Android examples for java.security:Certificate
get X.509 Certificate From Assets
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; public class Main { public static X509Certificate getCertificateFromAssets( InputStream inStream) { try {/*from w w w . j a va 2 s . c om*/ CertificateFactory cf = CertificateFactory.getInstance("X.509"); return (X509Certificate) cf.generateCertificate(inStream); } catch (CertificateException e) { e.printStackTrace(); } finally { try { if (inStream != null) { inStream.close(); } } catch (IOException e) { e.printStackTrace(); } } return null; } }