secp256k1 helpers for Hedera's ECDSA signature convention: signatures are the
64-byte raw r ‖ s form with s normalized to the lower half of the curve
order (low-S, as required by Hedera/Ethereum), and public keys are the 33-byte
compressed form on the wire. OpenSSL (via OTP :crypto) produces DER
signatures and uncompressed points, which these functions convert.
Summary
Functions
Compress an uncompressed secp256k1 point (0x04 ‖ X ‖ Y) to 33 bytes.
Convert a DER ECDSA signature to canonical 64-byte r ‖ s (low-S).
Convert a canonical 64-byte r ‖ s signature to DER.
Recover the public key point {x, y} from (r, s, z, recid), or :error.
The EIP-1559 recovery id (yParity, 0 or 1) for a signature <<r::256, s::256>>
over the 32-byte message hash z, given the signer's public key (33-byte
compressed or 65-byte uncompressed). Recovers the public key for each candidate
parity and returns the one that reproduces the signer — or :error.
Functions
Compress an uncompressed secp256k1 point (0x04 ‖ X ‖ Y) to 33 bytes.
Convert a DER ECDSA signature to canonical 64-byte r ‖ s (low-S).
Convert a canonical 64-byte r ‖ s signature to DER.
Recover the public key point {x, y} from (r, s, z, recid), or :error.
The EIP-1559 recovery id (yParity, 0 or 1) for a signature <<r::256, s::256>>
over the 32-byte message hash z, given the signer's public key (33-byte
compressed or 65-byte uncompressed). Recovers the public key for each candidate
parity and returns the one that reproduces the signer — or :error.