There's currently nothing in traits.rs for this.
My learned machine colleague suggests a natural fit for the public/private key classes would be:
pub trait SignatureKeyPairGenerator<
PK: SignaturePublicKey<PK_LEN>,
SK: SignaturePrivateKey<SK_LEN>,
const PK_LEN: usize,
const SK_LEN: usize,
>
{
/// Generates a key pair using the library's default OS-backed RNG.
fn keygen() -> Result<(PK, SK), SignatureError>;
/// Generates a key pair using the provided RNG.
fn keygen_from_rng(rng: &mut dyn RNG) -> Result<(PK, SK), SignatureError>;
}
and
pub trait KEMKeyPairGenerator<
PK: KEMPublicKey<PK_LEN>,
SK: KEMPrivateKey<SK_LEN>,
const PK_LEN: usize,
const SK_LEN: usize,
>
{
/// Generates a key pair using the library's default OS-backed RNG.
fn keygen() -> Result<(PK, SK), KEMError>;
/// Generates a key pair using the provided RNG.
fn keygen_from_rng(rng: &mut dyn RNG) -> Result<(PK, SK), KEMError>;
}
These could then be combined with the appropriate types to simplify the notation for invoking one.
It's possible that KEMKeyPairGenerator might be better as EncryptionKeyPairGenerator in-case RSA/OAEP get's added at a later date, XDH might be another candidate for "Encryption" although again, it and Diffie-Hellman might deserve "Agreement".
There's currently nothing in traits.rs for this.
My learned machine colleague suggests a natural fit for the public/private key classes would be:
and
These could then be combined with the appropriate types to simplify the notation for invoking one.
It's possible that KEMKeyPairGenerator might be better as EncryptionKeyPairGenerator in-case RSA/OAEP get's added at a later date, XDH might be another candidate for "Encryption" although again, it and Diffie-Hellman might deserve "Agreement".