uri::encode_data_string lowercase replacements

Jan 15, 2015 at 12:15 PM
I am writing a client for the MS Azure REST API.

The biggest challenge I have at the moment is producing a SAS key to authenticate. This involves producing a Hash-based message authentication code using SHA256 which I am doing with the openSSL library. I am also using the uri::encode_data_string() function to encode various parts of the signature.

The problem I am seeing is that Microsoft Azure is very picky about the way the URIs are encoded. The resuests are working if the URI replacements are lower case i.e.

"=" to "%3D" FAILS
"=" to "%3d" WORKS

Though I would post the problem here as is would be handy if Is there was a way to make the encoding lowercase.
Coordinator
Jan 15, 2015 at 7:32 PM
Hi jamesbrew,

No we don't have any way to do this built in the library. It seems like this would be quite easy to do afterwards. Try writing a function to convert the entire string to lowercase letters.

Steve
Jan 15, 2015 at 8:52 PM
Converting the entire string to lowercase would change the encoded data. I've basically written a little loop to search for and change the two characters following a %.

Just thought I'd post so others could can try this if they have problems with the azure REST API.


Coordinator
Jan 15, 2015 at 8:58 PM
Hi jamesbrew,

I see, yes. If you wanted to contribute back an option for this, or something to the library that would be possible as well. You would just need to sign our contributor license agreement.

Steve