Top Description Fields Constructors Methods
org.bouncycastle.openpgp

public Class PGPEncryptedDataList

extends Object
implements Iterable<PGPEncryptedData>
Class Inheritance
All Implemented Interfaces
org.bouncycastle.util.Iterable, java.lang.Iterable
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, java.util.ArrayList, .Iterator, .List, java.util.logging.Level, .Logger, org.bouncycastle.bcpg.BCPGInputStream, .InputStreamPacket, .Packet, .PacketTags, .PublicKeyEncSessionPacket, .SymmetricEncIntegrityPacket, .SymmetricKeyEncSessionPacket, .UnsupportedPacketVersionException, org.bouncycastle.util.Iterable

A holder for a list of PGP encryption method packets and the encrypted data associated with them.

This holder supports reading a sequence of the following encryption methods, followed by an encrypted data packet:

All of the objects returned from this holder share a reference to the same encrypted data input stream, which can only be consumed once.

Field Summary

Modifier and TypeField and Description
pack-priv InputStreamPacket
private static final Logger
pack-priv List<PGPEncryptedData>

Constructor Summary

AccessConstructor and Description
public
PGPEncryptedDataList(byte[]
a byte array containing an encrypted stream.
encData
)

Construct an encrypted data packet holder, reading PGP encrypted method packets and an encrypted data packet from a stream.

public
PGPEncryptedDataList(InputStream
the input stream being read.
inStream
)

Construct an encrypted data packet holder, reading PGP encrypted method packets and an encrypted data packet from a stream.

public
PGPEncryptedDataList(BCPGInputStream
the PGP object stream being read.
pIn
)

Construct an encrypted data packet holder, reading PGP encrypted method packets and an encrypted data packet from the stream.

Method Summary

Modifier and TypeMethod and Description
public PGPSessionKeyEncryptedData

Returns:

session key encrypted data
extractSessionKeyEncryptedData
()

Create a decryption method using a PGPSessionKey.

public PGPEncryptedData
get(int
the encryption method to obtain (0 based).
index
)

Gets the encryption method object at the specified index.

public Iterator<PGPEncryptedData>
getEncryptedDataObjects()

Returns an iterator over the encryption method objects held in this list, in the order they appeared in the stream they are read from.

public boolean
isEmpty()

Returns true iff there are 0 encryption methods in this list.

public boolean

Returns:

true if there is a modification detection code package associated with this stream
isIntegrityProtected
()

Checks whether the packet is integrity protected.

public Iterator<PGPEncryptedData>
iterator()

Implements org.bouncycastle.util.Iterable.iterator.

Support method for Iterable where available.

public int
size()

Gets the number of encryption methods in this list.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
pack-priv InputStreamPacket data
LOGback to summary
private static final Logger LOG
methodsback to summary
pack-priv List<PGPEncryptedData> methods

Constructor Detail

PGPEncryptedDataListback to summary
public PGPEncryptedDataList(byte[] encData) throws IOException

Construct an encrypted data packet holder, reading PGP encrypted method packets and an encrypted data packet from a stream.

The first packet in the stream should be one of PacketTags#SYMMETRIC_KEY_ENC_SESSION or PacketTags#PUBLIC_KEY_ENC_SESSION.

Parameters
encData:byte[]

a byte array containing an encrypted stream.

Exceptions
IOException:
if an error occurs reading from the PGP input.
PGPEncryptedDataListback to summary
public PGPEncryptedDataList(InputStream inStream) throws IOException

Construct an encrypted data packet holder, reading PGP encrypted method packets and an encrypted data packet from a stream.

The first packet in the stream should be one of PacketTags#SYMMETRIC_KEY_ENC_SESSION or PacketTags#PUBLIC_KEY_ENC_SESSION.

Parameters
inStream:InputStream

the input stream being read.

Exceptions
IOException:
if an error occurs reading from the PGP input.
PGPEncryptedDataListback to summary
public PGPEncryptedDataList(BCPGInputStream pIn) throws IOException

Construct an encrypted data packet holder, reading PGP encrypted method packets and an encrypted data packet from the stream.

The next packet in the stream should be one of PacketTags#SYMMETRIC_KEY_ENC_SESSION or PacketTags#PUBLIC_KEY_ENC_SESSION.

Parameters
pIn:BCPGInputStream

the PGP object stream being read.

Exceptions
IOException:
if an error occurs reading from the PGP input.

Method Detail

extractSessionKeyEncryptedDataback to summary
public PGPSessionKeyEncryptedData extractSessionKeyEncryptedData()

Create a decryption method using a PGPSessionKey. This method can be used to decrypt messages which do not contain a SKESK or PKESK packet using a session key.

Returns:PGPSessionKeyEncryptedData

session key encrypted data

getback to summary
public PGPEncryptedData get(int index)

Gets the encryption method object at the specified index.

Parameters
index:int

the encryption method to obtain (0 based).

getEncryptedDataObjectsback to summary
public Iterator<PGPEncryptedData> getEncryptedDataObjects()

Returns an iterator over the encryption method objects held in this list, in the order they appeared in the stream they are read from.

isEmptyback to summary
public boolean isEmpty()

Returns true iff there are 0 encryption methods in this list.

isIntegrityProtectedback to summary
public boolean isIntegrityProtected()

Checks whether the packet is integrity protected.

Returns:boolean

true if there is a modification detection code package associated with this stream

iteratorback to summary
public Iterator<PGPEncryptedData> iterator()

Implements org.bouncycastle.util.Iterable.iterator.

Support method for Iterable where available.

Returns:Iterator<PGPEncryptedData>

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

an Iterator.

sizeback to summary
public int size()

Gets the number of encryption methods in this list.