Click or drag to resize
MimeKit

GnuPGContextGenerateKeyPair Method

Generate a new key pair.

Namespace: MimeKit.Cryptography
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
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.
Exceptions
ExceptionCondition
ArgumentNullException

mailbox is null.

-or-

password is null.

ArgumentExceptionexpirationDate is not a date in the future.
Remarks
Generates a new RSA key pair.
See Also