pub struct SigningKey { /* private fields */ }Expand description
Taproot Schnorr signing key.
Implementations§
Source§impl SigningKey
impl SigningKey
Sourcepub fn random(rng: &mut impl CryptoRngCore) -> Self
pub fn random(rng: &mut impl CryptoRngCore) -> Self
Generate a cryptographically random SigningKey.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Parse signing key from big endian-encoded bytes.
Sourcepub fn to_bytes(&self) -> FieldBytes
pub fn to_bytes(&self) -> FieldBytes
Serialize as bytes.
Sourcepub fn verifying_key(&self) -> &VerifyingKey
pub fn verifying_key(&self) -> &VerifyingKey
Get the VerifyingKey that corresponds to this signing key.
Sourcepub fn as_nonzero_scalar(&self) -> &NonZeroScalar
pub fn as_nonzero_scalar(&self) -> &NonZeroScalar
Borrow the secret NonZeroScalar value for this key.
§⚠️ Warning
This value is key material.
Please treat it with the care it deserves!
Sourcepub fn sign_prehash_with_aux_rand(
&self,
msg_digest: &[u8; 32],
aux_rand: &[u8; 32],
) -> Result<Signature>
pub fn sign_prehash_with_aux_rand( &self, msg_digest: &[u8; 32], aux_rand: &[u8; 32], ) -> Result<Signature>
Compute Schnorr signature.
§⚠️ Warning
This is a low-level interface intended only for unusual use cases involving signing pre-hashed messages.
The preferred interfaces are the Signer or RandomizedSigner traits.
Sourcepub fn sign_raw(&self, msg: &[u8], aux_rand: &[u8; 32]) -> Result<Signature>
pub fn sign_raw(&self, msg: &[u8], aux_rand: &[u8; 32]) -> Result<Signature>
Compute Schnorr signature.
§⚠️ Warning
This is a low-level interface intended only for unusual use cases involving signing pre-hashed messages, or “raw” messages where the message is not hashed at all prior to being used to generate the Schnorr signature.
The preferred interfaces are the Signer or RandomizedSigner traits.
Trait Implementations§
Source§impl AsRef<VerifyingKey> for SigningKey
impl AsRef<VerifyingKey> for SigningKey
Source§fn as_ref(&self) -> &VerifyingKey
fn as_ref(&self) -> &VerifyingKey
Source§impl Clone for SigningKey
impl Clone for SigningKey
Source§fn clone(&self) -> SigningKey
fn clone(&self) -> SigningKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<D> DigestSigner<D, Signature> for SigningKey
impl<D> DigestSigner<D, Signature> for SigningKey
Source§fn try_sign_digest(&self, digest: D) -> Result<Signature>
fn try_sign_digest(&self, digest: D) -> Result<Signature>
Digest, returning a
digital signature on success, or an error if something went wrong.Source§fn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Source§impl Drop for SigningKey
impl Drop for SigningKey
Source§impl From<&SecretKey<Secp256k1>> for SigningKey
impl From<&SecretKey<Secp256k1>> for SigningKey
Source§fn from(secret_key: &SecretKey) -> SigningKey
fn from(secret_key: &SecretKey) -> SigningKey
Source§impl From<NonZeroScalar<Secp256k1>> for SigningKey
impl From<NonZeroScalar<Secp256k1>> for SigningKey
Source§fn from(secret_key: NonZeroScalar) -> SigningKey
fn from(secret_key: NonZeroScalar) -> SigningKey
Source§impl From<SecretKey<Secp256k1>> for SigningKey
impl From<SecretKey<Secp256k1>> for SigningKey
Source§fn from(secret_key: SecretKey) -> SigningKey
fn from(secret_key: SecretKey) -> SigningKey
Source§impl KeypairRef for SigningKey
impl KeypairRef for SigningKey
Source§type VerifyingKey = VerifyingKey
type VerifyingKey = VerifyingKey
Source§impl PrehashSigner<Signature> for SigningKey
impl PrehashSigner<Signature> for SigningKey
Source§impl<D> RandomizedDigestSigner<D, Signature> for SigningKey
impl<D> RandomizedDigestSigner<D, Signature> for SigningKey
Source§fn try_sign_digest_with_rng(
&self,
rng: &mut impl CryptoRngCore,
digest: D,
) -> Result<Signature>
fn try_sign_digest_with_rng( &self, rng: &mut impl CryptoRngCore, digest: D, ) -> Result<Signature>
Digest, returning a
digital signature on success, or an error if something went wrong.Source§fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S
fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S
Digest, returning a signature. Read moreSource§impl RandomizedPrehashSigner<Signature> for SigningKey
impl RandomizedPrehashSigner<Signature> for SigningKey
Source§fn sign_prehash_with_rng(
&self,
rng: &mut impl CryptoRngCore,
prehash: &[u8],
) -> Result<Signature>
fn sign_prehash_with_rng( &self, rng: &mut impl CryptoRngCore, prehash: &[u8], ) -> Result<Signature>
Source§impl RandomizedSigner<Signature> for SigningKey
impl RandomizedSigner<Signature> for SigningKey
Source§fn try_sign_with_rng(
&self,
rng: &mut impl CryptoRngCore,
msg: &[u8],
) -> Result<Signature>
fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8], ) -> Result<Signature>
Source§fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
Source§impl Signer<Signature> for SigningKey
impl Signer<Signature> for SigningKey
impl ZeroizeOnDrop for SigningKey
Auto Trait Implementations§
impl Freeze for SigningKey
impl RefUnwindSafe for SigningKey
impl Send for SigningKey
impl Sync for SigningKey
impl Unpin for SigningKey
impl UnwindSafe for SigningKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<K> Keypair for Kwhere
K: KeypairRef,
impl<K> Keypair for Kwhere
K: KeypairRef,
Source§type VerifyingKey = <K as KeypairRef>::VerifyingKey
type VerifyingKey = <K as KeypairRef>::VerifyingKey
Source§fn verifying_key(&self) -> <K as Keypair>::VerifyingKey
fn verifying_key(&self) -> <K as Keypair>::VerifyingKey
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<S, T> SignerMut<S> for Twhere
T: Signer<S>,
impl<S, T> SignerMut<S> for Twhere
T: Signer<S>,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.