A pass phrase is used to generate an encryption key using the PGP string-to-key
method.
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.
| Modifier and Type | Field and Description |
|---|---|
| private char[] | |
| private SecureRandom | |
| private S2K | |
| private int | |
| private PGPDigestCalculator | |
| private int |
| Access | Constructor and Description |
|---|---|
| protected | PBEKeyEncryptionMethodGenerator(char[]
the pass phrase to encrypt with. passPhrase, PGPDigestCalculator a digest calculator to use in the string-to-key function. s2kDigestCalculator)Construct a PBE key generator using the default iteration count ( |
| protected | PBEKeyEncryptionMethodGenerator(char[]
passphrase passPhrase, S2K.argon2 parameters paramsConstruct a PBE key generator using Argon2 as S2K mechanism. |
| protected | PBEKeyEncryptionMethodGenerator(char[]
the pass phrase to encrypt with. passPhrase, PGPDigestCalculator a digest calculator to use in the string-to-key function. s2kDigestCalculator, int a single byte s2kCount)S2K iteration count specifier, which is translated to
an actual iteration count by the S2K class.Construct a PBE key generator using a specific iteration level. |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract byte[] | |
| public ContainedPacket | Returns: a packet encoding the provided information and the configuration of this instance.session data generated by the encrypted data generator. sessionKey)Implements org. Generates a version 4 Symmetric-Key-Encrypted-Session-Key (SKESK) packet, encoding the encrypted session-key for this method. |
| protected abstract byte[] | |
| protected abstract byte[] | getEskAndTag(int kekAlgorithm, int aeadAlgorithm, byte[] sessionKey, byte[] key, byte[] iv, byte[] info)
|
| public byte[] | Returns: the bytes of the generated key.the encAlgorithm)encryption algorithm to generate
the key for.Generate a key for a symmetric encryption algorithm using the PBE configuration in this method. |
| public int | Returns: the PBE method's wrapping algorithm, defaultWrapAlg is setSessionKeyWrapperAlgorithm was not called.the default wrapping algorithm if none was set. defaultWrapAlg)Return the key wrapping algorithm this PBE key method is associated with. |
| public PBEKeyEncryptionMethodGenerator | Returns: the current generator.Sets a user defined source of randomness. |
| public PBEKeyEncryptionMethodGenerator | Returns: the current generator.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. |
| passPhrase | back to summary |
|---|---|
| private char[] passPhrase | |
| random | back to summary |
|---|---|
| private SecureRandom random | |
| s2k | back to summary |
|---|---|
| private S2K s2k | |
| s2kCount | back to summary |
|---|---|
| private int s2kCount | |
| s2kDigestCalculator | back to summary |
|---|---|
| private PGPDigestCalculator s2kDigestCalculator | |
| wrapAlg | back to summary |
|---|---|
| private int wrapAlg | |
| PBEKeyEncryptionMethodGenerator | back to summary |
|---|---|
| protected PBEKeyEncryptionMethodGenerator(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator) Construct a PBE key generator using the default iteration count (
| |
| PBEKeyEncryptionMethodGenerator | back to summary |
|---|---|
| protected PBEKeyEncryptionMethodGenerator(char[] passPhrase, S2K. Construct a PBE key generator using Argon2 as S2K mechanism.
| |
| PBEKeyEncryptionMethodGenerator | back to summary |
|---|---|
| protected PBEKeyEncryptionMethodGenerator(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator, int s2kCount) Construct a PBE key generator using a specific iteration level.
| |
| encryptSessionInfo | back to summary |
|---|---|
| protected abstract byte[] encryptSessionInfo(int encAlgorithm, byte[] key, byte[] sessionInfo) throws PGPException | |
| generate | back to summary |
|---|---|
| public ContainedPacket generate(PGPDataEncryptorBuilder dataEncryptorBuilder, byte[] sessionKey) throws PGPException Implements org. Generates a version 4 Symmetric-Key-Encrypted-Session-Key (SKESK) packet, encoding the encrypted session-key for this method. SKESKv4 packets are used by Symmetrically-Encrypted-Integrity-Protected-Data (SEIPD) packets of version 1, or by (deprecated) Symmetrically-Encrypted-Data (SED) packets.
Generates a version 5 Symmetric-Key-Encrypted-Session-Key (SKESK) packet, encoding the encrypted
session-key for this method.
SKESKv5 packets are used with Generates a version 6 Symmetric-Key-Encrypted-Session-Key (SKESK) packet, encoding the encrypted session-key for this method. SKESKv6 packets are used with Symmetrically-Encrypted Integrity-Protected Data (SEIPD) packets of version 2 only. A SKESKv6 packet MUST NOT precede a SEIPDv1, OED or SED packet.
| |
| generateV6KEK | back to summary |
|---|---|
| protected abstract byte[] generateV6KEK(int kekAlgorithm, byte[] ikm, byte[] info) throws PGPException | |
| getEskAndTag | back to summary |
|---|---|
| protected abstract byte[] getEskAndTag(int kekAlgorithm, int aeadAlgorithm, byte[] sessionKey, byte[] key, byte[] iv, byte[] info) throws PGPException | |
| getKey | back to summary |
|---|---|
| public byte[] getKey(int encAlgorithm) throws PGPException Generate a key for a symmetric encryption algorithm using the PBE configuration in this method.
| |
| getSessionKeyWrapperAlgorithm | back to summary |
|---|---|
| public int getSessionKeyWrapperAlgorithm(int defaultWrapAlg) Return the key wrapping algorithm this PBE key method is associated with.
| |
| setSecureRandom | back to summary |
|---|---|
| public PBEKeyEncryptionMethodGenerator setSecureRandom(SecureRandom random) Sets a user defined source of randomness. If no SecureRandom is configured, a default SecureRandom will be used.
| |
| setSessionKeyWrapperAlgorithm | back to summary |
|---|---|
| public 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. The default wrapping algorithm is the same algorithm as the one specified for data encryption with the PGPEncryptedDataGenerator used.
| |