[][src]Struct signatory::ecdsa::FixedSignature

pub struct FixedSignature<C> where
    C: CheckSignatureBytes + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
{ /* fields omitted */ }

ECDSA signatures (fixed-size).

Generic over elliptic curve types.

These signatures are serialized as fixed-sized big endian scalar values with no additional framing:

  • r: field element size for the given curve, big-endian
  • s: field element size for the given curve, big-endian

For example, in a curve with a 256-bit modulus like NIST P-256 or secp256k1, r and s will both be 32-bytes, resulting in a signature with a total of 64-bytes.

ASN.1 is also supported via the Signature::from_asn1 and Signature::to_asn1 methods.

Implementations

impl<C> Signature<C> where
    C: Curve + CheckSignatureBytes,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

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

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

pub fn from_asn1(bytes: &[u8]) -> Result<Signature<C>, Error> where
    <C as Curve>::FieldSize: Add<<C as Curve>::FieldSize>,
    <C as Curve>::FieldSize: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: ArrayLength<u8>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

Parse a signature from ASN.1 DER

pub fn to_asn1(&self) -> Signature<C> where
    <C as Curve>::FieldSize: Add<<C as Curve>::FieldSize>,
    <C as Curve>::FieldSize: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: ArrayLength<u8>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

Serialize this signature as ASN.1 DER

Trait Implementations

impl<C> AsRef<[u8]> for Signature<C> where
    C: Curve + CheckSignatureBytes,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

impl<C> Clone for Signature<C> where
    C: CheckSignatureBytes + Clone + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

impl<C> Copy for Signature<C> where
    C: Curve + CheckSignatureBytes,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as ArrayLength<u8>>::ArrayType: Copy
[src]

impl<C> Debug for Signature<C> where
    C: Curve + CheckSignatureBytes,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

impl<C> Eq for Signature<C> where
    C: CheckSignatureBytes + Eq + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

impl From<Signature> for Signature<Secp256k1>[src]

impl<C> PartialEq<Signature<C>> for Signature<C> where
    C: CheckSignatureBytes + PartialEq<C> + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

impl<C> PrehashSignature for Signature<C> where
    C: DigestPrimitive + CheckSignatureBytes,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

type Digest = <C as DigestPrimitive>::Digest

Preferred Digest algorithm to use when computing this signature type.

impl<C> Signature for Signature<C> where
    C: Curve + CheckSignatureBytes,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

impl<C> StructuralEq for Signature<C> where
    C: CheckSignatureBytes + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

impl<C> StructuralPartialEq for Signature<C> where
    C: CheckSignatureBytes + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

impl<'_, C> TryFrom<&'_ [u8]> for Signature<C> where
    C: Curve + CheckSignatureBytes,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

type Error = Error

The type returned in the event of a conversion error.

impl<C> TryFrom<Signature<C>> for Signature<C> where
    C: Curve + CheckSignatureBytes,
    <C as Curve>::FieldSize: Add<<C as Curve>::FieldSize>,
    <C as Curve>::FieldSize: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: ArrayLength<u8>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<C> RefUnwindSafe for Signature<C> where
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::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>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as ArrayLength<u8>>::ArrayType: Unpin

impl<C> UnwindSafe for Signature<C> where
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as ArrayLength<u8>>::ArrayType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.