diff options
| author | Steven Fackler <[email protected]> | 2016-11-06 23:19:58 -0800 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-11-06 23:19:58 -0800 |
| commit | 8f7df7b2057bc31dfc3d6a2b83ee83116a8eb93a (patch) | |
| tree | b8fb935fe784fc1b7a14c23308309d09c3c206ba /openssl/src/x509/tests.rs | |
| parent | More extension progress (diff) | |
| download | rust-openssl-8f7df7b2057bc31dfc3d6a2b83ee83116a8eb93a.tar.xz rust-openssl-8f7df7b2057bc31dfc3d6a2b83ee83116a8eb93a.zip | |
Add SubjectAlternativeName
Diffstat (limited to 'openssl/src/x509/tests.rs')
| -rw-r--r-- | openssl/src/x509/tests.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/openssl/src/x509/tests.rs b/openssl/src/x509/tests.rs index a1ab6de5..510bb437 100644 --- a/openssl/src/x509/tests.rs +++ b/openssl/src/x509/tests.rs @@ -7,7 +7,7 @@ use pkey::PKey; use rsa::Rsa; use x509::{X509, X509Generator, X509Name}; use x509::extension::{Extension, BasicConstraints, KeyUsage, ExtendedKeyUsage, - SubjectKeyIdentifier, AuthorityKeyIdentifier}; + SubjectKeyIdentifier, AuthorityKeyIdentifier, SubjectAlternativeName}; use x509::extension::AltNameOption as SAN; use x509::extension::KeyUsageOption::{DigitalSignature, KeyEncipherment}; use x509::extension::ExtKeyUsageOption::{self, ClientAuth, ServerAuth}; @@ -217,6 +217,11 @@ fn x509_builder() { .build(&builder.x509v3_context(None, None)) .unwrap(); builder.append_extension(authority_key_identifier).unwrap(); + let subject_alternative_name = SubjectAlternativeName::new() + .dns("example.com") + .build(&builder.x509v3_context(None, None)) + .unwrap(); + builder.append_extension(subject_alternative_name).unwrap(); builder.sign(&pkey, MessageDigest::sha256()).unwrap(); |