pub struct MlDsa44Key { /* private fields */ }Expand description
An ML-DSA-44 private key for mldsa44 signing (DKIM2 only,
draft-ietf-dkim-dkim2-spec Section 3.4).
Signatures use “pure” ML-DSA-44 (FIPS 204) with the DKIM2 context
string. They are hedged (randomized), as the specification recommends, so
signing the same input twice gives different signatures.
Implementations§
Source§impl MlDsa44Key
impl MlDsa44Key
Sourcepub fn generate_pkcs8() -> Result<Vec<u8>>
pub fn generate_pkcs8() -> Result<Vec<u8>>
Generates a new random key and returns it as PKCS #8 DER bytes (the
RFC 9881 seed-only private key encoding), ready for
from_pkcs8_der.
§Errors
Returns Error::Crypto with CryptoError::Library if the system
random number generator fails.
Sourcepub fn from_pkcs8_der(pkcs8_der: &[u8]) -> Result<Self>
pub fn from_pkcs8_der(pkcs8_der: &[u8]) -> Result<Self>
Loads a key from PKCS #8 DER bytes holding an ML-DSA-44 private key in the RFC 9881 seed-only or both (seed and expanded key) form. The key is derived from the seed.
§Errors
Returns Error::Crypto with CryptoError::Library if the key
cannot be decoded or has no seed.
Sourcepub fn from_raw_private_key(raw: &[u8]) -> Result<Self>
pub fn from_raw_private_key(raw: &[u8]) -> Result<Self>
Loads a key from its 32-byte seed.
§Errors
Returns Error::Crypto with CryptoError::Library if the seed
has the wrong length or cannot be expanded.
Sourcepub fn public_key(&self) -> Result<Vec<u8>>
pub fn public_key(&self) -> Result<Vec<u8>>
Returns the 1312-byte ML-DSA-44 public key, as published in the p=
tag of a k=mldsa44 key record.
§Errors
Returns Error::Crypto with CryptoError::Library if the backend
cannot export the public key.
Trait Implementations§
Source§impl From<MlDsa44Key> for DkimKey
Available on crate features aws-lc-rs or rust-crypto only.
impl From<MlDsa44Key> for DkimKey
aws-lc-rs or rust-crypto only.Source§fn from(key: MlDsa44Key) -> Self
fn from(key: MlDsa44Key) -> Self
Source§impl SigningKey for MlDsa44Key
impl SigningKey for MlDsa44Key
Source§fn sign(&self, input: impl Writable) -> Result<Vec<u8>>
fn sign(&self, input: impl Writable) -> Result<Vec<u8>>
input and returns the raw signature. Read moreSource§fn heap_size(&self) -> usize
fn heap_size(&self) -> usize
Source§fn hash(&self, data: impl Writable) -> HashOutput
fn hash(&self, data: impl Writable) -> HashOutput
data with Self::Hasher.Auto Trait Implementations§
impl Freeze for MlDsa44Key
impl RefUnwindSafe for MlDsa44Key
impl Send for MlDsa44Key
impl Sync for MlDsa44Key
impl Unpin for MlDsa44Key
impl UnsafeUnpin for MlDsa44Key
impl UnwindSafe for MlDsa44Key
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more