[vault] Android: the android key kind and the apk sign kind (v0.14.0) #16
Reference in New Issue
Block a user
Delete Branch "feature/apk-signing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Android APK signing for Postea, so its release is signed by Custos instead of a keystore file and environment variables (the app side is the Custos PR that pins this tag).
What
android: RSA-4096, a self-signed X.509 v3 end-entity certificateCN=<cn>, O=<o>, C=<c>(not a CA, keyUsage digitalSignature + nonRepudiation, no EKU, under no root), valid 100 × 365 days.Vault::signing_create_android(&AndroidKey, now)makes one at a time (id[a-z0-9-]{1,64}, used once). Not exportable, like every signing key; its certificate is its public half (signing_export_cert).apk:digest= 1–4 SHA-512 digests of APK Signature Scheme signed data (64·n bytes) → the n RSA PKCS#1 v1.5 signatures with the SHA-512 DigestInfo, concatenated. One request = one card line = one audit entry, so a v2+v3 APK needs one card.androidsigns onlyapk, and onlyandroidsignsapk(an Authenticode leaf cannot sign an APK, an Android key cannot sign an exe or minisign).apkis not onunattended_sign's list: an Android key cannot be revoked or replaced, so it always shows the card, even on the hands-off vault.apkkind and why SHA-512, the two-pass client, the backup warning, compatibility), FORMAT.md (values older cores refuse;unattended_sign), THREAT_MODEL.md (losing the vault loses its signing keys; an Android key's loss ends the app's updates). Version 0.14.0.Why SHA-512, not SHA-256 as first planned
apksig 36.0.0 (
V2SchemeSigner.getSuggestedSignatureAlgorithms) usesRSA_PKCS1_V1_5_WITH_SHA512for every RSA key over 3072 bits and has no option to choose. RSA-4096 was kept (the owner's design), so the kind takes SHA-512 digests.Tests (cargo test --workspace: 215 passed, 0 failed)
kat.rs:apkequalsopenssl pkeyutl -sign -pkeyopt digest:sha512(new fixturedigest512.*, throwaway key), two digests → two signatures in order, bad lengths refused;new_androidmakes RSA-4096, the subject, self-signed, 100 years, not a CA, no EKU, its key verifies its signatures; bad subjects refused.tests/android.rs(9): view and certificate, id rules and once only, sign + verify with the certificate's key, wrong kind both ways (exe/minisign with the Android key, apk with the leaf, Ed25519, root, test leaf), out of scope (other repo, barePostea, other pipeline) even when approved, release needs Mark / test twin signs alone but never a tag, malformed requests (0/1/32/63/65/320 bytes, no file, a path, approval text, bad run), refused/expired/approved through a save and reopen, never unattended.apkrequests (and the wrong-kind ones) and searches every output for their private exponents and primes.new_androidthrough the two-pass helper;apksigner verify --print-certs -v→ v2 true, v3 true, v1 false,CN=Postea, O=Marek Novak, C=CZ, RSA 4096.Self-review
rsa0.9 +sha20.10 (already used for Authenticode), certificates withx509-cert's builder (theLeafprofile with the subject as its own issuer, so no CA extensions).androidandapkare closed-list values, so a core before 0.14.0 refuses such a vault (Corrupted) instead of misreading an Android key as something it could use. The desktop moves to this tag in the same change; the web vault (core v0.7.0) never readssigning.new_androidfailures map to a fixed message (or the core's own error text, which names no key)./api/sign/*) APK requests; the factor service does not listapk, so a remote one is refused there.