Class PgpPublicKeyRingBundle
- Namespace
- Org.BouncyCastle.Bcpg.OpenPgp
- Assembly
- BouncyCastle.Cryptography.dll
public class PgpPublicKeyRingBundle
- Inheritance
-
PgpPublicKeyRingBundle
- Inherited Members
Remarks
Often a PGP key ring file is made up of a succession of master/sub-key key rings. If you want to read an entire public key file in one hit this is the class for you.
Constructors
PgpPublicKeyRingBundle(byte[])
public PgpPublicKeyRingBundle(byte[] encoding)
Parameters
encodingbyte[]
PgpPublicKeyRingBundle(IEnumerable<PgpObject>)
public PgpPublicKeyRingBundle(IEnumerable<PgpObject> e)
Parameters
PgpPublicKeyRingBundle(Stream)
Build a PgpPublicKeyRingBundle from the passed in input stream.
public PgpPublicKeyRingBundle(Stream inputStream)
Parameters
inputStreamStreamInput stream containing data.
Exceptions
- IOException
If a problem parsing the stream occurs.
- PgpException
If an object is encountered which isn't a PgpPublicKeyRing.
Properties
Count
Return the number of key rings in this collection.
public int Count { get; }
Property Value
Methods
AddPublicKeyRing(PgpPublicKeyRingBundle, PgpPublicKeyRing)
Return a new bundle containing the contents of the passed in bundle and the passed in public key ring.
public static PgpPublicKeyRingBundle AddPublicKeyRing(PgpPublicKeyRingBundle bundle, PgpPublicKeyRing publicKeyRing)
Parameters
bundlePgpPublicKeyRingBundleThe
PgpPublicKeyRingBundlethe key ring is to be added to.publicKeyRingPgpPublicKeyRingThe key ring to be added.
Returns
- PgpPublicKeyRingBundle
A new
PgpPublicKeyRingBundlemerging the current one with the passed in key ring.
Exceptions
- ArgumentException
If the keyId for the passed in key ring is already present.
Contains(long)
Return true if a key matching the passed in key ID is present, false otherwise.
public bool Contains(long keyID)
Parameters
keyIDlongkey ID to look for.
Returns
Encode(Stream)
public void Encode(Stream outStr)
Parameters
outStrStream
GetEncoded()
public byte[] GetEncoded()
Returns
- byte[]
GetKeyRings()
Allow enumeration of the public key rings making up this collection.
public IEnumerable<PgpPublicKeyRing> GetKeyRings()
Returns
GetKeyRings(string)
Allow enumeration of the key rings associated with the passed in userId.
public IEnumerable<PgpPublicKeyRing> GetKeyRings(string userId)
Parameters
userIdstringThe user ID to be matched.
Returns
- IEnumerable<PgpPublicKeyRing>
An
IEnumerableof key rings which matched (possibly none).
GetKeyRings(string, bool)
Allow enumeration of the key rings associated with the passed in userId.
public IEnumerable<PgpPublicKeyRing> GetKeyRings(string userId, bool matchPartial)
Parameters
userIdstringThe user ID to be matched.
matchPartialboolIf true, userId need only be a substring of an actual ID string to match.
Returns
- IEnumerable<PgpPublicKeyRing>
An
IEnumerableof key rings which matched (possibly none).
GetKeyRings(string, bool, bool)
Allow enumeration of the key rings associated with the passed in userId.
public IEnumerable<PgpPublicKeyRing> GetKeyRings(string userID, bool matchPartial, bool ignoreCase)
Parameters
userIDstringThe user ID to be matched.
matchPartialboolIf true, userId need only be a substring of an actual ID string to match.
ignoreCaseboolIf true, case is ignored in user ID comparisons.
Returns
- IEnumerable<PgpPublicKeyRing>
An
IEnumerableof key rings which matched (possibly none).
GetPublicKey(byte[])
Return the PGP public key associated with the given key fingerprint.
public PgpPublicKey GetPublicKey(byte[] fingerprint)
Parameters
fingerprintbyte[]the public key fingerprint to match against.
Returns
GetPublicKey(long)
Return the PGP public key associated with the given key id.
public PgpPublicKey GetPublicKey(long keyId)
Parameters
keyIdlongThe ID of the public key to return.
Returns
GetPublicKeyRing(byte[])
Return the public key ring which contains the key associated with the given key fingerprint.
public PgpPublicKeyRing GetPublicKeyRing(byte[] fingerprint)
Parameters
fingerprintbyte[]the public key fingerprint to match against.
Returns
GetPublicKeyRing(long)
Return the public key ring which contains the key referred to by keyId
public PgpPublicKeyRing GetPublicKeyRing(long keyId)
Parameters
keyIdlongkey ID to match against
Returns
RemovePublicKeyRing(PgpPublicKeyRingBundle, PgpPublicKeyRing)
Return a new bundle containing the contents of the passed in bundle with the passed in public key ring removed.
public static PgpPublicKeyRingBundle RemovePublicKeyRing(PgpPublicKeyRingBundle bundle, PgpPublicKeyRing publicKeyRing)
Parameters
bundlePgpPublicKeyRingBundleThe
PgpPublicKeyRingBundlethe key ring is to be removed from.publicKeyRingPgpPublicKeyRingThe key ring to be removed.
Returns
- PgpPublicKeyRingBundle
A new
PgpPublicKeyRingBundlenot containing the passed in key ring.
Exceptions
- ArgumentException
If the keyId for the passed in key ring is not present.