Open GoogleCodeExporter opened 9 years ago
The getAPPCerts() in AccessController.java should be updated as follows:
public Certificate[] getAPPCerts(String packageName)
throws CertificateException, NoSuchAlgorithmException, AccessControlException,
CardException {
PackageInfo foundPkgInfo;
try {
foundPkgInfo = mPackageManager.getPackageInfo(packageName,
PackageManager.GET_SIGNATURES);
} catch (NameNotFoundException ne) {
throw new AccessControlException("Package does not exist");
}
if (foundPkgInfo == null) {
throw new AccessControlException("Package does not exist");
}
ArrayList<Certificate> appCerts = new ArrayList<Certificate>();
// this is the certificate chain...
for (Signature signature : foundPkgInfo.signatures) {
appCerts.add(decodeCertificate(signature.toByteArray()));
}
return appCerts.toArray(new Certificate[appCerts.size()]);
}
Original comment by danny.w....@gmail.com
on 28 Mar 2013 at 1:45
I see how the performance gets improved by switching from .getInstalledPackages
to .getPackageInfo. However, I don't see how, given the device application is
signed by one party with a certificate chain, the getAPPCerts will return an
array of certificates.
If the app is only signed by one party then there will be only one signature.
If there is only one signature then decodeCertificate will only be called one
time in the loop. decodeCertificate is only designed to return one
certificate. It does not return an array of certificates. I still don't see
any way for getAPPCerts to return an array of size more than one certificate.
Original comment by er...@motorola.com
on 28 Mar 2013 at 3:03
the improvement on using getPackageInfo would be desired definitely to improve
older version of SEEK implementation. similar to finding on DTAG
https://github.com/DTAG-PD14/AccessControl/issues/4
Original comment by tommypo...@gmail.com
on 23 Apr 2013 at 8:52
Original issue reported on code.google.com by
er...@motorola.com
on 20 Mar 2013 at 3:20