Module: Orthrus::SSH
- Defined in:
- lib/orthrus/ssh/agent.rb,
lib/orthrus/ssh.rb,
lib/orthrus/ssh/dsa.rb,
lib/orthrus/ssh/key.rb,
lib/orthrus/ssh/rsa.rb,
lib/orthrus/ssh/utils.rb,
lib/orthrus/ssh/buffer.rb,
lib/orthrus/ssh/rack_app.rb,
lib/orthrus/ssh/http_agent.rb,
lib/orthrus/ssh/key_manager.rb,
lib/orthrus/ssh/public_key_set.rb
Overview
Adapted from buffer.rb in net-ssh
Defined Under Namespace
Modules: DSA, RSA, Utils
Classes: Agent, AgentError, AgentNotAvailable, Buffer, DSAPrivateKey, DSAPublicKey, HTTPAgent, Key, KeyManager, PrivateKey, PublicKey, PublicKeySet, RSAPrivateKey, RSAPublicKey, RackApp
Constant Summary
collapse
- VERSION =
'0.6.0'
Class Method Summary
collapse
Class Method Details
.load_private(path) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/orthrus/ssh.rb', line 12
def self.load_private(path)
data = File.read(path)
if data.index("-----BEGIN RSA PRIVATE KEY-----") == 0
k = OpenSSL::PKey::RSA.new data
return RSAPrivateKey.new k
elsif data.index("-----BEGIN DSA PRIVATE KEY-----") == 0
k = OpenSSL::PKey::DSA.new data
return DSAPrivateKey.new k
else
raise "Unknown key type in '#{path}'"
end
end
|
.load_public(path) ⇒ Object
38
39
40
|
# File 'lib/orthrus/ssh.rb', line 38
def self.load_public(path)
parse_public File.read(path)
end
|
.parse_public(data) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/orthrus/ssh.rb', line 25
def self.parse_public(data)
type, key, = data.split " ", 3
case type
when "ssh-rsa"
RSAPublicKey.parse key
when "ssh-dss"
DSAPublicKey.parse key
else
raise "Unknown key type - #{type}"
end
end
|