Secp256k1.ECDSA (secp256k1 v0.6.1)

View Source

Module implementing ECDSA pubkey derivation and signatures

Summary

Functions

Convert uncompressed pubkey to compressed one

Derive compressed pubkey from seckey

Convert compressed pubkey to uncompressed one

Derive pubkey from seckey

Generate ECDSA signature of message hash (AUX is randomly generated)

Generate ECDSA signature of message hash and specify AUX value - NOT RECOMMENDED

Derive uncompressed pubkey from seckey

Check if ECDSA signature is valid

Functions

compress_pubkey(pubkey)

@spec compress_pubkey(pubkey :: Secp256k1.uncompressed_pubkey()) ::
  Secp256k1.compressed_pubkey()

Convert uncompressed pubkey to compressed one

compressed_pubkey(seckey)

@spec compressed_pubkey(seckey :: Secp256k1.seckey()) :: Secp256k1.compressed_pubkey()

Derive compressed pubkey from seckey

decompress_pubkey(pubkey)

@spec decompress_pubkey(pubkey :: Secp256k1.compressed_pubkey()) ::
  Secp256k1.uncompressed_pubkey()

Convert compressed pubkey to uncompressed one

pubkey(seckey, opts \\ [])

Derive pubkey from seckey

Options

  • :compress (default true) - whether to format pubkey in compressed or uncompressed format

sign(msg_hash, seckey)

@spec sign(msg_hash :: Secp256k1.hash(), seckey :: Secp256k1.seckey()) ::
  Secp256k1.ecdsa_sig()

Generate ECDSA signature of message hash (AUX is randomly generated)

sign(msg_hash, seckey, aux)

@spec sign(
  msg_hash :: Secp256k1.hash(),
  seckey :: Secp256k1.seckey(),
  aux :: <<_::256>>
) :: Secp256k1.ecdsa_sig()

Generate ECDSA signature of message hash and specify AUX value - NOT RECOMMENDED

uncompressed_pubkey(seckey)

@spec uncompressed_pubkey(seckey :: Secp256k1.seckey()) ::
  Secp256k1.uncompressed_pubkey()

Derive uncompressed pubkey from seckey

valid?(signature, msg_hash, pubkey)

@spec valid?(
  signature :: Secp256k1.ecdsa_sig(),
  msg_hash :: Secp256k1.hash(),
  pubkey :: Secp256k1.compressed_pubkey()
) :: boolean()

Check if ECDSA signature is valid