diff options
| author | Steven Fackler <[email protected]> | 2017-01-03 15:31:03 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-01-03 15:31:03 -0800 |
| commit | 0897c196e12627ef8e5eca99bada9027dfe9baaa (patch) | |
| tree | 55b26cc538b35c712eca27f20e00d0fe1cc58b6e /openssl/src/x509/tests.rs | |
| parent | Merge pull request #541 from bluejekyll/master (diff) | |
| parent | Add X509::stack_from_pem (diff) | |
| download | rust-openssl-0897c196e12627ef8e5eca99bada9027dfe9baaa.tar.xz rust-openssl-0897c196e12627ef8e5eca99bada9027dfe9baaa.zip | |
Merge pull request #547 from sfackler/x509-stack
Add X509::stack_from_pem
Diffstat (limited to 'openssl/src/x509/tests.rs')
| -rw-r--r-- | openssl/src/x509/tests.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/openssl/src/x509/tests.rs b/openssl/src/x509/tests.rs index 16ad661d..0843b19f 100644 --- a/openssl/src/x509/tests.rs +++ b/openssl/src/x509/tests.rs @@ -1,4 +1,4 @@ -use hex::FromHex; +use hex::{FromHex, ToHex}; use hash::MessageDigest; use pkey::PKey; @@ -174,3 +174,15 @@ fn test_subject_alt_name_iter() { Some(&b"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"[..])); assert!(subject_alt_names_iter.next().is_none()); } + +#[test] +fn test_stack_from_pem() { + let certs = include_bytes!("../../test/certs.pem"); + let certs = X509::stack_from_pem(certs).unwrap(); + + assert_eq!(certs.len(), 2); + assert_eq!(certs[0].fingerprint(MessageDigest::sha1()).unwrap().to_hex(), + "59172d9313e84459bcff27f967e79e6e9217e584"); + assert_eq!(certs[1].fingerprint(MessageDigest::sha1()).unwrap().to_hex(), + "c0cbdf7cdd03c9773e5468e1f6d2da7d5cbb1875"); +} |