I need to convert a PHP code to C/C++, this code makes the signature of a message using a PFX certificate, I did a long search on google, to check how I could do this, but I did not find something that explained how to do this.
My actual PHP code is:
file_put_contents('file_msg', $mensagem);
$certificado_pfx = file_get_contents('certificado.pfx');
if (!openssl_pkcs12_read($certificado_pfx, $result, 'pass')) {
throw new Exception('Não foi possível ler o certificado .pfx');
}
$certificado_key = openssl_x509_read($result['cert']);
$private_key = openssl_pkey_get_private($result['pkey'], 'pass');
openssl_pkcs7_sign('file_msg', 'signature', $certificado_key, $private_key, [], PKCS7_BINARY | PKCS7_TEXT);
So, how I can do the same, in C/C++ ?