Struct p521::ecdsa::SigningKey
source · pub struct SigningKey(/* private fields */);
Available on crate features
ecdsa-core
and ecdsa
only.Expand description
ECDSA/P-521 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: &FieldBytes) -> Result<Self>
pub fn from_bytes(bytes: &FieldBytes) -> Result<Self>
Initialize signing key from a raw scalar serialized as a byte array.
sourcepub fn from_slice(bytes: &[u8]) -> Result<Self>
pub fn from_slice(bytes: &[u8]) -> Result<Self>
Initialize signing key from a raw scalar serialized as a byte slice.
sourcepub fn to_bytes(&self) -> FieldBytes
pub fn to_bytes(&self) -> FieldBytes
Serialize this SigningKey
as bytes
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!
Trait Implementations§
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 From<&SigningKey> for VerifyingKey
impl From<&SigningKey> for VerifyingKey
source§fn from(signing_key: &SigningKey) -> VerifyingKey
fn from(signing_key: &SigningKey) -> VerifyingKey
Converts to this type from the input type.
source§impl From<SigningKey<NistP521>> for SigningKey
impl From<SigningKey<NistP521>> for SigningKey
source§fn from(inner: SigningKey<NistP521>) -> SigningKey
fn from(inner: SigningKey<NistP521>) -> SigningKey
Converts to this type from the input type.
source§impl PrehashSigner<Signature<NistP521>> for SigningKey
Available on crate feature getrandom
only.
impl PrehashSigner<Signature<NistP521>> for SigningKey
Available on crate feature
getrandom
only.source§impl RandomizedPrehashSigner<Signature<NistP521>> for SigningKey
impl RandomizedPrehashSigner<Signature<NistP521>> 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<NistP521>> for SigningKey
impl RandomizedSigner<Signature<NistP521>> 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
§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<NistP521>> for SigningKey
Available on crate feature getrandom
only.
impl Signer<Signature<NistP521>> for SigningKey
Available on crate feature
getrandom
only.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