abstract class Utilities extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
Utilities.ClientKey
WeakKey for looking up a client SSLContext.
|
private static class |
Utilities.ServerKey
WeakKey for looking up a server SSLContext.
|
(package private) static class |
Utilities.SSLContextInfo
Used to pass an SSLContext and AuthManager pair.
|
private static class |
Utilities.Value
Used to store a soft reference to a SSLContext and the associated
AuthManager in the SSL context map.
|
Modifier and Type | Field and Description |
---|---|
private static String[] |
ANONYMOUS_KEY_EXCHANGE_ALGORITHMS
The names of JSSE key exchange algorithms used for anonymous
communication.
|
(package private) static int |
ANY_KEY_ALGORITHM
Returned by getPermittedKeyAlgorithms when any key algorithm is
permitted.
|
private static CertificateFactory |
certFactory
An X.509 certificate factory for creating CertPaths.
|
(package private) static Logger |
clientLogger
Client logger
|
(package private) static int |
DSA_KEY_ALGORITHM
Or'ed into the value returned by getPermittedKeyAlgorithms when DSA keys
are permitted.
|
private static String[] |
DSA_KEY_EXCHANGE_ALGORITHMS
The names of JSSE key exchange algorithms that use DSA keys.
|
(package private) static AuthPermission |
getSubjectPermission
Permission needed to access the current subject.
|
(package private) static Logger |
initLogger
Initialization logger
|
(package private) static InvocationConstraints |
INTEGRITY_PREFERRED
Constraints that prefer Integrity.YES.
|
(package private) static InvocationConstraints |
INTEGRITY_REQUIRED
Constraints that require Integrity.YES.
|
private static String |
NO_ENCRYPTION_CIPHER_ALGORITHM
The name of the JSSE cipher algorithm that provides no encryption
|
private static String |
NO_INTEGRITY_MIC_ALGORITHM
The name of the JSSE message integrity code algorithm that does not
insure integrity.
|
private static String[] |
requestedCipherSuites
The cipher suites specified by the user, or null if not specified.
|
(package private) static int |
RSA_KEY_ALGORITHM
Or'ed into the value returned by getPermittedKeyAlgorithms when RSA keys
are permitted.
|
private static String[] |
RSA_KEY_EXCHANGE_ALGORITHMS
The names of JSSE key exchange algorithms that use RSA keys.
|
(package private) static Logger |
serverLogger
Server logger
|
private static WeakSoftTable |
sslContextMap
Stores SSL contexts and auth managers.
|
private static String |
sslProtocol
The secure socket protocol used with JSSE.
|
private static String[] |
STRONG_ENCRYPTION_CIPHERS
The names of cipher algorithms that do strong encryption
|
private static String[] |
SUPPORTED_ENCRYPTION_CIPHERS
The names of all cipher algorithms supported by this provider.
|
private static String[] |
SUPPORTED_KEY_EXCHANGE_ALGORITHMS
The names of all the JSSE key exchange algorithms supported by this
provider.
|
private static String[] |
supportedCipherSuitesInternal
The cipher suites supported by the JSSE implementation, or null if not
set yet.
|
(package private) static Principal |
UNKNOWN_PRINCIPAL
Represents a principal whose name is not known.
|
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
checkValidity(CertPath x509CertPath,
X500Principal[] issuers)
Checks if the X.509 certificates in the CertPath are currently valid.
|
(package private) static boolean |
contains(Object[] array,
Object element)
Returns true if the array contains an equal element, which may be null.
|
(package private) static boolean |
doesEncryption(String cipherSuite)
Determines if the cipher suite does encryption
|
(package private) static boolean |
doesServerAuthentication(String cipherSuite)
Determines if the cipher suite authenticates the server
|
(package private) static boolean |
equals(Object[] x,
Object[] y)
Checks if the elements of two arrays are equal.
|
(package private) static X509Certificate |
firstX509Cert(CertPath certPath)
Returns the first X509Certificate from a CertPath known to contain them.
|
(package private) static CertificateFactory |
getCertFactory()
Returns a CertificateFactory for generating a CertPath for X.509
certificates.
|
(package private) static String |
getCipherAlgorithm(String cipherSuite)
Returns the cipher algorithm for the specified cipher suite.
|
(package private) static String |
getClassName(Object object)
Returns the class name of an object, without the package or enclosing
class prefix.
|
(package private) static Set |
getClientPrincipals(InvocationConstraints constraints)
Returns all client principals referred to by the constraints or null if
no client principal constraints are specified.
|
(package private) static Set |
getClientPrincipals(Set constraints)
Returns all client principals referred to by the constraints or null if
no client principal constraints are specified.
|
(package private) static Utilities.SSLContextInfo |
getClientSSLContextInfo(CallContext callContext)
Returns the SSLContext and ClientAuthManager to use for creating client
socket factories.
|
(package private) static String |
getKeyAlgorithm(String cipherSuite)
Returns the key algorithm for the specified cipher suite, one of "RSA",
"DSA", or "NULL".
|
(package private) static String |
getKeyExchangeAlgorithm(String cipherSuite)
Returns the key exchange algorithm for the specified cipher suite.
|
private static String |
getMICAlgorithm(String cipherSuite)
Returns the message integrity code algorithm for the specified cipher
suite.
|
(package private) static int |
getPermittedKeyAlgorithms(String cipherSuite,
boolean client)
Returns the algorithms permitted for keys used with this cipher suite.
|
private static Set |
getPrincipals(InvocationConstraint constraint,
boolean client)
Returns the principals specified by a ClientMinPrincipal,
ClientMaxPrincipal, or ServerMinPrincipal constraint, or an alternatives
of one of those types.
|
private static Set |
getPrincipals(InvocationConstraints constraints,
boolean client)
Implements getClientPrincipals or getServerPrincipals.
|
private static Set |
getPrincipals(Set constraints,
boolean client)
Returns the client or server principals referred to by a set of
constraints.
|
(package private) static Set |
getServerPrincipals(InvocationConstraints constraints)
Returns all server principals referred to by the constraints or null if
no server principal constraints are specified.
|
(package private) static Utilities.SSLContextInfo |
getServerSSLContextInfo(Subject serverSubject,
Set serverPrincipals)
Returns the SSLContext and ServerAuthManager to use for creating server
socket factories.
|
(package private) static String[] |
getSupportedCipherSuites()
Returns all the cipher suites supported by the JSSE implementation and
this provider.
|
private static String[] |
getSupportedCipherSuites(SSLSocketFactory factory)
Returns all the cipher suites supported by the socket factory and this
provider.
|
private static String[] |
getSupportedCipherSuites(String[] suites)
Filters out unsupported suites, modifying the argument and maintaining
the original order.
|
(package private) static boolean |
hasStrongCipherAlgorithm(String cipherSuite)
Returns true if the cipher algorithm for the specified cipher suite is
considered a strong cipher, otherwise false.
|
private static RuntimeException |
initializationError(Exception error,
String contextString)
Returns a
RuntimeException for a problem initializing JSSE. |
(package private) static void |
logThrow(Logger logger,
Level level,
Class sourceClass,
String sourceMethod,
String msg,
Object[] params,
Throwable e)
Logs a throw.
|
(package private) static boolean |
maintainsIntegrity(String cipherSuite)
Determines if the cipher suite maintains integrity
|
(package private) static boolean |
permittedKeyAlgorithm(String keyAlgorithm,
int permittedKeyAlgorithms)
Returns true if the algorithm is one of the permitted algorithms,
otherwise false.
|
(package private) static int |
position(String string,
String[] list)
Returns the offset of a string in an array of strings.
|
(package private) static void |
releaseClientSSLContextInfo(CallContext callContext,
SSLContext sslContext,
ClientAuthManager authManager)
Returns the client's SSLContext and ClientAuthManager to the
SSLContextMap for use by another connection.
|
(package private) static boolean |
safeEquals(Object x,
Object y)
Same as equals(), but allows either argument to be null
|
(package private) static String |
subjectString(Subject subject)
Returns a String that includes relevant information about a Subject
|
private static boolean |
supportedCipherSuite(String cipherSuite)
Checks if the suite is supported by this provider.
|
(package private) static String |
toString(Object[] array)
Converts the contents of an Object array to a String.
|
private static final String[] ANONYMOUS_KEY_EXCHANGE_ALGORITHMS
private static final String[] RSA_KEY_EXCHANGE_ALGORITHMS
private static final String[] DSA_KEY_EXCHANGE_ALGORITHMS
private static final String[] SUPPORTED_KEY_EXCHANGE_ALGORITHMS
private static final String NO_INTEGRITY_MIC_ALGORITHM
private static final String NO_ENCRYPTION_CIPHER_ALGORITHM
private static final String[] STRONG_ENCRYPTION_CIPHERS
private static final String[] SUPPORTED_ENCRYPTION_CIPHERS
static final Logger clientLogger
static final Logger serverLogger
static final Logger initLogger
static final int ANY_KEY_ALGORITHM
static final int DSA_KEY_ALGORITHM
static final int RSA_KEY_ALGORITHM
private static final WeakSoftTable sslContextMap
private static String[] supportedCipherSuitesInternal
private static String[] requestedCipherSuites
private static CertificateFactory certFactory
static final Principal UNKNOWN_PRINCIPAL
static final InvocationConstraints INTEGRITY_REQUIRED
static final InvocationConstraints INTEGRITY_PREFERRED
private static final String sslProtocol
static final AuthPermission getSubjectPermission
static String[] getSupportedCipherSuites()
private static String[] getSupportedCipherSuites(SSLSocketFactory factory)
private static String[] getSupportedCipherSuites(String[] suites)
static Set getClientPrincipals(InvocationConstraints constraints)
static Set getClientPrincipals(Set constraints)
static Set getServerPrincipals(InvocationConstraints constraints)
private static Set getPrincipals(InvocationConstraints constraints, boolean client)
private static Set getPrincipals(Set constraints, boolean client)
private static Set getPrincipals(InvocationConstraint constraint, boolean client)
static Utilities.SSLContextInfo getClientSSLContextInfo(CallContext callContext)
callContext
- the client call contextRuntimeException
- if an error occurs during initialization of
JSSEstatic Utilities.SSLContextInfo getServerSSLContextInfo(Subject serverSubject, Set serverPrincipals)
serverSubject
- the subject, or nullserverPrincipals
- the permitted principals, or nullRuntimeException
- if an error occurs during initialization of
JSSEstatic void releaseClientSSLContextInfo(CallContext callContext, SSLContext sslContext, ClientAuthManager authManager)
private static RuntimeException initializationError(Exception error, String contextString)
RuntimeException
for a problem initializing JSSE.error
- an Exception
that describes the problemcontextString
- describes where the problem occurredRuntimeException
describing the problemstatic CertificateFactory getCertFactory()
static X509Certificate firstX509Cert(CertPath certPath)
static void checkValidity(CertPath x509CertPath, X500Principal[] issuers) throws CertificateException
CertificateException
static boolean doesServerAuthentication(String cipherSuite)
static boolean doesEncryption(String cipherSuite)
static boolean maintainsIntegrity(String cipherSuite)
static String getKeyExchangeAlgorithm(String cipherSuite)
The key exchange algorithm is found following the first underscore and up to the first occurrence of "_WITH_".
static String getKeyAlgorithm(String cipherSuite)
The key algorithm is specified by the key exchange algorithm.
static int getPermittedKeyAlgorithms(String cipherSuite, boolean client)
cipherSuite
- the cipher suiteclient
- true to get results for the client side, false for the
server sideIllegalArgumentException
- if the key exchange algorithm is not
recognizedstatic boolean permittedKeyAlgorithm(String keyAlgorithm, int permittedKeyAlgorithms)
static String getCipherAlgorithm(String cipherSuite)
The cipher algorithm is found following the first occurrence of "_WITH_" and up to the last underscore.
static boolean hasStrongCipherAlgorithm(String cipherSuite)
private static String getMICAlgorithm(String cipherSuite)
The message integrity algorithm is found after the last underscore.
private static boolean supportedCipherSuite(String cipherSuite)
static String subjectString(Subject subject)
static boolean safeEquals(Object x, Object y)
static boolean contains(Object[] array, Object element)
static String toString(Object[] array)
static boolean equals(Object[] x, Object[] y)
x
- the first arrayy
- the second arraystatic String getClassName(Object object)
static int position(String string, String[] list)
static void logThrow(Logger logger, Level level, Class sourceClass, String sourceMethod, String msg, Object[] params, Throwable e)
logger
- logger to log tolevel
- the log levelsourceClass
- class where throw occurredsourceMethod
- name of the method where throw occurredmsg
- log messageparams
- log message parameterse
- exception thrownCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.