Base64.decode(privateKeyString, Base64.DEFAULT) in Commons Codec

13.8k views Asked by At

Using Android's Base64, it's possible to do this: Base64.decode(privateKeyString, Base64.DEFAULT). If you are using Apache's Commons Codec, this isn't available. How can I achieve the same result using Commons Codec?

2

There are 2 answers

3
Alexander Tokarev On BEST ANSWER

Javadoc for Apache Commons Codec Base64 class can be found here: http://commons.apache.org/proper/commons-codec/archives/1.9/apidocs/org/apache/commons/codec/binary/Base64.html

For your case, you need to use Base64.decodeBase64(String base64String) method

0
perry On

delete the base64 string head.for example,"data:image/png;base64,iVBORw0....",delete the string "data:image/png;base64,".then.it work well. i did it