Package org.apache.sshd.common.kex
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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]getG()static byte[]getOakleyGroupPrimeValue(String name)static byte[]getP1()static byte[]getP14()static byte[]getP15()static byte[]getP16()static byte[]getP17()static byte[]getP18()static byte[]parseOakleyGroupPrimeValue(String str)Parses the string assumed to contain a HEX-encoded Oakely prime value in big endian formatstatic byte[]readOakleyGroupPrimeValue(BufferedReader br)Reads a HEX encoded prime value from a possibly multi-line input as follows:static byte[]readOakleyGroupPrimeValue(InputStream stream)static byte[]readOakleyGroupPrimeValue(Reader r)static byte[]readOakleyGroupPrimeValue(String name)Reads a HEX-encoded Oakley prime value from an internal resource filestatic byte[]readOakleyGroupPrimeValue(Stream<String> lines)
-
-
-
Method Detail
-
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. Seeorg.apache.sshd.common.kexpackage 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(InputStream)
-
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- TheBufferedReaderto 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:
parseOakleyGroupPrimeValue
-
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 ifnull/empty- Returns:
- The prime value bytes suitable for building a
BigIntegeror empty array if no input - Throws:
NumberFormatException- if malformed encoded value
-
-