JWT token decoding even when the last character of the signature is changed

The reason is the base64url encoding. The three parts of a JWT are all base64url encoded. Base64 encoding transforms the input data to a 6-Bit representation, mapped to a set of 64 ASCII characters. If you have 3 bytes source data (24 bits), the base64 encoded result is 4 characters long, each character representing a … Read more

Json.Net deserialize out of memory issue

To read large JSON string with use of JsonConvert.DeserializeObject will consume your lots of memory. So One of the ways to over come from this issue, you can create an instance of JsonSerializer as given below. using (StreamReader r = new StreamReader(filePath)) { using (JsonReader reader = new JsonTextReader(r)) { JsonSerializer serializer = new JsonSerializer(); … Read more

How to send a base64 encoded image to a FastAPI backend?

As described in this answer, uploaded files are sent as form data. As per FastAPI documentation: Data from forms is normally encoded using the “media type” application/x-www-form-urlencoded when it doesn’t include files. But when the form includes files, it is encoded as multipart/form-data. If you use File, FastAPI will know it has to get the … Read more

Convert base64 byte array to an image

What you get is just the toString output of an array. You need however the byte array converted to a String. You should create a method in bean public String getByteArrayString() { return new String(this.imageByteArray); } and reference this in your JSP. While technically you should define which encoding to use for an array of … Read more