Example usage for org.apache.commons.codec.binary Base64 decodeBase64

List of usage examples for org.apache.commons.codec.binary Base64 decodeBase64

Introduction

In this page you can find the example usage for org.apache.commons.codec.binary Base64 decodeBase64.

Prototype

public static byte[] decodeBase64(final byte[] base64Data) 

Source Link

Document

Decodes Base64 data into octets

Usage

From source file:com.jk.db.dataaccess.orm.eclipselink.FSSessionPCustomizer.java

/**
 * Decode.//from w  w  w.j  a  va 2 s.co m
 *
 * @param name
 *            the name
 * @return the string
 */
public static String decode(String name) {
    return new String(Base64.decodeBase64(name));
}

From source file:aiai.apps.commons.utils.SecUtils.java

public static PublicKey getPublicKey(String keyBase64)
        throws NoSuchAlgorithmException, InvalidKeySpecException {
    byte[] keyBytes = Base64.decodeBase64(keyBase64);
    X509EncodedKeySpec spec = new X509EncodedKeySpec(keyBytes);
    KeyFactory kf = KeyFactory.getInstance("RSA");
    return kf.generatePublic(spec);
}

From source file:jp.go.nict.langrid.commons.ws.util.Base64Util.java

/**
 * 
 * 
 */
public static byte[] decode(byte[] src) {
    return Base64.decodeBase64(src);
}

From source file:com.credomatic.gprod.db2query2csv.Security.java

/**
 *  Decodifica un arreglo de byes y lo convierte en una cadena de carateres.
 * @param value areglo de bytes a ser decodificado
 * @return cadena de carateres resultado de la decodificacion
 *///from w w w .j ava 2s . c  om
public static String dencodeFromBase64(final byte[] value) {
    try {
        return new String(Base64.decodeBase64(value), "ISO-8859-1");
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(Security.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:com.vmware.o11n.plugin.crypto.service.CryptoDigestService.java

public String md5Base64(String dataB64) {
    validateB64(dataB64);
    return Base64.encodeBase64String(DigestUtils.md5(Base64.decodeBase64(dataB64)));
}

From source file:com.envision.envservice.common.util.Base64Utils.java

/**
 * Base64 decode//from w w w . j a v  a2 s  .c  o  m
 */
public static String decode(String str) throws IOException {
    if (str == null) {
        throw new IllegalArgumentException("Null.");
    }

    return new String(Base64.decodeBase64(str));
}

From source file:com.dv.meetmefor.ws.controller.BinaryDataContoller.java

public String upload(String encodedData) {
    byte[] data = Base64.decodeBase64(encodedData);
    Response<Integer> response = new Response();
    BinaryData binaryData = new BinaryData();
    binaryData.setData(data);/*from   ww  w.j a v a2s . c o m*/
    binaryData = binaryDataDao.create(binaryData);
    response.setPayload(binaryData.getId_value().toString());
    response.setResponseType(Response.ResponseType.Info);
    return response.toJson();
}

From source file:net.duckling.ddl.util.Utility.java

public static String getFromBASE64(String s) {
    if (s == null) {
        return null;
    }/*  w  w w  .j a  v  a2  s.c  om*/
    try {
        return new String(Base64.decodeBase64(s.getBytes()));
    } catch (Exception e) {
        return null;
    }
}

From source file:com.comichentai.serialize.SerializeUtil.java

public static <T> T decodeObject(String base64, Class<T> clazz) {
    byte[] zipped = Base64.decodeBase64(base64.getBytes());
    byte[] unzipped = CompressUtil.unzip(zipped);
    return deserialize(unzipped, clazz);
}

From source file:librarymanagementsystem.Base64Converter.java

public static void decode(String sourceFile, String targetFile) throws Exception {

    byte[] decodedBytes = Base64.decodeBase64(loadFileAsBytesArray(sourceFile));

    writeByteArraysToFile(targetFile, decodedBytes);
}