1 Commits
Author SHA1 Message Date
leoca 87e72a582e Use DER encoding for AVB1 ECDSA signatures
The AVB 1.0 BootSignature format comes from AOSP's BootSignature.java,
which signs and verifies with Java's SHA256withECDSA family. Those
produce and expect ASN.1 DER encoded (r, s) signatures.

magiskboot wrote and parsed the fixed width r || s form instead. An
image signed by AOSP with an EC key was therefore not recognized by
`magiskboot verify` (nor flagged AVB1_SIGNED by unpack), and an image
signed by `magiskboot sign-avb1` with an EC key was rejected by AOSP's
verifier with "Invalid encoding for signature".

Encode and decode ECDSA signatures as DER. RSA is unchanged.

Assisted-by: Claude Opus 5.5
2026-10-15 00:38:20 +02:00