teCertificateContext返回ASN1坏标记值遇到

teCertificateContext返回ASN1坏标记值遇到

本文介绍了CertCreateCertificateContext返回ASN1坏标记值遇到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在加载.p7b证书文件到内存,然后调用CertCreateCertificateContext它,但它失败,错误ASN1坏标记值遇到。。



调用类似这样:



m_hContext = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,pbCertEncoded,dwCertEncodedLen);



这会返回NULL,而GetLastError()返回上面提到的错误。



我通过将证书拖出IE中的设置创建了证书文件,然后执行自动导出



我做错了什么?



谢谢!



可能您的凭证已汇出



我发现您尝试使用的编码的信息不完全支持(见可能的错误值)。


I'm loading a .p7b certificate file into memory and then calling CertCreateCertificateContext on it, but it fails with the error "ASN1 bad tag value met.".

The call look like this:

m_hContext = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, pbCertEncoded, dwCertEncodedLen);

This returns NULL and GetLastError() returns the error mentioned above.

I created the certificate file by dragging a certificate out of the settings in IE, which then does an automatic export to a file.

What am I doing wrong?

Thanks!

解决方案

Try to open your certificate by some asn.1 editor.

Probably your certificate has been exported incorrectly or size of the certificate you pass to the api is wrong... Rather the second one option (incorrect cert construction or passing).

I found here the info that the encoding you try to use is not fully supported (see possible error values).

这篇关于CertCreateCertificateContext返回ASN1坏标记值遇到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 10:54