pub struct SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,{ /* private fields */ }Expand description
ECDSA signing key. Generic over elliptic curves.
Requires an elliptic_curve::ProjectiveArithmetic impl on the curve, and a
SignPrimitive impl on its associated Scalar type.
Implementations§
Source§impl<C> SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
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>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Initialize signing key from a raw scalar serialized as a byte slice.
Sourcepub fn verifying_key(&self) -> VerifyingKey<C>
pub fn verifying_key(&self) -> VerifyingKey<C>
Get the VerifyingKey which corresponds to this SigningKey
Sourcepub fn to_bytes(&self) -> FieldBytes<C>
pub fn to_bytes(&self) -> FieldBytes<C>
Serialize this SigningKey as bytes
Trait Implementations§
Source§impl<C> Clone for SigningKey<C>where
C: Curve + ProjectiveArithmetic + Clone,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Clone for SigningKey<C>where
C: Curve + ProjectiveArithmetic + Clone,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> ConstantTimeEq for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> ConstantTimeEq for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> Debug for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Debug for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C, D> DigestSigner<D, Signature<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
D: FixedOutput<OutputSize = FieldSize<C>> + BlockInput + Clone + Default + Reset + Update,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C, D> DigestSigner<D, Signature<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
D: FixedOutput<OutputSize = FieldSize<C>> + BlockInput + Clone + Default + Reset + Update,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§fn try_sign_digest(&self, digest: D) -> Result<Signature<C>>
fn try_sign_digest(&self, digest: D) -> Result<Signature<C>>
Sign message prehash using a deterministic ephemeral scalar (k)
computed using the algorithm described in RFC 6979 (Section 3.2):
https://tools.ietf.org/html/rfc6979#section-3
Source§fn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Source§impl<C> Drop for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Drop for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Eq for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> From<&SecretKey<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> From<&SecretKey<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> From<&SigningKey<C>> for VerifyingKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature verify only.
impl<C> From<&SigningKey<C>> for VerifyingKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Available on crate feature
verify only.Source§fn from(signing_key: &SigningKey<C>) -> VerifyingKey<C>
fn from(signing_key: &SigningKey<C>) -> VerifyingKey<C>
Converts to this type from the input type.
Source§impl<C> From<NonZeroScalar<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> From<NonZeroScalar<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§fn from(secret_scalar: NonZeroScalar<C>) -> Self
fn from(secret_scalar: NonZeroScalar<C>) -> Self
Converts to this type from the input type.
Source§impl<C> From<SecretKey<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> From<SecretKey<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> PartialEq for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> PartialEq for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
D: FixedOutput<OutputSize = FieldSize<C>> + BlockInput + Clone + Default + Reset + Update,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
D: FixedOutput<OutputSize = FieldSize<C>> + BlockInput + Clone + Default + Reset + Update,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where
Self: RandomizedDigestSigner<C::Digest, Signature<C>>,
C: Curve + ProjectiveArithmetic + DigestPrimitive,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where
Self: RandomizedDigestSigner<C::Digest, Signature<C>>,
C: Curve + ProjectiveArithmetic + DigestPrimitive,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> Signer<Signature<C>> for SigningKey<C>where
Self: DigestSigner<C::Digest, Signature<C>>,
C: Curve + ProjectiveArithmetic + DigestPrimitive,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Signer<Signature<C>> for SigningKey<C>where
Self: DigestSigner<C::Digest, Signature<C>>,
C: Curve + ProjectiveArithmetic + DigestPrimitive,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> TryFrom<&[u8]> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> TryFrom<&[u8]> for SigningKey<C>where
C: Curve + ProjectiveArithmetic,
Scalar<C>: FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
SignatureSize<C>: ArrayLength<u8>,
Auto Trait Implementations§
impl<C> Freeze for SigningKey<C>where
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add>::Output: Sized,
<C as ScalarArithmetic>::Scalar: Freeze,
impl<C> RefUnwindSafe for SigningKey<C>where
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add>::Output: Sized,
<C as ScalarArithmetic>::Scalar: RefUnwindSafe,
impl<C> Send for SigningKey<C>
impl<C> Sync for SigningKey<C>
impl<C> Unpin for SigningKey<C>where
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add>::Output: Sized,
<C as ScalarArithmetic>::Scalar: Unpin,
impl<C> UnsafeUnpin for SigningKey<C>where
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add>::Output: Sized,
<C as ScalarArithmetic>::Scalar: UnsafeUnpin,
impl<C> UnwindSafe for SigningKey<C>where
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add>::Output: Sized,
<C as ScalarArithmetic>::Scalar: 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
Mutably borrows from an owned value. Read more