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 more