Exports private key from this OpenPGP key store as a String in ASCII armored format.

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

Syntax

C#
public virtual string ExportPrivateKeyAsString(
	string userId
)
Visual Basic
Public Overridable Function ExportPrivateKeyAsString ( _
	userId As String _
) As String
Visual C++
public:
virtual String^ ExportPrivateKeyAsString(
	String^ userId
)

Parameters

userId
Type: System..::..String
User Id of the form "name (comment) <email address>"

Return Value

requested Private key 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");
       String keyAscii = ks.ExportPrivateKeyAsString("support@didisoft.com");
   }
}
CopyVB.NET
Imports System
Imports DidiSoft.Pgp

Public Class ExportKeys
   Public Sub Demo()
       Dim ks As New KeyStore("C:\Test\key.store", "changeit")
       Dim keyAscii As String = ks.ExportPrivateKeyAsString("support@didisoft.com")
   End Sub
End Class

Exceptions

ExceptionCondition
DidiSoft.Pgp.Exceptions..::..WrongPrivateKeyExceptionIf there is no private key in this key pair
System.IO..::..IOExceptionif an I/O error occurs.

See Also