internal static SafeBCryptKeyHandle ImportAsymmetricPublicKey(X509Native.CERT_PUBLIC_KEY_INFO certPublicKeyInfo, int dwFlag) { SafeBCryptKeyHandle keyHandle = null; int error = UnsafeNativeMethods.CryptImportPublicKeyInfoEx2( X509Native.X509_ASN_ENCODING, ref certPublicKeyInfo, dwFlag, IntPtr.Zero, out keyHandle); if (error == 0) { throw new CryptographicException(Marshal.GetLastWin32Error()); } return(keyHandle); }
internal static extern int CryptImportPublicKeyInfoEx2([In] uint dwCertEncodingType, [In] ref X509Native.CERT_PUBLIC_KEY_INFO pInfo, [In] int dwFlags, [In] IntPtr pvAuxInfo, [Out] out SafeBCryptKeyHandle phKey);