Class DHGroupData

java.lang.Object
org.apache.sshd.common.kex.DHGroupData

public final class DHGroupData extends Object
Simple class holding the data for DH group key exchanges.
Author:
Apache MINA SSHD Project
  • Method Details

    • getG

      public static byte[] getG()
    • getP1

      public static byte[] getP1()
    • getP14

      public static byte[] getP14()
    • getP15

      public static byte[] getP15()
    • getP16

      public static byte[] getP16()
    • getP17

      public static byte[] getP17()
    • getP18

      public static byte[] getP18()
    • getOakleyGroupPrimeValue

      public static byte[] getOakleyGroupPrimeValue(String name)
      Parameters:
      name - The name of the resource file containing the prime value data
      Returns:
      The prime value bytes suitable for building a BigInteger
    • readOakleyGroupPrimeValue

      public static byte[] readOakleyGroupPrimeValue(String name) throws IOError
      Reads a HEX-encoded Oakley prime value from an internal resource file
      Parameters:
      name - The name of the resource file containing the prime value data. See org.apache.sshd.common.kex package for available primes
      Returns:
      The prime value bytes suitable for building a BigInteger
      Throws:
      IOError - If failed to access/read the required resource
      See Also:
    • readOakleyGroupPrimeValue

      public static byte[] readOakleyGroupPrimeValue(InputStream stream) throws IOException
      Throws:
      IOException
    • readOakleyGroupPrimeValue

      public static byte[] readOakleyGroupPrimeValue(Reader r) throws IOException
      Throws:
      IOException
    • readOakleyGroupPrimeValue

      public static byte[] readOakleyGroupPrimeValue(BufferedReader br) throws IOException

      Reads a HEX encoded prime value from a possibly multi-line input as follows:

      • Lines are trimmed and all whitespaces removed.
      • Empty lines (after trimming) are ignored.
      • Lines beginning with "#" are ignored (assumed to be comments).
      • Remaining lines are appended to one big string assumed to contain the HEX-encoded value
      Parameters:
      br - The BufferedReader to read the data from
      Returns:
      The prime value bytes suitable for building a BigInteger
      Throws:
      IOException - If invalid data or no encoded value found
      See Also:
    • readOakleyGroupPrimeValue

      public static byte[] readOakleyGroupPrimeValue(Stream<String> lines) throws NumberFormatException
      Throws:
      NumberFormatException
    • parseOakleyGroupPrimeValue

      public static byte[] parseOakleyGroupPrimeValue(String str) throws NumberFormatException
      Parses the string assumed to contain a HEX-encoded Oakely prime value in big endian format
      Parameters:
      str - The HEX-encoded string to decode - ignored if null/empty
      Returns:
      The prime value bytes suitable for building a BigInteger or empty array if no input
      Throws:
      NumberFormatException - if malformed encoded value