openssl::ecdsa

Struct EcdsaSig

source
pub struct EcdsaSig(/* private fields */);
Expand description

A low level interface to ECDSA.

Implementations§

source§

impl EcdsaSig

source

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.

source

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.

source

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>§

source

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.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl AsRef<EcdsaSigRef> for EcdsaSig

source§

fn as_ref(&self) -> &EcdsaSigRef

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<EcdsaSigRef> for EcdsaSig

source§

fn borrow(&self) -> &EcdsaSigRef

Immutably borrows from an owned value. Read more
source§

impl Deref for EcdsaSig

source§

type Target = EcdsaSigRef

The resulting type after dereferencing.
source§

fn deref(&self) -> &EcdsaSigRef

Dereferences the value.
source§

impl DerefMut for EcdsaSig

source§

fn deref_mut(&mut self) -> &mut EcdsaSigRef

Mutably dereferences the value.
source§

impl Drop for EcdsaSig

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl ForeignType for EcdsaSig

source§

type CType = ECDSA_SIG

The raw C type.
source§

type Ref = EcdsaSigRef

The type representing a reference to this type.
source§

unsafe fn from_ptr(ptr: *mut ECDSA_SIG) -> EcdsaSig

Constructs an instance of this type from its raw type.
source§

fn as_ptr(&self) -> *mut ECDSA_SIG

Returns a raw pointer to the wrapped value.
source§

impl Send for EcdsaSig

source§

impl Sync for EcdsaSig

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.