pub struct EcdsaSig(/* private fields */);
Expand description
A low level interface to ECDSA.
Implementations§
source§impl EcdsaSig
impl EcdsaSig
sourcepub fn sign<T>(data: &[u8], eckey: &EcKeyRef<T>) -> Result<EcdsaSig, ErrorStack>where
T: HasPrivate,
pub fn sign<T>(data: &[u8], eckey: &EcKeyRef<T>) -> Result<EcdsaSig, ErrorStack>where T: HasPrivate,
Computes a digital signature of the hash value data
using the private EC key eckey.
This corresponds to ECDSA_do_sign
.
sourcepub fn from_private_components(
r: BigNum,
s: BigNum
) -> Result<EcdsaSig, ErrorStack>
pub fn from_private_components( r: BigNum, s: BigNum ) -> Result<EcdsaSig, ErrorStack>
Returns a new EcdsaSig
by setting the r
and s
values associated with an ECDSA signature.
This corresponds to ECDSA_SIG_set0
.
sourcepub fn from_der(der: &[u8]) -> Result<EcdsaSig, ErrorStack>
pub fn from_der(der: &[u8]) -> Result<EcdsaSig, ErrorStack>
Decodes a DER-encoded ECDSA signature.
This corresponds to d2i_ECDSA_SIG
.
Methods from Deref<Target = EcdsaSigRef>§
sourcepub fn to_der(&self) -> Result<Vec<u8>, ErrorStack>
pub fn to_der(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the ECDSA signature into a DER-encoded ECDSASignature structure.
This corresponds to i2d_ECDSA_SIG
.
sourcepub fn verify<T>(
&self,
data: &[u8],
eckey: &EcKeyRef<T>
) -> Result<bool, ErrorStack>where
T: HasPublic,
pub fn verify<T>( &self, data: &[u8], eckey: &EcKeyRef<T> ) -> Result<bool, ErrorStack>where T: HasPublic,
Verifies if the signature is a valid ECDSA signature using the given public key.
This corresponds to ECDSA_do_verify
.
sourcepub fn r(&self) -> &BigNumRef
pub fn r(&self) -> &BigNumRef
Returns internal component: r
of an EcdsaSig
. (See X9.62 or FIPS 186-2)
This corresponds to ECDSA_SIG_get0
.
sourcepub fn s(&self) -> &BigNumRef
pub fn s(&self) -> &BigNumRef
Returns internal components: s
of an EcdsaSig
. (See X9.62 or FIPS 186-2)
This corresponds to ECDSA_SIG_get0
.