Skip to content

Tag: base64

Base 64 decode to String not as expected

I have a String that I want to decode to a binary object (BigInteger or its String) Say for instance I got the String An now I want to decode it using the Base64.getDecoder() method, such as: According to that, the value of result is 1011010011000100110000001100010011000000110000001100010011000100110000001100…

Java Base64 encoding loss of data

say I have the following snippet, where certificate is a java Certificate object: Is there any chance data will not be equal to newData? basically, is there loss of information to string and then back? Thanks Answer Assuming nothing explodes due to out-of-memory errors or similar general problems, this code s…

Convert a bit to Base64 character

I need to convert a binary String (“110100”, 52 in decimal) to its corresponding Base64 character, that I know is “0”. Is any way in Java to do that? I was reading multiple base 64 guides but I cant reach the answer. For clarification, the conversion table is here: https://www.lifewire…

Jackson encode all properties to base64

I have more than one class that I want to serialize using Jackson to generate Json, for example I need to encode all value of the json to base64, so I configure the object mapper like this The problem is it’s only encode the String type as the serializer only accept one type, is there any method to enco…