In addition to @jalchr's solution that helped me, I found that when calling ATL::Base64Encode
from a c++ application to encode the content you pass to an ASP.NET webservice, you need something else, too. In addition to
sEncryptedString = sEncryptedString.Replace(' ', '+');
from @jalchr's solution, you also need to ensure that you do not use the ATL_BASE64_FLAG_NOPAD
flag on ATL::Base64Encode
:
BOOL bEncoded = Base64Encode(lpBuffer,
nBufferSizeInBytes,
strBase64Encoded.GetBufferSetLength(base64Length),
&base64Length,ATL_BASE64_FLAG_NOCRLF/*|ATL_BASE64_FLAG_NOPAD*/);