Class BcPBEKeyEncryptionMethodGenerator
java.lang.Object
org.bouncycastle.openpgp.operator.PGPKeyEncryptionMethodGenerator
org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator
org.bouncycastle.openpgp.operator.bc.BcPBEKeyEncryptionMethodGenerator
A BC lightweight method generator for supporting PBE based encryption operations.
-
Constructor Summary
ConstructorDescriptionBcPBEKeyEncryptionMethodGenerator
(char[] passPhrase) Create a PBE encryption method generator using the default SHA-1 digest and the default S2K count for key generation.BcPBEKeyEncryptionMethodGenerator
(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.BcPBEKeyEncryptionMethodGenerator
(char[] passPhrase, S2K.Argon2Params argon2Params) Create a PBE encryption method generator using Argon2 for S2K key generation.BcPBEKeyEncryptionMethodGenerator
(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator) Create a PBE encryption method generator using the provided digest and the default S2K count for key generation.BcPBEKeyEncryptionMethodGenerator
(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) protected byte[]
generateV6KEK
(int kekAlgorithm, byte[] ikm, byte[] info) protected byte[]
getEskAndTag
(int kekAlgorithm, int aeadAlgorithm, byte[] sessionInfo, byte[] key, byte[] iv, byte[] info) setSecureRandom
(SecureRandom random) Sets a user defined source of randomness.Methods inherited from class org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator
generate, generateV5, generateV6, getKey, getSessionKeyWrapperAlgorithm, setSessionKeyWrapperAlgorithm
-
Constructor Details
-
BcPBEKeyEncryptionMethodGenerator
public BcPBEKeyEncryptionMethodGenerator(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.
-
BcPBEKeyEncryptionMethodGenerator
public BcPBEKeyEncryptionMethodGenerator(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.
-
BcPBEKeyEncryptionMethodGenerator
Create a PBE encryption method generator using Argon2 for S2K key generation.- Parameters:
passPhrase
- passphraseargon2Params
- parameters for argon2
-
BcPBEKeyEncryptionMethodGenerator
public BcPBEKeyEncryptionMethodGenerator(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.
-
BcPBEKeyEncryptionMethodGenerator
public BcPBEKeyEncryptionMethodGenerator(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
-
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
-
generateV6KEK
protected byte[] generateV6KEK(int kekAlgorithm, byte[] ikm, byte[] info) - Specified by:
generateV6KEK
in classPBEKeyEncryptionMethodGenerator
-
getEskAndTag
protected byte[] getEskAndTag(int kekAlgorithm, int aeadAlgorithm, byte[] sessionInfo, byte[] key, byte[] iv, byte[] info) throws PGPException - Specified by:
getEskAndTag
in classPBEKeyEncryptionMethodGenerator
- Throws:
PGPException
-