Class: OpenSSL::SignatureAlgorithm::EdDSA

Inherits:
Base
  • Object
show all
Defined in:
lib/openssl/signature_algorithm/eddsa.rb

Defined Under Namespace

Classes: SigningKey, VerifyKey

Instance Attribute Summary

Attributes inherited from Base

#signing_key, #verify_key

Instance Method Summary collapse

Methods inherited from Base

#compatible_verify_key?

Instance Method Details

#generate_signing_keyObject



33
34
35
# File 'lib/openssl/signature_algorithm/eddsa.rb', line 33

def generate_signing_key
  @signing_key = SigningKey.generate
end

#sign(data) ⇒ Object



37
38
39
# File 'lib/openssl/signature_algorithm/eddsa.rb', line 37

def sign(data)
  signing_key.sign(data)
end

#verify(signature, verification_data) ⇒ Object



41
42
43
44
45
# File 'lib/openssl/signature_algorithm/eddsa.rb', line 41

def verify(signature, verification_data)
  verify_key.verify(signature, verification_data)
rescue ::Ed25519::VerifyError
  raise(OpenSSL::SignatureAlgorithm::SignatureVerificationError, "Signature verification failed")
end