Changed from org.apache.commons.codec.binary.Base64 to org.spongycastle.util.encoders.Base64 and added the spongycastle dependency.