Trait coins_bip32::ecdsa::signature::DigestSigner
source · [−]pub trait DigestSigner<D, S> where
D: Digest,
S: Signature, {
fn try_sign_digest(&self, digest: D) -> Result<S, Error>;
fn sign_digest(&self, digest: D) -> S { ... }
}
Expand description
Sign the given prehashed message Digest
using Self
.
Notes
This trait is primarily intended for signature algorithms based on the Fiat-Shamir heuristic, a method for converting an interactive challenge/response-based proof-of-knowledge protocol into an offline digital signature through the use of a random oracle, i.e. a digest function.
The security of such protocols critically rests upon the inability of an attacker to solve for the output of the random oracle, as generally otherwise such signature algorithms are a system of linear equations and therefore doing so would allow the attacker to trivially forge signatures.
To prevent misuse which would potentially allow this to be possible, this
API accepts a Digest
instance, rather than a raw digest value.
Required Methods
fn try_sign_digest(&self, digest: D) -> Result<S, Error>
fn try_sign_digest(&self, digest: D) -> Result<S, Error>
Attempt to sign the given prehashed message Digest
, returning a
digital signature on success, or an error if something went wrong.
Provided Methods
fn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Sign the given prehashed message Digest
, returning a signature.
Panics in the event of a signing error.
Implementations on Foreign Types
sourceimpl<D> DigestSigner<D, Signature> for SigningKey where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
impl<D> DigestSigner<D, Signature> for SigningKey where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
fn try_sign_digest(&self, digest: D) -> Result<Signature, Error>
impl<C, D> DigestSigner<D, Signature<C>> for SigningKey<C> where
C: PrimeCurve + ProjectiveArithmetic,
D: Digest<OutputSize = <<C as Curve>::UInt as ArrayEncoding>::ByteSize> + BlockSizeUser + FixedOutput + FixedOutputReset,
<C as Curve>::UInt: for<'a> From<&'a <C as ScalarArithmetic>::Scalar>,
<C as ScalarArithmetic>::Scalar: Invert,
<C as ScalarArithmetic>::Scalar: Reduce<<C as Curve>::UInt>,
<C as ScalarArithmetic>::Scalar: SignPrimitive<C>,
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add<<<C as Curve>::UInt as ArrayEncoding>::ByteSize>>::Output: ArrayLength<u8>,
<<C as ScalarArithmetic>::Scalar as Invert>::Output == CtOption<<C as ScalarArithmetic>::Scalar>,
impl<C, D> DigestSigner<D, Signature<C>> for SigningKey<C> where
C: PrimeCurve + ProjectiveArithmetic,
D: Digest<OutputSize = <<C as Curve>::UInt as ArrayEncoding>::ByteSize> + BlockSizeUser + FixedOutput + FixedOutputReset,
<C as Curve>::UInt: for<'a> From<&'a <C as ScalarArithmetic>::Scalar>,
<C as ScalarArithmetic>::Scalar: Invert,
<C as ScalarArithmetic>::Scalar: Reduce<<C as Curve>::UInt>,
<C as ScalarArithmetic>::Scalar: SignPrimitive<C>,
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add<<<C as Curve>::UInt as ArrayEncoding>::ByteSize>>::Output: ArrayLength<u8>,
<<C as ScalarArithmetic>::Scalar as Invert>::Output == CtOption<<C as ScalarArithmetic>::Scalar>,
fn try_sign_digest(&self, msg_digest: D) -> Result<Signature<C>, Error>
fn try_sign_digest(&self, msg_digest: D) -> Result<Signature<C>, Error>
Sign message digest using a deterministic ephemeral scalar (k
)
computed using the algorithm described in RFC6979 § 3.2.