Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define SIGNATURE_LEN (sizeof(signature_p1363))
- /* Parse public key */
- mbedtls_pk_init(&pubkey_ctx);
- res = mbedtls_pk_parse_public_key(&pubkey_ctx, ecc_public_key_text, sizeof(ecc_public_key_text));
- printf("mbedtls_pk_parse_public_key: %d\r\n", res);
- mbedtls_mpi r, s;
- mbedtls_mpi_init(&r);
- mbedtls_mpi_init(&s);
- mbedtls_mpi_read_binary(&r, signature_p1363, SIGNATURE_LEN / 2);
- mbedtls_mpi_read_binary(&s, signature_p1363 + SIGNATURE_LEN / 2, SIGNATURE_LEN / 2);
- /* Get ECDSA verify context from pk structure */
- mbedtls_ecdsa_context* ctx = pubkey_ctx.private_pk_ctx;
- res = mbedtls_ecdsa_verify(&ctx->private_grp, data_raw_hash_digest, sizeof(data_raw_hash_digest),
- &ctx->private_Q, &r, &s);
- printf("mbedtls_ecdsa_verify: %d\r\n", res);
- printf("-----\r\n");
- mbedtls_pk_free(&pubkey_ctx);
- #undef SIGNATURE_LEN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement