Class: SSHData::PrivateKey::Base
- Inherits:
-
Object
- Object
- SSHData::PrivateKey::Base
- Defined in:
- lib/ssh_data/private_key/base.rb
Instance Attribute Summary collapse
-
#algo ⇒ Object
readonly
Returns the value of attribute algo.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
Class Method Summary collapse
-
.generate(**kwargs) ⇒ Object
Generate a new private key.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Base
constructor
A new instance of Base.
-
#issue_certificate(signature_algo: nil, **kwargs) ⇒ Object
Issue a certificate using this private key.
-
#sign(signed_data, algo: nil) ⇒ Object
Make an SSH signature.
Constructor Details
#initialize(**kwargs) ⇒ Base
Returns a new instance of Base.
6 7 8 9 |
# File 'lib/ssh_data/private_key/base.rb', line 6 def initialize(**kwargs) @algo = kwargs[:algo] @comment = kwargs[:comment] end |
Instance Attribute Details
#algo ⇒ Object (readonly)
Returns the value of attribute algo.
4 5 6 |
# File 'lib/ssh_data/private_key/base.rb', line 4 def algo @algo end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
4 5 6 |
# File 'lib/ssh_data/private_key/base.rb', line 4 def comment @comment end |
#public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
4 5 6 |
# File 'lib/ssh_data/private_key/base.rb', line 4 def public_key @public_key end |
Class Method Details
.generate(**kwargs) ⇒ Object
Generate a new private key.
Returns a PublicKey::Base subclass instance.
14 15 16 |
# File 'lib/ssh_data/private_key/base.rb', line 14 def self.generate(**kwargs) raise "implement me" end |
Instance Method Details
#issue_certificate(signature_algo: nil, **kwargs) ⇒ Object
Issue a certificate using this private key.
signature_algo: - Optionally specify the signature algorithm to use. kwargs - See SSHData::Certificate.new.
Returns a SSHData::Certificate instance.
34 35 36 |
# File 'lib/ssh_data/private_key/base.rb', line 34 def issue_certificate(signature_algo: nil, **kwargs) Certificate.new(**kwargs).tap { |c| c.sign(self, algo: signature_algo) } end |
#sign(signed_data, algo: nil) ⇒ Object
Make an SSH signature.
signed_data - The String message over which to calculated the signature. algo: - Optionally specify the signature algorithm to use.
Returns a binary String signature.
24 25 26 |
# File 'lib/ssh_data/private_key/base.rb', line 24 def sign(signed_data, algo: nil) raise "implement me" end |