GnuPGContextGenerateKeyPair Method

Generate a new key pair.

Definition

Namespace: MimeKit.Cryptography
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
C#
public void GenerateKeyPair(
	MailboxAddress mailbox,
	string password,
	DateTime? expirationDate = null,
	EncryptionAlgorithm algorithm = EncryptionAlgorithm.Aes256,
	SecureRandom? random = null
)

Parameters

mailbox  MailboxAddress
The mailbox to generate the key pair for.
password  String
The password to be set on the secret key.
expirationDate  NullableDateTime  (Optional)
The expiration date for the generated key pair.
algorithm  EncryptionAlgorithm  (Optional)
The symmetric key algorithm to use.
random  SecureRandom  (Optional)
The source of randomness to use when generating the key pair.

Remarks

Generates a new RSA key pair.

The enabled encryption algorithms (see EnabledEncryptionAlgorithms) and the enabled digest algorithms (see EnabledDigestAlgorithms) are stored, in ranked order, in the generated key's preferred symmetric algorithms and preferred hash algorithms signature subpackets.

Exceptions

ArgumentNullException

mailbox is .

-or-

password is .

ArgumentException expirationDate is not a date in the future.

See Also