Package org.bouncycastle.openpgp
Class PGPEncryptedData
- java.lang.Object
-
- org.bouncycastle.openpgp.PGPEncryptedData
-
- All Implemented Interfaces:
AEADAlgorithmTags
,SymmetricKeyAlgorithmTags
- Direct Known Subclasses:
PGPPublicKeyEncryptedData
,PGPSymmetricKeyEncryptedData
public abstract class PGPEncryptedData extends java.lang.Object implements SymmetricKeyAlgorithmTags, AEADAlgorithmTags
A PGP encrypted data object.Encrypted data packets are decrypted using a
PGPDataDecryptor
obtained from aPGPDataDecryptorFactory
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
PGPEncryptedData.TruncatedStream
-
Field Summary
-
Fields inherited from interface org.bouncycastle.bcpg.AEADAlgorithmTags
EAX, GCM, OCB
-
Fields inherited from interface org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags
AES_128, AES_192, AES_256, BLOWFISH, CAMELLIA_128, CAMELLIA_192, CAMELLIA_256, CAST5, DES, IDEA, NULL, SAFER, TRIPLE_DES, TWOFISH
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAlgorithm()
Return the symmetric encryption algorithm that is used by the packet.java.io.InputStream
getInputStream()
Return the raw input stream for the data stream.int
getVersion()
Return the version number of the Encrypted Session Key Packet.boolean
isAEAD()
Checks whether the packet is protected using an AEAD algorithm.boolean
isIntegrityProtected()
Checks whether the packet is integrity protected using a modification detection code package.boolean
verify()
Verifies the integrity of the packet against the modification detection code associated with it in the stream.
-
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream()
Return the raw input stream for the data stream.Note this stream is shared with all other encryption methods in the same
PGPEncryptedDataList
and with any decryption methods in sub-classes, so consuming this stream will affect decryption.- Returns:
- the encrypted data in this packet.
-
isIntegrityProtected
public boolean isIntegrityProtected()
Checks whether the packet is integrity protected using a modification detection code package.- Returns:
true
if there is a modification detection code package associated with this stream
-
isAEAD
public boolean isAEAD()
Checks whether the packet is protected using an AEAD algorithm.- Returns:
true
if there is a modification detection code package associated with this stream
-
verify
public boolean verify() throws PGPException, java.io.IOException
Verifies the integrity of the packet against the modification detection code associated with it in the stream.Note: This can only be called after the message has been read.
- Returns:
true
if the message verifies,false
otherwise.- Throws:
PGPException
- if the message is notintegrity protected
.java.io.IOException
-
getVersion
public int getVersion()
Return the version number of the Encrypted Session Key Packet.- Returns:
- version
-
getAlgorithm
public int getAlgorithm()
Return the symmetric encryption algorithm that is used by the packet.- Returns:
- algorithm
-
-