|
Description
|
this should work (server.key is a valid RSA private key):
openssl rsautl -inkey /export/apache/server.key -out test2 -in test -sign -keyform e -engine pkcs11
engine "pkcs11" set.
unable to load Private Key
looking at the code, this is obviously wrong (using a read function for public key when private key is to be read):
EVP_PKEY *pk11_load_privkey(ENGINE* e, const char* privkey_file,
UI_METHOD *ui_method, void *callback_data)
{
if ((pubkey=fopen(privkey_file,"r")) != NULL)
{
pkey = PEM_read_PUBKEY(pubkey, NULL, NULL, NULL);
fclose(pubkey);
if (pkey)
after fixing the code:
if ((privkey=fopen(privkey_file,"r")) != NULL)
{
pkey = PEM_read_PrivateKey(privkey, NULL, NULL, NULL);
fclose(privkey);
if (pkey)
it works as expected.
|