Problem with "=" in base64_decode

Hi,
I have two string in base64 encode:
0J3QvtCy0L7QtSDRgdC+0L7QsdGJ0LXQvdC40LUg0L4g0L/RgNC+0LHQu9C10Lw=0LUg4oSWMjU2NDUyNw==
and
0J/QvtGB0YLRg9C/0LjQuyDQt9Cw0L/RgNC+0YEg0L3QsCDRgdC80LXQvdGDINC80LDRgNGI0YDRg9GC0LAg0L/QviDQv9GA0L7QsdC70LXQvNC1IOKEljI0OTU2NDU=

At the first string I have “=” , but don’t have in second.
When I decode firs line - I get error In call to function 'base64_decode' at 18:23 an exception was thrown: Unrecognized character: =. If you decode it in the linux console, the problem doesn’t occur.
When decode second string i don’t have this error.
What I can do with this problem ?

It’s probably problem of input data. Graylog follows RFC 4648 for base64, but your string contains = in middle of string (which is not allowed in middle, but only at the end of string = padding).

This is correct base64 string which works, and return same encoded data:
0J3QvtCy0L7QtSDRgdC+0L7QsdGJ0LXQvdC40LUg0L4g0L/RgNC+0LHQu9C10LzQtSDihJYyNTY0NTI3Cg==


https://guava.dev/releases/21.0/api/docs/com/google/common/io/BaseEncoding.html
https://tools.ietf.org/html/rfc4648#section-4

2 Likes

Thank you. At first time, i joined two word and then decoded. Now i decode and then join. All words decoded.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.