APKSIGNER(1)
π APKSIGNER(1) π
Manual name: apksigner(1) π Β· Version: 7.0.0_r1 π¦
β¨ NAME β¨
apksigner - sign and verify Android APKs π
πΈ SYNOPSIS πΈ
Okay so this is a command line tool for signing Android APK files and for checking whether their signatures will verify on Android devices β¨
apksigner [options] apk
apksigner --version
apksigner --help
apk is just an existing file you want to sign or verify, nothing fancy π«Ά
π DESCRIPTION π
apksig is a project that's literally built to make APK signing easier, plus checking whether an APK's signatures should verify on Android. It supports JAR signing (which Android has used since day one) and APK Signature Scheme v2 (supported since Android Nougat, API Level 24) π§
The main thing that makes apksig iconic is that it knows the verification logic changes between different versions of the Android platform π So it can check whether a signed APK is expected to verify on all the Android platform versions that APK supports. When it signs an APK, apksig picks the most appropriate cryptographic algorithms based on the platform versions that APK supports. Main character energy, no cap π
π COMMANDS π
signβ This signs the provided APK and strips out any pre-existing signatures β¨ Signing uses one or more signers, and each signer is an asymmetric key pair plus a matching certificate. Usually an APK only has one signer, but for each one you need to hand over the signer's private key and certificate πverifyβ This checks whether the provided APK will verify on Android π By default it checks every Android platform version the APK supports (as declared byminSdkVersioninAndroidManifest.xml). Want a custom range of API Levels instead? Use--min-sdk-versionand/or--max-sdk-versionπ―lineageβ This modifies the capabilities of one or more signers in the providedSigningCertificateLineage𧬠It's how you revoke the capabilities of an older signing certificate once the install base has moved over to the new one π«§rotateβ This takes the provided keys and creates aSigningCertificateLineageentry linking the old to the new π It's for key rotation using APK Signature Scheme v3 π¦versionβ Show this tool's version number and exit πhelpβ Show this usage page and exit π
π OPTIONS π
-v,--verboseβ Turn on verbose output mode, so the tool gets extra chatty π£οΈ-h,--helpβ Show help about this command and exit π-Werrβ Treat warnings as errors π¨
π§ sign
Sign the provided APK ποΈ
--outβ The file the signed APK gets written into π¦ By default, the APK is signed in-place, overwriting the input file.
π¨ Heads up bestie: without --out, the original APK gets overwritten in-place. Your input file is literally replaced, so back it up first if you want to keep it π
--min-sdk-versionβ The lowest API Level on which this APK's signatures will be verified π’ By default, the value fromAndroidManifest.xmlis used. The higher the value, the stronger the security parameters used when signing π‘οΈ--max-sdk-versionβ The highest API Level on which this APK's signatures will be verified π By default, the highest possible value is used.--v1-signing-enabledβ Whether to enable signing with the JAR signing scheme (aka the v1 signing scheme, the one Android has used since day one) ποΈ By default, this is enabled based on the min and max SDK version (see--min-sdk-versionand--max-sdk-version).--v2-signing-enabledβ Whether to enable signing with APK Signature Scheme v2 (aka the v2 signing scheme, introduced in Android Nougat, API Level 24) π₯ By default, this is enabled based on the min and max SDK version (see--min-sdk-versionand--max-sdk-version).
π«§ per-signer options
These options set up one particular signer β¨ To separate the options of different signers, use --next-signer π§
--next-signerβ Delimits the options of two different signers πͺ You don't need this when you're only using one signer.--v1-signer-nameβ The basename for the files that make up this signer's JAR signature scheme (aka v1 scheme) signature π By default, the KeyStore key alias or the basename of the key file is used.
π per-signer signing key & certificate options
There are two ways to give the signer's private key and certificate, and you pick one π
- A Java KeyStore (see
--ks) - A private key file in PKCS #8 format plus a certificate file in X.509 format (see
--keyand--cert)
--ksβ Load the private key and certificate chain from the Java KeyStore that's initialized from the specified file ποΈNONEmeans the KeyStore doesn't need any file, which is the case for some PKCS #11 KeyStores.--ks-key-aliasβ The alias the private key and certificate are stored under in the KeyStore π·οΈ You must specify this if the KeyStore has multiple keys.--ks-passβ The KeyStore password (see--ks) π€« These formats are supported:passβ password provided inlineenvβ password provided in the named environment variablefileβ password provided in the named file, as a single linestdinβ password provided on standard input, as a single line
A password is required to open a KeyStore π By default, the tool prompts you for it via the console or standard input. If the same file (including standard input) is used to provide multiple passwords, the passwords get read from that file one line at a time. Passwords are read in the order the signers are specified, and within each signer the KeyStore password is read before the key password π
--key-passβ The password the private key is protected with π By default it's assumed that KeyStore keys are protected by the same password as their KeyStore (see--ks-pass). These formats are supported:passβ password provided inlineenvβ password provided in the named environment variablefileβ password provided in the named file, as a single linestdinβ password provided on standard input, as a single line
By default, if the key is password-protected, the tool prompts for the password via the console or standard input π¬ Same deal as above: when one file (including standard input) supplies multiple passwords, they're read one line at a time. Passwords are read in signer order, and within each signer the KeyStore password comes before the key password π
--pass-encodingβ An extra character encoding (e.g.,ibm437orutf-8) to try for passwords that have non-ASCII characters π KeyStores made bykeytoolare often encrypted with the console's character encoding instead of the Unicode form of the password π€― By default,apksignertries a few forms of the password: the Unicode form, the form encoded with the JVM default charset, and, on Java 8 and older, the form encoded with the console's charset. On Java 9,apksignercan't detect the console's charset, so you may need to pass--pass-encodingwhen you're using a non-ASCII password. You might also need it for a KeyStore created bykeytoolon a different OS or in a different locale πΊοΈ--ks-typeβ The type/algorithm of KeyStore to use π§© By default, the default type is used.--ks-provider-nameβ The name of the JCA Provider to request the KeyStore implementation from π By default, the highest priority provider is used. For the alternative way to specify a provider, see--ks-provider-class.--ks-provider-classβ The fully-qualified class name of the JCA Provider to request the KeyStore implementation from π By default, the provider is chosen based on--ks-provider-name.--ks-provider-argβ A value passed into the constructor of the JCA Provider class specified by--ks-provider-classπ The value is passed into the constructor asjava.lang.String. By default, the no-arg provider constructor is used.--keyβ Load the private key from the specified file π If the key is password-protected, you'll get a prompt via standard input unless you specify otherwise with--key-pass. The file must be in PKCS #8 DER format.--certβ Load the certificate chain from the specified file π The file must be in X.509 PEM or DER format.
π verify
Check whether the provided APK is expected to verify on Android π΅οΈββοΈ
--print-certsβ Show information about the APK's signing certificates π--min-sdk-versionβ The lowest API Level on which this APK's signatures will be verified π’ By default, the value fromAndroidManifest.xmlis used.--max-sdk-versionβ The highest API Level on which this APK's signatures will be verified π By default, the highest possible value is used.
β¨ AUTHORS β¨
okay so all the credit goes to The Android Open Source Project π they're the ones who wrote this page, so they deserve all the flowers πΈ
okay bestie, that's a wrap on apksigner π this manual page was last updated on 2 December 2016 and it's the APKSIGNER(1) page, so bookmark it for when you need it again π
love you, now go sign something π¦β¨
π¦ where this page comes from
- debian trixie: apksigner 35.0.2-1 Β· Apache-2.0
- ubuntu resolute: apksigner 35.0.2-1 Β· Apache-2.0
- ubuntu stonking: apksigner 35.0.2-1 Β· Apache-2.0
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms