Code example for CertificateFactory

Methods: generateCertificate

3
            return null; 
        } 
        InputStream is = null;
        try { 
            is = new BufferedInputStream(new FileInputStream(file));
            return (X509Certificate) CERT_FACTORY.generateCertificate(is);
        } catch (IOException e) {
            return null; 
        } catch (CertificateException e) {
            // reading a cert while its being installed can lead to this. 
            // just pretend like its not available yet. 
            return null; 
        } finally { 
            IoUtils.closeQuietly(is);
        } 
    } 
 
    private void writeCertificate(File file, X509Certificate cert)
            throws IOException, CertificateException { 
        File dir = file.getParentFile();
Stop searching for code, let great code find you!  Add Codota to your java IDE