Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions apk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 2 additions & 2 deletions appbundle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
6 changes: 3 additions & 3 deletions msix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion msix/src/p7x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn p7x(signer: &Signer, digests: &Digests) -> Vec<u8> {
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 {
Expand Down
11 changes: 6 additions & 5 deletions msix/src/pkcs7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions xcommon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }