Struct k256::schnorr::SigningKey
source · pub struct SigningKey { /* private fields */ }
Available on crate feature
schnorr
only.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.
Trait Implementations§
source§impl AsRef<VerifyingKey> for SigningKey
impl AsRef<VerifyingKey> for SigningKey
source§fn as_ref(&self) -> &VerifyingKey
fn as_ref(&self) -> &VerifyingKey
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for SigningKey
impl Clone for SigningKey
source§fn clone(&self) -> SigningKey
fn clone(&self) -> SigningKey
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<D> DigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> DigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
source§fn try_sign_digest(&self, digest: D) -> Result<Signature>
fn try_sign_digest(&self, digest: D) -> Result<Signature>
Attempt to sign the given prehashed message [
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
Sign the given prehashed message [
Digest
], returning a signature. Read moresource§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
Converts to this type from the input type.
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
Converts to this type from the input type.
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
Converts to this type from the input type.
source§impl KeypairRef for SigningKey
impl KeypairRef for SigningKey
§type VerifyingKey = VerifyingKey
type VerifyingKey = VerifyingKey
Verifying key type for this keypair.
source§impl PrehashSigner<Signature> for SigningKey
impl PrehashSigner<Signature> for SigningKey
source§impl<D> RandomizedDigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> RandomizedDigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
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>
Attempt to sign the given prehashed message
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
Sign the given prehashed message
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>
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
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>
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(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
Sign the given message and return a digital signature
source§impl Signer<Signature> for SigningKey
impl Signer<Signature> for SigningKey
impl ZeroizeOnDrop for SigningKey
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<K> Keypair for Kwhere
K: KeypairRef,
impl<K> Keypair for Kwhere
K: KeypairRef,
§type VerifyingKey = <K as KeypairRef>::VerifyingKey
type VerifyingKey = <K as KeypairRef>::VerifyingKey
Verifying key type for this keypair.
source§fn verifying_key(&self) -> <K as Keypair>::VerifyingKey
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.