public class GMJSSEUtil
extends org.apache.tomcat.util.net.jsse.JSSEUtil
| 限定符和类型 | 字段和说明 |
|---|---|
private static Method |
getCRLsMethod |
private static Method |
getRevocationEnabledMethod |
private static Method |
getStoreMethod |
private static Method |
isCertificateVerificationDepthConfiguredMethod |
private static org.apache.juli.logging.Log |
log |
private static org.apache.tomcat.util.res.StringManager |
sm |
private org.apache.tomcat.util.net.SSLHostConfig |
sslHostConfig |
private Set<String> |
VALIDATE_GM_KEYSTORE_TYPE |
| 构造器和说明 |
|---|
GMJSSEUtil(org.apache.tomcat.util.net.SSLHostConfigCertificate certificate) |
| 限定符和类型 | 方法和说明 |
|---|---|
private void |
checkTrustStoreEntries(KeyStore trustStore) |
private static Map<String,Integer> |
createKeyAliasMap(String[] keyAliases)
Create key alias map , the key is alias and value is index of alias in the keyAliases.
|
private String[] |
getAttrValues(String attrKey,
String attrValue) |
private String[] |
getAttrValues(String attrKey,
String attrValue,
boolean checkEmpty) |
private String[] |
getAttrValues(String attrKey,
String attrValue,
int count) |
private String[] |
getAttrValues(String attrKey,
String attrValue,
int count,
boolean checkEmpty) |
private Collection<? extends CRL> |
getCertCRLs(String crlf) |
private String[] |
getCertificateChainFiles(int certCount)
Verify and obtain the split certificateChainFile value.
|
private String[] |
getCertificateFiles()
Verify and obtain the split certificateFile value.
|
private String[] |
getCertificateKeyFiles(int certCount)
Verify and obtain the split certificateKeyFile value.
|
private String[] |
getCertificateKeyPasswords(int keyAliasCount,
boolean checkEmpty)
Verify and obtain the split certificateKeyPassword value.
|
private String[] |
getCertificateKeystoreFiles()
Verify and obtain the split certificateKeystoreFile value.
|
private String[] |
getCertificateKeystorePasswords(int keyStoreCount,
boolean checkEmpty)
Verify and obtain the split certificateKeystorePassword value.
|
private String[] |
getCertificateKeystoreProviders(int keyStoreCount)
Verify and obtain the split certificateKeystoreProvider value.
|
private String[] |
getCertificateKeystoreType(int keyStoreCount)
Verify and obtain the split certificateKeystoreType value.
|
private String[] |
getCertificatePassword(int count,
String keyPass)
Verify and obtain the split certificateKeyPassword or certificateKeystorePassword value.
|
private CertPathParameters |
getCertPathParameters(String crlf,
KeyStore trustStore,
boolean revocationEnabled) |
private static Method |
getCRLsMethod() |
private KeyManager[] |
getGMKeyManagers(String keyAlias)
Get the GM keyManagers.
|
KeyManager[] |
getKeyManagers() |
private boolean |
getRevocationEnabled(org.apache.tomcat.util.net.SSLHostConfig sslHostConfig) |
private static Method |
getRevocationEnabledMethod() |
private KeyStore |
getStore(String type,
String provider,
String path,
String pass)
Load store according to store type , provider , path and password.
|
private static Method |
getStoreMethod() |
TrustManager[] |
getTrustManagers() |
private String[] |
getTruststoreFiles()
Verify and obtain the split truststoreFile value.
|
private String[] |
getTruststoreProviders(int trustStoreCount)
Verify and obtain the split truststoreProvider value.
|
private String[] |
getTruststoreTypes(int trustStoreCount)
Verify and obtain the split truststoreType value.
|
private static void |
importKeyStore(KeyStore srcStore,
String srcStorePassword,
Map<String,Integer> keyAliasMap,
String[] keyPasswords,
KeyStore destStore,
char[] destKeyPassword)
Import the key of the specified entry in the source store to the destination store
|
private static void |
importTrustStore(KeyStore srcStore,
char[] srcStorePassword,
KeyStore destStore,
char[] destStorePassword)
Import the source trust store to the dest trust store.
|
private static void |
initReflectionMethod()
Obtain the following methods through reflection:
SSLUtilBase#getStore
SSLHostConfig#getRevocationEnabled
SSLHostConfig#isCertificateVerificationDepthConfigured
|
private boolean |
isCertificateVerificationDepthConfigured(org.apache.tomcat.util.net.SSLHostConfig sslHostConfig) |
private static Method |
isCertificateVerificationDepthConfiguredMethod() |
private boolean |
isEmpty(String str) |
private boolean |
isGMKey(String keyAlias)
Determine whether to configure GM secret key.
|
private boolean |
isValidateGMCertificateKeystoreType(String keystoreType)
Determine whether it is a valid keystore type.
|
private KeyStore |
loadEmptyKeyStore(String keyStoreType)
Load a empty key store.
|
private KeyStore |
loadKeyStoreByKeyStoreFile(String[] keyAliases)
Load the configured keystore file, obtain the entry of the specified key alias from the keystore
and save it to a newly created keystore.
|
private KeyStore |
loadKeyStoreByPEMFile(String[] keyAliases)
Parse the configured PEM file, get the privateKey and certificates and the certificate chain,
and then save it in the newly created keystore.
|
private KeyStore |
loadTrustStore() |
private void |
setKeyEntryByPEMFile(KeyStore ks,
String keyAlias,
String certificateKeyFile,
String certificateFile,
String certificateChainFile,
String certificatePassword,
char[] destKeyPassword) |
private String[] |
truststorePassword(int trustStoreCount)
Verify and obtain the split truststoreType value.
|
private boolean |
usePEMFile()
Determine whether to use the PEM file to generate the keystore.
|
createSSLContextInternal, getImplementedCiphers, getImplementedProtocols, getLog, isTls13RenegAuthAvailableprivate static final org.apache.juli.logging.Log log
private static final org.apache.tomcat.util.res.StringManager sm
private static Method getStoreMethod
private static Method getRevocationEnabledMethod
private static Method isCertificateVerificationDepthConfiguredMethod
private static Method getCRLsMethod
private final org.apache.tomcat.util.net.SSLHostConfig sslHostConfig
public GMJSSEUtil(org.apache.tomcat.util.net.SSLHostConfigCertificate certificate)
private static void initReflectionMethod()
private static Method getStoreMethod()
private static Method getRevocationEnabledMethod()
private static Method isCertificateVerificationDepthConfiguredMethod()
private static Method getCRLsMethod()
public KeyManager[] getKeyManagers() throws Exception
getKeyManagers 在接口中 org.apache.tomcat.util.net.SSLUtilgetKeyManagers 在类中 org.apache.tomcat.util.net.SSLUtilBaseExceptionprivate boolean isGMKey(String keyAlias)
keyAlias - certificateKeyAliasprivate KeyManager[] getGMKeyManagers(String keyAlias) throws Exception
keyAlias - certificateKeyAliasExceptionprivate boolean usePEMFile()
private KeyStore loadKeyStoreByPEMFile(String[] keyAliases) throws IOException
keyAliases - Multiple values obtained after separating the certificateKeyAlias
attribute value with a commaIOExceptionprivate void setKeyEntryByPEMFile(KeyStore ks, String keyAlias, String certificateKeyFile, String certificateFile, String certificateChainFile, String certificatePassword, char[] destKeyPassword) throws IOException
IOExceptionprivate KeyStore loadKeyStoreByKeyStoreFile(String[] keyAliases) throws IOException
keyAliases - Multiple values obtained after separating the certificateKeyAlias
attribute value with a commaIOExceptionprivate KeyStore loadEmptyKeyStore(String keyStoreType) throws IOException
IOExceptionprivate boolean isValidateGMCertificateKeystoreType(String keystoreType)
private static Map<String,Integer> createKeyAliasMap(String[] keyAliases)
keyAliases - Array of key aliasesprivate static void importKeyStore(KeyStore srcStore, String srcStorePassword, Map<String,Integer> keyAliasMap, String[] keyPasswords, KeyStore destStore, char[] destKeyPassword) throws IOException
srcStore - The source storesrcStorePassword - The source store passwordkeyAliasMap - The configured key aliases mapkeyPasswords - The source storedestStore - The dest store key passworddestKeyPassword - The dest store key passwordIOExceptionprivate static void importTrustStore(KeyStore srcStore, char[] srcStorePassword, KeyStore destStore, char[] destStorePassword) throws IOException
srcStore - The source trust storesrcStorePassword - The source trust store passworddestStore - The dest trust storedestStorePassword - The dest trust store passwordIOExceptionprivate KeyStore getStore(String type, String provider, String path, String pass) throws IOException
type - The store typeprovider - The store providerpath - The store pathpass - The store passwordIOExceptionprivate String[] getCertificatePassword(int count, String keyPass)
private String[] getCertificateKeystorePasswords(int keyStoreCount, boolean checkEmpty)
private String[] getCertificateKeyPasswords(int keyAliasCount, boolean checkEmpty)
private String[] getCertificateKeystoreFiles()
private String[] getCertificateKeystoreType(int keyStoreCount)
private String[] getCertificateKeystoreProviders(int keyStoreCount)
private String[] getCertificateFiles()
private String[] getCertificateKeyFiles(int certCount)
private String[] getCertificateChainFiles(int certCount)
private String[] getAttrValues(String attrKey, String attrValue, int count, boolean checkEmpty)
private boolean isEmpty(String str)
public TrustManager[] getTrustManagers() throws Exception
getTrustManagers 在接口中 org.apache.tomcat.util.net.SSLUtilgetTrustManagers 在类中 org.apache.tomcat.util.net.SSLUtilBaseExceptionprivate boolean getRevocationEnabled(org.apache.tomcat.util.net.SSLHostConfig sslHostConfig)
private boolean isCertificateVerificationDepthConfigured(org.apache.tomcat.util.net.SSLHostConfig sslHostConfig)
private CertPathParameters getCertPathParameters(String crlf, KeyStore trustStore, boolean revocationEnabled) throws Exception
Exceptionprivate Collection<? extends CRL> getCertCRLs(String crlf) throws InvocationTargetException, IllegalAccessException
private KeyStore loadTrustStore() throws IOException
IOExceptionprivate String[] getTruststoreFiles()
private String[] getTruststoreTypes(int trustStoreCount)
private String[] truststorePassword(int trustStoreCount)
private String[] getTruststoreProviders(int trustStoreCount)
Copyright © 2024. All rights reserved.