Class: Net::SSH::Authentication::SecurityKey::PubKey
- Inherits:
-
Object
- Object
- Net::SSH::Authentication::SecurityKey::PubKey
- Includes:
- PubKeyFingerprint
- Defined in:
- lib/net/ssh/authentication/security_key.rb
Overview
Public key of an agent-held security key; signing is delegated to the agent.
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
-
#curve ⇒ Object
readonly
Returns the value of attribute curve.
-
#public_key_data ⇒ Object
readonly
Returns the value of attribute public_key_data.
-
#ssh_type ⇒ Object
readonly
Returns the value of attribute ssh_type.
Class Method Summary collapse
-
.read_keyblob(type, buffer) ⇒ Object
Wire formats: [email protected]: string curve, string Q, string application [email protected]: string public_key, string application.
Instance Method Summary collapse
-
#initialize(ssh_type, public_key_data, application, curve: nil) ⇒ PubKey
constructor
A new instance of PubKey.
- #ssh_signature_type ⇒ Object
- #to_blob ⇒ Object
-
#to_pem ⇒ Object
Only used to de-duplicate identities, so a stable key-specific string suffices.
Methods included from PubKeyFingerprint
Constructor Details
#initialize(ssh_type, public_key_data, application, curve: nil) ⇒ PubKey
Returns a new instance of PubKey.
43 44 45 46 47 48 |
# File 'lib/net/ssh/authentication/security_key.rb', line 43 def initialize(ssh_type, public_key_data, application, curve: nil) @ssh_type = ssh_type @public_key_data = public_key_data @application = application @curve = curve end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
22 23 24 |
# File 'lib/net/ssh/authentication/security_key.rb', line 22 def application @application end |
#curve ⇒ Object (readonly)
Returns the value of attribute curve.
22 23 24 |
# File 'lib/net/ssh/authentication/security_key.rb', line 22 def curve @curve end |
#public_key_data ⇒ Object (readonly)
Returns the value of attribute public_key_data.
22 23 24 |
# File 'lib/net/ssh/authentication/security_key.rb', line 22 def public_key_data @public_key_data end |
#ssh_type ⇒ Object (readonly)
Returns the value of attribute ssh_type.
22 23 24 |
# File 'lib/net/ssh/authentication/security_key.rb', line 22 def ssh_type @ssh_type end |
Class Method Details
.read_keyblob(type, buffer) ⇒ Object
Wire formats:
[email protected]: string curve, string Q, string application
[email protected]: string public_key, string application
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/net/ssh/authentication/security_key.rb', line 27 def self.read_keyblob(type, buffer) case type when SK_ECDSA_SHA2_NISTP256 curve = buffer.read_string public_key_data = buffer.read_string application = buffer.read_string new(type, public_key_data, application, curve: curve) when SK_SSH_ED25519 public_key_data = buffer.read_string application = buffer.read_string new(type, public_key_data, application) else raise Net::SSH::UnsupportedKeyType, "unsupported security key type `#{type}'" end end |
Instance Method Details
#ssh_signature_type ⇒ Object
59 60 61 |
# File 'lib/net/ssh/authentication/security_key.rb', line 59 def ssh_signature_type ssh_type end |
#to_blob ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/net/ssh/authentication/security_key.rb', line 50 def to_blob buffer = Net::SSH::Buffer.new buffer.write_string(ssh_type) buffer.write_string(curve) if curve buffer.write_string(public_key_data) buffer.write_string(application) buffer.to_s end |
#to_pem ⇒ Object
Only used to de-duplicate identities, so a stable key-specific string suffices.
64 65 66 |
# File 'lib/net/ssh/authentication/security_key.rb', line 64 def to_pem "#{ssh_type} #{[to_blob].pack('m0')}" end |