Often PGP keyring files consist of multiple master keys, if you are trying to process or construct one of these you should use the PGPPublicKeyRingCollection class.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv List | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PGPPublicKeyRing(List<PGPPublicKey>
the list of keys making up the ring. pubKeys)Base constructor from a list of keys representing a public key ring (a master key and its associated sub-keys). |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static List | |
| public void | |
| public void | encode(OutputStream
stream to write the key encoding to. outStream, boolean if the purpose of encoding is to send key to other users. forTransfer)Encode the key ring to outStream, with trust packets stripped out if forTransfer is true. |
| public byte[] | |
| public byte[] | Returns: a encoded byte array representing the key.if the purpose of encoding is to send key to other users. forTransfer)Return an encoding of the key ring, with trust packets stripped out if forTransfer is true. |
| public Iterator | Returns: an iterator (possibly empty) of PGPPublicKey objects carrying signatures from keyID.the key id to be matched against. keyID)Implements abstract org. |
| public PGPPublicKey | Returns: PGPPublicKeyImplements abstract org. |
| public PGPPublicKey | Returns: PGPPublicKey with matching keyID, null if it is not present.the full keyID of the key of interest. keyID)Implements abstract org. |
| public PGPPublicKey | Returns: PGPPublicKey with the matching fingerprint, null if it is not present.the full fingerprint of the key of interest. fingerprint)Implements abstract org. |
| public Iterator | Returns: IteratorImplements abstract org. |
| public static PGPPublicKeyRing | Returns: a new keyRingthe public key ring to be modified pubRing, PGPPublicKey the public key to be inserted. pubKey)Returns a new key ring with the public key passed in either added or replacing an existing one. |
| public Iterator | iterator()
Implements org. |
| public static PGPPublicKeyRing | Returns: joined key ringlocal copy of the certificate first, PGPPublicKeyRing remote copy of the certificate (e.g. from a key server) second)Join two copies of the same certificate. |
| public static PGPPublicKeyRing | Returns: joined certificatelocal copy of the certificate first, PGPPublicKeyRing remote copy of the certificate (e.g. from a key server) second, boolean if true, trust packets from the second certificate copy will be carried over into the joined certificate joinTrustPackets, boolean if true, the resulting joined certificate may carry subkey signatures on its primary key allowSubkeySigsOnNonSubkey)Join two copies of the same certificate. |
| pack-priv static PublicKeyPacket | |
| pack-priv static PGPPublicKey | |
| public static PGPPublicKeyRing | Returns: a new keyRing, null if pubKey is not found.the public key ring to be modified pubRing, PGPPublicKey the public key to be removed. pubKey)Returns a new key ring with the public key passed in removed from the key ring. |
| keys | back to summary |
|---|---|
| pack-priv List<PGPPublicKey> keys | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| PGPPublicKeyRing | back to summary |
|---|---|
| public PGPPublicKeyRing(byte[] encoding, KeyFingerPrintCalculator fingerPrintCalculator) throws IOException | |
| PGPPublicKeyRing | back to summary |
|---|---|
| public PGPPublicKeyRing(List<PGPPublicKey> pubKeys) Base constructor from a list of keys representing a public key ring (a master key and its associated sub-keys).
| |
| PGPPublicKeyRing | back to summary |
|---|---|
| public PGPPublicKeyRing(InputStream in, KeyFingerPrintCalculator fingerPrintCalculator) throws IOException | |
| checkKeys | back to summary |
|---|---|
| private static List | |
| encode | back to summary |
|---|---|
| public void encode(OutputStream outStream) throws IOException Implements abstract org. | |
| encode | back to summary |
|---|---|
| public void encode(OutputStream outStream, boolean forTransfer) throws IOException Encode the key ring to outStream, with trust packets stripped out if forTransfer is true.
| |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded() throws IOException Implements abstract org. | |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded(boolean forTransfer) throws IOException Return an encoding of the key ring, with trust packets stripped out if forTransfer is true.
| |
| getKeysWithSignaturesBy | back to summary |
|---|---|
| public Iterator Implements abstract org. Return any keys carrying a signature issued by the key represented by keyID.
| |
| getPublicKey | back to summary |
|---|---|
| public PGPPublicKey getPublicKey() Implements abstract org. Return the first public key in the ring.
| |
| getPublicKey | back to summary |
|---|---|
| public PGPPublicKey getPublicKey(long keyID) Implements abstract org. Return the public key referred to by the passed in keyID if it is present.
| |
| getPublicKey | back to summary |
|---|---|
| public PGPPublicKey getPublicKey(byte[] fingerprint) Implements abstract org. Return the public key with the passed in fingerprint if it is present.
| |
| getPublicKeys | back to summary |
|---|---|
| public Iterator Implements abstract org. Return an iterator containing all the public keys.
| |
| insertPublicKey | back to summary |
|---|---|
| public static PGPPublicKeyRing insertPublicKey(PGPPublicKeyRing pubRing, PGPPublicKey pubKey) Returns a new key ring with the public key passed in either added or replacing an existing one.
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements org. Support method for Iterable where available.
| |
| join | back to summary |
|---|---|
| public static PGPPublicKeyRing join(PGPPublicKeyRing first, PGPPublicKeyRing second) throws PGPException Join two copies of the same certificate. The certificates must have the same primary key, but may carry different subkeys, user-ids and signatures. The resulting certificate will carry the sum of both certificates subkeys, user-ids and signatures. This method will ignore trust packets on the second copy of the certificate and instead copy the local certificate's trust packets to the joined certificate.
| |
| join | back to summary |
|---|---|
| public static PGPPublicKeyRing join(PGPPublicKeyRing first, PGPPublicKeyRing second, boolean joinTrustPackets, boolean allowSubkeySigsOnNonSubkey) throws PGPException Join two copies of the same certificate. The certificates must have the same primary key, but may carry different subkeys, user-ids and signatures. The resulting certificate will carry the sum of both certificates subkeys, user-ids and signatures. For each subkey holds: If joinTrustPackets is set to true and the second key is carrying a trust packet, the trust packet will be copied to the joined key. Otherwise, the joined key will carry the trust packet of the local copy.
| |
| readPublicKeyPacket | back to summary |
|---|---|
| pack-priv static PublicKeyPacket readPublicKeyPacket(BCPGInputStream in) throws IOException | |
| readSubkey | back to summary |
|---|---|
| pack-priv static PGPPublicKey readSubkey(BCPGInputStream in, KeyFingerPrintCalculator fingerPrintCalculator) throws IOException, PGPException | |
| removePublicKey | back to summary |
|---|---|
| public static PGPPublicKeyRing removePublicKey(PGPPublicKeyRing pubRing, PGPPublicKey pubKey) Returns a new key ring with the public key passed in removed from the key ring.
| |