pub type Signature = Signature<NistP256>;
Expand description
ECDSA/P-256 signature (fixed-size)
Aliased Type§
struct Signature { /* private fields */ }
Implementations
Source§impl<C> Signature<C>
impl<C> Signature<C>
Sourcepub fn from_bytes(
bytes: &GenericArray<u8, <<C as Curve>::FieldBytesSize as Add>::Output>,
) -> Result<Signature<C>, Error>
pub fn from_bytes( bytes: &GenericArray<u8, <<C as Curve>::FieldBytesSize as Add>::Output>, ) -> Result<Signature<C>, Error>
Parse a signature from fixed-width bytes, i.e. 2 * the size of
FieldBytes
for a particular curve.
§Returns
Ok(signature)
if ther
ands
components are both in the valid range1..n
when serialized as concatenated big endian integers.Err(err)
if ther
and/ors
component of the signature is out-of-range when interpreted as a big endian integer.
Sourcepub fn from_slice(slice: &[u8]) -> Result<Signature<C>, Error>
pub fn from_slice(slice: &[u8]) -> Result<Signature<C>, Error>
Parse a signature from a byte slice.
Sourcepub fn from_scalars(
r: impl Into<GenericArray<u8, <C as Curve>::FieldBytesSize>>,
s: impl Into<GenericArray<u8, <C as Curve>::FieldBytesSize>>,
) -> Result<Signature<C>, Error>
pub fn from_scalars( r: impl Into<GenericArray<u8, <C as Curve>::FieldBytesSize>>, s: impl Into<GenericArray<u8, <C as Curve>::FieldBytesSize>>, ) -> Result<Signature<C>, Error>
Create a Signature
from the serialized r
and s
scalar values
which comprise the signature.
§Returns
Ok(signature)
if ther
ands
components are both in the valid range1..n
when serialized as concatenated big endian integers.Err(err)
if ther
and/ors
component of the signature is out-of-range when interpreted as a big endian integer.
Sourcepub fn split_bytes(
&self,
) -> (GenericArray<u8, <C as Curve>::FieldBytesSize>, GenericArray<u8, <C as Curve>::FieldBytesSize>)
pub fn split_bytes( &self, ) -> (GenericArray<u8, <C as Curve>::FieldBytesSize>, GenericArray<u8, <C as Curve>::FieldBytesSize>)
Split the signature into its r
and s
components, represented as bytes.
Sourcepub fn to_bytes(
&self,
) -> GenericArray<u8, <<C as Curve>::FieldBytesSize as Add>::Output>
pub fn to_bytes( &self, ) -> GenericArray<u8, <<C as Curve>::FieldBytesSize as Add>::Output>
Serialize this signature as bytes.
Source§impl<C> Signature<C>where
C: PrimeCurve + CurveArithmetic,
<<C as Curve>::FieldBytesSize as Add>::Output: ArrayLength<u8>,
impl<C> Signature<C>where
C: PrimeCurve + CurveArithmetic,
<<C as Curve>::FieldBytesSize as Add>::Output: ArrayLength<u8>,
Sourcepub fn r(&self) -> NonZeroScalar<C>
pub fn r(&self) -> NonZeroScalar<C>
Get the r
component of this signature
Sourcepub fn s(&self) -> NonZeroScalar<C>
pub fn s(&self) -> NonZeroScalar<C>
Get the s
component of this signature
Sourcepub fn split_scalars(&self) -> (NonZeroScalar<C>, NonZeroScalar<C>)
pub fn split_scalars(&self) -> (NonZeroScalar<C>, NonZeroScalar<C>)
Split the signature into its r
and s
scalars.
Sourcepub fn normalize_s(&self) -> Option<Signature<C>>
pub fn normalize_s(&self) -> Option<Signature<C>>
Normalize signature into “low S” form as described in BIP 0062: Dealing with Malleability.
Trait Implementations
Source§impl<C> AssociatedOid for Signature<C>
ECDSA ObjectIdentifier
which identifies the digest used by default
with the Signer
and Verifier
traits.
impl<C> AssociatedOid for Signature<C>
ECDSA ObjectIdentifier
which identifies the digest used by default
with the Signer
and Verifier
traits.
To support non-default digest algorithms, use the SignatureWithOid
type instead.
Source§const OID: ObjectIdentifier
const OID: ObjectIdentifier
Source§impl<C> From<SignatureWithOid<C>> for Signature<C>where
C: PrimeCurve,
impl<C> From<SignatureWithOid<C>> for Signature<C>where
C: PrimeCurve,
Source§fn from(sig: SignatureWithOid<C>) -> Signature<C>
fn from(sig: SignatureWithOid<C>) -> Signature<C>
Source§impl<C> FromStr for Signature<C>where
C: PrimeCurve + CurveArithmetic,
<<C as Curve>::FieldBytesSize as Add>::Output: ArrayLength<u8>,
impl<C> FromStr for Signature<C>where
C: PrimeCurve + CurveArithmetic,
<<C as Curve>::FieldBytesSize as Add>::Output: ArrayLength<u8>,
Source§impl<C> PrehashSignature for Signature<C>
impl<C> PrehashSignature for Signature<C>
Source§type Digest = <C as DigestPrimitive>::Digest
type Digest = <C as DigestPrimitive>::Digest
Digest
algorithm to use when computing this signature type.