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/asn1.rb
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
#--
|
|
3
|
-
#
|
|
4
|
-
# = Ruby-space definitions that completes C-space funcs for ASN.1
|
|
5
|
-
#
|
|
6
|
-
# = Licence
|
|
7
|
-
# This program is licensed under the same licence as Ruby.
|
|
8
|
-
# (See the file 'COPYING'.)
|
|
9
|
-
#++
|
|
10
|
-
|
|
11
|
-
module OpenSSL
|
|
12
|
-
module ASN1
|
|
13
|
-
class ASN1Data
|
|
14
|
-
#
|
|
15
|
-
# Carries the value of a ASN.1 type.
|
|
16
|
-
# Please confer Constructive and Primitive for the mappings between
|
|
17
|
-
# ASN.1 data types and Ruby classes.
|
|
18
|
-
#
|
|
19
|
-
attr_accessor :value
|
|
20
|
-
|
|
21
|
-
# An Integer representing the tag number of this ASN1Data. Never +nil+.
|
|
22
|
-
attr_accessor :tag
|
|
23
|
-
|
|
24
|
-
# A Symbol representing the tag class of this ASN1Data. Never +nil+.
|
|
25
|
-
# See ASN1Data for possible values.
|
|
26
|
-
attr_accessor :tag_class
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
# Never +nil+. A boolean value indicating whether the encoding uses
|
|
30
|
-
# indefinite length (in the case of parsing) or whether an indefinite
|
|
31
|
-
# length form shall be used (in the encoding case).
|
|
32
|
-
# In DER, every value uses definite length form. But in scenarios where
|
|
33
|
-
# large amounts of data need to be transferred it might be desirable to
|
|
34
|
-
# have some kind of streaming support available.
|
|
35
|
-
# For example, huge OCTET STRINGs are preferably sent in smaller-sized
|
|
36
|
-
# chunks, each at a time.
|
|
37
|
-
# This is possible in BER by setting the length bytes of an encoding
|
|
38
|
-
# to zero and by this indicating that the following value will be
|
|
39
|
-
# sent in chunks. Indefinite length encodings are always constructed.
|
|
40
|
-
# The end of such a stream of chunks is indicated by sending a EOC
|
|
41
|
-
# (End of Content) tag. SETs and SEQUENCEs may use an indefinite length
|
|
42
|
-
# encoding, but also primitive types such as e.g. OCTET STRINGS or
|
|
43
|
-
# BIT STRINGS may leverage this functionality (cf. ITU-T X.690).
|
|
44
|
-
#
|
|
45
|
-
attr_accessor :indefinite_length
|
|
46
|
-
|
|
47
|
-
alias infinite_length indefinite_length
|
|
48
|
-
alias infinite_length= indefinite_length=
|
|
49
|
-
|
|
50
|
-
#
|
|
51
|
-
# :call-seq:
|
|
52
|
-
# OpenSSL::ASN1::ASN1Data.new(value, tag, tag_class) => ASN1Data
|
|
53
|
-
#
|
|
54
|
-
# _value_: Please have a look at Constructive and Primitive to see how Ruby
|
|
55
|
-
# types are mapped to ASN.1 types and vice versa.
|
|
56
|
-
#
|
|
57
|
-
# _tag_: An Integer indicating the tag number.
|
|
58
|
-
#
|
|
59
|
-
# _tag_class_: A Symbol indicating the tag class. Please cf. ASN1 for
|
|
60
|
-
# possible values.
|
|
61
|
-
#
|
|
62
|
-
# == Example
|
|
63
|
-
# asn1_int = OpenSSL::ASN1Data.new(42, 2, :UNIVERSAL) # => Same as OpenSSL::ASN1::Integer.new(42)
|
|
64
|
-
# tagged_int = OpenSSL::ASN1Data.new(42, 0, :CONTEXT_SPECIFIC) # implicitly 0-tagged INTEGER
|
|
65
|
-
#
|
|
66
|
-
def initialize(value, tag, tag_class)
|
|
67
|
-
raise ASN1Error, "invalid tag class" unless tag_class.is_a?(Symbol)
|
|
68
|
-
|
|
69
|
-
@tag = tag
|
|
70
|
-
@value = value
|
|
71
|
-
@tag_class = tag_class
|
|
72
|
-
@indefinite_length = false
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
module TaggedASN1Data
|
|
77
|
-
#
|
|
78
|
-
# May be used as a hint for encoding a value either implicitly or
|
|
79
|
-
# explicitly by setting it either to +:IMPLICIT+ or to +:EXPLICIT+.
|
|
80
|
-
# _tagging_ is not set when a ASN.1 structure is parsed using
|
|
81
|
-
# OpenSSL::ASN1.decode.
|
|
82
|
-
#
|
|
83
|
-
attr_accessor :tagging
|
|
84
|
-
|
|
85
|
-
# :call-seq:
|
|
86
|
-
# OpenSSL::ASN1::Primitive.new(value [, tag, tagging, tag_class ]) => Primitive
|
|
87
|
-
#
|
|
88
|
-
# _value_: is mandatory.
|
|
89
|
-
#
|
|
90
|
-
# _tag_: optional, may be specified for tagged values. If no _tag_ is
|
|
91
|
-
# specified, the UNIVERSAL tag corresponding to the Primitive sub-class
|
|
92
|
-
# is used by default.
|
|
93
|
-
#
|
|
94
|
-
# _tagging_: may be used as an encoding hint to encode a value either
|
|
95
|
-
# explicitly or implicitly, see ASN1 for possible values.
|
|
96
|
-
#
|
|
97
|
-
# _tag_class_: if _tag_ and _tagging_ are +nil+ then this is set to
|
|
98
|
-
# +:UNIVERSAL+ by default. If either _tag_ or _tagging_ are set then
|
|
99
|
-
# +:CONTEXT_SPECIFIC+ is used as the default. For possible values please
|
|
100
|
-
# cf. ASN1.
|
|
101
|
-
#
|
|
102
|
-
# == Example
|
|
103
|
-
# int = OpenSSL::ASN1::Integer.new(42)
|
|
104
|
-
# zero_tagged_int = OpenSSL::ASN1::Integer.new(42, 0, :IMPLICIT)
|
|
105
|
-
# private_explicit_zero_tagged_int = OpenSSL::ASN1::Integer.new(42, 0, :EXPLICIT, :PRIVATE)
|
|
106
|
-
#
|
|
107
|
-
def initialize(value, tag = nil, tagging = nil, tag_class = nil)
|
|
108
|
-
tag ||= ASN1.take_default_tag(self.class)
|
|
109
|
-
|
|
110
|
-
raise ASN1Error, "must specify tag number" unless tag
|
|
111
|
-
|
|
112
|
-
if tagging
|
|
113
|
-
raise ASN1Error, "invalid tagging method" unless tagging.is_a?(Symbol)
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
tag_class ||= tagging ? :CONTEXT_SPECIFIC : :UNIVERSAL
|
|
117
|
-
|
|
118
|
-
raise ASN1Error, "invalid tag class" unless tag_class.is_a?(Symbol)
|
|
119
|
-
|
|
120
|
-
@tagging = tagging
|
|
121
|
-
super(value ,tag, tag_class)
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
class Primitive < ASN1Data
|
|
126
|
-
include TaggedASN1Data
|
|
127
|
-
|
|
128
|
-
undef_method :indefinite_length=
|
|
129
|
-
undef_method :infinite_length=
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
class Constructive < ASN1Data
|
|
133
|
-
include TaggedASN1Data
|
|
134
|
-
include Enumerable
|
|
135
|
-
|
|
136
|
-
# :call-seq:
|
|
137
|
-
# asn1_ary.each { |asn1| block } => asn1_ary
|
|
138
|
-
#
|
|
139
|
-
# Calls the given block once for each element in self, passing that element
|
|
140
|
-
# as parameter _asn1_. If no block is given, an enumerator is returned
|
|
141
|
-
# instead.
|
|
142
|
-
#
|
|
143
|
-
# == Example
|
|
144
|
-
# asn1_ary.each do |asn1|
|
|
145
|
-
# puts asn1
|
|
146
|
-
# end
|
|
147
|
-
#
|
|
148
|
-
def each(&blk)
|
|
149
|
-
@value.each(&blk)
|
|
150
|
-
|
|
151
|
-
self
|
|
152
|
-
end
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
class Boolean < Primitive ; end
|
|
156
|
-
class Integer < Primitive ; end
|
|
157
|
-
class Enumerated < Primitive ; end
|
|
158
|
-
|
|
159
|
-
class BitString < Primitive
|
|
160
|
-
attr_accessor :unused_bits
|
|
161
|
-
|
|
162
|
-
def initialize(*)
|
|
163
|
-
super
|
|
164
|
-
|
|
165
|
-
@unused_bits = 0
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
class EndOfContent < ASN1Data
|
|
170
|
-
def initialize
|
|
171
|
-
super("", 0, :UNIVERSAL)
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
# :nodoc:
|
|
176
|
-
def self.take_default_tag(klass)
|
|
177
|
-
tag = CLASS_TAG_MAP[klass]
|
|
178
|
-
|
|
179
|
-
return tag if tag
|
|
180
|
-
|
|
181
|
-
sklass = klass.superclass
|
|
182
|
-
|
|
183
|
-
return unless sklass
|
|
184
|
-
|
|
185
|
-
take_default_tag(sklass)
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
end
|