Load an PEM encoded X.509 certificate into Windows CryptoAPI

前端 未结 3 1057
难免孤独
难免孤独 2020-12-04 22:45

I need to load a PEM encoded X.509 certificate into a Windows Crypto API context to use with C++. They are the ones that have -----BEGIN RSA XXX KEY-----

3条回答
  •  眼角桃花
    2020-12-04 23:33

    I'm currently facing the same difficulty. I haven't finished coding a solution but as I understand it you need to strip off the ----- BEGIN etc ----- and ----- END etc ------ tags and decode the Base64.

    This leaves you with a DER encoded string, which you need to parse to get the modulus and public exponent. From those you can populate the PUBLICKEYSTRUC and RSAPUBKEY structures. Good luck ;-)

提交回复
热议问题