本文整理汇总了Java中sun.security.validator.ValidatorException类的典型用法代码示例。如果您正苦于以下问题:Java ValidatorException类的具体用法?Java ValidatorException怎么用?Java ValidatorException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValidatorException类属于sun.security.validator包,在下文中一共展示了ValidatorException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkClientValidationFailure
import sun.security.validator.ValidatorException; //导入依赖的package包/类
/**
* Checks a validation failure to see if it failed for the reason we think
* it should. This comes in as an SSLException of some sort, but it
* encapsulates a ValidatorException which in turn encapsulates the
* CertPathValidatorException we are interested in.
*
* @param e the exception thrown at the top level
* @param reason the underlying CertPathValidatorException BasicReason
* we are expecting it to have.
*
* @return true if the reason matches up, false otherwise.
*/
static boolean checkClientValidationFailure(Exception e,
BasicReason reason) {
boolean result = false;
if (e instanceof SSLException) {
Throwable valExc = e.getCause();
if (valExc instanceof sun.security.validator.ValidatorException) {
Throwable cause = valExc.getCause();
if (cause instanceof CertPathValidatorException) {
CertPathValidatorException cpve =
(CertPathValidatorException)cause;
if (cpve.getReason() == reason) {
result = true;
}
}
}
}
return result;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:HttpsUrlConnClient.java
示例2: checkTrustClient
import sun.security.validator.ValidatorException; //导入依赖的package包/类
/**
* Check if client is trusted (no support for custom here, only system/user)
* @param chain certificate chain
* @param authType type of authentification
* @param hostName hostnem
* @throws java.security.cert.CertificateException if certificate is wrong
*/
public void checkTrustClient(X509Certificate[] chain, String authType,
String hostName)
throws CertificateException {
boolean trusted = false;
ValidatorException savedException = null;
for (X509TrustManager clientTrustManager : clientTrustManagers) {
try {
clientTrustManager.checkClientTrusted(chain, authType);
trusted = true;
break;
}catch (ValidatorException caex) {
savedException = caex;
}
}
if (trusted) {
return;
}
throw savedException;
}
开发者ID:GITNE,项目名称:icedtea-web,代码行数:29,代码来源:VariableX509TrustManager.java
示例3: isExplicitlyTrusted
import sun.security.validator.ValidatorException; //导入依赖的package包/类
/**
* Return if the user explicitly trusted this i.e. in userTrustManager or temporarilyTrusted
*/
private boolean isExplicitlyTrusted(X509Certificate[] chain, String authType) {
boolean explicitlyTrusted = false;
for (X509TrustManager certTrustManager : certTrustManagers) {
try {
certTrustManager.checkServerTrusted(chain, authType);
explicitlyTrusted = true;
break;
}catch (ValidatorException uex) {
if (temporarilyTrusted.contains(chain[0])) {
explicitlyTrusted = true;
break;
}
}catch (CertificateException ce) {
// not explicitly trusted
}
}
return explicitlyTrusted;
}
开发者ID:GITNE,项目名称:icedtea-web,代码行数:24,代码来源:VariableX509TrustManager.java
示例4: validateCertChain
import sun.security.validator.ValidatorException; //导入依赖的package包/类
void validateCertChain(List<? extends Certificate> certs) throws Exception {
try {
Validator.getInstance(Validator.TYPE_PKIX,
Validator.VAR_CODE_SIGNING,
pkixParameters)
.validate(certs.toArray(new X509Certificate[certs.size()]));
} catch (Exception e) {
if (debug) {
e.printStackTrace();
}
if (e instanceof ValidatorException) {
// Throw cause if it's CertPathValidatorException,
if (e.getCause() != null &&
e.getCause() instanceof CertPathValidatorException) {
e = (Exception) e.getCause();
Throwable t = e.getCause();
if ((t instanceof CertificateExpiredException &&
hasExpiredCert) ||
(t instanceof CertificateNotYetValidException &&
notYetValidCert)) {
// we already have hasExpiredCert and notYetValidCert
return;
}
}
if (e instanceof ValidatorException) {
ValidatorException ve = (ValidatorException)e;
if (ve.getErrorType() == ValidatorException.T_EE_EXTENSIONS &&
(badKeyUsage || badExtendedKeyUsage || badNetscapeCertType)) {
// We already have badKeyUsage, badExtendedKeyUsage
// and badNetscapeCertType
return;
}
}
}
throw e;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:Main.java
示例5: isCertificateException
import sun.security.validator.ValidatorException; //导入依赖的package包/类
public static boolean isCertificateException(IOException e) {
return e.getCause() instanceof ValidatorException;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:GithubSslSupport.java
注:本文中的sun.security.validator.ValidatorException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论