Exports public key from this OpenPGP key store, into file.

Namespace: DidiSoft.Pgp
Assembly: DidiSoft.Pgp (in DidiSoft.Pgp.dll) Version: 1.7.3.35547

Syntax

C#
public virtual void ExportPublicKey(
	string fileName,
	string userId,
	bool asciiArmored
)
Visual Basic
Public Overridable Sub ExportPublicKey ( _
	fileName As String, _
	userId As String, _
	asciiArmored As Boolean _
)
Visual C++
public:
virtual void ExportPublicKey(
	String^ fileName, 
	String^ userId, 
	bool asciiArmored
)

Parameters

fileName
Type: System..::..String
File name where the public key will be exported (absolute or relative path)
userId
Type: System..::..String
User Id of the form "name (comment) <email address>"
asciiArmored
Type: System..::..Boolean
If true, output is in ASCII armored format

Examples

CopyC#
using System;
using DidiSoft.Pgp;

public class ExportKeys
{
   public void Demo()
   {
       KeyStore ks = new KeyStore(@"C:\Test\key.store", "changeit");
       bool asciiArmored = true;
       ks.ExportPublicKey(@"C:\Test\public_key_exported.pkr", "support@didisoft.com", asciiArmored);
   }
}
CopyVB.NET
Imports System
Imports DidiSoft.Pgp

Public Class ExportKeys
   Public Sub Demo()
       Dim ks As New KeyStore("C:\Test\key.store", "changeit")
       Dim asciiArmored As Boolean = True
       ks.ExportPublicKey("C:\Test\public_key_exported.pkr", "support@didisoft.com", asciiArmored)
   End Sub
End Class

Exceptions

ExceptionCondition
DidiSoft.Pgp.Exceptions..::..WrongPublicKeyExceptionIf there is no such key
System.IO..::..IOExceptionIf file writing error occur

See Also