Skip to content

Commit

Permalink
x509ext: test OpenSSL::X509::ExtensionFactory#create_ext with ln
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rhenium committed Aug 31, 2023
1 parent 5394dd5 commit b690949
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/openssl/test_x509ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def test_create_by_factory
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)
Expand Down

0 comments on commit b690949

Please sign in to comment.