121
Views
5
Comments
[CryptoAPI] The input is not a valid Base-64 string as it contains a non-base 64 character
cryptoapi
Service icon
Forge asset by João Barata

Hi,

Here I am generating One link and passed that link in the Email for user, but when user clicked link from email, receives the Error :

"The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters."

Used Crypto API

To generate a link  

Site.GeneralFormLink+EncodeUrl(AES_Encrypt.Ciphertext)+EncodeUrl("&IsForm2=false&Key=")+EncodeUrl( BinaryToBase64.Base64)

Generated Link:


2024-08-01 09-19-00
Mohd Shuaib

Hi @Harbor V,

You have encoded the url parameter with EncodeUrl() function before generating the link so when you are trying to decrypt that Base64 parameter then first you need to decode that encoded parameter and make it exactly what it was before using the EncodeUrl().


UserImage.jpg
Harbor V

Thank you so much for Guiding me 

Expression which used to Generate a Link that only I Changed 

Site.GeneralFormLink+EncodeUrl(AES_Encrypt.Ciphertext)+"&IsForm2=false&Key="+EncodeUrl( BinaryToBase64.Base64) 

and it works

Thank You

UserImage.jpg
Md Mansur

Hi @Harbor V 

I think your requirement is when a person send a mail than in this mail you have a button like this:

1. you want to encrypted button link via crypto API and navigated to screen ??

If this is your requirement so its is not possible because when we navigate email to screen than you have only pass Screen URL  with some some Value like this

before encryption URL( You Need To Naviagte):

https://personal-bedrfblj.outsystemscloud.com/Home/Home?id=id

After Encryption URL

"wurhuefjkdjfdfhuefhuwehyfuehfcjvdcdvcncbvdfhnjxndughvncmnvcjvmcnbvnfcjmvncvncmvncvnc"

So its is not Valid link to Navigate Same screen and also you Can't decrypt this url or value outside outsystesm so email Via Encryption and description is not possible

You can used Crypto Api Inside the Outsystems application for encryption and description



Thanks

Md Mansur






2024-08-01 09-19-00
Mohd Shuaib

Hi @Md Mansur ,

I think you got him wrong. He is not encrypting whole URL, he is just encoding the parameter. Check the second image attached with the question, where he has shown the generated link, the link has a domain and a screen name.

2020-10-08 19-51-35
João Barata
Staff

Hi @Harbor V .
If you want to use the output of the CryptoAPI as an URL Parameter, you will need to convert it from Base64 into Base64URL.
https://base64.guru/standards/base64url

TL;DR; You will need to:

  • Replace “+” by “-” (minus)
  • Replace “/” by “_” (underline)
  • Remove the "=" padding characters


Then, when receiving the value, you will need to convert it back from Base64URL into Base64:

  • Replace “-” (minus) by “+”
  • Replace “_” (underline) by “/”
  • Calculate how many "=" padding characters are needed. You need to add as many as necessary to have the full string length be a multiple of 4.

Here's an example on how to properly calculate the padding necessary


Hope this helps,



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.