BaseCode64, URL parameters, encoding problem?

  1. 9 months ago

    James M

    9 Aug 2018 South Devon England

    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 :-)

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

  2. Andrew L

    9 Aug 2018 San Francisco, CA, USA

    @James M 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-

    "+" is a reserved character in URLs. Try EncodeURLComponent(base64key)

  3. Kem T

    9 Aug 2018 Pre-Release Testers, Xojo Pro, XDC Speakers Answer New York

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

  4. James D

    9 Aug 2018 Pre-Release Testers, Xojo Pro Europe (Switzerland)

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

  5. James M

    10 Aug 2018 South Devon England

    Thanks for your help :-)....

    @Andrew L

    Try EncodeURLComponent(base64key)

    tried that Andrew but errors thrown up relating to json??.

    Kem your base64URL code worked a treat...

or Sign Up to reply!