21 unsigned char msg[12] =
"Hello World!";
22 unsigned char msg_hash[32];
23 unsigned char tag[17] =
"my_fancy_protocol";
24 unsigned char seckey[32];
25 unsigned char randomize[32];
26 unsigned char auxiliary_rand[32];
27 unsigned char serialized_pubkey[32];
28 unsigned char signature[64];
29 int is_signature_valid;
39 if (!fill_random(randomize,
sizeof(randomize))) {
40 printf(
"Failed to generate randomness\n");
55 if (!fill_random(seckey,
sizeof(seckey))) {
56 printf(
"Failed to generate randomness\n");
98 if (!fill_random(auxiliary_rand,
sizeof(auxiliary_rand))) {
99 printf(
"Failed to generate randomness\n");
119 printf(
"Failed parsing the public key\n");
131 printf(
"Is the signature valid? %s\n", is_signature_valid ?
"true" :
"false");
132 printf(
"Secret Key: ");
133 print_hex(seckey,
sizeof(seckey));
134 printf(
"Public Key: ");
135 print_hex(serialized_pubkey,
sizeof(serialized_pubkey));
136 printf(
"Signature: ");
137 print_hex(signature,
sizeof(signature));
149 memset(seckey, 0,
sizeof(seckey));
SECP256K1_API void secp256k1_context_destroy(secp256k1_context *ctx) SECP256K1_ARG_NONNULL(1)
#define SECP256K1_CONTEXT_SIGN
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_context_randomize(secp256k1_context *ctx, const unsigned char *seed32) SECP256K1_ARG_NONNULL(1)
SECP256K1_API secp256k1_context * secp256k1_context_create(unsigned int flags) SECP256K1_WARN_UNUSED_RESULT
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_tagged_sha256(const secp256k1_context *ctx, unsigned char *hash32, const unsigned char *tag, size_t taglen, const unsigned char *msg, size_t msglen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(5)
#define SECP256K1_CONTEXT_VERIFY
SECP256K1_API int secp256k1_schnorrsig_sign32(const secp256k1_context *ctx, unsigned char *sig64, const unsigned char *msg32, const secp256k1_keypair *keypair, const unsigned char *aux_rand32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_schnorrsig_verify(const secp256k1_context *ctx, const unsigned char *sig64, const unsigned char *msg, size_t msglen, const secp256k1_xonly_pubkey *pubkey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(5)
memset(pInfo->slotDescription, ' ', 64)