pub trait SigningKey<T>: Sizedwhere
T: Algorithm<SigningKey = Self>,{
// Required methods
fn from_slice(raw: &[u8]) -> Result<Self>;
fn to_verifying_key(&self) -> T::VerifyingKey;
fn as_bytes(&self) -> SecretBytes<'_>;
}
Expand description
Signing key for a specific signature cryptosystem. In the case of public-key cryptosystems, this is a private key.
This trait provides a uniform interface for different backends / implementations of the same cryptosystem.
Required Methods§
Sourcefn from_slice(raw: &[u8]) -> Result<Self>
fn from_slice(raw: &[u8]) -> Result<Self>
Creates a key from raw
bytes. Returns an error if the bytes do not represent
a valid key.
Sourcefn to_verifying_key(&self) -> T::VerifyingKey
fn to_verifying_key(&self) -> T::VerifyingKey
Converts a signing key to a verification key.
Sourcefn as_bytes(&self) -> SecretBytes<'_>
fn as_bytes(&self) -> SecretBytes<'_>
Returns the key as raw bytes.
Implementations should return Cow::Borrowed
whenever possible (that is, if the bytes
are actually stored within the implementing data structure).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl SigningKey<Ed25519> for SecretKey
impl SigningKey<Ed25519> for SecretKey
fn from_slice(raw: &[u8]) -> Result<Self>
fn to_verifying_key(&self) -> PublicKey
fn as_bytes(&self) -> SecretBytes<'_>
Source§impl SigningKey<Es256> for SigningKey
impl SigningKey<Es256> for SigningKey
fn from_slice(raw: &[u8]) -> Result<Self>
fn to_verifying_key(&self) -> VerifyingKey
fn as_bytes(&self) -> SecretBytes<'_>
Source§impl SigningKey<Es256k> for SecretKey
This implementation initializes a libsecp256k1
context once on the first call to
to_verifying_key
if it was not initialized previously.
impl SigningKey<Es256k> for SecretKey
This implementation initializes a libsecp256k1
context once on the first call to
to_verifying_key
if it was not initialized previously.