Struct ecdsa::SigningKey[][src]

pub struct SigningKey<C> where
    C: Curve + ProjectiveArithmetic,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
{ /* fields omitted */ }
This is supported on crate feature sign only.

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

impl<C> SigningKey<C> where
    C: Curve + ProjectiveArithmetic,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

pub fn random(rng: impl CryptoRng + RngCore) -> Self[src]

Generate a cryptographically random SigningKey.

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>[src]

Initialize signing key from a raw scalar serialized as a byte slice.

pub fn verify_key(&self) -> VerifyingKey<C> where
    AffinePoint<C>: Copy + Clone + Debug + Default,
    ProjectivePoint<C>: From<AffinePoint<C>>, 
[src]

This is supported on crate feature verify only.

Get the VerifyingKey which corresponds to this SigningKey

pub fn to_bytes(&self) -> FieldBytes<C>[src]

Serialize this SigningKey as bytes

Trait Implementations

impl<C, D> DigestSigner<D, Signature<C>> for SigningKey<C> where
    C: Curve + ProjectiveArithmetic,
    D: FixedOutput<OutputSize = C::FieldSize> + BlockInput + Clone + Default + Reset + Update,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

fn try_sign_digest(&self, digest: D) -> Result<Signature<C>, Error>[src]

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

impl<C> From<&'_ SigningKey<C>> for VerifyingKey<C> where
    C: Curve + ProjectiveArithmetic,
    AffinePoint<C>: Copy + Clone + Debug + Default,
    ProjectivePoint<C>: From<AffinePoint<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

impl<C> From<NonZeroScalar<C>> for SigningKey<C> where
    C: Curve + ProjectiveArithmetic,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

impl<C> From<SecretKey<C>> for SigningKey<C> where
    C: Curve + ProjectiveArithmetic,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + ConstantTimeEq + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

impl<C> FromPrivateKey for SigningKey<C> where
    C: Curve + AlgorithmParameters + ProjectiveArithmetic,
    AffinePoint<C>: Copy + Clone + Debug + Default + FromEncodedPoint<C> + ToEncodedPoint<C>,
    ProjectivePoint<C>: From<AffinePoint<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>,
    UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

This is supported on crate feature pkcs8 only.

impl<C> FromStr for SigningKey<C> where
    C: Curve + AlgorithmParameters + ProjectiveArithmetic,
    AffinePoint<C>: Copy + Clone + Debug + Default + FromEncodedPoint<C> + ToEncodedPoint<C>,
    ProjectivePoint<C>: From<AffinePoint<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>,
    UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

This is supported on crate feature pem only.

type Err = Error

The associated error which can be returned from parsing.

impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C> where
    C: Curve + ProjectiveArithmetic,
    D: FixedOutput<OutputSize = C::FieldSize> + BlockInput + Clone + Default + Reset + Update,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

fn try_sign_digest_with_rng(
    &self,
    rng: impl CryptoRng + RngCore,
    digest: D
) -> Result<Signature<C>, Error>
[src]

Sign message prehash using an ephemeral scalar (k) derived according to a variant of RFC 6979 (Section 3.6) which supplies additional entropy from an RNG.

impl<C> RandomizedSigner<Signature<C>> for SigningKey<C> where
    Self: RandomizedDigestSigner<C::Digest, Signature<C>>,
    C: Curve + ProjectiveArithmetic + DigestPrimitive,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

impl<C> Signer<Signature<C>> for SigningKey<C> where
    Self: DigestSigner<C::Digest, Signature<C>>,
    C: Curve + ProjectiveArithmetic + DigestPrimitive,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

Auto Trait Implementations

impl<C> RefUnwindSafe for SigningKey<C> where
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: RefUnwindSafe

impl<C> Send for SigningKey<C>

impl<C> Sync for SigningKey<C>

impl<C> Unpin for SigningKey<C> where
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: Unpin

impl<C> UnwindSafe for SigningKey<C> where
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.