NET PGP Library
GenerateKeyPairFiles Method
Example 



KellermanSoftware.NetPgpLibrary Namespace > PgpEncryptorDecryptor Class : GenerateKeyPairFiles Method
The user name for the keys
The password for the keys
A fully qualified file path to output the public key
A full qualitied file path to outoput the private key
Generate a pair of public and private keys
Syntax
'Declaration
 
Public Sub GenerateKeyPairFiles( _
   ByVal username As String, _
   ByVal password As String, _
   ByVal publicKeyFilePath As String, _
   ByVal privateKeyFilePath As String _
) 
'Usage
 
Dim instance As PgpEncryptorDecryptor
Dim username As String
Dim password As String
Dim publicKeyFilePath As String
Dim privateKeyFilePath As String
 
instance.GenerateKeyPairFiles(username, password, publicKeyFilePath, privateKeyFilePath)

Parameters

username
The user name for the keys
password
The password for the keys
publicKeyFilePath
A fully qualified file path to output the public key
privateKeyFilePath
A full qualitied file path to outoput the private key
Example
PgpEncryptorDecryptor pgpEncryptorDecryptor = new PgpEncryptorDecryptor(); //Trial Mode
//PgpEncryptorDecryptor pgpEncryptorDecryptor = new PgpEncryptorDecryptor("place user name here", "place license key here"); //License Mode
 
//Parameters
string username = "username";
string password = "password";
string directoryForKeys = Directory.GetCurrentDirectory();
string publicKeyFilePath = Path.Combine(directoryForKeys, "public.asc");
string privateKeyFilePath = Path.Combine(directoryForKeys, "private.asc");
 
pgpEncryptorDecryptor.GenerateKeyPairFiles(username, password, publicKeyFilePath, privateKeyFilePath);
 
Console.WriteLine(publicKeyFilePath);
Console.WriteLine(privateKeyFilePath);
Dim pgpEncryptorDecryptor As New PgpEncryptorDecryptor() 'Trial Mode
'Dim pgpEncryptorDecryptorLicensed As New PgpEncryptorDecryptor("place user name here", "place license key here") //License Mode
 
'Parameters
Dim username As String = "username"
Dim password As String = "password"
Dim directoryForKeys As String = Directory.GetCurrentDirectory()
Dim publicKeyFilePath As String = Path.Combine(directoryForKeys, "public.asc")
Dim privateKeyFilePath As String = Path.Combine(directoryForKeys, "private.asc")
 
pgpEncryptorDecryptor.GenerateKeyPairFiles(username, password, publicKeyFilePath, privateKeyFilePath)
 
Console.WriteLine(publicKeyFilePath)
Console.WriteLine(privateKeyFilePath)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PgpEncryptorDecryptor Class
PgpEncryptorDecryptor Members