openssl 3.3.0 → 4.0.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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +3 -0
- data/History.md +156 -0
- data/README.md +12 -11
- data/ext/openssl/extconf.rb +30 -69
- data/ext/openssl/openssl_missing.h +0 -206
- data/ext/openssl/ossl.c +280 -301
- data/ext/openssl/ossl.h +15 -10
- data/ext/openssl/ossl_asn1.c +598 -406
- data/ext/openssl/ossl_asn1.h +15 -1
- data/ext/openssl/ossl_bio.c +3 -3
- data/ext/openssl/ossl_bn.c +286 -291
- data/ext/openssl/ossl_cipher.c +257 -209
- data/ext/openssl/ossl_cipher.h +10 -1
- data/ext/openssl/ossl_config.c +1 -6
- data/ext/openssl/ossl_digest.c +74 -43
- data/ext/openssl/ossl_digest.h +9 -1
- data/ext/openssl/ossl_engine.c +39 -103
- data/ext/openssl/ossl_hmac.c +30 -36
- data/ext/openssl/ossl_kdf.c +42 -53
- data/ext/openssl/ossl_ns_spki.c +31 -37
- data/ext/openssl/ossl_ocsp.c +214 -241
- data/ext/openssl/ossl_pkcs12.c +26 -26
- data/ext/openssl/ossl_pkcs7.c +176 -146
- data/ext/openssl/ossl_pkey.c +163 -178
- data/ext/openssl/ossl_pkey.h +99 -99
- data/ext/openssl/ossl_pkey_dh.c +32 -67
- data/ext/openssl/ossl_pkey_dsa.c +16 -53
- data/ext/openssl/ossl_pkey_ec.c +181 -237
- data/ext/openssl/ossl_pkey_rsa.c +57 -102
- data/ext/openssl/ossl_provider.c +0 -7
- data/ext/openssl/ossl_rand.c +7 -14
- data/ext/openssl/ossl_ssl.c +544 -393
- data/ext/openssl/ossl_ssl.h +8 -8
- data/ext/openssl/ossl_ssl_session.c +93 -97
- data/ext/openssl/ossl_ts.c +81 -127
- data/ext/openssl/ossl_x509.c +9 -28
- data/ext/openssl/ossl_x509attr.c +33 -54
- data/ext/openssl/ossl_x509cert.c +69 -100
- data/ext/openssl/ossl_x509crl.c +78 -89
- data/ext/openssl/ossl_x509ext.c +45 -66
- data/ext/openssl/ossl_x509name.c +63 -88
- data/ext/openssl/ossl_x509req.c +55 -62
- data/ext/openssl/ossl_x509revoked.c +27 -41
- data/ext/openssl/ossl_x509store.c +38 -56
- data/lib/openssl/buffering.rb +30 -24
- data/lib/openssl/digest.rb +1 -1
- data/lib/openssl/pkey.rb +71 -49
- data/lib/openssl/ssl.rb +12 -80
- data/lib/openssl/version.rb +2 -1
- data/lib/openssl/x509.rb +9 -0
- data/lib/openssl.rb +9 -6
- metadata +3 -8
- data/ext/openssl/openssl_missing.c +0 -40
- data/lib/openssl/asn1.rb +0 -188
data/lib/openssl/pkey.rb
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
require_relative 'marshal'
|
|
8
8
|
|
|
9
9
|
module OpenSSL::PKey
|
|
10
|
+
# Alias of PKeyError. Before version 4.0.0, this was a subclass of PKeyError.
|
|
11
|
+
DHError = PKeyError
|
|
12
|
+
|
|
10
13
|
class DH
|
|
11
14
|
include OpenSSL::Marshal
|
|
12
15
|
|
|
@@ -34,6 +37,18 @@ module OpenSSL::PKey
|
|
|
34
37
|
DH.new(to_der)
|
|
35
38
|
end
|
|
36
39
|
|
|
40
|
+
# :call-seq:
|
|
41
|
+
# dh.params -> hash
|
|
42
|
+
#
|
|
43
|
+
# Stores all parameters of key to a Hash.
|
|
44
|
+
#
|
|
45
|
+
# The hash has keys 'p', 'q', 'g', 'pub_key', and 'priv_key'.
|
|
46
|
+
def params
|
|
47
|
+
%w{p q g pub_key priv_key}.map { |name|
|
|
48
|
+
[name, send(name)]
|
|
49
|
+
}.to_h
|
|
50
|
+
end
|
|
51
|
+
|
|
37
52
|
# :call-seq:
|
|
38
53
|
# dh.compute_key(pub_bn) -> string
|
|
39
54
|
#
|
|
@@ -90,7 +105,7 @@ module OpenSSL::PKey
|
|
|
90
105
|
# puts dh0.pub_key == dh.pub_key #=> false
|
|
91
106
|
def generate_key!
|
|
92
107
|
if OpenSSL::OPENSSL_VERSION_NUMBER >= 0x30000000
|
|
93
|
-
raise
|
|
108
|
+
raise PKeyError, "OpenSSL::PKey::DH is immutable on OpenSSL 3.0; " \
|
|
94
109
|
"use OpenSSL::PKey.generate_key instead"
|
|
95
110
|
end
|
|
96
111
|
|
|
@@ -135,6 +150,9 @@ module OpenSSL::PKey
|
|
|
135
150
|
end
|
|
136
151
|
end
|
|
137
152
|
|
|
153
|
+
# Alias of PKeyError. Before version 4.0.0, this was a subclass of PKeyError.
|
|
154
|
+
DSAError = PKeyError
|
|
155
|
+
|
|
138
156
|
class DSA
|
|
139
157
|
include OpenSSL::Marshal
|
|
140
158
|
|
|
@@ -154,6 +172,18 @@ module OpenSSL::PKey
|
|
|
154
172
|
OpenSSL::PKey.read(public_to_der)
|
|
155
173
|
end
|
|
156
174
|
|
|
175
|
+
# :call-seq:
|
|
176
|
+
# dsa.params -> hash
|
|
177
|
+
#
|
|
178
|
+
# Stores all parameters of key to a Hash.
|
|
179
|
+
#
|
|
180
|
+
# The hash has keys 'p', 'q', 'g', 'pub_key', and 'priv_key'.
|
|
181
|
+
def params
|
|
182
|
+
%w{p q g pub_key priv_key}.map { |name|
|
|
183
|
+
[name, send(name)]
|
|
184
|
+
}.to_h
|
|
185
|
+
end
|
|
186
|
+
|
|
157
187
|
class << self
|
|
158
188
|
# :call-seq:
|
|
159
189
|
# DSA.generate(size) -> dsa
|
|
@@ -218,13 +248,9 @@ module OpenSSL::PKey
|
|
|
218
248
|
# sig = dsa.sign_raw(nil, digest)
|
|
219
249
|
# p dsa.verify_raw(nil, sig, digest) #=> true
|
|
220
250
|
def syssign(string)
|
|
221
|
-
q or raise
|
|
222
|
-
private? or raise
|
|
223
|
-
|
|
224
|
-
sign_raw(nil, string)
|
|
225
|
-
rescue OpenSSL::PKey::PKeyError
|
|
226
|
-
raise OpenSSL::PKey::DSAError, $!.message
|
|
227
|
-
end
|
|
251
|
+
q or raise PKeyError, "incomplete DSA"
|
|
252
|
+
private? or raise PKeyError, "Private DSA key needed!"
|
|
253
|
+
sign_raw(nil, string)
|
|
228
254
|
end
|
|
229
255
|
|
|
230
256
|
# :call-seq:
|
|
@@ -242,12 +268,13 @@ module OpenSSL::PKey
|
|
|
242
268
|
# A \DSA signature value.
|
|
243
269
|
def sysverify(digest, sig)
|
|
244
270
|
verify_raw(nil, sig, digest)
|
|
245
|
-
rescue OpenSSL::PKey::PKeyError
|
|
246
|
-
raise OpenSSL::PKey::DSAError, $!.message
|
|
247
271
|
end
|
|
248
272
|
end
|
|
249
273
|
|
|
250
274
|
if defined?(EC)
|
|
275
|
+
# Alias of PKeyError. Before version 4.0.0, this was a subclass of PKeyError.
|
|
276
|
+
ECError = PKeyError
|
|
277
|
+
|
|
251
278
|
class EC
|
|
252
279
|
include OpenSSL::Marshal
|
|
253
280
|
|
|
@@ -258,8 +285,6 @@ module OpenSSL::PKey
|
|
|
258
285
|
# Consider using PKey::PKey#sign_raw and PKey::PKey#verify_raw instead.
|
|
259
286
|
def dsa_sign_asn1(data)
|
|
260
287
|
sign_raw(nil, data)
|
|
261
|
-
rescue OpenSSL::PKey::PKeyError
|
|
262
|
-
raise OpenSSL::PKey::ECError, $!.message
|
|
263
288
|
end
|
|
264
289
|
|
|
265
290
|
# :call-seq:
|
|
@@ -269,8 +294,6 @@ module OpenSSL::PKey
|
|
|
269
294
|
# Consider using PKey::PKey#sign_raw and PKey::PKey#verify_raw instead.
|
|
270
295
|
def dsa_verify_asn1(data, sig)
|
|
271
296
|
verify_raw(nil, sig, data)
|
|
272
|
-
rescue OpenSSL::PKey::PKeyError
|
|
273
|
-
raise OpenSSL::PKey::ECError, $!.message
|
|
274
297
|
end
|
|
275
298
|
|
|
276
299
|
# :call-seq:
|
|
@@ -310,6 +333,9 @@ module OpenSSL::PKey
|
|
|
310
333
|
end
|
|
311
334
|
end
|
|
312
335
|
|
|
336
|
+
# Alias of PKeyError. Before version 4.0.0, this was a subclass of PKeyError.
|
|
337
|
+
RSAError = PKeyError
|
|
338
|
+
|
|
313
339
|
class RSA
|
|
314
340
|
include OpenSSL::Marshal
|
|
315
341
|
|
|
@@ -328,6 +354,18 @@ module OpenSSL::PKey
|
|
|
328
354
|
OpenSSL::PKey.read(public_to_der)
|
|
329
355
|
end
|
|
330
356
|
|
|
357
|
+
# :call-seq:
|
|
358
|
+
# rsa.params -> hash
|
|
359
|
+
#
|
|
360
|
+
# Stores all parameters of key to a Hash.
|
|
361
|
+
#
|
|
362
|
+
# The hash has keys 'n', 'e', 'd', 'p', 'q', 'dmp1', 'dmq1', and 'iqmp'.
|
|
363
|
+
def params
|
|
364
|
+
%w{n e d p q dmp1 dmq1 iqmp}.map { |name|
|
|
365
|
+
[name, send(name)]
|
|
366
|
+
}.to_h
|
|
367
|
+
end
|
|
368
|
+
|
|
331
369
|
class << self
|
|
332
370
|
# :call-seq:
|
|
333
371
|
# RSA.generate(size, exponent = 65537) -> RSA
|
|
@@ -371,15 +409,11 @@ module OpenSSL::PKey
|
|
|
371
409
|
# Consider using PKey::PKey#sign_raw and PKey::PKey#verify_raw, and
|
|
372
410
|
# PKey::PKey#verify_recover instead.
|
|
373
411
|
def private_encrypt(string, padding = PKCS1_PADDING)
|
|
374
|
-
n or raise
|
|
375
|
-
private? or raise
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
})
|
|
380
|
-
rescue OpenSSL::PKey::PKeyError
|
|
381
|
-
raise OpenSSL::PKey::RSAError, $!.message
|
|
382
|
-
end
|
|
412
|
+
n or raise PKeyError, "incomplete RSA"
|
|
413
|
+
private? or raise PKeyError, "private key needed."
|
|
414
|
+
sign_raw(nil, string, {
|
|
415
|
+
"rsa_padding_mode" => translate_padding_mode(padding),
|
|
416
|
+
})
|
|
383
417
|
end
|
|
384
418
|
|
|
385
419
|
# :call-seq:
|
|
@@ -394,14 +428,10 @@ module OpenSSL::PKey
|
|
|
394
428
|
# Consider using PKey::PKey#sign_raw and PKey::PKey#verify_raw, and
|
|
395
429
|
# PKey::PKey#verify_recover instead.
|
|
396
430
|
def public_decrypt(string, padding = PKCS1_PADDING)
|
|
397
|
-
n or raise
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
})
|
|
402
|
-
rescue OpenSSL::PKey::PKeyError
|
|
403
|
-
raise OpenSSL::PKey::RSAError, $!.message
|
|
404
|
-
end
|
|
431
|
+
n or raise PKeyError, "incomplete RSA"
|
|
432
|
+
verify_recover(nil, string, {
|
|
433
|
+
"rsa_padding_mode" => translate_padding_mode(padding),
|
|
434
|
+
})
|
|
405
435
|
end
|
|
406
436
|
|
|
407
437
|
# :call-seq:
|
|
@@ -416,14 +446,10 @@ module OpenSSL::PKey
|
|
|
416
446
|
# <b>Deprecated in version 3.0</b>.
|
|
417
447
|
# Consider using PKey::PKey#encrypt and PKey::PKey#decrypt instead.
|
|
418
448
|
def public_encrypt(data, padding = PKCS1_PADDING)
|
|
419
|
-
n or raise
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
})
|
|
424
|
-
rescue OpenSSL::PKey::PKeyError
|
|
425
|
-
raise OpenSSL::PKey::RSAError, $!.message
|
|
426
|
-
end
|
|
449
|
+
n or raise PKeyError, "incomplete RSA"
|
|
450
|
+
encrypt(data, {
|
|
451
|
+
"rsa_padding_mode" => translate_padding_mode(padding),
|
|
452
|
+
})
|
|
427
453
|
end
|
|
428
454
|
|
|
429
455
|
# :call-seq:
|
|
@@ -437,15 +463,11 @@ module OpenSSL::PKey
|
|
|
437
463
|
# <b>Deprecated in version 3.0</b>.
|
|
438
464
|
# Consider using PKey::PKey#encrypt and PKey::PKey#decrypt instead.
|
|
439
465
|
def private_decrypt(data, padding = PKCS1_PADDING)
|
|
440
|
-
n or raise
|
|
441
|
-
private? or raise
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
})
|
|
446
|
-
rescue OpenSSL::PKey::PKeyError
|
|
447
|
-
raise OpenSSL::PKey::RSAError, $!.message
|
|
448
|
-
end
|
|
466
|
+
n or raise PKeyError, "incomplete RSA"
|
|
467
|
+
private? or raise PKeyError, "private key needed."
|
|
468
|
+
decrypt(data, {
|
|
469
|
+
"rsa_padding_mode" => translate_padding_mode(padding),
|
|
470
|
+
})
|
|
449
471
|
end
|
|
450
472
|
|
|
451
473
|
PKCS1_PADDING = 1
|
|
@@ -464,7 +486,7 @@ module OpenSSL::PKey
|
|
|
464
486
|
when PKCS1_OAEP_PADDING
|
|
465
487
|
"oaep"
|
|
466
488
|
else
|
|
467
|
-
raise
|
|
489
|
+
raise PKeyError, "unsupported padding mode"
|
|
468
490
|
end
|
|
469
491
|
end
|
|
470
492
|
end
|
data/lib/openssl/ssl.rb
CHANGED
|
@@ -32,27 +32,7 @@ module OpenSSL
|
|
|
32
32
|
}.call
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
if
|
|
36
|
-
DH_ffdhe2048 = OpenSSL::PKey::DH.new <<-_end_of_pem_
|
|
37
|
-
-----BEGIN DH PARAMETERS-----
|
|
38
|
-
MIIBCAKCAQEA//////////+t+FRYortKmq/cViAnPTzx2LnFg84tNpWp4TZBFGQz
|
|
39
|
-
+8yTnc4kmz75fS/jY2MMddj2gbICrsRhetPfHtXV/WVhJDP1H18GbtCFY2VVPe0a
|
|
40
|
-
87VXE15/V8k1mE8McODmi3fipona8+/och3xWKE2rec1MKzKT0g6eXq8CrGCsyT7
|
|
41
|
-
YdEIqUuyyOP7uWrat2DX9GgdT0Kj3jlN9K5W7edjcrsZCwenyO4KbXCeAvzhzffi
|
|
42
|
-
7MA0BM0oNC9hkXL+nOmFg/+OTxIy7vKBg8P+OxtMb61zO7X8vC7CIAXFjvGDfRaD
|
|
43
|
-
ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
44
|
-
-----END DH PARAMETERS-----
|
|
45
|
-
_end_of_pem_
|
|
46
|
-
private_constant :DH_ffdhe2048
|
|
47
|
-
|
|
48
|
-
DEFAULT_TMP_DH_CALLBACK = lambda { |ctx, is_export, keylen| # :nodoc:
|
|
49
|
-
warn "using default DH parameters." if $VERBOSE
|
|
50
|
-
DH_ffdhe2048
|
|
51
|
-
}
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
if !(OpenSSL::OPENSSL_VERSION.start_with?("OpenSSL") &&
|
|
55
|
-
OpenSSL::OPENSSL_VERSION_NUMBER >= 0x10100000)
|
|
35
|
+
if !OpenSSL::OPENSSL_VERSION.start_with?("OpenSSL")
|
|
56
36
|
DEFAULT_PARAMS.merge!(
|
|
57
37
|
min_version: OpenSSL::SSL::TLS1_VERSION,
|
|
58
38
|
ciphers: %w{
|
|
@@ -86,26 +66,13 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
|
86
66
|
AES256-SHA256
|
|
87
67
|
AES128-SHA
|
|
88
68
|
AES256-SHA
|
|
89
|
-
}.join(":"),
|
|
69
|
+
}.join(":").freeze,
|
|
90
70
|
)
|
|
91
71
|
end
|
|
72
|
+
DEFAULT_PARAMS.freeze
|
|
92
73
|
|
|
93
74
|
DEFAULT_CERT_STORE = OpenSSL::X509::Store.new # :nodoc:
|
|
94
75
|
DEFAULT_CERT_STORE.set_default_paths
|
|
95
|
-
DEFAULT_CERT_STORE.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
|
|
96
|
-
|
|
97
|
-
# A callback invoked when DH parameters are required for ephemeral DH key
|
|
98
|
-
# exchange.
|
|
99
|
-
#
|
|
100
|
-
# The callback is invoked with the SSLSocket, a
|
|
101
|
-
# flag indicating the use of an export cipher and the keylength
|
|
102
|
-
# required.
|
|
103
|
-
#
|
|
104
|
-
# The callback must return an OpenSSL::PKey::DH instance of the correct
|
|
105
|
-
# key length.
|
|
106
|
-
#
|
|
107
|
-
# <b>Deprecated in version 3.0.</b> Use #tmp_dh= instead.
|
|
108
|
-
attr_accessor :tmp_dh_callback
|
|
109
76
|
|
|
110
77
|
# A callback invoked at connect time to distinguish between multiple
|
|
111
78
|
# server names.
|
|
@@ -148,49 +115,19 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
|
148
115
|
params.each{|name, value| self.__send__("#{name}=", value) }
|
|
149
116
|
if self.verify_mode != OpenSSL::SSL::VERIFY_NONE
|
|
150
117
|
unless self.ca_file or self.ca_path or self.cert_store
|
|
151
|
-
|
|
118
|
+
if not defined?(Ractor) or Ractor.current == Ractor.main
|
|
119
|
+
self.cert_store = DEFAULT_CERT_STORE
|
|
120
|
+
else
|
|
121
|
+
self.cert_store = Ractor.current[:__openssl_default_store__] ||=
|
|
122
|
+
OpenSSL::X509::Store.new.tap { |store|
|
|
123
|
+
store.set_default_paths
|
|
124
|
+
}
|
|
125
|
+
end
|
|
152
126
|
end
|
|
153
127
|
end
|
|
154
128
|
return params
|
|
155
129
|
end
|
|
156
130
|
|
|
157
|
-
# call-seq:
|
|
158
|
-
# ctx.min_version = OpenSSL::SSL::TLS1_2_VERSION
|
|
159
|
-
# ctx.min_version = :TLS1_2
|
|
160
|
-
# ctx.min_version = nil
|
|
161
|
-
#
|
|
162
|
-
# Sets the lower bound on the supported SSL/TLS protocol version. The
|
|
163
|
-
# version may be specified by an integer constant named
|
|
164
|
-
# OpenSSL::SSL::*_VERSION, a Symbol, or +nil+ which means "any version".
|
|
165
|
-
#
|
|
166
|
-
# Be careful that you don't overwrite OpenSSL::SSL::OP_NO_{SSL,TLS}v*
|
|
167
|
-
# options by #options= once you have called #min_version= or
|
|
168
|
-
# #max_version=.
|
|
169
|
-
#
|
|
170
|
-
# === Example
|
|
171
|
-
# ctx = OpenSSL::SSL::SSLContext.new
|
|
172
|
-
# ctx.min_version = OpenSSL::SSL::TLS1_1_VERSION
|
|
173
|
-
# ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
|
|
174
|
-
#
|
|
175
|
-
# sock = OpenSSL::SSL::SSLSocket.new(tcp_sock, ctx)
|
|
176
|
-
# sock.connect # Initiates a connection using either TLS 1.1 or TLS 1.2
|
|
177
|
-
def min_version=(version)
|
|
178
|
-
set_minmax_proto_version(version, @max_proto_version ||= nil)
|
|
179
|
-
@min_proto_version = version
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# call-seq:
|
|
183
|
-
# ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
|
|
184
|
-
# ctx.max_version = :TLS1_2
|
|
185
|
-
# ctx.max_version = nil
|
|
186
|
-
#
|
|
187
|
-
# Sets the upper bound of the supported SSL/TLS protocol version. See
|
|
188
|
-
# #min_version= for the possible values.
|
|
189
|
-
def max_version=(version)
|
|
190
|
-
set_minmax_proto_version(@min_proto_version ||= nil, version)
|
|
191
|
-
@max_proto_version = version
|
|
192
|
-
end
|
|
193
|
-
|
|
194
131
|
# call-seq:
|
|
195
132
|
# ctx.ssl_version = :TLSv1
|
|
196
133
|
# ctx.ssl_version = "SSLv23"
|
|
@@ -215,8 +152,7 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
|
215
152
|
end
|
|
216
153
|
version = METHODS_MAP[meth.intern] or
|
|
217
154
|
raise ArgumentError, "unknown SSL method `%s'" % meth
|
|
218
|
-
|
|
219
|
-
@min_proto_version = @max_proto_version = version
|
|
155
|
+
self.min_version = self.max_version = version
|
|
220
156
|
end
|
|
221
157
|
|
|
222
158
|
METHODS_MAP = {
|
|
@@ -496,10 +432,6 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
|
496
432
|
@context.client_cert_cb
|
|
497
433
|
end
|
|
498
434
|
|
|
499
|
-
def tmp_dh_callback
|
|
500
|
-
@context.tmp_dh_callback || OpenSSL::SSL::SSLContext::DEFAULT_TMP_DH_CALLBACK
|
|
501
|
-
end
|
|
502
|
-
|
|
503
435
|
def session_new_cb
|
|
504
436
|
@context.session_new_cb
|
|
505
437
|
end
|
data/lib/openssl/version.rb
CHANGED
data/lib/openssl/x509.rb
CHANGED
|
@@ -346,6 +346,15 @@ module OpenSSL
|
|
|
346
346
|
include Extension::CRLDistributionPoints
|
|
347
347
|
include Extension::AuthorityInfoAccess
|
|
348
348
|
|
|
349
|
+
def inspect
|
|
350
|
+
"#<#{self.class}: " \
|
|
351
|
+
"subject=#{subject.inspect}, " \
|
|
352
|
+
"issuer=#{issuer.inspect}, " \
|
|
353
|
+
"serial=#{serial.inspect}, " \
|
|
354
|
+
"not_before=#{not_before.inspect rescue "(error)"}, " \
|
|
355
|
+
"not_after=#{not_after.inspect rescue "(error)"}>"
|
|
356
|
+
end
|
|
357
|
+
|
|
349
358
|
def pretty_print(q)
|
|
350
359
|
q.object_group(self) {
|
|
351
360
|
q.breakable
|
data/lib/openssl.rb
CHANGED
|
@@ -13,23 +13,26 @@
|
|
|
13
13
|
require 'openssl.so'
|
|
14
14
|
|
|
15
15
|
require_relative 'openssl/bn'
|
|
16
|
-
require_relative 'openssl/asn1'
|
|
17
|
-
require_relative 'openssl/pkey'
|
|
18
16
|
require_relative 'openssl/cipher'
|
|
19
17
|
require_relative 'openssl/digest'
|
|
20
18
|
require_relative 'openssl/hmac'
|
|
21
|
-
require_relative 'openssl/x509'
|
|
22
|
-
require_relative 'openssl/ssl'
|
|
23
19
|
require_relative 'openssl/pkcs5'
|
|
20
|
+
require_relative 'openssl/pkey'
|
|
21
|
+
require_relative 'openssl/ssl'
|
|
24
22
|
require_relative 'openssl/version'
|
|
23
|
+
require_relative 'openssl/x509'
|
|
25
24
|
|
|
26
25
|
module OpenSSL
|
|
27
|
-
# call-seq:
|
|
28
|
-
#
|
|
26
|
+
# :call-seq:
|
|
27
|
+
# OpenSSL.secure_compare(string, string) -> true or false
|
|
29
28
|
#
|
|
30
29
|
# Constant time memory comparison. Inputs are hashed using SHA-256 to mask
|
|
31
30
|
# the length of the secret. Returns +true+ if the strings are identical,
|
|
32
31
|
# +false+ otherwise.
|
|
32
|
+
#
|
|
33
|
+
# This method is expensive due to the SHA-256 hashing. In most cases, where
|
|
34
|
+
# the input lengths are known to be equal or are not sensitive,
|
|
35
|
+
# OpenSSL.fixed_length_secure_compare should be used instead.
|
|
33
36
|
def self.secure_compare(a, b)
|
|
34
37
|
hashed_a = OpenSSL::Digest.digest('SHA256', a)
|
|
35
38
|
hashed_b = OpenSSL::Digest.digest('SHA256', b)
|
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openssl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Bosslet
|
|
8
8
|
- SHIBATA Hiroshi
|
|
9
9
|
- Zachary Scott
|
|
10
10
|
- Kazuki Yamaguchi
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies: []
|
|
16
15
|
description: OpenSSL for Ruby provides access to SSL/TLS and general-purpose cryptography
|
|
17
16
|
based on the OpenSSL library.
|
|
@@ -31,7 +30,6 @@ files:
|
|
|
31
30
|
- History.md
|
|
32
31
|
- README.md
|
|
33
32
|
- ext/openssl/extconf.rb
|
|
34
|
-
- ext/openssl/openssl_missing.c
|
|
35
33
|
- ext/openssl/openssl_missing.h
|
|
36
34
|
- ext/openssl/ossl.c
|
|
37
35
|
- ext/openssl/ossl.h
|
|
@@ -87,7 +85,6 @@ files:
|
|
|
87
85
|
- ext/openssl/ossl_x509revoked.c
|
|
88
86
|
- ext/openssl/ossl_x509store.c
|
|
89
87
|
- lib/openssl.rb
|
|
90
|
-
- lib/openssl/asn1.rb
|
|
91
88
|
- lib/openssl/bn.rb
|
|
92
89
|
- lib/openssl/buffering.rb
|
|
93
90
|
- lib/openssl/cipher.rb
|
|
@@ -105,7 +102,6 @@ licenses:
|
|
|
105
102
|
- BSD-2-Clause
|
|
106
103
|
metadata:
|
|
107
104
|
msys2_mingw_dependencies: openssl
|
|
108
|
-
post_install_message:
|
|
109
105
|
rdoc_options:
|
|
110
106
|
- "--main"
|
|
111
107
|
- README.md
|
|
@@ -122,8 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
122
118
|
- !ruby/object:Gem::Version
|
|
123
119
|
version: '0'
|
|
124
120
|
requirements: []
|
|
125
|
-
rubygems_version:
|
|
126
|
-
signing_key:
|
|
121
|
+
rubygems_version: 4.0.3
|
|
127
122
|
specification_version: 4
|
|
128
123
|
summary: SSL/TLS and general-purpose cryptography for Ruby
|
|
129
124
|
test_files: []
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* 'OpenSSL for Ruby' project
|
|
3
|
-
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
*/
|
|
6
|
-
/*
|
|
7
|
-
* This program is licensed under the same licence as Ruby.
|
|
8
|
-
* (See the file 'COPYING'.)
|
|
9
|
-
*/
|
|
10
|
-
#include RUBY_EXTCONF_H
|
|
11
|
-
|
|
12
|
-
#include <string.h> /* memcpy() */
|
|
13
|
-
#include <openssl/x509_vfy.h>
|
|
14
|
-
|
|
15
|
-
#include "openssl_missing.h"
|
|
16
|
-
|
|
17
|
-
/*** added in 1.1.0 ***/
|
|
18
|
-
#if !defined(HAVE_X509_CRL_GET0_SIGNATURE)
|
|
19
|
-
void
|
|
20
|
-
ossl_X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig,
|
|
21
|
-
const X509_ALGOR **palg)
|
|
22
|
-
{
|
|
23
|
-
if (psig != NULL)
|
|
24
|
-
*psig = crl->signature;
|
|
25
|
-
if (palg != NULL)
|
|
26
|
-
*palg = crl->sig_alg;
|
|
27
|
-
}
|
|
28
|
-
#endif
|
|
29
|
-
|
|
30
|
-
#if !defined(HAVE_X509_REQ_GET0_SIGNATURE)
|
|
31
|
-
void
|
|
32
|
-
ossl_X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig,
|
|
33
|
-
const X509_ALGOR **palg)
|
|
34
|
-
{
|
|
35
|
-
if (psig != NULL)
|
|
36
|
-
*psig = req->signature;
|
|
37
|
-
if (palg != NULL)
|
|
38
|
-
*palg = req->sig_alg;
|
|
39
|
-
}
|
|
40
|
-
#endif
|