sshkey 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -0
- data/Gemfile +0 -1
- data/README.md +7 -5
- data/Rakefile +8 -11
- data/lib/sshkey.rb +7 -2
- data/lib/sshkey/version.rb +1 -1
- data/sshkey.gemspec +3 -1
- metadata +34 -32
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
sshkey
|
2
2
|
======
|
3
3
|
|
4
|
-
Generate private and public SSH keys (RSA and DSA supported) using Ruby
|
4
|
+
Generate private and public SSH keys (RSA and DSA supported) using pure Ruby.
|
5
5
|
|
6
6
|
gem install sshkey
|
7
7
|
|
8
|
-
Tested on the following Rubies: MRI 1.8.7
|
8
|
+
Tested on the following Rubies: MRI 1.8.7, 1.9.2, 1.9.3, Rubinius, REE. Ruby must be compiled with OpenSSL support.
|
9
|
+
|
10
|
+
[![Build Status](https://secure.travis-ci.org/bensie/sshkey.png)](http://travis-ci.org/bensie/sshkey)
|
9
11
|
|
10
12
|
Usage
|
11
13
|
-----
|
12
14
|
|
13
15
|
When generating a new keypair the default key type is 2048-bit RSA, but you can supply the `type` (RSA or DSA) and `bits` in the options.
|
14
|
-
You can also (optionally) supply a comment
|
16
|
+
You can also (optionally) supply a `comment`:
|
15
17
|
|
16
18
|
``` ruby
|
17
19
|
k = SSHKey.generate
|
@@ -50,12 +52,12 @@ k.ssh_public_key
|
|
50
52
|
k.comment
|
51
53
|
# => "foo@bar.com"
|
52
54
|
|
53
|
-
# Returns the fingerprint as a string
|
55
|
+
# Returns the MD5 fingerprint as a string
|
54
56
|
k.fingerprint
|
55
57
|
# => "2a:89:84:c9:29:05:d1:f8:49:79:1c:ba:73:99:eb:af"
|
56
58
|
|
57
59
|
# Validates SSH Public Key
|
58
|
-
SSHKey.
|
60
|
+
SSHKey.valid_ssh_public_key? "ssh-rsa AAAAB3NzaC1yc2EA...."
|
59
61
|
# => true
|
60
62
|
```
|
61
63
|
|
data/Rakefile
CHANGED
@@ -1,16 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require 'rake/testtask'
|
1
|
+
require "rake"
|
2
|
+
require "rake/testtask"
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
desc 'Default: run unit tests.'
|
4
|
+
desc "Default: run unit tests."
|
8
5
|
task :default => :test
|
9
6
|
|
10
|
-
desc
|
7
|
+
desc "Test the sshkey gem"
|
11
8
|
Rake::TestTask.new(:test) do |t|
|
12
|
-
t.libs <<
|
13
|
-
t.libs <<
|
14
|
-
t.
|
15
|
-
t.verbose
|
9
|
+
t.libs << "lib"
|
10
|
+
t.libs << "test"
|
11
|
+
t.test_files = FileList['test/*_test.rb']
|
12
|
+
t.verbose = true
|
16
13
|
end
|
data/lib/sshkey.rb
CHANGED
@@ -19,8 +19,8 @@ class SSHKey
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.
|
23
|
-
ssh_type, encoded_key =
|
22
|
+
def self.valid_ssh_public_key?(ssh_public_key)
|
23
|
+
ssh_type, encoded_key = ssh_public_key.split(" ")
|
24
24
|
type = SSH_TYPES.invert[ssh_type]
|
25
25
|
prefix = [0,0,0,7].pack("C*")
|
26
26
|
decoded = Base64.decode64(encoded_key)
|
@@ -45,6 +45,11 @@ class SSHKey
|
|
45
45
|
false
|
46
46
|
end
|
47
47
|
|
48
|
+
def self.valid?(ssh_public_key)
|
49
|
+
puts "DEPRECATION WARNING: SSHKey.valid? has been renamed to SSHKey.valid_ssh_public_key? for clarity. SSHKey.valid? will be removed in 1.3."
|
50
|
+
valid_ssh_public_key?(ssh_public_key)
|
51
|
+
end
|
52
|
+
|
48
53
|
def self.from_byte_array(byte_array, expected_size = nil)
|
49
54
|
num = 0
|
50
55
|
raise "Byte array too short" if !expected_size.nil? && expected_size != byte_array.size
|
data/lib/sshkey/version.rb
CHANGED
data/sshkey.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.email = ["bensie@gmail.com"]
|
11
11
|
s.homepage = "https://github.com/bensie/sshkey"
|
12
12
|
s.summary = %q{SSH private/public key generator in Ruby}
|
13
|
-
s.description = %q{Generate private/public SSH
|
13
|
+
s.description = %q{Generate private/public SSH keypairs using pure Ruby}
|
14
14
|
|
15
15
|
s.rubyforge_project = "sshkey"
|
16
16
|
|
@@ -18,4 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_development_dependency("rake")
|
21
23
|
end
|
metadata
CHANGED
@@ -1,30 +1,36 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sshkey
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.3
|
4
5
|
prerelease:
|
5
|
-
version: 1.2.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- James Miller
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
date: 2011-11-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &70227494691020 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70227494691020
|
25
|
+
description: Generate private/public SSH keypairs using pure Ruby
|
26
|
+
email:
|
19
27
|
- bensie@gmail.com
|
20
28
|
executables: []
|
21
|
-
|
22
29
|
extensions: []
|
23
|
-
|
24
30
|
extra_rdoc_files: []
|
25
|
-
|
26
|
-
files:
|
31
|
+
files:
|
27
32
|
- .gitignore
|
33
|
+
- .travis.yml
|
28
34
|
- Gemfile
|
29
35
|
- LICENSE
|
30
36
|
- README.md
|
@@ -33,33 +39,29 @@ files:
|
|
33
39
|
- lib/sshkey/version.rb
|
34
40
|
- sshkey.gemspec
|
35
41
|
- test/sshkey_test.rb
|
36
|
-
has_rdoc: true
|
37
42
|
homepage: https://github.com/bensie/sshkey
|
38
43
|
licenses: []
|
39
|
-
|
40
44
|
post_install_message:
|
41
45
|
rdoc_options: []
|
42
|
-
|
43
|
-
require_paths:
|
46
|
+
require_paths:
|
44
47
|
- lib
|
45
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
49
|
none: false
|
47
|
-
requirements:
|
48
|
-
- -
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version:
|
51
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
55
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version:
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
57
60
|
requirements: []
|
58
|
-
|
59
61
|
rubyforge_project: sshkey
|
60
|
-
rubygems_version: 1.
|
62
|
+
rubygems_version: 1.8.10
|
61
63
|
signing_key:
|
62
64
|
specification_version: 3
|
63
65
|
summary: SSH private/public key generator in Ruby
|
64
|
-
test_files:
|
66
|
+
test_files:
|
65
67
|
- test/sshkey_test.rb
|