307 {
309 int num =
sizeof(BCRYPT_KEY_DATA_BLOB_HEADER) +
length;
310 byte[]
array =
new byte[num];
311 fixed (
byte* ptr =
array)
312 {
313 BCRYPT_KEY_DATA_BLOB_HEADER* ptr2 = (BCRYPT_KEY_DATA_BLOB_HEADER*)ptr;
314 ptr2->dwMagic = 1296188491u;
315 ptr2->dwVersion = 1u;
316 ptr2->cbKeyData = (uint)
length;
317 }
318 key.CopyTo(
array.AsSpan(
sizeof(BCRYPT_KEY_DATA_BLOB_HEADER)));
321 if (nTSTATUS != 0)
322 {
324 }
325 return hKey;
326 }
static Exception CreateCryptographicException(NTSTATUS ntStatus)
static unsafe SafeKeyHandle BCryptImportKey(SafeAlgorithmHandle hAlg, ReadOnlySpan< byte > key)
static readonly IntPtr Zero