Deletes the first public key pair from this key store that has the specified User Id.

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

Syntax

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

Parameters

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

Return Value

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

Remarks

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

Examples

CopyC#
using System;
using DidiSoft.Pgp;

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

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

See Also