jruby-openssl 0.7.7 → 0.8.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +111 -109
- data/lib/1.8/openssl/bn.rb +1 -1
- data/lib/1.8/openssl/buffering.rb +1 -1
- data/lib/1.8/openssl/cipher.rb +1 -1
- data/lib/1.8/openssl/digest.rb +1 -1
- data/lib/1.8/openssl/dummy.rb +33 -0
- data/lib/1.8/openssl/dummyssl.rb +14 -0
- data/lib/1.9/openssl/bn.rb +1 -1
- data/lib/1.9/openssl/cipher.rb +1 -1
- data/lib/1.9/openssl/digest.rb +1 -1
- data/lib/1.9/openssl/ssl-internal.rb +1 -1
- data/lib/1.9/openssl/x509-internal.rb +1 -1
- data/lib/shared/jopenssl.jar +0 -0
- data/lib/shared/jopenssl/version.rb +1 -1
- data/lib/shared/jruby-openssl.rb +26 -0
- data/lib/shared/openssl.rb +8 -2
- metadata +222 -212
- data/test/fixture/purpose/ca/gen_cert.rb +0 -128
data/Manifest.txt
CHANGED
@@ -4,169 +4,171 @@ Manifest.txt
|
|
4
4
|
README.txt
|
5
5
|
License.txt
|
6
6
|
lib/shared/jopenssl.jar
|
7
|
+
lib/1.8
|
7
8
|
lib/1.9
|
8
9
|
lib/shared
|
9
|
-
lib/1.8
|
10
|
-
lib/1.
|
10
|
+
lib/1.8/openssl
|
11
|
+
lib/1.8/openssl.rb
|
12
|
+
lib/1.8/openssl/bn.rb
|
13
|
+
lib/1.8/openssl/buffering.rb
|
14
|
+
lib/1.8/openssl/cipher.rb
|
15
|
+
lib/1.8/openssl/config.rb
|
16
|
+
lib/1.8/openssl/digest.rb
|
17
|
+
lib/1.8/openssl/dummy.rb
|
18
|
+
lib/1.8/openssl/dummyssl.rb
|
19
|
+
lib/1.8/openssl/pkcs7.rb
|
20
|
+
lib/1.8/openssl/ssl-internal.rb
|
21
|
+
lib/1.8/openssl/ssl.rb
|
22
|
+
lib/1.8/openssl/x509-internal.rb
|
23
|
+
lib/1.8/openssl/x509.rb
|
11
24
|
lib/1.9/openssl
|
25
|
+
lib/1.9/openssl.rb
|
12
26
|
lib/1.9/openssl/bn.rb
|
13
|
-
lib/1.9/openssl/
|
27
|
+
lib/1.9/openssl/buffering.rb
|
14
28
|
lib/1.9/openssl/cipher.rb
|
29
|
+
lib/1.9/openssl/config.rb
|
15
30
|
lib/1.9/openssl/digest.rb
|
16
|
-
lib/1.9/openssl/ssl.rb
|
17
|
-
lib/1.9/openssl/buffering.rb
|
18
31
|
lib/1.9/openssl/ssl-internal.rb
|
32
|
+
lib/1.9/openssl/ssl.rb
|
33
|
+
lib/1.9/openssl/x509-internal.rb
|
19
34
|
lib/1.9/openssl/x509.rb
|
20
|
-
lib/
|
35
|
+
lib/shared/jopenssl
|
21
36
|
lib/shared/jopenssl.jar
|
22
|
-
lib/shared/openssl.rb
|
37
|
+
lib/shared/jruby-openssl.rb
|
23
38
|
lib/shared/openssl
|
24
|
-
lib/shared/
|
39
|
+
lib/shared/openssl.rb
|
40
|
+
lib/shared/jopenssl/version.rb
|
41
|
+
lib/shared/openssl/dummy.rb
|
25
42
|
lib/shared/openssl/dummyssl.rb
|
26
|
-
lib/shared/openssl/ssl.rb
|
27
43
|
lib/shared/openssl/pkcs12.rb
|
44
|
+
lib/shared/openssl/ssl.rb
|
28
45
|
lib/shared/openssl/x509.rb
|
29
|
-
|
30
|
-
lib/shared/jopenssl/version.rb
|
31
|
-
lib/1.8/openssl.rb
|
32
|
-
lib/1.8/openssl
|
33
|
-
lib/1.8/openssl/bn.rb
|
34
|
-
lib/1.8/openssl/pkcs7.rb
|
35
|
-
lib/1.8/openssl/x509-internal.rb
|
36
|
-
lib/1.8/openssl/cipher.rb
|
37
|
-
lib/1.8/openssl/digest.rb
|
38
|
-
lib/1.8/openssl/ssl.rb
|
39
|
-
lib/1.8/openssl/buffering.rb
|
40
|
-
lib/1.8/openssl/ssl-internal.rb
|
41
|
-
lib/1.8/openssl/x509.rb
|
42
|
-
lib/1.8/openssl/config.rb
|
46
|
+
test/1.8
|
43
47
|
test/1.9
|
48
|
+
test/cert_with_ec_pk.cer
|
49
|
+
test/fixture
|
50
|
+
test/java
|
44
51
|
test/ref
|
52
|
+
test/ruby
|
45
53
|
test/test_all.rb
|
46
|
-
test/
|
47
|
-
test/
|
54
|
+
test/test_certificate.rb
|
55
|
+
test/test_cipher.rb
|
56
|
+
test/test_imaps.rb
|
48
57
|
test/test_integration.rb
|
49
|
-
test/
|
50
|
-
test/test_ssl.rb
|
51
|
-
test/test_parse_certificate.rb
|
58
|
+
test/test_java.rb
|
52
59
|
test/test_openssl.rb
|
53
|
-
test/
|
54
|
-
test/java
|
55
|
-
test/ut_eof.rb
|
56
|
-
test/test_x509store.rb
|
57
|
-
test/test_imaps.rb
|
58
|
-
test/test_certificate.rb
|
60
|
+
test/test_parse_certificate.rb
|
59
61
|
test/test_pkcs7.rb
|
60
|
-
test/
|
61
|
-
test/1.8
|
62
|
+
test/test_pkey_dsa.rb
|
62
63
|
test/test_pkey_rsa.rb
|
63
|
-
test/
|
64
|
-
test/
|
65
|
-
test/
|
66
|
-
test/1.
|
67
|
-
test/1.
|
68
|
-
test/1.
|
69
|
-
test/1.
|
64
|
+
test/test_ssl.rb
|
65
|
+
test/test_x509store.rb
|
66
|
+
test/ut_eof.rb
|
67
|
+
test/1.8/ssl_server.rb
|
68
|
+
test/1.8/test_asn1.rb
|
69
|
+
test/1.8/test_cipher.rb
|
70
|
+
test/1.8/test_config.rb
|
71
|
+
test/1.8/test_digest.rb
|
72
|
+
test/1.8/test_ec.rb
|
73
|
+
test/1.8/test_hmac.rb
|
74
|
+
test/1.8/test_ns_spki.rb
|
75
|
+
test/1.8/test_pair.rb
|
76
|
+
test/1.8/test_pkcs7.rb
|
77
|
+
test/1.8/test_pkey_rsa.rb
|
78
|
+
test/1.8/test_ssl.rb
|
79
|
+
test/1.8/test_x509cert.rb
|
80
|
+
test/1.8/test_x509crl.rb
|
81
|
+
test/1.8/test_x509ext.rb
|
82
|
+
test/1.8/test_x509name.rb
|
83
|
+
test/1.8/test_x509req.rb
|
84
|
+
test/1.8/test_x509store.rb
|
85
|
+
test/1.8/utils.rb
|
70
86
|
test/1.9/ssl_server.rb
|
71
|
-
test/1.9/
|
72
|
-
test/1.9/
|
73
|
-
test/1.9/test_ssl.rb
|
87
|
+
test/1.9/test_asn1.rb
|
88
|
+
test/1.9/test_bn.rb
|
74
89
|
test/1.9/test_buffering.rb
|
75
|
-
test/1.9/
|
90
|
+
test/1.9/test_cipher.rb
|
91
|
+
test/1.9/test_config.rb
|
76
92
|
test/1.9/test_digest.rb
|
93
|
+
test/1.9/test_engine.rb
|
94
|
+
test/1.9/test_hmac.rb
|
95
|
+
test/1.9/test_ns_spki.rb
|
96
|
+
test/1.9/test_ocsp.rb
|
77
97
|
test/1.9/test_pair.rb
|
78
|
-
test/1.9/test_x509crl.rb
|
79
|
-
test/1.9/test_x509store.rb
|
80
|
-
test/1.9/test_bn.rb
|
81
|
-
test/1.9/test_pkey_ec.rb
|
82
|
-
test/1.9/test_pkcs7.rb
|
83
98
|
test/1.9/test_pkcs12.rb
|
84
|
-
test/1.9/
|
99
|
+
test/1.9/test_pkcs7.rb
|
100
|
+
test/1.9/test_pkey_dh.rb
|
101
|
+
test/1.9/test_pkey_dsa.rb
|
102
|
+
test/1.9/test_pkey_ec.rb
|
85
103
|
test/1.9/test_pkey_rsa.rb
|
86
|
-
test/1.9/
|
87
|
-
test/1.9/
|
88
|
-
test/1.9/test_hmac.rb
|
104
|
+
test/1.9/test_ssl.rb
|
105
|
+
test/1.9/test_ssl_session.rb
|
89
106
|
test/1.9/test_x509cert.rb
|
90
|
-
test/1.9/
|
91
|
-
test/
|
92
|
-
test/
|
93
|
-
test/
|
94
|
-
test/
|
95
|
-
test/
|
107
|
+
test/1.9/test_x509crl.rb
|
108
|
+
test/1.9/test_x509ext.rb
|
109
|
+
test/1.9/test_x509name.rb
|
110
|
+
test/1.9/test_x509req.rb
|
111
|
+
test/1.9/test_x509store.rb
|
112
|
+
test/1.9/utils.rb
|
113
|
+
test/fixture/ca-bundle.crt
|
96
114
|
test/fixture/ca_path
|
97
|
-
test/fixture/
|
115
|
+
test/fixture/cacert.pem
|
116
|
+
test/fixture/cert_localhost.pem
|
117
|
+
test/fixture/common.pem
|
118
|
+
test/fixture/ids_in_subject_rdn_set.pem
|
98
119
|
test/fixture/imaps
|
120
|
+
test/fixture/key_then_cert.pem
|
99
121
|
test/fixture/keypair.pem
|
100
|
-
test/fixture/
|
101
|
-
test/fixture/
|
122
|
+
test/fixture/localhost_keypair.pem
|
123
|
+
test/fixture/max.pem
|
102
124
|
test/fixture/purpose
|
103
|
-
test/fixture/cert_localhost.pem
|
104
125
|
test/fixture/selfcert.pem
|
105
|
-
test/fixture/
|
106
|
-
test/fixture/localhost_keypair.pem
|
107
|
-
test/fixture/ids_in_subject_rdn_set.pem
|
108
|
-
test/fixture/ca-bundle.crt
|
126
|
+
test/fixture/verisign.pem
|
109
127
|
test/fixture/verisign_c3.pem
|
110
128
|
test/fixture/ca_path/72fa7371.0
|
111
129
|
test/fixture/ca_path/verisign.pem
|
112
130
|
test/fixture/imaps/cacert.pem
|
113
131
|
test/fixture/imaps/server.crt
|
114
132
|
test/fixture/imaps/server.key
|
133
|
+
test/fixture/purpose/b70a5bc1.0
|
115
134
|
test/fixture/purpose/ca
|
116
|
-
test/fixture/purpose/sslclient
|
117
|
-
test/fixture/purpose/scripts
|
118
|
-
test/fixture/purpose/sslserver_no_dsig_in_keyUsage.pem
|
119
135
|
test/fixture/purpose/cacert.pem
|
136
|
+
test/fixture/purpose/scripts
|
137
|
+
test/fixture/purpose/sslclient
|
138
|
+
test/fixture/purpose/sslclient.pem
|
120
139
|
test/fixture/purpose/sslserver
|
121
140
|
test/fixture/purpose/sslserver.pem
|
122
|
-
test/fixture/purpose/
|
123
|
-
test/fixture/purpose/b70a5bc1.0
|
124
|
-
test/fixture/purpose/ca/serial
|
125
|
-
test/fixture/purpose/ca/gen_cert.rb
|
141
|
+
test/fixture/purpose/sslserver_no_dsig_in_keyUsage.pem
|
126
142
|
test/fixture/purpose/ca/PASSWD_OF_CA_KEY_IS_1234
|
127
143
|
test/fixture/purpose/ca/ca_config.rb
|
128
144
|
test/fixture/purpose/ca/cacert.pem
|
129
|
-
test/fixture/purpose/ca/private
|
130
145
|
test/fixture/purpose/ca/newcerts
|
131
|
-
test/fixture/purpose/ca/private
|
132
|
-
test/fixture/purpose/ca/
|
133
|
-
test/fixture/purpose/ca/newcerts/3_cert.pem
|
146
|
+
test/fixture/purpose/ca/private
|
147
|
+
test/fixture/purpose/ca/serial
|
134
148
|
test/fixture/purpose/ca/newcerts/2_cert.pem
|
149
|
+
test/fixture/purpose/ca/newcerts/3_cert.pem
|
150
|
+
test/fixture/purpose/ca/newcerts/4_cert.pem
|
151
|
+
test/fixture/purpose/ca/private/cakeypair.pem
|
152
|
+
test/fixture/purpose/scripts/gen_cert.rb
|
153
|
+
test/fixture/purpose/scripts/gen_csr.rb
|
154
|
+
test/fixture/purpose/scripts/init_ca.rb
|
135
155
|
test/fixture/purpose/sslclient/csr.pem
|
136
156
|
test/fixture/purpose/sslclient/keypair.pem
|
137
157
|
test/fixture/purpose/sslclient/sslclient.pem
|
138
|
-
test/fixture/purpose/scripts/gen_cert.rb
|
139
|
-
test/fixture/purpose/scripts/init_ca.rb
|
140
|
-
test/fixture/purpose/scripts/gen_csr.rb
|
141
158
|
test/fixture/purpose/sslserver/csr.pem
|
142
159
|
test/fixture/purpose/sslserver/keypair.pem
|
143
160
|
test/fixture/purpose/sslserver/sslserver.pem
|
144
|
-
test/ruby/ut_eof.rb
|
145
|
-
test/ruby/envutil.rb
|
146
161
|
test/java/pkcs7_mime_enveloped.message
|
147
|
-
test/java/test_java_attribute.rb
|
148
|
-
test/java/test_java_pkcs7.rb
|
149
|
-
test/java/test_java_mime.rb
|
150
162
|
test/java/pkcs7_mime_signed.message
|
151
|
-
test/java/test_java_smime.rb
|
152
163
|
test/java/pkcs7_multipart_signed.message
|
164
|
+
test/java/test_java_attribute.rb
|
153
165
|
test/java/test_java_bio.rb
|
154
|
-
test/
|
155
|
-
test/
|
156
|
-
test/
|
157
|
-
test/
|
158
|
-
test/
|
159
|
-
test/
|
160
|
-
test/
|
161
|
-
test/
|
162
|
-
test/
|
163
|
-
test/1.8/test_x509crl.rb
|
164
|
-
test/1.8/test_x509store.rb
|
165
|
-
test/1.8/test_pkcs7.rb
|
166
|
-
test/1.8/test_cipher.rb
|
167
|
-
test/1.8/test_pkey_rsa.rb
|
168
|
-
test/1.8/test_x509req.rb
|
169
|
-
test/1.8/test_x509name.rb
|
170
|
-
test/1.8/test_hmac.rb
|
171
|
-
test/1.8/test_x509cert.rb
|
172
|
-
test/1.8/test_config.rb
|
166
|
+
test/java/test_java_mime.rb
|
167
|
+
test/java/test_java_pkcs7.rb
|
168
|
+
test/java/test_java_smime.rb
|
169
|
+
test/ref/a.out
|
170
|
+
test/ref/compile.rb
|
171
|
+
test/ref/pkcs1
|
172
|
+
test/ref/pkcs1.c
|
173
|
+
test/ruby/envutil.rb
|
174
|
+
test/ruby/ut_eof.rb
|
data/lib/1.8/openssl/bn.rb
CHANGED
data/lib/1.8/openssl/cipher.rb
CHANGED
data/lib/1.8/openssl/digest.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
warn "OpenSSL ASN1/PKey/X509/Netscape/PKCS7 implementation unavailable"
|
2
|
+
warn "gem install bouncy-castle-java for full support."
|
3
|
+
module OpenSSL
|
4
|
+
module ASN1
|
5
|
+
class ASN1Error < OpenSSLError; end
|
6
|
+
class ASN1Data; end
|
7
|
+
class Primitive; end
|
8
|
+
class Constructive; end
|
9
|
+
end
|
10
|
+
module X509
|
11
|
+
class Name; end
|
12
|
+
class Certificate; end
|
13
|
+
class Extension; end
|
14
|
+
class CRL; end
|
15
|
+
class Revoked; end
|
16
|
+
class Store
|
17
|
+
def set_default_paths; end
|
18
|
+
end
|
19
|
+
class Request; end
|
20
|
+
class Attribute; end
|
21
|
+
end
|
22
|
+
module Netscape
|
23
|
+
class SPKI; end
|
24
|
+
end
|
25
|
+
class PKCS7
|
26
|
+
# this definition causes TypeError "superclass mismatch for class PKCS7"
|
27
|
+
# MRI also crashes following definition;
|
28
|
+
# class Foo; class Foo < Foo; end; end
|
29
|
+
# class Foo; class Foo < Foo; end; end
|
30
|
+
#
|
31
|
+
# class PKCS7 < PKCS7; end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
warn "Warning: OpenSSL SSL implementation unavailable"
|
2
|
+
warn "You must run on JDK 1.5 (Java 5) or higher to use SSL"
|
3
|
+
module OpenSSL
|
4
|
+
module SSL
|
5
|
+
class SSLError < OpenSSLError; end
|
6
|
+
class SSLContext; end
|
7
|
+
class SSLSocket; end
|
8
|
+
VERIFY_NONE = 0
|
9
|
+
VERIFY_PEER = 1
|
10
|
+
VERIFY_FAIL_IF_NO_PEER_CERT = 2
|
11
|
+
VERIFY_CLIENT_ONCE = 4
|
12
|
+
OP_ALL = 0x00000FFF
|
13
|
+
end
|
14
|
+
end
|
data/lib/1.9/openssl/bn.rb
CHANGED
data/lib/1.9/openssl/cipher.rb
CHANGED
data/lib/1.9/openssl/digest.rb
CHANGED
data/lib/shared/jopenssl.jar
CHANGED
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
unless defined? JRUBY_VERSION
|
2
|
+
warn 'Loading jruby-openssl in a non-JRuby interpreter'
|
3
|
+
end
|
4
|
+
|
5
|
+
# Load bouncy-castle gem if available
|
6
|
+
begin
|
7
|
+
require 'bouncy-castle-java'
|
8
|
+
rescue LoadError
|
9
|
+
# runs under restricted mode or uses builtin BC
|
10
|
+
end
|
11
|
+
|
12
|
+
# Load extension
|
13
|
+
require 'jruby'
|
14
|
+
require 'jopenssl.jar'
|
15
|
+
org.jruby.ext.openssl.OSSLLibrary.new.load(JRuby.runtime, false)
|
16
|
+
|
17
|
+
# Add version-appropriate library path to LOAD_PATH
|
18
|
+
if RUBY_VERSION >= '1.9.0'
|
19
|
+
$LOAD_PATH.unshift(File.expand_path('../../1.9', __FILE__))
|
20
|
+
load(File.expand_path('../../1.9/openssl.rb', __FILE__))
|
21
|
+
else
|
22
|
+
$LOAD_PATH.unshift(File.expand_path('../../1.8', __FILE__))
|
23
|
+
load(File.expand_path('../../1.8/openssl.rb', __FILE__))
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'openssl/pkcs12'
|
data/lib/shared/openssl.rb
CHANGED
@@ -2,13 +2,19 @@ unless defined? JRUBY_VERSION
|
|
2
2
|
warn 'Loading jruby-openssl in a non-JRuby interpreter'
|
3
3
|
end
|
4
4
|
|
5
|
+
# Load bouncy-castle gem if available
|
5
6
|
begin
|
6
7
|
require 'bouncy-castle-java'
|
7
8
|
rescue LoadError
|
8
|
-
# runs under restricted mode
|
9
|
+
# runs under restricted mode or uses builtin BC
|
9
10
|
end
|
10
|
-
require 'jopenssl'
|
11
11
|
|
12
|
+
# Load extension
|
13
|
+
require 'jruby'
|
14
|
+
require 'jopenssl.jar'
|
15
|
+
org.jruby.ext.openssl.OSSLLibrary.new.load(JRuby.runtime, false)
|
16
|
+
|
17
|
+
# Add version-appropriate library path to LOAD_PATH
|
12
18
|
if RUBY_VERSION >= '1.9.0'
|
13
19
|
$LOAD_PATH.unshift(File.expand_path('../../1.9', __FILE__))
|
14
20
|
load(File.expand_path('../../1.9/openssl.rb', __FILE__))
|
metadata
CHANGED
@@ -1,228 +1,238 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-openssl
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.0.pre1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
9
|
-
autorequire:
|
7
|
+
authors:
|
8
|
+
- Ola Bini and JRuby contributors
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
12
|
+
date: 2012-10-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bouncy-castle-java
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ! '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.5.0146.1
|
21
|
+
none: false
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.5.0146.1
|
27
|
+
none: false
|
28
|
+
prerelease: false
|
29
|
+
type: :runtime
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rdoc
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ~>
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '3.10'
|
37
|
+
none: false
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '3.10'
|
43
|
+
none: false
|
44
|
+
prerelease: false
|
45
|
+
type: :development
|
37
46
|
description: JRuby-OpenSSL is an add-on gem for JRuby that emulates the Ruby OpenSSL native library.
|
38
47
|
email: ola.bini@gmail.com
|
39
48
|
executables: []
|
40
|
-
|
41
49
|
extensions: []
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
50
|
+
extra_rdoc_files:
|
51
|
+
- History.txt
|
52
|
+
- Manifest.txt
|
53
|
+
- README.txt
|
54
|
+
- License.txt
|
55
|
+
files:
|
56
|
+
- Rakefile
|
57
|
+
- History.txt
|
58
|
+
- Manifest.txt
|
59
|
+
- README.txt
|
60
|
+
- License.txt
|
61
|
+
- lib/shared/jopenssl.jar
|
62
|
+
- lib/1.8/openssl.rb
|
63
|
+
- lib/1.8/openssl/bn.rb
|
64
|
+
- lib/1.8/openssl/buffering.rb
|
65
|
+
- lib/1.8/openssl/cipher.rb
|
66
|
+
- lib/1.8/openssl/config.rb
|
67
|
+
- lib/1.8/openssl/digest.rb
|
68
|
+
- lib/1.8/openssl/dummy.rb
|
69
|
+
- lib/1.8/openssl/dummyssl.rb
|
70
|
+
- lib/1.8/openssl/pkcs7.rb
|
71
|
+
- lib/1.8/openssl/ssl-internal.rb
|
72
|
+
- lib/1.8/openssl/ssl.rb
|
73
|
+
- lib/1.8/openssl/x509-internal.rb
|
74
|
+
- lib/1.8/openssl/x509.rb
|
75
|
+
- lib/1.9/openssl.rb
|
76
|
+
- lib/1.9/openssl/bn.rb
|
77
|
+
- lib/1.9/openssl/buffering.rb
|
78
|
+
- lib/1.9/openssl/cipher.rb
|
79
|
+
- lib/1.9/openssl/config.rb
|
80
|
+
- lib/1.9/openssl/digest.rb
|
81
|
+
- lib/1.9/openssl/ssl-internal.rb
|
82
|
+
- lib/1.9/openssl/ssl.rb
|
83
|
+
- lib/1.9/openssl/x509-internal.rb
|
84
|
+
- lib/1.9/openssl/x509.rb
|
85
|
+
- lib/shared/jruby-openssl.rb
|
86
|
+
- lib/shared/openssl.rb
|
87
|
+
- lib/shared/jopenssl/version.rb
|
88
|
+
- lib/shared/openssl/dummy.rb
|
89
|
+
- lib/shared/openssl/dummyssl.rb
|
90
|
+
- lib/shared/openssl/pkcs12.rb
|
91
|
+
- lib/shared/openssl/ssl.rb
|
92
|
+
- lib/shared/openssl/x509.rb
|
93
|
+
- test/cert_with_ec_pk.cer
|
94
|
+
- test/test_all.rb
|
95
|
+
- test/test_certificate.rb
|
96
|
+
- test/test_cipher.rb
|
97
|
+
- test/test_imaps.rb
|
98
|
+
- test/test_integration.rb
|
99
|
+
- test/test_java.rb
|
100
|
+
- test/test_openssl.rb
|
101
|
+
- test/test_parse_certificate.rb
|
102
|
+
- test/test_pkcs7.rb
|
103
|
+
- test/test_pkey_dsa.rb
|
104
|
+
- test/test_pkey_rsa.rb
|
105
|
+
- test/test_ssl.rb
|
106
|
+
- test/test_x509store.rb
|
107
|
+
- test/ut_eof.rb
|
108
|
+
- test/1.8/ssl_server.rb
|
109
|
+
- test/1.8/test_asn1.rb
|
110
|
+
- test/1.8/test_cipher.rb
|
111
|
+
- test/1.8/test_config.rb
|
112
|
+
- test/1.8/test_digest.rb
|
113
|
+
- test/1.8/test_ec.rb
|
114
|
+
- test/1.8/test_hmac.rb
|
115
|
+
- test/1.8/test_ns_spki.rb
|
116
|
+
- test/1.8/test_pair.rb
|
117
|
+
- test/1.8/test_pkcs7.rb
|
118
|
+
- test/1.8/test_pkey_rsa.rb
|
119
|
+
- test/1.8/test_ssl.rb
|
120
|
+
- test/1.8/test_x509cert.rb
|
121
|
+
- test/1.8/test_x509crl.rb
|
122
|
+
- test/1.8/test_x509ext.rb
|
123
|
+
- test/1.8/test_x509name.rb
|
124
|
+
- test/1.8/test_x509req.rb
|
125
|
+
- test/1.8/test_x509store.rb
|
126
|
+
- test/1.8/utils.rb
|
127
|
+
- test/1.9/ssl_server.rb
|
128
|
+
- test/1.9/test_asn1.rb
|
129
|
+
- test/1.9/test_bn.rb
|
130
|
+
- test/1.9/test_buffering.rb
|
131
|
+
- test/1.9/test_cipher.rb
|
132
|
+
- test/1.9/test_config.rb
|
133
|
+
- test/1.9/test_digest.rb
|
134
|
+
- test/1.9/test_engine.rb
|
135
|
+
- test/1.9/test_hmac.rb
|
136
|
+
- test/1.9/test_ns_spki.rb
|
137
|
+
- test/1.9/test_ocsp.rb
|
138
|
+
- test/1.9/test_pair.rb
|
139
|
+
- test/1.9/test_pkcs12.rb
|
140
|
+
- test/1.9/test_pkcs7.rb
|
141
|
+
- test/1.9/test_pkey_dh.rb
|
142
|
+
- test/1.9/test_pkey_dsa.rb
|
143
|
+
- test/1.9/test_pkey_ec.rb
|
144
|
+
- test/1.9/test_pkey_rsa.rb
|
145
|
+
- test/1.9/test_ssl.rb
|
146
|
+
- test/1.9/test_ssl_session.rb
|
147
|
+
- test/1.9/test_x509cert.rb
|
148
|
+
- test/1.9/test_x509crl.rb
|
149
|
+
- test/1.9/test_x509ext.rb
|
150
|
+
- test/1.9/test_x509name.rb
|
151
|
+
- test/1.9/test_x509req.rb
|
152
|
+
- test/1.9/test_x509store.rb
|
153
|
+
- test/1.9/utils.rb
|
154
|
+
- test/fixture/ca-bundle.crt
|
155
|
+
- test/fixture/cacert.pem
|
156
|
+
- test/fixture/cert_localhost.pem
|
157
|
+
- test/fixture/common.pem
|
158
|
+
- test/fixture/ids_in_subject_rdn_set.pem
|
159
|
+
- test/fixture/key_then_cert.pem
|
160
|
+
- test/fixture/keypair.pem
|
161
|
+
- test/fixture/localhost_keypair.pem
|
162
|
+
- test/fixture/max.pem
|
163
|
+
- test/fixture/selfcert.pem
|
164
|
+
- test/fixture/verisign.pem
|
165
|
+
- test/fixture/verisign_c3.pem
|
166
|
+
- test/fixture/ca_path/72fa7371.0
|
167
|
+
- test/fixture/ca_path/verisign.pem
|
168
|
+
- test/fixture/imaps/cacert.pem
|
169
|
+
- test/fixture/imaps/server.crt
|
170
|
+
- test/fixture/imaps/server.key
|
171
|
+
- test/fixture/purpose/b70a5bc1.0
|
172
|
+
- test/fixture/purpose/cacert.pem
|
173
|
+
- test/fixture/purpose/sslclient.pem
|
174
|
+
- test/fixture/purpose/sslserver.pem
|
175
|
+
- test/fixture/purpose/sslserver_no_dsig_in_keyUsage.pem
|
176
|
+
- test/fixture/purpose/ca/PASSWD_OF_CA_KEY_IS_1234
|
177
|
+
- test/fixture/purpose/ca/ca_config.rb
|
178
|
+
- test/fixture/purpose/ca/cacert.pem
|
179
|
+
- test/fixture/purpose/ca/serial
|
180
|
+
- test/fixture/purpose/ca/newcerts/2_cert.pem
|
181
|
+
- test/fixture/purpose/ca/newcerts/3_cert.pem
|
182
|
+
- test/fixture/purpose/ca/newcerts/4_cert.pem
|
183
|
+
- test/fixture/purpose/ca/private/cakeypair.pem
|
184
|
+
- test/fixture/purpose/scripts/gen_cert.rb
|
185
|
+
- test/fixture/purpose/scripts/gen_csr.rb
|
186
|
+
- test/fixture/purpose/scripts/init_ca.rb
|
187
|
+
- test/fixture/purpose/sslclient/csr.pem
|
188
|
+
- test/fixture/purpose/sslclient/keypair.pem
|
189
|
+
- test/fixture/purpose/sslclient/sslclient.pem
|
190
|
+
- test/fixture/purpose/sslserver/csr.pem
|
191
|
+
- test/fixture/purpose/sslserver/keypair.pem
|
192
|
+
- test/fixture/purpose/sslserver/sslserver.pem
|
193
|
+
- test/java/pkcs7_mime_enveloped.message
|
194
|
+
- test/java/pkcs7_mime_signed.message
|
195
|
+
- test/java/pkcs7_multipart_signed.message
|
196
|
+
- test/java/test_java_attribute.rb
|
197
|
+
- test/java/test_java_bio.rb
|
198
|
+
- test/java/test_java_mime.rb
|
199
|
+
- test/java/test_java_pkcs7.rb
|
200
|
+
- test/java/test_java_smime.rb
|
201
|
+
- test/ref/a.out
|
202
|
+
- test/ref/compile.rb
|
203
|
+
- test/ref/pkcs1
|
204
|
+
- test/ref/pkcs1.c
|
205
|
+
- test/ruby/envutil.rb
|
206
|
+
- test/ruby/ut_eof.rb
|
207
|
+
- .gemtest
|
199
208
|
homepage: https://github.com/jruby/jruby-ossl
|
200
209
|
licenses: []
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
210
|
+
post_install_message:
|
211
|
+
rdoc_options:
|
212
|
+
- --main
|
213
|
+
- README.txt
|
214
|
+
require_paths:
|
215
|
+
- lib/shared
|
216
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ! '>='
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: !binary |-
|
221
|
+
MA==
|
209
222
|
none: false
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
223
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
225
|
+
- - !binary |-
|
226
|
+
Pg==
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: 1.3.1
|
215
229
|
none: false
|
216
|
-
requirements:
|
217
|
-
- - ">="
|
218
|
-
- !ruby/object:Gem::Version
|
219
|
-
version: "0"
|
220
230
|
requirements: []
|
221
|
-
|
222
231
|
rubyforge_project: jruby-extras
|
223
|
-
rubygems_version: 1.8.
|
224
|
-
signing_key:
|
232
|
+
rubygems_version: 1.8.24
|
233
|
+
signing_key:
|
225
234
|
specification_version: 3
|
226
235
|
summary: OpenSSL add-on for JRuby
|
227
|
-
test_files:
|
228
|
-
|
236
|
+
test_files:
|
237
|
+
- !binary |-
|
238
|
+
dGVzdC90ZXN0X2FsbC5yYg==
|
@@ -1,128 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'openssl'
|
4
|
-
require 'ca_config'
|
5
|
-
require 'fileutils'
|
6
|
-
require 'getopts'
|
7
|
-
|
8
|
-
include OpenSSL
|
9
|
-
|
10
|
-
def usage
|
11
|
-
myname = File::basename($0)
|
12
|
-
$stderr.puts "Usage: #{myname} [--type (client|server|ca|ocsp)] [--out certfile] csr_file"
|
13
|
-
exit
|
14
|
-
end
|
15
|
-
|
16
|
-
getopts nil, 'type:client', 'out:', 'force'
|
17
|
-
|
18
|
-
cert_type = $OPT_type
|
19
|
-
out_file = $OPT_out || 'cert.pem'
|
20
|
-
csr_file = ARGV.shift or usage
|
21
|
-
ARGV.empty? or usage
|
22
|
-
|
23
|
-
csr = X509::Request.new(File.open(csr_file).read)
|
24
|
-
unless csr.verify(csr.public_key)
|
25
|
-
raise "CSR sign verification failed."
|
26
|
-
end
|
27
|
-
p csr.public_key
|
28
|
-
if csr.public_key.n.num_bits < CAConfig::CERT_KEY_LENGTH_MIN
|
29
|
-
raise "Key length too short"
|
30
|
-
end
|
31
|
-
if csr.public_key.n.num_bits > CAConfig::CERT_KEY_LENGTH_MAX
|
32
|
-
raise "Key length too long"
|
33
|
-
end
|
34
|
-
if csr.subject.to_a[0, CAConfig::NAME.size] != CAConfig::NAME
|
35
|
-
unless $OPT_force
|
36
|
-
p csr.subject.to_a
|
37
|
-
p CAConfig::NAME
|
38
|
-
raise "DN does not match"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# Only checks signature here. You must verify CSR according to your CP/CPS.
|
43
|
-
|
44
|
-
$stdout.sync = true
|
45
|
-
|
46
|
-
# CA setup
|
47
|
-
|
48
|
-
ca_file = CAConfig::CERT_FILE
|
49
|
-
puts "Reading CA cert (from #{ca_file})"
|
50
|
-
ca = X509::Certificate.new(File.read(ca_file))
|
51
|
-
|
52
|
-
ca_keypair_file = CAConfig::KEYPAIR_FILE
|
53
|
-
puts "Reading CA keypair (from #{ca_keypair_file})"
|
54
|
-
ca_keypair = PKey::RSA.new(File.read(ca_keypair_file), &CAConfig::PASSWD_CB)
|
55
|
-
|
56
|
-
serial = File.open(CAConfig::SERIAL_FILE, "r").read.chomp.hex
|
57
|
-
File.open(CAConfig::SERIAL_FILE, "w") do |f|
|
58
|
-
f << sprintf("%04X", serial + 1)
|
59
|
-
end
|
60
|
-
|
61
|
-
# Generate new cert
|
62
|
-
|
63
|
-
cert = X509::Certificate.new
|
64
|
-
from = Time.now # + 30 * 60 # Wait 30 minutes.
|
65
|
-
cert.subject = csr.subject
|
66
|
-
cert.issuer = ca.subject
|
67
|
-
cert.not_before = from
|
68
|
-
cert.not_after = from + CAConfig::CERT_DAYS * 24 * 60 * 60
|
69
|
-
cert.public_key = csr.public_key
|
70
|
-
cert.serial = serial
|
71
|
-
cert.version = 2 # X509v3
|
72
|
-
|
73
|
-
basic_constraint = nil
|
74
|
-
key_usage = []
|
75
|
-
ext_key_usage = []
|
76
|
-
case cert_type
|
77
|
-
when "ca"
|
78
|
-
basic_constraint = "CA:TRUE"
|
79
|
-
key_usage << "cRLSign" << "keyCertSign"
|
80
|
-
when "terminalsubca"
|
81
|
-
basic_constraint = "CA:TRUE,pathlen:0"
|
82
|
-
key_usage << "cRLSign" << "keyCertSign"
|
83
|
-
when "server"
|
84
|
-
basic_constraint = "CA:FALSE"
|
85
|
-
#key_usage << "digitalSignature" << "keyEncipherment"
|
86
|
-
key_usage << "keyEncipherment"
|
87
|
-
ext_key_usage << "serverAuth"
|
88
|
-
when "ocsp"
|
89
|
-
basic_constraint = "CA:FALSE"
|
90
|
-
key_usage << "nonRepudiation" << "digitalSignature"
|
91
|
-
ext_key_usage << "serverAuth" << "OCSPSigning"
|
92
|
-
when "client"
|
93
|
-
basic_constraint = "CA:FALSE"
|
94
|
-
key_usage << "nonRepudiation" << "digitalSignature" << "keyEncipherment"
|
95
|
-
ext_key_usage << "clientAuth" << "emailProtection"
|
96
|
-
else
|
97
|
-
raise "unknonw cert type \"#{cert_type}\" is specified."
|
98
|
-
end
|
99
|
-
|
100
|
-
ef = X509::ExtensionFactory.new
|
101
|
-
ef.subject_certificate = cert
|
102
|
-
ef.issuer_certificate = ca
|
103
|
-
ex = []
|
104
|
-
ex << ef.create_extension("basicConstraints", basic_constraint, true)
|
105
|
-
ex << ef.create_extension("nsComment","Ruby/OpenSSL Generated Certificate")
|
106
|
-
ex << ef.create_extension("subjectKeyIdentifier", "hash")
|
107
|
-
#ex << ef.create_extension("nsCertType", "client,email")
|
108
|
-
ex << ef.create_extension("keyUsage", key_usage.join(",")) unless key_usage.empty?
|
109
|
-
#ex << ef.create_extension("authorityKeyIdentifier", "keyid:always,issuer:always")
|
110
|
-
#ex << ef.create_extension("authorityKeyIdentifier", "keyid:always")
|
111
|
-
ex << ef.create_extension("extendedKeyUsage", ext_key_usage.join(",")) unless ext_key_usage.empty?
|
112
|
-
|
113
|
-
ex << ef.create_extension("crlDistributionPoints", CAConfig::CDP_LOCATION) if CAConfig::CDP_LOCATION
|
114
|
-
ex << ef.create_extension("authorityInfoAccess", "OCSP;" << CAConfig::OCSP_LOCATION) if CAConfig::OCSP_LOCATION
|
115
|
-
cert.extensions = ex
|
116
|
-
cert.sign(ca_keypair, OpenSSL::Digest::SHA1.new)
|
117
|
-
|
118
|
-
# For backup
|
119
|
-
|
120
|
-
cert_file = CAConfig::NEW_CERTS_DIR + "/#{cert.serial}_cert.pem"
|
121
|
-
File.open(cert_file, "w", 0644) do |f|
|
122
|
-
f << cert.to_pem
|
123
|
-
end
|
124
|
-
|
125
|
-
puts "Writing cert.pem..."
|
126
|
-
FileUtils.copy(cert_file, out_file)
|
127
|
-
|
128
|
-
puts "DONE. (Generated certificate for '#{cert.subject}')"
|