[−][src]Struct signatory::ecdsa::FixedSignature
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-endians
: 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]
C: Curve + CheckSignatureBytes,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
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]
r: impl Into<GenericArray<u8, <C as Curve>::FieldSize>>,
s: impl Into<GenericArray<u8, <C as Curve>::FieldSize>>
) -> Result<Signature<C>, Error>
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]
<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>,
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]
<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>,
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]
C: Curve + CheckSignatureBytes,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
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]
C: CheckSignatureBytes + Clone + Curve,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
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]
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,
impl<C> Debug for Signature<C> where
C: Curve + CheckSignatureBytes,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
[src]
C: Curve + CheckSignatureBytes,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
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]
C: CheckSignatureBytes + Eq + Curve,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
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]
C: CheckSignatureBytes + PartialEq<C> + Curve,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
pub fn eq(&self, other: &Signature<C>) -> bool
[src]
pub fn ne(&self, other: &Signature<C>) -> bool
[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]
C: DigestPrimitive + CheckSignatureBytes,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
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]
C: Curve + CheckSignatureBytes,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
impl<C> StructuralEq for Signature<C> where
C: CheckSignatureBytes + Curve,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
[src]
C: CheckSignatureBytes + Curve,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
impl<C> StructuralPartialEq for Signature<C> where
C: CheckSignatureBytes + Curve,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
[src]
C: CheckSignatureBytes + Curve,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
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]
C: Curve + CheckSignatureBytes,
<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
type Error = Error
The type returned in the event of a conversion error.
pub fn try_from(bytes: &[u8]) -> Result<Signature<C>, Error>
[src]
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]
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>,
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,
<<<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,
<<<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,
<<<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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,