Skip to content
Merged
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
46 changes: 46 additions & 0 deletions pkcs7/tests/content_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,49 @@ fn decode_signed_scep_example() {
_ => panic!("expected ContentInfo::SignedData(Some(_))"),
}
}

// TODO(tarcieri): BER support
#[test]
#[ignore]
fn decode_signed_ber() {
let bytes = include_bytes!("examples/cms_ber.bin");

let content = match ContentInfo::from_der(bytes) {
Ok(ContentInfo::SignedData(Some(data))) => data,
other => panic!("unexpected result: {:?}", other),
};

assert_eq!(
content
.encap_content_info
.e_content
.unwrap()
.decode_as::<OctetStringRef>()
.unwrap()
.as_bytes()
.len(),
10034
);
}

#[test]
fn decode_signed_der() {
let bytes = include_bytes!("examples/cms_der.bin");

let content = match ContentInfo::from_der(bytes) {
Ok(ContentInfo::SignedData(Some(data))) => data,
other => panic!("unexpected result: {:?}", other),
};

assert_eq!(
content
.encap_content_info
.e_content
.unwrap()
.decode_as::<OctetStringRef>()
.unwrap()
.as_bytes()
.len(),
10034
);
}
Binary file added pkcs7/tests/examples/cms_ber.bin
Binary file not shown.
Binary file added pkcs7/tests/examples/cms_der.bin
Binary file not shown.