Class KnownHostHashValue
- java.lang.Object
-
- org.apache.sshd.client.config.hosts.KnownHostHashValue
-
public class KnownHostHashValue extends Object
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static NamedFactory<Mac>DEFAULT_DIGESTstatic charHASHED_HOST_DELIMITERCharacter used to indicate a hashed host pattern
-
Constructor Summary
Constructors Constructor Description KnownHostHashValue()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <A extends Appendable>
Aappend(A sb, KnownHostHashValue hashValue)static <A extends Appendable>
Aappend(A sb, NamedResource factory, byte[] salt, byte[] digest)static <A extends Appendable>
AappendHostPattern(A sb, String host, int port)static byte[]calculateHashValue(String host, int port, Factory<? extends Mac> factory, byte[] salt)static byte[]calculateHashValue(String host, int port, Mac mac, byte[] salt)static StringcreateHostPattern(String host, int port)NamedFactory<Mac>getDigester()byte[]getDigestValue()byte[]getSaltValue()booleanisHostMatch(String host, int port)Checks if the host matches the hashstatic KnownHostHashValueparse(String patternString)static <V extends KnownHostHashValue>
Vparse(String patternString, V value)voidsetDigester(NamedFactory<Mac> digester)voidsetDigestValue(byte[] digestValue)voidsetSaltValue(byte[] saltValue)StringtoString()
-
-
-
Field Detail
-
HASHED_HOST_DELIMITER
public static final char HASHED_HOST_DELIMITER
Character used to indicate a hashed host pattern- See Also:
- Constant Field Values
-
DEFAULT_DIGEST
public static final NamedFactory<Mac> DEFAULT_DIGEST
-
-
Method Detail
-
getDigester
public NamedFactory<Mac> getDigester()
-
setDigester
public void setDigester(NamedFactory<Mac> digester)
-
getSaltValue
public byte[] getSaltValue()
-
setSaltValue
public void setSaltValue(byte[] saltValue)
-
getDigestValue
public byte[] getDigestValue()
-
setDigestValue
public void setDigestValue(byte[] digestValue)
-
isHostMatch
public boolean isHostMatch(String host, int port)
Checks if the host matches the hash- Parameters:
host- The host name/address - ignored ifnull/emptyport- The access port - ignored if non-positive or SSH default- Returns:
trueif host matches the hash- Throws:
RuntimeException- If entry not properly initialized
-
calculateHashValue
public static byte[] calculateHashValue(String host, int port, Factory<? extends Mac> factory, byte[] salt) throws Exception
- Throws:
Exception
-
calculateHashValue
public static byte[] calculateHashValue(String host, int port, Mac mac, byte[] salt) throws Exception
- Throws:
Exception
-
appendHostPattern
public static <A extends Appendable> A appendHostPattern(A sb, String host, int port) throws IOException
- Throws:
IOException
-
append
public static <A extends Appendable> A append(A sb, KnownHostHashValue hashValue) throws IOException
- Throws:
IOException
-
append
public static <A extends Appendable> A append(A sb, NamedResource factory, byte[] salt, byte[] digest) throws IOException
- Throws:
IOException
-
parse
public static KnownHostHashValue parse(String patternString)
-
parse
public static <V extends KnownHostHashValue> V parse(String patternString, V value)
-
-