Hedera.Crypto.Secp256k1 (Hedera v0.1.0)

Copy Markdown View Source

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.

Functions

compress(compressed)

@spec compress(binary()) :: binary()

Compress an uncompressed secp256k1 point (0x04 ‖ X ‖ Y) to 33 bytes.

der_to_raw(arg)

@spec der_to_raw(binary()) :: binary()

Convert a DER ECDSA signature to canonical 64-byte r ‖ s (low-S).

raw_to_der(arg)

@spec raw_to_der(binary()) :: binary()

Convert a canonical 64-byte r ‖ s signature to DER.