1 #include "simpleOpensslSigner.h"
5 #include <openssl/ssl.h>
6 #include <openssl/err.h>
7 #include <openssl/bio.h>
8 #include <openssl/bn.h>
9 #include <openssl/engine.h>
11 void SimpleOpensslSigner::sign( std::shared_ptr<TBSCertificate> cert ) {
12 std::cout << cert->CN << std::endl;
14 in = BIO_new_mem_buf( const_cast<char*>( cert->csr_content.c_str() ), -1 );
15 X509_REQ* req = PEM_read_bio_X509_REQ( in, NULL, NULL, NULL );
18 std::cerr << "Error parsing CSR" << std::endl;
22 EVP_PKEY* pktmp = X509_REQ_get_pubkey( req );
25 std::cerr << "Error extracting pubkey" << std::endl;
29 std::cout << req << ";" << pktmp << std::endl;
31 int i = X509_REQ_verify( req, pktmp );
32 ERR_load_crypto_strings();
33 ERR_print_errors_fp( stderr );
34 std::cout << ERR_get_error() << std::endl;
37 std::cerr << "Signature problems ... " << i << std::endl;
40 std::cerr << "Signature did not match" << std::endl;
43 std::cerr << "Signature ok" << std::endl;