Here you can find the source of readCertifacates()
public static byte[] readCertifacates() throws Exception
//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 }