INNER CODE UNIT · Java
check
patrickfav/uber-apk-signer · src/main/java/at/favre/tools/apksigner/signing/CertHashChecker.java:12
public Result check(AndroidApkSignerVerify.Result verifyResult, String[] hashes) {
if (verifyResult == null) {
throw new IllegalArgumentException("parameters must not be null");
}
if (hashes == null || !verifyResult.verified) {
return null;
}
if (verifyResult.certInfoList.isEmpty()) {
throw new IllegalArgumentException("no certs info found in verify result - strange...");
}
if (verifyResult.certInfoList.size() != hashes.length) {
return new Result(false, "not the same count of signatures and provided check hashes (found " + verifyResult.certInfoList.size() + " signatures)", hashes);
}
List<String> apkHashes = verifyResult.certInfoList.stream().map(certInfo -> certInfo.certSha256).distinct().sorted().collect(Collectors.toList());