public class SecurityManager.CertificateSecurityManager
extends java.lang.Object
| Constructor and Description |
|---|
CertificateSecurityManager() |
| Modifier and Type | Method and Description |
|---|---|
private java.util.List<java.lang.String> |
fetchAltNames(java.security.cert.X509Certificate x509,
int altNameType)
Parses a X.509 certificate and returns a list of alternative names of a
specified type.
|
SecurityManager.EncryptedKeyStoreFunction |
getEncryptedKeyStore()
Get a function worker to resolve an encrypted key store with the SSL private key.
|
private byte[] |
getEncryptedKeyStoreWorker(java.lang.String alias,
java.lang.String ksPassword,
java.lang.String kePassword,
ServerKeyStore.Store type)
Get an encrypted key store with the SSL private key.
|
byte[] |
getEncryptedTrustStore(java.lang.String password)
Get an encrypted key store with the trusted certificates.
|
(package private) java.lang.String |
getSubjectCommonName(java.security.cert.X509Certificate x509)
Parses a X.509 certificate and returns the CN component of the subject's
distinctive name.
|
private TransportSecurity |
getTransportSecurity(BootstrapConfig config)
Creates an instance of
TransportSecurity class that serves
the client or server end of secured TLS connections, as needed. |
private boolean |
needsServerValidation(BootstrapConfig config)
Detects if server certificate validation is required.
|
private boolean |
validateServer(javax.net.ssl.SSLSession locSess,
BootstrapConfig config)
Validate the server's certificate if this was specified in the
bootstrap configuration.
|
java.lang.String getSubjectCommonName(java.security.cert.X509Certificate x509)
throws java.security.cert.CertificateParsingException
x509 - certificate to parsejava.security.cert.CertificateParsingException - if DN is malformed or no CN was found in DNpublic byte[] getEncryptedTrustStore(java.lang.String password)
password - The password used to encrypt the store.null if the store could not be generated.public SecurityManager.EncryptedKeyStoreFunction getEncryptedKeyStore()
getEncryptedKeyStoreWorker(java.lang.String, java.lang.String, java.lang.String, com.goldencode.p2j.main.ServerKeyStore.Store) or null
if the thread doesn't have a server context.private byte[] getEncryptedKeyStoreWorker(java.lang.String alias,
java.lang.String ksPassword,
java.lang.String kePassword,
ServerKeyStore.Store type)
alias - The alias.ksPassword - Password used to encrypt the key store.kePassword - Password used to encrypt the key entry within the store.type - The key store typenull if the alias does not exist or
the store could not be generated.private boolean needsServerValidation(BootstrapConfig config)
config - BootstrapConfig instance which should override the security
manager's version; null to use default config.true if server certificate validation is
required.private boolean validateServer(javax.net.ssl.SSLSession locSess,
BootstrapConfig config)
locSess - The local SSL session to validate.config - BootstrapConfig instance which should override the security
manager's version; null to use default config.private TransportSecurity getTransportSecurity(BootstrapConfig config) throws java.security.NoSuchAlgorithmException, java.security.KeyStoreException, java.security.UnrecoverableKeyException, ConfigurationException
TransportSecurity class that serves
the client or server end of secured TLS connections, as needed. The
newly created instance is a singleton within the domain of this
instance of SecurityManager. Thus, repeatable calls return
the same reference.java.security.NoSuchAlgorithmExceptionjava.security.KeyStoreExceptionjava.security.UnrecoverableKeyExceptionConfigurationExceptionprivate java.util.List<java.lang.String> fetchAltNames(java.security.cert.X509Certificate x509,
int altNameType)
throws java.security.cert.CertificateParsingException
x509 - certificate to parsealtNameType - integer type of alternative name to look forList of found names as Strings. May be
empty.java.security.cert.CertificateParsingException