Top Description Fields Constructors Methods
org.bouncycastle.openpgp

public Class PGPObjectFactory

extends Object
implements Iterable
Class Inheritance
All Implemented Interfaces
org.bouncycastle.util.Iterable, java.lang.Iterable
Known Direct Subclasses
org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, java.util.ArrayList, .Iterator, .List, .NoSuchElementException, org.bouncycastle.bcpg.BCPGInputStream, .PacketTags, .UnsupportedPacketVersionException, org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator, 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:

Field Summary

Modifier and TypeField and Description
private KeyFingerPrintCalculator
private BCPGInputStream

Constructor Summary

AccessConstructor and Description
public
PGPObjectFactory(InputStream
stream to read PGP data from.
in
,
KeyFingerPrintCalculator
calculator to use in key finger print calculations.
fingerPrintCalculator
)

Create an object factory suitable for reading PGP objects such as keys, key rings and key ring collections, or PGP encrypted data.

public
PGPObjectFactory(byte[]
PGP encoded data.
bytes
,
KeyFingerPrintCalculator
calculator to use in key finger print calculations.
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

Modifier and TypeMethod and Description
public Iterator<E>
iterator()

Implements org.bouncycastle.util.Iterable.iterator.

Support method for Iterable where available.
public Object

Returns:

one of the supported objects - see class docs for details.
nextObject
()

Return the next object in the stream, or null if the end of stream is reached.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fingerPrintCalculatorback to summary
private KeyFingerPrintCalculator fingerPrintCalculator
inback to summary
private BCPGInputStream in

Constructor Detail

PGPObjectFactoryback to summary
public PGPObjectFactory(InputStream in, 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:InputStream

stream to read PGP data from.

fingerPrintCalculator:KeyFingerPrintCalculator

calculator to use in key finger print calculations.

PGPObjectFactoryback to summary
public PGPObjectFactory(byte[] bytes, 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:byte[]

PGP encoded data.

fingerPrintCalculator:KeyFingerPrintCalculator

calculator to use in key finger print calculations.

Method Detail

iteratorback to summary
public Iterator<E> iterator()

Implements org.bouncycastle.util.Iterable.iterator.

Support method for Iterable where available.

Returns:Iterator<E>

Doc from org.bouncycastle.util.Iterable.iterator.

an Iterator.

nextObjectback to summary
public Object nextObject() throws IOException

Return the next object in the stream, or null if the end of stream is reached.

Returns:Object

one of the supported objects - see class docs for details.

Exceptions
IOException:
if an error occurs reading from the wrapped stream or parsing data.