jruby-openssl 0.9.7-java → 0.9.8-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,139 @@
1
+ #--
2
+ #
3
+ # $RCSfile$
4
+ #
5
+ # = Ruby-space definitions that completes C-space funcs for X509 and subclasses
6
+ #
7
+ # = Info
8
+ # 'OpenSSL for Ruby 2' project
9
+ # Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
10
+ # All rights reserved.
11
+ #
12
+ # = Licence
13
+ # This program is licenced under the same licence as Ruby.
14
+ # (See the file 'LICENCE'.)
15
+ #
16
+ # = Version
17
+ # $Id$
18
+ #
19
+ #++
20
+
21
+ module OpenSSL
22
+ module X509
23
+ class Name
24
+ module RFC2253DN
25
+ Special = ',=+<>#;'
26
+ HexChar = /[0-9a-fA-F]/
27
+ HexPair = /#{HexChar}#{HexChar}/
28
+ HexString = /#{HexPair}+/
29
+ Pair = /\\(?:[#{Special}]|\\|"|#{HexPair})/
30
+ StringChar = /[^\\"#{Special}]/
31
+ QuoteChar = /[^\\"]/
32
+ AttributeType = /[a-zA-Z][0-9a-zA-Z]*|[0-9]+(?:\.[0-9]+)*/
33
+ AttributeValue = /
34
+ (?!["#])((?:#{StringChar}|#{Pair})*)|
35
+ \#(#{HexString})|
36
+ "((?:#{QuoteChar}|#{Pair})*)"
37
+ /x
38
+ TypeAndValue = /\A(#{AttributeType})=#{AttributeValue}/
39
+
40
+ module_function
41
+
42
+ def expand_pair(str)
43
+ return nil unless str
44
+ return str.gsub(Pair){
45
+ pair = $&
46
+ case pair.size
47
+ when 2 then pair[1,1]
48
+ when 3 then Integer("0x#{pair[1,2]}").chr
49
+ else raise OpenSSL::X509::NameError, "invalid pair: #{str}"
50
+ end
51
+ }
52
+ end
53
+
54
+ def expand_hexstring(str)
55
+ return nil unless str
56
+ der = str.gsub(HexPair){$&.to_i(16).chr }
57
+ a1 = OpenSSL::ASN1.decode(der)
58
+ return a1.value, a1.tag
59
+ end
60
+
61
+ def expand_value(str1, str2, str3)
62
+ value = expand_pair(str1)
63
+ value, tag = expand_hexstring(str2) unless value
64
+ value = expand_pair(str3) unless value
65
+ return value, tag
66
+ end
67
+
68
+ def scan(dn)
69
+ str = dn
70
+ ary = []
71
+ while true
72
+ if md = TypeAndValue.match(str)
73
+ remain = md.post_match
74
+ type = md[1]
75
+ value, tag = expand_value(md[2], md[3], md[4]) rescue nil
76
+ if value
77
+ type_and_value = [type, value]
78
+ type_and_value.push(tag) if tag
79
+ ary.unshift(type_and_value)
80
+ if remain.length > 2 && remain[0] == ?,
81
+ str = remain[1..-1]
82
+ next
83
+ elsif remain.length > 2 && remain[0] == ?+
84
+ raise OpenSSL::X509::NameError,
85
+ "multi-valued RDN is not supported: #{dn}"
86
+ elsif remain.empty?
87
+ break
88
+ end
89
+ end
90
+ end
91
+ msg_dn = dn[0, dn.length - str.length] + " =>" + str
92
+ raise OpenSSL::X509::NameError, "malformed RDN: #{msg_dn}"
93
+ end
94
+ return ary
95
+ end
96
+ end
97
+
98
+ class << self
99
+ def parse_rfc2253(str, template=OBJECT_TYPE_TEMPLATE)
100
+ ary = OpenSSL::X509::Name::RFC2253DN.scan(str)
101
+ self.new(ary, template)
102
+ end
103
+
104
+ def parse_openssl(str, template=OBJECT_TYPE_TEMPLATE)
105
+ ary = str.scan(/\s*([^\/,]+)\s*/).collect{|i| i[0].split("=", 2) }
106
+ self.new(ary, template)
107
+ end
108
+
109
+ alias parse parse_openssl
110
+ end
111
+
112
+ def pretty_print(q)
113
+ q.object_group(self) {
114
+ q.text ' '
115
+ q.text to_s(OpenSSL::X509::Name::RFC2253)
116
+ }
117
+ end
118
+ end
119
+
120
+ class StoreContext
121
+ def cleanup
122
+ warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE
123
+ end
124
+ end
125
+
126
+ class Certificate
127
+ def pretty_print(q)
128
+ q.object_group(self) {
129
+ q.breakable
130
+ q.text 'subject='; q.pp self.subject; q.text ','; q.breakable
131
+ q.text 'issuer='; q.pp self.issuer; q.text ','; q.breakable
132
+ q.text 'serial='; q.pp self.serial; q.text ','; q.breakable
133
+ q.text 'not_before='; q.pp self.not_before; q.text ','; q.breakable
134
+ q.text 'not_after='; q.pp self.not_after
135
+ }
136
+ end
137
+ end
138
+ end
139
+ end
data/lib/openssl/bn.rb CHANGED
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
2
- load('jopenssl21/openssl/bn.rb')
3
- elsif RUBY_VERSION >= '1.9.0'
4
- load('jopenssl19/openssl/bn.rb')
1
+ if RUBY_VERSION > '2.2'
2
+ load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.1'
4
+ load "jopenssl21/openssl/#{File.basename(__FILE__)}"
5
+ elsif RUBY_VERSION > '1.9'
6
+ load "jopenssl19/openssl/#{File.basename(__FILE__)}"
5
7
  else
6
- load('jopenssl18/openssl/bn.rb')
7
- end
8
+ load "jopenssl18/openssl/#{File.basename(__FILE__)}"
9
+ end
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
2
- load('jopenssl21/openssl/buffering.rb')
3
- elsif RUBY_VERSION >= '1.9.0'
4
- load('jopenssl19/openssl/buffering.rb')
1
+ if RUBY_VERSION > '2.2'
2
+ load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.1'
4
+ load "jopenssl21/openssl/#{File.basename(__FILE__)}"
5
+ elsif RUBY_VERSION > '1.9'
6
+ load "jopenssl19/openssl/#{File.basename(__FILE__)}"
5
7
  else
6
- load('jopenssl18/openssl/buffering.rb')
7
- end
8
+ load "jopenssl18/openssl/#{File.basename(__FILE__)}"
9
+ end
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
2
- load('jopenssl21/openssl/cipher.rb')
3
- elsif RUBY_VERSION >= '1.9.0'
4
- load('jopenssl19/openssl/cipher.rb')
1
+ if RUBY_VERSION > '2.2'
2
+ load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.1'
4
+ load "jopenssl21/openssl/#{File.basename(__FILE__)}"
5
+ elsif RUBY_VERSION > '1.9'
6
+ load "jopenssl19/openssl/#{File.basename(__FILE__)}"
5
7
  else
6
- load('jopenssl18/openssl/cipher.rb')
7
- end
8
+ load "jopenssl18/openssl/#{File.basename(__FILE__)}"
9
+ end
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
2
- load('jopenssl21/openssl/config.rb')
3
- elsif RUBY_VERSION >= '1.9.0'
4
- load('jopenssl19/openssl/config.rb')
1
+ if RUBY_VERSION > '2.2'
2
+ load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.1'
4
+ load "jopenssl21/openssl/#{File.basename(__FILE__)}"
5
+ elsif RUBY_VERSION > '1.9'
6
+ load "jopenssl19/openssl/#{File.basename(__FILE__)}"
5
7
  else
6
- load('jopenssl18/openssl/config.rb')
7
- end
8
+ load "jopenssl18/openssl/#{File.basename(__FILE__)}"
9
+ end
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
2
- load('jopenssl21/openssl/digest.rb')
3
- elsif RUBY_VERSION >= '1.9.0'
4
- load('jopenssl19/openssl/digest.rb')
1
+ if RUBY_VERSION > '2.2'
2
+ load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.1'
4
+ load "jopenssl21/openssl/#{File.basename(__FILE__)}"
5
+ elsif RUBY_VERSION > '1.9'
6
+ load "jopenssl19/openssl/#{File.basename(__FILE__)}"
5
7
  else
6
- load('jopenssl18/openssl/digest.rb')
7
- end
8
+ load "jopenssl18/openssl/#{File.basename(__FILE__)}"
9
+ end
@@ -72,11 +72,11 @@ module OpenSSL
72
72
  end
73
73
  end
74
74
  end
75
+ break
75
76
  end
76
- break
77
77
  end
78
78
  rescue java.lang.Exception => e
79
- raise PKCS12Error, "Exception: #{e}"
79
+ raise PKCS12Error, e.inspect
80
80
  end
81
81
 
82
82
  def generate(pass, alias_name, key, cert, ca = nil)
@@ -93,7 +93,7 @@ module OpenSSL
93
93
  rescue java.security.KeyStoreException, java.security.cert.CertificateException => e
94
94
  raise PKCS12Error, e.message
95
95
  rescue java.security.GeneralSecurityException, java.io.IOException => e
96
- raise PKCS12Error, "Exception: #{e}"
96
+ raise PKCS12Error, e.inspect
97
97
  end
98
98
 
99
99
  @der = String.from_java_bytes(der_bytes)
data/lib/openssl/pkcs7.rb CHANGED
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
1
+ if RUBY_VERSION > '2.2'
2
+ raise LoadError, "no such library in 2.2: openssl/pkcs7"
3
+ elsif RUBY_VERSION > '2.1'
2
4
  raise LoadError, "no such library in 2.1: openssl/pkcs7"
3
- elsif RUBY_VERSION >= '1.9.0'
5
+ elsif RUBY_VERSION > '1.9'
4
6
  raise LoadError, "no such library in 1.9: openssl/pkcs7"
5
7
  else
6
- load('jopenssl18/openssl/pkcs7.rb')
7
- end
8
+ load "jopenssl18/openssl/pkcs7.rb"
9
+ end
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
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'
2
4
  raise LoadError, "no such library in 2.1: openssl/ssl-internal.rb"
3
- elsif RUBY_VERSION >= '1.9.0'
4
- load('jopenssl19/openssl/ssl-internal.rb')
5
+ elsif RUBY_VERSION > '1.9'
6
+ load "jopenssl19/openssl/#{File.basename(__FILE__)}"
5
7
  else
6
- load('jopenssl18/openssl/ssl-internal.rb')
7
- end
8
+ load "jopenssl18/openssl/#{File.basename(__FILE__)}"
9
+ end
data/lib/openssl/ssl.rb CHANGED
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
2
- load('jopenssl21/openssl/ssl.rb')
3
- elsif RUBY_VERSION >= '1.9.0'
4
- load('jopenssl19/openssl/ssl.rb')
1
+ if RUBY_VERSION > '2.2'
2
+ load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.1'
4
+ load "jopenssl21/openssl/#{File.basename(__FILE__)}"
5
+ elsif RUBY_VERSION > '1.9'
6
+ load "jopenssl19/openssl/#{File.basename(__FILE__)}"
5
7
  else
6
- load('jopenssl18/openssl/ssl.rb')
7
- end
8
+ load "jopenssl18/openssl/#{File.basename(__FILE__)}"
9
+ end
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
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'
2
4
  raise LoadError, "no such library in 2.1: openssl/x509-internal.rb"
3
- elsif RUBY_VERSION >= '1.9.0'
4
- load('jopenssl19/openssl/x509-internal.rb')
5
+ elsif RUBY_VERSION > '1.9'
6
+ load "jopenssl19/openssl/#{File.basename(__FILE__)}"
5
7
  else
6
- load('jopenssl18/openssl/x509-internal.rb')
7
- end
8
+ load "jopenssl18/openssl/#{File.basename(__FILE__)}"
9
+ end
data/lib/openssl/x509.rb CHANGED
@@ -1,7 +1,9 @@
1
- if RUBY_VERSION >= '2.1.0'
2
- load('jopenssl21/openssl/x509.rb')
3
- elsif RUBY_VERSION >= '1.9.0'
4
- load('jopenssl19/openssl/x509.rb')
1
+ if RUBY_VERSION > '2.2'
2
+ load "jopenssl22/openssl/#{File.basename(__FILE__)}"
3
+ elsif RUBY_VERSION > '2.1'
4
+ load "jopenssl21/openssl/#{File.basename(__FILE__)}"
5
+ elsif RUBY_VERSION > '1.9'
6
+ load "jopenssl19/openssl/#{File.basename(__FILE__)}"
5
7
  else
6
- load('jopenssl18/openssl/x509.rb')
7
- end
8
+ load "jopenssl18/openssl/#{File.basename(__FILE__)}"
9
+ end
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.7
4
+ version: 0.9.8
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-04-15 00:00:00.000000000 Z
12
+ date: 2015-07-27 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: '0'
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
- name: ruby-maven
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: []
@@ -94,6 +94,14 @@ files:
94
94
  - lib/jopenssl21/openssl/digest.rb
95
95
  - lib/jopenssl21/openssl/ssl.rb
96
96
  - lib/jopenssl21/openssl/x509.rb
97
+ - lib/jopenssl22/openssl.rb
98
+ - lib/jopenssl22/openssl/bn.rb
99
+ - lib/jopenssl22/openssl/buffering.rb
100
+ - lib/jopenssl22/openssl/cipher.rb
101
+ - lib/jopenssl22/openssl/config.rb
102
+ - lib/jopenssl22/openssl/digest.rb
103
+ - lib/jopenssl22/openssl/ssl.rb
104
+ - lib/jopenssl22/openssl/x509.rb
97
105
  - lib/jruby-openssl.rb
98
106
  - lib/openssl.rb
99
107
  - lib/openssl/bn.rb