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

source

pub fn random(rng: &mut impl CryptoRngCore) -> Self

Generate a cryptographically random SigningKey.

source

pub fn from_bytes(bytes: &FieldBytes) -> Result<Self>

Initialize signing key from a raw scalar serialized as a byte array.

source

pub fn from_slice(bytes: &[u8]) -> Result<Self>

Initialize signing key from a raw scalar serialized as a byte slice.

source

pub fn to_bytes(&self) -> FieldBytes

Serialize this SigningKey as bytes

source

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

source§

fn clone(&self) -> SigningKey

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl From<&SigningKey> for VerifyingKey

source§

fn from(signing_key: &SigningKey) -> VerifyingKey

Converts to this type from the input type.
source§

impl From<SigningKey<NistP521>> for SigningKey

source§

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.
source§

fn sign_prehash(&self, 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 RandomizedPrehashSigner<Signature<NistP521>> for SigningKey

source§

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

source§

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

Sign the given message and return a digital signature
source§

impl Signer<Signature<NistP521>> for SigningKey

Available on crate feature getrandom only.
source§

fn try_sign(&self, 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(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<S, T> SignerMut<S> for T
where T: Signer<S>,

§

fn try_sign(&mut self, msg: &[u8]) -> Result<S, Error>

Attempt to sign the given message, updating the state, and returning a digital signature on success, or an error if something went wrong. Read more
§

fn sign(&mut self, msg: &[u8]) -> S

Sign the given message, update the state, and return a digital signature.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.