public class ApkVerifier
extends java.lang.Object
The verifier is designed to closely mimic the behavior of Android platforms. This is to enable the verifier to be used for checking whether an APK's signatures are expected to verify on Android.
Use ApkVerifier.Builder to obtain instances of this verifier.
| Modifier and Type | Class and Description |
|---|---|
static class |
ApkVerifier.Builder
Builder of
ApkVerifier instances. |
static class |
ApkVerifier.Issue
Error or warning encountered while verifying an APK's signatures.
|
static class |
ApkVerifier.IssueWithParams
ApkVerifier.Issue with associated parameters. |
static class |
ApkVerifier.Result
Result of verifying an APKs signatures.
|
| Modifier and Type | Method and Description |
|---|---|
ApkVerifier.Result |
verify()
Verifies the APK's signatures and returns the result of verification.
|
public ApkVerifier.Result verify() throws java.io.IOException, ApkFormatException, java.security.NoSuchAlgorithmException, java.lang.IllegalStateException
ApkVerifier.Result.isVerified() returns true.
The verification result also includes errors, warnings, and information about signers such
as their signing certificates.
Verification succeeds iff the APK's signature is expected to verify on all Android
platform versions specified via the ApkVerifier.Builder. If the APK's signature is expected to
not verify on any of the specified platform versions, this method returns a result with one
or more errors and whose ApkVerifier.Result.isVerified() returns false, or this method
throws an exception.
java.io.IOException - if an I/O error is encountered while reading the APKApkFormatException - if the APK is malformedjava.security.NoSuchAlgorithmException - if the APK's signatures cannot be verified because a
required cryptographic algorithm implementation is missingjava.lang.IllegalStateException - if this verifier's configuration is missing required
information.