pub trait AsymmetricCryptosystem {
type PublicKey: EncryptionKey;
type SecretKey: DecryptionKey<Self::PublicKey>;
fn setup(security_parameter: &BitsOfSecurity) -> Self;
fn generate_keys<R: SecureRng>(
&self,
rng: &mut GeneralRng<R>
) -> (Self::PublicKey, Self::SecretKey);
}
Expand description
An asymmetric cryptosystem is a system of methods to encrypt plaintexts into ciphertexts, and decrypt those ciphertexts back into plaintexts. Anyone who has access to the public key can perform encryptions, but only those with the secret key can decrypt.
The struct that implements an AsymmetricCryptosystem
will hold the general parameters of that
cryptosystem. Depending on the cryptosystem, those parameters could play an important role in
deciding the level of security. As such, each cryptosystem should clearly indicate these.
Required Associated Types
type PublicKey: EncryptionKey
type PublicKey: EncryptionKey
The public key, used for encrypting plaintexts.
type SecretKey: DecryptionKey<Self::PublicKey>
type SecretKey: DecryptionKey<Self::PublicKey>
The secret key, used for decrypting ciphertexts.
Required Methods
fn setup(security_parameter: &BitsOfSecurity) -> Self
fn setup(security_parameter: &BitsOfSecurity) -> Self
Sets up an instance of this cryptosystem with parameters satisfying the security parameter.
fn generate_keys<R: SecureRng>(
&self,
rng: &mut GeneralRng<R>
) -> (Self::PublicKey, Self::SecretKey)
fn generate_keys<R: SecureRng>(
&self,
rng: &mut GeneralRng<R>
) -> (Self::PublicKey, Self::SecretKey)
Generate a public and private key pair using a cryptographic RNG. The level of security is
determined by the computational security_parameter
.