|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.openpgp.PGPKeyRing | +--org.bouncycastle.openpgp.PGPPublicKeyRing
Class to hold a single master public key and its subkeys.
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.
Constructor Summary | |
PGPPublicKeyRing(byte[] encoding,
KeyFingerPrintCalculator fingerPrintCalculator)
|
|
PGPPublicKeyRing(java.io.InputStream in,
KeyFingerPrintCalculator fingerPrintCalculator)
|
|
PGPPublicKeyRing(java.util.List pubKeys)
Base constructor from a list of keys representing a public key ring (a master key and its associated sub-keys). |
Method Summary | |
void |
encode(java.io.OutputStream outStream)
|
void |
encode(java.io.OutputStream outStream,
boolean forTransfer)
Encode the key ring to outStream, with trust packets stripped out if forTransfer is true. |
byte[] |
getEncoded()
|
byte[] |
getEncoded(boolean forTransfer)
Return an encoding of the key ring, with trust packets stripped out if forTransfer is true. |
java.util.Iterator |
getKeysWithSignaturesBy(long keyID)
Return any keys carrying a signature issued by the key represented by keyID. |
PGPPublicKey |
getPublicKey()
Return the first public key in the ring. |
PGPPublicKey |
getPublicKey(byte[] fingerprint)
Return the public key with the passed in fingerprint if it is present. |
PGPPublicKey |
getPublicKey(long keyID)
Return the public key referred to by the passed in keyID if it is present. |
java.util.Iterator |
getPublicKeys()
Return an iterator containing all the public keys. |
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. |
java.util.Iterator |
iterator()
Support method for Iterable where available. |
static PGPPublicKeyRing |
join(PGPPublicKeyRing first,
PGPPublicKeyRing second)
Join two copies of the same certificate. |
static PGPPublicKeyRing |
join(PGPPublicKeyRing first,
PGPPublicKeyRing second,
boolean joinTrustPackets,
boolean allowSubkeySigsOnNonSubkey)
Join two copies of the same certificate. |
static PGPPublicKeyRing |
removePublicKey(PGPPublicKeyRing pubRing,
PGPPublicKey pubKey)
Returns a new key ring with the public key passed in removed from the key ring. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PGPPublicKeyRing(byte[] encoding, KeyFingerPrintCalculator fingerPrintCalculator) throws java.io.IOException
public PGPPublicKeyRing(java.util.List pubKeys)
pubKeys
- the list of keys making up the ring.public PGPPublicKeyRing(java.io.InputStream in, KeyFingerPrintCalculator fingerPrintCalculator) throws java.io.IOException
Method Detail |
public PGPPublicKey getPublicKey()
getPublicKey
in class PGPKeyRing
public PGPPublicKey getPublicKey(long keyID)
getPublicKey
in class PGPKeyRing
keyID
- the full keyID of the key of interest.public PGPPublicKey getPublicKey(byte[] fingerprint)
getPublicKey
in class PGPKeyRing
fingerprint
- the full fingerprint of the key of interest.public java.util.Iterator getKeysWithSignaturesBy(long keyID)
getKeysWithSignaturesBy
in class PGPKeyRing
keyID
- the key id to be matched against.public java.util.Iterator getPublicKeys()
getPublicKeys
in class PGPKeyRing
public java.util.Iterator iterator()
iterator
in interface org.bouncycastle.util.Iterable
public byte[] getEncoded() throws java.io.IOException
getEncoded
in class PGPKeyRing
public byte[] getEncoded(boolean forTransfer) throws java.io.IOException
forTransfer
- if the purpose of encoding is to send key to other users.java.io.IOException
- in case of encoding error.public void encode(java.io.OutputStream outStream) throws java.io.IOException
encode
in class PGPKeyRing
public void encode(java.io.OutputStream outStream, boolean forTransfer) throws java.io.IOException
outStream
- stream to write the key encoding to.forTransfer
- if the purpose of encoding is to send key to other users.java.io.IOException
- in case of encoding error.public static PGPPublicKeyRing insertPublicKey(PGPPublicKeyRing pubRing, PGPPublicKey pubKey)
pubRing
- the public key ring to be modifiedpubKey
- the public key to be inserted.public static PGPPublicKeyRing removePublicKey(PGPPublicKeyRing pubRing, PGPPublicKey pubKey)
pubRing
- the public key ring to be modifiedpubKey
- the public key to be removed.public static PGPPublicKeyRing join(PGPPublicKeyRing first, PGPPublicKeyRing second) throws PGPException
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.
first
- local copy of the certificatesecond
- remote copy of the certificate (e.g. from a key server)PGPException
- public static PGPPublicKeyRing join(PGPPublicKeyRing first, PGPPublicKeyRing second, boolean joinTrustPackets, boolean allowSubkeySigsOnNonSubkey) throws PGPException
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.
first
- local copy of the certificatesecond
- remote copy of the certificate (e.g. from a key server)joinTrustPackets
- if true, trust packets from the second certificate copy will be carried over into the joined certificateallowSubkeySigsOnNonSubkey
- if true, the resulting joined certificate may carry subkey signatures on its primary keyPGPException
-
|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |