From 271e062be2cea8b0627995f2c4363dc7cd36bcf6 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 7 Nov 2016 11:06:33 +0100 Subject: [PATCH] Auditing of CryptProtectData() enabled --- lib/EAPBase/src/Credentials.cpp | 2 +- lib/TLS/src/Credentials.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/EAPBase/src/Credentials.cpp b/lib/EAPBase/src/Credentials.cpp index ab5acbc..5e8728e 100644 --- a/lib/EAPBase/src/Credentials.cpp +++ b/lib/EAPBase/src/Credentials.cpp @@ -360,7 +360,7 @@ void eap::credentials_pass::store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned in DATA_BLOB cred_blob = { (DWORD)cred_utf8.size() , const_cast(reinterpret_cast(cred_utf8.data())) }; DATA_BLOB entropy_blob = { sizeof(s_entropy), const_cast( s_entropy ) }; data_blob cred_enc; - if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &cred_enc)) + if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN | CRYPTPROTECT_AUDIT, &cred_enc)) throw win_runtime_error(__FUNCTION__ " CryptProtectData failed."); tstring target(target_name(pszTargetName, level)); diff --git a/lib/TLS/src/Credentials.cpp b/lib/TLS/src/Credentials.cpp index db4afac..0739728 100644 --- a/lib/TLS/src/Credentials.cpp +++ b/lib/TLS/src/Credentials.cpp @@ -179,7 +179,7 @@ void eap::credentials_tls::store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int // Encrypt the certificate using user's key. DATA_BLOB cred_blob = { m_cert->cbCertEncoded, m_cert->pbCertEncoded }; DATA_BLOB entropy_blob = { sizeof(s_entropy) , const_cast(s_entropy) }; - if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &cred_enc)) + if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN | CRYPTPROTECT_AUDIT, &cred_enc)) throw win_runtime_error(__FUNCTION__ " CryptProtectData failed."); }