pub trait SignPrimitive<C>: Field + Into<FieldBytes<C>> + Reduce<C::UInt> + Sizedwhere
    C: PrimeCurve + ProjectiveArithmetic + ScalarArithmetic<Scalar = Self>,
    SignatureSize<C>: ArrayLength<u8>,
{ fn try_sign_prehashed<K>(
        &self,
        k: K,
        z: Scalar<C>
    ) -> Result<(Signature<C>, Option<RecoveryId>)>
    where
        K: Borrow<Self> + Invert<Output = Self>
, { ... } }
Expand description

Try to sign the given prehashed message using ECDSA.

This trait is intended to be implemented on a type with access to the secret scalar via &self, such as particular curve’s Scalar type.

Provided Methods§

Try to sign the prehashed message.

Accepts the following arguments:

  • k: ephemeral scalar value. MUST BE UNIFORMLY RANDOM!!!
  • z: scalar computed from a hashed message digest to be signed. MUST BE OUTPUT OF A CRYPTOGRAPHICALLY SECURE DIGEST ALGORITHM!!!
Computing the hashed_msg scalar

To compute a Scalar from a message digest, use the Reduce trait on the computed digest, e.g. Scalar::from_be_bytes_reduced.

Returns

ECDSA Signature and, when possible/desired, a RecoveryId which can be used to recover the verifying key for a given signature.

Implementors§