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 int
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.private static final AtomicInteger
static final String
private int
private byte[]
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected void
bcryptKdf
(byte[] password, byte[] output) byte[]
decodePrivateKeyBytes
(SessionContext session, NamedResource resourceKey, String cipherName, byte[] privateDataBytes, String password) boolean
static int
final String
getName()
int
byte[]
getSalt()
int
hashCode()
protected void
initialize
(InputStream stream, int maxSaltSize) void
initialize
(String name, byte[] kdfOptions) boolean
static void
setMaxAllowedRounds
(int value) void
setNumRounds
(int numRounds) void
setSalt
(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-a
parameter to thessh-keygen
command) 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:
initialize
in interfaceOpenSSHKdfOptions
- Throws:
IOException
-
initialize
- 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
- 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) -
hashCode
public int hashCode() -
equals
-
toString
-
getMaxAllowedRounds
public static int getMaxAllowedRounds() -
setMaxAllowedRounds
public static void setMaxAllowedRounds(int value)
-