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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2f25fb48a4e37551a2660d1d4fd3147d3e3170ac
4
- data.tar.gz: 8e4bd0d38dbf9a5a56e1e10fdf7db11cd2f7a055
2
+ SHA256:
3
+ metadata.gz: 9ee468e63692d4e452273f75c0e2349f451992fa906901f8856685c8c8f2bf82
4
+ data.tar.gz: 4aafcf168d89410aae4e6f513a10e6fb3261c4a88493ca88125a1ea251cc6721
5
5
  SHA512:
6
- metadata.gz: 54e123b54417b3b2dcb280c6fccb054ae7f4a1d2bb4af8924c33f12886cdea5dcf3d998dbe48c435840578ebed83f471742b45fea808334ebd0010047b1f45bd
7
- data.tar.gz: cd8f021629d480f19e4c3b7f628b1b602c318e69ce1316b6619dd6f94b42fc3dd969d2a53b8cbc4e6df1cc655a54dc83512cc74499804fa20fc3cbc26eb0e33b
6
+ metadata.gz: 67187df6dd956d5067b3a97f35fe53fbb35698f788c5a08f6fd6bf42cc20afcb910fab6773f8af24ac6d53d6f9bd0c23737e47d683921147e9453296d3eed32d
7
+ data.tar.gz: 7ff5c7f235975206b17da9be813221c4d24e9706e036ef4fc32ed097cfa4ce52deeb11cd9acfc68c218b0e6b7f68d07a54155e81738acd3bf05ca26f75921f03
@@ -1,3 +1 @@
1
- 1�񨯼]�n]�W��E����:Q��؃�#� ��5��.�|Tju���ͱ�gh�#x�?�;���ly:C{8��B��hg��@�����Yba��
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��4a5A YP]�ph�-ܚ�������%�*�x���j?� _����"ME �@c�l���&,��&�i�_�ֹ�8R^U',&aa�A�&"@�~��U'8���XG*�G���6�y��V�z#��0�E�1 �Օ6��k(ZC2�/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
- Version 1.0.0 - 2-Apr-2016
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', '~> 10.5'
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
- gem 'simplecov', '~> 0.11', require: false
13
- gem 'coveralls', '~> 0.8', require: false
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
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 Philip Ross
1
+ Copyright (c) 2016-2019 Philip Ross
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
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)](http://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) [![Coverage Status](https://coveralls.io/repos/philr/putty-key/badge.svg?branch=master)](https://coveralls.io/r/philr/putty-key?branch=master)
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 Rubinius 2.5.4+ (provided the
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](http://ruby-doc.org/core-2.3.0/doc/syntax/refinements_rdoc.html)
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](http://www.rubydoc.info/gems/putty-key).
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
- task 'test:refinement' do
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.
@@ -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
- require 'putty/key/version'
21
- require 'putty/key/error'
22
- require 'putty/key/util'
23
- require 'putty/key/ppk'
24
- require 'putty/key/openssl'
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
 
@@ -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
- _, pkey.p, pkey.q, pkey.g, pkey.pub_key = Util.ssh_unpack(ppk.public_blob, :string, :mpint, :mpint, :mpint, :mpint)
49
- pkey.priv_key = Util.ssh_unpack(ppk.private_blob, :mpint).first
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
- _, pkey.e, pkey.n = Util.ssh_unpack(ppk.public_blob, :string, :mpint, :mpint)
54
- pkey.d, pkey.p, pkey.q, pkey.iqmp = Util.ssh_unpack(ppk.private_blob, :mpint, :mpint, :mpint, :mpint)
55
- pkey.dmp1 = pkey.d % (pkey.p - 1)
56
- pkey.dmq1 = pkey.d % (pkey.q - 1)
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 doesn't include an EC class (version 0.9.16)
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.public_key = ::OpenSSL::PKey::EC::Point.new(pkey.group, point)
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
@@ -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'#.b#.freeze
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.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openssl'
2
4
  require 'stringio'
3
5
 
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PuTTY
2
4
  module Key
3
5
  # The PuTTY::Key version number.
4
- VERSION = '1.0.0'
6
+ VERSION = '1.0.1'
5
7
  end
6
8
  end
@@ -1,9 +1,9 @@
1
- require 'test_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'test_helper'
2
4
 
3
5
  if TEST_TYPE == :refinement
4
- # JRuby 9.0.5.0 ignores the conditional and imports the refinements
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(load_fixture('rsa-2048.pem'), pkey.to_pem)
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(load_fixture('rsa-2048.pem'), pkey.to_pem)
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(load_fixture('dss-1024.pem'), pkey.to_pem)
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(load_fixture('dss-1024.pem'), pkey.to_pem)
44
+ assert_equal(normalize_pem_fixture('dss-1024.pem'), pkey.to_pem)
45
45
  end
46
46
 
47
- # jruby-openssl doesn't include an EC class (version 0.9.16)
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(load_fixture('ecdsa-sha2-nistp256.pem'), pkey.to_pem)
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(load_fixture('ecdsa-sha2-nistp256.pem'), pkey.to_pem)
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(load_fixture('ecdsa-sha2-nistp384.pem'), pkey.to_pem)
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(load_fixture('ecdsa-sha2-nistp384.pem'), pkey.to_pem)
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(load_fixture('ecdsa-sha2-nistp521.pem'), pkey.to_pem)
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(load_fixture('ecdsa-sha2-nistp521.pem'), pkey.to_pem)
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 pem_to_ppk(fixture, type = nil)
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
- pkey = type ? type.new(pem) : OpenSSL::PKey.read(pem)
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 doesn't include an EC class (version 0.9.15)
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)
@@ -1,4 +1,6 @@
1
- require 'test_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'test_helper'
2
4
  require 'pathname'
3
5
 
4
6
  class PPKTest < Minitest::Test
@@ -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
@@ -1,6 +1,6 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
- require 'test_helper'
3
+ require_relative 'test_helper'
4
4
  require 'openssl'
5
5
 
6
6
  # PuTTY::Key::NilValueError and PuTTY::Key::Util are private constants.
@@ -1,4 +1,6 @@
1
- require 'test_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'test_helper'
2
4
 
3
5
  class VersionTest < Minitest::Test
4
6
  def test_version
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.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
- MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlwaGls
14
- LnJvc3MxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
15
- bTAeFw0xNTEwMDMxNDI1MThaFw0xNjEwMDIxNDI1MThaMEAxEjAQBgNVBAMMCXBo
16
- aWwucm9zczEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
17
- Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkZzB+qfhmyY+XRvU
18
- u310LMTGsTkR4/8JFCMF0YeQX6ZKmLr1fKzF3At1+DlI+v0t/G2FS6Dic0V3l8MK
19
- JczyFh72NANOaQhAo0GHh8WkaeCf2DLL5K6YJeLpvkvp39oxzn00A4zosnzxM50f
20
- Xrjx2HmurcJQurzafeCDj67QccaNE+5H+mcIVAJlsA1h1f5QFZ3SqQ4mf8St40pE
21
- 6YR4ev/Eq6Hb8aUoUq30otxbeHAEHh8cdVhTNFq7sPWb0psQRF2D/+o0MLgHt8PY
22
- EUm49szlLsnjVXAMCHU7wH9CmDR/5Lzcrgqh3DgyI8ay6DnlSQ213eYZH/Nkn1Yz
23
- TcNLCQIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
24
- D5nzO9/MG4B6ygch/Pv6PF9Q5x8wHgYDVR0RBBcwFYETcGhpbC5yb3NzQGdtYWls
25
- LmNvbTAeBgNVHRIEFzAVgRNwaGlsLnJvc3NAZ21haWwuY29tMA0GCSqGSIb3DQEB
26
- BQUAA4IBAQAXSadI6IEalgGF0nk3laNNljSN2c4YnH9BXLjbkqMuKKzCH3N9BJIw
27
- uajraaYF4POe4RYwofjgFD+pIJcyThbWF8Q0qHQSAym+b8StlDKIqdnU2WVKjpSU
28
- /e4wIFQthMfxG0blBNeDTEAnlDg8f9lhRUC6U/vtAfayZGRZALlBxf1hLTuQM8Dq
29
- BToABONINIJwjUzUEOx9ZtTdqi/nyldqpsHm+t2AYxGasUSkAEfpVECYnf9QpN16
30
- tJbwPdSfFEA06U1LVTYbl0bHfmqYTZeb9CFlGMjLYSL2NFESn5ohzt6iL+ybPHX6
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: 2016-04-02 00:00:00.000000000 Z
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
- rubyforge_project:
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