summaryrefslogtreecommitdiff
path: root/test/openssl/test_x509ext.rb
diff options
context:
space:
mode:
authorMichael Richardson <mcr@sandelman.ca>2017-08-26 20:09:38 -0400
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-09-06 19:30:32 +0900
commit91e5f51607e38138045b67f80932f7a2a56f7d72 (patch)
tree2556e4176f11b3c37e6a56eef9f453aabff0b647 /test/openssl/test_x509ext.rb
parent98d8f6128e7f8378bf6e34b5c12fae9bdd6d3f10 (diff)
[ruby/openssl] x509ext: let X509::ExtensionFactory#create_ext take a dotted OID string
instead of looking of NIDs and then using X509V3_EXT_nconf_nid, instead just pass strings to X509V3_EXT_nconf, which has all the logic for processing dealing with generic extensions also process the oid through ln2nid() to retain compatibility. [rhe: tweaked commit message and added a test case] https://github.com/ruby/openssl/commit/9f15741331
Diffstat (limited to 'test/openssl/test_x509ext.rb')
-rw-r--r--test/openssl/test_x509ext.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/openssl/test_x509ext.rb b/test/openssl/test_x509ext.rb
index c04c06574f..838780d325 100644
--- a/test/openssl/test_x509ext.rb
+++ b/test/openssl/test_x509ext.rb
@@ -78,6 +78,17 @@ class OpenSSL::TestX509Extension < OpenSSL::TestCase
assert_equal(@basic_constraints.to_der, bc_ln.to_der)
end
+ def test_factory_create_extension_oid
+ ef = OpenSSL::X509::ExtensionFactory.new
+ ef.config = OpenSSL::Config.parse(<<~_end_of_cnf_)
+ [basic_constraints]
+ cA = BOOLEAN:TRUE
+ pathLenConstraint = INTEGER:2
+ _end_of_cnf_
+ bc_oid = ef.create_extension("2.5.29.19", "ASN1:SEQUENCE:basic_constraints", true)
+ assert_equal(@basic_constraints.to_der, bc_oid.to_der)
+ end
+
def test_dup
ext = OpenSSL::X509::Extension.new(@basic_constraints.to_der)
assert_equal(@basic_constraints.to_der, ext.to_der)