pub struct SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,{ /* private fields */ }Expand description
ECDSA secret key used for signing. Generic over prime order elliptic curves (e.g. NIST P-curves)
Requires an elliptic_curve::CurveArithmetic impl on the curve, and a
SignPrimitive impl on its associated Scalar type.
§Usage
The signature crate defines the following traits which are the
primary API for signing:
Signer: sign a message using this keyDigestSigner: sign the output of aDigestusing this keyPrehashSigner: sign the low-level raw output bytes of a message digest
See the p256 crate
for examples of using this type with a concrete elliptic curve.
Implementations§
Source§impl<C> SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Sourcepub fn sign_prehash_recoverable(
&self,
prehash: &[u8],
) -> Result<(Signature<C>, RecoveryId)>
pub fn sign_prehash_recoverable( &self, prehash: &[u8], ) -> Result<(Signature<C>, RecoveryId)>
Sign the given message prehash, returning a signature and recovery ID.
Sourcepub fn sign_digest_recoverable<D>(
&self,
msg_digest: D,
) -> Result<(Signature<C>, RecoveryId)>where
D: Digest,
pub fn sign_digest_recoverable<D>(
&self,
msg_digest: D,
) -> Result<(Signature<C>, RecoveryId)>where
D: Digest,
Sign the given message digest, returning a signature and recovery ID.
Sourcepub fn sign_recoverable(&self, msg: &[u8]) -> Result<(Signature<C>, RecoveryId)>
pub fn sign_recoverable(&self, msg: &[u8]) -> Result<(Signature<C>, RecoveryId)>
Sign the given message, hashing it with the curve’s default digest function, and returning a signature and recovery ID.
Source§impl<C> SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Sourcepub fn random(rng: &mut impl CryptoRngCore) -> Self
pub fn random(rng: &mut impl CryptoRngCore) -> Self
Generate a cryptographically random SigningKey.
Sourcepub fn from_bytes(bytes: &FieldBytes<C>) -> Result<Self>
pub fn from_bytes(bytes: &FieldBytes<C>) -> Result<Self>
Initialize signing key from a raw scalar serialized as a byte array.
Sourcepub fn from_slice(bytes: &[u8]) -> Result<Self>
pub fn from_slice(bytes: &[u8]) -> Result<Self>
Initialize signing key from a raw scalar serialized as a byte slice.
Sourcepub fn to_bytes(&self) -> FieldBytes<C>
pub fn to_bytes(&self) -> FieldBytes<C>
Serialize this SigningKey as bytes
Sourcepub fn as_nonzero_scalar(&self) -> &NonZeroScalar<C>
pub fn as_nonzero_scalar(&self) -> &NonZeroScalar<C>
Borrow the secret NonZeroScalar value for this key.
§⚠️ Warning
This value is key material.
Please treat it with the care it deserves!
Sourcepub fn verifying_key(&self) -> &VerifyingKey<C>
pub fn verifying_key(&self) -> &VerifyingKey<C>
Get the VerifyingKey which corresponds to this SigningKey.
Trait Implementations§
Source§impl<C> AsRef<VerifyingKey<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature verifying only.
impl<C> AsRef<VerifyingKey<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
verifying only.Source§fn as_ref(&self) -> &VerifyingKey<C>
fn as_ref(&self) -> &VerifyingKey<C>
Source§impl<C> AssociatedAlgorithmIdentifier for SigningKey<C>where
C: AssociatedOid + CurveArithmetic + PrimeCurve,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature pkcs8 only.
impl<C> AssociatedAlgorithmIdentifier for SigningKey<C>where
C: AssociatedOid + CurveArithmetic + PrimeCurve,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
pkcs8 only.Source§const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<ObjectIdentifier> = SecretKey<C>::ALGORITHM_IDENTIFIER
const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<ObjectIdentifier> = SecretKey<C>::ALGORITHM_IDENTIFIER
AlgorithmIdentifier for this structure.Source§type Params = ObjectIdentifier
type Params = ObjectIdentifier
Source§impl<C> Clone for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + Clone,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Clone for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + Clone,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn clone(&self) -> SigningKey<C>
fn clone(&self) -> SigningKey<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<C> ConstantTimeEq for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> ConstantTimeEq for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> Debug for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Debug for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C, D> DigestSigner<D, (Signature<C>, RecoveryId)> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: Digest,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature signing only.
impl<C, D> DigestSigner<D, (Signature<C>, RecoveryId)> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: Digest,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
signing only.Source§fn try_sign_digest(&self, msg_digest: D) -> Result<(Signature<C>, RecoveryId)>
fn try_sign_digest(&self, msg_digest: D) -> Result<(Signature<C>, RecoveryId)>
Digest, returning a
digital signature on success, or an error if something went wrong.Source§fn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Source§impl<C, D> DigestSigner<D, Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Sign message digest using a deterministic ephemeral scalar (k)
computed using the algorithm described in RFC6979 § 3.2.
impl<C, D> DigestSigner<D, Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Sign message digest using a deterministic ephemeral scalar (k)
computed using the algorithm described in RFC6979 § 3.2.
Source§fn try_sign_digest(&self, msg_digest: D) -> Result<Signature<C>>
fn try_sign_digest(&self, msg_digest: D) -> Result<Signature<C>>
Digest, returning a
digital signature on success, or an error if something went wrong.Source§fn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Source§impl<C, D> DigestSigner<D, SignatureWithOid<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: AssociatedOid + Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C, D> DigestSigner<D, SignatureWithOid<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: AssociatedOid + Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn try_sign_digest(&self, msg_digest: D) -> Result<SignatureWithOid<C>>
fn try_sign_digest(&self, msg_digest: D) -> Result<SignatureWithOid<C>>
Digest, returning a
digital signature on success, or an error if something went wrong.Source§fn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Source§impl<C> Drop for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Drop for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> From<&SecretKey<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> From<&SecretKey<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> From<&SigningKey<C>> for SecretKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> From<&SigningKey<C>> for SecretKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn from(secret_key: &SigningKey<C>) -> Self
fn from(secret_key: &SigningKey<C>) -> Self
Source§impl<C> From<&SigningKey<C>> for VerifyingKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature verifying only.
impl<C> From<&SigningKey<C>> for VerifyingKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
verifying only.Source§fn from(signing_key: &SigningKey<C>) -> VerifyingKey<C>
fn from(signing_key: &SigningKey<C>) -> VerifyingKey<C>
Source§impl<C> From<NonZeroScalar<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> From<NonZeroScalar<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn from(secret_scalar: NonZeroScalar<C>) -> Self
fn from(secret_scalar: NonZeroScalar<C>) -> Self
Source§impl<C> From<SecretKey<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> From<SecretKey<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> From<SigningKey<C>> for SecretKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> From<SigningKey<C>> for SecretKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn from(key: SigningKey<C>) -> Self
fn from(key: SigningKey<C>) -> Self
Source§impl<C> From<SigningKey<C>> for VerifyingKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature verifying only.
impl<C> From<SigningKey<C>> for VerifyingKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
verifying only.Source§fn from(signing_key: SigningKey<C>) -> VerifyingKey<C>
fn from(signing_key: SigningKey<C>) -> VerifyingKey<C>
Source§impl<C> KeypairRef for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature verifying only.
impl<C> KeypairRef for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
verifying only.Source§type VerifyingKey = VerifyingKey<C>
type VerifyingKey = VerifyingKey<C>
Source§impl<C> PartialEq for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> PartialEq for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> PrehashSigner<(Signature<C>, RecoveryId)> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature signing only.
impl<C> PrehashSigner<(Signature<C>, RecoveryId)> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
signing only.Source§fn sign_prehash(&self, prehash: &[u8]) -> Result<(Signature<C>, RecoveryId)>
fn sign_prehash(&self, prehash: &[u8]) -> Result<(Signature<C>, RecoveryId)>
Source§impl<C> PrehashSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Sign message prehash using a deterministic ephemeral scalar (k)
computed using the algorithm described in RFC6979 § 3.2.
impl<C> PrehashSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Sign message prehash using a deterministic ephemeral scalar (k)
computed using the algorithm described in RFC6979 § 3.2.
Source§impl<C> PrehashSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
Available on crate feature der only.
impl<C> PrehashSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
der only.Source§impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn try_sign_digest_with_rng(
&self,
rng: &mut impl CryptoRngCore,
msg_digest: D,
) -> Result<Signature<C>>
fn try_sign_digest_with_rng( &self, rng: &mut impl CryptoRngCore, msg_digest: D, ) -> Result<Signature<C>>
Digest, returning a
digital signature on success, or an error if something went wrong.Source§fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S
fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S
Digest, returning a signature. Read moreSource§impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
Available on crate feature der only.
impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
der only.Source§fn try_sign_digest_with_rng(
&self,
rng: &mut impl CryptoRngCore,
msg_digest: D,
) -> Result<Signature<C>>
fn try_sign_digest_with_rng( &self, rng: &mut impl CryptoRngCore, msg_digest: D, ) -> Result<Signature<C>>
Digest, returning a
digital signature on success, or an error if something went wrong.Source§fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S
fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S
Digest, returning a signature. Read moreSource§impl<C> RandomizedPrehashSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> RandomizedPrehashSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn sign_prehash_with_rng(
&self,
rng: &mut impl CryptoRngCore,
prehash: &[u8],
) -> Result<Signature<C>>
fn sign_prehash_with_rng( &self, rng: &mut impl CryptoRngCore, prehash: &[u8], ) -> Result<Signature<C>>
Source§impl<C> RandomizedPrehashSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
Available on crate feature der only.
impl<C> RandomizedPrehashSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
der only.Source§fn sign_prehash_with_rng(
&self,
rng: &mut impl CryptoRngCore,
prehash: &[u8],
) -> Result<Signature<C>>
fn sign_prehash_with_rng( &self, rng: &mut impl CryptoRngCore, prehash: &[u8], ) -> Result<Signature<C>>
Source§impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where
Self: RandomizedDigestSigner<C::Digest, Signature<C>>,
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where
Self: RandomizedDigestSigner<C::Digest, Signature<C>>,
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn try_sign_with_rng(
&self,
rng: &mut impl CryptoRngCore,
msg: &[u8],
) -> Result<Signature<C>>
fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8], ) -> Result<Signature<C>>
Source§fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
Source§impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
Available on crate feature der only.
impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
der only.Source§fn try_sign_with_rng(
&self,
rng: &mut impl CryptoRngCore,
msg: &[u8],
) -> Result<Signature<C>>
fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8], ) -> Result<Signature<C>>
Source§fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
Source§impl<C> SignatureAlgorithmIdentifier for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Signature<C>: AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,
Available on crate feature pkcs8 only.
impl<C> SignatureAlgorithmIdentifier for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Signature<C>: AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,
pkcs8 only.Source§const SIGNATURE_ALGORITHM_IDENTIFIER: AlgorithmIdentifier<Self::Params> = Signature<C>::ALGORITHM_IDENTIFIER
const SIGNATURE_ALGORITHM_IDENTIFIER: AlgorithmIdentifier<Self::Params> = Signature<C>::ALGORITHM_IDENTIFIER
AlgorithmIdentifier for the corresponding singature system.Source§impl<C> Signer<(Signature<C>, RecoveryId)> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature signing only.
impl<C> Signer<(Signature<C>, RecoveryId)> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
signing only.Source§impl<C> Signer<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Sign message using a deterministic ephemeral scalar (k)
computed using the algorithm described in RFC6979 § 3.2.
impl<C> Signer<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Sign message using a deterministic ephemeral scalar (k)
computed using the algorithm described in RFC6979 § 3.2.
Source§impl<C> Signer<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
Available on crate feature der only.
impl<C> Signer<Signature<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
MaxSize<C>: ArrayLength<u8>,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,
der only.Source§impl<C> Signer<SignatureWithOid<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
C::Digest: AssociatedOid,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Signer<SignatureWithOid<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
C::Digest: AssociatedOid,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> TryFrom<&[u8]> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> TryFrom<&[u8]> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> TryFrom<PrivateKeyInfo<'_>> for SigningKey<C>where
C: PrimeCurve + AssociatedOid + CurveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature pkcs8 only.
impl<C> TryFrom<PrivateKeyInfo<'_>> for SigningKey<C>where
C: PrimeCurve + AssociatedOid + CurveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
pkcs8 only.impl<C> Eq for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Constant-time comparison
impl<C> ZeroizeOnDrop for SigningKey<C>where
C: PrimeCurve + CurveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Auto Trait Implementations§
impl<C> Freeze for SigningKey<C>where
<<C as Curve>::FieldBytesSize as Add>::Output: Sized,
<C as CurveArithmetic>::Scalar: Sized + Freeze,
<C as CurveArithmetic>::AffinePoint: Freeze,
impl<C> RefUnwindSafe for SigningKey<C>where
<<C as Curve>::FieldBytesSize as Add>::Output: Sized,
<C as CurveArithmetic>::Scalar: Sized + RefUnwindSafe,
<C as CurveArithmetic>::AffinePoint: RefUnwindSafe,
impl<C> Send for SigningKey<C>
impl<C> Sync for SigningKey<C>
impl<C> Unpin for SigningKey<C>where
<<C as Curve>::FieldBytesSize as Add>::Output: Sized,
<C as CurveArithmetic>::Scalar: Sized + Unpin,
<C as CurveArithmetic>::AffinePoint: Unpin,
impl<C> UnwindSafe for SigningKey<C>where
<<C as Curve>::FieldBytesSize as Add>::Output: Sized,
<C as CurveArithmetic>::Scalar: Sized + UnwindSafe,
<C as CurveArithmetic>::AffinePoint: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodePrivateKey for T
impl<T> DecodePrivateKey for T
Source§impl<T> DynAssociatedAlgorithmIdentifier for Twhere
T: AssociatedAlgorithmIdentifier,
impl<T> DynAssociatedAlgorithmIdentifier for Twhere
T: AssociatedAlgorithmIdentifier,
Source§fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>
fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>
AlgorithmIdentifier for this structure.Source§impl<T> DynSignatureAlgorithmIdentifier for Twhere
T: SignatureAlgorithmIdentifier,
impl<T> DynSignatureAlgorithmIdentifier for Twhere
T: SignatureAlgorithmIdentifier,
Source§fn signature_algorithm_identifier(
&self,
) -> Result<AlgorithmIdentifier<Any>, Error>
fn signature_algorithm_identifier( &self, ) -> Result<AlgorithmIdentifier<Any>, Error>
AlgorithmIdentifier for the corresponding singature system.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<K> Keypair for Kwhere
K: KeypairRef,
impl<K> Keypair for Kwhere
K: KeypairRef,
Source§type VerifyingKey = <K as KeypairRef>::VerifyingKey
type VerifyingKey = <K as KeypairRef>::VerifyingKey
Source§fn verifying_key(&self) -> <K as Keypair>::VerifyingKey
fn verifying_key(&self) -> <K as Keypair>::VerifyingKey
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<S, T> SignerMut<S> for Twhere
T: Signer<S>,
impl<S, T> SignerMut<S> for Twhere
T: Signer<S>,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.