jruby-openssl 0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jruby-openssl might be problematic. Click here for more details.
- data/History.txt +4 -0
- data/lib/jopenssl.jar +0 -0
- data/lib/jopenssl/version.rb +1 -1
- data/test/openssl/test_ssl.rb +73 -55
- data/test/test_openssl.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
data/lib/jopenssl.jar
CHANGED
Binary file
|
data/lib/jopenssl/version.rb
CHANGED
data/test/openssl/test_ssl.rb
CHANGED
@@ -6,6 +6,7 @@ end
|
|
6
6
|
require "rbconfig"
|
7
7
|
require "socket"
|
8
8
|
require "test/unit"
|
9
|
+
require "jruby"
|
9
10
|
|
10
11
|
if defined?(OpenSSL)
|
11
12
|
|
@@ -17,6 +18,20 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
|
|
17
18
|
SSL_SERVER = File.join(File.dirname(__FILE__), "ssl_server.rb")
|
18
19
|
PORT = 20443
|
19
20
|
ITERATIONS = ($0 == __FILE__) ? 5 : 5
|
21
|
+
|
22
|
+
# Disable in-proc process launching and either run jruby with specified args
|
23
|
+
# or yield args to a given block
|
24
|
+
def jruby_oop(*args)
|
25
|
+
prev_in_process = JRuby.runtime.instance_config.run_ruby_in_process
|
26
|
+
JRuby.runtime.instance_config.run_ruby_in_process = false
|
27
|
+
if block_given?
|
28
|
+
yield args
|
29
|
+
else
|
30
|
+
`#{RUBY} #{args.join(' ')}`
|
31
|
+
end
|
32
|
+
ensure
|
33
|
+
JRuby.runtime.instance_config.run_ruby_in_process = prev_in_process
|
34
|
+
end
|
20
35
|
|
21
36
|
def setup
|
22
37
|
@ca_key = OpenSSL::TestUtils::TEST_KEY_RSA2048
|
@@ -56,28 +71,30 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
|
|
56
71
|
|
57
72
|
def start_server(port0, verify_mode, start_immediately, &block)
|
58
73
|
server = nil
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
if
|
71
|
-
$
|
74
|
+
jruby_oop {
|
75
|
+
begin
|
76
|
+
cmd = [RUBY]
|
77
|
+
cmd << "-d" if $DEBUG
|
78
|
+
cmd << SSL_SERVER << port0.to_s << verify_mode.to_s
|
79
|
+
cmd << (start_immediately ? "yes" : "no")
|
80
|
+
server = IO.popen(cmd.join(" "), "w+")
|
81
|
+
server.write(@ca_cert.to_pem)
|
82
|
+
server.write(@svr_cert.to_pem)
|
83
|
+
server.write(@svr_key.to_pem)
|
84
|
+
pid = Integer(server.gets)
|
85
|
+
if port = server.gets
|
86
|
+
if $DEBUG
|
87
|
+
$stderr.printf("%s started: pid=%d port=%d\n", SSL_SERVER, pid, port)
|
88
|
+
end
|
89
|
+
block.call(server, port.to_i)
|
90
|
+
end
|
91
|
+
ensure
|
92
|
+
if server
|
93
|
+
Process.kill(:KILL, pid)
|
94
|
+
server.close
|
72
95
|
end
|
73
|
-
block.call(server, port.to_i)
|
74
|
-
end
|
75
|
-
ensure
|
76
|
-
if server
|
77
|
-
Process.kill(:KILL, pid)
|
78
|
-
server.close
|
79
96
|
end
|
80
|
-
|
97
|
+
}
|
81
98
|
end
|
82
99
|
|
83
100
|
def starttls(ssl)
|
@@ -151,41 +168,42 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
|
|
151
168
|
}
|
152
169
|
end
|
153
170
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
ssl.
|
161
|
-
|
162
|
-
|
163
|
-
ctx
|
164
|
-
ctx.
|
165
|
-
|
166
|
-
|
167
|
-
ssl
|
168
|
-
ssl.
|
169
|
-
ssl.
|
170
|
-
|
171
|
-
ssl.
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
ctx
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
ssl
|
182
|
-
ssl.
|
183
|
-
#
|
184
|
-
|
185
|
-
|
186
|
-
ssl.
|
187
|
-
|
188
|
-
|
171
|
+
# Temporarily disabled...see JRUBY-1888
|
172
|
+
# def test_client_auth
|
173
|
+
# vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
174
|
+
# start_server(PORT, vflag, true){|s, p|
|
175
|
+
# assert_raises(OpenSSL::SSL::SSLError){
|
176
|
+
# sock = TCPSocket.new("127.0.0.1", p)
|
177
|
+
# ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
178
|
+
# ssl.connect
|
179
|
+
# }
|
180
|
+
# ctx = OpenSSL::SSL::SSLContext.new
|
181
|
+
# ctx.key = @cli_key
|
182
|
+
# ctx.cert = @cli_cert
|
183
|
+
# sock = TCPSocket.new("127.0.0.1", p)
|
184
|
+
# ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
|
185
|
+
# ssl.sync_close = true
|
186
|
+
# ssl.connect
|
187
|
+
# ssl.puts("foo")
|
188
|
+
# assert_equal("foo\n", ssl.gets)
|
189
|
+
# ssl.close
|
190
|
+
#
|
191
|
+
# called = nil
|
192
|
+
# ctx = OpenSSL::SSL::SSLContext.new
|
193
|
+
# ctx.client_cert_cb = Proc.new{|ssl|
|
194
|
+
# called = true
|
195
|
+
# [@cli_cert, @cli_key]
|
196
|
+
# }
|
197
|
+
# sock = TCPSocket.new("127.0.0.1", p)
|
198
|
+
# ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
|
199
|
+
# ssl.sync_close = true
|
200
|
+
# ssl.connect
|
201
|
+
## assert(called)
|
202
|
+
# ssl.puts("foo")
|
203
|
+
# assert_equal("foo\n", ssl.gets)
|
204
|
+
# ssl.close
|
205
|
+
# }
|
206
|
+
# end
|
189
207
|
|
190
208
|
def test_starttls
|
191
209
|
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|s, p|
|
data/test/test_openssl.rb
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
require 'openssl/test_ns_spki'
|
9
9
|
# require 'openssl/test_pair'
|
10
10
|
require 'openssl/test_pkey_rsa'
|
11
|
-
|
11
|
+
require 'openssl/test_ssl'
|
12
12
|
require 'openssl/test_x509cert'
|
13
13
|
require 'openssl/test_x509crl'
|
14
14
|
require 'openssl/test_x509name'
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: jruby-openssl
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
date:
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2008-01-06 00:00:00 -06:00
|
8
8
|
summary: OpenSSL add-on for JRuby
|
9
9
|
require_paths:
|
10
10
|
- lib
|