pub struct VerifyingKey<P: ParameterSet> {
pub(crate) rho: B32,
pub(crate) t1: Vector<BaseField, P::K>,
pub(crate) A_hat: NttMatrix<BaseField, P::K, P::L>,
pub(crate) t1_2d_hat: NttVector<BaseField, P::K>,
pub(crate) tr: Array<u8, U64>,
}Expand description
An ML-DSA verification key
Fields§
§rho: B32§t1: Vector<BaseField, P::K>§A_hat: NttMatrix<BaseField, P::K, P::L>§t1_2d_hat: NttVector<BaseField, P::K>§tr: Array<u8, U64>Implementations§
Source§impl<P: MlDsaParams> VerifyingKey<P>
impl<P: MlDsaParams> VerifyingKey<P>
pub(crate) fn new( rho: B32, t1: Vector<BaseField, P::K>, A_hat: Option<NttMatrix<BaseField, P::K, P::L>>, enc: Option<EncodedVerifyingKey<P>>, ) -> Self
Sourcepub fn verify_internal(&self, Mp: &[&[u8]], sigma: &Signature<P>) -> boolwhere
P: MlDsaParams,
pub fn verify_internal(&self, Mp: &[&[u8]], sigma: &Signature<P>) -> boolwhere
P: MlDsaParams,
This algorithm reflects the ML-DSA.Verify_internal algorithm from FIPS 204. It does not include the domain separator that distinguishes between the normal and pre-hashed cases, and it does not separate the context string from the rest of the message.
Sourcepub fn verify_with_context(
&self,
M: &[u8],
ctx: &[u8],
sigma: &Signature<P>,
) -> bool
pub fn verify_with_context( &self, M: &[u8], ctx: &[u8], sigma: &Signature<P>, ) -> bool
This algorithm reflect the ML-DSA.Verify algorithm from FIPS 204.
pub(crate) fn encode_internal( rho: &B32, t1: &Vector<BaseField, P::K>, ) -> EncodedVerifyingKey<P>
Sourcepub fn encode(&self) -> EncodedVerifyingKey<P>
pub fn encode(&self) -> EncodedVerifyingKey<P>
Encode the key in a fixed-size byte array.
Sourcepub fn decode(enc: &EncodedVerifyingKey<P>) -> Self
pub fn decode(enc: &EncodedVerifyingKey<P>) -> Self
Decode the key from an appropriately sized byte array.
Trait Implementations§
Source§impl<P: MlDsaParams> AsRef<VerifyingKey<P>> for KeyPair<P>
impl<P: MlDsaParams> AsRef<VerifyingKey<P>> for KeyPair<P>
Source§fn as_ref(&self) -> &VerifyingKey<P>
fn as_ref(&self) -> &VerifyingKey<P>
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<P: Clone + ParameterSet> Clone for VerifyingKey<P>
impl<P: Clone + ParameterSet> Clone for VerifyingKey<P>
Source§fn clone(&self) -> VerifyingKey<P>
fn clone(&self) -> VerifyingKey<P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<P: Debug + ParameterSet> Debug for VerifyingKey<P>
impl<P: Debug + ParameterSet> Debug for VerifyingKey<P>
Source§impl<P> EncodePublicKey for VerifyingKey<P>
impl<P> EncodePublicKey for VerifyingKey<P>
Source§fn to_public_key_der(&self) -> Result<Document>
fn to_public_key_der(&self) -> Result<Document>
Serialize a
Document containing a SPKI-encoded public key.Source§fn to_public_key_pem(&self, line_ending: LineEnding) -> Result<String, Error>
fn to_public_key_pem(&self, line_ending: LineEnding) -> Result<String, Error>
Serialize this public key as PEM-encoded SPKI with the given
LineEnding.Source§fn write_public_key_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
fn write_public_key_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
Write ASN.1 DER-encoded public key to the given path
Source§fn write_public_key_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding,
) -> Result<(), Error>
fn write_public_key_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding, ) -> Result<(), Error>
Write ASN.1 DER-encoded public key to the given path
Source§impl<P: PartialEq + ParameterSet> PartialEq for VerifyingKey<P>
impl<P: PartialEq + ParameterSet> PartialEq for VerifyingKey<P>
Source§impl<P> SignatureAlgorithmIdentifier for VerifyingKey<P>
impl<P> SignatureAlgorithmIdentifier for VerifyingKey<P>
Source§const SIGNATURE_ALGORITHM_IDENTIFIER: AlgorithmIdentifier<Self::Params> = Signature<P>::ALGORITHM_IDENTIFIER
const SIGNATURE_ALGORITHM_IDENTIFIER: AlgorithmIdentifier<Self::Params> = Signature<P>::ALGORITHM_IDENTIFIER
AlgorithmIdentifier for the corresponding singature system.Source§impl<P> TryFrom<SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>>> for VerifyingKey<P>
impl<P> TryFrom<SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>>> for VerifyingKey<P>
Source§impl<P: MlDsaParams> Verifier<Signature<P>> for VerifyingKey<P>
impl<P: MlDsaParams> Verifier<Signature<P>> for VerifyingKey<P>
impl<P: ParameterSet> StructuralPartialEq for VerifyingKey<P>
Auto Trait Implementations§
impl<P> Freeze for VerifyingKey<P>where
<<P as ParameterSet>::K as ArraySize>::ArrayType<Polynomial<BaseField>>: Freeze,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttVector<BaseField, <P as ParameterSet>::L>>: Freeze,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttPolynomial<BaseField>>: Freeze,
impl<P> RefUnwindSafe for VerifyingKey<P>where
<<P as ParameterSet>::K as ArraySize>::ArrayType<Polynomial<BaseField>>: RefUnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttVector<BaseField, <P as ParameterSet>::L>>: RefUnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttPolynomial<BaseField>>: RefUnwindSafe,
impl<P> Send for VerifyingKey<P>
impl<P> Sync for VerifyingKey<P>
impl<P> Unpin for VerifyingKey<P>where
<<P as ParameterSet>::K as ArraySize>::ArrayType<Polynomial<BaseField>>: Unpin,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttVector<BaseField, <P as ParameterSet>::L>>: Unpin,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttPolynomial<BaseField>>: Unpin,
impl<P> UnwindSafe for VerifyingKey<P>where
<<P as ParameterSet>::K as ArraySize>::ArrayType<Polynomial<BaseField>>: UnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttVector<BaseField, <P as ParameterSet>::L>>: UnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttPolynomial<BaseField>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodePublicKey for T
impl<T> DecodePublicKey for T
Source§fn from_public_key_der(bytes: &[u8]) -> Result<T, Error>
fn from_public_key_der(bytes: &[u8]) -> Result<T, Error>
Deserialize object from ASN.1 DER-encoded [
SubjectPublicKeyInfo]
(binary format).Source§fn from_public_key_pem(s: &str) -> Result<Self, Error>
fn from_public_key_pem(s: &str) -> Result<Self, Error>
Deserialize PEM-encoded [
SubjectPublicKeyInfo]. Read moreSource§impl<T> DynSignatureAlgorithmIdentifier for Twhere
T: SignatureAlgorithmIdentifier,
impl<T> DynSignatureAlgorithmIdentifier for Twhere
T: SignatureAlgorithmIdentifier,
Source§fn signature_algorithm_identifier(
&self,
) -> Result<AlgorithmIdentifier<Any>, Error>
fn signature_algorithm_identifier( &self, ) -> Result<AlgorithmIdentifier<Any>, Error>
AlgorithmIdentifier for the corresponding singature system.