publicvoid getSingInfo() {
try{
PackageInfo packageInfo = getPackageManager().getPackageInfo(
"wabao.et.master", PackageManager.GET_SIGNATURES);
Signature[] signs = packageInfo.signatures;
Signature sign = signs[0];
parseSignature(sign.toByteArray());
}catch(Exception e) {
e.printStackTrace();
}
}
publicvoid parseSignature(byte[] signature) {
try{
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate) certFactory.generateCertificate(newByteArrayInputStream(signature));
String pubKey = cert.getPublicKey().toString();
String signNumber = cert.getSerialNumber().toString();
}catch(CertificateException e) {
e.printStackTrace();
}
}
Android获取应用的签名信息
最新推荐文章于 2024-04-27 16:14:47 发布