pub trait SignPrimitive<C>:
AsRef<Self>
+ Into<FieldBytes<C>>
+ IsHigh
+ PrimeField<Repr = FieldBytes<C>>
+ Reduce<C::Uint, Bytes = FieldBytes<C>>
+ Sized{
// 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 { ... }
}
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§
Sourcefn try_sign_prehashed<K>(
&self,
k: K,
z: &FieldBytes<C>,
) -> Result<(Signature<C>, Option<RecoveryId>)>
fn try_sign_prehashed<K>( &self, k: K, z: &FieldBytes<C>, ) -> Result<(Signature<C>, Option<RecoveryId>)>
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.
Sourcefn 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,
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,
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.