class Sodium::Sign::SecretKey
- Sodium::Sign::SecretKey
- Sodium::Key
- Reference
- Object
Overview
Ed25519 secret key used for signing.
https://libsodium.gitbook.io/doc/public-key_cryptography/public-key_signatures
Usage:
key = Sodium::Sign::SecretKey.new
sig = key.sign_detached data
key.public_key.verify_detached data, sig
Defined in:
sodium/sign/secret_key.crConstant Summary
-
KEY_SIZE =
LibSodium.crypto_sign_secretkeybytes.to_i
-
SEED_SIZE =
LibSodium.crypto_sign_seedbytes.to_i
-
SIG_SIZE =
LibSodium.crypto_sign_bytes.to_i
Constructors
-
.new(bytes : Bytes, pkey : Bytes? = nil, *, erase = false)
Use existing secret and public keys.
-
.new
Generates a new random secret/public key pair.
-
.new(*, seed : Bytes, erase = false)
Derive a new secret/public key pair based on a consistent seed.
-
.new(*, seed : SecureBuffer)
Derive a new secret/public key pair based on a consistent seed.
Instance Method Summary
- #public_key : PublicKey
- #seed : SecureBuffer?
- #sign_detached(message : Bytes)
-
#sign_detached(message)
Signs message and returns a detached signature.
- #to_curve25519 : CryptoBox::SecretKey
-
#to_slice : Bytes
Returns key
Instance methods inherited from class Sodium::Key
to_slice : Bytes
to_slice
Instance methods inherited from module Sodium::Wipe
close
close,
finalize
finalize
Constructor Detail
Use existing secret and public keys. Copies secret key to a SecureBuffer. Recomputes the public key from a secret key if missing.
Derive a new secret/public key pair based on a consistent seed. Copies seed to a SecureBuffer.
Derive a new secret/public key pair based on a consistent seed.
Instance Method Detail
Signs message and returns a detached signature.
Verify using secret_key.public_key.verify_detached(message, sig)