Table of Contents

Class PgpPublicKeyRing

Namespace
Org.BouncyCastle.Bcpg.OpenPgp
Assembly
BouncyCastle.Cryptography.dll
public class PgpPublicKeyRing : PgpKeyRing
Inheritance
PgpPublicKeyRing
Inherited Members

Remarks

Class to hold a single master public key and its subkeys.

Often PGP keyring files consist of multiple master keys, if you are trying to process or construct one of these you should use the PgpPublicKeyRingBundle class.

Constructors

PgpPublicKeyRing(byte[])

public PgpPublicKeyRing(byte[] encoding)

Parameters

encoding byte[]

PgpPublicKeyRing(Stream)

public PgpPublicKeyRing(Stream inputStream)

Parameters

inputStream Stream

Methods

Encode(Stream)

public virtual void Encode(Stream outStr)

Parameters

outStr Stream

GetEncoded()

public virtual byte[] GetEncoded()

Returns

byte[]

GetPublicKey()

Return the first public key in the ring.

public virtual PgpPublicKey GetPublicKey()

Returns

PgpPublicKey

GetPublicKey(byte[])

Return the public key with the passed in fingerprint if it is present.

public virtual PgpPublicKey GetPublicKey(byte[] fingerprint)

Parameters

fingerprint byte[]

Returns

PgpPublicKey

GetPublicKey(long)

Return the public key referred to by the passed in key ID if it is present.

public virtual PgpPublicKey GetPublicKey(long keyId)

Parameters

keyId long

Returns

PgpPublicKey

GetPublicKeys()

Allows enumeration of all the public keys.

public virtual IEnumerable<PgpPublicKey> GetPublicKeys()

Returns

IEnumerable<PgpPublicKey>

An IEnumerable of PgpPublicKey objects.

InsertPublicKey(PgpPublicKeyRing, PgpPublicKey)

Returns a new key ring with the public key passed in either added or replacing an existing one.

public static PgpPublicKeyRing InsertPublicKey(PgpPublicKeyRing pubRing, PgpPublicKey pubKey)

Parameters

pubRing PgpPublicKeyRing

The public key ring to be modified.

pubKey PgpPublicKey

The public key to be inserted.

Returns

PgpPublicKeyRing

A new PgpPublicKeyRing

Join(PgpPublicKeyRing, PgpPublicKeyRing)

public static PgpPublicKeyRing Join(PgpPublicKeyRing first, PgpPublicKeyRing second)

Parameters

first PgpPublicKeyRing
second PgpPublicKeyRing

Returns

PgpPublicKeyRing

Join(PgpPublicKeyRing, PgpPublicKeyRing, bool, bool)

public static PgpPublicKeyRing Join(PgpPublicKeyRing first, PgpPublicKeyRing second, bool joinTrustPackets, bool allowSubkeySigsOnNonSubkey)

Parameters

first PgpPublicKeyRing
second PgpPublicKeyRing
joinTrustPackets bool
allowSubkeySigsOnNonSubkey bool

Returns

PgpPublicKeyRing

RemovePublicKey(PgpPublicKeyRing, PgpPublicKey)

Returns a new key ring with the public key passed in removed from the key ring.

public static PgpPublicKeyRing RemovePublicKey(PgpPublicKeyRing pubRing, PgpPublicKey pubKey)

Parameters

pubRing PgpPublicKeyRing

The public key ring to be modified.

pubKey PgpPublicKey

The public key to be removed.

Returns

PgpPublicKeyRing

A new PgpPublicKeyRing, or null if pubKey is not found.