Skip to main content

GitHub Release PyPI Version Python Versions CI GPLv3+

apksigcopier - copy/extract/patch apk signatures

apksigcopier is a tool for copying APK signatures from a signed APK to an unsigned one (in order to verify reproducible builds). Its command-line tool offers three operations:

  • copy signatures directly from a signed to an unsigned APK
  • extract signatures from a signed APK to a directory
  • patch previously extracted signatures onto an unsigned APK

Extract

$ mkdir meta
$ apksigcopier extract signed.apk meta
$ ls -1 meta
8BEA2A77.RSA
8BEA2A77.SF
APKSigningBlock
APKSigningBlockOffset
MANIFEST.MF

Patch

$ apksigcopier patch meta unsigned.apk out.apk

Copy (Extract & Patch)

$ apksigcopier copy signed.apk unsigned.apk out.apk

Help

$ apksigcopier --help
$ apksigcopier copy --help      # extract --help, patch --help, etc.

Python API

>>> from apksigcopier import do_extract, do_patch, do_copy
>>> do_extract(signed_apk, output_dir, v1_only=NO)
>>> do_patch(metadata_dir, unsigned_apk, output_apk, v1_only=NO)
>>> do_copy(signed_apk, unsigned_apk, output_apk, v1_only=NO)

FAQ

What kind of signatures does apksigcopier support?

It currently supports v1 + v2 (+ v3, which is a variant of v2).

when using the extract command, the v2/v3 signature is saved as APKSigningBlock + APKSigningBlockOffset.

Tab Completion

For Bash, add this to ~/.bashrc:

eval "$(_APKSIGCOPIER_COMPLETE=source_bash apksigcopier)"

For Zsh, add this to ~/.zshrc:

eval "$(_APKSIGCOPIER_COMPLETE=source_zsh apksigcopier)"

For Fish, add this to ~/.config/fish/completions/apksigcopier.fish:

eval (env _APKSIGCOPIER_COMPLETE=source_fish apksigcopier)

Requirements

  • Python >= 3.5 + click.

Debian/Ubuntu

$ apt install python3-click

Installing

Debian

An official Debian package will hopefully be available soon. You can also manually build one using the debian/sid branch, or download a pre-built .deb via GitHub releases.

Using pip

$ pip install apksigcopier

NB: depending on your system you may need to use e.g. pip3 --user instead of just pip.

From git

NB: this installs the latest development version, not the latest release.

$ git clone https://github.com/obfusk/apksigcopier.git
$ cd apksigcopier
$ pip install -e .

NB: you may need to add e.g. ~/.local/bin to your $PATH in order to run apksigcopier.

To update to the latest development version:

$ cd apksigcopier
$ git pull --rebase

License

GPLv3+

Metadata

Release files for apksigcopier 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apksigcopier 0.4.0
File Size Uploaded Provenance Actions
apksigcopier-0.4.0.tar.gz 20.9 kB Without provenance Details for apksigcopier-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for apksigcopier 0.4.0
File Interpreter ABI Platform Actions
apksigcopier-0.4.0-py3-none-any.whl Python 3 none any Details for apksigcopier-0.4.0-py3-none-any.whl

Total release size: 41.2 kB

Release files / apksigcopier-0.4.0.tar.gz

Download URL apksigcopier-0.4.0.tar.gz
Size 20.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a543016d20713e08968c699febb88be950e0eab682834e7bb9f0aef29ce612de
BLAKE2b-256 checksum
How to use checksums
189bc2675db86ae26fd272e5bd042b5449398d54bb7d885c510994e6de5736d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release files / apksigcopier-0.4.0-py3-none-any.whl

Download URL apksigcopier-0.4.0-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3116b36a007204d03bea004a36f2d42a96394a359579fcdc5bbe43f6be07cc03
BLAKE2b-256 checksum
How to use checksums
0f04bceeb0524c84e106d1255e06cfc24a04eb85210de9b1b4e431040593feb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Security for apksigcopier 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page