All Downloads are FREE. Search and download functionalities are using the official Maven repository.

no.difi.certvalidator.util.CrlUtils Maven / Gradle / Ivy

There is a newer version: 2.2.1
Show newest version
package no.difi.certvalidator.util;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.cert.*;

/**
 * @author erlend
 */
public class CrlUtils {

    private static CertificateFactory certificateFactory;

    static {
        try {
            certificateFactory = CertificateFactory.getInstance("X.509");
        } catch (CertificateException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }

    public static X509CRL load(InputStream inputStream) throws CRLException {
        return (X509CRL) certificateFactory.generateCRL(inputStream);
    }

    public static void save(OutputStream outputStream, X509CRL crl) throws CRLException, IOException {
        outputStream.write(crl.getEncoded());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy