RFC9580 recommends the following S2K specifiers + usages:
| S2K Specifier | S2K Usage | Note |
|---|---|---|
S2K#ARGON_2 |
org. |
RECOMMENDED; Argon2 MUST be used with AEAD |
S2K#SALTED_AND_ITERATED |
org. |
MAY be used if Argon2 is not available; Take care to use high octet count + strong passphrase |
| none | org. |
Unprotected |
Additionally, implementations MAY use the following combinations with caution:
| S2K Specifier | S2K Usage | Note |
|---|---|---|
S2K#SALTED_AND_ITERATED |
org. |
Does not provide memory hardness |
S2K#SIMPLE |
org. |
Only for reading secret keys in backwards compatibility mode |
| Modifier and Type | Field and Description |
|---|---|
| protected int | |
| protected int | |
| protected char[] | |
| protected SecureRandom | |
| protected S2K | |
| protected int | |
| protected PGPDigestCalculator |
| Access | Constructor and Description |
|---|---|
| protected | PBESecretKeyEncryptor(int encAlgorithm, int aeadAlgorithm, S2K.
|
| protected | PBESecretKeyEncryptor(int encAlgorithm, PGPDigestCalculator s2kDigestCalculator, SecureRandom random, char[] passPhrase)
|
| protected | PBESecretKeyEncryptor(int encAlgorithm, PGPDigestCalculator s2kDigestCalculator, int s2kCount, SecureRandom random, char[] passPhrase)
|
| Modifier and Type | Method and Description |
|---|---|
| public byte[] | Returns: an encryption of the passed in keyData.raw key data keyData, int offset into raw key data keyOff, int length of key data to use. keyLen)Key encryption method invoked for V4 keys and greater. |
| public abstract byte[] | |
| public byte[] | encryptKeyData(byte[] key, byte[] iv, byte[] keyData, int keyOff, int keyLen)
Encrypt the passed in keyData using the key and the iv provided. |
| public int | |
| public int | |
| public abstract byte[] | |
| public int | |
| public byte[] | |
| public S2K |
| aeadAlgorithm | back to summary |
|---|---|
| protected int aeadAlgorithm | |
| encAlgorithm | back to summary |
|---|---|
| protected int encAlgorithm | |
| passPhrase | back to summary |
|---|---|
| protected char[] passPhrase | |
| random | back to summary |
|---|---|
| protected SecureRandom random | |
| s2k | back to summary |
|---|---|
| protected S2K s2k | |
| s2kCount | back to summary |
|---|---|
| protected int s2kCount | |
| s2kDigestCalculator | back to summary |
|---|---|
| protected PGPDigestCalculator s2kDigestCalculator | |
| PBESecretKeyEncryptor | back to summary |
|---|---|
| protected PBESecretKeyEncryptor(int encAlgorithm, int aeadAlgorithm, S2K. | |
| PBESecretKeyEncryptor | back to summary |
|---|---|
| protected PBESecretKeyEncryptor(int encAlgorithm, PGPDigestCalculator s2kDigestCalculator, SecureRandom random, char[] passPhrase) | |
| PBESecretKeyEncryptor | back to summary |
|---|---|
| protected PBESecretKeyEncryptor(int encAlgorithm, PGPDigestCalculator s2kDigestCalculator, int s2kCount, SecureRandom random, char[] passPhrase) | |
| encryptKeyData | back to summary |
|---|---|
| public byte[] encryptKeyData(byte[] keyData, int keyOff, int keyLen) throws PGPException Key encryption method invoked for V4 keys and greater.
| |
| encryptKeyData | back to summary |
|---|---|
| public abstract byte[] encryptKeyData(byte[] key, byte[] keyData, int keyOff, int keyLen) throws PGPException | |
| encryptKeyData | back to summary |
|---|---|
| public byte[] encryptKeyData(byte[] key, byte[] iv, byte[] keyData, int keyOff, int keyLen) throws PGPException Encrypt the passed in keyData using the key and the iv provided. This method is only used for processing version 3 keys. | |
| getAeadAlgorithm | back to summary |
|---|---|
| public int getAeadAlgorithm() | |
| getAlgorithm | back to summary |
|---|---|
| public int getAlgorithm() | |
| getCipherIV | back to summary |
|---|---|
| public abstract byte[] getCipherIV() | |
| getHashAlgorithm | back to summary |
|---|---|
| public int getHashAlgorithm() | |
| getKey | back to summary |
|---|---|
| public byte[] getKey() throws PGPException | |
| getS2K | back to summary |
|---|---|
| public S2K getS2K() | |