sshkey 1.3.1 → 1.3.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.
data/.travis.yml CHANGED
@@ -2,9 +2,11 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
+ - 2.0.0
5
6
  - ree
6
7
  - ruby-head
7
8
  - jruby-18mode
8
9
  - jruby-19mode
10
+ - jruby-head
9
11
  - rbx-18mode
10
12
  - rbx-19mode
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "jruby-openssl", "~> 0.7.7", :platform => :jruby
3
+ gem "jruby-openssl", "~> 0.8.2", :platform => :jruby
4
4
 
5
5
  gemspec
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 James Miller
1
+ Copyright (c) 2011-2013 James Miller
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -5,7 +5,7 @@ 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, 1.9.2, 1.9.3, REE, JRuby, Rubinius. Ruby must be compiled with OpenSSL support.
8
+ Tested on the following Rubies: MRI 1.8.7, 1.9.2, 1.9.3, 2.0.0, REE, JRuby (1.7.2 or later), Rubinius. Ruby must be compiled with OpenSSL support.
9
9
 
10
10
  [![Build Status](https://secure.travis-ci.org/bensie/sshkey.png)](http://travis-ci.org/bensie/sshkey)
11
11
 
@@ -72,4 +72,4 @@ SSHKey.valid_ssh_public_key? "ssh-rsa AAAAB3NzaC1yc2EA...."
72
72
  Copyright
73
73
  ---------
74
74
 
75
- Copyright (c) 2012 James Miller
75
+ Copyright (c) 2011-2013 James Miller
data/lib/sshkey.rb CHANGED
@@ -48,7 +48,8 @@ class SSHKey
48
48
  # * ssh_public_key<~String> - "ssh-rsa AAAAB3NzaC1yc2EA...."
49
49
  #
50
50
  def valid_ssh_public_key?(ssh_public_key)
51
- ssh_type, encoded_key = ssh_public_key.split(" ")
51
+ ssh_type, encoded_key = parse_ssh_public_key(ssh_public_key)
52
+
52
53
  type = SSH_TYPES.invert[ssh_type]
53
54
  prefix = [0,0,0,7].pack("C*")
54
55
  decoded = Base64.decode64(encoded_key)
@@ -114,6 +115,13 @@ class SSHKey
114
115
  def fingerprint_regex
115
116
  /(.{2})(?=.)/
116
117
  end
118
+
119
+ def parse_ssh_public_key(public_key)
120
+ parsed = public_key.split(" ")
121
+ parsed.each_with_index do |el, index|
122
+ break parsed[index..(index+1)] if !SSH_TYPES.invert[el].nil?
123
+ end
124
+ end
117
125
  end
118
126
 
119
127
  # Create a new SSHKey object
@@ -1,3 +1,3 @@
1
1
  class SSHKey
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
data/test/sshkey_test.rb CHANGED
@@ -165,6 +165,7 @@ EOF
165
165
  expected2 = "ssh-rsa #{SSH_PUBLIC_KEY2} me@example.com"
166
166
  expected3 = "ssh-dss #{SSH_PUBLIC_KEY3} me@example.com"
167
167
  expected4 = "ssh-rsa #{SSH_PUBLIC_KEY1}"
168
+ expected5 = %Q{from="trusted.eng.cam.ac.uk",no-port-forwarding,no-pty" ssh-rsa #{SSH_PUBLIC_KEY1}}
168
169
  invalid1 = "ssh-rsa #{SSH_PUBLIC_KEY1}= me@example.com"
169
170
  invalid2 = "ssh-rsa #{SSH_PUBLIC_KEY2}= me@example.com"
170
171
  invalid3 = "ssh-dss #{SSH_PUBLIC_KEY3}= me@example.com"
@@ -175,6 +176,7 @@ EOF
175
176
  assert SSHKey.valid_ssh_public_key?(expected2)
176
177
  assert SSHKey.valid_ssh_public_key?(expected3)
177
178
  assert SSHKey.valid_ssh_public_key?(expected4)
179
+ assert SSHKey.valid_ssh_public_key?(expected5)
178
180
 
179
181
  assert !SSHKey.valid_ssh_public_key?(invalid1)
180
182
  assert !SSHKey.valid_ssh_public_key?(invalid2)
metadata CHANGED
@@ -1,32 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
5
- prerelease:
4
+ prerelease:
5
+ version: 1.3.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Miller
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-05 00:00:00.000000000 Z
12
+ date: 2013-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
16
+ version_requirements: !ruby/object:Gem::Requirement
18
17
  requirements:
19
- - - ! '>='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
20
+ version: !binary |-
21
+ MA==
25
22
  none: false
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
- - - ! '>='
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
- version: '0'
27
+ version: !binary |-
28
+ MA==
29
+ none: false
30
+ prerelease: false
31
+ type: :development
30
32
  description: Generate private/public SSH keypairs using pure Ruby
31
33
  email:
32
34
  - bensie@gmail.com
@@ -34,8 +36,8 @@ executables: []
34
36
  extensions: []
35
37
  extra_rdoc_files: []
36
38
  files:
37
- - .gitignore
38
- - .travis.yml
39
+ - ".gitignore"
40
+ - ".travis.yml"
39
41
  - Gemfile
40
42
  - LICENSE
41
43
  - README.md
@@ -46,26 +48,28 @@ files:
46
48
  - test/sshkey_test.rb
47
49
  homepage: https://github.com/bensie/sshkey
48
50
  licenses: []
49
- post_install_message:
51
+ post_install_message:
50
52
  rdoc_options: []
51
53
  require_paths:
52
54
  - lib
53
55
  required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
56
  requirements:
56
- - - ! '>='
57
+ - - ">="
57
58
  - !ruby/object:Gem::Version
58
- version: '0'
59
- required_rubygems_version: !ruby/object:Gem::Requirement
59
+ version: !binary |-
60
+ MA==
60
61
  none: false
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
63
  requirements:
62
- - - ! '>='
64
+ - - ">="
63
65
  - !ruby/object:Gem::Version
64
- version: '0'
66
+ version: !binary |-
67
+ MA==
68
+ none: false
65
69
  requirements: []
66
70
  rubyforge_project: sshkey
67
- rubygems_version: 1.8.23
68
- signing_key:
71
+ rubygems_version: 1.8.24
72
+ signing_key:
69
73
  specification_version: 3
70
74
  summary: SSH private/public key generator in Ruby
71
75
  test_files: