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 class
BCryptKdfOptions.BCryptBadRoundsException
-
Field Summary
Fields Modifier and Type Field Description static 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.static String
NAME
-
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 void
bcryptKdf(byte[] password, byte[] output)
byte[]
decodePrivateKeyBytes(SessionContext session, NamedResource resourceKey, String cipherName, byte[] privateDataBytes, String password)
boolean
equals(Object obj)
static int
getMaxAllowedRounds()
String
getName()
int
getNumRounds()
byte[]
getSalt()
int
hashCode()
protected void
initialize(InputStream stream, int maxSaltSize)
void
initialize(String name, byte[] kdfOptions)
boolean
isEncrypted()
static void
setMaxAllowedRounds(int value)
void
setNumRounds(int numRounds)
void
setSalt(byte[] salt)
String
toString()
-
-
-
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-a
parameter to thessh-keygen
command) is usually 16.- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(String name, byte[] kdfOptions) throws IOException
- Specified by:
initialize
in interfaceOpenSSHKdfOptions
- Throws:
IOException
-
initialize
protected void initialize(InputStream stream, int maxSaltSize) throws IOException
- Throws:
IOException
-
isEncrypted
public boolean isEncrypted()
- Specified by:
isEncrypted
in interfaceOpenSSHKeyDecryptor
-
decodePrivateKeyBytes
public byte[] decodePrivateKeyBytes(SessionContext session, NamedResource resourceKey, String cipherName, byte[] privateDataBytes, String password) throws IOException, GeneralSecurityException
- Specified by:
decodePrivateKeyBytes
in interfaceOpenSSHKeyDecryptor
- Throws:
IOException
GeneralSecurityException
-
bcryptKdf
protected void bcryptKdf(byte[] password, byte[] output) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
getName
public final String getName()
- Specified by:
getName
in 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)
-
-