public static PGPDataDecryptor createDataDecryptor(boolean withIntegrityPacket, BlockCipher engine, byte[] key) { final BufferedBlockCipher c = createStreamCipher(false, engine, withIntegrityPacket, key); return new PGPDataDecryptor() { public InputStream getInputStream(InputStream in) { return new CipherInputStream(in, c); } public int getBlockSize() { return c.getBlockSize(); } public PGPDigestCalculator getIntegrityCalculator() { return new SHA1PGPDigestCalculator(); } }; }
public PublicKeyDataDecryptorFactory build(final PrivateKey privKey) { return new PublicKeyDataDecryptorFactory() { public byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData) throws PGPException { if (keyAlgorithm == PublicKeyAlgorithmTags.ECDH) { throw new PGPException("ECDH requires use of PGPPrivateKey for decryption"); } return decryptSessionData(keyAlgorithm, privKey, secKeyData); } public PGPDataDecryptor createDataDecryptor(boolean withIntegrityPacket, int encAlgorithm, byte[] key) throws PGPException { return contentHelper.createDataDecryptor(withIntegrityPacket, encAlgorithm, key); } }; }
public PublicKeyDataDecryptorFactory build(final PGPPrivateKey privKey) { return new PublicKeyDataDecryptorFactory() { public byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData) throws PGPException { if (keyAlgorithm == PublicKeyAlgorithmTags.ECDH) { return decryptSessionData(privKey.getPrivateKeyDataPacket(), privKey.getPublicKeyPacket(), secKeyData); } return decryptSessionData(keyAlgorithm, keyConverter.getPrivateKey(privKey), secKeyData); } public PGPDataDecryptor createDataDecryptor(boolean withIntegrityPacket, int encAlgorithm, byte[] key) throws PGPException { return contentHelper.createDataDecryptor(withIntegrityPacket, encAlgorithm, key); } }; }
public PublicKeyDataDecryptorFactory build(final PrivateKey privKey) { return new PublicKeyDataDecryptorFactory() { public byte[] recoverSessionData(int keyAlgorithm, BigInteger[] secKeyData) throws PGPException { return decryptSessionData(keyAlgorithm, privKey, secKeyData); } public PGPDataDecryptor createDataDecryptor(boolean withIntegrityPacket, int encAlgorithm, byte[] key) throws PGPException { return contentHelper.createDataDecryptor(withIntegrityPacket, encAlgorithm, key); } }; }
public PublicKeyDataDecryptorFactory build(final PGPPrivateKey privKey) { return new PublicKeyDataDecryptorFactory() { public byte[] recoverSessionData(int keyAlgorithm, BigInteger[] secKeyData) throws PGPException { return decryptSessionData(keyAlgorithm, keyConverter.getPrivateKey(privKey), secKeyData); } public PGPDataDecryptor createDataDecryptor(boolean withIntegrityPacket, int encAlgorithm, byte[] key) throws PGPException { return contentHelper.createDataDecryptor(withIntegrityPacket, encAlgorithm, key); } }; }
public PGPDataDecryptor createDataDecryptor(boolean withIntegrityPacket, int encAlgorithm, byte[] key) throws PGPException { BlockCipher engine = BcImplProvider.createBlockCipher(encAlgorithm); return BcUtil.createDataDecryptor(withIntegrityPacket, engine, key); }