create Certificate Factory - Java Security

Java examples for Security:Certificate

Description

create Certificate Factory

Demo Code


//package com.java2s;

import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;

public class Main {
    public static void main(String[] argv) throws Exception {
        String type = "java2s.com";
        System.out.println(createCertificateFactory(type));
    }//  ww  w  .ja va2s  .c  om

    public static CertificateFactory createCertificateFactory(String type) {
        try {
            return CertificateFactory.getInstance(type);
        } catch (CertificateException e) {
            throw new RuntimeException("required " + type
                    + " certificate factory not supported", e);
        }
    }
}

Related Tutorials