Class BCryptKdfOptions
java.lang.Object
org.apache.sshd.common.config.keys.loader.openssh.kdf.BCryptKdfOptions
- All Implemented Interfaces:
OpenSSHKdfOptions,OpenSSHKeyDecryptor,NamedResource
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intVarious discussions on the net seem to indicate that 64 is the value at which many computers seem to slow down noticeably, so we are rather generous here.private static final AtomicIntegerstatic final Stringprivate intprivate byte[]Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTORFields inherited from interface org.apache.sshd.common.config.keys.loader.openssh.OpenSSHKdfOptions
IS_NONE_KDF, MAX_KDF_NAME_LENGTH, MAX_KDF_OPTIONS_SIZE, NONE_KDF -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbcryptKdf(byte[] password, byte[] output) byte[]decodePrivateKeyBytes(SessionContext session, NamedResource resourceKey, CipherFactory cipherSpec, byte[] privateDataBytes, String password) booleanstatic intfinal StringgetName()intbyte[]getSalt()inthashCode()protected voidinitialize(InputStream stream, int maxSaltSize) voidinitialize(String name, byte[] kdfOptions) booleanstatic voidsetMaxAllowedRounds(int value) voidsetNumRounds(int numRounds) voidsetSalt(byte[] salt) toString()
-
Field Details
-
NAME
- See Also:
-
DEFAULT_MAX_ROUNDS
public static final int DEFAULT_MAX_ROUNDSVarious discussions on the net seem to indicate that 64 is the value at which many computers seem to slow down noticeably, so we are rather generous here. The default value (unless overridden by the-aparameter to thessh-keygencommand) is usually 16.- See Also:
-
MAX_ROUNDS_HOLDER
-
salt
private byte[] salt -
numRounds
private int numRounds
-
-
Constructor Details
-
BCryptKdfOptions
public BCryptKdfOptions()
-
-
Method Details
-
initialize
- Specified by:
initializein interfaceOpenSSHKdfOptions- Throws:
IOException
-
initialize
- Throws:
IOException
-
isEncrypted
public boolean isEncrypted()- Specified by:
isEncryptedin interfaceOpenSSHKeyDecryptor
-
decodePrivateKeyBytes
public byte[] decodePrivateKeyBytes(SessionContext session, NamedResource resourceKey, CipherFactory cipherSpec, byte[] privateDataBytes, String password) throws IOException, GeneralSecurityException - Specified by:
decodePrivateKeyBytesin interfaceOpenSSHKeyDecryptor- Throws:
IOExceptionGeneralSecurityException
-
bcryptKdf
protected void bcryptKdf(byte[] password, byte[] output) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
getName
- Specified by:
getNamein interfaceNamedResource- Returns:
- The resource name
-
getSalt
public byte[] getSalt() -
setSalt
public void setSalt(byte[] salt) -
getNumRounds
public int getNumRounds() -
setNumRounds
public void setNumRounds(int numRounds) -
hashCode
public int hashCode() -
equals
-
toString
-
getMaxAllowedRounds
public static int getMaxAllowedRounds() -
setMaxAllowedRounds
public static void setMaxAllowedRounds(int value)
-