openssl 2.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of openssl might be problematic. Click here for more details.

Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/BSDL +22 -0
  3. data/CONTRIBUTING.md +130 -0
  4. data/History.md +118 -0
  5. data/LICENSE.txt +56 -0
  6. data/README.md +70 -0
  7. data/ext/openssl/deprecation.rb +26 -0
  8. data/ext/openssl/extconf.rb +158 -0
  9. data/ext/openssl/openssl_missing.c +173 -0
  10. data/ext/openssl/openssl_missing.h +244 -0
  11. data/ext/openssl/ossl.c +1201 -0
  12. data/ext/openssl/ossl.h +222 -0
  13. data/ext/openssl/ossl_asn1.c +1992 -0
  14. data/ext/openssl/ossl_asn1.h +66 -0
  15. data/ext/openssl/ossl_bio.c +87 -0
  16. data/ext/openssl/ossl_bio.h +19 -0
  17. data/ext/openssl/ossl_bn.c +1153 -0
  18. data/ext/openssl/ossl_bn.h +23 -0
  19. data/ext/openssl/ossl_cipher.c +1085 -0
  20. data/ext/openssl/ossl_cipher.h +20 -0
  21. data/ext/openssl/ossl_config.c +89 -0
  22. data/ext/openssl/ossl_config.h +19 -0
  23. data/ext/openssl/ossl_digest.c +453 -0
  24. data/ext/openssl/ossl_digest.h +20 -0
  25. data/ext/openssl/ossl_engine.c +580 -0
  26. data/ext/openssl/ossl_engine.h +19 -0
  27. data/ext/openssl/ossl_hmac.c +398 -0
  28. data/ext/openssl/ossl_hmac.h +18 -0
  29. data/ext/openssl/ossl_ns_spki.c +406 -0
  30. data/ext/openssl/ossl_ns_spki.h +19 -0
  31. data/ext/openssl/ossl_ocsp.c +2013 -0
  32. data/ext/openssl/ossl_ocsp.h +23 -0
  33. data/ext/openssl/ossl_pkcs12.c +259 -0
  34. data/ext/openssl/ossl_pkcs12.h +13 -0
  35. data/ext/openssl/ossl_pkcs5.c +180 -0
  36. data/ext/openssl/ossl_pkcs5.h +6 -0
  37. data/ext/openssl/ossl_pkcs7.c +1125 -0
  38. data/ext/openssl/ossl_pkcs7.h +20 -0
  39. data/ext/openssl/ossl_pkey.c +435 -0
  40. data/ext/openssl/ossl_pkey.h +245 -0
  41. data/ext/openssl/ossl_pkey_dh.c +650 -0
  42. data/ext/openssl/ossl_pkey_dsa.c +672 -0
  43. data/ext/openssl/ossl_pkey_ec.c +1899 -0
  44. data/ext/openssl/ossl_pkey_rsa.c +768 -0
  45. data/ext/openssl/ossl_rand.c +238 -0
  46. data/ext/openssl/ossl_rand.h +18 -0
  47. data/ext/openssl/ossl_ssl.c +2679 -0
  48. data/ext/openssl/ossl_ssl.h +41 -0
  49. data/ext/openssl/ossl_ssl_session.c +352 -0
  50. data/ext/openssl/ossl_version.h +15 -0
  51. data/ext/openssl/ossl_x509.c +186 -0
  52. data/ext/openssl/ossl_x509.h +119 -0
  53. data/ext/openssl/ossl_x509attr.c +328 -0
  54. data/ext/openssl/ossl_x509cert.c +860 -0
  55. data/ext/openssl/ossl_x509crl.c +565 -0
  56. data/ext/openssl/ossl_x509ext.c +480 -0
  57. data/ext/openssl/ossl_x509name.c +547 -0
  58. data/ext/openssl/ossl_x509req.c +492 -0
  59. data/ext/openssl/ossl_x509revoked.c +279 -0
  60. data/ext/openssl/ossl_x509store.c +846 -0
  61. data/ext/openssl/ruby_missing.h +32 -0
  62. data/lib/openssl.rb +21 -0
  63. data/lib/openssl/bn.rb +39 -0
  64. data/lib/openssl/buffering.rb +451 -0
  65. data/lib/openssl/cipher.rb +67 -0
  66. data/lib/openssl/config.rb +473 -0
  67. data/lib/openssl/digest.rb +78 -0
  68. data/lib/openssl/pkey.rb +44 -0
  69. data/lib/openssl/ssl.rb +416 -0
  70. data/lib/openssl/x509.rb +176 -0
  71. metadata +178 -0
@@ -0,0 +1,176 @@
1
+ # frozen_string_literal: false
2
+ #--
3
+ # = Ruby-space definitions that completes C-space funcs for X509 and subclasses
4
+ #
5
+ # = Info
6
+ # 'OpenSSL for Ruby 2' project
7
+ # Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
8
+ # All rights reserved.
9
+ #
10
+ # = Licence
11
+ # This program is licensed under the same licence as Ruby.
12
+ # (See the file 'LICENCE'.)
13
+ #++
14
+
15
+ module OpenSSL
16
+ module X509
17
+ class ExtensionFactory
18
+ def create_extension(*arg)
19
+ if arg.size > 1
20
+ create_ext(*arg)
21
+ else
22
+ send("create_ext_from_"+arg[0].class.name.downcase, arg[0])
23
+ end
24
+ end
25
+
26
+ def create_ext_from_array(ary)
27
+ raise ExtensionError, "unexpected array form" if ary.size > 3
28
+ create_ext(ary[0], ary[1], ary[2])
29
+ end
30
+
31
+ def create_ext_from_string(str) # "oid = critical, value"
32
+ oid, value = str.split(/=/, 2)
33
+ oid.strip!
34
+ value.strip!
35
+ create_ext(oid, value)
36
+ end
37
+
38
+ def create_ext_from_hash(hash)
39
+ create_ext(hash["oid"], hash["value"], hash["critical"])
40
+ end
41
+ end
42
+
43
+ class Extension
44
+ def to_s # "oid = critical, value"
45
+ str = self.oid
46
+ str << " = "
47
+ str << "critical, " if self.critical?
48
+ str << self.value.gsub(/\n/, ", ")
49
+ end
50
+
51
+ def to_h # {"oid"=>sn|ln, "value"=>value, "critical"=>true|false}
52
+ {"oid"=>self.oid,"value"=>self.value,"critical"=>self.critical?}
53
+ end
54
+
55
+ def to_a
56
+ [ self.oid, self.value, self.critical? ]
57
+ end
58
+ end
59
+
60
+ class Name
61
+ module RFC2253DN
62
+ Special = ',=+<>#;'
63
+ HexChar = /[0-9a-fA-F]/
64
+ HexPair = /#{HexChar}#{HexChar}/
65
+ HexString = /#{HexPair}+/
66
+ Pair = /\\(?:[#{Special}]|\\|"|#{HexPair})/
67
+ StringChar = /[^\\"#{Special}]/
68
+ QuoteChar = /[^\\"]/
69
+ AttributeType = /[a-zA-Z][0-9a-zA-Z]*|[0-9]+(?:\.[0-9]+)*/
70
+ AttributeValue = /
71
+ (?!["#])((?:#{StringChar}|#{Pair})*)|
72
+ \#(#{HexString})|
73
+ "((?:#{QuoteChar}|#{Pair})*)"
74
+ /x
75
+ TypeAndValue = /\A(#{AttributeType})=#{AttributeValue}/
76
+
77
+ module_function
78
+
79
+ def expand_pair(str)
80
+ return nil unless str
81
+ return str.gsub(Pair){
82
+ pair = $&
83
+ case pair.size
84
+ when 2 then pair[1,1]
85
+ when 3 then Integer("0x#{pair[1,2]}").chr
86
+ else raise OpenSSL::X509::NameError, "invalid pair: #{str}"
87
+ end
88
+ }
89
+ end
90
+
91
+ def expand_hexstring(str)
92
+ return nil unless str
93
+ der = str.gsub(HexPair){$&.to_i(16).chr }
94
+ a1 = OpenSSL::ASN1.decode(der)
95
+ return a1.value, a1.tag
96
+ end
97
+
98
+ def expand_value(str1, str2, str3)
99
+ value = expand_pair(str1)
100
+ value, tag = expand_hexstring(str2) unless value
101
+ value = expand_pair(str3) unless value
102
+ return value, tag
103
+ end
104
+
105
+ def scan(dn)
106
+ str = dn
107
+ ary = []
108
+ while true
109
+ if md = TypeAndValue.match(str)
110
+ remain = md.post_match
111
+ type = md[1]
112
+ value, tag = expand_value(md[2], md[3], md[4]) rescue nil
113
+ if value
114
+ type_and_value = [type, value]
115
+ type_and_value.push(tag) if tag
116
+ ary.unshift(type_and_value)
117
+ if remain.length > 2 && remain[0] == ?,
118
+ str = remain[1..-1]
119
+ next
120
+ elsif remain.length > 2 && remain[0] == ?+
121
+ raise OpenSSL::X509::NameError,
122
+ "multi-valued RDN is not supported: #{dn}"
123
+ elsif remain.empty?
124
+ break
125
+ end
126
+ end
127
+ end
128
+ msg_dn = dn[0, dn.length - str.length] + " =>" + str
129
+ raise OpenSSL::X509::NameError, "malformed RDN: #{msg_dn}"
130
+ end
131
+ return ary
132
+ end
133
+ end
134
+
135
+ class << self
136
+ def parse_rfc2253(str, template=OBJECT_TYPE_TEMPLATE)
137
+ ary = OpenSSL::X509::Name::RFC2253DN.scan(str)
138
+ self.new(ary, template)
139
+ end
140
+
141
+ def parse_openssl(str, template=OBJECT_TYPE_TEMPLATE)
142
+ ary = str.scan(/\s*([^\/,]+)\s*/).collect{|i| i[0].split("=", 2) }
143
+ self.new(ary, template)
144
+ end
145
+
146
+ alias parse parse_openssl
147
+ end
148
+
149
+ def pretty_print(q)
150
+ q.object_group(self) {
151
+ q.text ' '
152
+ q.text to_s(OpenSSL::X509::Name::RFC2253)
153
+ }
154
+ end
155
+ end
156
+
157
+ class StoreContext
158
+ def cleanup
159
+ warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE
160
+ end
161
+ end
162
+
163
+ class Certificate
164
+ def pretty_print(q)
165
+ q.object_group(self) {
166
+ q.breakable
167
+ q.text 'subject='; q.pp self.subject; q.text ','; q.breakable
168
+ q.text 'issuer='; q.pp self.issuer; q.text ','; q.breakable
169
+ q.text 'serial='; q.pp self.serial; q.text ','; q.breakable
170
+ q.text 'not_before='; q.pp self.not_before; q.text ','; q.breakable
171
+ q.text 'not_after='; q.pp self.not_after
172
+ }
173
+ end
174
+ end
175
+ end
176
+ end
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: openssl
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0.beta.1
5
+ platform: ruby
6
+ authors:
7
+ - Martin Bosslet
8
+ - SHIBATA Hiroshi
9
+ - Zachary Scott
10
+ - Kazuki Yamaguchi
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2016-08-29 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rake
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '10.3'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '10.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake-compiler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: '0.9'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.9'
44
+ - !ruby/object:Gem::Dependency
45
+ name: test-unit
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '3.0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: rdoc
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - "~>"
63
+ - !ruby/object:Gem::Version
64
+ version: '4.2'
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '4.2'
72
+ description: It wraps the OpenSSL library.
73
+ email:
74
+ - ruby-core@ruby-lang.org
75
+ executables: []
76
+ extensions:
77
+ - ext/openssl/extconf.rb
78
+ extra_rdoc_files:
79
+ - CONTRIBUTING.md
80
+ - History.md
81
+ - README.md
82
+ files:
83
+ - BSDL
84
+ - CONTRIBUTING.md
85
+ - History.md
86
+ - LICENSE.txt
87
+ - README.md
88
+ - ext/openssl/deprecation.rb
89
+ - ext/openssl/extconf.rb
90
+ - ext/openssl/openssl_missing.c
91
+ - ext/openssl/openssl_missing.h
92
+ - ext/openssl/ossl.c
93
+ - ext/openssl/ossl.h
94
+ - ext/openssl/ossl_asn1.c
95
+ - ext/openssl/ossl_asn1.h
96
+ - ext/openssl/ossl_bio.c
97
+ - ext/openssl/ossl_bio.h
98
+ - ext/openssl/ossl_bn.c
99
+ - ext/openssl/ossl_bn.h
100
+ - ext/openssl/ossl_cipher.c
101
+ - ext/openssl/ossl_cipher.h
102
+ - ext/openssl/ossl_config.c
103
+ - ext/openssl/ossl_config.h
104
+ - ext/openssl/ossl_digest.c
105
+ - ext/openssl/ossl_digest.h
106
+ - ext/openssl/ossl_engine.c
107
+ - ext/openssl/ossl_engine.h
108
+ - ext/openssl/ossl_hmac.c
109
+ - ext/openssl/ossl_hmac.h
110
+ - ext/openssl/ossl_ns_spki.c
111
+ - ext/openssl/ossl_ns_spki.h
112
+ - ext/openssl/ossl_ocsp.c
113
+ - ext/openssl/ossl_ocsp.h
114
+ - ext/openssl/ossl_pkcs12.c
115
+ - ext/openssl/ossl_pkcs12.h
116
+ - ext/openssl/ossl_pkcs5.c
117
+ - ext/openssl/ossl_pkcs5.h
118
+ - ext/openssl/ossl_pkcs7.c
119
+ - ext/openssl/ossl_pkcs7.h
120
+ - ext/openssl/ossl_pkey.c
121
+ - ext/openssl/ossl_pkey.h
122
+ - ext/openssl/ossl_pkey_dh.c
123
+ - ext/openssl/ossl_pkey_dsa.c
124
+ - ext/openssl/ossl_pkey_ec.c
125
+ - ext/openssl/ossl_pkey_rsa.c
126
+ - ext/openssl/ossl_rand.c
127
+ - ext/openssl/ossl_rand.h
128
+ - ext/openssl/ossl_ssl.c
129
+ - ext/openssl/ossl_ssl.h
130
+ - ext/openssl/ossl_ssl_session.c
131
+ - ext/openssl/ossl_version.h
132
+ - ext/openssl/ossl_x509.c
133
+ - ext/openssl/ossl_x509.h
134
+ - ext/openssl/ossl_x509attr.c
135
+ - ext/openssl/ossl_x509cert.c
136
+ - ext/openssl/ossl_x509crl.c
137
+ - ext/openssl/ossl_x509ext.c
138
+ - ext/openssl/ossl_x509name.c
139
+ - ext/openssl/ossl_x509req.c
140
+ - ext/openssl/ossl_x509revoked.c
141
+ - ext/openssl/ossl_x509store.c
142
+ - ext/openssl/ruby_missing.h
143
+ - lib/openssl.rb
144
+ - lib/openssl/bn.rb
145
+ - lib/openssl/buffering.rb
146
+ - lib/openssl/cipher.rb
147
+ - lib/openssl/config.rb
148
+ - lib/openssl/digest.rb
149
+ - lib/openssl/pkey.rb
150
+ - lib/openssl/ssl.rb
151
+ - lib/openssl/x509.rb
152
+ homepage: https://www.ruby-lang.org/
153
+ licenses:
154
+ - Ruby
155
+ metadata: {}
156
+ post_install_message:
157
+ rdoc_options:
158
+ - "--main"
159
+ - README.md
160
+ require_paths:
161
+ - lib
162
+ required_ruby_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: 2.3.0
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">"
170
+ - !ruby/object:Gem::Version
171
+ version: 1.3.1
172
+ requirements: []
173
+ rubyforge_project:
174
+ rubygems_version: 2.6.6
175
+ signing_key:
176
+ specification_version: 4
177
+ summary: OpenSSL provides SSL, TLS and general purpose cryptography.
178
+ test_files: []