Struct k256::ecdsa::SigningKey
source · [−]pub struct SigningKey { /* private fields */ }
Available on crate features
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 AsRef<VerifyingKey> for SigningKey
impl AsRef<VerifyingKey> for SigningKey
sourcefn as_ref(&self) -> &VerifyingKey
fn as_ref(&self) -> &VerifyingKey
Converts this type into a shared reference of the (usually inferred) input type.
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 moresourceimpl 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
Available on crate feature
pkcs8
only.sourceimpl<D> DigestSigner<D, Signature<Secp256k1>> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> DigestSigner<D, Signature<Secp256k1>> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
sourcefn try_sign_digest(&self, msg_digest: D) -> Result<Signature>
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. Read morefn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Sign the given prehashed message [
Digest
], returning a signature. Read moresourceimpl<D> DigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> DigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
sourcefn try_sign_digest(&self, msg_digest: D) -> Result<Signature>
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. Read morefn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Sign the given prehashed message [
Digest
], returning a signature. Read moresourceimpl 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 Keypair<Signature<Secp256k1>> for SigningKey
Available on crate feature sha256
only.
impl Keypair<Signature<Secp256k1>> for SigningKey
Available on crate feature
sha256
only.type VerifyingKey = VerifyingKey
type VerifyingKey = VerifyingKey
Verifying key type for this keypair.
fn verifying_key(&self) -> &Self::VerifyingKey
fn verifying_key(&self) -> &Self::VerifyingKey
Get the verifying key which can verify signatures produced by the
signing key portion of this keypair. Read more
sourceimpl Keypair<Signature> for SigningKey
Available on crate feature keccak256
only.
impl Keypair<Signature> for SigningKey
Available on crate feature
keccak256
only.type VerifyingKey = VerifyingKey
type VerifyingKey = VerifyingKey
Verifying key type for this keypair.
fn verifying_key(&self) -> &Self::VerifyingKey
fn verifying_key(&self) -> &Self::VerifyingKey
Get the verifying key which can verify signatures produced by the
signing key portion of this keypair. Read more
sourceimpl PartialEq<SigningKey> for SigningKey
impl PartialEq<SigningKey> for SigningKey
sourcefn eq(&self, other: &SigningKey) -> bool
fn eq(&self, other: &SigningKey) -> bool
sourceimpl PrehashSigner<Signature<Secp256k1>> for SigningKey
impl PrehashSigner<Signature<Secp256k1>> for SigningKey
sourcefn sign_prehash(&self, prehash: &[u8]) -> Result<Signature>
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
sourceimpl PrehashSigner<Signature> for SigningKey
impl PrehashSigner<Signature> for SigningKey
sourcefn sign_prehash(&self, prehash: &[u8]) -> Result<Signature>
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
sourceimpl<D> RandomizedDigestSigner<D, Signature<Secp256k1>> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> RandomizedDigestSigner<D, Signature<Secp256k1>> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
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 morefn 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 moresourceimpl<D> RandomizedDigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> RandomizedDigestSigner<D, Signature> for SigningKeywhere
D: Digest + FixedOutput<OutputSize = U32>,
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 morefn 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 moresourceimpl<S> RandomizedSigner<S> for SigningKeywhere
S: PrehashSignature,
Self: RandomizedDigestSigner<S::Digest, S>,
impl<S> RandomizedSigner<S> for SigningKeywhere
S: PrehashSignature,
Self: RandomizedDigestSigner<S::Digest, S>,
sourcefn try_sign_with_rng(
&self,
rng: impl CryptoRng + RngCore,
msg: &[u8]
) -> Result<S>
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
fn sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> S
Sign the given message and return a digital signature
sourceimpl<S> Signer<S> for SigningKeywhere
S: PrehashSignature,
Self: DigestSigner<S::Digest, S>,
impl<S> Signer<S> for SigningKeywhere
S: PrehashSignature,
Self: DigestSigner<S::Digest, S>,
sourceimpl TryFrom<PrivateKeyInfo<'_>> for SigningKey
Available on crate feature pkcs8
only.
impl TryFrom<PrivateKeyInfo<'_>> for SigningKey
Available on crate feature
pkcs8
only.impl Eq for SigningKey
impl ZeroizeOnDrop 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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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 Twhere
T: DecodePrivateKey,
impl<T> DecodeEcPrivateKey for Twhere
T: DecodePrivateKey,
fn from_sec1_der(private_key: &[u8]) -> Result<T, Error>
fn from_sec1_der(private_key: &[u8]) -> Result<T, Error>
Deserialize SEC1 private key from ASN.1 DER-encoded data
(binary format). Read more