BaseCode64, URL parameters, encoding problem?

Hi all,

I have a web service created on Xojo cloud and a local osx based xojo app.
The local app sends url parameters to the webservice.

I have created a password sent by the local app to the web service for access.
I have created public and private RSA keys and encrypted the password.
The encrypted password memory block is then converted to basecode64 for transmission as a url parameter.
However the web service’s received basecode64 encrypted, password is different to that created by the app.

After checking the value of the basecode64 encrypted password on the desktop app there are “+” characters shown
but the string received by the webservice is different in that it has no “+” characters-
causing the error message
“RSA/OAEP-MGF1(SHA-1): ciphertext length of 124 doesn’t match the required length of 128 for this key”

Not sure why this is happening.
I suspect this is to do with encoding…any advice help or examples would be great…Thanks :slight_smile:

[quote=399999:@James Moore]After checking the value of the basecode64 encrypted password on the desktop app there are “+” characters shown
but the string received by the webservice is different in that it has no “+” characters-[/quote]
“+” is a reserved character in URLs. Try EncodeURLComponent(base64key)

There is also Base64Url that is designed specifically for this. Look elsewhere on the forum for the code.

Best practice is to send this kind of stuff in the header not on the URL.

Thanks for your help :-)…

@Andrew Lambert [quote] Try EncodeURLComponent(base64key)[/quote] tried that Andrew but errors thrown up relating to json??.

Kem your base64URL code worked a treat…