Question

I have my certrequest as a PEM base64 data. See data below.

1) My understanding is that this is an ASCII data type and not in UNICODE format. Please clarify.

-----BEGIN NEW CERTIFICATE REQUEST----- MIIBTjCBuAIBADARMQ8wDQYDVQQDEwZ3dTAwMzEwgZ0wDQYJKoZIhvcNAQEBBQAD gYsAMIGHAoGBAKP48eljetv3fVicT6g6hKjmLpsySJaZ/NnepEJEqtQQNbwsluhW yWxhHWzPoNPV9uqjZBW7EnqYjxyPp1A0vOK35uxmmcNrgmuSjO1WBkD0YVZwzh2u OovRCOwJKklQtJnQWoM+yT8CyBVk7raVJOrLDMC8FR5AMknVCIlt7HppAgEDoAAw DQYJKoZIhvcNAQEFBQADgYEAAK5G10e39GxiNiPXdrOAwtuIiLd1UTWn3VYY7nYY 74LhydUBjo0Xi6HBTTNVlPNoRB9GOe5P1Qgq0EJ6gLIriFY+Gxdl2Y4lSo7FmpxB +87bRCLpC3mxQltNm97ZysmS4I4diYhPDSS/2acKeH2cBgAtQVG9KsuZ41qxUQ10 EY8= -----END NEW CERTIFICATE REQUEST-----

2) If the above data is in ASCII, how can i convert it to BSTR, as ICertRequest2::Submit requires the data to be unicode string.

3) Can i convert the ASCII data directly to BSTR

Thanks Raj

Was it helpful?

Solution

Either:

  1. Use MultiByteToWideChar before calling SysAllocString (or SysAllocStringLen)

  2. Use _bstr_t or CComBSTR which are C++ wrappers for BSTRs.

OTHER TIPS

US-ASCII is a subset of UTF-8. The encoded form of any ASCII character is the UTF-8 encoding, so no conversion is needed.

Simply pass the string as-is, setting the CR_IN_BASE64HEADER flag.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top