diff options
| author | Joe Wilm <[email protected]> | 2016-02-02 09:25:52 -0800 |
|---|---|---|
| committer | Joe Wilm <[email protected]> | 2016-02-02 09:25:52 -0800 |
| commit | 4940ca7e9292ab04f473ebb017272a50b0d79fbc (patch) | |
| tree | 010571d026f2d5a4574d3a107ae8fe49635c6ac2 /openssl/src/x509/tests.rs | |
| parent | Merge pull request #348 from Hywan/patch-1 (diff) | |
| download | rust-openssl-4940ca7e9292ab04f473ebb017272a50b0d79fbc.tar.xz rust-openssl-4940ca7e9292ab04f473ebb017272a50b0d79fbc.zip | |
Fix Nid::UID value
Nid::UID (userId) previously held the value of Nid::uid
(uniqueIdentifier).
Diffstat (limited to 'openssl/src/x509/tests.rs')
| -rw-r--r-- | openssl/src/x509/tests.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/openssl/src/x509/tests.rs b/openssl/src/x509/tests.rs index 35690e05..dbca8b98 100644 --- a/openssl/src/x509/tests.rs +++ b/openssl/src/x509/tests.rs @@ -140,3 +140,20 @@ fn test_nid_values() { }; assert_eq!(&friendly as &str, "Example"); } + +#[test] +fn test_nid_uid_value() { + let cert_path = Path::new("test/nid_uid_test_cert.pem"); + let mut file = File::open(&cert_path) + .ok() + .expect("Failed to open `test/nid_uid_test_cert.pem`"); + + let cert = X509::from_pem(&mut file).ok().expect("Failed to load PEM"); + let subject = cert.subject_name(); + + let cn = match subject.text_by_nid(Nid::UID) { + Some(x) => x, + None => panic!("Failed to read UID from cert"), + }; + assert_eq!(&cn as &str, "this is the userId"); +} |