crypt_hash::derive() added

This commit is contained in:
Simon Rozman 2016-08-06 16:27:05 +02:00
parent d82a31e543
commit e547372197

View File

@ -810,6 +810,21 @@ namespace winstd
return false; return false;
} }
///
/// Generates cryptographic session keys derived from a base data value.
///
/// \sa [CryptDeriveKey function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379916.aspx)
///
inline bool derive(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTHASH hBaseData, _In_ DWORD dwFlags)
{
handle_type h;
if (CryptDeriveKey(hProv, Algid, hBaseData, dwFlags, &h)) {
attach(h);
return true;
} else
return false;
}
protected: protected:
/// ///
/// Destroys the key. /// Destroys the key.