Top Inners Fields Constructors Methods
org.apache.sshd.common.config.keys.loader.openssh.kdf

public Class BCryptKdfOptions

extends Object
implements OpenSSHKdfOptions
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.config.keys.loader.openssh.OpenSSHKdfOptions, org.apache.sshd.common.config.keys.loader.openssh.OpenSSHKeyDecryptor, org.apache.sshd.common.NamedResource
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, .StreamCorruptedException, java.nio.charset.StandardCharsets, java.security.GeneralSecurityException, java.util.Arrays, java.util.concurrent.atomic.AtomicInteger, org.apache.sshd.common.NamedResource, .RuntimeSshException, org.apache.sshd.common.cipher.BuiltinCiphers, .Cipher, .CipherFactory, org.apache.sshd.common.config.keys.KeyEntryResolver, org.apache.sshd.common.config.keys.loader.openssh.OpenSSHKdfOptions, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.ExceptionUtils, .NumberUtils, .ValidateUtils, org.apache.sshd.common.util.buffer.BufferUtils

Author
Apache MINA SSHD Project

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
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.

private static final AtomicInteger
public static final String
private int
private byte[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
bcryptKdf(byte[] password, byte[] output)

public byte[]
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public static int
public final String
public int
public byte[]
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public void
protected void
initialize(InputStream stream, int maxSaltSize)

public boolean
public static void
public void
setNumRounds(int numRounds)

public void
setSalt(byte[] salt)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

DEFAULT_MAX_ROUNDSback to summary
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 the ssh-keygen command) is usually 16.

MAX_ROUNDS_HOLDERback to summary
private static final AtomicInteger MAX_ROUNDS_HOLDER
NAMEback to summary
public static final String NAME
numRoundsback to summary
private int numRounds
saltback to summary
private byte[] salt

Constructor Detail

BCryptKdfOptionsback to summary
public BCryptKdfOptions()

Method Detail

bcryptKdfback to summary
protected void bcryptKdf(byte[] password, byte[] output) throws IOException, GeneralSecurityException
decodePrivateKeyBytesback to summary
public byte[] decodePrivateKeyBytes(SessionContext session, NamedResource resourceKey, CipherFactory cipherSpec, byte[] privateDataBytes, String password) throws IOException, GeneralSecurityException

Implements org.apache.sshd.common.config.keys.loader.openssh.OpenSSHKeyDecryptor.decodePrivateKeyBytes.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getMaxAllowedRoundsback to summary
public static int getMaxAllowedRounds()
getNameback to summary
public final String getName()

Implements org.apache.sshd.common.NamedResource.getName.

Returns:String

Doc from org.apache.sshd.common.NamedResource.getName.

The resource name

Annotations
@Override
getNumRoundsback to summary
public int getNumRounds()
getSaltback to summary
public byte[] getSalt()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
initializeback to summary
public void initialize(String name, byte[] kdfOptions) throws IOException

Implements org.apache.sshd.common.config.keys.loader.openssh.OpenSSHKdfOptions.initialize.

Annotations
@Override
initializeback to summary
protected void initialize(InputStream stream, int maxSaltSize) throws IOException
isEncryptedback to summary
public boolean isEncrypted()

Implements org.apache.sshd.common.config.keys.loader.openssh.OpenSSHKeyDecryptor.isEncrypted.

Annotations
@Override
setMaxAllowedRoundsback to summary
public static void setMaxAllowedRounds(int value)
setNumRoundsback to summary
public void setNumRounds(int numRounds)
setSaltback to summary
public void setSalt(byte[] salt)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.apache.sshd.common.config.keys.loader.openssh.kdf back to summary

public Class BCryptKdfOptions.BCryptBadRoundsException

extends RuntimeSshException
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int
private static final long

Constructor Summary

AccessConstructor and Description
public
public
BCryptBadRoundsException(int rounds, String message)

public
BCryptBadRoundsException(int rounds, String message, Throwable reason)

Method Summary

Modifier and TypeMethod and Description
public int

Field Detail

roundsback to summary
private final int rounds
serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.sshd.common.RuntimeSshException.serialVersionUID.

Constructor Detail

BCryptBadRoundsExceptionback to summary
public BCryptBadRoundsException(int rounds)
BCryptBadRoundsExceptionback to summary
public BCryptBadRoundsException(int rounds, String message)
BCryptBadRoundsExceptionback to summary
public BCryptBadRoundsException(int rounds, String message, Throwable reason)

Method Detail

getRoundsback to summary
public int getRounds()