|
3 | 3 |
|
4 | 4 | using System; |
5 | 5 | using System.Runtime.InteropServices; |
| 6 | +using Internal.Cryptography; |
6 | 7 | using Microsoft.Win32.SafeHandles; |
7 | 8 |
|
8 | 9 | internal static partial class Interop |
9 | 10 | { |
10 | 11 | internal static partial class NCrypt |
11 | 12 | { |
12 | 13 | [LibraryImport(Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] |
13 | | - internal static unsafe partial ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan<byte> pbHashValue, int cbHashValue, Span<byte> pbSignature, int cbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags); |
| 14 | + private static unsafe partial ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHashValue, int cbHashValue, byte* pbSignature, int cbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags); |
| 15 | + |
| 16 | + internal static unsafe ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan<byte> pbHashValue, Span<byte> pbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags) |
| 17 | + { |
| 18 | + fixed (byte* pHash = &MemoryMarshal.GetReference(pbHashValue)) |
| 19 | + fixed (byte* pSignature = &Helpers.GetNonNullPinnableReference(pbSignature)) |
| 20 | + { |
| 21 | + return NCryptSignHash(hKey, pPaddingInfo, pHash, pbHashValue.Length, pSignature, pbSignature.Length, out pcbResult, dwFlags); |
| 22 | + } |
| 23 | + } |
14 | 24 |
|
15 | 25 | [LibraryImport(Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] |
16 | 26 | internal static unsafe partial ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan<byte> pbHashValue, int cbHashValue, ReadOnlySpan<byte> pbSignature, int cbSignature, AsymmetricPaddingMode dwFlags); |
|
0 commit comments