Class JcePBEKeyEncryptionMethodGenerator
java.lang.Object
org.bouncycastle.openpgp.operator.PGPKeyEncryptionMethodGenerator
org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator
org.bouncycastle.openpgp.operator.jcajce.JcePBEKeyEncryptionMethodGenerator
JCE based generator for password based encryption (PBE) data protection methods.
-
Constructor Summary
ConstructorsConstructorDescriptionJcePBEKeyEncryptionMethodGenerator
(char[] passPhrase) Create a PBE encryption method generator using the default SHA-1 digest and the default S2K count for key generation.JcePBEKeyEncryptionMethodGenerator
(char[] passPhrase, int s2kCount) Create a PBE encryption method generator using the default SHA-1 digest calculator and a S2K count other than the default for key generation.JcePBEKeyEncryptionMethodGenerator
(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator) Create a PBE encryption method generator using the provided digest and the default S2K count for key generation.JcePBEKeyEncryptionMethodGenerator
(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator, int s2kCount) Create a PBE encryption method generator using the provided calculator and S2K count for key generation. -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
encryptSessionInfo
(int encAlgorithm, byte[] key, byte[] sessionInfo) setProvider
(String providerName) Sets the JCE provider to source cryptographic primitives from.setProvider
(Provider provider) Sets the JCE provider to source cryptographic primitives from.setSecureRandom
(SecureRandom random) Sets a user defined source of randomness.Methods inherited from class org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator
generate, getKey
-
Constructor Details
-
JcePBEKeyEncryptionMethodGenerator
public JcePBEKeyEncryptionMethodGenerator(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator) Create a PBE encryption method generator using the provided digest and the default S2K count for key generation.- Parameters:
passPhrase
- the passphrase to use as the primary source of key material.s2kDigestCalculator
- the digest calculator to use for key calculation.
-
JcePBEKeyEncryptionMethodGenerator
public JcePBEKeyEncryptionMethodGenerator(char[] passPhrase) Create a PBE encryption method generator using the default SHA-1 digest and the default S2K count for key generation.- Parameters:
passPhrase
- the passphrase to use as the primary source of key material.
-
JcePBEKeyEncryptionMethodGenerator
public JcePBEKeyEncryptionMethodGenerator(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator, int s2kCount) Create a PBE encryption method generator using the provided calculator and S2K count for key generation.- Parameters:
passPhrase
- the passphrase to use as the primary source of key material.s2kDigestCalculator
- the digest calculator to use for key calculation.s2kCount
- the single byteS2K
count to use.
-
JcePBEKeyEncryptionMethodGenerator
public JcePBEKeyEncryptionMethodGenerator(char[] passPhrase, int s2kCount) Create a PBE encryption method generator using the default SHA-1 digest calculator and a S2K count other than the default for key generation.- Parameters:
passPhrase
- the passphrase to use as the primary source of key material.s2kCount
- the single byteS2K
count to use.
-
-
Method Details
-
setProvider
Sets the JCE provider to source cryptographic primitives from.- Parameters:
provider
- the JCE provider to use.- Returns:
- the current generator.
-
setProvider
Sets the JCE provider to source cryptographic primitives from.- Parameters:
providerName
- the name of the JCE provider to use.- Returns:
- the current generator.
-
setSecureRandom
Description copied from class:PBEKeyEncryptionMethodGenerator
Sets a user defined source of randomness.If no SecureRandom is configured, a default SecureRandom will be used.
- Overrides:
setSecureRandom
in classPBEKeyEncryptionMethodGenerator
- Returns:
- the current generator.
-
encryptSessionInfo
protected byte[] encryptSessionInfo(int encAlgorithm, byte[] key, byte[] sessionInfo) throws PGPException - Specified by:
encryptSessionInfo
in classPBEKeyEncryptionMethodGenerator
- Throws:
PGPException
-