Package org.bouncycastle.openpgp
Class PGPEncryptedDataList
- java.lang.Object
-
- org.bouncycastle.openpgp.PGPEncryptedDataList
-
- All Implemented Interfaces:
java.lang.Iterable
,org.bouncycastle.util.Iterable
public class PGPEncryptedDataList extends java.lang.Object implements 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:
PacketTags.SYMMETRIC_KEY_ENC_SESSION
- produces aPGPPBEEncryptedData
PacketTags.PUBLIC_KEY_ENC_SESSION
- produces aPGPPublicKeyEncryptedData
All of the objects returned from this holder share a reference to the same encrypted data input stream, which can only be consumed once.
-
-
Constructor Summary
Constructors Constructor Description PGPEncryptedDataList(BCPGInputStream pIn)
Construct an encrypted data packet holder, reading PGP encrypted method packets and an encrytped data packet from the stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
get(int index)
Gets the encryption method object at the specified index.java.util.Iterator
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.boolean
isEmpty()
Returnstrue
iff there are 0 encryption methods in this list.java.util.Iterator
iterator()
Support method for Iterable where available.int
size()
Gets the number of encryption methods in this list.
-
-
-
Constructor Detail
-
PGPEncryptedDataList
public PGPEncryptedDataList(BCPGInputStream pIn) throws java.io.IOException
Construct an encrypted data packet holder, reading PGP encrypted method packets and an encrytped data packet from the stream.The next packet in the stream should be one of
PacketTags.SYMMETRIC_KEY_ENC_SESSION
orPacketTags.PUBLIC_KEY_ENC_SESSION
.- Parameters:
pIn
- the PGP object stream being read.- Throws:
java.io.IOException
- if an error occurs reading from the PGP input.
-
-
Method Detail
-
get
public java.lang.Object get(int index)
Gets the encryption method object at the specified index.- Parameters:
index
- the encryption method to obtain (0 based).
-
size
public int size()
Gets the number of encryption methods in this list.
-
isEmpty
public boolean isEmpty()
Returnstrue
iff there are 0 encryption methods in this list.
-
getEncryptedDataObjects
public java.util.Iterator 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.
-
iterator
public java.util.Iterator iterator()
Support method for Iterable where available.- Specified by:
iterator
in interfacejava.lang.Iterable
- Specified by:
iterator
in interfaceorg.bouncycastle.util.Iterable
-
-