Package org.bouncycastle.openpgp
Class PGPKeyRing
- java.lang.Object
-
- org.bouncycastle.openpgp.PGPKeyRing
-
- Direct Known Subclasses:
PGPPublicKeyRing,PGPSecretKeyRing
public abstract class PGPKeyRing extends java.lang.ObjectParent class for PGP public and secret key rings.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract voidencode(java.io.OutputStream outStream)abstract byte[]getEncoded()abstract byte[]getEncoded(PacketFormat format)abstract java.util.Iterator<PGPPublicKey>getKeysWithSignaturesBy(long keyID)Return an iterator containing all the public keys carrying signatures issued from key keyID.abstract java.util.Iterator<PGPPublicKey>getKeysWithSignaturesBy(KeyIdentifier identifier)abstract PGPPublicKeygetPublicKey()Return the first public key in the ring.abstract PGPPublicKeygetPublicKey(byte[] fingerprint)Return the public key with the passed in fingerprint if it is present.abstract PGPPublicKeygetPublicKey(long keyID)Return the public key referred to by the passed in keyID if it is present.abstract PGPPublicKeygetPublicKey(KeyIdentifier identifier)abstract java.util.Iterator<PGPPublicKey>getPublicKeys()Return an iterator containing all the public keys.abstract java.util.Iterator<PGPPublicKey>getPublicKeys(KeyIdentifier identifier)abstract intsize()Return the number of keys in the key ring.
-
-
-
Method Detail
-
getPublicKey
public abstract PGPPublicKey getPublicKey()
Return the first public key in the ring. In the case of aPGPSecretKeyRingthis is also the public key of the master key pair.- Returns:
- PGPPublicKey
-
getPublicKeys
public abstract java.util.Iterator<PGPPublicKey> getPublicKeys()
Return an iterator containing all the public keys.- Returns:
- Iterator
-
getPublicKey
public abstract PGPPublicKey getPublicKey(long keyID)
Return the public key referred to by the passed in keyID if it is present.- Parameters:
keyID- the full keyID of the key of interest.- Returns:
- PGPPublicKey with matching keyID.
-
getPublicKey
public abstract PGPPublicKey getPublicKey(byte[] fingerprint)
Return the public key with the passed in fingerprint if it is present.- Parameters:
fingerprint- the full fingerprint of the key of interest.- Returns:
- PGPPublicKey with the matching fingerprint.
-
getPublicKey
public abstract PGPPublicKey getPublicKey(KeyIdentifier identifier)
-
getPublicKeys
public abstract java.util.Iterator<PGPPublicKey> getPublicKeys(KeyIdentifier identifier)
-
getKeysWithSignaturesBy
public abstract java.util.Iterator<PGPPublicKey> getKeysWithSignaturesBy(long keyID)
Return an iterator containing all the public keys carrying signatures issued from key keyID.- Returns:
- an iterator (possibly empty) of the public keys associated with keyID.
-
getKeysWithSignaturesBy
public abstract java.util.Iterator<PGPPublicKey> getKeysWithSignaturesBy(KeyIdentifier identifier)
-
size
public abstract int size()
Return the number of keys in the key ring.- Returns:
- number of keys (master key + subkey).
-
encode
public abstract void encode(java.io.OutputStream outStream) throws java.io.IOException- Throws:
java.io.IOException
-
getEncoded
public abstract byte[] getEncoded() throws java.io.IOException- Throws:
java.io.IOException
-
getEncoded
public abstract byte[] getEncoded(PacketFormat format) throws java.io.IOException
- Throws:
java.io.IOException
-
-