[−][src]Struct secp256k1::Signature
An ECDSA signature
Methods
impl Signature
[src]
pub fn from_der(data: &[u8]) -> Result<Signature, Error>
[src]
Converts a DER-encoded byte slice to a signature
pub fn from_compact(data: &[u8]) -> Result<Signature, Error>
[src]
Converts a 64-byte compact-encoded byte slice to a signature
pub fn from_der_lax(data: &[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 2016. 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 as_ptr(&self) -> *const Signature
[src]
Obtains a raw pointer suitable for use with FFI functions
pub fn as_mut_ptr(&mut self) -> *mut Signature
[src]
Obtains a raw mutable pointer suitable for use with FFI functions
pub fn serialize_der(&self) -> SerializedSignature
[src]
Serializes the signature in DER format
pub fn serialize_compact(&self) -> [u8; 64]
[src]
Serializes the signature in compact format
Trait Implementations
impl CPtr for Signature
[src]
type Target = Signature
fn as_c_ptr(&self) -> *const Self::Target
[src]
fn as_mut_c_ptr(&mut self) -> *mut Self::Target
[src]
impl Clone for Signature
[src]
impl Copy for Signature
[src]
impl Debug for Signature
[src]
impl<'de> Deserialize<'de> for Signature
[src]
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Signature, D::Error>
[src]
impl Display for Signature
[src]
impl Eq for Signature
[src]
impl From<Signature> for Signature
[src]
Creates a new signature from a FFI signature
impl FromStr for Signature
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Signature, Error>
[src]
impl PartialEq<Signature> for Signature
[src]
impl Serialize for Signature
[src]
impl StructuralEq for Signature
[src]
impl StructuralPartialEq for Signature
[src]
Auto Trait Implementations
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnwindSafe for Signature
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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>,