How can I get a NCRYPT_KEY_HANDLE
for encryption/decryption with CNG from the private key of a PCCERT_CONTEXT
from the windows certificate store?
The CryptEncrypt
function has been superceded by the NCryptEncrypt
and BCryptEncrypt
functions, but there is no immediately apparent way of obtaining a handle for either of these functions from a PCCERT_CONTEXT
from the Windows certificate store.
Is it even possible to use the CNG functions for encryption/decryption using (private keys of) certificates without resolving to brute force approaches like exporting the certificate?