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
This is supported on crate feature pkcs8
only.
impl DecodePrivateKey for SigningKey
pkcs8
only.sourcefn from_pkcs8_der(bytes: &[u8]) -> Result<Self, Error>
fn from_pkcs8_der(bytes: &[u8]) -> Result<Self, Error>
Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary format). Read more
sourcefn from_pkcs8_doc(doc: &PrivateKeyDocument) -> Result<Self, Error>
fn from_pkcs8_doc(doc: &PrivateKeyDocument) -> Result<Self, Error>
Deserialize PKCS#8 private key from a PrivateKeyDocument
.
sourceimpl<D> DigestSigner<D, Signature<Secp256k1>> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
impl<D> DigestSigner<D, Signature<Secp256k1>> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
sourcefn try_sign_digest(&self, digest: D) -> Result<Signature, Error>
fn try_sign_digest(&self, 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(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Sign the given prehashed message [Digest
], returning a signature. Read more
sourceimpl<D> DigestSigner<D, Signature> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
impl<D> DigestSigner<D, Signature> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
sourcefn try_sign_digest(&self, msg_digest: D) -> Result<Signature, Error>
fn try_sign_digest(&self, 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(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Sign the given prehashed message [Digest
], returning a signature. Read more
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
Performs the conversion.
sourceimpl From<&'_ SecretKey<Secp256k1>> for SigningKey
impl From<&'_ SecretKey<Secp256k1>> for SigningKey
sourcefn from(secret_key: &SecretKey) -> SigningKey
fn from(secret_key: &SecretKey) -> SigningKey
Performs the conversion.
sourceimpl From<&'_ SigningKey> for SecretKey
impl From<&'_ SigningKey> for SecretKey
sourcefn from(signing_key: &SigningKey) -> SecretKey
fn from(signing_key: &SigningKey) -> SecretKey
Performs the conversion.
sourceimpl From<&'_ SigningKey> for VerifyingKey
impl From<&'_ SigningKey> for VerifyingKey
sourcefn from(signing_key: &SigningKey) -> VerifyingKey
fn from(signing_key: &SigningKey) -> VerifyingKey
Performs the conversion.
sourceimpl From<NonZeroScalar<Secp256k1>> for SigningKey
impl From<NonZeroScalar<Secp256k1>> for SigningKey
sourcefn from(secret_scalar: NonZeroScalar) -> Self
fn from(secret_scalar: NonZeroScalar) -> Self
Performs the conversion.
sourceimpl From<SecretKey<Secp256k1>> for SigningKey
impl From<SecretKey<Secp256k1>> for SigningKey
sourcefn from(secret_key: SecretKey) -> SigningKey
fn from(secret_key: SecretKey) -> SigningKey
Performs the conversion.
sourceimpl From<SigningKey> for SecretKey
impl From<SigningKey> for SecretKey
sourcefn from(signing_key: SigningKey) -> SecretKey
fn from(signing_key: SigningKey) -> SecretKey
Performs the conversion.
sourceimpl From<SigningKey> for VerifyingKey
impl From<SigningKey> for VerifyingKey
sourcefn from(signing_key: SigningKey) -> VerifyingKey
fn from(signing_key: SigningKey) -> VerifyingKey
Performs the conversion.
sourceimpl PartialEq<SigningKey> for SigningKey
impl PartialEq<SigningKey> for SigningKey
sourceimpl<D> RandomizedDigestSigner<D, Signature<Secp256k1>> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
impl<D> RandomizedDigestSigner<D, Signature<Secp256k1>> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
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: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
impl<D> RandomizedDigestSigner<D, Signature> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
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
This is supported 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
sourceimpl<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