Struct Signature

Source
pub struct Signature<P: MlDsaParams> { /* private fields */ }
Expand description

An ML-DSA signature

Implementations§

Source§

impl<P: MlDsaParams> Signature<P>

Source

pub fn encode(&self) -> EncodedSignature<P>

Encode the signature in a fixed-size byte array.

Source

pub fn decode(enc: &EncodedSignature<P>) -> Option<Self>

Decode the signature from an appropriately sized byte array.

Trait Implementations§

Source§

impl<P> AssociatedAlgorithmIdentifier for Signature<P>
where P: MlDsaParams + AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,

Available on crate feature pkcs8 only.
Source§

const ALGORITHM_IDENTIFIER: AlgorithmIdentifierRef<'static> = P::ALGORITHM_IDENTIFIER

AlgorithmIdentifier for this structure.
Source§

type Params = AnyRef<'static>

Algorithm parameters.
Source§

impl<P: Clone + MlDsaParams> Clone for Signature<P>
where P::Lambda: Clone, P::L: Clone,

Source§

fn clone(&self) -> Signature<P>

Returns a duplicate 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<P: Debug + MlDsaParams> Debug for Signature<P>
where P::Lambda: Debug, P::L: Debug,

Source§

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

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

impl<P: PartialEq + MlDsaParams> PartialEq for Signature<P>
where P::Lambda: PartialEq, P::L: PartialEq,

Source§

fn eq(&self, other: &Signature<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P: MlDsaParams> RandomizedSigner<Signature<P>> for SigningKey<P>

Available on crate feature rand_core only.

The RandomizedSigner implementation for SigningKey only supports signing with an empty context string. If you would like to include a context string, use the [SigningKey::sign] method.

Source§

fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8], ) -> Result<Signature<P>, 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_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S

Sign the given message and return a digital signature
Source§

impl<P: MlDsaParams> SignatureBitStringEncoding for Signature<P>

Available on crate feature alloc only.
Source§

fn to_bitstring(&self) -> Result<BitString>

BitString encoding for this signature.
Source§

impl<P: MlDsaParams> SignatureEncoding for Signature<P>

Source§

type Repr = Array<u8, <P as SignatureParams>::SignatureSize>

Byte representation of a signature.
Source§

fn to_bytes(&self) -> Self::Repr

Encode signature as its byte representation.
Source§

fn encoded_len(&self) -> usize

Get the length of this signature when encoded.
Source§

impl<P: MlDsaParams> Signer<Signature<P>> for KeyPair<P>

The Signer implementation for KeyPair uses the optional deterministic variant of ML-DSA, and only supports signing with an empty context string.

Source§

fn try_sign(&self, msg: &[u8]) -> Result<Signature<P>, 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<P: MlDsaParams> Signer<Signature<P>> for SigningKey<P>

The Signer implementation for SigningKey uses the optional deterministic variant of ML-DSA, and only supports signing with an empty context string. If you would like to include a context string, use the SigningKey::sign_deterministic method.

Source§

fn try_sign(&self, msg: &[u8]) -> Result<Signature<P>, 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<'a, P: MlDsaParams> TryFrom<&'a [u8]> for Signature<P>

Source§

type Error = Error

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

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

Performs the conversion.
Source§

impl<P: MlDsaParams> TryInto<Array<u8, <P as SignatureParams>::SignatureSize>> for Signature<P>

Source§

type Error = Error

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

fn try_into(self) -> Result<EncodedSignature<P>, Self::Error>

Performs the conversion.
Source§

impl<P: MlDsaParams> Verifier<Signature<P>> for VerifyingKey<P>

Source§

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

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

impl<P: MlDsaParams> StructuralPartialEq for Signature<P>

Auto Trait Implementations§

§

impl<P> Freeze for Signature<P>
where <<P as ParameterSet>::Lambda as ArraySize>::ArrayType<u8>: Freeze, <<P as ParameterSet>::L as ArraySize>::ArrayType<Polynomial<BaseField>>: Freeze, <<P as ParameterSet>::K as ArraySize>::ArrayType<Array<bool, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>>: Freeze,

§

impl<P> RefUnwindSafe for Signature<P>
where <<P as ParameterSet>::Lambda as ArraySize>::ArrayType<u8>: RefUnwindSafe, <<P as ParameterSet>::L as ArraySize>::ArrayType<Polynomial<BaseField>>: RefUnwindSafe, <<P as ParameterSet>::K as ArraySize>::ArrayType<Array<bool, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>>: RefUnwindSafe,

§

impl<P> Send for Signature<P>

§

impl<P> Sync for Signature<P>

§

impl<P> Unpin for Signature<P>
where <<P as ParameterSet>::Lambda as ArraySize>::ArrayType<u8>: Unpin, <<P as ParameterSet>::L as ArraySize>::ArrayType<Polynomial<BaseField>>: Unpin, <<P as ParameterSet>::K as ArraySize>::ArrayType<Array<bool, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>>: Unpin,

§

impl<P> UnwindSafe for Signature<P>
where <<P as ParameterSet>::Lambda as ArraySize>::ArrayType<u8>: UnwindSafe, <<P as ParameterSet>::L as ArraySize>::ArrayType<Polynomial<BaseField>>: UnwindSafe, <<P as ParameterSet>::K as ArraySize>::ArrayType<Array<bool, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>>: UnwindSafe,

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
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynAssociatedAlgorithmIdentifier for T

Source§

fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>

AlgorithmIdentifier for this structure.
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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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.