diff options
author | Kazuki Yamaguchi <[email protected]> | 2023-08-31 14:12:57 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2023-09-06 19:28:47 +0900 |
commit | 98d8f6128e7f8378bf6e34b5c12fae9bdd6d3f10 (patch) | |
tree | c7588b22ec4db0268134fc2a56d34296fe5b1ed8 | |
parent | 9b6128c541386d6e375723bb9eb4161854d72112 (diff) |
[ruby/openssl] x509ext: test OpenSSL::X509::ExtensionFactory#create_ext with ln
OpenSSL::X509::ExtensionFactory#create_ext and #create_extensions
accepts both sn (short names) and ln (long names) for registered OIDs.
This is different from the behavior of the openssl command-line utility
which accepts only sn in openssl.cnf keys.
Add a test case to check this.
https://github.com/ruby/openssl/commit/91ae46c8d7
-rw-r--r-- | test/openssl/test_x509ext.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/openssl/test_x509ext.rb b/test/openssl/test_x509ext.rb index 7ad010d1ed..c04c06574f 100644 --- a/test/openssl/test_x509ext.rb +++ b/test/openssl/test_x509ext.rb @@ -70,6 +70,14 @@ class OpenSSL::TestX509Extension < OpenSSL::TestCase assert_match(%r{http://cps.example.com}, cp.value) end + def test_factory_create_extension_sn_ln + ef = OpenSSL::X509::ExtensionFactory.new + bc_sn = ef.create_extension("basicConstraints", "critical, CA:TRUE, pathlen:2") + bc_ln = ef.create_extension("X509v3 Basic Constraints", "critical, CA:TRUE, pathlen:2") + assert_equal(@basic_constraints.to_der, bc_sn.to_der) + assert_equal(@basic_constraints.to_der, bc_ln.to_der) + end + def test_dup ext = OpenSSL::X509::Extension.new(@basic_constraints.to_der) assert_equal(@basic_constraints.to_der, ext.to_der) |