Class BCryptKdfOptions
- java.lang.Object
-
- org.apache.sshd.common.config.keys.loader.openssh.kdf.BCryptKdfOptions
-
- All Implemented Interfaces:
OpenSSHKdfOptions,OpenSSHKeyDecryptor,NamedResource
public class BCryptKdfOptions extends Object implements OpenSSHKdfOptions
- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBCryptKdfOptions.BCryptBadRoundsException
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_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.static StringNAME-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
Fields 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 Constructor Description BCryptKdfOptions()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbcryptKdf(byte[] password, byte[] output)byte[]decodePrivateKeyBytes(SessionContext session, NamedResource resourceKey, String cipherName, byte[] privateDataBytes, String password)booleanequals(Object obj)static intgetMaxAllowedRounds()StringgetName()intgetNumRounds()byte[]getSalt()inthashCode()protected voidinitialize(InputStream stream, int maxSaltSize)voidinitialize(String name, byte[] kdfOptions)booleanisEncrypted()static voidsetMaxAllowedRounds(int value)voidsetNumRounds(int numRounds)voidsetSalt(byte[] salt)StringtoString()
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
DEFAULT_MAX_ROUNDS
public static final int DEFAULT_MAX_ROUNDS
Various 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:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(String name, byte[] kdfOptions) throws IOException
- Specified by:
initializein interfaceOpenSSHKdfOptions- Throws:
IOException
-
initialize
protected void initialize(InputStream stream, int maxSaltSize) throws IOException
- Throws:
IOException
-
isEncrypted
public boolean isEncrypted()
- Specified by:
isEncryptedin interfaceOpenSSHKeyDecryptor
-
decodePrivateKeyBytes
public byte[] decodePrivateKeyBytes(SessionContext session, NamedResource resourceKey, String cipherName, 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
public final String 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)
-
getMaxAllowedRounds
public static int getMaxAllowedRounds()
-
setMaxAllowedRounds
public static void setMaxAllowedRounds(int value)
-
-