Type Alias Signature

Source
pub type Signature = Signature<NistP256>;
Expand description

ECDSA/P-256 signature (fixed-size)

Aliased Type§

struct Signature { /* private fields */ }

Implementations

Source§

impl<C> Signature<C>

Source

pub fn from_bytes( bytes: &GenericArray<u8, <<C as Curve>::FieldBytesSize as Add>::Output>, ) -> Result<Signature<C>, Error>

Parse a signature from fixed-width bytes, i.e. 2 * the size of FieldBytes for a particular curve.

§Returns
  • Ok(signature) if the r and s components are both in the valid range 1..n when serialized as concatenated big endian integers.
  • Err(err) if the r and/or s component of the signature is out-of-range when interpreted as a big endian integer.
Source

pub fn from_slice(slice: &[u8]) -> Result<Signature<C>, Error>

Parse a signature from a byte slice.

Source

pub fn from_der(bytes: &[u8]) -> Result<Signature<C>, Error>

Parse a signature from ASN.1 DER.

Source

pub fn from_scalars( r: impl Into<GenericArray<u8, <C as Curve>::FieldBytesSize>>, s: impl Into<GenericArray<u8, <C as Curve>::FieldBytesSize>>, ) -> Result<Signature<C>, Error>

Create a Signature from the serialized r and s scalar values which comprise the signature.

§Returns
  • Ok(signature) if the r and s components are both in the valid range 1..n when serialized as concatenated big endian integers.
  • Err(err) if the r and/or s component of the signature is out-of-range when interpreted as a big endian integer.
Source

pub fn split_bytes( &self, ) -> (GenericArray<u8, <C as Curve>::FieldBytesSize>, GenericArray<u8, <C as Curve>::FieldBytesSize>)

Split the signature into its r and s components, represented as bytes.

Source

pub fn to_bytes( &self, ) -> GenericArray<u8, <<C as Curve>::FieldBytesSize as Add>::Output>

Serialize this signature as bytes.

Source

pub fn to_der(&self) -> Signature<C>

Serialize this signature as ASN.1 DER.

Source§

impl<C> Signature<C>

Source

pub fn r(&self) -> NonZeroScalar<C>

Get the r component of this signature

Source

pub fn s(&self) -> NonZeroScalar<C>

Get the s component of this signature

Source

pub fn split_scalars(&self) -> (NonZeroScalar<C>, NonZeroScalar<C>)

Split the signature into its r and s scalars.

Source

pub fn normalize_s(&self) -> Option<Signature<C>>

Normalize signature into “low S” form as described in BIP 0062: Dealing with Malleability.

Trait Implementations

Source§

impl<C> AssociatedOid for Signature<C>

ECDSA ObjectIdentifier which identifies the digest used by default with the Signer and Verifier traits.

To support non-default digest algorithms, use the SignatureWithOid type instead.

Source§

const OID: ObjectIdentifier

The OID associated with this type.
Source§

impl<C> Clone for Signature<C>
where C: Clone + PrimeCurve,

Source§

fn clone(&self) -> Signature<C>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C> Debug for Signature<C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<C> Display for Signature<C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<C> From<SignatureWithOid<C>> for Signature<C>
where C: PrimeCurve,

Source§

fn from(sig: SignatureWithOid<C>) -> Signature<C>

Converts to this type from the input type.
Source§

impl<C> FromStr for Signature<C>

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(hex: &str) -> Result<Signature<C>, Error>

Parses a string s to return a value of this type. Read more
Source§

impl<C> LowerHex for Signature<C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<C> PartialEq for Signature<C>
where C: PartialEq + PrimeCurve,

Source§

fn eq(&self, other: &Signature<C>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<C> PrehashSignature for Signature<C>

Source§

type Digest = <C as DigestPrimitive>::Digest

Preferred Digest algorithm to use when computing this signature type.
Source§

impl<C> SignatureEncoding for Signature<C>

Source§

type Repr = GenericArray<u8, <<C as Curve>::FieldBytesSize as Add>::Output>

Byte representation of a signature.
Source§

fn to_bytes(&self) -> Self::Repr

Encode signature as its byte representation.
Source§

fn encoded_len(&self) -> usize

Get the length of this signature when encoded.
Source§

impl<C> TryFrom<&[u8]> for Signature<C>

Source§

type Error = Error

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

fn try_from(slice: &[u8]) -> Result<Signature<C>, Error>

Performs the conversion.
Source§

impl<C> TryFrom<Signature<C>> for Signature<C>

Source§

type Error = Error

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

fn try_from(sig: Signature<C>) -> Result<Signature<C>, Error>

Performs the conversion.
Source§

impl<C> UpperHex for Signature<C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<C> Copy for Signature<C>

Source§

impl<C> Eq for Signature<C>
where C: Eq + PrimeCurve,

Source§

impl<C> StructuralPartialEq for Signature<C>
where C: PrimeCurve,