logo
pub trait SignPrimitive<C>: Field + Into<FieldBytes<C>> + Reduce<C::UInt> + Sized where
    C: PrimeCurve + ProjectiveArithmetic + ScalarArithmetic<Scalar = Self>,
    SignatureSize<C>: ArrayLength<u8>, 
{ fn try_sign_prehashed<K>(
        &self,
        k: K,
        z: FieldBytes<C>
    ) -> Result<(Signature<C>, Option<RecoveryId>)>
    where
        K: Borrow<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<ScalarCore<C>>,
        C::UInt: for<'a> From<&'a Self>,
        D: CoreProxy + FixedOutput<OutputSize = FieldSize<C>>,
        D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
        <D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
        Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero
, { ... } fn try_sign_digest_rfc6979<D>(
        &self,
        msg_digest: D,
        ad: &[u8]
    ) -> Result<(Signature<C>, Option<RecoveryId>)>
    where
        Self: From<ScalarCore<C>>,
        C::UInt: for<'a> From<&'a Self>,
        D: CoreProxy + FixedOutput<OutputSize = FieldSize<C>>,
        D::Core: BlockSizeUser + BufferKindUser<BufferKind = Eager> + Clone + Default + FixedOutputCore + HashMarker + OutputSizeUser<OutputSize = D::OutputSize>,
        <D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
        Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero
, { ... } }
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

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.

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
Available on crate feature rfc6979 only.

Try to sign the given digest instance using the method described in RFC6979.

Implementors