org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpg-fips Show documentation
Show all versions of bcpg-fips Show documentation
The Bouncy Castle Java APIs for the OpenPGP Protocol. The APIs are designed primarily to be used in conjunction with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified and used appropriately.
package org.bouncycastle.openpgp.operator;
import org.bouncycastle.bcpg.S2K;
import org.bouncycastle.openpgp.PGPException;
public abstract class PBESecretKeyDecryptor
{
private char[] passPhrase;
private PGPDigestCalculatorProvider calculatorProvider;
protected PBESecretKeyDecryptor(char[] passPhrase, PGPDigestCalculatorProvider calculatorProvider)
{
this.passPhrase = passPhrase;
this.calculatorProvider = calculatorProvider;
}
public PGPDigestCalculator getChecksumCalculator(int hashAlgorithm)
throws PGPException
{
return calculatorProvider.get(hashAlgorithm);
}
public byte[] makeKeyFromPassPhrase(int keyAlgorithm, S2K s2k)
throws PGPException
{
return PGPUtil.makeKeyFromPassPhrase(calculatorProvider, keyAlgorithm, s2k, passPhrase);
}
public abstract byte[] recoverKeyData(int encAlgorithm, byte[] key, byte[] iv, byte[] keyData, int keyOff, int keyLen)
throws PGPException;
public abstract byte[] recoverKeyData(
int encAlgorithm,
int aeadAlgorithm,
byte[] s2kKey,
byte[] iv,
int packetTag,
int keyVersion,
byte[] keyData,
byte[] pubkeyData)
throws PGPException;
}