pub struct SigningKey(pub(crate) SigningKey);Expand description
A secp256k1 private key held on behalf of an agent.
The inner k256 key zeroizes on drop. That is a floor, not a guarantee:
anything that goes through SigningKey::to_bytes is an ordinary array
and is the caller’s problem.
Tuple Fields§
§0: SigningKeyImplementations§
Source§impl SigningKey
impl SigningKey
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> Result<Self, KeyError>
pub fn from_bytes(bytes: &[u8; 32]) -> Result<Self, KeyError>
Loads a key from its 32-byte big-endian scalar, as written by
SigningKey::to_bytes.
Fails for zero and for anything at or above the curve order, so a corrupted or truncated store surfaces here rather than as an unusable key later.
Sourcepub fn to_bytes(&self) -> [u8; 32]
pub fn to_bytes(&self) -> [u8; 32]
The 32-byte big-endian scalar, for writing to custodial storage.
This is the whole secret. Nothing else in this crate exposes it.
Sourcepub fn sign(&self, message: &[u8]) -> Signature
pub fn sign(&self, message: &[u8]) -> Signature
Signs a message with ECDSA over SHA-256.
The nonce is deterministic (RFC 6979), so the same key and message give the same signature, and a bad RNG at signing time cannot leak the key.
Sourcepub fn verifying_key(&self) -> VerifyingKey
pub fn verifying_key(&self) -> VerifyingKey
The public half.
Trait Implementations§
Source§impl Clone for SigningKey
impl Clone for SigningKey
Source§fn clone(&self) -> SigningKey
fn clone(&self) -> SigningKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more