APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.ssl

pack-priv final Class Utilities

extends Object
Class Inheritance
Imports
java.math.BigInteger, java.util.*, java.util.regex.Pattern, javax.net.ssl.*, sun.net.util.IPAddressUtil

A utility class to share the static methods.

Field Summary

Modifier and TypeField and Description
private static final HexFormat
private static final String
pack-priv static final String
private static final Pattern

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static List<SNIServerName>

Returns:

a list of SNIServerName
addToSNIServerNameList
(List<SNIServerName> serverNames, String hostname)

Puts hostname into the serverNames list.

pack-priv static String
pack-priv static <T> boolean
contains(T[] array, T item)

pack-priv static boolean
getBooleanProperty(String propName, boolean defaultValue)

Return the value of the boolean System property propName.

pack-priv static String
indent(String source)

pack-priv static String
indent(String source, String prefix)

private static SNIHostName

Returns:

an instance of SNIHostName, or null if the hostname does not look like a FQDN
rawToSNIHostName
(String
the raw hostname
hostname
)

Converts string hostname to SNIHostName.

pack-priv static void
reverseBytes(byte[] arr)

private static void
swap(byte[] arr, int i, int j)

pack-priv static byte[]
toByteArray(BigInteger bi)

Utility method to convert a BigInteger to a byte array in unsigned format as needed in the handshake messages.

pack-priv static String
toHexString(byte[] bytes)

pack-priv static String
toHexString(long lv)

pack-priv static String
wrapText(String text, int maxWidth)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HEX_FORMATTERback to summary
private static final HexFormat HEX_FORMATTER
indentback to summary
private static final String indent
LINE_SEPback to summary
pack-priv static final String LINE_SEP
lineBreakPaternback to summary
private static final Pattern lineBreakPatern

Constructor Detail

Utilitiesback to summary
pack-priv Utilities()

Method Detail

addToSNIServerNameListback to summary
pack-priv static List<SNIServerName> addToSNIServerNameList(List<SNIServerName> serverNames, String hostname)

Puts hostname into the serverNames list.

If the serverNames does not look like a legal FQDN, it will not be put into the returned list.

Note that the returned list does not allow duplicated name type.

Returns:List<SNIServerName>

a list of SNIServerName

byte16HexStringback to summary
pack-priv static String byte16HexString(int id)
containsback to summary
pack-priv static <T> boolean contains(T[] array, T item)
getBooleanPropertyback to summary
pack-priv static boolean getBooleanProperty(String propName, boolean defaultValue)

Return the value of the boolean System property propName.

indentback to summary
pack-priv static String indent(String source)
indentback to summary
pack-priv static String indent(String source, String prefix)
rawToSNIHostNameback to summary
private static SNIHostName rawToSNIHostName(String hostname)

Converts string hostname to SNIHostName.

Note that to check whether a hostname is a valid domain name, we cannot use the hostname resolved from name services. For virtual hosting, multiple hostnames may be bound to the same IP address, so the hostname resolved from name services is not always reliable.

Parameters
hostname:String

the raw hostname

Returns:SNIHostName

an instance of SNIHostName, or null if the hostname does not look like a FQDN

reverseBytesback to summary
pack-priv static void reverseBytes(byte[] arr)
swapback to summary
private static void swap(byte[] arr, int i, int j)
toByteArrayback to summary
pack-priv static byte[] toByteArray(BigInteger bi)

Utility method to convert a BigInteger to a byte array in unsigned format as needed in the handshake messages. BigInteger uses 2's complement format, i.e. it prepends an extra zero if the MSB is set. We remove that.

toHexStringback to summary
pack-priv static String toHexString(byte[] bytes)
toHexStringback to summary
pack-priv static String toHexString(long lv)
wrapTextback to summary
pack-priv static String wrapText(String text, int maxWidth)