本文整理汇总了Java中java.security.cert.CertPathValidatorException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java CertPathValidatorException.getMessage方法的具体用法?Java CertPathValidatorException.getMessage怎么用?Java CertPathValidatorException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.cert.CertPathValidatorException
的用法示例。
在下文中一共展示了CertPathValidatorException.getMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareNextCertO
import java.security.cert.CertPathValidatorException; //导入方法依赖的package包/类
protected static void prepareNextCertO(
CertPath certPath,
int index,
Set criticalExtensions,
List pathCheckers)
throws CertPathValidatorException
{
List certs = certPath.getCertificates();
X509Certificate cert = (X509Certificate)certs.get(index);
//
// (o)
//
Iterator tmpIter;
tmpIter = pathCheckers.iterator();
while (tmpIter.hasNext())
{
try
{
((PKIXCertPathChecker)tmpIter.next()).check(cert, criticalExtensions);
}
catch (CertPathValidatorException e)
{
throw new CertPathValidatorException(e.getMessage(), e.getCause(), certPath, index);
}
}
if (!criticalExtensions.isEmpty())
{
throw new ExtCertPathValidatorException("Certificate has unsupported critical extension: " + criticalExtensions, null, certPath,
index);
}
}
示例2: toInvalidCertificates
import java.security.cert.CertPathValidatorException; //导入方法依赖的package包/类
private Function<Map<CertificateDetails, CertificateValidity>, InvalidCertificateDto> toInvalidCertificates() {
return input -> {
CertificateDetails certificateDetail = getOnlyElement(input.keySet());
CertificateValidity certificateValidity = getOnlyElement(input.values());
CertPathValidatorException certPathValidatorException = certificateValidity.getException().get();
return new InvalidCertificateDto(
certificateDetail.getIssuerId(),
certPathValidatorException.getReason(),
certificateDetail.getKeyUse(),
certificateDetail.getFederationEntityType(),
certPathValidatorException.getMessage());
};
}
示例3: main
import java.security.cert.CertPathValidatorException; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Throwable[] causes = {
new Throwable(),
new Throwable("message"),
new Throwable("message", new Throwable()) };
for (Throwable cause: causes) {
CertPathValidatorException cpve =
new CertPathValidatorException(cause);
// from CertPathValidatorException(Throwable cause) spec:
// The detail message is set to (cause==null ? null : cause.toString() )
// (which typically contains the class and detail message of cause).
String expMsg = (cause == null ? null : cause.toString());
String actualMsg = cpve.getMessage();
boolean msgsEqual =
(expMsg == null ? actualMsg == null : expMsg.equals(actualMsg));
if (!msgsEqual) {
System.out.println("expected message:" + expMsg);
System.out.println("getMessage():" + actualMsg);
failed = true;
}
}
if (failed) {
throw new Exception("Some tests FAILED");
}
}