pub trait SignatureEncoding: Clone + Sized + for<'a> TryFrom<&'a [u8]> + TryInto<Self::Repr> {
    type Repr: 'static + AsRef<[u8]> + Clone + Send + Sync;

    // Provided methods
    fn to_bytes(&self) -> Self::Repr { ... }
    fn to_vec(&self) -> Vec<u8, Global> { ... }
    fn encoded_len(&self) -> usize { ... }
}
Expand description

Support for decoding/encoding signatures as bytes.

Required Associated Types§

type Repr: 'static + AsRef<[u8]> + Clone + Send + Sync

Byte representation of a signature.

Provided Methods§

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

Encode signature as its byte representation.

fn to_vec(&self) -> Vec<u8, Global>

Encode signature as a byte vector.

fn encoded_len(&self) -> usize

Get the length of this signature when encoded.

Implementations on Foreign Types§

source§

impl SignatureEncoding for Signature

§

impl<C> SignatureEncoding for Signature<C>where C: PrimeCurve, <<<C as Curve>::FieldBytesSize as Add<<C as Curve>::FieldBytesSize>>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: ArrayLength<u8>, <<C as Curve>::FieldBytesSize as Add<<C as Curve>::FieldBytesSize>>::Output: Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>> + ArrayLength<u8>,

§

type Repr = Box<[u8], Global>

§

fn to_vec(&self) -> Vec<u8, Global>

§

impl<C> SignatureEncoding for Signature<C>where C: PrimeCurve, <<C as Curve>::FieldBytesSize as Add<<C as Curve>::FieldBytesSize>>::Output: ArrayLength<u8>,

§

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

§

impl<C> SignatureEncoding for SignatureWithOid<C>where C: DigestPrimitive, <C as DigestPrimitive>::Digest: AssociatedOid, <<C as Curve>::FieldBytesSize as Add<<C as Curve>::FieldBytesSize>>::Output: ArrayLength<u8>,

NOTE: this implementation assumes the default digest for the given elliptic curve as defined by hazmat::DigestPrimitive.

When working with alternative digests, you will need to use e.g. [SignatureWithOid::new_with_digest].

§

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

Implementors§