how to access android app's certificate from inside the app?

Posted by Yan on Stack Overflow See other posts from Stack Overflow or by Yan
Published on 2011-01-07T14:22:59Z Indexed on 2011/01/07 14:53 UTC
Read the original article Hit count: 195

Filed under:
|

Hi All, Im trying to access the certificate/signature from inside an android app, so that I can do something with the certificate. I googled a bit and found the code below:

Class c =  getClass();
ProtectionDomain pd = c.getProtectionDomain();
CodeSource cs = pd.getCodeSource();
Certificate[] signingCertificates = cs.getCertificates();
String st = signingCertificates[0].toString();

but c.getProtectionDomain() returns null.

anyone can help? many thanks.

© Stack Overflow or respective owner

Related posts about android

Related posts about certificate