We are trying to convert a PDF file into Base64 string using Javascript within Apigee Edge Cloud. But when we try to decode the Base64 string back to PDF, we are not getting back the original PDF text. This is because the Base64 conversion does not seem to work correctly within Apigee. The Base64 string obtained within Apigee is not matching with some standard Base64 tools such as http://www.base64encode.org
1. I have been able to reproduce this problem with a simple API proxy using the same Base64 Encoding algorithm.
2. When I just try to do Base64 encoding of "\n", I get the value shown below from from within Apigee
Cg==
3. However, when I try to do Base64 encoding of "\n" using the standard Base64 encoder http://www.base64encode.org, I get the following output:
XG4=
Can someone help in fixing this issue ?
quick question, how are you doing base64 encoding in apigee?
I have created Base64.js with a publicly available Base64 Encoder/Decoder algorithm
sounds like that could be the source of the problem, can you try running it locally to see if it produces any different output - i doubt it would,
or
I have used cryptojs in the past without any issues - can you that?
https://github.com/sytelus/CryptoJS/blob/master/components/enc-base64.js
The Base64 algorithm that I have used in my proxy works fine outside of Apigee and produces the expected results.
I will use the cryptojs and see if that works.
thats weird, do you mind sharing your code?