Checks is there a private key with the specified Key ID in this Key Store

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

Syntax

C#
public bool ContainsPrivateKey(
	long keyId
)
Visual Basic
Public Function ContainsPrivateKey ( _
	keyId As Long _
) As Boolean
Visual C++
public:
bool ContainsPrivateKey(
	long long keyId
)

Parameters

keyId
Type: System..::..Int64
Key Id of type Int64

Return Value

Returns true if this key store contains key with the specified Key ID

Examples

CopyC#
using System;
using DidiSoft.Pgp;

public class ContainsPrivateKey
{
   public void Demo()            
   {
       KeyStore ks = new KeyStore(@"DataFiles\key.store", "changeit");
       long keyId = 10000;
       if (ks.ContainsPrivateKey(keyId))
       {
           Console.WriteLine("Key found.");
       }
   }
}
CopyVB.NET
Imports System
Imports DidiSoft.Pgp

Public Class ContainsPrivateKey
   Public Sub Test()
       Dim ks As New KeyStore("DataFiles\key.store", "changeit")
       If (Not ks.ContainsPrivateKey(1000)) Then
           Console.WriteLine("Key found.")
       End If
   End Sub
End Class

See Also