jruby-openssl 0.9.5-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/History.txt +218 -0
- data/License.txt +30 -0
- data/Mavenfile +44 -0
- data/README.txt +13 -0
- data/Rakefile +7 -0
- data/lib/jopenssl.jar +0 -0
- data/lib/jopenssl/load.rb +29 -0
- data/lib/jopenssl/version.rb +6 -0
- data/lib/jopenssl18/openssl.rb +23 -0
- data/lib/jopenssl18/openssl/bn.rb +35 -0
- data/lib/jopenssl18/openssl/buffering.rb +241 -0
- data/lib/jopenssl18/openssl/cipher.rb +65 -0
- data/lib/jopenssl18/openssl/config.rb +316 -0
- data/lib/jopenssl18/openssl/digest.rb +61 -0
- data/lib/jopenssl18/openssl/pkcs7.rb +25 -0
- data/lib/jopenssl18/openssl/ssl-internal.rb +179 -0
- data/lib/jopenssl18/openssl/ssl.rb +1 -0
- data/lib/jopenssl18/openssl/x509-internal.rb +153 -0
- data/lib/jopenssl18/openssl/x509.rb +1 -0
- data/lib/jopenssl19/openssl.rb +23 -0
- data/lib/jopenssl19/openssl/bn.rb +35 -0
- data/lib/jopenssl19/openssl/buffering.rb +449 -0
- data/lib/jopenssl19/openssl/cipher.rb +65 -0
- data/lib/jopenssl19/openssl/config.rb +313 -0
- data/lib/jopenssl19/openssl/digest.rb +72 -0
- data/lib/jopenssl19/openssl/ssl-internal.rb +177 -0
- data/lib/jopenssl19/openssl/ssl.rb +2 -0
- data/lib/jopenssl19/openssl/x509-internal.rb +158 -0
- data/lib/jopenssl19/openssl/x509.rb +2 -0
- data/lib/jopenssl21/openssl.rb +23 -0
- data/lib/jopenssl21/openssl/bn.rb +35 -0
- data/lib/jopenssl21/openssl/buffering.rb +449 -0
- data/lib/jopenssl21/openssl/cipher.rb +65 -0
- data/lib/jopenssl21/openssl/config.rb +313 -0
- data/lib/jopenssl21/openssl/digest.rb +89 -0
- data/lib/jopenssl21/openssl/ssl.rb +237 -0
- data/lib/jopenssl21/openssl/x509.rb +162 -0
- data/lib/jruby-openssl.rb +5 -0
- data/lib/openssl.rb +1 -0
- data/lib/openssl/bn.rb +7 -0
- data/lib/openssl/buffering.rb +7 -0
- data/lib/openssl/cipher.rb +7 -0
- data/lib/openssl/config.rb +7 -0
- data/lib/openssl/digest.rb +7 -0
- data/lib/openssl/pkcs12.rb +106 -0
- data/lib/openssl/pkcs7.rb +7 -0
- data/lib/openssl/ssl-internal.rb +7 -0
- data/lib/openssl/ssl.rb +7 -0
- data/lib/openssl/x509-internal.rb +7 -0
- data/lib/openssl/x509.rb +7 -0
- data/lib/org/bouncycastle/bcpkix-jdk15on/1.47/bcpkix-jdk15on-1.47.jar +0 -0
- data/lib/org/bouncycastle/bcprov-jdk15on/1.47/bcprov-jdk15on-1.47.jar +0 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 83b4b3bc5766a70b162d7fc27fc2f1ae6a1cc98d
|
4
|
+
data.tar.gz: 9b35fc5907f29cd2d46690e2b639429da44970e0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b59627e9a268c6942c5210cd0ccf28aca4ed1ca550fd72d8d8735c8d8dd735d3abea3b488799c98e34d1f9aed3986790a4e01abe0381c2884b4ace3e218234c
|
7
|
+
data.tar.gz: 7f72bdc6f8abad2b5d2ccccf858b6eb0531be0a6da2dc56774c74227dc6c6d9dd80f379ca3c693ac3b47236bda760a9bfb089230d7c860da8588b80d32b6ae0a
|
data/History.txt
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
== 0.7.7
|
2
|
+
|
3
|
+
This release includes bug fixes.
|
4
|
+
|
5
|
+
- JRUBY-6622: Support loading encrypted RSA key with PBES2
|
6
|
+
- JRUBY-4326: Confusing (and late) OpenSSL error message
|
7
|
+
- JRUBY-6579: Avoid ClassCastException for public key loading
|
8
|
+
- JRUBY-6515: sending UTF-8 data over SSL can hang with openssl
|
9
|
+
- Update tests to sync with CRuby ruby_1_9_3
|
10
|
+
|
11
|
+
== 0.7.6
|
12
|
+
|
13
|
+
This release includes initial implementation of PKCS12 by Owen Ou.
|
14
|
+
|
15
|
+
- JRUBY-5066: Implement OpenSSL::PKCS12 (only for simple case)
|
16
|
+
- JRUBY-6385: Assertion failure with -J-ea
|
17
|
+
|
18
|
+
== 0.7.5
|
19
|
+
|
20
|
+
This release improved 1.9 mode support with help of
|
21
|
+
Duncan Mak <duncan@earthaid.net>. Now jruby-ossl gem includes both 1.8 and 1.9
|
22
|
+
libraries and part of features should work fine on 1.9 mode, too.
|
23
|
+
|
24
|
+
- JRUBY-6270: Wrong keyUsage check for SSL server
|
25
|
+
- JRUBY-6260: OpenSSL::ASN1::Integer#value incompatibility
|
26
|
+
- JRUBY-6044: Improve Ecrypted RSA/DSA pem support
|
27
|
+
- JRUBY-5972: Allow to load/dump empty PKCS7 data
|
28
|
+
- JRUBY-5834: Fix X509Name handling; X509Name RDN can include multiple elements
|
29
|
+
- JRUBY-5362: Improved 1.9 support
|
30
|
+
- JRUBY-4992: Warn if loaded by non JRuby interpreter
|
31
|
+
|
32
|
+
== 0.7.4
|
33
|
+
|
34
|
+
- JRUBY-5519: Avoid String encoding dependency in DER loading. PEM loading
|
35
|
+
failed on JRuby 1.6.x. Fixed.
|
36
|
+
- JRUBY-5510: Add debug information to released jar
|
37
|
+
- JRUBY-5478: Update bouncycastle jars to the latest version. (1.46)
|
38
|
+
|
39
|
+
== 0.7.3
|
40
|
+
|
41
|
+
- JRUBY-5200: Net::IMAP + SSL(imaps) login could hang. Fixed.
|
42
|
+
- JRUBY-5253: Allow to load the certificate file which includes private
|
43
|
+
key for activemarchant compatibility.
|
44
|
+
- JRUBY-5267: Added SSL socket error-checks to avoid busy loop under an
|
45
|
+
unknown condition.
|
46
|
+
- JRUBY-5316: Improvements for J9's IBMJCE support. Now all testcases
|
47
|
+
pass on J9 JDK 6.
|
48
|
+
|
49
|
+
== 0.7.2
|
50
|
+
|
51
|
+
- JRUBY-5126: Ignore Cipher#reset and Cipher#iv= when it's a stream
|
52
|
+
cipher (Net::SSH compatibility)
|
53
|
+
- JRUBY-5125: let Cipher#name for 'rc4' to be 'RC4' (Net::SSH
|
54
|
+
compatibility)
|
55
|
+
- JRUBY-5096: Fixed inconsistent Certificate verification behavior
|
56
|
+
- JRUBY-5060: Avoid NPE from to_pem for empty X509 Objects
|
57
|
+
- JRUBY-5059: SSLSocket ignores Timeout (Fixed)
|
58
|
+
- JRUBY-4965: implemented OpenSSL::Config
|
59
|
+
- JRUBY-5023: make Certificate#signature_algorithm return correct algo
|
60
|
+
name; "sha1WithRSAEncryption" instead of "SHA1"
|
61
|
+
- JRUBY-5024: let HMAC.new accept a String as a digest name
|
62
|
+
- JRUBY-5018: SSLSocket holds selectors, keys, preventing quick
|
63
|
+
cleanup of resources when dereferenced
|
64
|
+
|
65
|
+
== 0.7.1
|
66
|
+
|
67
|
+
- NOTE: Now BouncyCastle jars has moved out to its own gem
|
68
|
+
"bouncy-castle-java" (http://rubygems.org/gems/bouncy-castle-java).
|
69
|
+
You don't need to care about it because "jruby-openssl" gem depends
|
70
|
+
on it from now on.
|
71
|
+
|
72
|
+
=== SSL bugfix
|
73
|
+
|
74
|
+
- JRUBY-4826 net/https client possibly raises "rbuf_fill': End of file
|
75
|
+
reached (EOFError)" for HTTP chunked read.
|
76
|
+
|
77
|
+
=== Misc
|
78
|
+
|
79
|
+
- JRUBY-4900: Set proper String to OpenSSL::OPENSSL_VERSION. Make sure
|
80
|
+
it's not an OpenSSL artifact: "OpenSSL 0.9.8b 04 May 2006
|
81
|
+
(JRuby-OpenSSL fake)" -> "jruby-ossl 0.7.1"
|
82
|
+
- JRUBY-4975: Moving BouncyCastle jars out to its own gem.
|
83
|
+
|
84
|
+
== 0.7
|
85
|
+
|
86
|
+
- Follow MRI 1.8.7 openssl API changes
|
87
|
+
- Fixes so that jruby-openssl can run on appengine
|
88
|
+
- Many bug and compatibility fixes, see below.
|
89
|
+
- This is the last release that will be compatible with JRuby 1.4.x.
|
90
|
+
- Compatibility issues
|
91
|
+
-- JRUBY-4342: Follow ruby-openssl of CRuby 1.8.7.
|
92
|
+
-- JRUBY-4346: Sync tests with tests for ruby-openssl of CRuby 1.8.7.
|
93
|
+
-- JRUBY-4444: OpenSSL crash running RubyGems tests
|
94
|
+
-- JRUBY-4075: Net::SSH gives OpenSSL::Cipher::CipherError "No message
|
95
|
+
available"
|
96
|
+
-- JRUBY-4076: Net::SSH padding error using 3des-cbc on Solaris
|
97
|
+
-- JRUBY-4541: jruby-openssl doesn't load on App Engine.
|
98
|
+
-- JRUBY-4077: Net::SSH "all authorization methods failed" Solaris -> Solaris
|
99
|
+
-- JRUBY-4535: Issues with the BouncyCastle provider
|
100
|
+
-- JRUBY-4510: JRuby-OpenSSL crashes when JCE fails a initialise bcprov
|
101
|
+
-- JRUBY-4343: Update BouncyCastle jar to upstream version; jdk14-139 ->
|
102
|
+
jdk15-144
|
103
|
+
- Cipher issues
|
104
|
+
-- JRUBY-4012: Initialization vector length handled differently than in MRI
|
105
|
+
(longer IV sequence are trimmed to fit the required)
|
106
|
+
-- JRUBY-4473: Implemented DSA key generation
|
107
|
+
-- JRUBY-4472: Cipher does not support RC4 and CAST
|
108
|
+
-- JRUBY-4577: InvalidParameterException 'Wrong keysize: must be equal to 112 or
|
109
|
+
168' for DES3 + SunJCE
|
110
|
+
- SSL and X.509(PKIX) issues
|
111
|
+
-- JRUBY-4384: TCP socket connection causes busy loop of SSL server
|
112
|
+
-- JRUBY-4370: Implement SSLContext#ciphers
|
113
|
+
-- JRUBY-4688: SSLContext#ciphers does not accept 'DEFAULT'
|
114
|
+
-- JRUBY-4357: SSLContext#{setup,ssl_version=} are not implemented
|
115
|
+
-- JRUBY-4397: SSLContext#extra_chain_cert and SSLContext#client_ca
|
116
|
+
-- JRUBY-4684: SSLContext#verify_depth is ignored
|
117
|
+
-- JRUBY-4398: SSLContext#options does not affect to SSL sessions
|
118
|
+
-- JRUBY-4360: Implement SSLSocket#verify_result and dependents
|
119
|
+
-- JRUBY-3829: SSLSocket#read should clear given buffer before concatenating
|
120
|
+
(ByteBuffer.java:328:in `allocate': java.lang.IllegalArgumentException when
|
121
|
+
returning SOAP queries over a certain size)
|
122
|
+
-- JRUBY-4686: SSLSocket can drop last chunk of data just before inbound channel
|
123
|
+
close
|
124
|
+
-- JRUBY-4369: X509Store#verify_callback is not called
|
125
|
+
-- JRUBY-4409: OpenSSL::X509::Store#add_file corrupts when it includes
|
126
|
+
certificates which have the same subject (problem with
|
127
|
+
ruby-openid-apps-discovery (github jruby-openssl issue #2))
|
128
|
+
-- JRUBY-4333: PKCS#8 formatted privkey read
|
129
|
+
-- JRUBY-4454: Loading Key file as a Certificate causes NPE
|
130
|
+
-- JRUBY-4455: calling X509::Certificate#sign for the Certificate initialized
|
131
|
+
from PEM causes IllegalStateException
|
132
|
+
- PKCS#7 issues
|
133
|
+
-- JRUBY-4379: PKCS7#sign failed for DES3 cipher algorithm
|
134
|
+
-- JRUBY-4428: Allow to use DES-EDE3-CBC in PKCS#7 w/o the Policy Files (rake
|
135
|
+
test doesn't finish on JDK5 w/o policy files update)
|
136
|
+
- Misc
|
137
|
+
-- JRUBY-4574: jruby-openssl deprecation warning cleanup
|
138
|
+
-- JRUBY-4591: jruby-1.4 support
|
139
|
+
|
140
|
+
== 0.6
|
141
|
+
|
142
|
+
- This is a recommended upgrade to jruby-openssl. A security problem
|
143
|
+
involving peer certificate verification was found where failed
|
144
|
+
verification silently did nothing, making affected applications
|
145
|
+
vulnerable to attackers. Attackers could lead a client application
|
146
|
+
to believe that a secure connection to a rogue SSL server is
|
147
|
+
legitimate. Attackers could also penetrate client-validated SSL
|
148
|
+
server applications with a dummy certificate. Your application would
|
149
|
+
be vulnerable if you're using the 'net/https' library with
|
150
|
+
OpenSSL::SSL::VERIFY_PEER mode and any version of jruby-openssl
|
151
|
+
prior to 0.6. Thanks to NaHi (NAKAMURA Hiroshi) for finding the
|
152
|
+
problem and providing the fix. See
|
153
|
+
http://www.jruby.org/2009/12/07/vulnerability-in-jruby-openssl.html
|
154
|
+
for details.
|
155
|
+
- This release addresses CVE-2009-4123 which was reserved for the
|
156
|
+
above vulnerability.
|
157
|
+
- Many fixes from NaHi, including issues related to certificate
|
158
|
+
verification and certificate store purpose verification.
|
159
|
+
- implement OpenSSL::X509::Store#set_default_paths
|
160
|
+
- MRI compat. fix: OpenSSL::X509::Store#add_file
|
161
|
+
- Fix nsCertType handling.
|
162
|
+
- Fix Cipher#key_len for DES-EDE3: 16 should be 24.
|
163
|
+
- Modified test expectations around Cipher#final.
|
164
|
+
- Public keys are lazily instantiated when the
|
165
|
+
X509::Certificate#public_key method is called (Dave Garcia)
|
166
|
+
|
167
|
+
== 0.5.2
|
168
|
+
|
169
|
+
* Multiple bugs fixed:
|
170
|
+
** JRUBY-3895 Could not verify server signature with net-ssh against Cygwin
|
171
|
+
** JRUBY-3864 jruby-openssl depends on Base64Coder from JvYAMLb
|
172
|
+
** JRUBY-3790 JRuby-OpenSSL test_post_connection_check is not passing
|
173
|
+
** JRUBY-3767 OpenSSL ssl implementation doesn't support client auth
|
174
|
+
** JRUBY-3673 jRuby-OpenSSL does not properly load certificate authority file
|
175
|
+
|
176
|
+
== 0.5.1
|
177
|
+
|
178
|
+
* Multiple fixes by Brice Figureau to get net/ssh working. Requires JRuby 1.3.1
|
179
|
+
to be 100%
|
180
|
+
* Fix by Frederic Jean for a character-decoding issue for some certificates
|
181
|
+
|
182
|
+
== 0.5
|
183
|
+
|
184
|
+
* Fixed JRUBY-3614: Unsupported HMAC algorithm (HMACSHA-256)
|
185
|
+
* Fixed JRUBY-3570: ActiveMerchant's AuthorizeNet Gateway throws OpenSSL Cert
|
186
|
+
Validation Error, when there should be no error
|
187
|
+
* Fixed JRUBY-3557 Class cast exception in PKeyRSA.java
|
188
|
+
* Fixed JRUBY-3468 X.509 certificates: subjectKeyIdentifier corrupted
|
189
|
+
* Fixed JRUBY-3285 Unsupported HMAC algorithm (HMACSHA1) error when generating
|
190
|
+
digest
|
191
|
+
* Misc code cleanup
|
192
|
+
|
193
|
+
== 0.2
|
194
|
+
|
195
|
+
- Enable remaining tests; fix a nil string issue in SSLSocket.sysread
|
196
|
+
(JRUBY-1888)
|
197
|
+
- Fix socket buffering issue by setting socket IO sync = true
|
198
|
+
- Fix bad file descriptor issue caused by unnecessary close (JRUBY-2152)
|
199
|
+
- Fix AES key length (JRUBY-2187)
|
200
|
+
- Fix cipher initialization (JRUBY-1100)
|
201
|
+
- Now, only compatible with JRuby 1.1
|
202
|
+
|
203
|
+
== 0.1.1
|
204
|
+
|
205
|
+
- Fixed blocker issue preventing HTTPS/SSL from working (JRUBY-1222)
|
206
|
+
|
207
|
+
== 0.1
|
208
|
+
|
209
|
+
- PLEASE NOTE: This release is not compatible with JRuby releases earlier than
|
210
|
+
1.0.3 or 1.1b2. If you must use JRuby 1.0.2 or earlier, please install the
|
211
|
+
0.6 release.
|
212
|
+
- Release coincides with JRuby 1.0.3 and JRuby 1.1b2 releases
|
213
|
+
- Simultaneous support for JRuby trunk and 1.0 branch
|
214
|
+
- Start of support for OpenSSL::BN
|
215
|
+
|
216
|
+
== 0.0.5 and prior
|
217
|
+
|
218
|
+
- Initial versions with maintenance updates
|
data/License.txt
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
JRuby-OpenSSL is distributed under the same license as JRuby (http://www.jruby.org/).
|
2
|
+
|
3
|
+
Version: EPL 1.0/GPL 2.0/LGPL 2.1
|
4
|
+
|
5
|
+
The contents of this file are subject to the Common Public
|
6
|
+
License Version 1.0 (the "License"); you may not use this file
|
7
|
+
except in compliance with the License. You may obtain a copy of
|
8
|
+
the License at http://www.eclipse.org/legal/cpl-v10.html
|
9
|
+
|
10
|
+
Software distributed under the License is distributed on an "AS
|
11
|
+
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
12
|
+
implied. See the License for the specific language governing
|
13
|
+
rights and limitations under the License.
|
14
|
+
|
15
|
+
Copyright (C) 2007 Ola Bini <ola.bini@gmail.com>
|
16
|
+
|
17
|
+
Alternatively, the contents of this file may be used under the terms of
|
18
|
+
either of the GNU General Public License Version 2 or later (the "GPL"),
|
19
|
+
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
20
|
+
in which case the provisions of the GPL or the LGPL are applicable instead
|
21
|
+
of those above. If you wish to allow use of your version of this file only
|
22
|
+
under the terms of either the GPL or the LGPL, and not to allow others to
|
23
|
+
use your version of this file under the terms of the EPL, indicate your
|
24
|
+
decision by deleting the provisions above and replace them with the notice
|
25
|
+
and other provisions required by the GPL or the LGPL. If you do not delete
|
26
|
+
the provisions above, a recipient may use your version of this file under
|
27
|
+
the terms of any one of the EPL, the GPL or the LGPL.
|
28
|
+
|
29
|
+
JRuby-OpenSSL includes software by the Legion of the Bouncy Castle
|
30
|
+
(http://bouncycastle.org/license.html).
|
data/Mavenfile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#-*- mode: ruby -*-
|
2
|
+
|
3
|
+
snapshot_repository :id => 'sonatype', :url => 'https://oss.sonatype.org/content/repositories/snapshots'
|
4
|
+
|
5
|
+
gemspec :jar => 'jopenssl', :include_jars => true
|
6
|
+
|
7
|
+
if model.version.to_s.match /[a-zA-Z]/
|
8
|
+
model.group_id = 'org.jruby.gems'
|
9
|
+
|
10
|
+
model.version = model.version + '-SNAPSHOT'
|
11
|
+
plugin :deploy do
|
12
|
+
execute_goals( :deploy,
|
13
|
+
:skip => false,
|
14
|
+
:altDeploymentRepository => 'sonatype-nexus-snapshots::default::https://oss.sonatype.org/content/repositories/snapshots/' )
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
plugin( :compiler, :target => '1.6', :source => '1.6', :debug => true, :verbose => false, :showWarnings => true, :showDeprecation => true )
|
19
|
+
|
20
|
+
jruby_plugin! :gem do
|
21
|
+
# avoid adding this not yet built openssl to the load_path
|
22
|
+
# when installing dependent gems
|
23
|
+
execute_goal :initialize, :lib => 'non-existing'
|
24
|
+
execute_goals :id => 'default-push', :skip => true
|
25
|
+
end
|
26
|
+
|
27
|
+
# you can use -Djruby.version=1.6.8 to pick a jruby version
|
28
|
+
# TODO use 1.6.8 and let the gem-maven-plugin pick the right version
|
29
|
+
properties 'jruby.version' => '1.7.12'
|
30
|
+
# we need the jruby API here, the version should be less important here
|
31
|
+
jar 'org.jruby:jruby-core', '${jruby.version}', :scope => :provided
|
32
|
+
# this artifact is needed to run the packaging at the end of the build
|
33
|
+
jar 'org.jruby:jruby-stdlib', '${jruby.version}', :scope => :provided
|
34
|
+
|
35
|
+
scope :test do
|
36
|
+
jar 'junit:junit:4.11'
|
37
|
+
end
|
38
|
+
|
39
|
+
properties( 'gem.home' => '../target/rubygems',
|
40
|
+
'gem.path' => '${gem.home}',
|
41
|
+
'tesla.dump.pom' => 'pom.xml',
|
42
|
+
'tesla.dump.readonly' => true )
|
43
|
+
|
44
|
+
# vim: syntax=Ruby
|
data/README.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
= JRuby-OpenSSL
|
2
|
+
|
3
|
+
* https://github.com/jruby/jruby/tree/master/maven/gems/jruby-openssl
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
JRuby-OpenSSL is an add-on gem for JRuby that emulates the Ruby OpenSSL native library.
|
8
|
+
|
9
|
+
Please report bugs and incompatibilities (preferably with testcases) to either the JRuby
|
10
|
+
mailing list [1] or the JRuby bug tracker [2].
|
11
|
+
|
12
|
+
[1]: http://xircles.codehaus.org/projects/jruby/lists
|
13
|
+
[2]: https://github.com/jruby/jruby/issues
|
data/Rakefile
ADDED
data/lib/jopenssl.jar
ADDED
Binary file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
unless defined? JRUBY_VERSION
|
2
|
+
warn 'Loading jruby-openssl in a non-JRuby interpreter'
|
3
|
+
end
|
4
|
+
|
5
|
+
require 'jopenssl/version'
|
6
|
+
begin
|
7
|
+
# if we have jar-dependencies we let it track the jars
|
8
|
+
require 'jar-dependencies'
|
9
|
+
require_jar( 'org.bouncycastle', 'bcpkix-jdk15on', Jopenssl::Version::BOUNCY_CASTLE_VERSION )
|
10
|
+
require_jar( 'org.bouncycastle', 'bcprov-jdk15on', Jopenssl::Version::BOUNCY_CASTLE_VERSION )
|
11
|
+
rescue LoadError
|
12
|
+
require "org/bouncycastle/bcpkix-jdk15on/#{Jopenssl::Version::BOUNCY_CASTLE_VERSION}/bcpkix-jdk15on-#{Jopenssl::Version::BOUNCY_CASTLE_VERSION}.jar"
|
13
|
+
require "org/bouncycastle/bcprov-jdk15on/#{Jopenssl::Version::BOUNCY_CASTLE_VERSION}/bcprov-jdk15on-#{Jopenssl::Version::BOUNCY_CASTLE_VERSION}.jar"
|
14
|
+
end
|
15
|
+
|
16
|
+
# Load extension
|
17
|
+
require 'jruby'
|
18
|
+
require 'jopenssl.jar'
|
19
|
+
org.jruby.ext.openssl.OSSLLibrary.new.load(JRuby.runtime, false)
|
20
|
+
|
21
|
+
if RUBY_VERSION >= '2.1.0'
|
22
|
+
load('jopenssl21/openssl.rb')
|
23
|
+
elsif RUBY_VERSION >= '1.9.0'
|
24
|
+
load('jopenssl19/openssl.rb')
|
25
|
+
else
|
26
|
+
load('jopenssl18/openssl.rb')
|
27
|
+
end
|
28
|
+
|
29
|
+
require 'openssl/pkcs12'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
=begin
|
2
|
+
= $RCSfile$ -- Loader for all OpenSSL C-space and Ruby-space definitions
|
3
|
+
|
4
|
+
= Info
|
5
|
+
'OpenSSL for Ruby 2' project
|
6
|
+
Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
7
|
+
All rights reserved.
|
8
|
+
|
9
|
+
= Licence
|
10
|
+
This program is licenced under the same licence as Ruby.
|
11
|
+
(See the file 'LICENCE'.)
|
12
|
+
|
13
|
+
= Version
|
14
|
+
$Id: openssl.rb 12496 2007-06-08 15:02:04Z technorama $
|
15
|
+
=end
|
16
|
+
|
17
|
+
require 'openssl/bn'
|
18
|
+
require 'openssl/cipher'
|
19
|
+
require 'openssl/config'
|
20
|
+
require 'openssl/digest'
|
21
|
+
require 'openssl/pkcs7'
|
22
|
+
require 'openssl/ssl-internal'
|
23
|
+
require 'openssl/x509-internal'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
=begin
|
2
|
+
= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for BN
|
3
|
+
|
4
|
+
= Info
|
5
|
+
'OpenSSL for Ruby 2' project
|
6
|
+
Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
7
|
+
All rights reserved.
|
8
|
+
|
9
|
+
= Licence
|
10
|
+
This program is licenced under the same licence as Ruby.
|
11
|
+
(See the file 'LICENCE'.)
|
12
|
+
|
13
|
+
= Version
|
14
|
+
$Id$
|
15
|
+
=end
|
16
|
+
|
17
|
+
##
|
18
|
+
# Should we care what if somebody require this file directly?
|
19
|
+
#require 'openssl'
|
20
|
+
|
21
|
+
module OpenSSL
|
22
|
+
class BN
|
23
|
+
include Comparable
|
24
|
+
end # BN
|
25
|
+
end # OpenSSL
|
26
|
+
|
27
|
+
##
|
28
|
+
# Add double dispatch to Integer
|
29
|
+
#
|
30
|
+
class Integer
|
31
|
+
def to_bn
|
32
|
+
OpenSSL::BN::new(self.to_s(16), 16)
|
33
|
+
end
|
34
|
+
end # Integer
|
35
|
+
|
@@ -0,0 +1,241 @@
|
|
1
|
+
=begin
|
2
|
+
= $RCSfile$ -- Buffering mix-in module.
|
3
|
+
|
4
|
+
= Info
|
5
|
+
'OpenSSL for Ruby 2' project
|
6
|
+
Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
|
7
|
+
All rights reserved.
|
8
|
+
|
9
|
+
= Licence
|
10
|
+
This program is licenced under the same licence as Ruby.
|
11
|
+
(See the file 'LICENCE'.)
|
12
|
+
|
13
|
+
= Version
|
14
|
+
$Id$
|
15
|
+
=end
|
16
|
+
|
17
|
+
module OpenSSL
|
18
|
+
module Buffering
|
19
|
+
include Enumerable
|
20
|
+
attr_accessor :sync
|
21
|
+
BLOCK_SIZE = 1024*16
|
22
|
+
|
23
|
+
def initialize(*args)
|
24
|
+
@eof = false
|
25
|
+
@rbuffer = ""
|
26
|
+
@sync = @io.sync
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# for reading.
|
31
|
+
#
|
32
|
+
private
|
33
|
+
|
34
|
+
def fill_rbuff
|
35
|
+
begin
|
36
|
+
@rbuffer << self.sysread(BLOCK_SIZE)
|
37
|
+
rescue Errno::EAGAIN
|
38
|
+
retry
|
39
|
+
rescue EOFError
|
40
|
+
@eof = true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def consume_rbuff(size=nil)
|
45
|
+
if @rbuffer.empty?
|
46
|
+
nil
|
47
|
+
else
|
48
|
+
size = @rbuffer.size unless size
|
49
|
+
ret = @rbuffer[0, size]
|
50
|
+
@rbuffer[0, size] = ""
|
51
|
+
ret
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
public
|
56
|
+
|
57
|
+
def read(size=nil, buf=nil)
|
58
|
+
if size == 0
|
59
|
+
if buf
|
60
|
+
buf.clear
|
61
|
+
else
|
62
|
+
buf = ""
|
63
|
+
end
|
64
|
+
return @eof ? nil : buf
|
65
|
+
end
|
66
|
+
until @eof
|
67
|
+
break if size && size <= @rbuffer.size
|
68
|
+
fill_rbuff
|
69
|
+
end
|
70
|
+
ret = consume_rbuff(size) || ""
|
71
|
+
if buf
|
72
|
+
buf.replace(ret)
|
73
|
+
ret = buf
|
74
|
+
end
|
75
|
+
(size && ret.empty?) ? nil : ret
|
76
|
+
end
|
77
|
+
|
78
|
+
def readpartial(maxlen, buf=nil)
|
79
|
+
if maxlen == 0
|
80
|
+
if buf
|
81
|
+
buf.clear
|
82
|
+
else
|
83
|
+
buf = ""
|
84
|
+
end
|
85
|
+
return @eof ? nil : buf
|
86
|
+
end
|
87
|
+
if @rbuffer.empty?
|
88
|
+
begin
|
89
|
+
return sysread(maxlen, buf)
|
90
|
+
rescue Errno::EAGAIN
|
91
|
+
retry
|
92
|
+
end
|
93
|
+
end
|
94
|
+
ret = consume_rbuff(maxlen)
|
95
|
+
if buf
|
96
|
+
buf.replace(ret)
|
97
|
+
ret = buf
|
98
|
+
end
|
99
|
+
raise EOFError if ret.empty?
|
100
|
+
ret
|
101
|
+
end
|
102
|
+
|
103
|
+
def gets(eol=$/)
|
104
|
+
idx = @rbuffer.index(eol)
|
105
|
+
until @eof
|
106
|
+
break if idx
|
107
|
+
fill_rbuff
|
108
|
+
idx = @rbuffer.index(eol)
|
109
|
+
end
|
110
|
+
if eol.is_a?(Regexp)
|
111
|
+
size = idx ? idx+$&.size : nil
|
112
|
+
else
|
113
|
+
size = idx ? idx+eol.size : nil
|
114
|
+
end
|
115
|
+
consume_rbuff(size)
|
116
|
+
end
|
117
|
+
|
118
|
+
def each(eol=$/)
|
119
|
+
while line = self.gets(eol)
|
120
|
+
yield line
|
121
|
+
end
|
122
|
+
end
|
123
|
+
alias each_line each
|
124
|
+
|
125
|
+
def readlines(eol=$/)
|
126
|
+
ary = []
|
127
|
+
while line = self.gets(eol)
|
128
|
+
ary << line
|
129
|
+
end
|
130
|
+
ary
|
131
|
+
end
|
132
|
+
|
133
|
+
def readline(eol=$/)
|
134
|
+
raise EOFError if eof?
|
135
|
+
gets(eol)
|
136
|
+
end
|
137
|
+
|
138
|
+
def getc
|
139
|
+
c = read(1)
|
140
|
+
c ? c[0] : nil
|
141
|
+
end
|
142
|
+
|
143
|
+
def each_byte
|
144
|
+
while c = getc
|
145
|
+
yield(c)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def readchar
|
150
|
+
raise EOFError if eof?
|
151
|
+
getc
|
152
|
+
end
|
153
|
+
|
154
|
+
def ungetc(c)
|
155
|
+
@rbuffer[0,0] = c.chr
|
156
|
+
end
|
157
|
+
|
158
|
+
def eof?
|
159
|
+
fill_rbuff if !@eof && @rbuffer.empty?
|
160
|
+
@eof && @rbuffer.empty?
|
161
|
+
end
|
162
|
+
alias eof eof?
|
163
|
+
|
164
|
+
#
|
165
|
+
# for writing.
|
166
|
+
#
|
167
|
+
private
|
168
|
+
|
169
|
+
def do_write(s)
|
170
|
+
@wbuffer = "" unless defined? @wbuffer
|
171
|
+
@wbuffer << s
|
172
|
+
@sync ||= false
|
173
|
+
if @sync or @wbuffer.size > BLOCK_SIZE or idx = @wbuffer.rindex($/)
|
174
|
+
remain = idx ? idx + $/.size : @wbuffer.length
|
175
|
+
nwritten = 0
|
176
|
+
while remain > 0
|
177
|
+
str = @wbuffer[nwritten,remain]
|
178
|
+
begin
|
179
|
+
nwrote = syswrite(str)
|
180
|
+
rescue Errno::EAGAIN
|
181
|
+
retry
|
182
|
+
end
|
183
|
+
remain -= nwrote
|
184
|
+
nwritten += nwrote
|
185
|
+
end
|
186
|
+
@wbuffer[0,nwritten] = ""
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
public
|
191
|
+
|
192
|
+
def write(s)
|
193
|
+
do_write(s)
|
194
|
+
s.length
|
195
|
+
end
|
196
|
+
|
197
|
+
def << (s)
|
198
|
+
do_write(s)
|
199
|
+
self
|
200
|
+
end
|
201
|
+
|
202
|
+
def puts(*args)
|
203
|
+
s = ""
|
204
|
+
if args.empty?
|
205
|
+
s << "\n"
|
206
|
+
end
|
207
|
+
args.each{|arg|
|
208
|
+
s << arg.to_s
|
209
|
+
if $/ && /\n\z/ !~ s
|
210
|
+
s << "\n"
|
211
|
+
end
|
212
|
+
}
|
213
|
+
do_write(s)
|
214
|
+
nil
|
215
|
+
end
|
216
|
+
|
217
|
+
def print(*args)
|
218
|
+
s = ""
|
219
|
+
args.each{ |arg| s << arg.to_s }
|
220
|
+
do_write(s)
|
221
|
+
nil
|
222
|
+
end
|
223
|
+
|
224
|
+
def printf(s, *args)
|
225
|
+
do_write(s % args)
|
226
|
+
nil
|
227
|
+
end
|
228
|
+
|
229
|
+
def flush
|
230
|
+
osync = @sync
|
231
|
+
@sync = true
|
232
|
+
do_write ""
|
233
|
+
@sync = osync
|
234
|
+
end
|
235
|
+
|
236
|
+
def close
|
237
|
+
flush rescue nil
|
238
|
+
sysclose
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|