commit | 351862b3011999a88227719950fb642d30bf5162 | [log] [tgz] |
---|---|---|
author | Alex Klyubin <klyubin@google.com> | Tue Jan 02 11:08:00 2018 -0800 |
committer | Alex Klyubin <klyubin@google.com> | Tue Jan 02 11:08:00 2018 -0800 |
tree | f415b475a8ab252ce8a9b583b310299fb2f48c83 | |
parent | e340acf692197dba44ba539e922eb0649bc6b35c [diff] |
Restrict access to non-public apksig API in Bazel builds apksig library's com.android.apksig.internal.** classes are not public API. This commit thus: 1. makes the :apksig Bazel target export only the public API, and 2. makes the :apksig-all Bazel target -- which exports non-public API -- visible/accessible only to the apksig and //tools/base projects. This should prevent external clients from accidentally depending on the non-public API which may change without regard to those clients. Test: bazel test $(<tools/base/bazel/targets) Change-Id: I2b918e211b74441a164445ea5af2924d21efe0a0 Merged-In: I74e1ea94e6ca50ce2aae21e169de189e423d0cba
apksig is a project which aims to simplify APK signing and checking whether APK signatures are expected to verify on Android. apksig supports JAR signing (used by Android since day one) and APK Signature Scheme v2 (supported since Android Nougat, API Level 24). apksig is meant to be used outside of Android devices.
The key feature of apksig is that it knows about differences in APK signature verification logic between different versions of the Android platform. apksig thus thoroughly checks whether an APK's signature is expected to verify on all Android platform versions supported by the APK. When signing an APK, apksig chooses the most appropriate cryptographic algorithms based on the Android platform versions supported by the APK being signed.
The project consists of two subprojects:
apksig library offers three primitives:
ApkSigner
which signs the provided APK so that it verifies on all Android platform versions supported by the APK. The range of platform versions can be customized.ApkVerifier
which checks whether the provided APK is expected to verify on all Android platform versions supported by the APK. The range of platform versions can be customized.(Default)ApkSignerEngine
which abstracts away signing APKs from parsing and building APKs. This is useful in optimized APK building pipelines, such as in Android Plugin for Gradle, which need to perform signing while building an APK, instead of after. For simpler use cases where the APK to be signed is available upfront, the ApkSigner
above is easier to use.NOTE: Some public classes of the library are in packages having the word “internal” in their name. These are not public API of the library. Do not use *.internal.* classes directly because these classes may change any time without regard to existing clients outside of apksig
and apksigner
.
apksigner command-line tool offers two operations:
apksigner sign
for usage information.apksigner verify
for usage information.The tool determines the range of Android platform versions (API Levels) supported by the APK by inspecting the APK's AndroidManifest.xml. This behavior can be overridden by specifying the range of platform versions on the command-line.