不会,不过这个flag也就只有3个值。 EXPORT_PRIVATE_KEYS Private keys are exported as well as the certificates. REPORT_NO_PRIVATE_KEY If a certificate is encountered that has no associated private key, the function returns FALSE with the last error set to either CRYPT_E_NOT_FOUND or NTE_NO_KEY. REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY If a certificate is encountered that has a non-exportable private key, the function returns FALSE with the last error set to either CRYPT_E_NOT_FOUND or NTE_BAD_KEY.
HCERTSTORE:什么类型?
CRYPT_DATA_BLOB:应该是个结构类型吧,需要layout
LPCWSTR szPassword:不能直接用string来进行传递
void *pvReserved:你调用的时候,还想没传这个参数
DWORD dwFlags:应该是标志,有些具体的值吧
你先看看
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/security/pfxexportcertstoreex.asp的说明吧
希望对api比较懂的大哥哥们帮帮小妹试试这个函数吧。哪怕给我一段没经过测试的代码也好让小妹葫芦画瓢阿。。谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢
EXPORT_PRIVATE_KEYS Private keys are exported as well as the certificates. REPORT_NO_PRIVATE_KEY If a certificate is encountered that has no associated private key, the function returns FALSE with the last error set to either CRYPT_E_NOT_FOUND or NTE_NO_KEY. REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY If a certificate is encountered that has a non-exportable private key, the function returns FALSE with the last error set to either CRYPT_E_NOT_FOUND or NTE_BAD_KEY.
IntPtr hnd;
...
Cryptography.X509Certificates.X509Certificate cert= Cryptography.X509Certificates.X509Certificate(hnd);
byte[] Data=cert.GetRawCertData(); //得到证书的原始数据typedef struct _CRYPTOAPI_BLOB
{
DWORD cbData;
BYTE* pbData;
}cryB;
cryB->cbData=Data.Length;
cryB->pbData=Data;PFXExportCertStoreEx(store.Handle,cryB,"liuying",null,EXPORT_PRIVATE_KEYS|REPORT_NO_PRIVATE_KEY);
可以参考:http://www.ithome-cn.net/technology/vc/vc141.htm信任证书不是你自己可以颁发的,就算是windows 中的administrator 身份证书也只是身份证书并不是一个信任证书晕
正因它人人都可以自己创建,所以它并不能保证包内的内容是否有害。如果它没有存在信任,那么它只一个作用就是保证自己的完整性,不知你的:我其时就是想要做一个带秘钥的合法的证书发给用户是什么意思,如果是WEB上的多点某知用户,那么根本没有必要,单点已知用户用签名比这个要更好
我想利用api用程序导出证书,存成证书文件