Java Certificate Read readCertifacates()

Here you can find the source of readCertifacates()

Description

read Certifacates

License

Apache License

Declaration

public static byte[] readCertifacates() throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.FileInputStream;
import java.io.InputStream;

import java.security.cert.CertificateFactory;

public class Main {
    public static byte[] readCertifacates() throws Exception {
        CertificateFactory factory = CertificateFactory.getInstance("X.509");
        InputStream in = new FileInputStream("C:/Users/Administrator/https.crt");
        java.security.cert.Certificate cate = factory.generateCertificate(in);
        return cate.getEncoded();
    }//from  ww w .  ja  v a2  s.c o  m
}