339 {
340 global::Interop.NCrypt.ErrorCode errorCode;
343 {
344 global::Interop.BCrypt.BCryptBufferDesc structure = default(global::Interop.BCrypt.BCryptBufferDesc);
345 global::Interop.BCrypt.BCryptBuffer structure2 = default(global::Interop.BCrypt.BCryptBuffer);
348 try
349 {
352 structure2.cbBuffer = (curveName.Length + 1) * 2;
353 structure2.BufferType = global::Interop.BCrypt.CngBufferDescriptors.NCRYPTBUFFER_ECC_CURVE_NAME;
356 structure.cBuffers = 1;
357 structure.pBuffers = intPtr2;
358 structure.ulVersion = 0;
360 errorCode = global::Interop.NCrypt.NCryptImportKey(provider,
IntPtr.Zero, blobType, intPtr, out phKey, ref
MemoryMarshal.GetReference(keyBlob), keyBlob.
Length, 0);
361 }
362 finally
363 {
366 }
367 }
368 if (errorCode != 0)
369 {
370 Exception ex = errorCode.ToCryptographicException();
371 if (errorCode == global::Interop.NCrypt.ErrorCode.NTE_INVALID_PARAMETER)
372 {
374 }
375 throw ex;
376 }
377 return phKey;
378 }
static void StructureToPtr(object structure, IntPtr ptr, bool fDeleteOld)
static void FreeHGlobal(IntPtr hglobal)
static int SizeOf(object structure)
static IntPtr AllocHGlobal(int cb)
IntPtr DangerousGetHandle()
static string Cryptography_CurveNotSupported
static string Format(string resourceFormat, object p1)