Struct k256::schnorr::SigningKey
source · [−]pub struct SigningKey { /* private fields */ }
Available on crate feature
schnorr
only.Expand description
Taproot Schnorr signing key.
Implementations
sourceimpl SigningKey
impl SigningKey
sourcepub fn random(rng: impl CryptoRng + RngCore) -> Self
pub fn random(rng: impl CryptoRng + RngCore) -> 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 try_sign_prehashed(
&self,
msg_digest: &[u8; 32],
aux_rand: &[u8; 32]
) -> Result<Signature>
pub fn try_sign_prehashed(
&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
sourceimpl Clone for SigningKey
impl Clone for SigningKey
sourcefn clone(&self) -> SigningKey
fn clone(&self) -> SigningKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<D> DigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> DigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
sourcefn 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. Read morefn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Sign the given prehashed message [
Digest
], returning a signature. Read moresourceimpl Drop for SigningKey
impl Drop for SigningKey
sourceimpl<D> RandomizedDigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> RandomizedDigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
sourcefn try_sign_digest_with_rng(
&self,
rng: impl CryptoRng + RngCore,
digest: D
) -> Result<Signature>
fn try_sign_digest_with_rng(
&self,
rng: impl CryptoRng + RngCore,
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. Read morefn sign_digest_with_rng(&self, rng: impl CryptoRng + RngCore, digest: D) -> S
fn sign_digest_with_rng(&self, rng: impl CryptoRng + RngCore, digest: D) -> S
Sign the given prehashed message
Digest
, returning a signature. Read moresourceimpl RandomizedSigner<Signature> for SigningKey
impl RandomizedSigner<Signature> for SigningKey
sourcefn try_sign_with_rng(
&self,
rng: impl CryptoRng + RngCore,
msg: &[u8]
) -> Result<Signature>
fn try_sign_with_rng(
&self,
rng: impl CryptoRng + RngCore,
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
fn sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> S
Sign the given message and return a digital signature
sourceimpl 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more