APK packages are signed with an RSA key pair so that package managers can verify that a package was produced by a trusted source and has not been tampered with. melange provides three commands to manage this workflow:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/chainguard-dev/melange/llms.txt
Use this file to discover all available pages before exploring further.
melange keygen to create a key pair, melange sign to sign individual APK files, and melange sign-index to sign an APKINDEX.tar.gz repository index. Signing can also happen automatically during melange build by passing --signing-key.
Generating a key pair
Usemelange keygen to create a new RSA private/public key pair:
melange.rsa (private) and melange.rsa.pub (public). Pass an explicit path to choose a different name:
Key size
The default prime size is 4096 bits. Adjust it with--key-size:
Signing during build
Pass--signing-key to melange build to sign every produced APK and the generated index in one step:
--generate-index is enabled (the default), the resulting APKINDEX.tar.gz is also signed automatically.
Signing existing APK files
If you have APK files on disk that were not signed at build time — or need to re-sign them — usemelange sign:
local-melange.rsa, so if your key is named that you can omit --signing-key:
melange sign flags
| Flag | Default | Description |
|---|---|---|
--signing-key, -k | local-melange.rsa | Path to the RSA private key used to sign. |
Signing a repository index
AnAPKINDEX.tar.gz file lists all packages in a repository and must be signed so that apk add can verify the repository as a whole. Use melange sign-index:
--force:
melange sign-index flags
| Flag | Default | Description |
|---|---|---|
--signing-key | melange.rsa | Path to the RSA private key used to sign the index. |
--force, -f | false | Overwrite the index with a freshly signed version rather than appending a signature. |
Full signing workflow
Build and sign in one command
./packages/{arch}/ and signed. The APKINDEX.tar.gz is generated and signed as well.Distribute the public key
Share
melange.rsa.pub with anyone who needs to install packages from your repository. They add it to their APK keyring:Using the key in melange test
When testing locally built packages, pass the public key tomelange test so the APK resolver can verify signatures on your local packages:
SLSA provenance
melange can generate SLSA provenance attestations alongside your APK files. Pass--generate-provenance to melange build:
.attest.tar.gz file in the same output directory containing the SLSA provenance document. Provenance records the build inputs (source repository, commit, configuration file) and the outputs (APK file hashes), creating an auditable chain of custody from source to package.
