[][src]Struct secp256k1::Signature

pub struct Signature {
    pub r: Scalar,
    pub s: Scalar,
}

An ECDSA signature.

Fields

r: Scalars: Scalar

Methods

impl Signature
[src]

pub fn parse(p: &[u8; 64]) -> Signature
[src]

pub fn parse_slice(p: &[u8]) -> Result<Signature, Error>
[src]

pub fn parse_der(p: &[u8]) -> Result<Signature, Error>
[src]

pub fn parse_der_lax(p: &[u8]) -> Result<Signature, Error>
[src]

Converts a "lax DER"-encoded byte slice to a signature. This is basically only useful for validating signatures in the Bitcoin blockchain from before

  1. It should never be used in new applications. This library does not support serializing to this "format"

pub fn normalize_s(&mut self)
[src]

Normalizes a signature to a "low S" form. In ECDSA, signatures are of the form (r, s) where r and s are numbers lying in some finite field. The verification equation will pass for (r, s) iff it passes for (r, -s), so it is possible to ``modify'' signatures in transit by flipping the sign of s. This does not constitute a forgery since the signed message still cannot be changed, but for some applications, changing even the signature itself can be a problem. Such applications require a "strong signature". It is believed that ECDSA is a strong signature except for this ambiguity in the sign of s, so to accommodate these applications libsecp256k1 will only accept signatures for which s is in the lower half of the field range. This eliminates the ambiguity.

However, for some systems, signatures with high s-values are considered valid. (For example, parsing the historic Bitcoin blockchain requires this.) For these applications we provide this normalization function, which ensures that the s value lies in the lower half of its range.

pub fn serialize(&self) -> [u8; 64]
[src]

pub fn serialize_der(&self) -> SignatureArray
[src]

Trait Implementations

impl Debug for Signature
[src]

impl PartialEq<Signature> for Signature
[src]

impl Eq for Signature
[src]

impl Clone for Signature
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Signature

impl Sync for Signature

Blanket Implementations

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> From for T
[src]

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

impl<T> Same for T
[src]

type Output = T

Should always be Self