openssl_pkcs8_pure 0.0.0.1 → 0.0.0.2
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/.travis.yml +12 -9
- data/CHANGELOG.md +3 -0
- data/Gemfile +6 -2
- data/README.md +3 -3
- data/lib/openssl_pkcs8_pure.rb +3 -3
- data/openssl_pkcs8_pure.gemspec +1 -1
- data/spec/openssl_pkcs8_pure_spec.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee756fa4dd8798a99cc6114a4f1420966cb4dda5
|
4
|
+
data.tar.gz: 641e466c012d803aff5d581bf855e38da7aa6fa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78e30cf5ef0cd19418879561ad89a2d82649972a392e8261c595daf312138ec8928279cb6897e52b1033102ffead8735fe11a11e2121d7e129a848b2f9f89489
|
7
|
+
data.tar.gz: a8d66a5c5f9a583fda5da67793df692d77833044864cbba43abf90883e77f3eba16f4fe3a4f2dff29bcd983e64f7c955fcde05803274122dba780a3df1e8b61e
|
data/.travis.yml
CHANGED
@@ -1,27 +1,30 @@
|
|
1
|
+
sudo: required
|
1
2
|
language: ruby
|
3
|
+
dist: trusty
|
2
4
|
rvm:
|
3
5
|
- 1.8.7
|
4
6
|
- ree
|
5
|
-
- 1.9.2
|
6
7
|
- 1.9.3
|
7
8
|
- 2.0.0
|
8
|
-
- 2.1.
|
9
|
-
- 2.
|
10
|
-
- 2.
|
11
|
-
- 2.
|
9
|
+
- 2.1.10
|
10
|
+
- 2.2.6
|
11
|
+
- 2.3.3
|
12
|
+
- 2.4.0
|
12
13
|
- ruby-head
|
13
|
-
- jruby-18mode
|
14
14
|
- jruby-19mode
|
15
15
|
- jruby-20mode
|
16
16
|
- jruby-21mode
|
17
|
+
- jruby-22mode
|
18
|
+
- jruby-23mode
|
17
19
|
- jruby-head
|
18
|
-
-
|
20
|
+
- rubinius-3
|
19
21
|
matrix:
|
20
22
|
allow_failures:
|
21
23
|
- rvm: ruby-head
|
22
24
|
- rvm: jruby-head
|
23
|
-
- rvm: jruby-18mode
|
24
25
|
- rvm: jruby-19mode
|
25
26
|
- rvm: jruby-20mode
|
26
27
|
- rvm: jruby-21mode
|
27
|
-
- rvm:
|
28
|
+
- rvm: jruby-22mode
|
29
|
+
- rvm: jruby-23mode
|
30
|
+
- rvm: rubinius-3
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -5,13 +5,17 @@ platforms :rbx do
|
|
5
5
|
end
|
6
6
|
|
7
7
|
group :development, :test do
|
8
|
-
if RUBY_VERSION<'
|
8
|
+
if RUBY_VERSION<'2.0'
|
9
9
|
gem 'mime-types', '~> 1.0'
|
10
10
|
gem 'rest-client', '~> 1.6.0'
|
11
|
+
gem 'tins', '~> 1.6.0'
|
12
|
+
gem 'term-ansicolor', '~> 1.3.0'
|
11
13
|
end
|
12
14
|
gem 'bundler', '>= 1.0'
|
13
|
-
gem 'rake'
|
15
|
+
gem 'rake', '~> 10.5.0' if RUBY_VERSION < '2.0'
|
16
|
+
gem 'rake' if RUBY_VERSION >= '2.0'
|
14
17
|
gem 'rspec'
|
18
|
+
gem 'json', '~> 1.0' if RUBY_VERSION < '1.9'
|
15
19
|
gem 'simplecov'
|
16
20
|
gem 'coveralls', :require => false
|
17
21
|
end
|
data/README.md
CHANGED
@@ -7,13 +7,13 @@
|
|
7
7
|
|
8
8
|
## Supported Ruby versions
|
9
9
|
* Ruby 1.8.7 or later
|
10
|
-
* jruby
|
11
10
|
* rubinius
|
12
|
-
* (
|
11
|
+
* jruby (RSA only)
|
13
12
|
|
14
13
|
## Caveats
|
15
14
|
* Passphrase is not supported yet.
|
16
15
|
* On Ruby 1.8, the output PEM's Base64 folding is different from original openssl.
|
16
|
+
* This implementation is built from my own research, so it might be unstable (of course, to avoid unstability we have rspec)
|
17
17
|
|
18
18
|
## Binary distribution
|
19
19
|
* https://rubygems.org/gems/openssl_pkcs8_pure
|
@@ -23,7 +23,7 @@
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
* Please check spec/openssl_pkcs8_pure.spec as an example.
|
26
|
-
* Also you can refer to ctouch/zip.rb (the first motivation is that Chrome WebStore only accepts PKCS8 key).
|
26
|
+
* Also you can refer to [ctouch/zip.rb](https://github.com/cielavenir/ctouch/blob/master/support/zip.rb) (the first motivation is that Chrome WebStore only accepts PKCS8 key).
|
27
27
|
|
28
28
|
## Contributing to openssl_pkcs8_pure
|
29
29
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
data/lib/openssl_pkcs8_pure.rb
CHANGED
@@ -15,7 +15,7 @@ class OpenSSL::PKey::DSA
|
|
15
15
|
def to_der_pkcs8
|
16
16
|
#if public, just use x509 default output
|
17
17
|
return to_der if !private?
|
18
|
-
asn1=OpenSSL::ASN1.decode(to_der).
|
18
|
+
asn1=OpenSSL::ASN1.decode(to_der).value
|
19
19
|
OpenSSL::ASN1::Sequence([
|
20
20
|
OpenSSL::ASN1::Integer(0),
|
21
21
|
OpenSSL::ASN1::Sequence([
|
@@ -41,7 +41,7 @@ class OpenSSL::PKey::RSA
|
|
41
41
|
return to_der if !private?
|
42
42
|
OpenSSL::ASN1::Sequence([
|
43
43
|
OpenSSL::ASN1::Integer(0),
|
44
|
-
OpenSSL::ASN1::Sequence([OpenSSL::ASN1::ObjectId("rsaEncryption"),OpenSSL::ASN1::Null(nil)]),
|
44
|
+
OpenSSL::ASN1::Sequence([OpenSSL::ASN1::ObjectId("rsaEncryption"),OpenSSL::ASN1::Null.new(nil)]),
|
45
45
|
OpenSSL::ASN1::OctetString(to_der)
|
46
46
|
]).to_der
|
47
47
|
end
|
@@ -59,7 +59,7 @@ class OpenSSL::PKey::EC
|
|
59
59
|
def to_der_pkcs8
|
60
60
|
#[todo] OpenSSL::PKey::EC#public_key does not respond to to_pem
|
61
61
|
#return to_der if !private?
|
62
|
-
asn1=OpenSSL::ASN1.decode(to_der).
|
62
|
+
asn1=OpenSSL::ASN1.decode(to_der).value
|
63
63
|
#curve_name=asn1[2].value[0].value
|
64
64
|
curve_name=group.curve_name
|
65
65
|
asn1.delete_at(2)
|
data/openssl_pkcs8_pure.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "openssl_pkcs8_pure"
|
5
|
-
spec.version = "0.0.0.
|
5
|
+
spec.version = "0.0.0.2"
|
6
6
|
spec.authors = ["cielavenir"]
|
7
7
|
spec.email = ["cielartisan@gmail.com"]
|
8
8
|
spec.description = "OpenSSL::PKey::[DSA/RSA/EC]#to_pem_pkcs8 written in Ruby"
|
@@ -23,20 +23,36 @@ end
|
|
23
23
|
#spec_keys.txt: fasta-like editable text archive
|
24
24
|
arc=File.open(File.expand_path(File.dirname(__FILE__)+'/spec_keys.txt')){|f|getarchive(f)}
|
25
25
|
|
26
|
+
DSA_jruby_msg='OpenSSL::ASN1::Integer#to_der is broken in jruby'
|
27
|
+
EC_jruby_msg='OpenSSL::PKey::EC is unstable in jruby'
|
28
|
+
|
26
29
|
['DSA','RSA','EC'].each{|type|
|
27
30
|
describe "OpenSSL::PKey::"+type do
|
28
31
|
klass=OpenSSL::PKey.const_get(type)
|
29
32
|
it "reads PKCS1 key" do
|
33
|
+
if type=='EC'&&OpenSSL::PKey::EC.instance_method(:initialize).arity==0
|
34
|
+
pending 'OpenSSL::PKey::EC.new is unusable on this platform'
|
35
|
+
end
|
30
36
|
klass.new(arc[type+'_PKCS1']).is_a?(klass).should be true
|
31
37
|
end
|
32
38
|
it "converts PKCS1 to PKCS8" do
|
33
39
|
pending 'PEM Line fold is different on Ruby 1.8' if RUBY_VERSION<'1.9'
|
40
|
+
if defined?(RUBY_ENGINE)&&RUBY_ENGINE=='jruby'
|
41
|
+
pending DSA_jruby_msg if type=='DSA'
|
42
|
+
pending EC_jruby_msg if type=='EC'
|
43
|
+
end
|
44
|
+
|
34
45
|
pkcs8=klass.new(arc[type+'_PKCS1']).to_pem_pkcs8
|
35
46
|
pkcs8.should eq arc[type+'_PKCS8']
|
36
47
|
klass.new(pkcs8).is_a?(klass).should be true
|
37
48
|
end
|
38
49
|
if RUBY_VERSION>='1.9'&&ENV['OPENSSL']
|
39
50
|
it "converts PKCS1 to correct PKCS8" do
|
51
|
+
if defined?(RUBY_ENGINE)&&RUBY_ENGINE=='jruby'
|
52
|
+
pending DSA_jruby_msg if type=='DSA'
|
53
|
+
pending EC_jruby_msg if type=='EC'
|
54
|
+
end
|
55
|
+
|
40
56
|
pkcs8=klass.new(arc[type+'_PKCS1']).to_pem_pkcs8
|
41
57
|
pkcs8_io=IO.popen(ENV['OPENSSL']+' pkcs8 -topk8 -nocrypt','r+b'){|io|
|
42
58
|
io.puts arc[type+'_PKCS1']
|