🖋️ DER Signature
Convert a signature between raw (r, s) and DER.
Strict DER
An ECDSA signature in DER is 30 len 02 lenR R 02 lenS S. Strict DER (Bitcoin’s BIP66) also requires that r and s are positive, have no unnecessary leading zero bytes, and that every length matches exactly. Low-S (BIP62/BIP146): s must be at most n/2; otherwise use n − s, which is equally valid. Bitcoin appends one sighash byte after the DER; Ethereum and most other systems use raw 64-byte r‖s instead of DER.