Skip to main content

SigningKey

Struct SigningKey 

Source
pub struct SigningKey { /* private fields */ }
Expand description

Taproot Schnorr signing key.

Implementations§

Source§

impl SigningKey

Source

pub fn from_bytes(bytes: &FieldBytes) -> Result<Self>

Parse signing key from big endian-encoded bytes.

§Errors

Returns Error in the event the provided bytes overflow the curve order n.

Source

pub fn from_slice(bytes: &[u8]) -> Result<Self>

Parse signing key from big endian-encoded byte slice.

§Errors

Returns Error if bytes is not 32-bytes long, or if it overflows the curve order n.

Source

pub fn to_bytes(&self) -> FieldBytes

Serialize as bytes.

Source

pub fn verifying_key(&self) -> &VerifyingKey

Get the VerifyingKey that corresponds to this signing key.

Source

pub fn as_nonzero_scalar(&self) -> &NonZeroScalar

Borrow the secret NonZeroScalar value for this key.

Security Warning

This value is key material. Please treat it with the care it deserves!

Source

pub fn random<R: CryptoRng + ?Sized>(rng: &mut R) -> Self

👎Deprecated since 0.14.0:

use the Generate trait instead

Deprecated: Generate a cryptographically random SigningKey.

Trait Implementations§

Source§

impl AsRef<VerifyingKey> for SigningKey

Source§

fn as_ref(&self) -> &VerifyingKey

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for SigningKey

Source§

fn clone(&self) -> SigningKey

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SigningKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<D> DigestSigner<D, Signature> for SigningKey
where D: Digest<OutputSize = U32> + Update,

Source§

fn try_sign_digest<F: Fn(&mut D) -> Result<()>>( &self, f: F, ) -> Result<Signature>

Attempt to sign a message by updating the received Digest with it, returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign_digest<F>(&self, f: F) -> S
where F: Fn(&mut D),

Sign a message by updating the received Digest with it, returning a signature. Read more
Source§

impl Drop for SigningKey

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl From<&SecretKey<Secp256k1>> for SigningKey

Source§

fn from(secret_key: &SecretKey) -> SigningKey

Converts to this type from the input type.
Source§

impl From<NonZeroScalar<Secp256k1>> for SigningKey

Source§

fn from(secret_key: NonZeroScalar) -> SigningKey

Converts to this type from the input type.
Source§

impl From<SecretKey<Secp256k1>> for SigningKey

Source§

fn from(secret_key: SecretKey) -> SigningKey

Converts to this type from the input type.
Source§

impl Generate for SigningKey

Source§

fn try_generate_from_rng<R: TryCryptoRng + ?Sized>( rng: &mut R, ) -> Result<Self, R::Error>

Generate random key using the provided TryCryptoRng. Read more
Source§

fn generate_from_rng<R>(rng: &mut R) -> Self
where R: CryptoRng + ?Sized,

Generate random key using the provided CryptoRng.
Source§

fn try_generate() -> Result<Self, Error>

Randomly generate a value of this type using the system’s ambient cryptographically secure random number generator. Read more
Source§

fn generate() -> Self

Randomly generate a value of this type using the system’s ambient cryptographically secure random number generator. Read more
Source§

impl KeypairRef for SigningKey

Source§

type VerifyingKey = VerifyingKey

Verifying key type for this keypair.
Source§

impl MultipartSigner<Signature> for SigningKey

Source§

fn try_multipart_sign(&self, msg: &[&[u8]]) -> Result<Signature>

Equivalent of Signer::try_sign() but the message is provided in non-contiguous byte slices. Read more
Source§

fn multipart_sign(&self, msg: &[&[u8]]) -> S

Equivalent of Signer::sign() but the message is provided in non-contiguous byte slices.
Source§

impl PrehashSigner<Signature> for SigningKey

Source§

fn sign_prehash(&self, prehash: &[u8]) -> Result<Signature>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong. Read more
Source§

impl<D> RandomizedDigestSigner<D, Signature> for SigningKey
where D: Digest<OutputSize = U32> + Update,

Source§

fn try_sign_digest_with_rng<R: TryCryptoRng + ?Sized, F: Fn(&mut D) -> Result<()>>( &self, rng: &mut R, f: F, ) -> Result<Signature>

Attempt to sign a message by updating the received Digest with it, returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign_digest_with_rng<R, F>(&self, rng: &mut R, f: F) -> S
where R: CryptoRng + ?Sized, F: Fn(&mut D),

Sign a message by updating the received Digest with it, returning a signature. Read more
Source§

impl RandomizedMultipartSigner<Signature> for SigningKey

Source§

fn try_multipart_sign_with_rng<R: TryCryptoRng + ?Sized>( &self, rng: &mut R, msg: &[&[u8]], ) -> Result<Signature>

Equivalent of RandomizedSigner::try_sign_with_rng() but the message is provided in non-contiguous byte slices. Read more
Source§

fn multipart_sign_with_rng<R>(&self, rng: &mut R, msg: &[&[u8]]) -> S
where R: CryptoRng + ?Sized,

Equivalent of RandomizedSigner::sign_with_rng() but the message is provided in non-contiguous byte slices.
Source§

impl RandomizedPrehashSigner<Signature> for SigningKey

Source§

fn sign_prehash_with_rng<R: TryCryptoRng + ?Sized>( &self, rng: &mut R, prehash: &[u8], ) -> Result<Signature>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong. Read more
Source§

impl RandomizedSigner<Signature> for SigningKey

Source§

fn try_sign_with_rng<R: TryCryptoRng + ?Sized>( &self, rng: &mut R, msg: &[u8], ) -> Result<Signature>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign_with_rng<R>(&self, rng: &mut R, msg: &[u8]) -> S
where R: CryptoRng + ?Sized,

Sign the given message and return a digital signature
Source§

impl Signer<Signature> for SigningKey

Source§

fn try_sign(&self, msg: &[u8]) -> Result<Signature>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature.
Source§

impl TryFrom<&[u8]> for SigningKey

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(bytes: &[u8]) -> Result<SigningKey>

Performs the conversion.
Source§

impl ZeroizeOnDrop for SigningKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<S, T> AsyncRandomizedSigner<S> for T
where T: RandomizedSigner<S>,

Source§

async fn try_sign_with_rng_async<R>( &self, rng: &mut R, msg: &[u8], ) -> Result<S, Error>
where R: TryCryptoRng + ?Sized,

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
Source§

async fn sign_with_rng_async<R>(&self, rng: &mut R, msg: &[u8]) -> S
where R: CryptoRng + ?Sized,

Sign the given message and return a digital signature. Read more
Source§

impl<S, T> AsyncSigner<S> for T
where T: Signer<S>,

Source§

async fn sign_async(&self, msg: &[u8]) -> Result<S, Error>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<K> Keypair for K
where K: KeypairRef,

Source§

type VerifyingKey = <K as KeypairRef>::VerifyingKey

Verifying key type for this keypair.
Source§

fn verifying_key(&self) -> <K as Keypair>::VerifyingKey

Get the verifying key which can verify signatures produced by the signing key portion of this keypair.
Source§

impl<S, T> RandomizedSignerMut<S> for T
where T: RandomizedSigner<S>,

Source§

fn try_sign_with_rng<R>(&mut self, rng: &mut R, msg: &[u8]) -> Result<S, Error>
where R: TryCryptoRng + ?Sized,

Attempt to sign the given message, updating the state, and returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign_with_rng<R>(&mut self, rng: &mut R, msg: &[u8]) -> S
where R: CryptoRng + ?Sized,

Sign the given message, update the state, and return a digital signature. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.