pub struct PqdsaKeyPair { /* private fields */ }
unstable
and non-crate feature fips
only.Expand description
A PQDSA (Post-Quantum Digital Signature Algorithm) key pair, used for signing and verification.
Implementations§
Source§impl PqdsaKeyPair
impl PqdsaKeyPair
Sourcepub fn generate(
algorithm: &'static PqdsaSigningAlgorithm,
) -> Result<Self, Unspecified>
pub fn generate( algorithm: &'static PqdsaSigningAlgorithm, ) -> Result<Self, Unspecified>
Generates a new PQDSA key pair for the specified algorithm.
§Errors
Returns Unspecified
is the key generation fails.
Sourcepub fn from_pkcs8(
algorithm: &'static PqdsaSigningAlgorithm,
pkcs8: &[u8],
) -> Result<Self, KeyRejected>
pub fn from_pkcs8( algorithm: &'static PqdsaSigningAlgorithm, pkcs8: &[u8], ) -> Result<Self, KeyRejected>
Constructs a key pair from the parsing of PKCS#8.
§Errors
Returns Unspecified
if the key is not valid for the specified signing algorithm.
Sourcepub fn from_raw_private_key(
algorithm: &'static PqdsaSigningAlgorithm,
raw_private_key: &[u8],
) -> Result<Self, KeyRejected>
pub fn from_raw_private_key( algorithm: &'static PqdsaSigningAlgorithm, raw_private_key: &[u8], ) -> Result<Self, KeyRejected>
Constructs a key pair from raw private key bytes.
§Errors
Returns Unspecified
if the key is not valid for the specified signing algorithm.
Sourcepub fn to_pkcs8(&self) -> Result<Document, Unspecified>
pub fn to_pkcs8(&self) -> Result<Document, Unspecified>
Sourcepub fn sign(
&self,
msg: &[u8],
signature: &mut [u8],
) -> Result<usize, Unspecified>
pub fn sign( &self, msg: &[u8], signature: &mut [u8], ) -> Result<usize, Unspecified>
Uses this key to sign the message provided. The signature is written to the signature
slice provided. It returns the length of the signature on success.
§Errors
Returns Unspecified
if signing fails.
Sourcepub fn algorithm(&self) -> &'static PqdsaSigningAlgorithm
pub fn algorithm(&self) -> &'static PqdsaSigningAlgorithm
Returns the signing algorithm associated with this key pair.
Sourcepub fn private_key(&self) -> PqdsaPrivateKey<'_>
pub fn private_key(&self) -> PqdsaPrivateKey<'_>
Returns the private key associated with this key pair.