PqdsaKeyPair

Struct PqdsaKeyPair 

Source
pub struct PqdsaKeyPair { /* private fields */ }
Available on crate feature 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

Source

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.

Source

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.

Source

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.

Source

pub fn to_pkcs8(&self) -> Result<Document, Unspecified>

Serializes the private key to PKCS#8 v1 DER.

§Errors

Returns Unspecified if serialization fails.

Source

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.

Source

pub fn algorithm(&self) -> &'static PqdsaSigningAlgorithm

Returns the signing algorithm associated with this key pair.

Source

pub fn private_key(&self) -> PqdsaPrivateKey<'_>

Returns the private key associated with this key pair.

Trait Implementations§

Source§

impl Debug for PqdsaKeyPair

Source§

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

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

impl KeyPair for PqdsaKeyPair

Source§

type PublicKey = PublicKey

The type of the public key.
Source§

fn public_key(&self) -> &Self::PublicKey

The public key for the key pair.
Source§

impl Send for PqdsaKeyPair

Source§

impl Sync for PqdsaKeyPair

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