Function k256::ecdsa::hazmat::sign_prehashed

source ·
pub fn sign_prehashed<C, K>(
    d: &<C as CurveArithmetic>::Scalar,
    k: K,
    z: &GenericArray<u8, <C as Curve>::FieldBytesSize>
) -> Result<(Signature<C>, RecoveryId), Error>
where C: PrimeCurve + CurveArithmetic, K: AsRef<<C as CurveArithmetic>::Scalar> + Invert<Output = CtOption<<C as CurveArithmetic>::Scalar>>, <<C as Curve>::FieldBytesSize as Add>::Output: ArrayLength<u8>,
Available on (crate features ecdsa or sha256) and crate feature hazmat and crate feature ecdsa-core and crate feature arithmetic only.
Expand description

Sign a prehashed message digest using the provided secret scalar and ephemeral scalar, returning an ECDSA signature.

Accepts the following arguments:

  • d: signing key. MUST BE UNIFORMLY RANDOM!!!
  • 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.