Package org.apache.sshd.common.kex
Class DHGroupData
- java.lang.Object
-
- org.apache.sshd.common.kex.DHGroupData
-
public final class DHGroupData extends java.lang.ObjectSimple class holding the data for DH group key exchanges.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.ConcurrentHashMap<java.lang.String,byte[]>OAKLEY_GROUPS
-
Constructor Summary
Constructors Modifier Constructor Description privateDHGroupData()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]getG()static byte[]getOakleyGroupPrimeValue(java.lang.String name)static byte[]getP1()static byte[]getP14()static byte[]getP15()static byte[]getP16()static byte[]getP17()static byte[]getP18()static byte[]parseOakleyGroupPrimeValue(java.lang.String str)Parses the string assumed to contain a HEX-encoded Oakely prime value in big endian formatstatic byte[]readOakleyGroupPrimeValue(java.io.BufferedReader br)Reads a HEX encoded prime value from a possibly multi-line input as follows:static byte[]readOakleyGroupPrimeValue(java.io.InputStream stream)static byte[]readOakleyGroupPrimeValue(java.io.Reader r)static byte[]readOakleyGroupPrimeValue(java.lang.String name)Reads a HEX-encoded Oakley prime value from an internal resource filestatic byte[]readOakleyGroupPrimeValue(java.util.stream.Stream<java.lang.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(java.lang.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(java.lang.String name) throws java.io.IOErrorReads 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:
java.io.IOError- If failed to access/read the required resource- See Also:
readOakleyGroupPrimeValue(InputStream)
-
readOakleyGroupPrimeValue
public static byte[] readOakleyGroupPrimeValue(java.io.InputStream stream) throws java.io.IOException- Throws:
java.io.IOException
-
readOakleyGroupPrimeValue
public static byte[] readOakleyGroupPrimeValue(java.io.Reader r) throws java.io.IOException- Throws:
java.io.IOException
-
readOakleyGroupPrimeValue
public static byte[] readOakleyGroupPrimeValue(java.io.BufferedReader br) throws java.io.IOExceptionReads 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:
java.io.IOException- If invalid data or no encoded value found- See Also:
parseOakleyGroupPrimeValue
-
readOakleyGroupPrimeValue
public static byte[] readOakleyGroupPrimeValue(java.util.stream.Stream<java.lang.String> lines) throws java.lang.NumberFormatException- Throws:
java.lang.NumberFormatException
-
parseOakleyGroupPrimeValue
public static byte[] parseOakleyGroupPrimeValue(java.lang.String str) throws java.lang.NumberFormatExceptionParses 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:
java.lang.NumberFormatException- if malformed encoded value
-
-