.\" Automatically generated by Pandoc 3.1.11.1 .\" .TH "apksigcopier" "1" "2023\-02\-08" "v1.1.1" "General Commands Manual" .SH NAME apksigcopier \- copy/extract/patch android apk signatures & compare apks .SH SYNOPSIS \f[B]apksigcopier\f[R] copy [\f[I]options\f[R]] \f[I]signed_apk\f[R] \f[I]unsigned_apk\f[R] \f[I]output_apk\f[R] .PP \f[B]apksigcopier\f[R] extract [\f[I]options\f[R]] \f[I]signed_apk\f[R] \f[I]output_dir\f[R] .PP \f[B]apksigcopier\f[R] patch [\f[I]options\f[R]] \f[I]metadata_dir\f[R] \f[I]unsigned_apk\f[R] \f[I]output_apk\f[R] .PP \f[B]apksigcopier\f[R] compare [\f[I]options\f[R]] \f[I]first_apk\f[R] \f[I]second_apk\f[R] .PP \f[B]apksigcopier\f[R] \-\-version .PP \f[B]apksigcopier\f[R] \-\-help .PP \f[B]apksigcopier\f[R] [\f[I]command\f[R]] \-\-help .SH DESCRIPTION A command line tool for copying android APK signatures from a signed APK to an unsigned one (in order to verify reproducible builds). It can also be used to compare two APKs with different signatures. .SH COMMANDS .SS copy Copy (extract & patch) signatures from signed to unsigned APK. .SS extract Extract APK signatures from signed APK. .SS patch Patch extracted APK signatures onto unsigned APK. .SS compare Compare two APKs by copying the signature from the first to a copy of the second and checking if the resulting APK verifies. .PP This command requires apksigner(1). .PP NB: copying from an APK v1\-signed with signflinger to an APK signed with apksigner works, whereas the reverse fails; see the FAQ in the README. .SH OPTIONS .SS copy/extract/patch \-\-v1\-only [no|auto|yes] .PP Whether to expect only a v1 signature: \f[I]no\f[R] means a v2 signature is expected as well, \f[I]auto\f[R] means the presence of a v2 signature is detected automatically, and \f[I]yes\f[R] means a v2 signature is not expected (and ignored if it does exist). Default: \f[I]no\f[R]. .PP You can also set the environment variable \f[B]APKSIGCOPIER_V1_ONLY\f[R] instead. .SS compare \-\-unsigned .PP Accept unsigned \f[I]second_apk\f[R]. .PP \-\-min\-sdk\-version .PP Passed to apksigner(1) when verifying. .PP \-\-verify\-cmd .PP Command (with arguments) used to verify APKs. Default: \f[I]apksigner verify\f[R]. .SH ENVIRONMENT VARIABLES The following environment variables can be set to \f[I]1\f[R], \f[I]yes\f[R], or \f[I]true\f[R] to override the default behaviour. .SS APKSIGCOPIER_EXCLUDE_ALL_META Exclude all metadata files, not just MANIFEST.MF. .SS APKSIGCOPIER_COPY_EXTRA_BYTES Copy extra bytes after data (e.g.\ an existing v2 signature). .SS APKSIGCOPIER_SKIP_REALIGNMENT Skip realignment of ZIP entries. .SH EXAMPLES .SS extract .IP .EX $ mkdir meta $ apksigcopier extract signed.apk meta $ ls \-1 meta 8BEA2A77.RSA 8BEA2A77.SF APKSigningBlock APKSigningBlockOffset MANIFEST.MF .EE .SS patch .IP .EX $ apksigcopier patch meta unsigned.apk out.apk .EE .SS copy .IP .EX $ apksigcopier copy signed.apk unsigned.apk out.apk .EE .SS compare .IP .EX $ apksigcopier compare foo\-from\-fdroid.apk foo\-built\-locally.apk $ apksigcopier compare foo.apk \-\-unsigned foo\-unsigned.apk .EE .SH SEE ALSO apksigner(1) .SH COPYRIGHT Copyright © 2023 FC Stegerman. License GPLv3+: GNU GPL version 3 or later \c .UR https://gnu.org/licenses/gpl.html .UE \c \&. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. .SH AUTHORS FC Stegerman \c .MT flx@obfusk.net .ME \c.