Java examples for Security:Certificate
validate X509 certificate
//package com.java2s; import java.io.FileInputStream; import java.io.IOException; import java.security.cert.CRLException; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509CRL; import java.security.cert.X509Certificate; public class Main { public static boolean validateCrl(X509Certificate cert, String crlPath) throws CertificateException, CRLException, IOException { X509CRL crl = loadX509CRL(crlPath); return crl.isRevoked(cert); }/*from w w w .j a v a2 s.c o m*/ public static X509CRL loadX509CRL(String crlFilePath) throws CertificateException, CRLException, IOException { FileInputStream in = new FileInputStream(crlFilePath); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509CRL crl = (X509CRL) cf.generateCRL(in); in.close(); return crl; } }