Struct k256::ecdsa::SigningKey

source ·
pub struct SigningKey { /* private fields */ }
Expand description

ECDSA/secp256k1 signing key

Implementations§

source§

impl SigningKey

source

pub fn random(rng: impl CryptoRng + RngCore) -> Self

Generate a cryptographically random SigningKey.

source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Initialize SigningKey from a raw scalar value (big endian).

source

pub fn verifying_key(&self) -> VerifyingKey

Get the VerifyingKey which corresponds to this SigningKey.

source

pub fn to_bytes(&self) -> FieldBytes

Serialize this SigningKey as bytes

Trait Implementations§

source§

impl AsRef<VerifyingKey> for SigningKey

source§

fn as_ref(&self) -> &VerifyingKey

Converts this type into a shared reference of the (usually inferred) input type.
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 ConstantTimeEq for SigningKey

source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
source§

impl Debug for SigningKey

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<D> DigestSigner<D, Signature<Secp256k1>> for SigningKeywhere D: Digest + FixedOutput<OutputSize = U32>,

source§

fn try_sign_digest(&self, msg_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

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<D> DigestSigner<D, Signature> for SigningKeywhere D: Digest + FixedOutput<OutputSize = U32>,

source§

fn try_sign_digest(&self, msg_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

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl Drop for SigningKey

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<&NonZeroScalar<Secp256k1>> for SigningKey

source§

fn from(secret_scalar: &NonZeroScalar) -> Self

Converts to this type from the input type.
source§

impl From<&SecretKey<Secp256k1>> for SigningKey

source§

fn from(secret_key: &SecretKey) -> SigningKey

Converts to this type from the input type.
source§

impl From<&SigningKey> for SecretKey

source§

fn from(signing_key: &SigningKey) -> SecretKey

Converts to this type from the input type.
source§

impl From<&SigningKey> for VerifyingKey

source§

fn from(signing_key: &SigningKey) -> VerifyingKey

Converts to this type from the input type.
source§

impl From<NonZeroScalar<Secp256k1>> for SigningKey

source§

fn from(secret_scalar: NonZeroScalar) -> Self

Converts to this type from the input type.
source§

impl From<SecretKey<Secp256k1>> for SigningKey

source§

fn from(secret_key: SecretKey) -> SigningKey

Converts to this type from the input type.
source§

impl From<SigningKey> for SecretKey

source§

fn from(signing_key: SigningKey) -> SecretKey

Converts to this type from the input type.
source§

impl From<SigningKey> for VerifyingKey

source§

fn from(signing_key: SigningKey) -> VerifyingKey

Converts to this type from the input type.
source§

impl Keypair<Signature<Secp256k1>> for SigningKey

§

type VerifyingKey = VerifyingKey

Verifying key type for this keypair.
source§

fn verifying_key(&self) -> &Self::VerifyingKey

Get the verifying key which can verify signatures produced by the signing key portion of this keypair.
source§

impl PartialEq<SigningKey> for SigningKey

source§

fn eq(&self, other: &SigningKey) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PrehashSigner<Signature<Secp256k1>> for SigningKey

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 PrehashSigner<Signature> for SigningKey

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<D> RandomizedDigestSigner<D, Signature<Secp256k1>> for SigningKeywhere D: Digest + FixedOutput<OutputSize = U32>,

source§

fn try_sign_digest_with_rng( &self, rng: impl CryptoRng + RngCore, digest: D ) -> Result<Signature, Error>

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: impl CryptoRng + RngCore, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<D> RandomizedDigestSigner<D, Signature> for SigningKeywhere D: Digest + FixedOutput<OutputSize = U32>,

source§

fn try_sign_digest_with_rng( &self, rng: impl CryptoRng + RngCore, msg_digest: D ) -> Result<Signature, Error>

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: impl CryptoRng + RngCore, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<S> RandomizedSigner<S> for SigningKeywhere S: PrehashSignature, Self: RandomizedDigestSigner<S::Digest, S>,

source§

fn try_sign_with_rng( &self, rng: impl CryptoRng + RngCore, msg: &[u8] ) -> Result<S>

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: impl CryptoRng + RngCore, msg: &[u8]) -> S

Sign the given message and return a digital signature
source§

impl<S> Signer<S> for SigningKeywhere S: PrehashSignature, Self: DigestSigner<S::Digest, S>,

source§

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

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

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

Sign the given message and return a digital signature
source§

impl Eq for SigningKey

source§

impl ZeroizeOnDrop for SigningKey

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T, S> SignerMut<S> for Twhere T: Signer<S>, S: Signature,

source§

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

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

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

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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.