Top Description Fields Constructors Methods
org.apache.sshd.common.kex

public final Class DHGroupData

extends Object
Class Inheritance
Imports
java.io.BufferedReader, .EOFException, .FileNotFoundException, .IOError, .IOException, .InputStream, .InputStreamReader, .Reader, .StreamCorruptedException, java.nio.charset.StandardCharsets, java.util.concurrent.ConcurrentHashMap, java.util.stream.Collectors, .Stream, org.apache.sshd.common.util.GenericUtils, .NumberUtils, org.apache.sshd.common.util.buffer.BufferUtils

Simple class holding the data for DH group key exchanges.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private static final ConcurrentHashMap<String, byte[]>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static byte[]
getG()

public static byte[]

Returns:

The prime value bytes suitable for building a BigInteger
getOakleyGroupPrimeValue
(String
The name of the resource file containing the prime value data
name
)

public static byte[]
public static byte[]
public static byte[]
public static byte[]
public static byte[]
public static byte[]
public static byte[]

Returns:

The prime value bytes suitable for building a BigInteger or empty array if no input
parseOakleyGroupPrimeValue
(String
The HEX-encoded string to decode - ignored if null/empty
str
)

Parses the string assumed to contain a HEX-encoded Oakely prime value in big endian format

public static byte[]

Returns:

The prime value bytes suitable for building a BigInteger
readOakleyGroupPrimeValue
(String
The name of the resource file containing the prime value data. See org.apache.sshd.common.kex package for available primes
name
)

Reads a HEX-encoded Oakley prime value from an internal resource file

public static byte[]
public static byte[]
public static byte[]

Returns:

The prime value bytes suitable for building a BigInteger
readOakleyGroupPrimeValue
(BufferedReader
The BufferedReader to read the data from
br
)

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
public static byte[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

OAKLEY_GROUPSback to summary
private static final ConcurrentHashMap<String, byte[]> OAKLEY_GROUPS

Constructor Detail

DHGroupDataback to summary
private DHGroupData()

Method Detail

getGback to summary
public static byte[] getG()
getOakleyGroupPrimeValueback to summary
public static byte[] getOakleyGroupPrimeValue(String name)
Parameters
name:String

The name of the resource file containing the prime value data

Returns:byte[]

The prime value bytes suitable for building a BigInteger

getP1back to summary
public static byte[] getP1()
getP14back to summary
public static byte[] getP14()
getP15back to summary
public static byte[] getP15()
getP16back to summary
public static byte[] getP16()
getP17back to summary
public static byte[] getP17()
getP18back to summary
public static byte[] getP18()
parseOakleyGroupPrimeValueback to summary
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:String

The HEX-encoded string to decode - ignored if null/empty

Returns:byte[]

The prime value bytes suitable for building a BigInteger or empty array if no input

Exceptions
NumberFormatException:
if malformed encoded value
readOakleyGroupPrimeValueback to summary
public static byte[] readOakleyGroupPrimeValue(String name) throws IOError

Reads a HEX-encoded Oakley prime value from an internal resource file

Parameters
name:String

The name of the resource file containing the prime value data. See org.apache.sshd.common.kex package for available primes

Returns:byte[]

The prime value bytes suitable for building a BigInteger

Exceptions
IOError:
If failed to access/read the required resource
See Also
readOakleyGroupPrimeValue(InputStream)
readOakleyGroupPrimeValueback to summary
public static byte[] readOakleyGroupPrimeValue(InputStream stream) throws IOException
readOakleyGroupPrimeValueback to summary
public static byte[] readOakleyGroupPrimeValue(Reader r) throws IOException
readOakleyGroupPrimeValueback to summary
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:BufferedReader

The BufferedReader to read the data from

Returns:byte[]

The prime value bytes suitable for building a BigInteger

Exceptions
IOException:
If invalid data or no encoded value found
See Also
parseOakleyGroupPrimeValue
readOakleyGroupPrimeValueback to summary
public static byte[] readOakleyGroupPrimeValue(Stream<String> lines) throws NumberFormatException