pub trait SignPrimitive<C>: AsRef<Self> + Into<FieldBytes<C>> + IsHigh + PrimeField<Repr = FieldBytes<C>> + Reduce<C::Uint, Bytes = FieldBytes<C>> + Sizedwhere
    C: PrimeCurve + CurveArithmetic<Scalar = Self>,
    SignatureSize<C>: ArrayLength<u8>,{
    // Provided methods
    fn try_sign_prehashed<K>(
        &self,
        k: K,
        z: &FieldBytes<C>
    ) -> Result<(Signature<C>, Option<RecoveryId>)>
       where K: AsRef<Self> + Invert<Output = CtOption<Self>> { ... }
    fn try_sign_prehashed_rfc6979<D>(
        &self,
        z: &FieldBytes<C>,
        ad: &[u8]
    ) -> Result<(Signature<C>, Option<RecoveryId>)>
       where Self: From<ScalarPrimitive<C>> + Invert<Output = CtOption<Self>>,
             D: Digest + BlockSizeUser + FixedOutput<OutputSize = FieldBytesSize<C>> + FixedOutputReset { ... }
}
Available on crate features hazmat and arithmetic only.
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§

source

fn try_sign_prehashed<K>( &self, k: K, z: &FieldBytes<C> ) -> Result<(Signature<C>, Option<RecoveryId>)>where K: AsRef<Self> + Invert<Output = CtOption<Self>>,

Try to sign the prehashed message.

Accepts the following arguments:

  • k: ephemeral scalar value. MUST BE UNIFORMLY RANDOM!!!
  • z: message digest to be signed. MUST BE OUTPUT OF A CRYPTOGRAPHICALLY SECURE DIGEST ALGORITHM!!!
Returns

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

source

fn try_sign_prehashed_rfc6979<D>( &self, z: &FieldBytes<C>, ad: &[u8] ) -> Result<(Signature<C>, Option<RecoveryId>)>where Self: From<ScalarPrimitive<C>> + Invert<Output = CtOption<Self>>, D: Digest + BlockSizeUser + FixedOutput<OutputSize = FieldBytesSize<C>> + FixedOutputReset,

Available on crate feature rfc6979 only.

Try to sign the given message digest deterministically using the method described in RFC6979 for computing ECDSA ephemeral scalar k.

Accepts the following parameters:

  • z: message digest to be signed.
  • ad: optional additional data, e.g. added entropy from an RNG

Object Safety§

This trait is not object safe.

Implementors§