putty-key 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +1 -3
- data.tar.gz.sig +0 -0
- data/CHANGES.md +16 -2
- data/Gemfile +12 -3
- data/LICENSE +1 -1
- data/README.md +4 -16
- data/Rakefile +1 -4
- data/lib/putty/key.rb +7 -5
- data/lib/putty/key/openssl.rb +39 -8
- data/lib/putty/key/ppk.rb +3 -1
- data/lib/putty/key/util.rb +2 -0
- data/lib/putty/key/version.rb +3 -1
- data/test/openssl_test.rb +27 -18
- data/test/ppk_test.rb +3 -1
- data/test/test_helper.rb +9 -0
- data/test/util_test.rb +2 -2
- data/test/version_test.rb +3 -1
- metadata +21 -23
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9ee468e63692d4e452273f75c0e2349f451992fa906901f8856685c8c8f2bf82
|
4
|
+
data.tar.gz: 4aafcf168d89410aae4e6f513a10e6fb3261c4a88493ca88125a1ea251cc6721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67187df6dd956d5067b3a97f35fe53fbb35698f788c5a08f6fd6bf42cc20afcb910fab6773f8af24ac6d53d6f9bd0c23737e47d683921147e9453296d3eed32d
|
7
|
+
data.tar.gz: 7ff5c7f235975206b17da9be813221c4d24e9706e036ef4fc32ed097cfa4ce52deeb11cd9acfc68c218b0e6b7f68d07a54155e81738acd3bf05ca26f75921f03
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
�����)��������B�ɵ
|
3
|
-
��R��#��,/��)���-CW��<5A�c�E��+qtN���CV��a����(�S�`��JG�����[�.��/G?���jf��<+^#�d��K�xb�}'>g^r#�2�'��;�X&�7˼OG�Z��5�
|
1
|
+
8�Ǜ�#��Z�8�S���B��4a5AYP]�ph�-ܚ�������%�*�x���j?� _����"ME�@c�l���&,��&�i�_�ֹ�8R^U',&aa�A�&"@�~��U'8���XG*�G���6�y��V�z#��0�E�1 �Օ6��k(�Z�C2�/e����6es�^����zBj���f�ڤ��\=F��Px��}��="�X���qAN�ޜ��g��卹��az�O:d�;���w��ћ�1��M�
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES.md
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Changes #
|
2
|
+
|
3
|
+
## Version 1.0.1 - 26-Dec-2019 ##
|
4
|
+
|
5
|
+
* Fix errors converting DSA and RSA PPK keys to OpenSSL in
|
6
|
+
`OpenSSL::PKey.from_ppk(ppk)` with Ruby MRI 2.4 and later.
|
7
|
+
* Fix errors converting EC PPK keys to OpenSSL in
|
8
|
+
`OpenSSL::PKey.from_ppk(ppk)` with JRuby 9.2.
|
9
|
+
* Fix errors converting EC keys from OpenSSL to PPK in
|
10
|
+
`OpenSSL::PKey::EC.to_ppk` with JRuby 9.2.
|
11
|
+
* Enable frozen string literals.
|
12
|
+
* Load dependencies using `require_relative` instead of `require`.
|
13
|
+
* Remove support for Rubinius.
|
14
|
+
|
15
|
+
|
16
|
+
## Version 1.0.0 - 2-Apr-2016 ##
|
3
17
|
|
4
18
|
* First release.
|
data/Gemfile
CHANGED
@@ -3,12 +3,21 @@ source "https://rubygems.org"
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'rake', '
|
6
|
+
gem 'rake', ['>= 12.3.3', '< 14']
|
7
7
|
gem 'git', '~> 1.2', require: false
|
8
8
|
end
|
9
9
|
|
10
10
|
group :test do
|
11
11
|
gem 'minitest', '~> 5.8'
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
# coveralls is no longer maintained, but supports Ruby < 2.3.
|
14
|
+
# coveralls_reborn is maintained, but requires Ruby >= 2.3.
|
15
|
+
gem 'coveralls', '~> 0.8', require: false if RUBY_VERSION < '2.3'
|
16
|
+
gem 'coveralls_reborn', '~> 0.13', require: false if RUBY_VERSION >= '2.3'
|
17
|
+
|
18
|
+
# json is a dependency of simplecov. Version 2.3.0 is declared as compatible
|
19
|
+
# with Ruby >= 1.9, but actually fails with a syntax error.
|
20
|
+
#
|
21
|
+
# Limit to earlier versions on Ruby 1.9.
|
22
|
+
gem 'json', '< 2.3.0', require: false if RUBY_VERSION < '2.0'
|
14
23
|
end
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# PuTTY::Key #
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/putty-key.svg)](
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/putty-key.svg)](https://badge.fury.io/rb/putty-key) [![Build Status](https://travis-ci.org/philr/putty-key.svg?branch=master)](https://travis-ci.org/philr/putty-key) [![Build status](https://ci.appveyor.com/api/projects/status/btinuu4g8sdachj3/branch/master?svg=true)](https://ci.appveyor.com/project/philr/tzinfo/branch/master) [![Coverage Status](https://coveralls.io/repos/philr/putty-key/badge.svg?branch=master)](https://coveralls.io/r/philr/putty-key?branch=master)
|
4
4
|
|
5
5
|
PuTTY::Key is a pure-Ruby implementation of the PuTTY private key (ppk) format,
|
6
6
|
handling reading and writing .ppk files. It includes a refinement to Ruby's
|
@@ -26,12 +26,7 @@ gem 'putty-key'
|
|
26
26
|
|
27
27
|
## Compatibility ##
|
28
28
|
|
29
|
-
PuTTY::Key is compatible with Ruby MRI 2.1.0+ and
|
30
|
-
OpenSSL standard library is available).
|
31
|
-
|
32
|
-
JRuby will be supported (DSA/DSS and RSA keys only) once jruby-openssl pull
|
33
|
-
requests [#82](https://github.com/jruby/jruby-openssl/pull/82) and
|
34
|
-
[#83](https://github.com/jruby/jruby-openssl/pull/83) have been released.
|
29
|
+
PuTTY::Key is compatible with Ruby MRI 2.1.0+ and JRuby 9.1.0.0+.
|
35
30
|
|
36
31
|
|
37
32
|
## Usage ##
|
@@ -42,7 +37,7 @@ To use PuTTY::Key, it must first be loaded with:
|
|
42
37
|
require 'putty/key'
|
43
38
|
```
|
44
39
|
|
45
|
-
The included [refinement](
|
40
|
+
The included [refinement](https://ruby-doc.org/core/doc/syntax/refinements_rdoc.html)
|
46
41
|
to Ruby's OpenSSL library can then either be activated in the lexical scope
|
47
42
|
(file, class or module) where it will be used with:
|
48
43
|
|
@@ -56,13 +51,6 @@ or installed globally by calling:
|
|
56
51
|
PuTTY::Key.global_install
|
57
52
|
```
|
58
53
|
|
59
|
-
Note that Rubinius (as of version 3.22) does not support refinements, so the
|
60
|
-
global installation approach is required.
|
61
|
-
|
62
|
-
JRuby (as of version 9.0.5.0) includes support for refinements, but there are
|
63
|
-
still outstanding issues. The global installation approach is preferable on
|
64
|
-
JRuby.
|
65
|
-
|
66
54
|
The following sections give examples of how PuTTY::Key can be used.
|
67
55
|
|
68
56
|
|
@@ -122,7 +110,7 @@ ppk.save('rsa-plain.ppk')
|
|
122
110
|
## API Documentation ##
|
123
111
|
|
124
112
|
API documentation for PuTTY::Key is available on
|
125
|
-
[RubyDoc.info](
|
113
|
+
[RubyDoc.info](https://www.rubydoc.info/gems/putty-key).
|
126
114
|
|
127
115
|
|
128
116
|
## License ##
|
data/Rakefile
CHANGED
@@ -74,14 +74,11 @@ def define_test_task(type, test_coverage)
|
|
74
74
|
Rake::Task[test_task].enhance([env_task])
|
75
75
|
end
|
76
76
|
|
77
|
-
# JRuby 9.0.5.0 doesn't handle refinements correctly.
|
78
77
|
if RUBY_ENGINE == 'jruby'
|
79
78
|
# Don't run coverage tests on JRuby due to inaccurate results.
|
80
79
|
TEST_COVERAGE = false
|
81
80
|
|
82
|
-
|
83
|
-
puts 'Skipping refinement tests on JRuby'
|
84
|
-
end
|
81
|
+
define_test_task(:refinement, TEST_COVERAGE)
|
85
82
|
elsif !respond_to?(:using, true)
|
86
83
|
# Don't run coverage tests on platforms that don't support refinements, since
|
87
84
|
# it won't be possible to get complete coverage.
|
data/lib/putty/key.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module PuTTY
|
2
4
|
# PuTTY::Key is a pure-Ruby implementation of the PuTTY private key (ppk)
|
3
5
|
# format, handling reading and writing .ppk files. It includes a refinement to
|
@@ -17,9 +19,9 @@ module PuTTY
|
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
require_relative 'key/version'
|
23
|
+
require_relative 'key/error'
|
24
|
+
require_relative 'key/util'
|
25
|
+
require_relative 'key/ppk'
|
26
|
+
require_relative 'key/openssl'
|
25
27
|
|
data/lib/putty/key/openssl.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'openssl'
|
2
4
|
|
3
5
|
module PuTTY
|
@@ -17,6 +19,10 @@ module PuTTY
|
|
17
19
|
|
18
20
|
# Mapping from OpenSSL curve names to their equivalent SSH names.
|
19
21
|
SSH_CURVES = OPENSSL_CURVES.invert
|
22
|
+
|
23
|
+
# Add an alternative alias for nistp256 used by JRuby.
|
24
|
+
SSH_CURVES['secp256r1'] = 'nistp256'
|
25
|
+
|
20
26
|
private_constant :SSH_CURVES
|
21
27
|
|
22
28
|
# The {ClassMethods} module is used to extend `OpenSSL::PKey` when
|
@@ -45,25 +51,50 @@ module PuTTY
|
|
45
51
|
case ppk.algorithm
|
46
52
|
when 'ssh-dss'
|
47
53
|
::OpenSSL::PKey::DSA.new.tap do |pkey|
|
48
|
-
_,
|
49
|
-
|
54
|
+
_, p, q, g, pub_key = Util.ssh_unpack(ppk.public_blob, :string, :mpint, :mpint, :mpint, :mpint)
|
55
|
+
priv_key = Util.ssh_unpack(ppk.private_blob, :mpint).first
|
56
|
+
|
57
|
+
if pkey.respond_to?(:set_key)
|
58
|
+
# :nocov_no_openssl_pkey_dsa_set_key:
|
59
|
+
pkey.set_key(pub_key, priv_key)
|
60
|
+
pkey.set_pqg(p, q, g)
|
61
|
+
# :nocov_no_openssl_pkey_dsa_set_key:
|
62
|
+
else
|
63
|
+
# :nocov_openssl_pkey_dsa_set_key:
|
64
|
+
pkey.p, pkey.q, pkey.g, pkey.pub_key, pkey.priv_key = p, q, g, pub_key, priv_key
|
65
|
+
# :nocov_openssl_pkey_dsa_set_key:
|
66
|
+
end
|
50
67
|
end
|
51
68
|
when 'ssh-rsa'
|
52
69
|
::OpenSSL::PKey::RSA.new.tap do |pkey|
|
53
|
-
_,
|
54
|
-
|
55
|
-
|
56
|
-
|
70
|
+
_, e, n = Util.ssh_unpack(ppk.public_blob, :string, :mpint, :mpint)
|
71
|
+
d, p, q, iqmp = Util.ssh_unpack(ppk.private_blob, :mpint, :mpint, :mpint, :mpint)
|
72
|
+
|
73
|
+
dmp1 = d % (p - 1)
|
74
|
+
dmq1 = d % (q - 1)
|
75
|
+
|
76
|
+
if pkey.respond_to?(:set_factors)
|
77
|
+
# :nocov_no_openssl_pkey_rsa_set_factors:
|
78
|
+
pkey.set_factors(p, q)
|
79
|
+
pkey.set_key(n, e, d)
|
80
|
+
pkey.set_crt_params(dmp1, dmq1, iqmp)
|
81
|
+
# :nocov_no_openssl_pkey_rsa_set_factors:
|
82
|
+
else
|
83
|
+
# :nocov_openssl_pkey_rsa_set_factors:
|
84
|
+
pkey.e, pkey.n, pkey.d, pkey.p, pkey.q, pkey.iqmp, pkey.dmp1, pkey.dmq1 = e, n, d, p, q, iqmp, dmp1, dmq1
|
85
|
+
# :nocov_openssl_pkey_rsa_set_factors:
|
86
|
+
end
|
57
87
|
end
|
58
88
|
when /\Aecdsa-sha2-(nistp(?:256|384|521))\z/
|
59
89
|
curve = OPENSSL_CURVES[$1]
|
60
90
|
|
61
|
-
# jruby-openssl
|
91
|
+
# Old versions of jruby-openssl don't include an EC class (version 0.9.16).
|
62
92
|
ec_class = (::OpenSSL::PKey::EC rescue raise ArgumentError, "Unsupported algorithm: #{ppk.algorithm}")
|
63
93
|
|
64
94
|
ec_class.new(curve).tap do |pkey|
|
65
95
|
_, _, point = Util.ssh_unpack(ppk.public_blob, :string, :string, :mpint)
|
66
|
-
pkey.
|
96
|
+
group = pkey.group || ::OpenSSL::PKey::EC::Group.new(curve)
|
97
|
+
pkey.public_key = ::OpenSSL::PKey::EC::Point.new(group, point)
|
67
98
|
pkey.private_key = Util.ssh_unpack(ppk.private_blob, :mpint).first
|
68
99
|
end
|
69
100
|
else
|
data/lib/putty/key/ppk.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'openssl'
|
2
4
|
|
3
5
|
module PuTTY
|
@@ -23,7 +25,7 @@ module PuTTY
|
|
23
25
|
# was only used briefly early on in the development of the .ppk format.
|
24
26
|
class PPK
|
25
27
|
# String used in the computation of the private MAC.
|
26
|
-
MAC_KEY = 'putty-private-key-file-mac-key'
|
28
|
+
MAC_KEY = 'putty-private-key-file-mac-key'
|
27
29
|
private_constant :MAC_KEY
|
28
30
|
|
29
31
|
# The default (and only supported) encryption algorithm.
|
data/lib/putty/key/util.rb
CHANGED
data/lib/putty/key/version.rb
CHANGED
data/test/openssl_test.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'test_helper'
|
2
4
|
|
3
5
|
if TEST_TYPE == :refinement
|
4
|
-
|
5
|
-
# regardless. Use send to prevent this.
|
6
|
-
send(:using, PuTTY::Key)
|
6
|
+
using PuTTY::Key
|
7
7
|
end
|
8
8
|
|
9
9
|
class OpenSSLTest < Minitest::Test
|
@@ -20,72 +20,72 @@ class OpenSSLTest < Minitest::Test
|
|
20
20
|
ppk = PuTTY::Key::PPK.new(fixture_path('rsa-2048.ppk'))
|
21
21
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
22
22
|
assert_kind_of(OpenSSL::PKey::RSA, pkey)
|
23
|
-
assert_equal(
|
23
|
+
assert_equal(normalize_pem_fixture('rsa-2048.pem'), pkey.to_pem)
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_from_ppk_rsa_encrypted
|
27
27
|
ppk = PuTTY::Key::PPK.new(fixture_path('rsa-2048-encrypted.ppk'), 'Test Passphrase')
|
28
28
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
29
29
|
assert_kind_of(OpenSSL::PKey::RSA, pkey)
|
30
|
-
assert_equal(
|
30
|
+
assert_equal(normalize_pem_fixture('rsa-2048.pem'), pkey.to_pem)
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_from_ppk_dss
|
34
34
|
ppk = PuTTY::Key::PPK.new(fixture_path('dss-1024.ppk'))
|
35
35
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
36
36
|
assert_kind_of(OpenSSL::PKey::DSA, pkey)
|
37
|
-
assert_equal(
|
37
|
+
assert_equal(normalize_pem_fixture('dss-1024.pem'), pkey.to_pem)
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_from_ppk_dss_encrypted
|
41
41
|
ppk = PuTTY::Key::PPK.new(fixture_path('dss-1024-encrypted.ppk'), 'Test Passphrase')
|
42
42
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
43
43
|
assert_kind_of(OpenSSL::PKey::DSA, pkey)
|
44
|
-
assert_equal(
|
44
|
+
assert_equal(normalize_pem_fixture('dss-1024.pem'), pkey.to_pem)
|
45
45
|
end
|
46
46
|
|
47
|
-
# jruby-openssl
|
47
|
+
# Old versions of jruby-openssl don't include an EC class (version 0.9.16).
|
48
48
|
if defined?(OpenSSL::PKey::EC)
|
49
49
|
def test_from_ppk_ecdsa_sha2_nistp256
|
50
50
|
ppk = PuTTY::Key::PPK.new(fixture_path('ecdsa-sha2-nistp256.ppk'))
|
51
51
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
52
52
|
assert_kind_of(OpenSSL::PKey::EC, pkey)
|
53
|
-
assert_equal(
|
53
|
+
assert_equal(normalize_pem_fixture('ecdsa-sha2-nistp256.pem', OpenSSL::PKey::EC), pkey.to_pem)
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_from_ppk_ecdsa_sha2_nistp256_encrypted
|
57
57
|
ppk = PuTTY::Key::PPK.new(fixture_path('ecdsa-sha2-nistp256-encrypted.ppk'), 'Test Passphrase')
|
58
58
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
59
59
|
assert_kind_of(OpenSSL::PKey::EC, pkey)
|
60
|
-
assert_equal(
|
60
|
+
assert_equal(normalize_pem_fixture('ecdsa-sha2-nistp256.pem', OpenSSL::PKey::EC), pkey.to_pem)
|
61
61
|
end
|
62
62
|
|
63
63
|
def test_from_ppk_ecdsa_sha2_nistp384
|
64
64
|
ppk = PuTTY::Key::PPK.new(fixture_path('ecdsa-sha2-nistp384.ppk'))
|
65
65
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
66
66
|
assert_kind_of(OpenSSL::PKey::EC, pkey)
|
67
|
-
assert_equal(
|
67
|
+
assert_equal(normalize_pem_fixture('ecdsa-sha2-nistp384.pem', OpenSSL::PKey::EC), pkey.to_pem)
|
68
68
|
end
|
69
69
|
|
70
70
|
def test_from_ppk_ecdsa_sha2_nistp384_encrypted
|
71
71
|
ppk = PuTTY::Key::PPK.new(fixture_path('ecdsa-sha2-nistp384-encrypted.ppk'), 'Test Passphrase')
|
72
72
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
73
73
|
assert_kind_of(OpenSSL::PKey::EC, pkey)
|
74
|
-
assert_equal(
|
74
|
+
assert_equal(normalize_pem_fixture('ecdsa-sha2-nistp384.pem', OpenSSL::PKey::EC), pkey.to_pem)
|
75
75
|
end
|
76
76
|
|
77
77
|
def test_from_ppk_ecdsa_sha2_nistp521
|
78
78
|
ppk = PuTTY::Key::PPK.new(fixture_path('ecdsa-sha2-nistp521.ppk'))
|
79
79
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
80
80
|
assert_kind_of(OpenSSL::PKey::EC, pkey)
|
81
|
-
assert_equal(
|
81
|
+
assert_equal(normalize_pem_fixture('ecdsa-sha2-nistp521.pem', OpenSSL::PKey::EC), pkey.to_pem)
|
82
82
|
end
|
83
83
|
|
84
84
|
def test_from_ppk_ecdsa_sha2_nistp521_encrypted
|
85
85
|
ppk = PuTTY::Key::PPK.new(fixture_path('ecdsa-sha2-nistp521-encrypted.ppk'), 'Test Passphrase')
|
86
86
|
pkey = OpenSSL::PKey.from_ppk(ppk)
|
87
87
|
assert_kind_of(OpenSSL::PKey::EC, pkey)
|
88
|
-
assert_equal(
|
88
|
+
assert_equal(normalize_pem_fixture('ecdsa-sha2-nistp521.pem', OpenSSL::PKey::EC), pkey.to_pem)
|
89
89
|
end
|
90
90
|
else
|
91
91
|
def test_from_ppk_ecdsa_sha2_nistp256
|
@@ -119,19 +119,28 @@ class OpenSSLTest < Minitest::Test
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
def
|
122
|
+
def load_key(fixture, type = nil)
|
123
123
|
pem = load_fixture(fixture)
|
124
124
|
|
125
125
|
# Accessing OpenSSL::PKey::EC#public_key raises a warning when the key was
|
126
126
|
# loaded with OpenSSL::PKey.read(pem), but doesn't when instantiated with
|
127
127
|
# OpenSSL::PKey::EC.new(pem) (Ruby 2.3.0).
|
128
|
-
|
128
|
+
type ? type.new(pem) : OpenSSL::PKey.read(pem)
|
129
|
+
end
|
130
|
+
|
131
|
+
def pem_to_ppk(fixture, type = nil)
|
132
|
+
pkey = load_key(fixture, type)
|
129
133
|
|
130
134
|
pkey.to_ppk.tap do |ppk|
|
131
135
|
assert_nil(ppk.comment)
|
132
136
|
end
|
133
137
|
end
|
134
138
|
|
139
|
+
def normalize_pem_fixture(fixture, type = nil)
|
140
|
+
pkey = load_key(fixture, type)
|
141
|
+
pkey.to_pem
|
142
|
+
end
|
143
|
+
|
135
144
|
def test_to_ppk_rsa
|
136
145
|
ppk = pem_to_ppk('rsa-2048.pem')
|
137
146
|
ppk.comment = '2048 bit RSA key'
|
@@ -178,7 +187,7 @@ class OpenSSLTest < Minitest::Test
|
|
178
187
|
assert_raises(PuTTY::Key::InvalidStateError) { pkey.to_ppk }
|
179
188
|
end
|
180
189
|
|
181
|
-
# jruby-openssl
|
190
|
+
# Old versions of jruby-openssl don't include an EC class (version 0.9.16).
|
182
191
|
if defined?(OpenSSL::PKey::EC)
|
183
192
|
def test_to_ppk_ecdsa_sha2_nistp256
|
184
193
|
ppk = pem_to_ppk('ecdsa-sha2-nistp256.pem', OpenSSL::PKey::EC)
|
data/test/ppk_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
TEST_TYPE = (ENV['TEST_TYPE'] || 'refinement').to_sym
|
2
4
|
raise "Unrecognized TEST_TYPE: #{TEST_TYPE}" unless [:refinement, :global].include?(TEST_TYPE)
|
3
5
|
|
@@ -7,6 +9,12 @@ if TEST_COVERAGE
|
|
7
9
|
require 'simplecov'
|
8
10
|
require 'coveralls'
|
9
11
|
|
12
|
+
require 'openssl'
|
13
|
+
|
14
|
+
method_support = [[OpenSSL::PKey::DSA.new, :set_key], [OpenSSL::PKey::RSA.new, :set_factors]].map do |object, method|
|
15
|
+
"#{object.respond_to?(method) ? '' : 'no_'}#{Regexp.escape(object.class.name.downcase.gsub('::', '_'))}_#{Regexp.escape(method)}"
|
16
|
+
end
|
17
|
+
|
10
18
|
SimpleCov.command_name TEST_TYPE.to_s
|
11
19
|
|
12
20
|
SimpleCov.formatters = [
|
@@ -15,6 +23,7 @@ if TEST_COVERAGE
|
|
15
23
|
|
16
24
|
SimpleCov.start do
|
17
25
|
add_filter 'test'
|
26
|
+
nocov_token "nocov_(#{method_support.join('|')})"
|
18
27
|
project_name 'PuTTY::Key'
|
19
28
|
end
|
20
29
|
end
|
data/test/util_test.rb
CHANGED
data/test/version_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: putty-key
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Ross
|
@@ -10,27 +10,26 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
6MZp2lpZ1vzDLLMrF41xmdxGROtUrcyy
|
13
|
+
MIIDPDCCAiSgAwIBAgIBATANBgkqhkiG9w0BAQsFADAkMSIwIAYDVQQDDBlwaGls
|
14
|
+
LnJvc3MvREM9Z21haWwvREM9Y29tMB4XDTE5MTIyNDE0NTU0N1oXDTM5MTIyNDE0
|
15
|
+
NTU0N1owJDEiMCAGA1UEAwwZcGhpbC5yb3NzL0RDPWdtYWlsL0RDPWNvbTCCASIw
|
16
|
+
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJGcwfqn4ZsmPl0b1Lt9dCzExrE5
|
17
|
+
EeP/CRQjBdGHkF+mSpi69XysxdwLdfg5SPr9LfxthUug4nNFd5fDCiXM8hYe9jQD
|
18
|
+
TmkIQKNBh4fFpGngn9gyy+SumCXi6b5L6d/aMc59NAOM6LJ88TOdH1648dh5rq3C
|
19
|
+
ULq82n3gg4+u0HHGjRPuR/pnCFQCZbANYdX+UBWd0qkOJn/EreNKROmEeHr/xKuh
|
20
|
+
2/GlKFKt9KLcW3hwBB4fHHVYUzRau7D1m9KbEERdg//qNDC4B7fD2BFJuPbM5S7J
|
21
|
+
41VwDAh1O8B/Qpg0f+S83K4Kodw4MiPGsug55UkNtd3mGR/zZJ9WM03DSwkCAwEA
|
22
|
+
AaN5MHcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFA+Z8zvfzBuA
|
23
|
+
esoHIfz7+jxfUOcfMB4GA1UdEQQXMBWBE3BoaWwucm9zc0BnbWFpbC5jb20wHgYD
|
24
|
+
VR0SBBcwFYETcGhpbC5yb3NzQGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEA
|
25
|
+
J80xgZ3gGdQVA8N+8NJANU5HLuZIU9jOaAlziU9ImoTgPiOHKGZC4as1TwT4kBt1
|
26
|
+
Qcnu7YSANYRrxP5tpOHsWPF/MQYgerAFCZS5+PzOTudwZ+7OsMW4/EMHy6aCVHEd
|
27
|
+
c7HzQRC4mSrDRpWxzyBnZ5nX5OAmIkKA8NgeKybT/4Ku6iFPPUQwlyxQaO+Wlxdo
|
28
|
+
FqHwpjRyoiVSpe4RUTNK3d3qesWPYi7Lxn6k6ZZeEdvG6ya33AXktE3jmmF+jPR1
|
29
|
+
J3Zn/kSTjTekiaspyGbczC3PUaeJNxr+yCvR4sk71Xmk/GaKKGOHedJ1uj/LAXrA
|
30
|
+
MR0mpl7b8zCg0PFC1J73uw==
|
32
31
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
32
|
+
date: 2019-12-26 00:00:00.000000000 Z
|
34
33
|
dependencies: []
|
35
34
|
description: |
|
36
35
|
PuTTY::Key is a pure-Ruby implementation of the PuTTY private key (ppk) format,
|
@@ -115,8 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
114
|
- !ruby/object:Gem::Version
|
116
115
|
version: '0'
|
117
116
|
requirements: []
|
118
|
-
|
119
|
-
rubygems_version: 2.6.2
|
117
|
+
rubygems_version: 3.1.2
|
120
118
|
signing_key:
|
121
119
|
specification_version: 4
|
122
120
|
summary: Reads and writes PuTTY private key (.ppk) files. Refines OpenSSL::PKey to
|
metadata.gz.sig
CHANGED
Binary file
|