defined why2_chat_ecc_verify_signature
All checks were successful
Codacy Scan / Codacy Security Scan (push) Successful in 10s
Build WHY2-chat / test-why2 (./out/why2-chat-client, ./configure.sh, ubuntu-latest, ./out/why2-chat-server) (push) Successful in 1m45s
Test Project / test-project (./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./test) (push) Successful in 1m42s
Test WHY2-core / test-why2 (why2, ./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./out/why2-core-test, valgrind --leak-check=full --show-leak-kinds=reachable --track-origins=yes -s) (push) Successful in 2m18s
Test WHY2-logger / test-why2 (why2-logger, ./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./out/why2-logger-test, valgrind --leak-check=full --show-leak-kinds=reachable --track-origins=yes -s) (push) Successful in 2m28s
All checks were successful
Codacy Scan / Codacy Security Scan (push) Successful in 10s
Build WHY2-chat / test-why2 (./out/why2-chat-client, ./configure.sh, ubuntu-latest, ./out/why2-chat-server) (push) Successful in 1m45s
Test Project / test-project (./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./test) (push) Successful in 1m42s
Test WHY2-core / test-why2 (why2, ./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./out/why2-core-test, valgrind --leak-check=full --show-leak-kinds=reachable --track-origins=yes -s) (push) Successful in 2m18s
Test WHY2-logger / test-why2 (why2-logger, ./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./out/why2-logger-test, valgrind --leak-check=full --show-leak-kinds=reachable --track-origins=yes -s) (push) Successful in 2m28s
one commit, 8 hours of going crazy together with AI
This commit is contained in:
parent
ac88620d99
commit
c1e7aba879
@ -165,6 +165,30 @@ char *why2_chat_ecc_sign(char *message)
|
||||
return encoded_sig;
|
||||
}
|
||||
|
||||
why2_bool why2_chat_ecc_verify_signature(char *message, char *signature, EVP_PKEY *key)
|
||||
{
|
||||
//VARIABLES
|
||||
size_t length;
|
||||
char *decoded_signature = base64_decode(signature, &length); //DECODE SIGNATURE
|
||||
why2_bool returning;
|
||||
|
||||
//INIT CONTEXT
|
||||
EVP_MD_CTX* ctx = EVP_MD_CTX_new();
|
||||
|
||||
//INIT VERIFICATION CONTEXT
|
||||
EVP_DigestVerifyInit(ctx, NULL, EVP_sha256(), NULL, key);
|
||||
|
||||
//VERIFY MESSAGE
|
||||
EVP_DigestVerifyUpdate(ctx, message, strlen(message));
|
||||
returning = EVP_DigestVerifyFinal(ctx, (unsigned char*) decoded_signature, length) == 1;
|
||||
|
||||
//DEALLOCATION
|
||||
EVP_MD_CTX_free(ctx);
|
||||
why2_deallocate(decoded_signature);
|
||||
|
||||
return returning;
|
||||
}
|
||||
|
||||
void why2_chat_deallocate_keys(void)
|
||||
{
|
||||
//DEALLOCATE THE pkey
|
||||
|
Loading…
x
Reference in New Issue
Block a user