jruby-openssl 0.3 → 0.4

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

Potentially problematic release.


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

Binary file
@@ -1,5 +1,5 @@
1
1
  module Jopenssl
2
2
  module Version
3
- VERSION = "0.3"
3
+ VERSION = "0.4"
4
4
  end
5
5
  end
@@ -28,40 +28,40 @@ module PKCS7Test
28
28
  bio = BIO::from_string("Foo: bar")
29
29
  result = Mime::DEFAULT.parse_headers(bio)
30
30
  assert_equal 1, result.size
31
- assert_equal MimeHeader.new("Foo", "bar"), result.first
32
- assert_equal "foo", result.first.name
31
+ assert_equal MimeHeader.new("Foo", "bar"), result[0]
32
+ assert_equal "foo", result[0].name
33
33
  end
34
34
 
35
35
  def test_simple_parse_headers2
36
36
  bio = BIO::from_string("Foo:bar")
37
37
  result = Mime::DEFAULT.parse_headers(bio)
38
38
  assert_equal 1, result.size
39
- assert_equal MimeHeader.new("Foo", "bar"), result.first
40
- assert_equal "foo", result.first.name
39
+ assert_equal MimeHeader.new("Foo", "bar"), result[0]
40
+ assert_equal "foo", result[0].name
41
41
  end
42
42
 
43
43
  def test_simple_parse_headers3
44
44
  bio = BIO::from_string("Foo: bar")
45
45
  result = Mime::DEFAULT.parse_headers(bio)
46
46
  assert_equal 1, result.size
47
- assert_equal MimeHeader.new("Foo", "bar"), result.first
48
- assert_equal "foo", result.first.name
47
+ assert_equal MimeHeader.new("Foo", "bar"), result[0]
48
+ assert_equal "foo", result[0].name
49
49
  end
50
50
 
51
51
  def test_simple_parse_headers4
52
52
  bio = BIO::from_string("Foo: bar\n")
53
53
  result = Mime::DEFAULT.parse_headers(bio)
54
54
  assert_equal 1, result.size
55
- assert_equal MimeHeader.new("Foo", "bar"), result.first
56
- assert_equal "foo", result.first.name
55
+ assert_equal MimeHeader.new("Foo", "bar"), result[0]
56
+ assert_equal "foo", result[0].name
57
57
  end
58
58
 
59
59
  def test_simple_parse_headers5
60
60
  bio = BIO::from_string(" Foo : bar \n")
61
61
  result = Mime::DEFAULT.parse_headers(bio)
62
62
  assert_equal 1, result.size
63
- assert_equal MimeHeader.new("Foo", "bar"), result.first
64
- assert_equal "foo", result.first.name
63
+ assert_equal MimeHeader.new("Foo", "bar"), result[0]
64
+ assert_equal "foo", result[0].name
65
65
  end
66
66
 
67
67
 
@@ -69,8 +69,8 @@ module PKCS7Test
69
69
  bio = BIO::from_string("Foo: bar;\n")
70
70
  result = Mime::DEFAULT.parse_headers(bio)
71
71
  assert_equal 1, result.size
72
- assert_equal MimeHeader.new("Foo", "bar"), result.first
73
- assert_equal "foo", result.first.name
72
+ assert_equal MimeHeader.new("Foo", "bar"), result[0]
73
+ assert_equal "foo", result[0].name
74
74
  end
75
75
 
76
76
  def test_simple_parse_headers7
@@ -88,7 +88,7 @@ module PKCS7Test
88
88
  result = Mime::DEFAULT.parse_headers(bio)
89
89
  assert_equal 1, result.size
90
90
  assert_equal MimeHeader.new("Foo", "bar"), result[0]
91
- assert_equal "foo", result.first.name
91
+ assert_equal "foo", result[0].name
92
92
  end
93
93
 
94
94
  def test_simple_parse_headers_comment
@@ -96,14 +96,14 @@ module PKCS7Test
96
96
  result = Mime::DEFAULT.parse_headers(bio)
97
97
  assert_equal 1, result.size
98
98
  assert_equal MimeHeader.new("Foo", "(this is the right thing)ba(and this is the wrong one)r"), result[0]
99
- assert_equal "foo", result.first.name
99
+ assert_equal "foo", result[0].name
100
100
  end
101
101
 
102
102
  def test_parse_headers_with_param
103
103
  bio = BIO::from_string("Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml")
104
104
  result = Mime::DEFAULT.parse_headers(bio)
105
105
  assert_equal 1, result.size
106
- header = result.first
106
+ header = result[0]
107
107
  assert_equal "content-type", header.name
108
108
  assert_equal "multipart/related", header.value
109
109
  assert_equal [MimeParam.new("boundary","MIME_boundary"),
@@ -114,7 +114,7 @@ module PKCS7Test
114
114
  bio = BIO::from_string("Content-Type: Multipart/Related\n boundary=MIME_boundary; type=text/xml")
115
115
  result = Mime::DEFAULT.parse_headers(bio)
116
116
  assert_equal 1, result.size
117
- header = result.first
117
+ header = result[0]
118
118
  assert_equal "content-type", header.name
119
119
  assert_equal "multipart/related", header.value
120
120
  assert_equal [MimeParam.new("boundary","MIME_boundary"),
@@ -125,7 +125,7 @@ module PKCS7Test
125
125
  bio = BIO::from_string("Content-Type: Multipart/Related;\n boundary=MIME_boundary;\n Type=text/xml")
126
126
  result = Mime::DEFAULT.parse_headers(bio)
127
127
  assert_equal 1, result.size
128
- header = result.first
128
+ header = result[0]
129
129
  assert_equal "content-type", header.name
130
130
  assert_equal "multipart/related", header.value
131
131
  assert_equal [MimeParam.new("boundary","MIME_boundary"),
@@ -31,3 +31,4 @@ protect_require 'openssl/test_x509store'
31
31
  protect_require 'test_cipher'
32
32
  protect_require 'test_java'
33
33
  protect_require 'test_integration'
34
+ protect_require 'test_pkey'
@@ -0,0 +1,46 @@
1
+ if defined?(JRUBY_VERSION)
2
+ require "java"
3
+ base = File.dirname(__FILE__)
4
+ $CLASSPATH << File.join(base, '..', 'pkg', 'classes')
5
+ $CLASSPATH << File.join(base, '..', 'lib', 'bcprov-jdk14-139.jar')
6
+ end
7
+
8
+ begin
9
+ require "openssl"
10
+ rescue LoadError
11
+ end
12
+
13
+ require "test/unit"
14
+
15
+ class TestPKey < Test::Unit::TestCase
16
+ def test_has_correct_methods
17
+ pkey_methods = OpenSSL::PKey::PKey.instance_methods(false).sort - ["initialize"]
18
+ assert_equal ["sign", "verify"], pkey_methods
19
+
20
+ rsa_methods = OpenSSL::PKey::RSA.instance_methods(false).sort - ["initialize"]
21
+ assert_equal ["d", "d=", "dmp1", "dmp1=", "dmq1", "dmq1=", "e", "e=", "export", "iqmp", "iqmp=", "n", "n=", "p", "p=", "params", "private?", "private_decrypt", "private_encrypt", "public?", "public_decrypt", "public_encrypt", "public_key", "q", "q=", "to_der", "to_pem", "to_s", "to_text"], rsa_methods
22
+
23
+ assert_equal ["generate"], OpenSSL::PKey::RSA.methods(false)
24
+
25
+ # dsa_methods = OpenSSL::PKey::DSA.instance_methods(false).sort - ["initialize"]
26
+ # assert_equal ["export", "g", "g=", "p", "p=", "params", "priv_key", "priv_key=", "private?", "pub_key", "pub_key=", "public?", "public_key", "q", "q=", "syssign", "sysverify", "to_der", "to_pem", "to_s", "to_text"], dsa_methods
27
+
28
+ # assert_equal ["generate"], OpenSSL::PKey::DSA.methods(false)
29
+ end
30
+
31
+ #iqmp == coefficient
32
+ #e == public exponent
33
+ #n == modulus
34
+ #d == private exponent
35
+ #p == prime1
36
+ #q == prime2
37
+ #dmq1 == exponent2
38
+ #dmp1 == exponent1
39
+
40
+ def test_can_generate_rsa_key
41
+ OpenSSL::PKey::RSA.generate(512)
42
+ end
43
+
44
+ def test_can_generate_dsa_key
45
+ end
46
+ end
metadata CHANGED
@@ -1,30 +1,13 @@
1
- --- !ruby/object:Gem::Specification
2
- required_ruby_version: !ruby/object:Gem::Requirement
3
- requirements:
4
- - - '>='
5
- - !ruby/object:Gem::Version
6
- version: !str 0
7
- version:
8
- email: ola.bini@gmail.com
9
- cert_chain: []
10
- summary: OpenSSL add-on for JRuby
11
- post_install_message:
12
- extra_rdoc_files:
13
- - History.txt
14
- - README.txt
15
- - License.txt
1
+ --- !ruby/object:Gem::Specification
2
+ extensions: []
3
+
16
4
  homepage: http://jruby-extras.rubyforge.org/jruby-openssl
17
- signing_key:
18
- name: jruby-openssl
19
- rdoc_options:
20
- - --main
21
- - README.txt
22
- autorequire:
23
- rubyforge_project: jruby-extras
24
5
  executables: []
25
- description: = JRuby-OpenSSL
26
- specification_version: 2
27
- default_executable:
6
+
7
+ version: !ruby/object:Gem::Version
8
+ version: "0.4"
9
+ post_install_message:
10
+ date: 2009-03-16 05:00:00 +00:00
28
11
  files:
29
12
  - History.txt
30
13
  - README.txt
@@ -59,6 +42,7 @@ files:
59
42
  - test/test_java_pkcs7.rb
60
43
  - test/test_java_smime.rb
61
44
  - test/test_openssl.rb
45
+ - test/test_pkey.rb
62
46
  - test/ut_eof.rb
63
47
  - test/fixture/cacert.pem
64
48
  - test/fixture/cert_localhost.pem
@@ -84,19 +68,34 @@ files:
84
68
  - test/ref/compile.rb
85
69
  - test/ref/pkcs1
86
70
  - test/ref/pkcs1.c
87
- required_rubygems_version: !ruby/object:Gem::Requirement
71
+ rubygems_version: 1.3.1
72
+ rdoc_options:
73
+ - --main
74
+ - README.txt
75
+ signing_key:
76
+ cert_chain: []
77
+
78
+ name: jruby-openssl
79
+ has_rdoc: true
80
+ platform: ruby
81
+ summary: OpenSSL add-on for JRuby
82
+ default_executable:
83
+ bindir: bin
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ version:
88
86
  requirements:
89
87
  - - '>='
90
- - !ruby/object:Gem::Version
91
- version: !str 0
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ required_ruby_version: !ruby/object:Gem::Requirement
92
91
  version:
93
- extensions: []
94
- rubygems_version: 1.2.0
95
- requirements: []
96
- authors:
97
- - Ola Bini and JRuby contributors
98
- date: 2008-08-13 22:00:00 +00:00
99
- platform: ruby
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: "0"
96
+ require_paths:
97
+ - lib
98
+ specification_version: 2
100
99
  test_files:
101
100
  - test/test_cipher.rb
102
101
  - test/test_integration.rb
@@ -107,10 +106,18 @@ test_files:
107
106
  - test/test_java_pkcs7.rb
108
107
  - test/test_java_smime.rb
109
108
  - test/test_openssl.rb
110
- version: !ruby/object:Gem::Version
111
- version: !str 0.3
112
- require_paths:
113
- - lib
109
+ - test/test_pkey.rb
114
110
  dependencies: []
115
- bindir: bin
116
- has_rdoc: true
111
+
112
+ description: = JRuby-OpenSSL
113
+ email: ola.bini@gmail.com
114
+ authors:
115
+ - Ola Bini and JRuby contributors
116
+ extra_rdoc_files:
117
+ - History.txt
118
+ - README.txt
119
+ - License.txt
120
+ requirements: []
121
+
122
+ rubyforge_project: jruby-extras
123
+ autorequire: