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
encodingbyte[]
PgpPublicKeyRing(Stream)
public PgpPublicKeyRing(Stream inputStream)
Parameters
inputStreamStream
Methods
Encode(Stream)
public virtual void Encode(Stream outStr)
Parameters
outStrStream
GetEncoded()
public virtual byte[] GetEncoded()
Returns
- byte[]
GetPublicKey()
Return the first public key in the ring.
public virtual PgpPublicKey GetPublicKey()
Returns
GetPublicKey(byte[])
Return the public key with the passed in fingerprint if it is present.
public virtual PgpPublicKey GetPublicKey(byte[] fingerprint)
Parameters
fingerprintbyte[]
Returns
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
keyIdlong
Returns
GetPublicKeys()
Allows enumeration of all the public keys.
public virtual IEnumerable<PgpPublicKey> GetPublicKeys()
Returns
- IEnumerable<PgpPublicKey>
An
IEnumerableofPgpPublicKeyobjects.
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
pubRingPgpPublicKeyRingThe public key ring to be modified.
pubKeyPgpPublicKeyThe public key to be inserted.
Returns
- PgpPublicKeyRing
A new
PgpPublicKeyRing
Join(PgpPublicKeyRing, PgpPublicKeyRing)
public static PgpPublicKeyRing Join(PgpPublicKeyRing first, PgpPublicKeyRing second)
Parameters
firstPgpPublicKeyRingsecondPgpPublicKeyRing
Returns
Join(PgpPublicKeyRing, PgpPublicKeyRing, bool, bool)
public static PgpPublicKeyRing Join(PgpPublicKeyRing first, PgpPublicKeyRing second, bool joinTrustPackets, bool allowSubkeySigsOnNonSubkey)
Parameters
firstPgpPublicKeyRingsecondPgpPublicKeyRingjoinTrustPacketsboolallowSubkeySigsOnNonSubkeybool
Returns
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
pubRingPgpPublicKeyRingThe public key ring to be modified.
pubKeyPgpPublicKeyThe public key to be removed.
Returns
- PgpPublicKeyRing
A new
PgpPublicKeyRing, or null if pubKey is not found.