code: @SuppressWarnings("rawtypes")
      public static void decrypt(InputStream encryptedStream, OutputStream targetStream, InputStream
          privateKeyStream, char[] password) throws Exception {
  
          BcKeyFingerprintCalculator calculator = new BcKeyFingerprintCalculator();
          PGPObjectFactory factory = new PGPObjectFactory(PGPUtil.getDecoderStream(encryptedStream), calculator);
          PGPEncryptedDataList dataList;
          Object object = factory.nextObject();
          if(object instanceof PGPEncryptedDataList) {
              dataList = (PGPEncryptedDataList) object;
          } else {
              dataList = (PGPEncryptedDataList) factory.nextObject();
          }
          Iterator objects = dataList.getEncryptedDataObjects();
          PGPPrivateKey privateKey = null;
          PGPPublicKeyEncryptedData data = null;
          while(privateKey == null && objects.hasNext()) {
              data = (PGPPublicKeyEncryptedData) objects.next();
              privateKey = findSecretKey(privateKeyStream, data.getKeyID(), password);
          }
          if(privateKey == null) {
              throw new IllegalArgumentException("Secret key for message not found.");
          }
  
          decryptData(privateKey, data, calculator, targetStream);
      }
docs: Performs decryption of a given stream using a PGP private key.
  @param encryptedStream stream providing the encrypted data
  @param targetStream stream to receive the decrypted data
  @param privateKeyStream stream providing the encoded PGP private key
  @param password passphrase for the private key
  @throws IOException if there is an error reading or writing from the streams
  @throws PGPException if the decryption process fails