base64_decode of BASE64R4

Other open source tools published on ScottKlement.com
Post Reply
das.samrat01
Posts: 1
Joined: Fri Mar 14, 2025 10:17 pm

base64_decode of BASE64R4

Post by das.samrat01 »

I am trying to decode a signature in base64URL and then use this for RS256 signature verification. Converted the signature to Base64 format (verified and working fine) and then used base64_decode to decode the same.

It's being decoded but the length is more than 256 (it's coming as 263) hence it's failing signature verification.

I am decoding header, payload and public key also using same routine and working fine. In debug mode just before calling Qc3VerifySignature if I change the signature length to 256 it's not giving any error.

I know if I put below logic might solve the issue but shouldn't be correct way of coding.
If SignatureLen > 256;
SignatureLen = 256;
EndIf;


I used same signature to decode in Base54URL through online website (https://base64.guru/standards/base64url/decode) and it's giving 230 characters.

If you can let me know how can I use base64_decode of BASE64R4 to decode the signature and length within 256 would be great help.
Scott Klement
Site Admin
Posts: 872
Joined: Sun Jul 04, 2021 5:12 am

Re: base64_decode of BASE64R4

Post by Scott Klement »

Base64Url isn't quite the same as Base64, though they are related.

I can't tell you what you are doing wrong from your post because, essentially, all it says is that its not working. It doesn't explain any details whatsoever. Show me how to reproduce the problem you're having if you want further help.
Post Reply