_generated\0\LibraryImports.g.cs (42)
3895internal static unsafe partial bool CertSetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, global::Interop.Crypt32.CertSetPropertyFlags dwFlags, global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle keyHandle)
3903global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __keyHandle_native__marshaller = new();
3943internal static unsafe partial bool CertSetCertificateContextProperty(nint pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, global::Interop.Crypt32.CertSetPropertyFlags dwFlags, global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle keyHandle)
3950global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __keyHandle_native__marshaller = new();
4043public static partial bool CryptAcquireCertificatePrivateKey(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCert, global::Interop.Crypt32.CryptAcquireCertificatePrivateKeyFlags dwFlags, nint pvParameters, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phCryptProvOrNCryptKey, out global::Interop.Crypt32.CryptKeySpec pdwKeySpec, out bool pfCallerFreeProvOrNCryptKey)
4056global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedOut __phCryptProvOrNCryptKey_native__marshaller = new();
4999internal static unsafe partial global::Interop.NCrypt.ErrorCode NCryptEncrypt(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, global::System.ReadOnlySpan<byte> pbInput, int cbInput, void* pPaddingInfo, global::System.Span<byte> pbOutput, int cbOutput, out int pcbResult, global::Interop.NCrypt.AsymmetricPaddingMode dwFlags)
5005global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5039internal static unsafe partial global::Interop.NCrypt.ErrorCode NCryptDecrypt(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, global::System.ReadOnlySpan<byte> pbInput, int cbInput, void* pPaddingInfo, global::System.Span<byte> pbOutput, int cbOutput, out int pcbResult, global::Interop.NCrypt.AsymmetricPaddingMode dwFlags)
5045global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5079internal static partial global::Interop.NCrypt.ErrorCode NCryptOpenKey(global::Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle hProvider, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phKey, string pszKeyName, int dwLegacyKeySpec, global::System.Security.Cryptography.CngKeyOpenOptions dwFlags)
5087global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedOut __phKey_native__marshaller = new();
5132internal static partial global::Interop.NCrypt.ErrorCode NCryptImportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle hProvider, nint hImportKey, string pszBlobType, nint pParameterList, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags)
5140global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedOut __phKey_native__marshaller = new();
5186internal static partial global::Interop.NCrypt.ErrorCode NCryptImportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle hProvider, nint hImportKey, string pszBlobType, ref global::Interop.NCrypt.NCryptBufferDesc pParameterList, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags)
5194global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedOut __phKey_native__marshaller = new();
5241internal static partial global::Interop.NCrypt.ErrorCode NCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, nint hExportKey, string pszBlobType, nint pParameterList, byte[] pbOutput, int cbOutput, out int pcbResult, int dwFlags)
5247global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5281internal static partial global::Interop.NCrypt.ErrorCode NCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, nint hExportKey, string pszBlobType, nint pParameterList, ref byte pbOutput, int cbOutput, out int pcbResult, int dwFlags)
5287global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5321internal static partial global::Interop.NCrypt.ErrorCode NCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, nint hExportKey, string pszBlobType, nint pParameterList, global::System.Span<byte> pbOutput, int cbOutput, out int pcbResult, int dwFlags)
5327global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5361internal static partial global::Interop.NCrypt.ErrorCode NCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, nint hExportKey, string pszBlobType, ref global::Interop.NCrypt.NCryptBufferDesc pParameterList, ref byte pbOutput, int cbOutput, out int pcbResult, int dwFlags)
5367global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5402internal static partial global::Interop.NCrypt.ErrorCode NCryptDeleteKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, int dwFlags)
5407global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5437internal static partial global::Interop.NCrypt.ErrorCode NCryptCreatePersistedKey(global::Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle hProvider, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phKey, string pszAlgId, string pszKeyName, int dwLegacyKeySpec, global::System.Security.Cryptography.CngKeyCreationOptions dwFlags)
5445global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedOut __phKey_native__marshaller = new();
5491internal static partial global::Interop.NCrypt.ErrorCode NCryptFinalizeKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, int dwFlags)
5496global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5526private static unsafe partial global::Interop.NCrypt.ErrorCode NCryptDecapsulate(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, byte* pbCipherText, uint cbCipherText, byte* pbSecretKey, uint cbSecretKey, out uint pcbSecretKey, uint dwFlags)
5532global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5564private static unsafe partial global::Interop.NCrypt.ErrorCode NCryptEncapsulate(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, byte* pbSecretKey, uint cbSecretKey, out uint pcbSecretKey, byte* pbCipherText, uint cbCipherText, out uint pcbCipherText, uint dwFlags)
5571global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5685private static partial global::Interop.NCrypt.ErrorCode NCryptSecretAgreement(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hPrivKey, global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hPubKey, out global::Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle phSecret, int dwFlags)
5695global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hPubKey_native__marshaller = new();
5696global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hPrivKey_native__marshaller = new();
5869private static unsafe partial global::Interop.NCrypt.ErrorCode NCryptSignHash(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHashValue, int cbHashValue, byte* pbSignature, int cbSignature, out int pcbResult, global::Interop.NCrypt.AsymmetricPaddingMode dwFlags)
5875global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
5907private static unsafe partial global::Interop.NCrypt.ErrorCode NCryptVerifySignature(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHashValue, int cbHashValue, byte* pbSignature, int cbSignature, global::Interop.NCrypt.AsymmetricPaddingMode dwFlags)
5912global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.EncryptDecrypt.cs (2)
14internal static unsafe partial ErrorCode NCryptEncrypt(SafeNCryptKeyHandle hKey, ReadOnlySpan<byte> pbInput, int cbInput, void* pPaddingInfo, Span<byte> pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags);
18internal static unsafe partial ErrorCode NCryptDecrypt(SafeNCryptKeyHandle hKey, ReadOnlySpan<byte> pbInput, int cbInput, void* pPaddingInfo, Span<byte> pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags);
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.Keys.cs (10)
21internal static partial ErrorCode NCryptOpenKey(SafeNCryptProviderHandle hProvider, out SafeNCryptKeyHandle phKey, string pszKeyName, int dwLegacyKeySpec, CngKeyOpenOptions dwFlags);
25internal static partial ErrorCode NCryptImportKey(SafeNCryptProviderHandle hProvider, IntPtr hImportKey, string pszBlobType, IntPtr pParameterList, out SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags);
29internal static partial ErrorCode NCryptImportKey(SafeNCryptProviderHandle hProvider, IntPtr hImportKey, string pszBlobType, ref NCryptBufferDesc pParameterList, out SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags);
33internal static partial ErrorCode NCryptExportKey(SafeNCryptKeyHandle hKey, IntPtr hExportKey, string pszBlobType, IntPtr pParameterList, byte[]? pbOutput, int cbOutput, out int pcbResult, int dwFlags);
37internal static partial ErrorCode NCryptExportKey(SafeNCryptKeyHandle hKey, IntPtr hExportKey, string pszBlobType, IntPtr pParameterList, ref byte pbOutput, int cbOutput, out int pcbResult, int dwFlags);
41internal static partial ErrorCode NCryptExportKey(SafeNCryptKeyHandle hKey, IntPtr hExportKey, string pszBlobType, IntPtr pParameterList, Span<byte> pbOutput, int cbOutput, out int pcbResult, int dwFlags);
45internal static partial ErrorCode NCryptExportKey(SafeNCryptKeyHandle hKey, IntPtr hExportKey, string pszBlobType, ref NCryptBufferDesc pParameterList, ref byte pbOutput, int cbOutput, out int pcbResult, int dwFlags);
49internal static partial ErrorCode NCryptDeleteKey(SafeNCryptKeyHandle hKey, int dwFlags);
53internal static partial ErrorCode NCryptCreatePersistedKey(SafeNCryptProviderHandle hProvider, out SafeNCryptKeyHandle phKey, string pszAlgId, string? pszKeyName, int dwLegacyKeySpec, CngKeyCreationOptions dwFlags);
57internal static partial ErrorCode NCryptFinalizeKey(SafeNCryptKeyHandle hKey, int dwFlags);
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.SignVerify.cs (4)
15private static unsafe partial ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHashValue, int cbHashValue, byte* pbSignature, int cbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags);
17internal static unsafe ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan<byte> pbHashValue, Span<byte> pbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags)
28private static unsafe partial ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHashValue, int cbHashValue, byte* pbSignature, int cbSignature, AsymmetricPaddingMode dwFlags);
30internal static unsafe ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan<byte> pbHashValue, int cbHashValue, ReadOnlySpan<byte> pbSignature, int cbSignature, AsymmetricPaddingMode dwFlags)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngHelpers.SignVerify.cs (4)
15public static unsafe byte[] SignHash(this SafeNCryptKeyHandle keyHandle, ReadOnlySpan<byte> hash, AsymmetricPaddingMode paddingMode, void* pPaddingInfo, int estimatedSize)
48this SafeNCryptKeyHandle keyHandle,
69public static unsafe bool TrySignHash(this SafeNCryptKeyHandle keyHandle, ReadOnlySpan<byte> hash, Span<byte> signature, AsymmetricPaddingMode paddingMode, void* pPaddingInfo, out int bytesWritten)
104public static unsafe bool VerifyHash(this SafeNCryptKeyHandle keyHandle, ReadOnlySpan<byte> hash, ReadOnlySpan<byte> signature, AsymmetricPaddingMode paddingMode, void* pPaddingInfo)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.EncryptDecrypt.cs (5)
56using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle())
138using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle())
198private unsafe byte[] EncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan<byte> input, AsymmetricPaddingMode paddingMode, void* paddingInfo, bool encrypt)
254private static unsafe bool TryEncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan<byte> input, Span<byte> output, AsymmetricPaddingMode paddingMode, void* paddingInfo, bool encrypt, out int bytesWritten)
281SafeNCryptKeyHandle key,