public static byte[] base64ToBytes(String base64) throws IllegalArgumentException {
  if (base64 == null) {
    return null;
  }
  try {
    return Base64.decode(base64,Base64.NO_WRAP);
  }
 catch (  IllegalArgumentException e) {
    log.error("Returning null on attempt to decode badly formed base64 string: " + base64);
    return null;
  }
}

public static byte [ ] base64ToBytes ( String base64 ) throws IllegalArgumentException { if ( base64 == null ) { return null ; } try { return Base64 . decode ( base64 , Base64 . NO_WRAP ) ; } catch ( IllegalArgumentException e ) { log . error ( "Returning null on attempt to decode badly formed base64 string: " + base64 ) ; return null ; } }
encode a byte array as a base64 string . this method should be used to convert from strings stored by friendstore to byte [ ] s accepted by crypto . java .
