jruby-openssl 0.9.12-java → 0.9.13-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,133 @@
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 Name
18
+ module RFC2253DN
19
+ Special = ',=+<>#;'
20
+ HexChar = /[0-9a-fA-F]/
21
+ HexPair = /#{HexChar}#{HexChar}/
22
+ HexString = /#{HexPair}+/
23
+ Pair = /\\(?:[#{Special}]|\\|"|#{HexPair})/
24
+ StringChar = /[^\\"#{Special}]/
25
+ QuoteChar = /[^\\"]/
26
+ AttributeType = /[a-zA-Z][0-9a-zA-Z]*|[0-9]+(?:\.[0-9]+)*/
27
+ AttributeValue = /
28
+ (?!["#])((?:#{StringChar}|#{Pair})*)|
29
+ \#(#{HexString})|
30
+ "((?:#{QuoteChar}|#{Pair})*)"
31
+ /x
32
+ TypeAndValue = /\A(#{AttributeType})=#{AttributeValue}/
33
+
34
+ module_function
35
+
36
+ def expand_pair(str)
37
+ return nil unless str
38
+ return str.gsub(Pair){
39
+ pair = $&
40
+ case pair.size
41
+ when 2 then pair[1,1]
42
+ when 3 then Integer("0x#{pair[1,2]}").chr
43
+ else raise OpenSSL::X509::NameError, "invalid pair: #{str}"
44
+ end
45
+ }
46
+ end
47
+
48
+ def expand_hexstring(str)
49
+ return nil unless str
50
+ der = str.gsub(HexPair){$&.to_i(16).chr }
51
+ a1 = OpenSSL::ASN1.decode(der)
52
+ return a1.value, a1.tag
53
+ end
54
+
55
+ def expand_value(str1, str2, str3)
56
+ value = expand_pair(str1)
57
+ value, tag = expand_hexstring(str2) unless value
58
+ value = expand_pair(str3) unless value
59
+ return value, tag
60
+ end
61
+
62
+ def scan(dn)
63
+ str = dn
64
+ ary = []
65
+ while true
66
+ if md = TypeAndValue.match(str)
67
+ remain = md.post_match
68
+ type = md[1]
69
+ value, tag = expand_value(md[2], md[3], md[4]) rescue nil
70
+ if value
71
+ type_and_value = [type, value]
72
+ type_and_value.push(tag) if tag
73
+ ary.unshift(type_and_value)
74
+ if remain.length > 2 && remain[0] == ?,
75
+ str = remain[1..-1]
76
+ next
77
+ elsif remain.length > 2 && remain[0] == ?+
78
+ raise OpenSSL::X509::NameError,
79
+ "multi-valued RDN is not supported: #{dn}"
80
+ elsif remain.empty?
81
+ break
82
+ end
83
+ end
84
+ end
85
+ msg_dn = dn[0, dn.length - str.length] + " =>" + str
86
+ raise OpenSSL::X509::NameError, "malformed RDN: #{msg_dn}"
87
+ end
88
+ return ary
89
+ end
90
+ end
91
+
92
+ class << self
93
+ def parse_rfc2253(str, template=OBJECT_TYPE_TEMPLATE)
94
+ ary = OpenSSL::X509::Name::RFC2253DN.scan(str)
95
+ self.new(ary, template)
96
+ end
97
+
98
+ def parse_openssl(str, template=OBJECT_TYPE_TEMPLATE)
99
+ ary = str.scan(/\s*([^\/,]+)\s*/).collect{|i| i[0].split("=", 2) }
100
+ self.new(ary, template)
101
+ end
102
+
103
+ alias parse parse_openssl
104
+ end
105
+
106
+ def pretty_print(q)
107
+ q.object_group(self) {
108
+ q.text ' '
109
+ q.text to_s(OpenSSL::X509::Name::RFC2253)
110
+ }
111
+ end
112
+ end
113
+
114
+ class StoreContext
115
+ def cleanup
116
+ warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE
117
+ end
118
+ end
119
+
120
+ class Certificate
121
+ def pretty_print(q)
122
+ q.object_group(self) {
123
+ q.breakable
124
+ q.text 'subject='; q.pp self.subject; q.text ','; q.breakable
125
+ q.text 'issuer='; q.pp self.issuer; q.text ','; q.breakable
126
+ q.text 'serial='; q.pp self.serial; q.text ','; q.breakable
127
+ q.text 'not_before='; q.pp self.not_before; q.text ','; q.breakable
128
+ q.text 'not_after='; q.pp self.not_after
129
+ }
130
+ end
131
+ end
132
+ end
133
+ end
data/lib/openssl/bn.rb CHANGED
@@ -1,4 +1,6 @@
1
- if RUBY_VERSION > '2.2'
1
+ if RUBY_VERSION > '2.3'
2
+ load "jopenssl23/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.2'
2
4
  load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
5
  elsif RUBY_VERSION > '2.1'
4
6
  load "jopenssl21/openssl/#{File.basename(__FILE__)}"
@@ -1,4 +1,6 @@
1
- if RUBY_VERSION > '2.2'
1
+ if RUBY_VERSION > '2.3'
2
+ load "jopenssl23/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.2'
2
4
  load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
5
  elsif RUBY_VERSION > '2.1'
4
6
  load "jopenssl21/openssl/#{File.basename(__FILE__)}"
@@ -1,4 +1,6 @@
1
- if RUBY_VERSION > '2.2'
1
+ if RUBY_VERSION > '2.3'
2
+ load "jopenssl23/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.2'
2
4
  load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
5
  elsif RUBY_VERSION > '2.1'
4
6
  load "jopenssl21/openssl/#{File.basename(__FILE__)}"
@@ -1,4 +1,6 @@
1
- if RUBY_VERSION > '2.2'
1
+ if RUBY_VERSION > '2.3'
2
+ load "jopenssl23/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.2'
2
4
  load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
5
  elsif RUBY_VERSION > '2.1'
4
6
  load "jopenssl21/openssl/#{File.basename(__FILE__)}"
@@ -1,4 +1,6 @@
1
- if RUBY_VERSION > '2.2'
1
+ if RUBY_VERSION > '2.3'
2
+ load "jopenssl23/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.2'
2
4
  load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
5
  elsif RUBY_VERSION > '2.1'
4
6
  load "jopenssl21/openssl/#{File.basename(__FILE__)}"
data/lib/openssl/pkcs7.rb CHANGED
@@ -1,9 +1,5 @@
1
- if RUBY_VERSION > '2.2'
2
- raise LoadError, "no such library in 2.2: openssl/pkcs7"
3
- elsif RUBY_VERSION > '2.1'
4
- raise LoadError, "no such library in 2.1: openssl/pkcs7"
5
- elsif RUBY_VERSION > '1.9'
6
- raise LoadError, "no such library in 1.9: openssl/pkcs7"
1
+ if RUBY_VERSION > '1.9'
2
+ raise LoadError, "no such library in #{RUBY_VERSION}: openssl/pkcs7"
7
3
  else
8
4
  load "jopenssl18/openssl/pkcs7.rb"
9
5
  end
@@ -0,0 +1,5 @@
1
+ if RUBY_VERSION > '2.3'
2
+ load "jopenssl23/openssl/#{File.basename(__FILE__)}"
3
+ else
4
+ raise LoadError, "no such file to load -- openssl/pkey"
5
+ end
@@ -1,7 +1,5 @@
1
- if RUBY_VERSION > '2.2'
2
- raise LoadError, "no such library in 2.2: openssl/ssl-internal.rb"
3
- elsif RUBY_VERSION > '2.1'
4
- raise LoadError, "no such library in 2.1: openssl/ssl-internal.rb"
1
+ if RUBY_VERSION > '2.1'
2
+ raise LoadError, "no such library in #{RUBY_VERSION}: openssl/ssl-internal.rb"
5
3
  elsif RUBY_VERSION > '1.9'
6
4
  load "jopenssl19/openssl/#{File.basename(__FILE__)}"
7
5
  else
data/lib/openssl/ssl.rb CHANGED
@@ -1,4 +1,6 @@
1
- if RUBY_VERSION > '2.2'
1
+ if RUBY_VERSION > '2.3'
2
+ load "jopenssl23/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.2'
2
4
  load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
5
  elsif RUBY_VERSION > '2.1'
4
6
  load "jopenssl21/openssl/#{File.basename(__FILE__)}"
@@ -1,7 +1,5 @@
1
- if RUBY_VERSION > '2.2'
2
- raise LoadError, "no such library in 2.2: openssl/x509-internal.rb"
3
- elsif RUBY_VERSION > '2.1'
4
- raise LoadError, "no such library in 2.1: openssl/x509-internal.rb"
1
+ if RUBY_VERSION > '2.1'
2
+ raise LoadError, "no such library in #{RUBY_VERSION}: openssl/x509-internal.rb"
5
3
  elsif RUBY_VERSION > '1.9'
6
4
  load "jopenssl19/openssl/#{File.basename(__FILE__)}"
7
5
  else
data/lib/openssl/x509.rb CHANGED
@@ -1,4 +1,6 @@
1
- if RUBY_VERSION > '2.2'
1
+ if RUBY_VERSION > '2.3'
2
+ load "jopenssl23/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.2'
2
4
  load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
5
  elsif RUBY_VERSION > '2.1'
4
6
  load "jopenssl21/openssl/#{File.basename(__FILE__)}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby-openssl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.12
4
+ version: 0.9.13
5
5
  platform: java
6
6
  authors:
7
7
  - Ola Bini
@@ -9,50 +9,50 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-08 00:00:00.000000000 Z
12
+ date: 2015-12-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ name: jar-dependencies
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: 0.1.0
15
21
  requirement: !ruby/object:Gem::Requirement
16
22
  requirements:
17
23
  - - ~>
18
24
  - !ruby/object:Gem::Version
19
25
  version: 0.1.0
20
- name: jar-dependencies
21
26
  prerelease: false
22
27
  type: :development
28
+ - !ruby/object:Gem::Dependency
29
+ name: mocha
23
30
  version_requirements: !ruby/object:Gem::Requirement
24
31
  requirements:
25
32
  - - ~>
26
33
  - !ruby/object:Gem::Version
27
- version: 0.1.0
28
- - !ruby/object:Gem::Dependency
34
+ version: 1.1.0
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ~>
32
38
  - !ruby/object:Gem::Version
33
39
  version: 1.1.0
34
- name: mocha
35
40
  prerelease: false
36
41
  type: :development
42
+ - !ruby/object:Gem::Dependency
43
+ name: ruby-maven
37
44
  version_requirements: !ruby/object:Gem::Requirement
38
45
  requirements:
39
46
  - - ~>
40
47
  - !ruby/object:Gem::Version
41
- version: 1.1.0
42
- - !ruby/object:Gem::Dependency
48
+ version: '3.0'
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - '>='
51
+ - - ~>
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
48
- name: ruby-maven
53
+ version: '3.0'
49
54
  prerelease: false
50
55
  type: :development
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - '>='
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
56
  description: JRuby-OpenSSL is an add-on gem for JRuby that emulates the Ruby OpenSSL native library.
57
57
  email: ola.bini@gmail.com
58
58
  executables: []
@@ -102,6 +102,15 @@ files:
102
102
  - lib/jopenssl22/openssl/digest.rb
103
103
  - lib/jopenssl22/openssl/ssl.rb
104
104
  - lib/jopenssl22/openssl/x509.rb
105
+ - lib/jopenssl23/openssl.rb
106
+ - lib/jopenssl23/openssl/bn.rb
107
+ - lib/jopenssl23/openssl/buffering.rb
108
+ - lib/jopenssl23/openssl/cipher.rb
109
+ - lib/jopenssl23/openssl/config.rb
110
+ - lib/jopenssl23/openssl/digest.rb
111
+ - lib/jopenssl23/openssl/pkey.rb
112
+ - lib/jopenssl23/openssl/ssl.rb
113
+ - lib/jopenssl23/openssl/x509.rb
105
114
  - lib/jruby-openssl.rb
106
115
  - lib/openssl.rb
107
116
  - lib/openssl/bn.rb
@@ -111,6 +120,7 @@ files:
111
120
  - lib/openssl/digest.rb
112
121
  - lib/openssl/pkcs12.rb
113
122
  - lib/openssl/pkcs7.rb
123
+ - lib/openssl/pkey.rb
114
124
  - lib/openssl/ssl-internal.rb
115
125
  - lib/openssl/ssl.rb
116
126
  - lib/openssl/x509-internal.rb