Often PGP keyring files consist of multiple master keys, if you are trying to process
or construct one of these you should use the PGPSecretKeyRingCollection class.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv List | |
| pack-priv List | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public | PGPSecretKeyRing(List<PGPSecretKey>
the list of keys making up the ring. secKeys)Base constructor from a list of keys representing a secret key ring (a master key and its associated sub-keys). |
| private | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static List | |
| public static PGPSecretKeyRing | Returns: the updated key ring.the PGPSecretKeyRing to be copied. ring, PBESecretKeyDecryptor the current decryptor based on the current password for key. oldKeyDecryptor, PBESecretKeyEncryptor a new encryptor based on a new password for encrypting the secret key material. newKeyEncryptor)Return a copy of the passed in secret key ring, with the private keys (where present) associated with the master key and sub keys are encrypted using a new password and the passed in algorithm. |
| public void | |
| public byte[] | |
| public byte[] | |
| public Iterator | Returns: iterator of unattached, or extra, public keys.Return an iterator of the public keys in the secret key ring that have no matching private key. |
| 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. Return any keys carrying a signature issued by the key represented by keyID. |
| public Iterator | getKeysWithSignaturesBy(KeyIdentifier identifier)
Implements abstract org.
|
| public PGPPublicKey | Returns: PGPPublicKeyImplements abstract org. Return the public key for the master key. |
| 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. Return the public key referred to by the passed in keyID if it is present. |
| 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. Return the public key with the passed in fingerprint if it is present. |
| public PGPPublicKey | getPublicKey(KeyIdentifier identifier)
Implements abstract org.
|
| public Iterator | getPublicKeys(KeyIdentifier identifier)
Implements abstract org.
|
| public Iterator | Returns: IteratorImplements abstract org. Return an iterator containing all the public keys. |
| public PGPSecretKey | |
| public PGPSecretKey | |
| public PGPSecretKey | Returns: PGPSecretKey with matching keyID, null if it is not present.the full keyID of the key of interest. keyID)Return the secret key referred to by the passed in keyID if it is present. |
| public PGPSecretKey | Returns: PGPSecretKey with the matching fingerprint, null if it is not present.the full fingerprint of the key of interest. fingerprint)Return the secret key associated with the passed in fingerprint if it is present. |
| public Iterator | |
| public Iterator | |
| public static PGPSecretKeyRing | Returns: secret key ringsecret key ring secretRing, PGPPublicKey public key to insert or replace publicKey)Either replace the public key on the corresponding secret key in the key ring if present, or insert the public key as an extra public key in case that the secret ring does not contain the corresponding secret key. |
| public static PGPSecretKeyRing | Returns: a new secret key ring.the secret key ring to be modified. secRing, PGPSecretKey the secret key to be added. secKey)Returns a new key ring with the secret key passed in either added or replacing an existing one with the same key ID. |
| public Iterator | iterator()
Implements org. Support method for Iterable where available. |
| public static PGPSecretKeyRing | Returns: a new secret key ring, or null if secKey is not found.the secret key ring to be modified. secRing, PGPSecretKey the secret key to be removed. secKey)Returns a new key ring with the secret key passed in removed from the key ring. |
| public static PGPSecretKeyRing | replacePublicKeys(PGPSecretKeyRing
secret ring to be changed. secretRing, PGPPublicKeyRing public ring containing the new public key set. publicRing)Replace the public key set on the secret ring with the corresponding key off the public ring. |
| public int | Returns: number of keys (master key + subkey).Implements abstract org. Return the number of keys in the key ring. |
| public PGPPublicKeyRing | Returns: certificateReturn the OpenPGP certificate (Transferable Public Key) of this key. |
| extraPubKeys | back to summary |
|---|---|
| pack-priv List<PGPPublicKey> extraPubKeys | |
| keys | back to summary |
|---|---|
| pack-priv List<PGPSecretKey> keys | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| PGPSecretKeyRing | back to summary |
|---|---|
| public PGPSecretKeyRing(List<PGPSecretKey> secKeys) Base constructor from a list of keys representing a secret key ring (a master key and its associated sub-keys).
| |
| PGPSecretKeyRing | back to summary |
|---|---|
| private PGPSecretKeyRing(List<PGPSecretKey> keys, List<PGPPublicKey> extraPubKeys) | |
| PGPSecretKeyRing | back to summary |
|---|---|
| public PGPSecretKeyRing(byte[] encoding, KeyFingerPrintCalculator fingerPrintCalculator) throws IOException, PGPException | |
| PGPSecretKeyRing | back to summary |
|---|---|
| public PGPSecretKeyRing(InputStream in, KeyFingerPrintCalculator fingerPrintCalculator) throws IOException, PGPException | |
| checkKeys | back to summary |
|---|---|
| private static List | |
| copyWithNewPassword | back to summary |
|---|---|
| public static PGPSecretKeyRing copyWithNewPassword(PGPSecretKeyRing ring, PBESecretKeyDecryptor oldKeyDecryptor, PBESecretKeyEncryptor newKeyEncryptor) throws PGPException Return a copy of the passed in secret key ring, with the private keys (where present) associated with the master key and sub keys are encrypted using a new password and the passed in algorithm.
| |
| encode | back to summary |
|---|---|
| public void encode(OutputStream outStream) throws IOException Implements abstract org. | |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded() throws IOException Implements abstract org. | |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded(PacketFormat format) throws IOException Implements abstract org.
| |
| getExtraPublicKeys | back to summary |
|---|---|
| public Iterator Return an iterator of the public keys in the secret key ring that have no matching private key. At the moment only personal certificate data appears in this fashion.
| |
| getKeysWithSignaturesBy | back to summary |
|---|---|
| public Iterator Implements abstract org. Return any keys carrying a signature issued by the key represented by keyID.
| |
| getKeysWithSignaturesBy | back to summary |
|---|---|
| public Iterator Implements abstract org.
| |
| getPublicKey | back to summary |
|---|---|
| public PGPPublicKey getPublicKey() Implements abstract org. Return the public key for the master key.
| |
| 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.
| |
| getPublicKey | back to summary |
|---|---|
| public PGPPublicKey getPublicKey(KeyIdentifier identifier) Implements abstract org.
| |
| getPublicKeys | back to summary |
|---|---|
| public Iterator Implements abstract org.
| |
| getPublicKeys | back to summary |
|---|---|
| public Iterator Implements abstract org. Return an iterator containing all the public keys.
| |
| getSecretKey | back to summary |
|---|---|
| public PGPSecretKey getSecretKey(KeyIdentifier identifier) | |
| getSecretKey | back to summary |
|---|---|
| public PGPSecretKey getSecretKey() Return the master private key.
| |
| getSecretKey | back to summary |
|---|---|
| public PGPSecretKey getSecretKey(long keyID) Return the secret key referred to by the passed in keyID if it is present.
| |
| getSecretKey | back to summary |
|---|---|
| public PGPSecretKey getSecretKey(byte[] fingerprint) Return the secret key associated with the passed in fingerprint if it is present.
| |
| getSecretKeys | back to summary |
|---|---|
| public Iterator | |
| getSecretKeys | back to summary |
|---|---|
| public Iterator Return an iterator containing all the secret keys.
| |
| insertOrReplacePublicKey | back to summary |
|---|---|
| public static PGPSecretKeyRing insertOrReplacePublicKey(PGPSecretKeyRing secretRing, PGPPublicKey publicKey) Either replace the public key on the corresponding secret key in the key ring if present, or insert the public key as an extra public key in case that the secret ring does not contain the corresponding secret key.
| |
| insertSecretKey | back to summary |
|---|---|
| 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.
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements org. Support method for Iterable where available.
| |
| removeSecretKey | back to summary |
|---|---|
| public static PGPSecretKeyRing removeSecretKey(PGPSecretKeyRing secRing, PGPSecretKey secKey) Returns a new key ring with the secret key passed in removed from the key ring.
| |
| replacePublicKeys | back to summary |
|---|---|
| public static PGPSecretKeyRing replacePublicKeys(PGPSecretKeyRing secretRing, PGPPublicKeyRing publicRing) Replace the public key set on the secret ring with the corresponding key off the public ring.
| |
| size | back to summary |
|---|---|
| public int size() Implements abstract org. Return the number of keys in the key ring.
| |
| toCertificate | back to summary |
|---|---|
| public PGPPublicKeyRing toCertificate() Return the OpenPGP certificate (Transferable Public Key) of this key.
| |