Struct dsa::Signature

source ·
pub struct Signature { /* private fields */ }
Expand description

Container of the DSA signature

Implementations§

source§

impl Signature

source

pub fn from_components(r: BigUint, s: BigUint) -> Result<Self>

Create a new Signature container from its components

source

pub fn r(&self) -> &BigUint

Signature part r

source

pub fn s(&self) -> &BigUint

Signature part s

Trait Implementations§

source§

impl Clone for Signature

source§

fn clone(&self) -> Signature

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Signature

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> DecodeValue<'a> for Signature

source§

fn decode_value<R: Reader<'a>>(reader: &mut R, header: Header) -> Result<Self>

Attempt to decode this message using the provided [Reader].
source§

impl<D> DigestSigner<D, Signature> for SigningKey
where D: Digest + BlockSizeUser + FixedOutputReset,

source§

fn try_sign_digest(&self, digest: D) -> Result<Signature, Error>

Attempt to sign the given prehashed message Digest, returning a digital signature on success, or an error if something went wrong.
source§

fn sign_digest(&self, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<D> DigestVerifier<D, Signature> for VerifyingKey
where D: Digest,

source§

fn verify_digest(&self, digest: D, signature: &Signature) -> Result<(), Error>

Verify the signature against the given Digest output.
source§

impl EncodeValue for Signature

source§

fn value_len(&self) -> Result<Length>

Compute the length of this value (sans [Tag]+[Length] header) when encoded as ASN.1 DER.
source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Encode value (sans [Tag]+[Length] header) as ASN.1 DER using the provided [Writer].
§

fn header(&self) -> Result<Header, Error>
where Self: Tagged,

Get the [Header] used to encode this value.
source§

impl From<Signature> for Box<[u8]>

source§

fn from(sig: Signature) -> Box<[u8]>

Converts to this type from the input type.
source§

impl PartialEq for Signature

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Signature

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PrehashSigner<Signature> for SigningKey

source§

fn sign_prehash(&self, prehash: &[u8]) -> Result<Signature, Error>

Warning: This uses sha2::Sha256 as the hash function for the digest. If you need to use a different one, use SigningKey::sign_prehashed_rfc6979.

source§

impl PrehashVerifier<Signature> for VerifyingKey

source§

fn verify_prehash( &self, prehash: &[u8], signature: &Signature ) -> Result<(), Error>

Use Self to verify that the provided signature for a given message prehash is authentic. Read more
source§

impl<D> RandomizedDigestSigner<D, Signature> for SigningKey
where D: Digest,

source§

fn try_sign_digest_with_rng( &self, rng: &mut impl CryptoRngCore, digest: D ) -> Result<Signature, Error>

Attempt to sign the given prehashed message Digest, returning a digital signature on success, or an error if something went wrong.
source§

fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl RandomizedPrehashSigner<Signature> for SigningKey

source§

fn sign_prehash_with_rng( &self, rng: &mut impl CryptoRngCore, prehash: &[u8] ) -> Result<Signature, Error>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong. Read more
source§

impl SignatureEncoding for Signature

§

type Repr = Box<[u8]>

Byte representation of a signature.
source§

fn to_bytes(&self) -> Box<[u8]>

Encode signature as its byte representation.
source§

fn to_vec(&self) -> Vec<u8>

Encode signature as a byte vector.
source§

fn encoded_len(&self) -> usize

Get the length of this signature when encoded.
source§

impl Signer<Signature> for SigningKey

source§

fn try_sign(&self, msg: &[u8]) -> Result<Signature, Error>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
source§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature
source§

impl TryFrom<&[u8]> for Signature

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(bytes: &[u8]) -> Result<Self>

Performs the conversion.
source§

impl Verifier<Signature> for VerifyingKey

source§

fn verify(&self, msg: &[u8], signature: &Signature) -> Result<(), Error>

Use Self to verify that the provided signature for a given message bytestring is authentic. Read more
source§

impl<'a> Sequence<'a> for Signature

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<'a, T> Choice<'a> for T
where T: Decode<'a> + FixedTag,

§

fn can_decode(tag: Tag) -> bool

Is the provided [Tag] decodable as a variant of this CHOICE?
§

impl<'a, T> Decode<'a> for T
where T: DecodeValue<'a> + FixedTag,

§

fn decode<R>(reader: &mut R) -> Result<T, Error>
where R: Reader<'a>,

Attempt to decode this message using the provided decoder.
§

fn from_der(bytes: &'a [u8]) -> Result<Self, Error>

Parse Self from the provided DER-encoded byte slice.
§

impl<T> Encode for T
where T: EncodeValue + Tagged,

§

fn encoded_len(&self) -> Result<Length, Error>

Compute the length of this value in bytes when encoded as ASN.1 DER.

§

fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>

Encode this value as ASN.1 DER using the provided [Writer].

§

fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>

Encode this value to the provided byte slice, returning a sub-slice containing the encoded message.
§

fn encode_to_vec(&self, buf: &mut Vec<u8>) -> Result<Length, Error>

Encode this message as ASN.1 DER, appending it to the provided byte vector.
§

fn to_der(&self) -> Result<Vec<u8>, Error>

Encode this type as DER, returning a byte vector.
§

impl<'a, S> FixedTag for S
where S: Sequence<'a>,

§

const TAG: Tag = Tag::Sequence

ASN.1 tag
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> Tagged for T
where T: FixedTag,

§

fn tag(&self) -> Tag

Get the ASN.1 tag that this type is encoded with.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> DecodeOwned for T
where T: for<'a> Decode<'a>,