<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" />

PgpPublicKey

public class PgpPublicKey : PgpObject

The algorithm code associated with the public key.

public int BitStrength { get; }

The strength of the key in bits.

public DateTime CreationTime { get; }

The creation time of this key.

public bool IsEncryptionKey { get; }

Check if this key has an algorithm type that makes it suitable to use for encryption.

public bool IsMasterKey { get; }

True, if this could be a master key.

public long KeyId { get; }

The key ID associated with the public key.

public int Version { get; }

The version of this key.

Create a PgpPublicKey from the passed in lightweight one.

public PgpPublicKey(PublicKeyPacket publicPk)

public static PgpPublicKey AddCertification(PgpPublicKey key, string id, PgpSignature certification)

Add a certification for an id to the given public key.

Add a certification for the given UserAttributeSubpackets to the given public key.

public static PgpPublicKey AddCertification(PgpPublicKey key, PgpSignature certification)

Add a revocation or some other key certification to a key.

public static byte[] CalculateFingerprint(PublicKeyPacket publicPk)

public static PgpPublicKey Join(PgpPublicKey key, PgpPublicKey copy, bool joinTrustPackets, bool allowSubkeySigsOnNonSubkey)

Merge the given local public key with another, potentially fresher copy. The resulting public key contains the sum of both keys' user-ids and signatures.

Remove any certifications associated with a user attribute subpacket on a key.

public static PgpPublicKey RemoveCertification(PgpPublicKey key, string id)

Remove any certifications associated with a given ID on a key.

public static PgpPublicKey RemoveCertification(PgpPublicKey key, byte[] rawId)

Remove any certifications associated with a given ID on a key.

public static PgpPublicKey RemoveCertification(PgpPublicKey key, byte[] id, PgpSignature certification)

Remove a certification associated with a given ID on a key.

public static PgpPublicKey RemoveCertification(PgpPublicKey key, string id, PgpSignature certification)

Remove a certification associated with a given ID on a key.

Remove a certification associated with a given user attributes on a key.

public static PgpPublicKey RemoveCertification(PgpPublicKey key, PgpSignature certification)

Remove a certification from the key.

public void Encode(Stream outStr)

public void Encode(Stream outStr, bool forTransfer)

public byte[] GetEncoded()

public byte[] GetFingerprint()

The fingerprint of the public key

The public key contained in the object.

public IEnumerable<byte[]> GetRawUserIds()

Return any userIDs associated with the key in raw byte form.

Allows enumeration of all signatures/certifications associated with this key.

Allows enumeration of any signatures associated with the passed in id.

Return any signatures associated with the passed in key identifier keyID.

Allows enumeration of signatures associated with the passed in user attributes.

public IEnumerable<PgpSignature> GetSignaturesOfType(int signatureType)

Allows enumeration of signatures of the passed in type that are on this key.

public byte[] GetTrustData()

Return the trust data associated with the public key, if present.

Allows enumeration of any user attribute vectors associated with the key.

public IEnumerable<string> GetUserIds()

Allows enumeration of any user IDs associated with the key.

public long GetValidSeconds()

The number of valid seconds from creation time - zero means no expiry.

public bool HasFingerprint(byte[] fingerprint)

public bool IsRevoked()

Check whether this (sub)key has a revocation signature on it.