org.bouncycastle.openpgp

Class PGPSecretKeyRing

public class PGPSecretKeyRing extends PGPKeyRing

Holder for a collection of PGP secret keys.
Constructor Summary
PGPSecretKeyRing(byte[] encoding)
PGPSecretKeyRing(InputStream in)
Method Summary
voidencode(OutputStream outStream)
byte[]getEncoded()
PGPPublicKeygetPublicKey()
Return the public key for the master key.
PGPSecretKeygetSecretKey()
Return the master private key.
PGPSecretKeygetSecretKey(long keyId)
IteratorgetSecretKeys()
Return an iterator containing all the secret keys.
static PGPSecretKeyRinginsertSecretKey(PGPSecretKeyRing secRing, PGPSecretKey secKey)
Returns a new key ring with the secret key passed in either added or replacing an existing one with the same key ID.
static PGPSecretKeyRingremoveSecretKey(PGPSecretKeyRing secRing, PGPSecretKey secKey)
Returns a new key ring with the secret key passed in removed from the key ring.

Constructor Detail

PGPSecretKeyRing

public PGPSecretKeyRing(byte[] encoding)

PGPSecretKeyRing

public PGPSecretKeyRing(InputStream in)

Method Detail

encode

public void encode(OutputStream outStream)

getEncoded

public byte[] getEncoded()

getPublicKey

public PGPPublicKey getPublicKey()
Return the public key for the master key.

Returns: PGPPublicKey

getSecretKey

public PGPSecretKey getSecretKey()
Return the master private key.

Returns: PGPSecretKey

getSecretKey

public PGPSecretKey getSecretKey(long keyId)

getSecretKeys

public Iterator getSecretKeys()
Return an iterator containing all the secret keys.

Returns: Iterator

insertSecretKey

public static PGPSecretKeyRing insertSecretKey(PGPSecretKeyRing secRing, PGPSecretKey secKey)
Returns a new key ring with the secret key passed in either added or replacing an existing one with the same key ID.

Parameters: secRing the secret key ring to be modified. secKey the secret key to be added.

Returns: a new secret key ring.

removeSecretKey

public static PGPSecretKeyRing removeSecretKey(PGPSecretKeyRing secRing, PGPSecretKey secKey)
Returns a new key ring with the secret key passed in removed from the key ring.

Parameters: secRing the secret key ring to be modified. secKey the secret key to be removed.

Returns: a new secret key ring, or null if secKey is not found.