sshkey 1.1.2 → 1.1.3

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.
Files changed (4) hide show
  1. data/README.rdoc +1 -1
  2. data/lib/sshkey.rb +19 -12
  3. data/lib/sshkey/version.rb +1 -1
  4. metadata +3 -14
data/README.rdoc CHANGED
@@ -4,7 +4,7 @@ Generate private/public SSH keys using Ruby without the `ssh-keygen` system comm
4
4
 
5
5
  gem install sshkey
6
6
 
7
- Tested on Ruby 1.8.7 and 1.9.2 (MRI).
7
+ Tested on Ruby 1.8.7 and 1.9.2 (MRI). Ruby must be compiled with OpenSSL support.
8
8
 
9
9
  == Usage
10
10
 
data/lib/sshkey.rb CHANGED
@@ -8,20 +8,27 @@ class SSHKey
8
8
  SSHKey.new(OpenSSL::PKey::RSA.generate(2048).to_pem, options)
9
9
  end
10
10
 
11
- attr_reader :key_object, :comment, :rsa_private_key, :rsa_public_key, :ssh_public_key, :fingerprint
11
+ attr_reader :key_object, :comment
12
12
 
13
13
  def initialize(private_key, options = {})
14
- @key_object = OpenSSL::PKey::RSA.new(private_key)
15
- @comment = options[:comment] || ""
16
- @rsa_private_key = @key_object.to_pem
17
- @rsa_public_key = @key_object.public_key.to_pem
18
- raw_ssh_public_key = ssh_public_key_conversion
19
- @ssh_public_key = [
20
- "ssh-rsa",
21
- Base64.encode64(raw_ssh_public_key).gsub("\n", ""),
22
- @comment,
23
- ].join(" ").strip
24
- @fingerprint = Digest::MD5.hexdigest(raw_ssh_public_key).gsub(/(.{2})(?=.)/, '\1:\2')
14
+ @key_object = OpenSSL::PKey::RSA.new(private_key)
15
+ @comment = options[:comment] || ""
16
+ end
17
+
18
+ def rsa_private_key
19
+ key_object.to_pem
20
+ end
21
+
22
+ def rsa_public_key
23
+ key_object.public_key.to_pem
24
+ end
25
+
26
+ def ssh_public_key
27
+ ["ssh-rsa", Base64.encode64(ssh_public_key_conversion).gsub("\n", ""), @comment].join(" ").strip
28
+ end
29
+
30
+ def fingerprint
31
+ Digest::MD5.hexdigest(ssh_public_key_conversion).gsub(/(.{2})(?=.)/, '\1:\2')
25
32
  end
26
33
 
27
34
  private
@@ -1,3 +1,3 @@
1
1
  class SSHKey
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkey
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease:
6
- segments:
7
- - 1
8
- - 1
9
- - 2
10
- version: 1.1.2
5
+ version: 1.1.3
11
6
  platform: ruby
12
7
  authors:
13
8
  - James Miller
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-04-19 00:00:00 -07:00
13
+ date: 2011-05-12 00:00:00 -07:00
19
14
  default_executable:
20
15
  dependencies: []
21
16
 
@@ -52,23 +47,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
47
  requirements:
53
48
  - - ">="
54
49
  - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
50
  version: "0"
59
51
  required_rubygems_version: !ruby/object:Gem::Requirement
60
52
  none: false
61
53
  requirements:
62
54
  - - ">="
63
55
  - !ruby/object:Gem::Version
64
- hash: 3
65
- segments:
66
- - 0
67
56
  version: "0"
68
57
  requirements: []
69
58
 
70
59
  rubyforge_project: sshkey
71
- rubygems_version: 1.5.2
60
+ rubygems_version: 1.6.2
72
61
  signing_key:
73
62
  specification_version: 3
74
63
  summary: SSH private/public key generator in Ruby