Struct ecdsa::der::Signature

source ·
pub struct Signature<C>where
    C: PrimeCurve,
    MaxSize<C>: ArrayLength<u8>,
    <FieldSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,{ /* private fields */ }
Expand description

ASN.1 DER-encoded signature.

Generic over the scalar size of the elliptic curve.

Implementations§

source§

impl<C> Signature<C>where C: PrimeCurve, MaxSize<C>: ArrayLength<u8>, <FieldSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

source

pub fn len(&self) -> usize

Get the length of the signature in bytes

source

pub fn as_bytes(&self) -> &[u8]

Borrow this signature as a byte slice

source

pub fn to_bytes(&self) -> Box<[u8]>

Serialize this signature as a boxed byte slice

Trait Implementations§

source§

impl<C> AsRef<[u8]> for Signature<C>where C: PrimeCurve, MaxSize<C>: ArrayLength<u8>, <FieldSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

source§

fn as_ref(&self) -> &[u8]

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

impl<C> Debug for Signature<C>where C: PrimeCurve, MaxSize<C>: ArrayLength<u8>, <FieldSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

source§

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

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

impl<C> PrehashSignature for Signature<C>where C: PrimeCurve + DigestPrimitive, MaxSize<C>: ArrayLength<u8>, <FieldSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

§

type Digest = <C as DigestPrimitive>::Digest

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

impl<C> Signature for Signature<C>where C: PrimeCurve, MaxSize<C>: ArrayLength<u8>, <FieldSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

source§

fn from_bytes(bytes: &[u8]) -> Result<Self>

Parse an ASN.1 DER-encoded ECDSA signature from a byte slice

source§

fn as_bytes(&self) -> &[u8]

Borrow a byte slice representing the serialized form of this signature
source§

impl<C> TryFrom<&[u8]> for Signature<C>where C: PrimeCurve, MaxSize<C>: ArrayLength<u8>, <FieldSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

§

type Error = Error

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

fn try_from(input: &[u8]) -> Result<Self>

Performs the conversion.
source§

impl<C> TryFrom<Signature<C>> for Signature<C>where C: PrimeCurve, MaxSize<C>: ArrayLength<u8>, <FieldSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

§

type Error = Error

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

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

Performs the conversion.

Auto Trait Implementations§

§

impl<C> RefUnwindSafe for Signature<C>where <<<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add<<<C as Curve>::UInt as ArrayEncoding>::ByteSize>>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output as ArrayLength<u8>>::ArrayType: RefUnwindSafe,

§

impl<C> Send for Signature<C>

§

impl<C> Sync for Signature<C>

§

impl<C> Unpin for Signature<C>where <<<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add<<<C as Curve>::UInt as ArrayEncoding>::ByteSize>>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output as ArrayLength<u8>>::ArrayType: Unpin,

§

impl<C> UnwindSafe for Signature<C>where <<<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add<<<C as Curve>::UInt as ArrayEncoding>::ByteSize>>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output as ArrayLength<u8>>::ArrayType: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.