对证书的CRL进行验证

package com.example.certificate;

import java.io.FileInputStream;
import java.security.cert.CertificateFactory;
import java.security.cert.X509CRL;
import java.security.cert.X509Certificate;

/**
 * 验证CRL,检查证书是否被吊销
 * @author S.J
 * @version 1.0, 11/03/2009
 */
public class ValidateCRL{
	public static void main(String[] args) throws Exception {
		String packagePath = "com/example/certificate/crl/";
		
//		创建CRL对象
		String crlPath = packagePath + "1.crl";
		X509CRL crl = loadX509CRL(crlPath);
		
//		创建包含可用和被吊销的两个证书对象的数组
		String availCertPath = packagePath + "wanghongjun.cer";
		String unAvailCertPath = packagePath + "liuheng.cer";
		X509Certificate[] certArray = new X509Certificate[2];
		certArray[0] = getCertificate(availCertPath);
		certArray[1] = getCertificate(unAvailCertPath);
		
//		验证证书是否被吊销
		for(int i=0; i0){
			String serialNumberString = new String();
			for(int i=0;i

 

你可能感兴趣的:(Secure)