Struct secp256k1::Signature [−][src]
pub struct Signature(_);
An ECDSA signature
Methods
impl Signature[src]
impl Signaturepub fn from_der(secp: &Secp256k1, data: &[u8]) -> Result<Signature, Error>[src]
pub fn from_der(secp: &Secp256k1, data: &[u8]) -> Result<Signature, Error>Converts a DER-encoded byte slice to a signature
pub fn from_der_lax(secp: &Secp256k1, data: &[u8]) -> Result<Signature, Error>[src]
pub fn from_der_lax(secp: &Secp256k1, data: &[u8]) -> Result<Signature, Error>Converts a "lax DER"-encoded byte slice to a signature. This is basically only useful for validating signatures in the Bitcoin blockchain from before
- It should never be used in new applications. This library does not support serializing to this "format"
pub fn normalize_s(&mut self, secp: &Secp256k1)[src]
pub fn normalize_s(&mut self, secp: &Secp256k1)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 accomodate 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 as_ptr(&self) -> *const Signature[src]
pub fn as_ptr(&self) -> *const SignatureObtains a raw pointer suitable for use with FFI functions
pub fn as_mut_ptr(&mut self) -> *mut Signature[src]
pub fn as_mut_ptr(&mut self) -> *mut SignatureObtains a raw mutable pointer suitable for use with FFI functions
pub fn serialize_der(&self, secp: &Secp256k1) -> Vec<u8>[src]
pub fn serialize_der(&self, secp: &Secp256k1) -> Vec<u8>Serializes the signature in DER format
Trait Implementations
impl Copy for Signature[src]
impl Copy for Signatureimpl Clone for Signature[src]
impl Clone for Signaturefn clone(&self) -> Signature[src]
fn clone(&self) -> SignatureReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl PartialEq for Signature[src]
impl PartialEq for Signaturefn eq(&self, other: &Signature) -> bool[src]
fn eq(&self, other: &Signature) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Signature) -> bool[src]
fn ne(&self, other: &Signature) -> boolThis method tests for !=.
impl Eq for Signature[src]
impl Eq for Signatureimpl Debug for Signature[src]
impl Debug for Signaturefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl From<Signature> for Signature[src]
impl From<Signature> for SignatureCreates a new signature from a FFI signature
impl Index<usize> for Signature[src]
impl Index<usize> for Signaturetype Output = u8
The returned type after indexing.
fn index(&self, index: usize) -> &u8[src]
fn index(&self, index: usize) -> &u8Performs the indexing (container[index]) operation.
impl Index<Range<usize>> for Signature[src]
impl Index<Range<usize>> for Signaturetype Output = [u8]
The returned type after indexing.
fn index(&self, index: Range<usize>) -> &[u8][src]
fn index(&self, index: Range<usize>) -> &[u8]Performs the indexing (container[index]) operation.
impl Index<RangeFrom<usize>> for Signature[src]
impl Index<RangeFrom<usize>> for Signaturetype Output = [u8]
The returned type after indexing.
fn index(&self, index: RangeFrom<usize>) -> &[u8][src]
fn index(&self, index: RangeFrom<usize>) -> &[u8]Performs the indexing (container[index]) operation.
impl Index<RangeFull> for Signature[src]
impl Index<RangeFull> for Signature