597593 {
597594
597595 if (signature.size() != 256 || sha256_hash.size() != 32) {
597596 throw std::runtime_error("Invalid input lengths, expected signature length 256, got " +
597597 to_string(signature.size()) +
", hash length 32, got " +
597599 }
597600
597603
597605 pubkey.size() + 1)) {
597606 throw runtime_error("RSA public key import error");
597607 }
597608
597609
597611 reinterpret_cast<const unsigned char *>(sha256_hash.data()), sha256_hash.size(),
597612 reinterpret_cast<const unsigned char *>(signature.data()), signature.length()) == 0;
597613
597615 return valid;
@ MBEDTLS_MD_SHA256
Definition duckdb.cpp:576492
struct mbedtls_pk_context mbedtls_pk_context
Public key container.
void mbedtls_pk_init(mbedtls_pk_context *ctx)
Initialize a mbedtls_pk_context (as NONE).
Definition duckdb.cpp:587138
int mbedtls_pk_verify(mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, const unsigned char *sig, size_t sig_len)
Verify signature (including padding if relevant).
Definition duckdb.cpp:588185
void mbedtls_pk_free(mbedtls_pk_context *ctx)
Free the components of a mbedtls_pk_context.
Definition duckdb.cpp:587156
int mbedtls_pk_parse_public_key(mbedtls_pk_context *ctx, const unsigned char *key, size_t keylen)
Parse a public key in PEM or DER format.
Definition duckdb.cpp:591403
std::string to_string(const T &value)
Definition duckdb.cpp:19425