diff options
| author | Steven Fackler <[email protected]> | 2016-04-29 21:15:32 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-04-29 21:15:32 -0700 |
| commit | 32722e18501b06fbd51a8871f8bea0cddb4b132c (patch) | |
| tree | a80964967a6aa180eabb05fc7ac8058476592fe9 /openssl/src/x509/tests.rs | |
| parent | Start on GeneralName (diff) | |
| download | rust-openssl-32722e18501b06fbd51a8871f8bea0cddb4b132c.tar.xz rust-openssl-32722e18501b06fbd51a8871f8bea0cddb4b132c.zip | |
Add accessors for x509 subject alt names
Diffstat (limited to 'openssl/src/x509/tests.rs')
| -rw-r--r-- | openssl/src/x509/tests.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/openssl/src/x509/tests.rs b/openssl/src/x509/tests.rs index 69ad37f8..5f4d432e 100644 --- a/openssl/src/x509/tests.rs +++ b/openssl/src/x509/tests.rs @@ -157,3 +157,15 @@ fn test_nid_uid_value() { }; assert_eq!(&cn as &str, "this is the userId"); } + +#[test] +fn test_subject_alt_name() { + let mut file = File::open("test/alt_name_cert.pem").unwrap(); + let cert = X509::from_pem(&mut file).unwrap(); + + let subject_alt_names = cert.subject_alt_names().unwrap(); + assert_eq!(3, subject_alt_names.len()); + assert_eq!(Some("foobar.com"), subject_alt_names.get(0).dns()); + assert_eq!(subject_alt_names.get(1).ipadd(), Some(&[127, 0, 0, 1][..])); + assert_eq!(subject_alt_names.get(2).ipadd(), Some(&b"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"[..])); +} |