I am here to post my answer when I found it with the comments above.
I did not have a certificate chain, so in the work that I do, I only have the program code generated by me. I wanted to verify its authenticity, so I created the following function, which checks the certificate for itself in another, to verify its authenticity.
void check_certificate_validaty(X509* certificate) { int status; X509_STORE_CTX *ctx; ctx = X509_STORE_CTX_new(); X509_STORE *store = X509_STORE_new(); X509_STORE_add_cert(store, certificate); X509_STORE_CTX_init(ctx, store, certificate, NULL); status = X509_verify_cert(ctx); if(status == 1) { printf("Certificate verified ok\n"); }else { printf("%s\n", X509_verify_cert_error_string(ctx->error)); } }
Hope this helps someone :)
mmm
source share