load X509 certificate - Java Security

Java examples for Security:Certificate

Description

load X509 certificate

Demo Code


//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;

public class Main {
    public static void main(String[] argv) throws Exception {
        String crlFilePath = "java2s.com";
        System.out.println(loadX509CRL(crlFilePath));
    }/*from   ww w  .  j av  a  2 s. com*/

    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;
    }
}

Related Tutorials