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