org.bouncycastle.openpgp
Class PGPObjectFactory
java.lang.Object
|
+--org.bouncycastle.openpgp.PGPObjectFactory
- public class PGPObjectFactory
- extends java.lang.Object
- implements org.bouncycastle.util.Iterable
General class for reading a PGP object stream.
Note: if this class finds a PGPPublicKey
or a PGPSecretKey
it will create a
PGPPublicKeyRing
, or a PGPSecretKeyRing
for each key found. If all you are trying
to do is read a key ring file use either PGPPublicKeyRingCollection
or
PGPSecretKeyRingCollection
.
This factory supports reading the following types of objects:
Constructor Summary |
PGPObjectFactory(byte[] bytes,
org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator fingerPrintCalculator)
Create an object factory suitable for reading PGP objects such as keys, key rings and key
ring collections, or PGP encrypted data. |
PGPObjectFactory(java.io.InputStream in,
org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator fingerPrintCalculator)
Create an object factory suitable for reading PGP objects such as keys, key rings and key
ring collections, or PGP encrypted data. |
Method Summary |
java.util.Iterator |
iterator()
Support method for Iterable where available. |
java.lang.Object |
nextObject()
Return the next object in the stream, or null if the end of stream is reached. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
PGPObjectFactory
public PGPObjectFactory(java.io.InputStream in,
org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator fingerPrintCalculator)
- Create an object factory suitable for reading PGP objects such as keys, key rings and key
ring collections, or PGP encrypted data.
- Parameters:
in
- stream to read PGP data from.fingerPrintCalculator
- calculator to use in key finger print calculations.
PGPObjectFactory
public PGPObjectFactory(byte[] bytes,
org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator fingerPrintCalculator)
- Create an object factory suitable for reading PGP objects such as keys, key rings and key
ring collections, or PGP encrypted data.
- Parameters:
bytes
- PGP encoded data.fingerPrintCalculator
- calculator to use in key finger print calculations.
nextObject
public java.lang.Object nextObject()
throws java.io.IOException
- Return the next object in the stream, or
null
if the end of stream is reached.
- Returns:
- one of the supported objects - see class docs for details.
- Throws:
- java.io.IOException - if an error occurs reading from the wrapped stream or parsing data.
iterator
public java.util.Iterator iterator()
- Support method for Iterable where available.
- Specified by:
- iterator in interface org.bouncycastle.util.Iterable