Class KnownHostHashValue

java.lang.Object
org.apache.sshd.client.config.hosts.KnownHostHashValue

public class KnownHostHashValue extends Object
  • Field Details

    • HASHED_HOST_DELIMITER

      public static final char HASHED_HOST_DELIMITER
      Character used to indicate a hashed host pattern
      See Also:
    • DEFAULT_DIGEST

      public static final NamedFactory<Mac> DEFAULT_DIGEST
    • digester

      private NamedFactory<Mac> digester
    • saltValue

      private byte[] saltValue
    • digestValue

      private byte[] digestValue
  • Constructor Details

    • KnownHostHashValue

      public KnownHostHashValue()
  • Method Details

    • 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 if null/empty
      port - The access port - ignored if non-positive or SSH default
      Returns:
      true if host matches the hash
      Throws:
      RuntimeException - If entry not properly initialized
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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
    • createHostPattern

      public static String createHostPattern(String host, int port)
    • 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)