jruby-openssl 0.7.5.dev → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +44 -14
- data/Manifest.txt +135 -80
- data/Rakefile +14 -6
- data/lib/{openssl.rb → 1.8/openssl.rb} +2 -11
- data/lib/{openssl → 1.8/openssl}/bn.rb +2 -2
- data/lib/{openssl → 1.8/openssl}/buffering.rb +3 -1
- data/lib/{openssl → 1.8/openssl}/cipher.rb +0 -0
- data/lib/{openssl → 1.8/openssl}/config.rb +1 -1
- data/lib/{openssl → 1.8/openssl}/digest.rb +2 -2
- data/lib/{openssl → 1.8/openssl}/pkcs7.rb +0 -0
- data/lib/{openssl/ssl.rb → 1.8/openssl/ssl-internal.rb} +2 -2
- data/lib/1.8/openssl/ssl.rb +1 -0
- data/lib/{openssl/x509.rb → 1.8/openssl/x509-internal.rb} +8 -9
- data/lib/1.8/openssl/x509.rb +1 -0
- data/lib/1.9/openssl.rb +22 -0
- data/lib/1.9/openssl/bn.rb +35 -0
- data/lib/1.9/openssl/buffering.rb +448 -0
- data/lib/1.9/openssl/cipher.rb +65 -0
- data/lib/1.9/openssl/config.rb +313 -0
- data/lib/1.9/openssl/digest.rb +72 -0
- data/lib/1.9/openssl/ssl-internal.rb +177 -0
- data/lib/1.9/openssl/ssl.rb +2 -0
- data/lib/1.9/openssl/x509-internal.rb +158 -0
- data/lib/1.9/openssl/x509.rb +2 -0
- data/lib/{jopenssl.jar → shared/jopenssl.jar} +0 -0
- data/lib/{jopenssl → shared/jopenssl}/version.rb +1 -1
- data/lib/shared/openssl.rb +18 -0
- data/lib/{openssl → shared/openssl}/dummy.rb +0 -0
- data/lib/{openssl → shared/openssl}/dummyssl.rb +0 -0
- data/lib/shared/openssl/ssl.rb +1 -0
- data/lib/shared/openssl/x509.rb +1 -0
- data/test/{openssl → 1.8}/ssl_server.rb +0 -0
- data/test/{openssl → 1.8}/test_asn1.rb +15 -0
- data/test/{openssl → 1.8}/test_cipher.rb +0 -0
- data/test/{openssl → 1.8}/test_config.rb +0 -0
- data/test/{openssl → 1.8}/test_digest.rb +0 -0
- data/test/{openssl → 1.8}/test_ec.rb +0 -0
- data/test/{openssl → 1.8}/test_hmac.rb +0 -0
- data/test/{openssl → 1.8}/test_ns_spki.rb +0 -0
- data/test/{openssl → 1.8}/test_pair.rb +10 -2
- data/test/{openssl → 1.8}/test_pkcs7.rb +0 -0
- data/test/{openssl → 1.8}/test_pkey_rsa.rb +0 -0
- data/test/{openssl → 1.8}/test_ssl.rb +17 -20
- data/test/{openssl → 1.8}/test_x509cert.rb +0 -0
- data/test/{openssl → 1.8}/test_x509crl.rb +0 -0
- data/test/{openssl → 1.8}/test_x509ext.rb +0 -0
- data/test/{openssl → 1.8}/test_x509name.rb +0 -0
- data/test/{openssl → 1.8}/test_x509req.rb +0 -0
- data/test/{openssl → 1.8}/test_x509store.rb +0 -0
- data/test/{openssl → 1.8}/utils.rb +0 -0
- data/test/1.9/ssl_server.rb +81 -0
- data/test/1.9/test_asn1.rb +589 -0
- data/test/1.9/test_bn.rb +23 -0
- data/test/1.9/test_buffering.rb +88 -0
- data/test/1.9/test_cipher.rb +107 -0
- data/test/1.9/test_config.rb +288 -0
- data/test/1.9/test_digest.rb +118 -0
- data/test/1.9/test_engine.rb +15 -0
- data/test/1.9/test_hmac.rb +32 -0
- data/test/1.9/test_ns_spki.rb +50 -0
- data/test/1.9/test_ocsp.rb +47 -0
- data/test/1.9/test_pair.rb +257 -0
- data/test/1.9/test_pkcs12.rb +209 -0
- data/test/1.9/test_pkcs7.rb +151 -0
- data/test/1.9/test_pkey_dh.rb +72 -0
- data/test/1.9/test_pkey_dsa.rb +224 -0
- data/test/1.9/test_pkey_ec.rb +182 -0
- data/test/1.9/test_pkey_rsa.rb +244 -0
- data/test/1.9/test_ssl.rb +455 -0
- data/test/1.9/test_ssl_session.rb +327 -0
- data/test/1.9/test_x509cert.rb +217 -0
- data/test/1.9/test_x509crl.rb +221 -0
- data/test/1.9/test_x509ext.rb +69 -0
- data/test/1.9/test_x509name.rb +296 -0
- data/test/1.9/test_x509req.rb +150 -0
- data/test/1.9/test_x509store.rb +229 -0
- data/test/1.9/utils.rb +304 -0
- data/test/fixture/purpose/ca/ca_config.rb +1 -1
- data/test/fixture/purpose/ca/gen_cert.rb +128 -0
- data/test/fixture/purpose/ca/newcerts/4_cert.pem +19 -0
- data/test/fixture/purpose/ca/serial +1 -1
- data/test/fixture/purpose/sslserver_no_dsig_in_keyUsage.pem +19 -0
- data/test/ruby/envutil.rb +208 -0
- data/test/ruby/ut_eof.rb +128 -0
- data/test/test_java.rb +1 -1
- data/test/test_openssl.rb +1 -1
- data/test/test_pkcs7.rb +16 -0
- data/test/test_pkey_dsa.rb +180 -0
- data/test/test_pkey_rsa.rb +298 -0
- data/test/test_ssl.rb +1 -1
- data/test/test_x509store.rb +8 -0
- metadata +121 -75
- data/test/test_pkey.rb +0 -204
data/test/test_java.rb
CHANGED
data/test/test_openssl.rb
CHANGED
data/test/test_pkcs7.rb
CHANGED
@@ -37,4 +37,20 @@ END
|
|
37
37
|
p7 = OpenSSL::PKCS7.encrypt(certs, msg, cipher, OpenSSL::PKCS7::BINARY)
|
38
38
|
assert_equal(msg, p7.data)
|
39
39
|
end
|
40
|
+
|
41
|
+
EMPTY_PEM = <<END
|
42
|
+
-----BEGIN PKCS7-----
|
43
|
+
MAMGAQA=
|
44
|
+
-----END PKCS7-----
|
45
|
+
END
|
46
|
+
|
47
|
+
def test_empty_pkcs7
|
48
|
+
p7 = OpenSSL::PKCS7.new
|
49
|
+
assert_equal(EMPTY_PEM, p7.to_pem)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_load_empty_pkcs7
|
53
|
+
p7 = OpenSSL::PKCS7.new(EMPTY_PEM)
|
54
|
+
assert_equal(EMPTY_PEM, p7.to_pem)
|
55
|
+
end
|
40
56
|
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
require "openssl"
|
2
|
+
require "test/unit"
|
3
|
+
|
4
|
+
class TestPKeyDSA < Test::Unit::TestCase
|
5
|
+
def test_can_generate_dsa_key
|
6
|
+
OpenSSL::PKey::DSA.generate(512)
|
7
|
+
end
|
8
|
+
|
9
|
+
# jruby-openssl/0.6 causes NPE
|
10
|
+
def test_generate_pkey_dsa_empty
|
11
|
+
assert_nothing_raised do
|
12
|
+
OpenSSL::PKey::DSA.new.to_pem
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# jruby-openssl/0.6 ignores fixnum arg => to_pem returned 65 bytes with 'MAA='
|
17
|
+
def test_generate_pkey_dsa_length
|
18
|
+
assert(OpenSSL::PKey::DSA.new(512).to_pem.size > 100)
|
19
|
+
end
|
20
|
+
|
21
|
+
# jruby-openssl/0.6 returns nil for DSA#to_text
|
22
|
+
def test_generate_pkey_dsa_to_text
|
23
|
+
assert_match(
|
24
|
+
/Private-Key: \(512 bit\)/,
|
25
|
+
OpenSSL::PKey::DSA.new(512).to_text
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_load_pkey_dsa
|
30
|
+
pkey = OpenSSL::PKey::DSA.new(512)
|
31
|
+
assert_equal(pkey.to_pem, OpenSSL::PKey::DSA.new(pkey.to_pem).to_pem)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_load_pkey_dsa_public
|
35
|
+
pkey = OpenSSL::PKey::DSA.new(512).public_key
|
36
|
+
assert_equal(pkey.to_pem, OpenSSL::PKey::DSA.new(pkey.to_pem).to_pem)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_load_pkey_dsa_der
|
40
|
+
pkey = OpenSSL::PKey::DSA.new(512)
|
41
|
+
assert_equal(pkey.to_der, OpenSSL::PKey::DSA.new(pkey.to_der).to_der)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_load_pkey_dsa_public_der
|
45
|
+
pkey = OpenSSL::PKey::DSA.new(512).public_key
|
46
|
+
assert_equal(pkey.to_der, OpenSSL::PKey::DSA.new(pkey.to_der).to_der)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_load_pkey_dsa_net_ssh
|
50
|
+
blob = "0\201\367\002\001\000\002A\000\203\316/\037u\272&J\265\003l3\315d\324h\372{\t8\252#\331_\026\006\035\270\266\255\343\353Z\302\276\335\336\306\220\375\202L\244\244J\206>\346\b\315\211\302L\246x\247u\a\376\366\345\302\016#\002\025\000\244\274\302\221Og\275/\302+\356\346\360\024\373wI\2573\361\002@\027\215\270r*\f\213\350C\245\021:\350 \006\\\376\345\022`\210b\262\3643\023XLKS\320\370\002\276\347A\nU\204\276\324\256`=\026\240\330\306J\316V\213\024\e\030\215\355\006\037q\337\356ln\002@\017\257\034\f\260\333'S\271#\237\230E\321\312\027\021\226\331\251Vj\220\305\316\036\v\266+\000\230\270\177B\003?t\a\305]e\344\261\334\023\253\323\251\223M\2175)a(\004\"lI8\312\303\307\a\002\024_\aznW\345\343\203V\326\246ua\203\376\201o\350\302\002"
|
51
|
+
pkey = OpenSSL::PKey::DSA.new(blob)
|
52
|
+
assert_equal(blob, pkey.to_der)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_load_dsa_des_encrypted
|
56
|
+
password = 'pass'
|
57
|
+
pkey = OpenSSL::PKey::DSA.generate(512)
|
58
|
+
cipher = OpenSSL::Cipher::Cipher.new('des-cbc')
|
59
|
+
pem = pkey.to_pem(cipher, password)
|
60
|
+
assert_equal(pkey.g, OpenSSL::PKey::DSA.new(pem, password).g)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_load_dsa_3des_encrypted
|
64
|
+
password = 'pass'
|
65
|
+
pkey = OpenSSL::PKey::DSA.generate(512)
|
66
|
+
cipher = OpenSSL::Cipher::Cipher.new('des-ede3-cbc')
|
67
|
+
pem = pkey.to_pem(cipher, password)
|
68
|
+
assert_equal(pkey.g, OpenSSL::PKey::DSA.new(pem, password).g)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_load_dsa_aes_encrypted
|
72
|
+
password = 'pass'
|
73
|
+
pkey = OpenSSL::PKey::DSA.generate(512)
|
74
|
+
cipher = OpenSSL::Cipher::Cipher.new('aes-128-cbc')
|
75
|
+
pem = pkey.to_pem(cipher, password)
|
76
|
+
assert_equal(pkey.g, OpenSSL::PKey::DSA.new(pem, password).g)
|
77
|
+
end
|
78
|
+
|
79
|
+
CRUBY_DES_DSA_PEM = <<END
|
80
|
+
-----BEGIN DSA PRIVATE KEY-----
|
81
|
+
Proc-Type: 4,ENCRYPTED
|
82
|
+
DEK-Info: DES-CBC,55669A6757B8752A
|
83
|
+
|
84
|
+
0DI84kfjNWOmckdBhvraem9LZqx++JRAD0fUB7J2ymLLMKS2wFq32AA3XD6K9kNP
|
85
|
+
Ud1idm0UMtJjxFFtT02ue7USlaSHIb+INbf4m5N/I54cOoMXXdOEFeecWlmDhfMP
|
86
|
+
zSA/6zM1L0iUKXaR30yRtslwZpGi3ZlriLkL6HbZFjBRUk93AL01oVHHIW3OPqLq
|
87
|
+
Mql0jpr9VDLi1OjkIbrRilZKHTx/C7DCeBfwhPS3KUhkyGTqQzTwa6TpA5fiL0vy
|
88
|
+
OXwDr9GqZCUq5sk3Psu+2yrI+dbzUFh+va+0p2EzVnOb7p6oyIhXTyyeqZVy+KRz
|
89
|
+
qK2rRxrZmQv9hJ59G1kJ/A==
|
90
|
+
-----END DSA PRIVATE KEY-----
|
91
|
+
END
|
92
|
+
|
93
|
+
JRUBY_DES_DSA_PEM = <<END
|
94
|
+
-----BEGIN DSA PRIVATE KEY-----
|
95
|
+
Proc-Type: 4,ENCRYPTED
|
96
|
+
DEK-Info: DES-CBC,06b4e0b42bf90db9
|
97
|
+
|
98
|
+
mroGVjL7pb1BSJDtaksk3If8XidwLgv0DJsQcmwG8gc55eBxF65TDmAFZlc1vAp8
|
99
|
+
YlkQx84ZCWufiTlWzeZR/giEPeps0nbzkaNN4tWOEN3ILF7TKfaqFdtJgEwLXMJ8
|
100
|
+
3L5jLZDsESmXpGY51RGp7LXYENoS1WwnJ+ke9kBty/IpFVUYyRtRZ2wpoFqWKfjV
|
101
|
+
rAlYqJLme+PQL1SXoPl3HOMr7NcjaEr9yYeq8mPCAg8YEW1ckyH0Z6j9ZK0spdtM
|
102
|
+
Cam9mftFK1gC4wqZbCSM3bRCrqiVfMr8uWIIZVpBwm1skYh8+yLlG1m0xhTcmMEq
|
103
|
+
Vo/ZKPN3/eLMl2nx5Td8ew==
|
104
|
+
-----END DSA PRIVATE KEY-----
|
105
|
+
END
|
106
|
+
|
107
|
+
CRUBY_3DES_DSA_PEM = <<END
|
108
|
+
-----BEGIN DSA PRIVATE KEY-----
|
109
|
+
Proc-Type: 4,ENCRYPTED
|
110
|
+
DEK-Info: DES-EDE3-CBC,75267DEE9DB19A15
|
111
|
+
|
112
|
+
rWX5EyFJ4n64oHadHhSKmW/wJWTeoA5K/CxdlAzh9sGzNtbJB1qevd7iV3HouQiZ
|
113
|
+
iGeA0b8tJWI8NJZFjYsQyNZgFemnpQ/Nz0kYXR/z0TpJzMHepyDn+3n7WBupRM+J
|
114
|
+
aEmgwSJSiwEDYDInscdIdTNW/zfXt8+wKf72rttV8ocTAHkIbBew1YFQK+hM2OZ5
|
115
|
+
MubNrFaiSwTJisGU0Vc5sAcaq60ZyfI730LN1QSA9FRWn/O8od3O+Ri7w8K2qRXV
|
116
|
+
R/z33GsXqt1dkaQVwH4yFUaUect/fgXfuijZaJrBY7ZT9oBPxsBrAxVIATf2bfQY
|
117
|
+
Vk30SWL9mazMmDcgjD32hg==
|
118
|
+
-----END DSA PRIVATE KEY-----
|
119
|
+
END
|
120
|
+
|
121
|
+
JRUBY_3DES_DSA_PEM = <<END
|
122
|
+
-----BEGIN DSA PRIVATE KEY-----
|
123
|
+
Proc-Type: 4,ENCRYPTED
|
124
|
+
DEK-Info: DES-EDE3-CBC,d795fb005ae84cd7
|
125
|
+
|
126
|
+
iSSWTjX84CqfaBGlds7NNBDNaAIvnbv6WI8uh2Mv4KJ5PLvpAAb2bxQUNLCAHlvP
|
127
|
+
gqWdUbNvC9IVGNfE9exYdW/1bevp9wjcjv6dK+1dH9H+WxFqZtnsuH0fOw5EWrXY
|
128
|
+
+yB0SQQo44UVqy/w+2SbYrYEQ/MAA4ebYqd8ubdi3qFoSjfuUnh/vdAakePqM82a
|
129
|
+
Vb4w35j7ihXr/RrtbP+bCW5rVHPUCKOvBy9XD0UG8wtEQH0wUmJnELWoWM6/xLS8
|
130
|
+
rFBX3EOYR2nItP5XQyHO49RRT3vzLY04cCYIa5/LhBBRbCSWi6oQaydxq6/buGff
|
131
|
+
z//DKy1e6FpeUIFgyjkldQ==
|
132
|
+
-----END DSA PRIVATE KEY-----
|
133
|
+
END
|
134
|
+
|
135
|
+
CRUBY_AES_DSA_PEM = <<END
|
136
|
+
-----BEGIN DSA PRIVATE KEY-----
|
137
|
+
Proc-Type: 4,ENCRYPTED
|
138
|
+
DEK-Info: AES-128-CBC,5F8642885141BB27B7D10E089006BF22
|
139
|
+
|
140
|
+
aBYZIZw67pJFf8voJK2PH6dT2npXL2sGgG4NStgrClAowFF3o0v+p7eAzKwIsfex
|
141
|
+
LSE60JAPtD/ooqGDoGkJqT3VXncpNw0B9dR3l2Z2j79ZCNuH64z8PnQKDCLjIVKj
|
142
|
+
yhqUsifokc/s7Vd96uaIfR8z3S3go+/96gbIr6p34FLD6N2Pi06t0XrN70msURaX
|
143
|
+
Q84edbPto/5Zl8zjVFuV+nvGidozytJ1b6txzyatKeCBQO8doZHihXpW32iyUkJ8
|
144
|
+
1H0047SzKhswP7Xxwob7ukcrPcn2ehPG3+bXC1w7J47jsIi6ihvHKMl6KfgPwVgu
|
145
|
+
a8/ecsqcdOGUXmtRJ2l3dw==
|
146
|
+
-----END DSA PRIVATE KEY-----
|
147
|
+
END
|
148
|
+
|
149
|
+
JRUBY_AES_DSA_PEM = <<END
|
150
|
+
-----BEGIN DSA PRIVATE KEY-----
|
151
|
+
Proc-Type: 4,ENCRYPTED
|
152
|
+
DEK-Info: AES-128-CBC,2327f11cbbaaf0a5f9ec992ae04677b1
|
153
|
+
|
154
|
+
YSG7L3SO9/Z+IgDSGf30oXaqUlwc+/AzKeMfqBCxs0qGP2lMELfHnwz/mwxlbepP
|
155
|
+
W4zDqgTV88Fvg8PpQVsFamrEWjIy2Bldztc+8Aj8ndBON3vqDkSDk9/FIVFnKCsQ
|
156
|
+
xXR/6ixhFVwBsWGJeGSM1PRPcX74JLBbUlY0vzZPk/uUcg7dQO/oGskOlBo/oLnS
|
157
|
+
xVXLvRo2CR+3ydHE9iF+y4Y/66f7uccbIAyUDgaurZLf/3MRihAydlkEUQriK88Q
|
158
|
+
z1fEb60qcDl8N4bQD2HOILUyPcwvT7OZsn01HmfwxtxMvMsfeIO2NnUUqmpCXawW
|
159
|
+
Cj7lDxD1ioXbyqmJyucyVg==
|
160
|
+
-----END DSA PRIVATE KEY-----
|
161
|
+
END
|
162
|
+
|
163
|
+
def test_load_dsa_des_encrypted_compat
|
164
|
+
password = 'pass'
|
165
|
+
assert_equal(2601835381435922300807529879321911722473209798319079426284347845245761126085714618755566626587428986614532580618831696049079493874672683842235950274336046, OpenSSL::PKey::DSA.new(CRUBY_DES_DSA_PEM, password).g)
|
166
|
+
assert_equal(5421644057436475141609648488325705128047428394380474376834667300766108262613900542681289080713724597310673074119355136085795982097390670890367185141189796, OpenSSL::PKey::DSA.new(JRUBY_DES_DSA_PEM, password).g)
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_load_dsa_3des_encrypted_compat
|
170
|
+
password = 'pass'
|
171
|
+
assert_equal(9936878837924433385259546254653845785685748445545516924244160189763997725813126701147586419234217178553350132394993861862023343427937351327849016782576411, OpenSSL::PKey::DSA.new(CRUBY_3DES_DSA_PEM, password).g)
|
172
|
+
assert_equal(5421644057436475141609648488325705128047428394380474376834667300766108262613900542681289080713724597310673074119355136085795982097390670890367185141189796, OpenSSL::PKey::DSA.new(JRUBY_3DES_DSA_PEM, password).g)
|
173
|
+
end
|
174
|
+
|
175
|
+
def test_load_dsa_aes_encrypted_compat
|
176
|
+
password = 'pass'
|
177
|
+
assert_equal(4237872605088828155551665609293446566126489611054397621156235339811966387210852049465706387691172976146024902239923506580469901654107741400464080284215372, OpenSSL::PKey::DSA.new(CRUBY_AES_DSA_PEM, password).g)
|
178
|
+
assert_equal(5421644057436475141609648488325705128047428394380474376834667300766108262613900542681289080713724597310673074119355136085795982097390670890367185141189796, OpenSSL::PKey::DSA.new(JRUBY_AES_DSA_PEM, password).g)
|
179
|
+
end
|
180
|
+
end
|
@@ -0,0 +1,298 @@
|
|
1
|
+
require "openssl"
|
2
|
+
require "test/unit"
|
3
|
+
|
4
|
+
class TestPKeyRSA < Test::Unit::TestCase
|
5
|
+
def test_has_correct_methods
|
6
|
+
pkey_methods = OpenSSL::PKey::PKey.instance_methods(false).sort.map(&:intern) - [:initialize]
|
7
|
+
assert_equal [:sign, :verify], pkey_methods
|
8
|
+
|
9
|
+
rsa_methods = OpenSSL::PKey::RSA.instance_methods(false).sort.map(&:intern) - [:initialize]
|
10
|
+
assert_equal [:d, :d=, :dmp1, :dmp1=, :dmq1, :dmq1=, :e, :e=, :export, :iqmp, :iqmp=, :n, :n=, :p, :p=, :params, :private?, :private_decrypt, :private_encrypt, :public?, :public_decrypt, :public_encrypt, :public_key, :q, :q=, :to_der, :to_pem, :to_s, :to_text], rsa_methods
|
11
|
+
|
12
|
+
assert_equal [:generate], OpenSSL::PKey::RSA.methods(false).map(&:intern)
|
13
|
+
end
|
14
|
+
|
15
|
+
#iqmp == coefficient
|
16
|
+
#e == public exponent
|
17
|
+
#n == modulus
|
18
|
+
#d == private exponent
|
19
|
+
#p == prime1
|
20
|
+
#q == prime2
|
21
|
+
#dmq1 == exponent2
|
22
|
+
#dmp1 == exponent1
|
23
|
+
|
24
|
+
def test_can_generate_rsa_key
|
25
|
+
OpenSSL::PKey::RSA.generate(512)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_malformed_rsa_handling
|
29
|
+
pem = <<__EOP__
|
30
|
+
-----BEGIN PUBLIC KEY-----
|
31
|
+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtiU1/UMzIQ1On9OlZGoV
|
32
|
+
S0yySFYWoXLH12nmP69fg9jwdRbQlb0rxLn7zATbwfqcvGpCcW+8SmdwW74elNrc
|
33
|
+
wRtbKjJKfbJCsVfDssbbj6BF+Bcq3ihi8+CGNXFdJOYhZZ+5Adg2Qc9Qp3Ubw9wu
|
34
|
+
/3Ai87+1aQxoZPMFwdX2BRiZvxch9dwHVyL8EuFGUOYId/8JQepHyZMbTqp/8wlA
|
35
|
+
UAbMcPW+IKp3N0WMgred3CjXKHAqqM0Ira9RLSXdlO2uFV4OrM0ak8rnTN5w1DsI
|
36
|
+
McjvVvOck0aIxfHEEmeadt3YMn4PCW33/j8geulZLvt0ci60/OWMSCcIqByITlvY
|
37
|
+
DwIDAQAB
|
38
|
+
-----END PUBLIC KEY-----
|
39
|
+
__EOP__
|
40
|
+
pkey = OpenSSL::PKey::RSA.new(pem)
|
41
|
+
# jruby-openssl/0.6 raises NativeException
|
42
|
+
assert_raise(OpenSSL::PKey::RSAError, 'JRUBY-4492') do
|
43
|
+
pkey.public_decrypt("rah")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# http://github.com/jruby/jruby-openssl/issues#issue/1
|
48
|
+
def test_load_pkey_rsa
|
49
|
+
pem = <<__EOP__
|
50
|
+
-----BEGIN PRIVATE KEY-----
|
51
|
+
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALRiMLAh9iimur8V
|
52
|
+
A7qVvdqxevEuUkW4K+2KdMXmnQbG9Aa7k7eBjK1S+0LYmVjPKlJGNXHDGuy5Fw/d
|
53
|
+
7rjVJ0BLB+ubPK8iA/Tw3hLQgXMRRGRXXCn8ikfuQfjUS1uZSatdLB81mydBETlJ
|
54
|
+
hI6GH4twrbDJCR2Bwy/XWXgqgGRzAgMBAAECgYBYWVtleUzavkbrPjy0T5FMou8H
|
55
|
+
X9u2AC2ry8vD/l7cqedtwMPp9k7TubgNFo+NGvKsl2ynyprOZR1xjQ7WgrgVB+mm
|
56
|
+
uScOM/5HVceFuGRDhYTCObE+y1kxRloNYXnx3ei1zbeYLPCHdhxRYW7T0qcynNmw
|
57
|
+
rn05/KO2RLjgQNalsQJBANeA3Q4Nugqy4QBUCEC09SqylT2K9FrrItqL2QKc9v0Z
|
58
|
+
zO2uwllCbg0dwpVuYPYXYvikNHHg+aCWF+VXsb9rpPsCQQDWR9TT4ORdzoj+Nccn
|
59
|
+
qkMsDmzt0EfNaAOwHOmVJ2RVBspPcxt5iN4HI7HNeG6U5YsFBb+/GZbgfBT3kpNG
|
60
|
+
WPTpAkBI+gFhjfJvRw38n3g/+UeAkwMI2TJQS4n8+hid0uus3/zOjDySH3XHCUno
|
61
|
+
cn1xOJAyZODBo47E+67R4jV1/gzbAkEAklJaspRPXP877NssM5nAZMU0/O/NGCZ+
|
62
|
+
3jPgDUno6WbJn5cqm8MqWhW1xGkImgRk+fkDBquiq4gPiT898jusgQJAd5Zrr6Q8
|
63
|
+
AO/0isr/3aa6O6NLQxISLKcPDk2NOccAfS/xOtfOz4sJYM3+Bs4Io9+dZGSDCA54
|
64
|
+
Lw03eHTNQghS0A==
|
65
|
+
-----END PRIVATE KEY-----
|
66
|
+
__EOP__
|
67
|
+
assert_nothing_raised do
|
68
|
+
pkey = OpenSSL::PKey::RSA.new(pem)
|
69
|
+
pkey2 = OpenSSL::PKey::RSA.new(pkey.to_pem)
|
70
|
+
assert_equal(pkey.n, pkey2.n)
|
71
|
+
assert_equal(pkey.e, pkey2.e)
|
72
|
+
assert_equal(pkey.d, pkey2.d)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_load_pkey_rsa_enc
|
77
|
+
# password is '1234'
|
78
|
+
pem = <<__EOP__
|
79
|
+
-----BEGIN ENCRYPTED PRIVATE KEY-----
|
80
|
+
MIICoTAbBgkqhkiG9w0BBQMwDgQIfvehP6JEg2wCAggABIICgD7kzSr+xWgdAuzG
|
81
|
+
cYNkCEWyKF6V0cJ58AKSoL4FQ59OQvQP/hMnSZEMiUpeGNRE6efC7O02RUjNarIk
|
82
|
+
ciCYIBqd5EFG3OSypK5l777AbCChIkzZHbyE/pIbadr8ZX9C4pkwzPqS0Avzavxi
|
83
|
+
5s1WDX2GggJkBcQUijqG9QuOZcOvoYbojHPT4tdJq+J6s+0LFas9Jp3a6dYkxtgv
|
84
|
+
u8Z6EFDZoLGOSVy/jCSMuZAnhoOxUCYqd9FFo2jryV7tQ/CaYAUApAQFTLgBA9qk
|
85
|
+
4WmyKRpwzIx6EG1pkqulvPXJCcTat9YwllEDVuQ2rKVwDepSl9O7X170Kx1sBecz
|
86
|
+
mGcfqviU9xwP5mkXO/TLoTZExkHF08Y3d/PTMdxGEDZH37/yRqCIb3Uyqv/jLibM
|
87
|
+
/s9fm52aWsfO1ndHEhciovlMJvGXq3+e+9gmq1w2TyNQahRc5fwfhwWKhPKfYDBk
|
88
|
+
7AtjPGfELDX61WZ5m+4Kb70BcGSAEgXCaBydVsMROy0B8jkYgtAnVBb4EMrGOsCG
|
89
|
+
jmNeW9MRIhrhDcifdyq1DMNg7IONMF+5mDdQ3FhK6WzlFU+8cTN517qA8L3A3+ZX
|
90
|
+
asiS+rx5/50InINknjuvVkmTGMzjl89nMNrZCjhx9sIDfXQ3ZKFmh1mvnXq/fLan
|
91
|
+
CgXn/UtLoykrSlobgqIxZslhj3p01kMCgGe62S3kokYrDTQEc57rlKWWR3Xyjy/T
|
92
|
+
LsecXAKEROj95IHSMMnT4jl+TJnbvGKQ2U9tOOB3W+OOOlDEFE59pQlcmQPAwdzr
|
93
|
+
mzI4kupi3QRTFjOgvX29leII9sPtpr4dKMKVIRxKnvMZhUAkS/n3+Szfa6zKexLa
|
94
|
+
4CHVgDo=
|
95
|
+
-----END ENCRYPTED PRIVATE KEY-----
|
96
|
+
__EOP__
|
97
|
+
assert_nothing_raised do
|
98
|
+
pkey = OpenSSL::PKey::RSA.new(pem, '1234')
|
99
|
+
pkey2 = OpenSSL::PKey::RSA.new(pkey.to_pem)
|
100
|
+
assert_equal(pkey.n, pkey2.n)
|
101
|
+
assert_equal(pkey.e, pkey2.e)
|
102
|
+
assert_equal(pkey.d, pkey2.d)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# jruby-openssl/0.6 causes NPE
|
107
|
+
def test_generate_pkey_rsa_empty
|
108
|
+
assert_nothing_raised do
|
109
|
+
OpenSSL::PKey::RSA.new.to_pem
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_generate_pkey_rsa_length
|
114
|
+
assert_nothing_raised do
|
115
|
+
OpenSSL::PKey::RSA.new(512).to_pem
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_generate_pkey_rsa_to_text
|
120
|
+
assert_match(
|
121
|
+
/Private-Key: \(512 bit\)/,
|
122
|
+
OpenSSL::PKey::RSA.new(512).to_text
|
123
|
+
)
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_load_pkey_rsa
|
127
|
+
pkey = OpenSSL::PKey::RSA.new(512)
|
128
|
+
assert_equal(pkey.to_pem, OpenSSL::PKey::RSA.new(pkey.to_pem).to_pem)
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_load_pkey_rsa_public
|
132
|
+
pkey = OpenSSL::PKey::RSA.new(512).public_key
|
133
|
+
assert_equal(pkey.to_pem, OpenSSL::PKey::RSA.new(pkey.to_pem).to_pem)
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_load_pkey_rsa_der
|
137
|
+
pkey = OpenSSL::PKey::RSA.new(512)
|
138
|
+
assert_equal(pkey.to_der, OpenSSL::PKey::RSA.new(pkey.to_der).to_der)
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_load_pkey_rsa_public_der
|
142
|
+
pkey = OpenSSL::PKey::RSA.new(512).public_key
|
143
|
+
assert_equal(pkey.to_der, OpenSSL::PKey::RSA.new(pkey.to_der).to_der)
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_load_rsa_des_encrypted
|
147
|
+
password = 'pass'
|
148
|
+
pkey = OpenSSL::PKey::RSA.generate(1024)
|
149
|
+
cipher = OpenSSL::Cipher::Cipher.new('des-cbc')
|
150
|
+
pem = pkey.to_pem(cipher, password)
|
151
|
+
assert_equal(pkey.n, OpenSSL::PKey::RSA.new(pem, password).n)
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_load_rsa_3des_encrypted
|
155
|
+
password = 'pass'
|
156
|
+
pkey = OpenSSL::PKey::RSA.generate(1024)
|
157
|
+
cipher = OpenSSL::Cipher::Cipher.new('des-ede3-cbc')
|
158
|
+
pem = pkey.to_pem(cipher, password)
|
159
|
+
assert_equal(pkey.n, OpenSSL::PKey::RSA.new(pem, password).n)
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_load_rsa_aes_encrypted
|
163
|
+
password = 'pass'
|
164
|
+
pkey = OpenSSL::PKey::RSA.generate(1024)
|
165
|
+
cipher = OpenSSL::Cipher::Cipher.new('aes-128-cbc')
|
166
|
+
pem = pkey.to_pem(cipher, password)
|
167
|
+
assert_equal(pkey.n, OpenSSL::PKey::RSA.new(pem, password).n)
|
168
|
+
end
|
169
|
+
|
170
|
+
CRUBY_DES_RSA_PEM = <<END
|
171
|
+
-----BEGIN RSA PRIVATE KEY-----
|
172
|
+
Proc-Type: 4,ENCRYPTED
|
173
|
+
DEK-Info: DES-CBC,D22ABA5D7A345AAF
|
174
|
+
|
175
|
+
uSRJRBARry1L2DUZwdLkQ0JA4riJ9CWnsA+Y6M76dznyzJCLK/rLyQSLxZefVWVk
|
176
|
+
CzkRMhi4n4NrSS1hB7qUlphX6y67O5Rv/O0S4SYa3d87hDJKqNpR47gfj35efNUk
|
177
|
+
izIb4rHoVgolRNm/L4joChuIrKqHkQnkusNxp9wReuNT/B2qPbqqEGxiDCcv8jni
|
178
|
+
fq1ifvkJyTlEKnmrdml65fhjHHDuNENVAXVrsPsVJXI6kk7PahJk24rn29qPOAlJ
|
179
|
+
d+E6Q6YDgRM1MDrEQmaXFzNJi8Mco1712LjXIYH9+vkJ5GnXrIk8XrAmY2E4ERgQ
|
180
|
+
XdFx9J6Qncnjj/y18H9WilvoaN4hJiE22OqNI/PeK+nYeeYnxzu2qc2E5QVyjCqA
|
181
|
+
N2nTwx0ZtZRxFakP8CMyrVCn7BVYdIF3ISgX7RT+GwkujKwWAO0xrjkMc3y3Pv2R
|
182
|
+
9MG5PzeFe4EuuwkjN0rWB8ra4HCkaPxk
|
183
|
+
-----END RSA PRIVATE KEY-----
|
184
|
+
END
|
185
|
+
|
186
|
+
JRUBY_DES_RSA_PEM = <<END
|
187
|
+
-----BEGIN RSA PRIVATE KEY-----
|
188
|
+
Proc-Type: 4,ENCRYPTED
|
189
|
+
DEK-Info: DES-CBC,14f319c66f99b413
|
190
|
+
|
191
|
+
JTTxyeEPF9HcOyyLQ0Y+oO91RaVYIoqppxpfKaULXBZwHN8pGSrHFPliCgahgEEC
|
192
|
+
aF39H6/69KrEKw7h8XYKrFK+sinBYd975qWfspexmDHTyMcN7MPBPpbnV5Ha2z+m
|
193
|
+
weenO/2rAzsOxNa6dRBmdCyHYODJrSDq71h6W7255t79E4Tjr1u72/lHPVTO2r9a
|
194
|
+
sv0AhkfM5G95n+qamgNYOYjWODKFaSA6vN4sB08UQZBN7EJeE6Ouv5hw8E0uooLu
|
195
|
+
10iaBJUWkYF9v50+Z+cVd890VlUiQZihybQ8dETHtBtJ6moaMxBzQjkXjGJf6vd+
|
196
|
+
h0YPQOIg0YLwxg+aIC4L+Sh/11DrXSeb6j/7d0HfqGW060AC1b7crits71v2vEGe
|
197
|
+
+9kGgboShossQLoOuFicETEo5UgyhWfJ+ftvKM5DgYfsKJNsegSH9WwISFNWGSsY
|
198
|
+
njt38WTtkSxDQmm1G+VGfdfOIUQWohI9Prol2qodhsN6SvJgd0n9nVYi388bh1IR
|
199
|
+
23jnX9eayTrCm6Ff9EBVIroG8wVr0Qqme36o0GDtmCXtuBY9F3utr/8n03lTBuW7
|
200
|
+
E/Cx4XKlTtA7oBQjDz/ecbSGZXIROQmZh2f4wX6JeDhQH93InvM5DP7nN7qq+bxp
|
201
|
+
aZPRS3QFj0XlcF/QTI5r/GqT+DAWZ4ZXGtuKUg2yEjCNz6+r8xW9zOFSFos+773U
|
202
|
+
MVitdHtRLjfRVV6PT6VyThaHI56f6T9PC7KHgX8e/YcA8cAR0IoOjVsy1Xy0KWn7
|
203
|
+
CLxLcO6qbYRDyoFEpMrYq/O2beA1BH28BXnDkODbOje/lbvL9sSaHg==
|
204
|
+
-----END RSA PRIVATE KEY-----
|
205
|
+
END
|
206
|
+
|
207
|
+
CRUBY_3DES_RSA_PEM = <<END
|
208
|
+
-----BEGIN RSA PRIVATE KEY-----
|
209
|
+
Proc-Type: 4,ENCRYPTED
|
210
|
+
DEK-Info: DES-EDE3-CBC,F4E217EFFC0C21F0
|
211
|
+
|
212
|
+
KblUxUrSn2mJlzZUyZ/QBBWdhDkPwO4bzH6y6XxUmVEhv3DgiiWiOccQoE9s06Gt
|
213
|
+
LguPArk2W61DfksDH7ESeVd5syS+6LVmuVXePrXlef45flNwmdFHXgy+OVM9uLHT
|
214
|
+
y1AvHs6f3NLsDlf+ho8yoKgCTTBWf9lwAxw6EO9iKqUWY4ofRjSefiGxwhIW77Vc
|
215
|
+
MIktK9wMcZL9d8mINqQEY/Pz7pg70bLp3uZlljNFo6i8OA2SnitTOmU97dyknbee
|
216
|
+
+HDzrFFGdwsCg6nJdnjDsOXYeXDW2sul8g258ipUEVpkByWZ7Vy3vpAZKwO2dIrj
|
217
|
+
oEr/6glDvOKd7w2U5DIqmuWo5zvtCBu1taonyyaJKRoxsmJO9PTbDhz38WU3wcbf
|
218
|
+
9AQxDlMY//N5hSICrcnIaXsjMTxiJrERHLPjW+auYSRl7E9qKh4KqjDHsJ2/LyTE
|
219
|
+
dQ7IaJwE9xygO1hVHLJze1pZs+xHsxdR
|
220
|
+
-----END RSA PRIVATE KEY-----
|
221
|
+
END
|
222
|
+
|
223
|
+
JRUBY_3DES_RSA_PEM = <<END
|
224
|
+
-----BEGIN RSA PRIVATE KEY-----
|
225
|
+
Proc-Type: 4,ENCRYPTED
|
226
|
+
DEK-Info: DES-EDE3-CBC,102c5e7fdd051c1a
|
227
|
+
|
228
|
+
u19K4AySBL8KAM9DSLsSJSuxtKLQgmPiawpPRBpYjMITxw2NQtpZMYJKLZOtx/uU
|
229
|
+
kVjbwzJhhr51ciBF2HztLLvrpmh9xPybLZFh4Ew7/yMMOir+GyO3G8pf3sL5roAA
|
230
|
+
+sR4VERTiK6KWdblZQCYOmyJDiffjWBfzSz6MlLdjjTZr+NBQ6d0vGFGdLE1662Y
|
231
|
+
XpjcG6nw3fpUhdTXhXJDYneSBD30P6sfSxzPY0G7TLNU6vv9qlaeZ3nksfY/2Li1
|
232
|
+
aOSzrYtZe9+uzqAd9KxNNO7Eya3GAgdhErwVQGIU/cmtNybYdeaEhOtd80Vx8qY0
|
233
|
+
l9Lz/FtKdbxxoSAFhpRupRY2cFC80LJ2e9hp+TRkYp2k9a9UuPMrTYmK6GoYsPRC
|
234
|
+
SqnL9xIlCrByxhQ3vJaogSseAFlFmLxb+E61cQxCHfc5oBM9XY3e60Cirfsx/POG
|
235
|
+
xvTPXBLS1SuLybLh68wZDpLcqTFk0zG0oSchUt6x5JqK4OImKnI2VpXZ1H7j/rSU
|
236
|
+
ghUJvDcvAiMwiqep/81Ue9KIrP+ouluk81njjFTA636Dx23PdPq0dyBwi4iF+WOf
|
237
|
+
A4EhhISttdb+ZSmS9kPDYn2a79Qvds29yOgEB2OwKIstDzlBNO85CA+E3JbOndBq
|
238
|
+
+zpQklVLA+dWw0dTIbwI5xYKGb7HJJPOpBC0aWcnudr4rda2b2WIFPzH/PTAoIhJ
|
239
|
+
kBuwNoLBA38qh+T6Se66hLWzWyt3yPWaH81KW0WOaHW68LC572+qq7hrsOHp7ya6
|
240
|
+
C4/lMsQ5zUyRI0fwpnSJv1RjYemNJMV+oUiHFDKN5jQ=
|
241
|
+
-----END RSA PRIVATE KEY-----
|
242
|
+
END
|
243
|
+
|
244
|
+
CRUBY_AES_RSA_PEM = <<END
|
245
|
+
-----BEGIN RSA PRIVATE KEY-----
|
246
|
+
Proc-Type: 4,ENCRYPTED
|
247
|
+
DEK-Info: AES-128-CBC,E6FB0DECDE6009CF6EEE61885679905E
|
248
|
+
|
249
|
+
254YnHYZVo139fw1jbztY/v7BbaaCoYAMC27q6NF4k5Qocfe12HYWD/pgpe1YKbX
|
250
|
+
8fmfBhKFpjqTAr8emp0HOOw8VjfcaITiN4MvrnyhT7Ir4yjJjO5mUQVBZQha+i7P
|
251
|
+
CFTsuZhDF1iEkxkyVsHQ56iWT+SL7d0uvWW2eVNZ0L/vRVrdffNG1m+92xIm66Fj
|
252
|
+
0/fMudTSUYJvad2Isj64i1DWKxo6gfxgmukLCwj4DnmjVQvOH/VQT7nUe9oqxCuy
|
253
|
+
VUC+c2FAZgTr+2vSYdpPnU/u//DKjqvDgZHDkRIKDNNDv1yyVRY7giuOfFE9GqbE
|
254
|
+
wQTwaLdJYnu9I4HaS8tWCLHgNYRKbvNcTRX7CMxlV82ndn7aKoIDb/x8O5frObEF
|
255
|
+
2gMnv4H5mxrtHCJVk0ivQf3BgZWTdom/YEBr56RC8R/8y5dWsaGhIbXr9kNW0Lom
|
256
|
+
50oQToYBbM5ulLJxYXV3tA==
|
257
|
+
-----END RSA PRIVATE KEY-----
|
258
|
+
END
|
259
|
+
|
260
|
+
JRUBY_AES_RSA_PEM = <<END
|
261
|
+
-----BEGIN RSA PRIVATE KEY-----
|
262
|
+
Proc-Type: 4,ENCRYPTED
|
263
|
+
DEK-Info: AES-128-CBC,5c6a1d2d24302e15a23bb77483db3966
|
264
|
+
|
265
|
+
2IBvwJDEw3CkZVMp7/ML0qiozHqmkmkZ+XEe3YD8EV8te7rO7zRVNCW+NOxfqUhu
|
266
|
+
TrP5gXNLK2rUrhBairruFz6iXWndtkGs1o8LL2X+dCSRbFpkVOo6d7IEpRi5xJDJ
|
267
|
+
MK1LzWLb1I3EUxlEY/NkpfIaULxldix9QCXejqdlHyuRvDEO11HwT2AO1ND/Pir9
|
268
|
+
510nnDrBF0oGy/y9n5Quw/3F30CLyNUoQ+yb05unRt3MXQ40Qh4qIxE2bEsT5bPV
|
269
|
+
YHQ7Ls4ETxSyqVETpWfghAl2pipU2S6ZhCcPETnv6nfjC72uk/dFRuaMsve4IUTu
|
270
|
+
AnxZCKQ6ICaExlgUzY97lEIj3nJDY5PbDARqE1EQt24nS4wHq+5hrMumDLaiYcFu
|
271
|
+
QqfDYDXJiZt0gUYXlHwezNyv+iH4Y5xhko7fQn0yFhp4ud748zZJVYzULJCMGVWT
|
272
|
+
ObQ6I5JE2UoTeTHl/UfE3UYqKoBPnnElsJkTFzdql8zBS5PGAHgrF06Wg/jp9iCG
|
273
|
+
h0BXTnPw5jBVF8YF15F9oWt6hzLVrBfihTCi1+KxKPYDCoKUVGyeaSmCRTwu/Shp
|
274
|
+
WJpKokBtazrML5gXE2rTho3yHOpiwv/3HLLGKpVxBZk/w+quo5o1dQbuNcdVkXUy
|
275
|
+
uvMFYJGBMXhpFHxWOnrHe5EWmlergjbH6FtDnZ6q9mGKX3Zv0mj16rGTwaC8ojFJ
|
276
|
+
klvWNuzEyQRT2OJNbiJ+w8v4yF9nKcoNnWaLwsTXkdfrPkrUEyG03aNj5UVkJ8cq
|
277
|
+
jfdOf8b35frgdBJrFb1fNxXUDiOmHxBeffidJ7LEHD0zvh8yke9iqCRquRbQw4ua
|
278
|
+
-----END RSA PRIVATE KEY-----
|
279
|
+
END
|
280
|
+
|
281
|
+
def test_load_rsa_des_encrypted_compat
|
282
|
+
password = 'pass'
|
283
|
+
assert_equal(171121679472900958735046240032013822902814135418044632926746858725279957006460484359346082493980272450155346042705805047522822137075000873718614673206839485927470809962483274240113443184049955325778842883884472730809338103721103527723371013427831682847229398280665281140996554391864952366240593334371598093357, OpenSSL::PKey::RSA.new(CRUBY_DES_RSA_PEM, password).n)
|
284
|
+
assert_equal(95186390926176289293448721787465460008681849005943627766414746880750829275325362105354699806095724614833850511391997530422798534550053092884697848715098905298125981139872096315909555296044739053126836027629923201408465604387441696201951345435727705264545384652266958892017406564235498456780610723946372077161, OpenSSL::PKey::RSA.new(JRUBY_DES_RSA_PEM, password).n)
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_load_rsa_3des_encrypted_compat
|
288
|
+
password = 'pass'
|
289
|
+
assert_equal(159891081887610779337613110093558981667630640397086024796277575756132362092191306947719745882625669532365621381440788450544049011459945371880102089907577418294502920328095107337128188112059054500699255092076505828498357575128536918367005034864200777995404401769611478230798677758186716282278489076140546075717, OpenSSL::PKey::RSA.new(CRUBY_3DES_RSA_PEM, password).n)
|
290
|
+
assert_equal(132634270546428248975101416587398035596645524786882670408365466475894396526829329830349264854502825314377251520406282650983030314030180184335663605776194424399755874220996106852804569548140575796496611429489809370931661876941690628312711482612941088835232077828296662784479160183720585553373956579796213039707, OpenSSL::PKey::RSA.new(JRUBY_3DES_RSA_PEM, password).n)
|
291
|
+
end
|
292
|
+
|
293
|
+
def test_load_rsa_aes_encrypted_compat
|
294
|
+
password = 'pass'
|
295
|
+
assert_equal(152164605304862839347386799863418642272176047421496804966498177563653853015174053675480323318393334405555865282832768092329962715390636176200784476670180320842603832200246642618431746763085706624847469867394029459008113763032679106133646348160741974785288005086128311619599829066360227829804048705177001887963, OpenSSL::PKey::RSA.new(CRUBY_AES_RSA_PEM, password).n)
|
296
|
+
assert_equal(120124464337037052596736192517844019014106857114253451267066925743499301063116479220243836708739023567649536721432121286547319736881999977669587689339777273865695637895993003754843628769179367393259439036333237000420047538052601743699164582419555307462460610926941760286052729693393703143580060262101504625743, OpenSSL::PKey::RSA.new(JRUBY_AES_RSA_PEM, password).n)
|
297
|
+
end
|
298
|
+
end
|