Class: SSHData::PublicKey::SKECDSA
- Defined in:
- lib/ssh_data/public_key/skecdsa.rb
Constant Summary collapse
- OPENSSL_CURVE_NAME_FOR_CURVE =
{ NISTP256 => "prime256v1", }
Constants inherited from ECDSA
ECDSA::CURVE_FOR_OPENSSL_CURVE_NAME, ECDSA::DIGEST_FOR_CURVE, ECDSA::NISTP256, ECDSA::NISTP384, ECDSA::NISTP521
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
Attributes inherited from ECDSA
#curve, #openssl, #public_key_bytes
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(algo:, curve:, public_key:, application:) ⇒ SKECDSA
constructor
A new instance of SKECDSA.
-
#rfc4253 ⇒ Object
RFC4253 binary encoding of the public key.
- #verify(signed_data, signature) ⇒ Object
Methods inherited from ECDSA
#digest, openssl_signature, ssh_signature
Methods inherited from Base
Constructor Details
#initialize(algo:, curve:, public_key:, application:) ⇒ SKECDSA
Returns a new instance of SKECDSA.
20 21 22 23 |
# File 'lib/ssh_data/public_key/skecdsa.rb', line 20 def initialize(algo:, curve:, public_key:, application:) @application = application super(algo: algo, curve: curve, public_key: public_key) end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
4 5 6 |
# File 'lib/ssh_data/public_key/skecdsa.rb', line 4 def application @application end |
Class Method Details
.check_algorithm!(algo, curve) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/ssh_data/public_key/skecdsa.rb', line 10 def self.check_algorithm!(algo, curve) unless algo == ALGO_SKECDSA256 raise DecodeError, "bad algorithm: #{algo.inspect}" end unless algo == "sk-ecdsa-sha2-#{curve}@openssh.com" raise DecodeError, "bad curve: #{curve.inspect}" end end |
Instance Method Details
#==(other) ⇒ Object
41 42 43 |
# File 'lib/ssh_data/public_key/skecdsa.rb', line 41 def ==(other) super && other.application == application end |
#rfc4253 ⇒ Object
RFC4253 binary encoding of the public key.
Returns a binary String.
28 29 30 31 32 33 34 35 |
# File 'lib/ssh_data/public_key/skecdsa.rb', line 28 def rfc4253 Encoding.encode_fields( [:string, algo], [:string, curve], [:string, public_key_bytes], [:string, application], ) end |
#verify(signed_data, signature) ⇒ Object
37 38 39 |
# File 'lib/ssh_data/public_key/skecdsa.rb', line 37 def verify(signed_data, signature) raise UnsupportedError, "SK-ECDSA verification is not supported." end |