unserialize Cert - Android java.security

Android examples for java.security:Certificate

Description

unserialize Cert

Demo Code


//package com.java2s;
import java.io.ByteArrayInputStream;
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 unserializeCert(String cert)
            throws CertificateException {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        InputStream in = new ByteArrayInputStream(cert.getBytes());
        return (X509Certificate) cf.generateCertificate(in);
    }//  w w w .j  a v a2 s  .c  om
}

Related Tutorials