code: protected static void decryptData(final PGPPrivateKey privateKey, final PGPPublicKeyEncryptedData data,
                                        final BcKeyFingerprintCalculator calculator, final OutputStream targetStream)
          throws PGPException, IOException {
          PublicKeyDataDecryptorFactory decryptorFactory = new JcePublicKeyDataDecryptorFactoryBuilder().setProvider
              (PROVIDER).setContentProvider(PROVIDER).build(privateKey);
  
          InputStream content = data.getDataStream(decryptorFactory);
  
          PGPObjectFactory plainFactory = new PGPObjectFactory(content, calculator);
  
          Object message = plainFactory.nextObject();
  
          if(message instanceof PGPCompressedData) {
              PGPCompressedData compressedData = (PGPCompressedData) message;
              PGPObjectFactory compressedFactory = new PGPObjectFactory(compressedData.getDataStream(), calculator);
              message = compressedFactory.nextObject();
          }
  
          if(message instanceof PGPLiteralData) {
              PGPLiteralData literalData = (PGPLiteralData) message;
              try(InputStream literalStream = literalData.getInputStream()) {
                  IOUtils.copy(literalStream, targetStream);
              }
          } else if(message instanceof PGPOnePassSignatureList) {
              throw new PGPException("Encrypted message contains a signed message - not literal data.");
          } else {
              throw new PGPException("Message is not a simple encrypted file - type unknown.");
          }
  
          if(data.isIntegrityProtected() && !data.verify()) {
              throw new PGPException("Message failed integrity check");
          }
      }
docs: Performs the decryption of the given data.
  @param privateKey PGP Private Key to decrypt
  @param data encrypted data
  @param calculator instance of {@link BcKeyFingerprintCalculator}
  @param targetStream stream to receive the decrypted data
  @throws PGPException if the decryption process fails
  @throws IOException if the stream write operation fails