|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.openpgp.operator.PGPKeyEncryptionMethodGenerator | +--org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator
PGP style PBE encryption method.
A pass phrase is used to generate an encryption key using the PGP string-to-key
method. This class always uses the salted and iterated form of the
S2K algorithm
.
Note that the iteration count provided to this method is a single byte as described by the
S2K
algorithm, and the actual iteration count ranges exponentially from
0x01 == 1088 to 0xFF == 65,011,712.
Constructor Summary | |
protected |
PBEKeyEncryptionMethodGenerator(char[] passPhrase,
PGPDigestCalculator s2kDigestCalculator)
Construct a PBE key generator using the default iteration count ( 0x60 == 65536 iterations). |
protected |
PBEKeyEncryptionMethodGenerator(char[] passPhrase,
PGPDigestCalculator s2kDigestCalculator,
int s2kCount)
Construct a PBE key generator using a specific iteration level. |
protected |
PBEKeyEncryptionMethodGenerator(char[] passPhrase,
S2K.Argon2Params params)
Construct a PBE key generator using Argon2 as S2K mechanism. |
Method Summary | |
protected abstract byte[] |
encryptSessionInfo(int encAlgorithm,
byte[] key,
byte[] sessionInfo)
|
ContainedPacket |
generate(int encAlgorithm,
byte[] sessionInfo)
Generate a V4 SKESK packet. |
ContainedPacket |
generateV5(int kekAlgorithm,
int aeadAlgorithm,
byte[] sessionInfo)
|
ContainedPacket |
generateV6(int kekAlgorithm,
int aeadAlgorithm,
byte[] sessionInfo)
|
protected abstract byte[] |
generateV6KEK(int kekAlgorithm,
byte[] ikm,
byte[] info)
|
protected abstract byte[] |
getEskAndTag(int kekAlgorithm,
int aeadAlgorithm,
byte[] sessionInfo,
byte[] key,
byte[] iv,
byte[] info)
|
byte[] |
getKey(int encAlgorithm)
Generate a key for a symmetric encryption algorithm using the PBE configuration in this method. |
int |
getSessionKeyWrapperAlgorithm(int defaultWrapAlg)
Return the key wrapping algorithm this PBE key method is associated with. |
PBEKeyEncryptionMethodGenerator |
setSecureRandom(java.security.SecureRandom random)
Sets a user defined source of randomness. |
PBEKeyEncryptionMethodGenerator |
setSessionKeyWrapperAlgorithm(int wrapAlg)
Set a specific algorithm to be used where this PBE method generator is used to wrap a session key for encrypting data, rather than providing the encryption key for the data. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected PBEKeyEncryptionMethodGenerator(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator)
passPhrase
- the pass phrase to encrypt with.s2kDigestCalculator
- a digest calculator to use in the string-to-key function.protected PBEKeyEncryptionMethodGenerator(char[] passPhrase, S2K.Argon2Params params)
passPhrase
- passphraseparams
- argon2 parametersprotected PBEKeyEncryptionMethodGenerator(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator, int s2kCount)
passPhrase
- the pass phrase to encrypt with.s2kDigestCalculator
- a digest calculator to use in the string-to-key function.s2kCount
- a single byte S2K
iteration count specifier, which is translated to
an actual iteration count by the S2K class.Method Detail |
public PBEKeyEncryptionMethodGenerator setSecureRandom(java.security.SecureRandom random)
If no SecureRandom is configured, a default SecureRandom will be used.
public PBEKeyEncryptionMethodGenerator setSessionKeyWrapperAlgorithm(int wrapAlg)
The default wrapping algorithm is the same algorithm as the one specified for data encryption with the PGPEncryptedDataGenerator used.
public int getSessionKeyWrapperAlgorithm(int defaultWrapAlg)
defaultWrapAlg
- the default wrapping algorithm if none was set.public byte[] getKey(int encAlgorithm) throws PGPException
encAlgorithm
- the encryption algorithm
to generate
the key for.PGPException
- if an error occurs performing the string-to-key generation.public ContainedPacket generateV5(int kekAlgorithm, int aeadAlgorithm, byte[] sessionInfo) throws PGPException
generateV5
in class PGPKeyEncryptionMethodGenerator
public ContainedPacket generateV6(int kekAlgorithm, int aeadAlgorithm, byte[] sessionInfo) throws PGPException
generateV6
in class PGPKeyEncryptionMethodGenerator
public ContainedPacket generate(int encAlgorithm, byte[] sessionInfo) throws PGPException
generate
in class PGPKeyEncryptionMethodGenerator
encAlgorithm
- the encryption algorithm
being usedsessionInfo
- session data generated by the encrypted data generator.PGPException
- protected abstract byte[] encryptSessionInfo(int encAlgorithm, byte[] key, byte[] sessionInfo) throws PGPException
protected abstract byte[] getEskAndTag(int kekAlgorithm, int aeadAlgorithm, byte[] sessionInfo, byte[] key, byte[] iv, byte[] info) throws PGPException
protected abstract byte[] generateV6KEK(int kekAlgorithm, byte[] ikm, byte[] info) throws PGPException
|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |