Class PGPEncryptedData

java.lang.Object
org.bouncycastle.openpgp.PGPEncryptedData
All Implemented Interfaces:
SymmetricKeyAlgorithmTags
Direct Known Subclasses:
PGPPBEEncryptedData, PGPPublicKeyEncryptedData

public abstract class PGPEncryptedData extends Object implements SymmetricKeyAlgorithmTags
A PGP encrypted data object.

Encrypted data packets are decrypted using a PGPDataDecryptor obtained from a PGPDataDecryptorFactory.

  • Method Details

    • getInputStream

      public 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.
      Returns:
      true if there is a modification detection code package associated with this stream
    • verify

      public boolean verify() throws PGPException, 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 not integrity protected.
      IOException