Here you can find the source of generateX509CertificateFromSignature( final Signature signature)
private static X509Certificate generateX509CertificateFromSignature( final Signature signature) throws CertificateException
//package com.java2s; //License from project: Apache License import android.content.pm.Signature; import java.io.ByteArrayInputStream; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; public class Main { private static X509Certificate generateX509CertificateFromSignature( final Signature signature) throws CertificateException { CertificateFactory certificateFactory = CertificateFactory .getInstance("X.509"); ByteArrayInputStream inputStream = new ByteArrayInputStream( signature.toByteArray()); X509Certificate certificate = (X509Certificate) certificateFactory .generateCertificate(inputStream); return certificate; }/*from w ww . j a va 2 s . com*/ }