Libp2p.Crypto.Secp256k1 (libp2p_elixir v0.9.0)

secp256k1 identity keys.

Uses OTP :crypto primitives (OpenSSL-backed) for key generation and ECDSA.

Summary

Functions

Sign per libp2p secp256k1 rules (hash SHA-256; DER; low-S normalization).

Verify per libp2p secp256k1 rules (hash SHA-256; DER).

Types

privkey()

@type privkey() :: binary()

pubkey_compressed()

@type pubkey_compressed() :: binary()

pubkey_uncompressed()

@type pubkey_uncompressed() :: binary()

Functions

compress_pubkey(arg)

@spec compress_pubkey(pubkey_uncompressed()) :: pubkey_compressed()

decompress_pubkey(arg)

@spec decompress_pubkey(pubkey_compressed()) :: pubkey_uncompressed()

generate_keypair()

@spec generate_keypair() :: {privkey(), pubkey_uncompressed()}

sign(priv, msg)

@spec sign(privkey(), binary()) :: binary()

sign_bitcoin(priv, msg)

@spec sign_bitcoin(privkey(), binary()) :: binary()

Sign per libp2p secp256k1 rules (hash SHA-256; DER; low-S normalization).

verify(pub, msg, sig)

@spec verify(pubkey_uncompressed(), binary(), binary()) :: boolean()

verify_bitcoin(pub, msg, der_sig)

@spec verify_bitcoin(pubkey_uncompressed(), binary(), binary()) :: boolean()

Verify per libp2p secp256k1 rules (hash SHA-256; DER).