Struct ring_compat::signature::ecdsa::Signature[][src]

pub struct Signature<C> where
    C: Curve + Order,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
{ /* fields omitted */ }
This is supported on crate feature signature only.

ECDSA signature (fixed-size). Generic over elliptic curve types.

Serialized as fixed-sized big endian scalar values with no added 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 DER-encoded signatures also supported via the Signature::from_der and Signature::to_der methods.

Implementations

impl<C> Signature<C> where
    C: Curve + Order,
    <<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_der(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: NonZero,
    <<<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_der(&self) -> Signature<C> where
    <C as Curve>::FieldSize: Add<<C as Curve>::FieldSize>,
    <C as Curve>::FieldSize: ArrayLength<u8>,
    <C as Curve>::FieldSize: NonZero,
    <<<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 + Order,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

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

impl<C> Copy for Signature<C> where
    C: Curve + Order,
    <<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 + Order,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>, 
[src]

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

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

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

impl<C> Signer<Signature<C>> for SigningKey<C> where
    C: Curve + CurveAlg + Order,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

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

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

impl<'_, C> TryFrom<&'_ [u8]> for Signature<C> where
    C: Curve + Order,
    <<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 + Order,
    <C as Curve>::FieldSize: Add<<C as Curve>::FieldSize>,
    <C as Curve>::FieldSize: ArrayLength<u8>,
    <C as Curve>::FieldSize: NonZero,
    <<<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.

impl<C: Curve> Verifier<Signature<C>> for VerifyingKey<C> where
    C: Curve + CurveAlg + Order,
    SignatureSize<C>: ArrayLength<u8>,
    UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

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.