Skip to content

Commit 94fb342

Browse files
committed
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.
1 parent 7c34a43 commit 94fb342

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/openssl/test_x509ext.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ def test_create_by_factory
7070
assert_match(%r{http://cps.example.com}, cp.value)
7171
end
7272

73+
def test_factory_create_extension_sn_ln
74+
ef = OpenSSL::X509::ExtensionFactory.new
75+
bc_sn = ef.create_extension("basicConstraints", "critical, CA:TRUE, pathlen:2")
76+
bc_ln = ef.create_extension("X509v3 Basic Constraints", "critical, CA:TRUE, pathlen:2")
77+
assert_equal(@basic_constraints.to_der, bc_sn.to_der)
78+
assert_equal(@basic_constraints.to_der, bc_ln.to_der)
79+
end
80+
7381
def test_dup
7482
ext = OpenSSL::X509::Extension.new(@basic_constraints.to_der)
7583
assert_equal(@basic_constraints.to_der, ext.to_der)

0 commit comments

Comments
 (0)