aboutsummaryrefslogtreecommitdiffstats
path: root/test/openssl/test_x509ext.rb
diff options
context:
space:
mode:
authorrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-29 05:47:09 +0000
committerrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-29 05:47:09 +0000
commitc9dc0164b8ad1cb23faf6120749bcc349a7bfd45 (patch)
tree831281099f54c0be80293785761a46688a0711f3 /test/openssl/test_x509ext.rb
parent28bf4d545fb7674fcdc99c93ba7476d320551d11 (diff)
downloadruby-c9dc0164b8ad1cb23faf6120749bcc349a7bfd45.tar.gz
import Ruby/OpenSSL 2.0.0.beta.1
* NEWS, {ext,test,sample}/openssl: Import Ruby/OpenSSL 2.0.0.beta.1. ext/openssl is now converted into a default gem. The full commit history since r55538 can be found at: https://github.com/ruby/openssl/compare/08e1881f5663...v2.0.0.beta.1 [Feature #9612] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl/test_x509ext.rb')
-rw-r--r--test/openssl/test_x509ext.rb30
1 files changed, 21 insertions, 9 deletions
diff --git a/test/openssl/test_x509ext.rb b/test/openssl/test_x509ext.rb
index 99e2eda5b3..79713c0fad 100644
--- a/test/openssl/test_x509ext.rb
+++ b/test/openssl/test_x509ext.rb
@@ -36,15 +36,15 @@ class OpenSSL::TestX509Extension < OpenSSL::TestCase
bc = ef.create_extension("basicConstraints", "CA:TRUE, pathlen:2", true)
assert_equal(@basic_constraints.to_der, bc.to_der)
- begin
- ef.config = OpenSSL::Config.parse(<<-_end_of_cnf_)
- [crlDistPts]
- URI.1 = http://www.example.com/crl
- URI.2 = ldap://ldap.example.com/cn=ca?certificateRevocationList;binary
- _end_of_cnf_
- rescue NotImplementedError
- return
- end
+ ef.config = OpenSSL::Config.parse(<<-_end_of_cnf_)
+ [crlDistPts]
+ URI.1 = http://www.example.com/crl
+ URI.2 = ldap://ldap.example.com/cn=ca?certificateRevocationList;binary
+
+ [certPolicies]
+ policyIdentifier = 2.23.140.1.2.1
+ CPS.1 = http://cps.example.com
+ _end_of_cnf_
cdp = ef.create_extension("crlDistributionPoints", "@crlDistPts")
assert_equal(false, cdp.critical?)
@@ -61,6 +61,18 @@ class OpenSSL::TestX509Extension < OpenSSL::TestCase
assert_match(
%r{URI:ldap://ldap.example.com/cn=ca\?certificateRevocationList;binary},
cdp.value)
+
+ cp = ef.create_extension("certificatePolicies", "@certPolicies")
+ assert_equal(false, cp.critical?)
+ assert_equal("certificatePolicies", cp.oid)
+ assert_match(%r{2.23.140.1.2.1}, cp.value)
+ assert_match(%r{http://cps.example.com}, cp.value)
+ end
+
+ def test_dup
+ ext = OpenSSL::X509::Extension.new(@basic_constraints.to_der)
+ assert_equal(@basic_constraints.to_der, ext.to_der)
+ assert_equal(ext.to_der, ext.dup.to_der)
end
end