Class PgpSecretKeyRingBundle
- Namespace
- Org.BouncyCastle.Bcpg.OpenPgp
- Assembly
- BouncyCastle.Cryptography.dll
public class PgpSecretKeyRingBundle
- Inheritance
-
PgpSecretKeyRingBundle
- 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 secret key file in one hit this is the class for you.
Constructors
PgpSecretKeyRingBundle(byte[])
public PgpSecretKeyRingBundle(byte[] encoding)
Parameters
encodingbyte[]
PgpSecretKeyRingBundle(IEnumerable<PgpObject>)
public PgpSecretKeyRingBundle(IEnumerable<PgpObject> e)
Parameters
PgpSecretKeyRingBundle(Stream)
Build a PgpSecretKeyRingBundle from the passed in input stream.
public PgpSecretKeyRingBundle(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 PgpSecretKeyRing.
Properties
Count
Return the number of rings in this collection.
public int Count { get; }
Property Value
Methods
AddSecretKeyRing(PgpSecretKeyRingBundle, PgpSecretKeyRing)
Return a new bundle containing the contents of the passed in bundle and the passed in secret key ring.
public static PgpSecretKeyRingBundle AddSecretKeyRing(PgpSecretKeyRingBundle bundle, PgpSecretKeyRing secretKeyRing)
Parameters
bundlePgpSecretKeyRingBundleThe
PgpSecretKeyRingBundlethe key ring is to be added to.secretKeyRingPgpSecretKeyRingThe key ring to be added.
Returns
- PgpSecretKeyRingBundle
A new
PgpSecretKeyRingBundlemerging 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 secret key rings making up this collection.
public IEnumerable<PgpSecretKeyRing> GetKeyRings()
Returns
GetKeyRings(string)
Allow enumeration of the key rings associated with the passed in userId.
public IEnumerable<PgpSecretKeyRing> GetKeyRings(string userId)
Parameters
userIdstringThe user ID to be matched.
Returns
- IEnumerable<PgpSecretKeyRing>
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<PgpSecretKeyRing> 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<PgpSecretKeyRing>
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<PgpSecretKeyRing> 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<PgpSecretKeyRing>
An
IEnumerableof key rings which matched (possibly none).
GetSecretKey(long)
Return the PGP secret key associated with the given key id.
public PgpSecretKey GetSecretKey(long keyId)
Parameters
keyIdlongThe ID of the secret key to return.
Returns
GetSecretKeyRing(long)
Return the secret key ring which contains the key referred to by keyId
public PgpSecretKeyRing GetSecretKeyRing(long keyId)
Parameters
keyIdlongThe ID of the secret key
Returns
RemoveSecretKeyRing(PgpSecretKeyRingBundle, PgpSecretKeyRing)
Return a new bundle containing the contents of the passed in bundle with the passed in secret key ring removed.
public static PgpSecretKeyRingBundle RemoveSecretKeyRing(PgpSecretKeyRingBundle bundle, PgpSecretKeyRing secretKeyRing)
Parameters
bundlePgpSecretKeyRingBundleThe
PgpSecretKeyRingBundlethe key ring is to be removed from.secretKeyRingPgpSecretKeyRingThe key ring to be removed.
Returns
- PgpSecretKeyRingBundle
A new
PgpSecretKeyRingBundlenot containing the passed in key ring.
Exceptions
- ArgumentException
If the keyId for the passed in key ring is not present.