public static SafeKeyHandleImpl DeriveSymKey(SafeProvHandleImpl providerHandle, SafeHashHandleImpl hashHandle) { var symKeyHandle = SafeKeyHandleImpl.InvalidHandle; if (!CryptoApi.CryptDeriveKey(providerHandle, Constants.CALG_G28147, hashHandle, Constants.CRYPT_EXPORTABLE, ref symKeyHandle)) { throw CreateWin32Error(); } return(symKeyHandle); }