|
|
@ -107,6 +107,7 @@ class CryptokiEngine: public openssl::Engine { |
|
|
|
return *_cert; |
|
|
|
return *_cert; |
|
|
|
} |
|
|
|
} |
|
|
|
virtual EVP_PKEY* privkey(const char* id, UI_METHOD*, void*) { |
|
|
|
virtual EVP_PKEY* privkey(const char* id, UI_METHOD*, void*) { |
|
|
|
|
|
|
|
OPENSSL_LOG("log"); |
|
|
|
EVP_PKEY* k(EVP_PKEY_new()); |
|
|
|
EVP_PKEY* k(EVP_PKEY_new()); |
|
|
|
RSA* r(RSA_new_method(_e)); |
|
|
|
RSA* r(RSA_new_method(_e)); |
|
|
|
r->n = BN_bin2bn((const unsigned char*)_modulus.data(), |
|
|
|
r->n = BN_bin2bn((const unsigned char*)_modulus.data(), |
|
|
@ -116,6 +117,7 @@ class CryptokiEngine: public openssl::Engine { |
|
|
|
// otherwise OpenSSL emulates sign/verify with encrypt/decrypt
|
|
|
|
// otherwise OpenSSL emulates sign/verify with encrypt/decrypt
|
|
|
|
r->flags |= RSA_FLAG_SIGN_VER; |
|
|
|
r->flags |= RSA_FLAG_SIGN_VER; |
|
|
|
EVP_PKEY_set1_RSA(k, r); |
|
|
|
EVP_PKEY_set1_RSA(k, r); |
|
|
|
|
|
|
|
OPENSSL_LOG("RSA_free"); |
|
|
|
RSA_free(r); |
|
|
|
RSA_free(r); |
|
|
|
return k; |
|
|
|
return k; |
|
|
|
} |
|
|
|
} |
|
|
|