本文整理汇总了Java中sun.security.validator.Validator.validate方法的典型用法代码示例。如果您正苦于以下问题:Java Validator.validate方法的具体用法?Java Validator.validate怎么用?Java Validator.validate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.security.validator.Validator
的用法示例。
在下文中一共展示了Validator.validate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import sun.security.validator.Validator; //导入方法依赖的package包/类
/**
* @param args {cacerts keystore, cert chain}
*/
public static void main(String[] args) throws Exception {
KeyStore ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream(args[0]), "changeit".toCharArray());
Validator v = Validator.getInstance
(Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks);
X509Certificate[] chain = createPath(args[1]);
System.out.println("Chain: ");
for (X509Certificate c: v.validate(chain)) {
System.out.println(" " + c.getSubjectX500Principal() +
" issued by " + c.getIssuerX500Principal());
}
}
示例2: showValidatedChain
import sun.security.validator.Validator; //导入方法依赖的package包/类
public static void showValidatedChain(Validator v, X509Certificate[] chain,
Set<X509Certificate> otherCerts) throws Exception {
for (X509Certificate cert : v.validate(chain, otherCerts)) {
System.out.println("\tSubj: " + cert.getSubjectX500Principal() +
" Iss: " + cert.getIssuerX500Principal());
}
}