diff --git a/Cargo.toml b/Cargo.toml index 1b33bec2..0cb12abc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,3 +11,8 @@ members = [ ] default-members = ["xbuild"] exclude = ["examples"] + +[workspace.dependencies] +rasn = "0.17.3" +rasn-cms = "0.17.3" +rasn-pkix = "0.17.3" diff --git a/apk/Cargo.toml b/apk/Cargo.toml index 520e3b0e..95f6a8e8 100644 --- a/apk/Cargo.toml +++ b/apk/Cargo.toml @@ -10,8 +10,8 @@ license = "Apache-2.0 OR MIT" anyhow = "1.0.68" byteorder = "1.4.3" quick-xml = { version = "0.26.0", features = ["serialize"] } -rasn = "0.6.1" -rasn-pkix = "0.6.0" +rasn.workspace = true +rasn-pkix.workspace = true roxmltree = "0.16.0" rsa = "0.7.2" serde = { version = "1.0.151", features = ["derive"] } diff --git a/appbundle/Cargo.toml b/appbundle/Cargo.toml index 80d0c8e2..e473d853 100644 --- a/appbundle/Cargo.toml +++ b/appbundle/Cargo.toml @@ -13,8 +13,8 @@ icns = "0.3.1" log = "0.4.17" pkcs8 = "0.9.0" plist = "1.3.1" -rasn = "0.6.1" -rasn-cms = "0.6.0" +rasn.workspace = true +rasn-cms.workspace = true serde = { version = "1.0.151", features = ["derive"] } x509-certificate = "0.16.0" xcommon = { version = "0.3.0", path = "../xcommon" } diff --git a/msix/Cargo.toml b/msix/Cargo.toml index 466bb5a7..1ea1c286 100644 --- a/msix/Cargo.toml +++ b/msix/Cargo.toml @@ -12,9 +12,9 @@ base64 = "0.20.0" byteorder = "1.4.3" mime_guess = "2.0.4" quick-xml = { version = "0.26.0", features = ["serialize"] } -rasn = "0.6.1" -rasn-cms = "0.6.0" -rasn-pkix = "0.6.0" +rasn.workspace = true +rasn-cms.workspace = true +rasn-pkix.workspace = true serde = { version = "1.0.151", features = ["derive"] } sha2 = "0.10.6" xcommon = { version = "0.3.0", path = "../xcommon" } diff --git a/msix/src/p7x.rs b/msix/src/p7x.rs index 55ff0f91..ef9c106d 100644 --- a/msix/src/p7x.rs +++ b/msix/src/p7x.rs @@ -31,7 +31,7 @@ pub fn p7x(signer: &Signer, digests: &Digests) -> Vec { let payload = Payload::encode(digests); let encap_content_info = EncapsulatedContentInfo { content_type: SPC_INDIRECT_DATA_OBJID.into(), - content: Any::new(payload), + content: Some(Any::new(payload)), }; let signed_data = build_pkcs7(signer, encap_content_info); let content_info = ContentInfo { diff --git a/msix/src/pkcs7.rs b/msix/src/pkcs7.rs index ddb2fe8f..68224b74 100644 --- a/msix/src/pkcs7.rs +++ b/msix/src/pkcs7.rs @@ -6,14 +6,15 @@ use rasn_pkix::Attribute; use sha2::{Digest, Sha256}; use std::collections::BTreeSet; -pub const SPC_INDIRECT_DATA_OBJID: ConstOid = ConstOid(&[1, 3, 6, 1, 4, 1, 311, 2, 1, 4]); -pub const SPC_SP_OPUS_INFO_OBJID: ConstOid = ConstOid(&[1, 3, 6, 1, 4, 1, 311, 2, 1, 12]); -pub const SPC_SIPINFO_OBJID: ConstOid = ConstOid(&[1, 3, 6, 1, 4, 1, 311, 2, 1, 30]); +pub const SPC_INDIRECT_DATA_OBJID: &Oid = Oid::const_new(&[1, 3, 6, 1, 4, 1, 311, 2, 1, 4]); +pub const SPC_SP_OPUS_INFO_OBJID: &Oid = Oid::const_new(&[1, 3, 6, 1, 4, 1, 311, 2, 1, 12]); +pub const SPC_SIPINFO_OBJID: &Oid = Oid::const_new(&[1, 3, 6, 1, 4, 1, 311, 2, 1, 30]); #[allow(clippy::mutable_key_type)] pub fn build_pkcs7(signer: &Signer, encap_content_info: EncapsulatedContentInfo) -> SignedData { - let digest = Sha256::digest(&encap_content_info.content.as_bytes()[8..]); - let signature = signer.sign(&encap_content_info.content.as_bytes()[8..]); + let content = encap_content_info.content.as_ref().unwrap().as_bytes(); + let digest = Sha256::digest(&content[8..]); + let signature = signer.sign(&content[8..]); let cert = signer.cert(); let digest_algorithm = AlgorithmIdentifier { diff --git a/xcommon/Cargo.toml b/xcommon/Cargo.toml index 4d725d7d..2acabd7b 100644 --- a/xcommon/Cargo.toml +++ b/xcommon/Cargo.toml @@ -12,8 +12,8 @@ byteorder = "1.4.3" dunce = "1" image = { version = "0.24.5", default-features = false, features = ["png", "webp"] } pem = "1.1.0" -rasn = "0.6.1" -rasn-pkix = "0.6.0" +rasn.workspace = true +rasn-pkix.workspace = true rsa = "0.7.2" sha2 = { version = "0.10.6", features = ["oid"] } zip = { version = "0.6.3", default-features = false, features = ["deflate"] }