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