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

Sandah Aung picture Sandah Aung · Jan 20, 2014 · Viewed 12.2k times · Source

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?

Answer

Alexander Tokarev picture Alexander Tokarev · Jan 20, 2014

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