138 {
139 int hashSizeInBytes;
140 SafeBCryptAlgorithmHandle cachedBCryptAlgorithmHandle = global::Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle(hashAlgorithmName, global::Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.BCRYPT_ALG_HANDLE_HMAC_FLAG, out hashSizeInBytes);
141 fixed (byte* pbPassword = password)
142 {
143 fixed (byte* pbSalt = salt)
144 {
146 {
147 global::Interop.BCrypt.NTSTATUS nTSTATUS = global::Interop.BCrypt.BCryptDeriveKeyPBKDF2(cachedBCryptAlgorithmHandle, pbPassword, password.
Length, pbSalt, salt.
Length, (ulong)iterations, pbDerivedKey,
destination.Length, 0u);
148 if (nTSTATUS != 0)
149 {
150 throw global::Interop.BCrypt.CreateCryptographicException(nTSTATUS);
151 }
152 }
153 }
154 }
155 }