pub type Signature = Signature<Secp256k1>;
Expand description
ECDSA/secp256k1 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>
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<'de, C> Deserialize<'de> for Signature<C>
impl<'de, C> Deserialize<'de> for Signature<C>
source§fn deserialize<D>(
deserializer: D,
) -> Result<Signature<C>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Signature<C>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
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> PartialEq for Signature<C>where
C: PartialEq + PrimeCurve,
impl<C> PartialEq for Signature<C>where
C: PartialEq + PrimeCurve,
source§impl<C> PrehashSignature for Signature<C>
impl<C> PrehashSignature for Signature<C>
§type Digest = <C as DigestPrimitive>::Digest
type Digest = <C as DigestPrimitive>::Digest
Digest
algorithm to use when computing this signature type.