sshkeyauth 0.0.3 → 0.0.4

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.
@@ -0,0 +1,21 @@
1
+ require "net/ssh"
2
+
3
+ module SSH; module Key; module Helper
4
+ # Add a private key to this signer.
5
+ def add_key_file(path, passphrase=nil)
6
+ @logger.info "Adding key from file #{path} (with#{passphrase ? "" : "out"} passphrase)"
7
+ @keys << Net::SSH::KeyFactory.load_private_key(path, passphrase)
8
+ end # def add_key_file
9
+
10
+ # Add a public key from your known_hosts file
11
+ def add_key_from_host(hostname)
12
+ hostkey = %x{ssh-keygen -F #{identity}}.split("\n")[1].chomp.split(" ",2)[-1]
13
+ @keys << Net::SSH::KeyFactory.load_data_public_key(hostkey)
14
+ end
15
+
16
+ # Add a public key from a ublic key string
17
+ def add_public_key_data(data)
18
+ @logger.info "Adding key from data #{data}"
19
+ @keys << Net::SSH::KeyFactory.load_data_public_key(data)
20
+ end # def add_key_file
21
+ end; end; end # module SSH::Key::Helper
@@ -3,9 +3,12 @@
3
3
  require "rubygems"
4
4
  require "net/ssh"
5
5
  require "ssh/key/signature"
6
+ require "ssh/key/helper"
6
7
  require "etc"
7
8
 
8
9
  module SSH; module Key; class Signer
10
+ include SSH::Key::Helper
11
+
9
12
  attr_accessor :account
10
13
  attr_accessor :sshd_config_file
11
14
  attr_accessor :logger
@@ -27,12 +30,6 @@ module SSH; module Key; class Signer
27
30
  end
28
31
  end # def ensure_connected
29
32
 
30
- # Add a private key to this signer.
31
- def add_key_file(path, passphrase=nil)
32
- @logger.info "Adding key from file #{path} (with#{passphrase ? "" : "out"} passphrase)"
33
- @keys << Net::SSH::KeyFactory.load_private_key(path, passphrase)
34
- end # def add_key_file
35
-
36
33
  # Signs a string with all available ssh keys
37
34
  #
38
35
  # * string - the value to sign
@@ -3,13 +3,12 @@
3
3
  require "rubygems"
4
4
  require "net/ssh"
5
5
  require "ssh/key/signature"
6
+ require "ssh/key/helper"
6
7
  require "etc"
7
8
 
8
- if $DEBUG
9
- require "awesome_print"
10
- end
11
-
12
9
  module SSH; module Key; class Verifier
10
+ include SSH::Key::Helper
11
+
13
12
  attr_accessor :account
14
13
  attr_accessor :sshd_config_file
15
14
  attr_accessor :authorized_keys_file
@@ -126,11 +125,6 @@ module SSH; module Key; class Verifier
126
125
  return identities
127
126
  end # def verifying_identities
128
127
 
129
- def add_public_key_data(data)
130
- @logger.info "Adding key from data #{data}"
131
- @keys << Net::SSH::KeyFactory.load_data_public_key(data)
132
- end # def add_key_file
133
-
134
128
  def find_authorized_keys_file
135
129
  # Look up the @account's home directory.
136
130
  begin
@@ -226,7 +220,6 @@ module SSH; module Key; class Verifier
226
220
 
227
221
  keys << identity
228
222
  end
229
- #@logger.info keys.awesome_inspect
230
223
  return keys
231
224
  end
232
225
  end; end; end # class SSH::Key::Verifier
data/samples/speed.rb ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ require "base64"
5
+ require "json"
6
+ $:.unshift "../lib"
7
+ $:.unshift "lib"
8
+ require "ssh/key/signer"
9
+
10
+ data = (argv[0] or "Hello world")
11
+ signer = SSH::Key::Signer.new
12
+
13
+ start = Time.now
14
+ 0.upto(1000) do
15
+ sigs = signer.sign(data)
16
+ end
17
+ duration = Time.now - start
18
+ puts "Duration: #{duration}"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jordan Sissel
@@ -41,9 +41,9 @@ files:
41
41
  - lib/ssh/key/verifier.rb
42
42
  - lib/ssh/key/signature.rb
43
43
  - lib/ssh/key/signer.rb
44
- - samples/id_rsa_tester
44
+ - lib/ssh/key/helper.rb
45
+ - samples/speed.rb
45
46
  - samples/server.rb
46
- - samples/id_rsa_tester.pub
47
47
  - samples/test.rb
48
48
  - samples/client.rb
49
49
  has_rdoc: true
@@ -1,27 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- MIIEoQIBAAKCAQEApZyBMG3etDCOelDYJLa2Q0eVKgk9hZfSXty+Uoa3yP8qtNUp
3
- JjVdna8+ZK1QMzfVpkJdCl7bnhFX1TmwvjaQsQZll+x8CFLoTQ+qkCIl9KNmup9Y
4
- q5zaPejihOAjFGMpVDfLseKeuWSKPgoTSFQmeGCG0QcC2phAsflNIeLKg+TjZOfd
5
- +JFtJW20SgzC6U3ec3M6rV8zGMblnVBa/yP/3HbKwihB1UFQen1zUZAeWr/XpBYy
6
- NElRiUUaZEU0e1vo471TUQreGwdbuj7x1SutA/kQWIyN9WM1j0dg7HT0U9lgn2Jj
7
- /Z9KUKNbhUS70H27TyoDCKViq1MxNtS/DBfCiQIBIwKCAQAJdqhL6QVpYdxBgPZo
8
- f3ghGgiGDygWQzCXtNes8cFb8VLlwwmqaXMQUygjApbeWvZEA8rNZIGUAP20abJU
9
- Ax42AF2Tpx0Hyjko+ZS3x2/iF/c93ThEUhsZewWhMWEXG5v2LxL0ONXetUm6ZvnJ
10
- nmiZKhZVFlfvO+Zwkecmgfzxl/VyoOp9ZmnyuNFAhYmyxjxBRhY3P1bG0XsEOs4y
11
- uzjjlHbwtN2hTVscUNTgQB5IL6smpGKHPEZCwiwRtuAe4OoNsQpxN6jzxxbP1RDf
12
- yYyYaOzrBtzELgynZW5wG/4QoyMyzU26KSqQ4kUthGD1esBz85/gwq4vKOmFL1fM
13
- 8ohDAoGBANU0bhw3lfbKIcqUIoSsxfls4cAVEMachloYN18M3NSnLYGRfVSS8qP7
14
- mylm+juX/Rx6iCiUKemXdRMpVfbDeBmw96mTAIeoIq6WHxHx/qDnHCCTKctALKYU
15
- TJxPn8CrgQ5DzLoxB177BtD6ciqbyLLmoGzNI1nonEyT0pr+RA+nAoGBAMbaebou
16
- ezhDqZvMyVSD+saQRvXRef3k7qK7E+N6esemoye8Tca7hPI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