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

Namespace:  DidiSoft
Assembly:  PGPLib (in PGPLib.dll) Version: 1.6.3.19546

Syntax

C#
public bool DeleteKeyPair(
	string userId
)
Visual Basic (Declaration)
Public Function DeleteKeyPair ( _
	userId As String _
) As Boolean
Visual C++
public:
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 pairs 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 occur.
This method is equivalent to the GnuPG commands:
gpg --delete-secret-keys [userId]
gpg --delete-keys [userId]

Examples

CopyC#
using System;
using DidiSoft;

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

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