Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to verify that app was signed by my certificate?
    primarykey
    data
    text
    <p>How do I check if the signature of my app matches the signature of the certificate that I used to sign it?</p> <p>This is how I should be able to get the certificates fingerprint:</p> <pre><code>public String getCertificateFingerprint() throws NameNotFoundException, CertificateException, NoSuchAlgorithmException { PackageManager pm = context.getPackageManager(); String packageName =context.getPackageName(); int flags = PackageManager.GET_SIGNATURES; PackageInfo packageInfo = null; packageInfo = pm.getPackageInfo(packageName, flags); Signature[] signatures = packageInfo.signatures; byte[] cert = signatures[0].toByteArray(); InputStream input = new ByteArrayInputStream(cert); CertificateFactory cf = null; cf = CertificateFactory.getInstance("X509"); X509Certificate c = null; c = (X509Certificate) cf.generateCertificate(input); MessageDigest md = MessageDigest.getInstance("MD5"); byte[] publicKey = md.digest(c.getPublicKey().getEncoded()); StringBuffer hexString = new StringBuffer(); for (int i = 0; i &lt; publicKey.length; i++) { String appendString = Integer.toHexString(0xFF &amp; publicKey[i]); if (appendString.length() == 1) hexString.append("0"); hexString.append(appendString); } return hexString.toString(); } </code></pre> <p>This is how I should be able to get the fingerprint of my certificate:</p> <pre><code>keytool -v -list -keystore filenameandpath </code></pre> <p>My problem is, that these two give back different results. Could someone point out what I'm screwing up?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload