MCPcopy Create free account
hub / github.com/3rdparty/libprocess / verify_rsa_sha256

Function verify_rsa_sha256

src/ssl/utilities.cpp:444–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442
443
444Try<Nothing> verify_rsa_sha256(
445 const string& message,
446 const string& signature,
447 shared_ptr<RSA> public_key)
448{
449 unsigned char hash[SHA256_DIGEST_LENGTH];
450
451 SHA256(
452 reinterpret_cast<const unsigned char*>(message.c_str()),
453 message.size(),
454 hash);
455
456 int success = RSA_verify(
457 NID_sha256,
458 hash,
459 SHA256_DIGEST_LENGTH,
460 reinterpret_cast<const unsigned char*>(signature.data()),
461 signature.size(),
462 public_key.get());
463
464 if (success == 0) {
465 const char* reason = ERR_reason_error_string(ERR_get_error());
466 return Error("Failed to verify message signature" +
467 (reason == nullptr ? "" : ": " + string(reason)));
468 }
469 return Nothing();
470}
471
472} // namespace openssl {
473} // namespace network {

Callers 1

parseMethod · 0.85

Calls 2

sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected