511 references to BCrypt
System.Security.Cryptography (511)
_generated\0\LibraryImports.g.cs (118)
1137public static partial global::Interop.BCrypt.NTSTATUS BCryptOpenAlgorithmProvider(out global::Internal.NativeCrypto.SafeAlgorithmHandle phAlgorithm, string pszAlgId, string pszImplementation, int dwFlags) 1142global::Interop.BCrypt.NTSTATUS __retVal = default; 1172static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint* __phAlgorithm_native, ushort* __pszAlgId_native, ushort* __pszImplementation_native, int __dwFlags_native); 1184public static partial global::Interop.BCrypt.NTSTATUS BCryptSetProperty(global::Internal.NativeCrypto.SafeAlgorithmHandle hObject, string pszProperty, string pbInput, int cbInput, int dwFlags) 1187global::Interop.BCrypt.NTSTATUS __retVal = default; 1212static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, ushort* __pbInput_native, int __cbInput_native, int __dwFlags_native); 1224private static partial global::Interop.BCrypt.NTSTATUS BCryptSetIntPropertyPrivate(global::Microsoft.Win32.SafeHandles.SafeBCryptHandle hObject, string pszProperty, ref int pdwInput, int cbInput, int dwFlags) 1227global::Interop.BCrypt.NTSTATUS __retVal = default; 1252static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, int* __pdwInput_native, int __cbInput_native, int __dwFlags_native); 1264public static partial global::Interop.BCrypt.NTSTATUS BCryptSetProperty(global::Microsoft.Win32.SafeHandles.SafeBCryptHandle hObject, string pszProperty, global::System.ReadOnlySpan<byte> pbInput, int cbInput, int dwFlags) 1267global::Interop.BCrypt.NTSTATUS __retVal = default; 1292static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, byte* __pbInput_native, int __cbInput_native, int __dwFlags_native); 1318internal static extern partial global::Interop.BCrypt.NTSTATUS BCryptCloseAlgorithmProvider(nint hAlgorithm, int dwFlags); 1326internal static partial global::Interop.BCrypt.NTSTATUS BCryptCreateHash(global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle phHash, nint pbHashObject, int cbHashObject, global::System.ReadOnlySpan<byte> secret, int cbSecret, global::Interop.BCrypt.BCryptCreateHashFlags dwFlags) 1332global::Interop.BCrypt.NTSTATUS __retVal = default; 1369static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint* __phHash_native, nint __pbHashObject_native, int __cbHashObject_native, byte* __secret_native, int __cbSecret_native, global::Interop.BCrypt.BCryptCreateHashFlags __dwFlags_native); 1378internal static partial global::Interop.BCrypt.NTSTATUS BCryptCreateHash(nuint hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle phHash, nint pbHashObject, int cbHashObject, global::System.ReadOnlySpan<byte> secret, int cbSecret, global::Interop.BCrypt.BCryptCreateHashFlags dwFlags) 1383global::Interop.BCrypt.NTSTATUS __retVal = default; 1412static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nuint __hAlgorithm_native, nint* __phHash_native, nint __pbHashObject_native, int __cbHashObject_native, byte* __secret_native, int __cbSecret_native, global::Interop.BCrypt.BCryptCreateHashFlags __dwFlags_native); 1421private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptDecapsulate(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, byte* pbCipherText, uint cbCipherText, byte* pbSecretKey, uint cbSecretKey, out uint pcbSecretKey, uint dwFlags) 1425global::Interop.BCrypt.NTSTATUS __retVal = default; 1449static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbCipherText_native, uint __cbCipherText_native, byte* __pbSecretKey_native, uint __cbSecretKey_native, uint* __pcbSecretKey_native, uint __dwFlags_native); 1458private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptEncapsulate(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, byte* pbSecretKey, uint cbSecretKey, out uint pcbSecretKey, byte* pbCipherText, uint cbCipherText, out uint pcbCipherText, uint dwFlags) 1463global::Interop.BCrypt.NTSTATUS __retVal = default; 1488static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbSecretKey_native, uint __cbSecretKey_native, uint* __pcbSecretKey_native, byte* __pbCipherText_native, uint __cbCipherText_native, uint* __pcbCipherText_native, uint __dwFlags_native); 1497private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptDeriveKey(global::Microsoft.Win32.SafeHandles.SafeBCryptSecretHandle hSharedSecret, string pwszKDF, ref readonly global::Interop.BCrypt.BCryptBufferDesc pParameterList, global::System.Span<byte> pbDerivedKey, uint cbDerivedKey, out uint pcbResult, uint dwFlags) 1501global::Interop.BCrypt.NTSTATUS __retVal = default; 1511fixed (global::Interop.BCrypt.BCryptBufferDesc* __pParameterList_native = &pParameterList) 1528static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hSharedSecret_native, ushort* __pwszKDF_native, global::Interop.BCrypt.BCryptBufferDesc* __pParameterList_native, byte* __pbDerivedKey_native, uint __cbDerivedKey_native, uint* __pcbResult_native, uint __dwFlags_native); 1537internal static extern partial global::Interop.BCrypt.NTSTATUS BCryptDestroyHash(nint hHash); 1545internal static extern partial global::Interop.BCrypt.NTSTATUS BCryptDestroyKey(nint hKey); 1553internal static extern partial global::Interop.BCrypt.NTSTATUS BCryptDestroySecret(nint hSecret); 1561private static partial global::Interop.BCrypt.NTSTATUS BCryptDuplicateHash(global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle hHash, out global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle phNewHash, nint pbHashObject, int cbHashObject, int dwFlags) 1567global::Interop.BCrypt.NTSTATUS __retVal = default; 1602static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hHash_native, nint* __phNewHash_native, nint __pbHashObject_native, int __cbHashObject_native, int __dwFlags_native); 1611public static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptEncrypt(global::Internal.NativeCrypto.SafeKeyHandle hKey, byte* pbInput, int cbInput, nint paddingInfo, byte[] pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags) 1615global::Interop.BCrypt.NTSTATUS __retVal = default; 1640static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, nint __paddingInfo_native, byte* __pbIV_native, int __cbIV_native, byte* __pbOutput_native, int __cbOutput_native, int* __cbResult_native, int __dwFlags_native); 1649public static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptDecrypt(global::Internal.NativeCrypto.SafeKeyHandle hKey, byte* pbInput, int cbInput, nint paddingInfo, byte[] pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags) 1653global::Interop.BCrypt.NTSTATUS __retVal = default; 1678static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, nint __paddingInfo_native, byte* __pbIV_native, int __cbIV_native, byte* __pbOutput_native, int __cbOutput_native, int* __cbResult_native, int __dwFlags_native); 1687private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptEncrypt(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, byte* pbInput, int cbInput, void* paddingInfo, byte* pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, global::Interop.BCrypt.BCryptEncryptFlags dwFlags) 1691global::Interop.BCrypt.NTSTATUS __retVal = default; 1715static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, void* __paddingInfo_native, byte* __pbIV_native, int __cbIV_native, byte* __pbOutput_native, int __cbOutput_native, int* __cbResult_native, global::Interop.BCrypt.BCryptEncryptFlags __dwFlags_native); 1724private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptDecrypt(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, byte* pbInput, int cbInput, void* paddingInfo, byte* pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, global::Interop.BCrypt.BCryptEncryptFlags dwFlags) 1728global::Interop.BCrypt.NTSTATUS __retVal = default; 1752static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, void* __paddingInfo_native, byte* __pbIV_native, int __cbIV_native, byte* __pbOutput_native, int __cbOutput_native, int* __cbResult_native, global::Interop.BCrypt.BCryptEncryptFlags __dwFlags_native); 1761private static partial global::Interop.BCrypt.NTSTATUS BCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, nint hExportKey, string pszBlobType, byte[] pbOutput, int cbOutput, out int pcbResult, int dwFlags) 1765global::Interop.BCrypt.NTSTATUS __retVal = default; 1791static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, nint __hExportKey_native, ushort* __pszBlobType_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, int __dwFlags_native); 1800private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptFinalizeKeyPair(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, uint dwFlags) 1803global::Interop.BCrypt.NTSTATUS __retVal = default; 1825static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, uint __dwFlags_native); 1834internal static partial global::Interop.BCrypt.NTSTATUS BCryptFinishHash(global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle hHash, global::System.Span<byte> pbOutput, int cbOutput, int dwFlags) 1837global::Interop.BCrypt.NTSTATUS __retVal = default; 1861static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hHash_native, byte* __pbOutput_native, int __cbOutput_native, int __dwFlags_native); 1870internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptFinishHash(global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle hHash, byte* pbOutput, int cbOutput, int dwFlags) 1873global::Interop.BCrypt.NTSTATUS __retVal = default; 1895static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hHash_native, byte* __pbOutput_native, int __cbOutput_native, int __dwFlags_native); 1904internal static unsafe extern partial global::Interop.BCrypt.NTSTATUS BCryptGenRandom(nint hAlgorithm, byte* pbBuffer, int cbBuffer, int dwFlags); 1912private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptGenerateKeyPair(global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey, int dwLength, uint dwFlags) 1918global::Interop.BCrypt.NTSTATUS __retVal = default; 1953static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint* __phKey_native, int __dwLength_native, uint __dwFlags_native); 1962internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptGenerateSymmetricKey(global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey, nint pbKeyObject, int cbKeyObject, byte* pbSecret, int cbSecret, uint dwFlags) 1968global::Interop.BCrypt.NTSTATUS __retVal = default; 2003static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint* __phKey_native, nint __pbKeyObject_native, int __cbKeyObject_native, byte* __pbSecret_native, int __cbSecret_native, uint __dwFlags_native); 2012internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptGenerateSymmetricKey(nuint hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey, nint pbKeyObject, int cbKeyObject, byte* pbSecret, int cbSecret, uint dwFlags) 2017global::Interop.BCrypt.NTSTATUS __retVal = default; 2044static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nuint __hAlgorithm_native, nint* __phKey_native, nint __pbKeyObject_native, int __cbKeyObject_native, byte* __pbSecret_native, int __cbSecret_native, uint __dwFlags_native); 2053internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptGetProperty(global::Microsoft.Win32.SafeHandles.SafeBCryptHandle hObject, string pszProperty, void* pbOutput, int cbOutput, out int pcbResult, int dwFlags) 2057global::Interop.BCrypt.NTSTATUS __retVal = default; 2082static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, int __dwFlags_native); 2091internal static unsafe extern partial global::Interop.BCrypt.NTSTATUS BCryptHash(nuint hAlgorithm, byte* pbSecret, int cbSecret, byte* pbInput, int cbInput, byte* pbOutput, int cbOutput); 2099internal static partial global::Interop.BCrypt.NTSTATUS BCryptHashData(global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle hHash, global::System.ReadOnlySpan<byte> pbInput, int cbInput, int dwFlags) 2102global::Interop.BCrypt.NTSTATUS __retVal = default; 2126static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hHash_native, byte* __pbInput_native, int __cbInput_native, int __dwFlags_native); 2135private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptImportKey(global::Internal.NativeCrypto.SafeAlgorithmHandle hAlgorithm, nint hImportKey, string pszBlobType, out global::Internal.NativeCrypto.SafeKeyHandle hKey, nint pbKeyObject, int cbKeyObject, byte* pbInput, int cbInput, int dwFlags) 2141global::Interop.BCrypt.NTSTATUS __retVal = default; 2178static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint __hImportKey_native, ushort* __pszBlobType_native, nint* __hKey_native, nint __pbKeyObject_native, int __cbKeyObject_native, byte* __pbInput_native, int __cbInput_native, int __dwFlags_native); 2187private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptImportKeyPair(global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle hAlgorithm, nint hImportKey, string pszBlobType, out global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey, byte* pbInput, int cbInput, uint dwFlags) 2193global::Interop.BCrypt.NTSTATUS __retVal = default; 2230static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint __hImportKey_native, ushort* __pszBlobType_native, nint* __phKey_native, byte* __pbInput_native, int __cbInput_native, uint __dwFlags_native); 2239internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptKeyDerivation(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, global::Interop.BCrypt.BCryptBufferDesc* pParameterList, byte* pbDerivedKey, int cbDerivedKey, out uint pcbResult, int dwFlags) 2243global::Interop.BCrypt.NTSTATUS __retVal = default; 2267static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, global::Interop.BCrypt.BCryptBufferDesc* __pParameterList_native, byte* __pbDerivedKey_native, int __cbDerivedKey_native, uint* __pcbResult_native, int __dwFlags_native); 2276internal static partial global::Interop.BCrypt.NTSTATUS BCryptOpenAlgorithmProvider(out global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle phAlgorithm, string pszAlgId, string pszImplementation, global::Interop.BCrypt.BCryptOpenAlgorithmProviderFlags dwFlags) 2281global::Interop.BCrypt.NTSTATUS __retVal = default; 2311static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint* __phAlgorithm_native, ushort* __pszAlgId_native, ushort* __pszImplementation_native, global::Interop.BCrypt.BCryptOpenAlgorithmProviderFlags __dwFlags_native); 2320private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptSecretAgreement(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hPrivKey, global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hPubKey, out global::Microsoft.Win32.SafeHandles.SafeBCryptSecretHandle phAgreedSecret, uint dwFlags) 2327global::Interop.BCrypt.NTSTATUS __retVal = default; 2366static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hPrivKey_native, nint __hPubKey_native, nint* __phAgreedSecret_native, uint __dwFlags_native); 2375internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptSetProperty(global::Microsoft.Win32.SafeHandles.SafeBCryptHandle hObject, string pszProperty, void* pbInput, uint cbInput, uint dwFlags) 2378global::Interop.BCrypt.NTSTATUS __retVal = default; 2402static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbInput_native, uint __cbInput_native, uint __dwFlags_native); 2411private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptSignHash(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, void* pPaddingInfo, byte* pbInput, int cbInput, byte* pbOutput, int cbOutput, out int pcbResult, global::Interop.BCrypt.BCryptSignVerifyFlags dwFlags) 2415global::Interop.BCrypt.NTSTATUS __retVal = default; 2439static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, void* __pPaddingInfo_native, byte* __pbInput_native, int __cbInput_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, global::Interop.BCrypt.BCryptSignVerifyFlags __dwFlags_native); 2448private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptVerifySignature(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHash, int cbHash, byte* pbSignature, int cbSignature, global::Interop.BCrypt.BCryptSignVerifyFlags dwFlags) 2451global::Interop.BCrypt.NTSTATUS __retVal = default; 2473static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, void* __pPaddingInfo_native, byte* __pbHash_native, int __cbHash_native, byte* __pbSignature_native, int __cbSignature_native, global::Interop.BCrypt.BCryptSignVerifyFlags __dwFlags_native);
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Cng.cs (1)
12using static Interop.BCrypt;
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptSignHash.cs (4)
109if (status != Interop.BCrypt.NTSTATUS.STATUS_SUCCESS) 111throw Interop.BCrypt.CreateCryptographicException(status); 148if (status != BCrypt.NTSTATUS.STATUS_SUCCESS) 150throw BCrypt.CreateCryptographicException(status);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.HashIdAlg.cs (1)
18public static unsafe CRYPT_OID_INFO FindAlgIdOidInfo(Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM algId)
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptAlgorithmHandle.cs (2)
7using NTSTATUS = Interop.BCrypt.NTSTATUS; 20NTSTATUS ntStatus = Interop.BCrypt.BCryptCloseAlgorithmProvider(handle, 0);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptHandle.cs (1)
7using NTSTATUS = Interop.BCrypt.NTSTATUS;
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptHashHandle.cs (2)
7using NTSTATUS = Interop.BCrypt.NTSTATUS; 20NTSTATUS ntStatus = Interop.BCrypt.BCryptDestroyHash(handle);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptKeyHandle.cs (2)
7using NTSTATUS = Interop.BCrypt.NTSTATUS; 20NTSTATUS ntStatus = Interop.BCrypt.BCryptDestroyKey(handle);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptSecretHandle.cs (2)
4using NTSTATUS = Interop.BCrypt.NTSTATUS; 12NTSTATUS ntStatus = Interop.BCrypt.BCryptDestroySecret(handle);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\AeadCommon.Windows.cs (1)
7using static Interop.BCrypt;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\AesGcm.Windows.cs (1)
23_keyHandle = Interop.BCrypt.BCryptImportKey(BCryptAeadHandleCache.AesGcm, key);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSACng.ImportExport.cs (33)
7using static Interop.BCrypt; 9using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 199Interop.BCrypt.EmitBigEndian(blob, ref offset, parameters.Counter); 200Interop.BCrypt.Emit(blob, ref offset, parameters.Seed); 206Interop.BCrypt.EmitByte(blob, ref offset, 0xff, Sha1HashOutputSize + sizeof(int)); 213Interop.BCrypt.Emit(blob, ref offset, parameters.Q); 217Interop.BCrypt.Emit(blob, ref offset, parameters.P!); 218Interop.BCrypt.Emit(blob, ref offset, parameters.G!); 219Interop.BCrypt.Emit(blob, ref offset, parameters.Y!); 222Interop.BCrypt.Emit(blob, ref offset, parameters.X!); 279Interop.BCrypt.EmitBigEndian(blob, ref offset, parameters.Counter); 283Interop.BCrypt.Emit(blob, ref offset, parameters.Seed); 289Interop.BCrypt.EmitByte(blob, ref offset, 0xff, sizeof(int)); 294Interop.BCrypt.EmitByte(blob, ref offset, 0xff, defaultSeedLength); 297Interop.BCrypt.Emit(blob, ref offset, parameters.Q); 298Interop.BCrypt.Emit(blob, ref offset, parameters.P); 299Interop.BCrypt.Emit(blob, ref offset, parameters.G); 300Interop.BCrypt.Emit(blob, ref offset, parameters.Y); 304Interop.BCrypt.Emit(blob, ref offset, parameters.X!); 359dsaParams.Counter = BinaryPrimitives.ReadInt32BigEndian(Interop.BCrypt.Consume(dsaBlob, ref offset, 4)); 360dsaParams.Seed = Interop.BCrypt.Consume(dsaBlob, ref offset, Sha1HashOutputSize); 361dsaParams.Q = Interop.BCrypt.Consume(dsaBlob, ref offset, Sha1HashOutputSize); 364dsaParams.P = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 365dsaParams.G = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 366dsaParams.Y = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 369dsaParams.X = Interop.BCrypt.Consume(dsaBlob, ref offset, Sha1HashOutputSize); 393dsaParams.Counter = BinaryPrimitives.ReadInt32BigEndian(Interop.BCrypt.Consume(dsaBlob, ref offset, 4)); 397dsaParams.Seed = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbSeedLength); 398dsaParams.Q = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbGroupSize); 399dsaParams.P = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 400dsaParams.G = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 401dsaParams.Y = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 404dsaParams.X = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbGroupSize);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSACng.SignVerify.cs (1)
7using static Interop.BCrypt;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.HashAlgorithm.cs (4)
15internal static Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM GetHashAlgorithmId(HashAlgorithmName? name) 19return Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM.BCRYPT_NO_CURVE_GENERATION_ALG_ID; 33return (Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM)oid.AlgId; 39internal static HashAlgorithmName? GetHashAlgorithmName(Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM hashId)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.ImportExport.cs (37)
6using BCRYPT_ECC_PARAMETER_HEADER = Interop.BCrypt.BCRYPT_ECC_PARAMETER_HEADER; 7using BCRYPT_ECCFULLKEY_BLOB = Interop.BCrypt.BCRYPT_ECCFULLKEY_BLOB; 9using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 93Interop.BCrypt.Emit(blob, ref offset, curve.Prime); 94Interop.BCrypt.Emit(blob, ref offset, curve.A); 95Interop.BCrypt.Emit(blob, ref offset, curve.B); 96Interop.BCrypt.Emit(blob, ref offset, curve.G.X); 97Interop.BCrypt.Emit(blob, ref offset, curve.G.Y); 98Interop.BCrypt.Emit(blob, ref offset, curve.Order); 99Interop.BCrypt.Emit(blob, ref offset, curve.Cofactor); 102Interop.BCrypt.Emit(blob, ref offset, curve.Seed); 104Interop.BCrypt.Emit(blob, ref offset, parameters.Q.X); 105Interop.BCrypt.Emit(blob, ref offset, parameters.Q.Y); 108Interop.BCrypt.Emit(blob, ref offset, parameters.D!); 200primeCurve.Prime = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength); 201primeCurve.A = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength); 202primeCurve.B = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength); 205X = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength), 206Y = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength), 208primeCurve.Order = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbSubgroupOrder); 209primeCurve.Cofactor = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbCofactor); 212primeCurve.Seed = pBcryptBlob->cbSeed == 0 ? null : Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbSeed); 216X = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength), 217Y = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength) 222ecParams.D = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbSubgroupOrder); 258pBcryptBlob->Version = Interop.BCrypt.BCRYPT_ECC_PARAMETER_HEADER_V1; 268Interop.BCrypt.Emit(blob, ref offset, curve.Prime); 269Interop.BCrypt.Emit(blob, ref offset, curve.A); 270Interop.BCrypt.Emit(blob, ref offset, curve.B); 271Interop.BCrypt.Emit(blob, ref offset, curve.G.X); 272Interop.BCrypt.Emit(blob, ref offset, curve.G.Y); 273Interop.BCrypt.Emit(blob, ref offset, curve.Order); 274Interop.BCrypt.Emit(blob, ref offset, curve.Cofactor); 277Interop.BCrypt.Emit(blob, ref offset, curve.Seed); 400private static Interop.BCrypt.ECC_CURVE_TYPE_ENUM ConvertToCurveTypeEnum(ECCurve.ECCurveType value) 406return (Interop.BCrypt.ECC_CURVE_TYPE_ENUM)value; 412private static ECCurve.ECCurveType ConvertToCurveTypeEnum(Interop.BCrypt.ECC_CURVE_TYPE_ENUM value)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.ImportExport.NamedCurve.cs (12)
7using BCRYPT_ECCKEY_BLOB = Interop.BCrypt.BCRYPT_ECCKEY_BLOB; 9using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 58Interop.BCrypt.Emit(blob, ref offset, x); 59Interop.BCrypt.Emit(blob, ref offset, y); 64Interop.BCrypt.Emit(blob, ref offset, d!); 108byte[] x = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey); 109byte[] y = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey); 119Interop.BCrypt.Consume(ecBlob, ref offset, d.Length, d); 158Interop.BCrypt.BCryptBufferDesc desc = default; 159Interop.BCrypt.BCryptBuffer buff = default; 162buff.BufferType = Interop.BCrypt.CngBufferDescriptors.NCRYPTBUFFER_ECC_CURVE_NAME; 167desc.ulVersion = Interop.BCrypt.BCRYPTBUFFER_VERSION;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaCng.Windows.cs (1)
10using BCRYPT_PQDSA_PADDING_INFO = Interop.BCrypt.BCRYPT_PQDSA_PADDING_INFO;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaImplementation.CreateCng.cs (4)
16_hasSeed ? Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB : 17_hasPrivateKey ? Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB : 18Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB; 25CngKey key = Interop.BCrypt.BCryptExportKey(
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaImplementation.Windows.cs (21)
10using NTSTATUS = Interop.BCrypt.NTSTATUS; 47Interop.BCrypt.BCryptSignHashPqcPure(_key, data, context, destination); 51Interop.BCrypt.BCryptVerifySignaturePqcPure(_key, data, context, signature); 73Interop.BCrypt.BCryptSignHashPqcPreHash(_key, hash, hashAlgorithmIdentifier, context, destination); 91return Interop.BCrypt.BCryptVerifySignaturePqcPreHash(_key, hash, hashAlgorithmIdentifier, context, signature); 105SafeBCryptKeyHandle keyHandle = Interop.BCrypt.BCryptGenerateKeyPair(s_algHandle, keyLength: 0); 109Interop.BCrypt.BCryptSetSZProperty(keyHandle, Interop.BCrypt.BCryptPropertyStrings.BCRYPT_PARAMETER_SET_NAME, parameterSet); 110Interop.BCrypt.BCryptFinalizeKeyPair(keyHandle); 125const string PublicBlobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB; 132static blob => Interop.BCrypt.BCryptImportKeyPair(s_algHandle, PublicBlobType, blob)); 141const string PrivateBlobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB; 148static blob => Interop.BCrypt.BCryptImportKeyPair(s_algHandle, PrivateBlobType, blob)); 157const string PrivateSeedBlobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB; 164static blob => Interop.BCrypt.BCryptImportKeyPair(s_algHandle, PrivateSeedBlobType, blob)); 171Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB, 183Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB, 196Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB, 224ArraySegment<byte> keyBlob = Interop.BCrypt.BCryptExportKey(_key, keyBlobType); 262NTSTATUS status = Interop.BCrypt.BCryptOpenAlgorithmProvider( 266Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKem.Windows.cs (2)
7using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 8using BCRYPT_MLKEM_KEY_BLOB = Interop.BCrypt.BCRYPT_MLKEM_KEY_BLOB;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemCng.Windows.cs (1)
11using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemImplementation.Windows.cs (14)
9using NTSTATUS = Interop.BCrypt.NTSTATUS; 10using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 11using KeyBlobType = Interop.BCrypt.KeyBlobType; 12using BCRYPT_MLKEM_KEY_BLOB = Interop.BCrypt.BCRYPT_MLKEM_KEY_BLOB; 39SafeBCryptKeyHandle keyHandle = Interop.BCrypt.BCryptGenerateKeyPair(s_algHandle, keyLength: 0); 43Interop.BCrypt.BCryptSetSZProperty(keyHandle, Interop.BCrypt.BCryptPropertyStrings.BCRYPT_PARAMETER_SET_NAME, parameterSet); 44Interop.BCrypt.BCryptFinalizeKeyPair(keyHandle); 87uint written = Interop.BCrypt.BCryptDecapsulate(_key, ciphertext, sharedSecret, 0); 96Interop.BCrypt.BCryptEncapsulate( 146NTSTATUS status = Interop.BCrypt.BCryptOpenAlgorithmProvider( 150Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None); 166ArraySegment<byte> key = Interop.BCrypt.BCryptExportKey(_key, blobKind); 194static (algHandle, blobKind, blob) => Interop.BCrypt.BCryptImportKeyPair(
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PqcBlobHelpers.cs (10)
9using KeyBlobType = Interop.BCrypt.KeyBlobType; 10using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 11using BCRYPT_MLKEM_KEY_BLOB = Interop.BCrypt.BCRYPT_MLKEM_KEY_BLOB; 12using BCRYPT_PQDSA_KEY_BLOB = Interop.BCrypt.BCRYPT_PQDSA_KEY_BLOB; 56case Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB: 59case Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB: 62case Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB: 83blobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB; 86blobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB; 89blobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.EncryptDecrypt.cs (1)
8using BCRYPT_OAEP_PADDING_INFO = Interop.BCrypt.BCRYPT_OAEP_PADDING_INFO;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.SignVerify.cs (2)
10using BCRYPT_PKCS1_PADDING_INFO = Interop.BCrypt.BCRYPT_PKCS1_PADDING_INFO; 11using BCRYPT_PSS_PADDING_INFO = Interop.BCrypt.BCRYPT_PSS_PADDING_INFO;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\SP800108HmacCounterKdfImplementationCng.cs (14)
6using BCryptBuffer = Interop.BCrypt.BCryptBuffer; 7using CngBufferDescriptors = Interop.BCrypt.CngBufferDescriptors; 8using NTSTATUS = Interop.BCrypt.NTSTATUS; 62Interop.BCrypt.BCryptBufferDesc bufferDesc; 63bufferDesc.ulVersion = Interop.BCrypt.BCRYPTBUFFER_VERSION; 67NTSTATUS deriveStatus = Interop.BCrypt.BCryptKeyDerivation( 77throw Interop.BCrypt.CreateCryptographicException(deriveStatus); 138generateKeyStatus = Interop.BCrypt.BCryptGenerateSymmetricKey( 149generateKeyStatus = Interop.BCrypt.BCryptGenerateSymmetricKey( 162throw Interop.BCrypt.CreateCryptographicException(generateKeyStatus); 173if (!Interop.BCrypt.PseudoHandlesSupported) 175NTSTATUS openStatus = Interop.BCrypt.BCryptOpenAlgorithmProvider( 179Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None); 184throw Interop.BCrypt.CreateCryptographicException(openStatus);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519WindowsHelpers.cs (12)
24Interop.BCrypt.KeyBlobMagicNumber expectedMagicNumber = privateKey ? 25Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_ECDH_PRIVATE_GENERIC_MAGIC : 26Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_ECDH_PUBLIC_GENERIC_MAGIC; 30int blobHeaderSize = sizeof(Interop.BCrypt.BCRYPT_ECCKEY_BLOB); 40Interop.BCrypt.BCRYPT_ECCKEY_BLOB* blob = (Interop.BCrypt.BCRYPT_ECCKEY_BLOB*)pExportedSpan; 75Interop.BCrypt.KeyBlobMagicNumber magicNumber = privateKey ? 76Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_ECDH_PRIVATE_GENERIC_MAGIC : 77Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_ECDH_PUBLIC_GENERIC_MAGIC; 81int blobHeaderSize = sizeof(Interop.BCrypt.BCRYPT_ECCKEY_BLOB); 94Interop.BCrypt.BCRYPT_ECCKEY_BLOB* blob = (Interop.BCrypt.BCRYPT_ECCKEY_BLOB*)pBlobHeader;
System\Security\Cryptography\AesCcm.Windows.cs (1)
19_keyHandle = Interop.BCrypt.BCryptImportKey(BCryptAeadHandleCache.AesCcm, key);
System\Security\Cryptography\BasicSymmetricCipherLiteBCrypt.cs (3)
37_hKey = Interop.BCrypt.BCryptImportKey(algorithm, key); 86Interop.BCrypt.BCryptEncrypt(_hKey, input, _currentIv, output) : 87Interop.BCrypt.BCryptDecrypt(_hKey, input, _currentIv, output);
System\Security\Cryptography\ChaCha20Poly1305.Windows.cs (1)
19_keyHandle = Interop.BCrypt.BCryptImportKey(BCryptAeadHandleCache.ChaCha20Poly1305, key);
System\Security\Cryptography\CngAlgorithmCore.cs (1)
105Interop.BCrypt.BCryptPropertyStrings.BCRYPT_ECC_PARAMETERS,
System\Security\Cryptography\CngHelpers.cs (16)
10using BCRYPT_RSAKEY_BLOB = Interop.BCrypt.BCRYPT_RSAKEY_BLOB; 12using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 98if (bcryptMagic != Interop.BCrypt.BCRYPT_KEY_DATA_BLOB_HEADER.BCRYPT_KEY_DATA_BLOB_MAGIC) 102if (dwVersion != Interop.BCrypt.BCRYPT_KEY_DATA_BLOB_HEADER.BCRYPT_KEY_DATA_BLOB_VERSION1) 208Interop.BCrypt.Emit(rsaBlob, ref offset, parameters.Exponent); 209Interop.BCrypt.Emit(rsaBlob, ref offset, parameters.Modulus); 213Interop.BCrypt.Emit(rsaBlob, ref offset, parameters.P!); 214Interop.BCrypt.Emit(rsaBlob, ref offset, parameters.Q!); 262rsaParams.Exponent = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPublicExp); 263rsaParams.Modulus = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbModulus); 267rsaParams.P = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime1); 268rsaParams.Q = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime2); 269rsaParams.DP = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime1); 270rsaParams.DQ = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime2); 271rsaParams.InverseQ = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime1); 272rsaParams.D = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbModulus);
System\Security\Cryptography\ECCng.ImportExport.cs (1)
5using static Interop.BCrypt;
System\Security\Cryptography\HashProviderCng.cs (16)
9using BCryptCreateHashFlags = Interop.BCrypt.BCryptCreateHashFlags; 10using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 11using NTSTATUS = Interop.BCrypt.NTSTATUS; 38_hAlgorithm = Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle(hashAlgId, dwFlags, out _hashSize); 39NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash(_hAlgorithm, out _hHash, IntPtr.Zero, 0, key, key.Length, BCryptCreateHashFlags.BCRYPT_HASH_REUSABLE_FLAG); 44throw Interop.BCrypt.CreateCryptographicException(ntStatus); 68NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hHash, source, source.Length, 0); 71throw Interop.BCrypt.CreateCryptographicException(ntStatus); 85NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hHash, destination, _hashSize, 0); 89throw Interop.BCrypt.CreateCryptographicException(ntStatus); 105using (SafeBCryptHashHandle tmpHash = Interop.BCrypt.BCryptDuplicateHash(_hHash)) 107NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(tmpHash, destination, _hashSize, 0); 111throw Interop.BCrypt.CreateCryptographicException(ntStatus); 123SafeBCryptHashHandle clone = Interop.BCrypt.BCryptDuplicateHash(_hHash); 159NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash(_hAlgorithm, out hHash, IntPtr.Zero, 0, _key, _key == null ? 0 : _key.Length, Flags); 164throw Interop.BCrypt.CreateCryptographicException(ntStatus);
System\Security\Cryptography\HashProviderDispenser.Windows.cs (33)
8using BCryptAlgorithmCache = Interop.BCrypt.BCryptAlgorithmCache; 9using BCryptCreateHashFlags = Interop.BCrypt.BCryptCreateHashFlags; 10using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 11using NTSTATUS = Interop.BCrypt.NTSTATUS; 121if (Interop.BCrypt.PseudoHandlesSupported) 148Debug.Assert(Interop.BCrypt.PseudoHandlesSupported); 157if (Interop.BCrypt.PseudoHandlesSupported) 194Interop.BCrypt.BCryptAlgPseudoHandle algHandle; 200Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_MD5_ALG_HANDLE : 201Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_MD5_ALG_HANDLE; 207Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA1_ALG_HANDLE : 208Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA1_ALG_HANDLE; 214Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA256_ALG_HANDLE : 215Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA256_ALG_HANDLE; 221Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA384_ALG_HANDLE : 222Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA384_ALG_HANDLE; 228Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA512_ALG_HANDLE : 229Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA512_ALG_HANDLE; 235Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA3_256_ALG_HANDLE : 236Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA3_256_ALG_HANDLE; 242Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA3_384_ALG_HANDLE : 243Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA3_384_ALG_HANDLE; 249Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA3_512_ALG_HANDLE : 250Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA3_512_ALG_HANDLE; 255algHandle = Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_CSHAKE128_ALG_HANDLE; 260algHandle = Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_CSHAKE256_ALG_HANDLE; 279NTSTATUS ntStatus = Interop.BCrypt.BCryptHash((uint)algHandle, pKey, key.Length, pSrc, source.Length, pDest, digestSizeInBytes); 283throw Interop.BCrypt.CreateCryptographicException(ntStatus); 297NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 309throw Interop.BCrypt.CreateCryptographicException(ntStatus); 314ntStatus = Interop.BCrypt.BCryptHashData(hHash, source, source.Length, 0); 318throw Interop.BCrypt.CreateCryptographicException(ntStatus); 321Interop.BCrypt.BCryptFinishHash(hHash, destination, hashSize, 0);
System\Security\Cryptography\HKDF.Windows.cs (18)
11using BCryptAlgPseudoHandle = Interop.BCrypt.BCryptAlgPseudoHandle; 12using BCryptBuffer = Interop.BCrypt.BCryptBuffer; 13using BCryptBufferDesc = Interop.BCrypt.BCryptBufferDesc; 14using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 15using BCRYPT_KEY_DATA_BLOB_HEADER = Interop.BCrypt.BCRYPT_KEY_DATA_BLOB_HEADER; 16using CngBufferDescriptors = Interop.BCrypt.CngBufferDescriptors; 17using NTSTATUS = Interop.BCrypt.NTSTATUS; 102NTSTATUS openStatus = Interop.BCrypt.BCryptOpenAlgorithmProvider( 123Debug.Assert(Interop.BCrypt.PseudoHandlesSupported); 150status = Interop.BCrypt.BCryptGenerateSymmetricKey( 161throw Interop.BCrypt.CreateCryptographicException(status); 164Interop.BCrypt.BCryptSetSZProperty(keyHandle, BCRYPT_HKDF_HASH_ALGORITHM, hashAlgorithmName.Name); 170status = Interop.BCrypt.BCryptSetProperty( 181status = Interop.BCrypt.BCryptSetProperty( 191throw Interop.BCrypt.CreateCryptographicException(status); 204bufferDesc.ulVersion = Interop.BCrypt.BCRYPTBUFFER_VERSION; 208status = Interop.BCrypt.BCryptKeyDerivation( 218throw Interop.BCrypt.CreateCryptographicException(status);
System\Security\Cryptography\LiteHash.Windows.cs (43)
8using BCryptCreateHashFlags = Interop.BCrypt.BCryptCreateHashFlags; 9using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 10using NTSTATUS = Interop.BCrypt.NTSTATUS; 50HashAlgorithmNames.KMAC128 => (nuint)Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_KMAC128_ALG_HANDLE, 51HashAlgorithmNames.KMAC256 => (nuint)Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_KMAC256_ALG_HANDLE, 55NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 67throw Interop.BCrypt.CreateCryptographicException(ntStatus); 82throw Interop.BCrypt.CreateCryptographicException(ntStatus); 117CheckStatus(Interop.BCrypt.BCryptFinishHash(_hashHandle, buffer, 0, dwFlags: 0)); 128CheckStatus(Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0)); 135using (SafeBCryptHashHandle dup = Interop.BCrypt.BCryptDuplicateHash(_hashHandle)) 137CheckStatus(Interop.BCrypt.BCryptFinishHash(dup, pDestination, destination.Length, _finishFlags)); 148CheckStatus(Interop.BCrypt.BCryptFinishHash(_hashHandle, pDestination, destination.Length, _finishFlags)); 156SafeBCryptHashHandle clone = Interop.BCrypt.BCryptDuplicateHash(_hashHandle); 169throw Interop.BCrypt.CreateCryptographicException(status); 184HashAlgorithmNames.CSHAKE128 => (nuint)Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_CSHAKE128_ALG_HANDLE, 185HashAlgorithmNames.CSHAKE256 => (nuint)Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_CSHAKE256_ALG_HANDLE, 191NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 203throw Interop.BCrypt.CreateCryptographicException(ntStatus); 237NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); 241throw Interop.BCrypt.CreateCryptographicException(ntStatus); 249NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, pDestination, destination.Length, dwFlags: 0); 253throw Interop.BCrypt.CreateCryptographicException(ntStatus); 267using (SafeBCryptHashHandle tmpHash = Interop.BCrypt.BCryptDuplicateHash(_hashHandle)) 270NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(tmpHash, pDestination, destination.Length, dwFlags: 0); 274throw Interop.BCrypt.CreateCryptographicException(ntStatus); 281SafeBCryptHashHandle clone = Interop.BCrypt.BCryptDuplicateHash(_hashHandle); 289NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, pDestination, destination.Length, dwFlags: BCRYPT_HASH_DONT_RESET_FLAG); 293throw Interop.BCrypt.CreateCryptographicException(ntStatus); 318SafeBCryptAlgorithmHandle algorithmHandle = Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle( 325NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 337throw Interop.BCrypt.CreateCryptographicException(ntStatus); 350NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); 354throw Interop.BCrypt.CreateCryptographicException(ntStatus); 362NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, destination, _hashSizeInBytes, dwFlags: 0); 366throw Interop.BCrypt.CreateCryptographicException(ntStatus); 391SafeBCryptAlgorithmHandle algorithmHandle = Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle( 398NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 410throw Interop.BCrypt.CreateCryptographicException(ntStatus); 423NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); 427throw Interop.BCrypt.CreateCryptographicException(ntStatus); 435NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, destination, _hashSizeInBytes, dwFlags: 0); 439throw Interop.BCrypt.CreateCryptographicException(ntStatus);
System\Security\Cryptography\Pbkdf2Implementation.Windows.cs (15)
7using BCryptAlgPseudoHandle = Interop.BCrypt.BCryptAlgPseudoHandle; 8using BCryptBuffer = Interop.BCrypt.BCryptBuffer; 9using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 10using CngBufferDescriptors = Interop.BCrypt.CngBufferDescriptors; 11using NTSTATUS = Interop.BCrypt.NTSTATUS; 90if (Interop.BCrypt.PseudoHandlesSupported) 94generateKeyStatus = Interop.BCrypt.BCryptGenerateSymmetricKey( 108NTSTATUS openStatus = Interop.BCrypt.BCryptOpenAlgorithmProvider( 118throw Interop.BCrypt.CreateCryptographicException(openStatus); 128generateKeyStatus = Interop.BCrypt.BCryptGenerateSymmetricKey( 144throw Interop.BCrypt.CreateCryptographicException(generateKeyStatus); 173Interop.BCrypt.BCryptBufferDesc bufferDesc; 174bufferDesc.ulVersion = Interop.BCrypt.BCRYPTBUFFER_VERSION; 178NTSTATUS deriveStatus = Interop.BCrypt.BCryptKeyDerivation( 188throw Interop.BCrypt.CreateCryptographicException(deriveStatus);
System\Security\Cryptography\RandomNumberGeneratorImplementation.Windows.cs (5)
14Interop.BCrypt.NTSTATUS status = Interop.BCrypt.BCryptGenRandom(IntPtr.Zero, pbBuffer, count, Interop.BCrypt.BCRYPT_USE_SYSTEM_PREFERRED_RNG); 15if (status != Interop.BCrypt.NTSTATUS.STATUS_SUCCESS) 16throw Interop.BCrypt.CreateCryptographicException(status);
System\Security\Cryptography\RSABCrypt.cs (23)
14Interop.BCrypt.BCryptOpenAlgorithmProvider(BCryptNative.AlgorithmName.RSA); 53SafeBCryptKeyHandle newKey = Interop.BCrypt.BCryptGenerateKeyPair(s_algHandle, keySize); 54Interop.BCrypt.BCryptFinalizeKeyPair(newKey); 63int keySize = Interop.BCrypt.BCryptGetDWordProperty( 65Interop.BCrypt.BCryptPropertyStrings.BCRYPT_KEY_STRENGTH); 77ArraySegment<byte> keyBlob = Interop.BCrypt.BCryptExportKey( 80Interop.BCrypt.KeyBlobType.BCRYPT_RSAFULLPRIVATE_BLOB : 81Interop.BCrypt.KeyBlobType.BCRYPT_RSAPUBLIC_KEY_BLOB); 103newKey = Interop.BCrypt.BCryptImportKeyPair( 106Interop.BCrypt.KeyBlobType.BCRYPT_RSAPRIVATE_BLOB : 107Interop.BCrypt.KeyBlobType.BCRYPT_RSAPUBLIC_KEY_BLOB, 200return Interop.BCrypt.BCryptDecryptPkcs1(key, data, destination, out bytesWritten); 202return Interop.BCrypt.BCryptDecryptOaep( 243bytesWritten = Interop.BCrypt.BCryptEncryptPkcs1(key, data, destination); 246bytesWritten = Interop.BCrypt.BCryptEncryptOaep( 277Interop.BCrypt.NTSTATUS status; 283status = Interop.BCrypt.BCryptSignHashPkcs1( 292status = Interop.BCrypt.BCryptSignHashPss( 304if (status == Interop.BCrypt.NTSTATUS.STATUS_SUCCESS) 310if (status == Interop.BCrypt.NTSTATUS.STATUS_BUFFER_TOO_SMALL) 316throw Interop.BCrypt.CreateCryptographicException(status); 339return Interop.BCrypt.BCryptVerifySignaturePkcs1( 345return Interop.BCrypt.BCryptVerifySignaturePss(
System\Security\Cryptography\RSACng.ImportExport.cs (3)
10new CngKeyBlobFormat(Interop.BCrypt.KeyBlobType.BCRYPT_RSAFULLPRIVATE_BLOB); 13new CngKeyBlobFormat(Interop.BCrypt.KeyBlobType.BCRYPT_RSAPRIVATE_BLOB); 16new CngKeyBlobFormat(Interop.BCrypt.KeyBlobType.BCRYPT_RSAPUBLIC_KEY_BLOB);
System\Security\Cryptography\X25519DiffieHellmanCng.Windows.cs (1)
78const int NCRYPT_NO_KEY_VALIDATION = (int)Interop.BCrypt.BCryptImportKeyPairFlags.BCRYPT_NO_KEY_VALIDATION;
System\Security\Cryptography\X25519DiffieHellmanImplementation.Windows.cs (16)
10using NTSTATUS = Interop.BCrypt.NTSTATUS; 74using (SafeBCryptSecretHandle secret = Interop.BCrypt.BCryptSecretAgreement(_key, otherPartyKey)) 76Interop.BCrypt.BCryptDeriveKey( 79in Unsafe.NullRef<Interop.BCrypt.BCryptBufferDesc>(), 144SafeBCryptKeyHandle key = Interop.BCrypt.BCryptGenerateKeyPair(s_algHandle, 0); 149Interop.BCrypt.BCryptFinalizeKeyPair(key); 195Interop.BCrypt.KeyBlobType.BCRYPT_ECCPRIVATE_BLOB : 196Interop.BCrypt.KeyBlobType.BCRYPT_ECCPUBLIC_BLOB; 198ArraySegment<byte> key = Interop.BCrypt.BCryptExportKey(_key, blobType); 221Interop.BCrypt.KeyBlobType.BCRYPT_ECCPRIVATE_BLOB : 222Interop.BCrypt.KeyBlobType.BCRYPT_ECCPUBLIC_BLOB; 227return Interop.BCrypt.BCryptImportKeyPair( 231Interop.BCrypt.BCryptImportKeyPairFlags.BCRYPT_NO_KEY_VALIDATION); 237NTSTATUS status = Interop.BCrypt.BCryptOpenAlgorithmProvider( 241Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None); 253status = Interop.BCrypt.BCryptSetProperty(
System\Security\Cryptography\X509Certificates\X509Pal.Windows.PublicKey.cs (11)
10using NTSTATUS = Interop.BCrypt.NTSTATUS; 165return Interop.BCrypt.BCryptExportKey(bCryptKeyHandle, blobFormatString); 179Debug.Assert(ecBlob.Length >= sizeof(Interop.BCrypt.BCRYPT_ECCKEY_BLOB)); 183Interop.BCrypt.BCRYPT_ECCKEY_BLOB* pBcryptBlob = (Interop.BCrypt.BCRYPT_ECCKEY_BLOB*)pEcBlob; 185int offset = sizeof(Interop.BCrypt.BCRYPT_ECCKEY_BLOB); 189X = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey), 190Y = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey) 195ecParams.D = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey); 353NTSTATUS errorCode = Interop.BCrypt.BCryptGetProperty(cryptHandle, propertyName, null, 0, out numBytesNeeded, 0); 360errorCode = Interop.BCrypt.BCryptGetProperty(cryptHandle, propertyName, pPropertyValue, propertyValue.Length, out numBytesNeeded, 0);