Beispiel #1
0
        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);
        }
Beispiel #2
0
 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);