本文整理匯總了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");
}
}