Deletes the first key pair (public and private key) from this key store that has the specified userId.

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

Syntax

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

Parameters

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

Return Value

true if key pair is deleted, false if there is no key pair with the specified user Id

Remarks

If more than one key pair exist with the supplied userId, only the first one is affected.
If no key exists with the specified userId, no changes to the key store occurs.
This method is equivalent to the GnuPG commands:
gpg --delete-secret-keys [userId]
gpg --delete-keys [userId]

Examples

CopyC#
using System;
using DidiSoft.Pgp;

public class DeleteKeyPair
{
   public static void Demo()
   {
       KeyStore ks = new KeyStore("pgp.keystore", "changeit");
       ks.DeleteKeyPair("test@gmail.com");            
   }
}
CopyVB.NET
Imports System
Imports DidiSoft.Pgp

Public Class DeleteKeyPair
   Public Shared Sub Demo()
       Dim ks As New KeyStore("pgp.keystore", "changeit")
       ks.DeleteKeyPair("test@gmail.com")
   End Sub
End Class

See Also