File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,15 @@ def test_new
15
15
assert_raise ( OpenSSL ::X509 ::CertificateError ) { cert . public_key }
16
16
end
17
17
18
+ def test_new_from_java_bytes # was historically supported through the StringHelper.readInput fallback
19
+ cert = File . read ( File . expand_path ( 'ca.crt' , File . dirname ( __FILE__ ) ) )
20
+ fact = java . security . cert . CertificateFactory . getInstance ( "X.509" )
21
+ java_cert = fact . generateCertificate ( java . io . ByteArrayInputStream . new ( cert . to_java_bytes ) ) # X509Certificate
22
+ cert = OpenSSL ::X509 ::Certificate . new ( java_cert . getEncoded ) # byte[]
23
+ assert_equal java_cert . getSerialNumber , cert . serial . to_java
24
+ assert_equal java_cert . getPublicKey , cert . public_key . to_java
25
+ end
26
+
18
27
def test_alt_name_extension
19
28
cert = OpenSSL ::X509 ::Certificate . new
20
29
cert . add_extension OpenSSL ::
X509 ::
Extension . new ( 'subjectAltName' , 'email:[email protected] , IP:127.0.0.1' , false )
You can’t perform that action at this time.
0 commit comments