59 references to UnsafeNativeMethods
Microsoft.AspNetCore.Cryptography.Internal (25)
Cng\BCryptUtil.cs (2)
20int ntstatus = UnsafeNativeMethods.BCryptGenRandom( 25UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus);
Cng\OSVersionUtil.cs (1)
24using var bcryptLibHandle = SafeLibraryHandle.Open(UnsafeNativeMethods.BCRYPT_LIB);
SafeHandles\BCryptAlgorithmHandle.cs (7)
32int ntstatus = UnsafeNativeMethods.BCryptCreateHash(this, out retVal, IntPtr.Zero, 0, pbKey, cbKey, dwFlags: 0); 33UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 55int ntstatus = UnsafeNativeMethods.BCryptGenerateSymmetricKey(this, out retVal, IntPtr.Zero, 0, pbSecret, cbSecret, 0); 56UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 139int ntstatus = UnsafeNativeMethods.BCryptOpenAlgorithmProvider(out algHandle, algorithmId, implementation, dwFlags: (hmac) ? BCRYPT_ALG_HANDLE_HMAC_FLAG : 0); 147UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 156return (UnsafeNativeMethods.BCryptCloseAlgorithmProvider(handle, dwFlags: 0) == 0);
SafeHandles\BCryptHandle.cs (4)
18int ntstatus = UnsafeNativeMethods.BCryptGetProperty(this, pszProperty, pbOutput, cbOutput, out retVal, dwFlags: 0); 19UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 25int ntstatus = UnsafeNativeMethods.BCryptSetProperty(this, pszProperty, pbInput, cbInput, dwFlags: 0); 26UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus);
SafeHandles\BCryptHashHandle.cs (7)
21int ntstatus = UnsafeNativeMethods.BCryptDuplicateHash(this, out duplicateHandle, IntPtr.Zero, 0, 0); 22UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 37ntstatus = UnsafeNativeMethods.BCryptHashData( 42UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 45ntstatus = UnsafeNativeMethods.BCryptFinishHash( 50UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 56return (UnsafeNativeMethods.BCryptDestroyHash(handle) == 0);
SafeHandles\BCryptKeyHandle.cs (1)
17return (UnsafeNativeMethods.BCryptDestroyKey(handle) == 0);
SafeHandles\NCryptDescriptorHandle.cs (3)
22int ntstatus = UnsafeNativeMethods.NCryptGetProtectionDescriptorInfo( 27UnsafeNativeMethods.ThrowExceptionForNCryptStatus(ntstatus); 39return (UnsafeNativeMethods.NCryptCloseProtectionDescriptor(handle) == 0);
Microsoft.AspNetCore.Cryptography.KeyDerivation (4)
PBKDF2\Win7Pbkdf2Provider.cs (2)
62int ntstatus = UnsafeNativeMethods.BCryptDeriveKeyPBKDF2( 72UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus);
PBKDF2\Win8Pbkdf2Provider.cs (2)
182int ntstatus = UnsafeNativeMethods.BCryptKeyDerivation( 189UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus);
Microsoft.AspNetCore.DataProtection (30)
Cng\CbcAuthenticatedEncryptor.cs (8)
227var ntstatus = UnsafeNativeMethods.BCryptDecrypt( 238UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 247ntstatus = UnsafeNativeMethods.BCryptDecrypt( 258UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 285var ntstatus = UnsafeNativeMethods.BCryptEncrypt( 296UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 398var ntstatus = UnsafeNativeMethods.BCryptEncrypt( 409UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus);
Cng\CngGcmAuthenticatedEncryptor.cs (4)
167var ntstatus = UnsafeNativeMethods.BCryptDecrypt( 178UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 217var ntstatus = UnsafeNativeMethods.BCryptEncrypt( 228UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus);
Cng\DpapiSecretSerializerHelper.cs (8)
88var success = UnsafeNativeMethods.CryptProtectData( 152var ntstatus = UnsafeNativeMethods.NCryptProtectSecret( 161UnsafeNativeMethods.ThrowExceptionForNCryptStatus(ntstatus); 231var success = UnsafeNativeMethods.CryptUnprotectData( 279var ntstatus = UnsafeNativeMethods.NCryptUnprotectSecret( 288UnsafeNativeMethods.ThrowExceptionForNCryptStatus(ntstatus); 340var ntstatus = UnsafeNativeMethods.NCryptUnprotectSecret( 349UnsafeNativeMethods.ThrowExceptionForNCryptStatus(ntstatus);
MemoryProtection.cs (6)
19if (!UnsafeNativeMethods.CryptProtectMemory(pBuffer, byteCount, CRYPTPROTECTMEMORY_SAME_PROCESS)) 21UnsafeNativeMethods.ThrowExceptionForLastCrypt32Error(); 27if (!UnsafeNativeMethods.CryptUnprotectMemory(pBuffer, byteCount, CRYPTPROTECTMEMORY_SAME_PROCESS)) 29UnsafeNativeMethods.ThrowExceptionForLastCrypt32Error(); 35if (!UnsafeNativeMethods.CryptUnprotectMemory(pBuffer, byteCount, CRYPTPROTECTMEMORY_SAME_PROCESS)) 37UnsafeNativeMethods.ThrowExceptionForLastCrypt32Error();
SP800_108\Win8SP800_108_CTR_HMACSHA512Provider.cs (2)
55var ntstatus = UnsafeNativeMethods.BCryptKeyDerivation( 62UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus);
XmlEncryption\DpapiNGXmlEncryptor.cs (2)
41var ntstatus = UnsafeNativeMethods.NCryptCreateProtectionDescriptor(protectionDescriptorRule, (uint)flags, out _protectionDescriptorHandle); 42UnsafeNativeMethods.ThrowExceptionForNCryptStatus(ntstatus);