[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
This commit is contained in:
Kazuki Yamaguchi 2023-08-31 14:12:57 +09:00 committed by Hiroshi SHIBATA
parent 9b6128c541
commit 98d8f6128e

View File

@ -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)