public class PBKDF2CipherProvider extends RandomIVPBECipherProvider
| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_ITERATION_COUNT
This can be calculated automatically using the code
PBKDF2CipherProviderGroovyTest#calculateMinimumIterationCount or manually updated by a maintainer |
private static String |
DEFAULT_PRF |
private static int |
DEFAULT_SALT_LENGTH |
private int |
iterationCount |
private static org.slf4j.Logger |
logger |
private org.bouncycastle.crypto.Digest |
prf |
IV_DELIMITER, MAX_IV_LIMIT, MAX_SALT_LIMIT, SALT_DELIMITER| Constructor and Description |
|---|
PBKDF2CipherProvider()
Instantiates a PBKDF2 cipher provider with the default number of iterations and the default PRF.
|
PBKDF2CipherProvider(String prf,
int iterationCount)
Instantiates a PBKDF2 cipher provider with the specified number of iterations and the specified PRF.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
generateSalt()
Returns a random salt suitable for this cipher provider.
|
Cipher |
getCipher(EncryptionMethod encryptionMethod,
String password,
byte[] salt,
byte[] iv,
int keyLength,
boolean encryptMode)
Returns an initialized cipher for the specified algorithm.
|
Cipher |
getCipher(EncryptionMethod encryptionMethod,
String password,
byte[] salt,
int keyLength,
boolean encryptMode)
Returns an initialized cipher for the specified algorithm.
|
int |
getDefaultSaltLength()
Returns the default salt length for this implementation.
|
protected Cipher |
getInitializedCipher(EncryptionMethod encryptionMethod,
String password,
byte[] salt,
byte[] iv,
int keyLength,
boolean encryptMode) |
protected int |
getIterationCount() |
(package private) org.slf4j.Logger |
getLogger() |
protected String |
getPRFName() |
private org.bouncycastle.crypto.Digest |
resolvePRF(String prf) |
readIV, readSalt, writeIV, writeSaltprivate static final org.slf4j.Logger logger
private static final int DEFAULT_SALT_LENGTH
private final int iterationCount
private final org.bouncycastle.crypto.Digest prf
private static final String DEFAULT_PRF
private static final int DEFAULT_ITERATION_COUNT
PBKDF2CipherProviderGroovyTest#calculateMinimumIterationCount or manually updated by a maintainerpublic PBKDF2CipherProvider()
public PBKDF2CipherProvider(String prf, int iterationCount)
prf - a String representation of the PRF name, e.g. "SHA256", "SHA-384" "sha_512"iterationCount - the number of iterationspublic Cipher getCipher(EncryptionMethod encryptionMethod, String password, byte[] salt, byte[] iv, int keyLength, boolean encryptMode) throws Exception
getCipher in class RandomIVPBECipherProviderencryptionMethod - the EncryptionMethodpassword - the secret inputsalt - the saltiv - the IVkeyLength - the desired key length in bitsencryptMode - true for encrypt, false for decryptException - if there is a problem initializing the cipherorg.slf4j.Logger getLogger()
getLogger in class RandomIVPBECipherProviderpublic Cipher getCipher(EncryptionMethod encryptionMethod, String password, byte[] salt, int keyLength, boolean encryptMode) throws Exception
Cipher.getIV().encryptionMethod - the EncryptionMethodpassword - the secret inputsalt - the saltkeyLength - the desired key length in bitsencryptMode - true for encrypt, false for decryptException - if there is a problem initializing the cipherprotected Cipher getInitializedCipher(EncryptionMethod encryptionMethod, String password, byte[] salt, byte[] iv, int keyLength, boolean encryptMode) throws Exception
Exceptionpublic byte[] generateSalt()
PBECipherProviderPBECipherProvider.getDefaultSaltLength()public int getDefaultSaltLength()
PBECipherProviderprotected int getIterationCount()
protected String getPRFName()
private org.bouncycastle.crypto.Digest resolvePRF(String prf)
Copyright © 2020 Apache NiFi Project. All rights reserved.