I'm trying to load a certificate using libcrypto. The certificate was generated using keytool and openssl. This is my code
#include <stdio.h>
#include <openssl/ssl.h>
int main(int argc, char **argv)
{
SSL* ssl;
SSL_CTX* ctx;
SSL_library_init();
SSL_load_error_strings();
OpenSSL_add_all_algorithms();
ctx = SSL_CTX_new(SSLv23_server_method());
char filename[256];
// https://github.com/apache/qpid-proton/blob/master/python/tests/proton_tests/ssl_db/server-certificate.pem
sprintf(filename, "%s", "server-certificate.pem");
char keyfile[256];
https://github.com/apache/qpid-proton/blob/master/python/tests/proton_tests/ssl_db/server-private-key.pem
sprintf(keyfile, "%s", "server-private-key.pem'");
int retval = SSL_CTX_use_certificate_chain_file(ctx, filename);
unsigned long err = ERR_peek_last_error();
printf("return value = %d\n", retval);
ERR_print_errors_fp(stdout);
return 0;
}
When i run this i'm see this error
139751662126752:error:14FFF0F7:SSL routines:(UNKNOWN)SSL_internal:unknown certificate type:ssl_rsa.c:373:
The certificate and private key are available at https://github.com/apache/qpid-proton/blob/master/python/tests/proton_tests/ssl_db
Any idea why i'm unable to load this cert ? LibreSSL 2.8.0.