Struct k256::ecdsa::SigningKey
source · [−]pub struct SigningKey { /* private fields */ }
ecdsa-core
and ecdsa
only.Expand description
ECDSA/secp256k1 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, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
Initialize SigningKey
from a raw scalar value (big endian).
sourcepub fn verifying_key(&self) -> VerifyingKey
pub fn verifying_key(&self) -> VerifyingKey
Get the VerifyingKey
which corresponds to this SigningKey
.
sourcepub fn to_bytes(&self) -> FieldBytes
pub fn to_bytes(&self) -> FieldBytes
Serialize this SigningKey
as bytes
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 more
sourceimpl ConstantTimeEq for SigningKey
impl ConstantTimeEq for SigningKey
sourceimpl Debug for SigningKey
impl Debug for SigningKey
sourceimpl DecodePrivateKey for SigningKey
Available on crate feature pkcs8
only.
impl DecodePrivateKey for SigningKey
pkcs8
only.sourceimpl<D> DigestSigner<D, Signature<Secp256k1>> for SigningKey where
D: CoreProxy + Digest + FixedOutput<OutputSize = U32>,
D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
impl<D> DigestSigner<D, Signature<Secp256k1>> for SigningKey where
D: CoreProxy + Digest + FixedOutput<OutputSize = U32>,
D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
sourcefn try_sign_digest(&self, digest: D) -> Result<Signature, Error>
fn try_sign_digest(&self, digest: D) -> Result<Signature, Error>
sourcefn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
sourceimpl<D> DigestSigner<D, Signature> for SigningKey where
D: CoreProxy + Digest + FixedOutput<OutputSize = U32>,
D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
impl<D> DigestSigner<D, Signature> for SigningKey where
D: CoreProxy + Digest + FixedOutput<OutputSize = U32>,
D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
sourcefn try_sign_digest(&self, msg_digest: D) -> Result<Signature, Error>
fn try_sign_digest(&self, msg_digest: D) -> Result<Signature, Error>
sourcefn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
sourceimpl Drop for SigningKey
impl Drop for SigningKey
sourceimpl From<&'_ NonZeroScalar<Secp256k1>> for SigningKey
impl From<&'_ NonZeroScalar<Secp256k1>> for SigningKey
sourcefn from(secret_scalar: &NonZeroScalar) -> Self
fn from(secret_scalar: &NonZeroScalar) -> Self
Converts to this type from the input type.
sourceimpl From<&'_ SecretKey<Secp256k1>> for SigningKey
impl From<&'_ SecretKey<Secp256k1>> for SigningKey
sourcefn from(secret_key: &SecretKey) -> SigningKey
fn from(secret_key: &SecretKey) -> SigningKey
Converts to this type from the input type.
sourceimpl From<&'_ SigningKey> for SecretKey
impl From<&'_ SigningKey> for SecretKey
sourcefn from(signing_key: &SigningKey) -> SecretKey
fn from(signing_key: &SigningKey) -> SecretKey
Converts to this type from the input type.
sourceimpl From<&'_ SigningKey> for VerifyingKey
impl From<&'_ SigningKey> for VerifyingKey
sourcefn from(signing_key: &SigningKey) -> VerifyingKey
fn from(signing_key: &SigningKey) -> VerifyingKey
Converts to this type from the input type.
sourceimpl From<NonZeroScalar<Secp256k1>> for SigningKey
impl From<NonZeroScalar<Secp256k1>> for SigningKey
sourcefn from(secret_scalar: NonZeroScalar) -> Self
fn from(secret_scalar: NonZeroScalar) -> Self
Converts to this type from the input type.
sourceimpl From<SecretKey<Secp256k1>> for SigningKey
impl From<SecretKey<Secp256k1>> for SigningKey
sourcefn from(secret_key: SecretKey) -> SigningKey
fn from(secret_key: SecretKey) -> SigningKey
Converts to this type from the input type.
sourceimpl From<SigningKey> for SecretKey
impl From<SigningKey> for SecretKey
sourcefn from(signing_key: SigningKey) -> SecretKey
fn from(signing_key: SigningKey) -> SecretKey
Converts to this type from the input type.
sourceimpl From<SigningKey> for VerifyingKey
impl From<SigningKey> for VerifyingKey
sourcefn from(signing_key: SigningKey) -> VerifyingKey
fn from(signing_key: SigningKey) -> VerifyingKey
Converts to this type from the input type.
sourceimpl PartialEq<SigningKey> for SigningKey
impl PartialEq<SigningKey> for SigningKey
sourceimpl<D> RandomizedDigestSigner<D, Signature<Secp256k1>> for SigningKey where
D: CoreProxy + Digest + FixedOutput<OutputSize = U32>,
D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
impl<D> RandomizedDigestSigner<D, Signature<Secp256k1>> for SigningKey where
D: CoreProxy + Digest + FixedOutput<OutputSize = U32>,
D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
sourcefn try_sign_digest_with_rng(
&self,
rng: impl CryptoRng + RngCore,
digest: D
) -> Result<Signature, Error>
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. Read more
sourcefn 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 more
sourceimpl<D> RandomizedDigestSigner<D, Signature> for SigningKey where
D: CoreProxy + Digest + FixedOutput<OutputSize = U32>,
D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
impl<D> RandomizedDigestSigner<D, Signature> for SigningKey where
D: CoreProxy + Digest + FixedOutput<OutputSize = U32>,
D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
sourcefn try_sign_digest_with_rng(
&self,
rng: impl CryptoRng + RngCore,
msg_digest: D
) -> Result<Signature, Error>
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. Read more
sourcefn 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 more
sourceimpl<S> RandomizedSigner<S> for SigningKey where
S: PrehashSignature,
Self: RandomizedDigestSigner<S::Digest, S>,
impl<S> RandomizedSigner<S> for SigningKey where
S: PrehashSignature,
Self: RandomizedDigestSigner<S::Digest, S>,
sourceimpl<S> Signer<S> for SigningKey where
S: PrehashSignature,
Self: DigestSigner<S::Digest, S>,
impl<S> Signer<S> for SigningKey where
S: PrehashSignature,
Self: DigestSigner<S::Digest, S>,
sourceimpl TryFrom<PrivateKeyInfo<'_>> for SigningKey
Available on crate feature pkcs8
only.
impl TryFrom<PrivateKeyInfo<'_>> for SigningKey
pkcs8
only.impl Eq 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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
impl<T> DecodeEcPrivateKey for T where
T: DecodePrivateKey,
impl<T> DecodeEcPrivateKey for T where
T: DecodePrivateKey,
sourceimpl<T, S> SignerMut<S> for T where
T: Signer<S>,
S: Signature,
impl<T, S> SignerMut<S> for T where
T: Signer<S>,
S: Signature,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more