是否可以使用 openssl API's 创建与 Windows crypto API's 兼容的证书缓冲区?

Is it possible to use openssl API's to create certificate buffer that is compatible with Windows crypto API's?

我们使用以下openssl API从个人信息交换文件中检索证书

ret = PKCS12_parse ( p12, "mqroot", &pkey, &cert, &ca );
        if ( 0 == ret )
        {
            printf ( "\tError: PKCS12_parse %d\n", GetLastError( ) );
            hResult = GetLastError ( );
            __leave;
        }// if

此证书能否转换为与 windows CAPI.

兼容的任何数据类型
hCertStore = PFXImportCertStore( &data, wszPassword, CRYPT_EXPORTABLE | CRYPT_USER_KEYSET );
        if ( !hCertStore )
        {
            hResult = GetLastError();
            __leave;
        } // if
pUsrCertContext = CertEnumCertificatesInStore(
            hCertStore,
            pUsrCertContext );
        if( !pUsrCertContext )
        {
            hResult = GetLastError( );
            __leave;
        } // if

使用上述函数,我们将编码的证书数据作为 pUsrCertContext 获取,是否有任何函数可以使用 openssl 获取编码的证书数据,以便 windows API 可以忽略其他兼容性操作系统。

您可以从 OpenSSL 获取 PEM/DER 编码证书并使用 CryptStringToBinary 函数将 PEM/DER 转换为 CryptoAPI 二进制格式。

另请参阅此 post 的最底部。