jruby-openssl 0.8.0.pre3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/Manifest.txt +5 -124
  2. data/Rakefile +3 -3
  3. data/lib/shared/jopenssl.jar +0 -0
  4. data/lib/shared/jopenssl/version.rb +1 -1
  5. metadata +10 -116
  6. data/test/1.8/ssl_server.rb +0 -99
  7. data/test/1.8/test_asn1.rb +0 -212
  8. data/test/1.8/test_cipher.rb +0 -193
  9. data/test/1.8/test_config.rb +0 -290
  10. data/test/1.8/test_digest.rb +0 -88
  11. data/test/1.8/test_ec.rb +0 -128
  12. data/test/1.8/test_hmac.rb +0 -46
  13. data/test/1.8/test_ns_spki.rb +0 -59
  14. data/test/1.8/test_pair.rb +0 -149
  15. data/test/1.8/test_pkcs7.rb +0 -489
  16. data/test/1.8/test_pkey_rsa.rb +0 -49
  17. data/test/1.8/test_ssl.rb +0 -1032
  18. data/test/1.8/test_x509cert.rb +0 -277
  19. data/test/1.8/test_x509crl.rb +0 -253
  20. data/test/1.8/test_x509ext.rb +0 -99
  21. data/test/1.8/test_x509name.rb +0 -290
  22. data/test/1.8/test_x509req.rb +0 -195
  23. data/test/1.8/test_x509store.rb +0 -246
  24. data/test/1.8/utils.rb +0 -144
  25. data/test/1.9/ssl_server.rb +0 -81
  26. data/test/1.9/test_asn1.rb +0 -589
  27. data/test/1.9/test_bn.rb +0 -23
  28. data/test/1.9/test_buffering.rb +0 -88
  29. data/test/1.9/test_cipher.rb +0 -107
  30. data/test/1.9/test_config.rb +0 -288
  31. data/test/1.9/test_digest.rb +0 -118
  32. data/test/1.9/test_engine.rb +0 -15
  33. data/test/1.9/test_hmac.rb +0 -32
  34. data/test/1.9/test_ns_spki.rb +0 -50
  35. data/test/1.9/test_ocsp.rb +0 -47
  36. data/test/1.9/test_pair.rb +0 -257
  37. data/test/1.9/test_pkcs12.rb +0 -209
  38. data/test/1.9/test_pkcs7.rb +0 -156
  39. data/test/1.9/test_pkey_dh.rb +0 -72
  40. data/test/1.9/test_pkey_dsa.rb +0 -224
  41. data/test/1.9/test_pkey_ec.rb +0 -182
  42. data/test/1.9/test_pkey_rsa.rb +0 -244
  43. data/test/1.9/test_ssl.rb +0 -499
  44. data/test/1.9/test_ssl_session.rb +0 -327
  45. data/test/1.9/test_x509cert.rb +0 -217
  46. data/test/1.9/test_x509crl.rb +0 -221
  47. data/test/1.9/test_x509ext.rb +0 -69
  48. data/test/1.9/test_x509name.rb +0 -366
  49. data/test/1.9/test_x509req.rb +0 -150
  50. data/test/1.9/test_x509store.rb +0 -229
  51. data/test/1.9/utils.rb +0 -304
  52. data/test/cert_with_ec_pk.cer +0 -27
  53. data/test/fixture/ca-bundle.crt +0 -2794
  54. data/test/fixture/ca_path/72fa7371.0 +0 -19
  55. data/test/fixture/ca_path/verisign.pem +0 -19
  56. data/test/fixture/cacert.pem +0 -23
  57. data/test/fixture/cert_localhost.pem +0 -19
  58. data/test/fixture/common.pem +0 -48
  59. data/test/fixture/ids_in_subject_rdn_set.pem +0 -31
  60. data/test/fixture/imaps/cacert.pem +0 -60
  61. data/test/fixture/imaps/server.crt +0 -61
  62. data/test/fixture/imaps/server.key +0 -15
  63. data/test/fixture/key_then_cert.pem +0 -34
  64. data/test/fixture/keypair.pem +0 -27
  65. data/test/fixture/localhost_keypair.pem +0 -18
  66. data/test/fixture/max.pem +0 -29
  67. data/test/fixture/purpose/b70a5bc1.0 +0 -24
  68. data/test/fixture/purpose/ca/PASSWD_OF_CA_KEY_IS_1234 +0 -0
  69. data/test/fixture/purpose/ca/ca_config.rb +0 -37
  70. data/test/fixture/purpose/ca/cacert.pem +0 -24
  71. data/test/fixture/purpose/ca/newcerts/2_cert.pem +0 -19
  72. data/test/fixture/purpose/ca/newcerts/3_cert.pem +0 -19
  73. data/test/fixture/purpose/ca/newcerts/4_cert.pem +0 -19
  74. data/test/fixture/purpose/ca/private/cakeypair.pem +0 -30
  75. data/test/fixture/purpose/ca/serial +0 -1
  76. data/test/fixture/purpose/cacert.pem +0 -24
  77. data/test/fixture/purpose/scripts/gen_cert.rb +0 -127
  78. data/test/fixture/purpose/scripts/gen_csr.rb +0 -50
  79. data/test/fixture/purpose/scripts/init_ca.rb +0 -66
  80. data/test/fixture/purpose/sslclient.pem +0 -19
  81. data/test/fixture/purpose/sslclient/csr.pem +0 -10
  82. data/test/fixture/purpose/sslclient/keypair.pem +0 -15
  83. data/test/fixture/purpose/sslclient/sslclient.pem +0 -19
  84. data/test/fixture/purpose/sslserver.pem +0 -19
  85. data/test/fixture/purpose/sslserver/csr.pem +0 -10
  86. data/test/fixture/purpose/sslserver/keypair.pem +0 -15
  87. data/test/fixture/purpose/sslserver/sslserver.pem +0 -19
  88. data/test/fixture/purpose/sslserver_no_dsig_in_keyUsage.pem +0 -19
  89. data/test/fixture/selfcert.pem +0 -23
  90. data/test/fixture/verisign.pem +0 -19
  91. data/test/fixture/verisign_c3.pem +0 -14
  92. data/test/ref/a.out +0 -0
  93. data/test/ref/compile.rb +0 -8
  94. data/test/ref/pkcs1 +0 -0
  95. data/test/ref/pkcs1.c +0 -21
  96. data/test/ruby/envutil.rb +0 -208
  97. data/test/ruby/ut_eof.rb +0 -128
  98. data/test/test_all.rb +0 -1
  99. data/test/test_certificate.rb +0 -132
  100. data/test/test_cipher.rb +0 -197
  101. data/test/test_imaps.rb +0 -107
  102. data/test/test_integration.rb +0 -144
  103. data/test/test_openssl.rb +0 -4
  104. data/test/test_parse_certificate.rb +0 -27
  105. data/test/test_pkcs7.rb +0 -56
  106. data/test/test_pkey_dsa.rb +0 -180
  107. data/test/test_pkey_rsa.rb +0 -329
  108. data/test/test_ssl.rb +0 -97
  109. data/test/test_x509store.rb +0 -168
@@ -5,8 +5,6 @@ README.txt
5
5
  License.txt
6
6
  lib/shared/jopenssl.jar
7
7
  lib/1.8
8
- lib/1.9
9
- lib/shared
10
8
  lib/1.8/openssl
11
9
  lib/1.8/openssl.rb
12
10
  lib/1.8/openssl/bn.rb
@@ -21,6 +19,7 @@ lib/1.8/openssl/ssl-internal.rb
21
19
  lib/1.8/openssl/ssl.rb
22
20
  lib/1.8/openssl/x509-internal.rb
23
21
  lib/1.8/openssl/x509.rb
22
+ lib/1.9
24
23
  lib/1.9/openssl
25
24
  lib/1.9/openssl.rb
26
25
  lib/1.9/openssl/bn.rb
@@ -32,128 +31,14 @@ lib/1.9/openssl/ssl-internal.rb
32
31
  lib/1.9/openssl/ssl.rb
33
32
  lib/1.9/openssl/x509-internal.rb
34
33
  lib/1.9/openssl/x509.rb
34
+ lib/shared
35
35
  lib/shared/jopenssl
36
- lib/shared/jopenssl.jar
36
+ lib/shared/jopenssl/version.rb
37
37
  lib/shared/jruby-openssl.rb
38
38
  lib/shared/openssl
39
39
  lib/shared/openssl.rb
40
- lib/shared/jopenssl/version.rb
41
40
  lib/shared/openssl/pkcs12.rb
42
- test/1.8
43
- test/1.9
44
- test/cert_with_ec_pk.cer
45
- test/fixture
46
41
  test/java
47
- test/ref
48
- test/ruby
49
- test/test_all.rb
50
- test/test_certificate.rb
51
- test/test_cipher.rb
52
- test/test_imaps.rb
53
- test/test_integration.rb
54
- test/test_java.rb
55
- test/test_openssl.rb
56
- test/test_parse_certificate.rb
57
- test/test_pkcs7.rb
58
- test/test_pkey_dsa.rb
59
- test/test_pkey_rsa.rb
60
- test/test_ssl.rb
61
- test/test_x509store.rb
62
- test/ut_eof.rb
63
- test/1.8/ssl_server.rb
64
- test/1.8/test_asn1.rb
65
- test/1.8/test_cipher.rb
66
- test/1.8/test_config.rb
67
- test/1.8/test_digest.rb
68
- test/1.8/test_ec.rb
69
- test/1.8/test_hmac.rb
70
- test/1.8/test_ns_spki.rb
71
- test/1.8/test_pair.rb
72
- test/1.8/test_pkcs7.rb
73
- test/1.8/test_pkey_rsa.rb
74
- test/1.8/test_ssl.rb
75
- test/1.8/test_x509cert.rb
76
- test/1.8/test_x509crl.rb
77
- test/1.8/test_x509ext.rb
78
- test/1.8/test_x509name.rb
79
- test/1.8/test_x509req.rb
80
- test/1.8/test_x509store.rb
81
- test/1.8/utils.rb
82
- test/1.9/ssl_server.rb
83
- test/1.9/test_asn1.rb
84
- test/1.9/test_bn.rb
85
- test/1.9/test_buffering.rb
86
- test/1.9/test_cipher.rb
87
- test/1.9/test_config.rb
88
- test/1.9/test_digest.rb
89
- test/1.9/test_engine.rb
90
- test/1.9/test_hmac.rb
91
- test/1.9/test_ns_spki.rb
92
- test/1.9/test_ocsp.rb
93
- test/1.9/test_pair.rb
94
- test/1.9/test_pkcs12.rb
95
- test/1.9/test_pkcs7.rb
96
- test/1.9/test_pkey_dh.rb
97
- test/1.9/test_pkey_dsa.rb
98
- test/1.9/test_pkey_ec.rb
99
- test/1.9/test_pkey_rsa.rb
100
- test/1.9/test_ssl.rb
101
- test/1.9/test_ssl_session.rb
102
- test/1.9/test_x509cert.rb
103
- test/1.9/test_x509crl.rb
104
- test/1.9/test_x509ext.rb
105
- test/1.9/test_x509name.rb
106
- test/1.9/test_x509req.rb
107
- test/1.9/test_x509store.rb
108
- test/1.9/utils.rb
109
- test/fixture/ca-bundle.crt
110
- test/fixture/ca_path
111
- test/fixture/cacert.pem
112
- test/fixture/cert_localhost.pem
113
- test/fixture/common.pem
114
- test/fixture/ids_in_subject_rdn_set.pem
115
- test/fixture/imaps
116
- test/fixture/key_then_cert.pem
117
- test/fixture/keypair.pem
118
- test/fixture/localhost_keypair.pem
119
- test/fixture/max.pem
120
- test/fixture/purpose
121
- test/fixture/selfcert.pem
122
- test/fixture/verisign.pem
123
- test/fixture/verisign_c3.pem
124
- test/fixture/ca_path/72fa7371.0
125
- test/fixture/ca_path/verisign.pem
126
- test/fixture/imaps/cacert.pem
127
- test/fixture/imaps/server.crt
128
- test/fixture/imaps/server.key
129
- test/fixture/purpose/b70a5bc1.0
130
- test/fixture/purpose/ca
131
- test/fixture/purpose/cacert.pem
132
- test/fixture/purpose/scripts
133
- test/fixture/purpose/sslclient
134
- test/fixture/purpose/sslclient.pem
135
- test/fixture/purpose/sslserver
136
- test/fixture/purpose/sslserver.pem
137
- test/fixture/purpose/sslserver_no_dsig_in_keyUsage.pem
138
- test/fixture/purpose/ca/PASSWD_OF_CA_KEY_IS_1234
139
- test/fixture/purpose/ca/ca_config.rb
140
- test/fixture/purpose/ca/cacert.pem
141
- test/fixture/purpose/ca/newcerts
142
- test/fixture/purpose/ca/private
143
- test/fixture/purpose/ca/serial
144
- test/fixture/purpose/ca/newcerts/2_cert.pem
145
- test/fixture/purpose/ca/newcerts/3_cert.pem
146
- test/fixture/purpose/ca/newcerts/4_cert.pem
147
- test/fixture/purpose/ca/private/cakeypair.pem
148
- test/fixture/purpose/scripts/gen_cert.rb
149
- test/fixture/purpose/scripts/gen_csr.rb
150
- test/fixture/purpose/scripts/init_ca.rb
151
- test/fixture/purpose/sslclient/csr.pem
152
- test/fixture/purpose/sslclient/keypair.pem
153
- test/fixture/purpose/sslclient/sslclient.pem
154
- test/fixture/purpose/sslserver/csr.pem
155
- test/fixture/purpose/sslserver/keypair.pem
156
- test/fixture/purpose/sslserver/sslserver.pem
157
42
  test/java/pkcs7_mime_enveloped.message
158
43
  test/java/pkcs7_mime_signed.message
159
44
  test/java/pkcs7_multipart_signed.message
@@ -162,9 +47,5 @@ test/java/test_java_bio.rb
162
47
  test/java/test_java_mime.rb
163
48
  test/java/test_java_pkcs7.rb
164
49
  test/java/test_java_smime.rb
165
- test/ref/a.out
166
- test/ref/compile.rb
167
- test/ref/pkcs1
168
- test/ref/pkcs1.c
169
- test/ruby/envutil.rb
170
- test/ruby/ut_eof.rb
50
+ test/test_java.rb
51
+ test/ut_eof.rb
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rake'
2
2
  require 'rake/testtask'
3
3
 
4
4
  MANIFEST = FileList["Rakefile", "History.txt", "Manifest.txt", "README.txt", "License.txt", "lib/shared/jopenssl.jar", "lib/**/*", "test/**/*"]
5
- BC_JARS = FileList["build_lib/bc*.jar"]
5
+ BC_JARS = FileList["../../build_lib/bc*.jar"]
6
6
 
7
7
  task :default => [:java_compile, :test]
8
8
 
@@ -34,7 +34,7 @@ task :java_compile do
34
34
  end
35
35
 
36
36
  File.open("pkg/compile_sourcefiles", "w") do |f|
37
- f << FileList['src/org/jruby/ext/openssl/**/*.java'].join(' ')
37
+ f << FileList['../../src/org/jruby/ext/openssl/**/*.java'].join(' ')
38
38
  end
39
39
 
40
40
  sh "javac @pkg/compile_options @pkg/compile_classpath @pkg/compile_sourcefiles"
@@ -54,7 +54,7 @@ begin
54
54
  ENV['RUBY_FLAGS'] ||= [
55
55
  (RUBY_VERSION >= '1.9.0' ? '--1.9' : '--1.8'),
56
56
  '-w',
57
- '-Ibuild_lib:lib/shared:lib:test',
57
+ '-I../../build_lib:lib/shared:lib:test',
58
58
  '-J-ea',
59
59
  ENV['RUBY_DEBUG']
60
60
  ].compact.join(' ')
Binary file
@@ -1,5 +1,5 @@
1
1
  module Jopenssl
2
2
  module Version
3
- VERSION = "0.8.0.pre3"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby-openssl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.pre3
5
- prerelease: 6
4
+ prerelease:
5
+ version: 0.8.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ola Bini and JRuby contributors
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-27 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bouncy-castle-java
@@ -82,110 +82,10 @@ files:
82
82
  - lib/1.9/openssl/ssl.rb
83
83
  - lib/1.9/openssl/x509-internal.rb
84
84
  - lib/1.9/openssl/x509.rb
85
+ - lib/shared/jopenssl/version.rb
85
86
  - lib/shared/jruby-openssl.rb
86
87
  - lib/shared/openssl.rb
87
- - lib/shared/jopenssl/version.rb
88
88
  - lib/shared/openssl/pkcs12.rb
89
- - test/cert_with_ec_pk.cer
90
- - test/test_all.rb
91
- - test/test_certificate.rb
92
- - test/test_cipher.rb
93
- - test/test_imaps.rb
94
- - test/test_integration.rb
95
- - test/test_java.rb
96
- - test/test_openssl.rb
97
- - test/test_parse_certificate.rb
98
- - test/test_pkcs7.rb
99
- - test/test_pkey_dsa.rb
100
- - test/test_pkey_rsa.rb
101
- - test/test_ssl.rb
102
- - test/test_x509store.rb
103
- - test/ut_eof.rb
104
- - test/1.8/ssl_server.rb
105
- - test/1.8/test_asn1.rb
106
- - test/1.8/test_cipher.rb
107
- - test/1.8/test_config.rb
108
- - test/1.8/test_digest.rb
109
- - test/1.8/test_ec.rb
110
- - test/1.8/test_hmac.rb
111
- - test/1.8/test_ns_spki.rb
112
- - test/1.8/test_pair.rb
113
- - test/1.8/test_pkcs7.rb
114
- - test/1.8/test_pkey_rsa.rb
115
- - test/1.8/test_ssl.rb
116
- - test/1.8/test_x509cert.rb
117
- - test/1.8/test_x509crl.rb
118
- - test/1.8/test_x509ext.rb
119
- - test/1.8/test_x509name.rb
120
- - test/1.8/test_x509req.rb
121
- - test/1.8/test_x509store.rb
122
- - test/1.8/utils.rb
123
- - test/1.9/ssl_server.rb
124
- - test/1.9/test_asn1.rb
125
- - test/1.9/test_bn.rb
126
- - test/1.9/test_buffering.rb
127
- - test/1.9/test_cipher.rb
128
- - test/1.9/test_config.rb
129
- - test/1.9/test_digest.rb
130
- - test/1.9/test_engine.rb
131
- - test/1.9/test_hmac.rb
132
- - test/1.9/test_ns_spki.rb
133
- - test/1.9/test_ocsp.rb
134
- - test/1.9/test_pair.rb
135
- - test/1.9/test_pkcs12.rb
136
- - test/1.9/test_pkcs7.rb
137
- - test/1.9/test_pkey_dh.rb
138
- - test/1.9/test_pkey_dsa.rb
139
- - test/1.9/test_pkey_ec.rb
140
- - test/1.9/test_pkey_rsa.rb
141
- - test/1.9/test_ssl.rb
142
- - test/1.9/test_ssl_session.rb
143
- - test/1.9/test_x509cert.rb
144
- - test/1.9/test_x509crl.rb
145
- - test/1.9/test_x509ext.rb
146
- - test/1.9/test_x509name.rb
147
- - test/1.9/test_x509req.rb
148
- - test/1.9/test_x509store.rb
149
- - test/1.9/utils.rb
150
- - test/fixture/ca-bundle.crt
151
- - test/fixture/cacert.pem
152
- - test/fixture/cert_localhost.pem
153
- - test/fixture/common.pem
154
- - test/fixture/ids_in_subject_rdn_set.pem
155
- - test/fixture/key_then_cert.pem
156
- - test/fixture/keypair.pem
157
- - test/fixture/localhost_keypair.pem
158
- - test/fixture/max.pem
159
- - test/fixture/selfcert.pem
160
- - test/fixture/verisign.pem
161
- - test/fixture/verisign_c3.pem
162
- - test/fixture/ca_path/72fa7371.0
163
- - test/fixture/ca_path/verisign.pem
164
- - test/fixture/imaps/cacert.pem
165
- - test/fixture/imaps/server.crt
166
- - test/fixture/imaps/server.key
167
- - test/fixture/purpose/b70a5bc1.0
168
- - test/fixture/purpose/cacert.pem
169
- - test/fixture/purpose/sslclient.pem
170
- - test/fixture/purpose/sslserver.pem
171
- - test/fixture/purpose/sslserver_no_dsig_in_keyUsage.pem
172
- - test/fixture/purpose/ca/PASSWD_OF_CA_KEY_IS_1234
173
- - test/fixture/purpose/ca/ca_config.rb
174
- - test/fixture/purpose/ca/cacert.pem
175
- - test/fixture/purpose/ca/serial
176
- - test/fixture/purpose/ca/newcerts/2_cert.pem
177
- - test/fixture/purpose/ca/newcerts/3_cert.pem
178
- - test/fixture/purpose/ca/newcerts/4_cert.pem
179
- - test/fixture/purpose/ca/private/cakeypair.pem
180
- - test/fixture/purpose/scripts/gen_cert.rb
181
- - test/fixture/purpose/scripts/gen_csr.rb
182
- - test/fixture/purpose/scripts/init_ca.rb
183
- - test/fixture/purpose/sslclient/csr.pem
184
- - test/fixture/purpose/sslclient/keypair.pem
185
- - test/fixture/purpose/sslclient/sslclient.pem
186
- - test/fixture/purpose/sslserver/csr.pem
187
- - test/fixture/purpose/sslserver/keypair.pem
188
- - test/fixture/purpose/sslserver/sslserver.pem
189
89
  - test/java/pkcs7_mime_enveloped.message
190
90
  - test/java/pkcs7_mime_signed.message
191
91
  - test/java/pkcs7_multipart_signed.message
@@ -194,12 +94,8 @@ files:
194
94
  - test/java/test_java_mime.rb
195
95
  - test/java/test_java_pkcs7.rb
196
96
  - test/java/test_java_smime.rb
197
- - test/ref/a.out
198
- - test/ref/compile.rb
199
- - test/ref/pkcs1
200
- - test/ref/pkcs1.c
201
- - test/ruby/envutil.rb
202
- - test/ruby/ut_eof.rb
97
+ - test/test_java.rb
98
+ - test/ut_eof.rb
203
99
  - .gemtest
204
100
  homepage: https://github.com/jruby/jruby-ossl
205
101
  licenses: []
@@ -218,10 +114,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
114
  none: false
219
115
  required_rubygems_version: !ruby/object:Gem::Requirement
220
116
  requirements:
221
- - - !binary |-
222
- Pg==
117
+ - - ! '>='
223
118
  - !ruby/object:Gem::Version
224
- version: 1.3.1
119
+ version: !binary |-
120
+ MA==
225
121
  none: false
226
122
  requirements: []
227
123
  rubyforge_project: jruby-extras
@@ -229,6 +125,4 @@ rubygems_version: 1.8.24
229
125
  signing_key:
230
126
  specification_version: 3
231
127
  summary: OpenSSL add-on for JRuby
232
- test_files:
233
- - !binary |-
234
- dGVzdC90ZXN0X2FsbC5yYg==
128
+ test_files: []
@@ -1,99 +0,0 @@
1
- require "socket"
2
- require "thread"
3
- require "openssl"
4
- require File.join(File.dirname(__FILE__), "utils.rb")
5
-
6
- def get_pem(io=$stdin)
7
- buf = ""
8
- while line = io.gets
9
- if /^-----BEGIN / =~ line
10
- buf << line
11
- break
12
- end
13
- end
14
- while line = io.gets
15
- buf << line
16
- if /^-----END / =~ line
17
- break
18
- end
19
- end
20
- return buf
21
- end
22
-
23
- def make_key(pem)
24
- begin
25
- return OpenSSL::PKey::RSA.new(pem)
26
- rescue
27
- return OpenSSL::PKey::DSA.new(pem)
28
- end
29
- end
30
-
31
- if $DEBUG
32
- def log(s); File.open("ssl-server-debug", "a") {|f| f.puts s}; end
33
- File.open("ssl-server-debug", "w") {|f| f << ""}
34
- log "server starting"
35
- else
36
- def log(s) end
37
- end
38
-
39
- begin
40
- ca_cert = OpenSSL::X509::Certificate.new(get_pem)
41
- log "got ca cert #{ca_cert.inspect}"
42
- ssl_cert = OpenSSL::X509::Certificate.new(get_pem)
43
- log "got ssl cert #{ssl_cert.inspect}"
44
- ssl_key = make_key(get_pem)
45
- port = Integer(ARGV.shift)
46
- verify_mode = Integer(ARGV.shift)
47
- start_immediately = (/yes/ =~ ARGV.shift)
48
-
49
- store = OpenSSL::X509::Store.new
50
- store.add_cert(ca_cert)
51
- store.purpose = OpenSSL::X509::PURPOSE_SSL_CLIENT
52
- ctx = OpenSSL::SSL::SSLContext.new
53
- ctx.cert_store = store
54
- #ctx.extra_chain_cert = [ ca_cert ]
55
- ctx.cert = ssl_cert
56
- ctx.key = ssl_key
57
- ctx.verify_mode = verify_mode
58
-
59
- Socket.do_not_reverse_lookup = true
60
- tcps = nil
61
- 100.times{|i|
62
- begin
63
- log "starting server on #{port+i}"
64
- tcps = TCPServer.new("0.0.0.0", port+i)
65
- port = port + i
66
- break
67
- rescue Errno::EADDRINUSE
68
- next
69
- end
70
- }
71
- log "starting ssl server"
72
- ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
73
- ssls.start_immediately = start_immediately
74
-
75
- log("sending pid #{Process.pid}")
76
- $stdout.sync = true
77
- $stdout.puts Process.pid
78
- $stdout.puts port
79
-
80
- loop do
81
- ssl = ssls.accept rescue next
82
- Thread.start{
83
- q = Queue.new
84
- th = Thread.start{ ssl.write(q.shift) while true }
85
- while line = ssl.gets
86
- if line =~ /^STARTTLS$/
87
- ssl.accept
88
- next
89
- end
90
- q.push(line)
91
- end
92
- th.kill if q.empty?
93
- ssl.close
94
- }
95
- end
96
- rescue
97
- log $!
98
- log $!.backtrace.join("\n")
99
- end