Sanitize key memory after use
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
cd78963fd2
commit
7440a3f421
@ -149,7 +149,7 @@ bool winstd::crypt_key::create_exp1(_In_ HCRYPTPROV hProv, _In_ DWORD dwKeySpec)
|
|||||||
handle_type h;
|
handle_type h;
|
||||||
if (CryptGenKey(hProv, dwKeySpec, CRYPT_EXPORTABLE, &h)) {
|
if (CryptGenKey(hProv, dwKeySpec, CRYPT_EXPORTABLE, &h)) {
|
||||||
// Export the private key, we'll convert it to a private exponent of one key.
|
// Export the private key, we'll convert it to a private exponent of one key.
|
||||||
std::vector<BYTE> key_blob;
|
std::vector<BYTE, sanitizing_allocator<BYTE>> key_blob;
|
||||||
if (CryptExportKey(h, 0, PRIVATEKEYBLOB, 0, key_blob)) {
|
if (CryptExportKey(h, 0, PRIVATEKEYBLOB, 0, key_blob)) {
|
||||||
CryptDestroyKey(h);
|
CryptDestroyKey(h);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user