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:Main.java

static byte[] decodeIdentifier(String identifier) {
    return Base64.decodeBase64(identifier.getBytes());
}

From source file:net.orpiske.tcs.service.core.utils.TextUtils.java

public static String getDecompressedText(Text text) throws IOException {
    String encodedText = text.getEncodedText();
    byte[] encodedBytes = Base64.decodeBase64(encodedText);

    return Decompressor.decompress(encodedBytes);
}

From source file:com.amazon.ion.plugin.intellij.helpers.ContentCorrectnessHelper.java

/**
 * Validate Base64 value for BLOB data type
 *
 * @param text Input value//from   w w  w  . j av a 2 s . c o  m
 * @return true if the value is a valid base64 encoded blob
 */
public static boolean isValidBase64(CharSequence text) {
    final String input = text.toString();
    final String decoded = new String(Base64.decodeBase64(input));
    final String encoded = Base64.encodeBase64String(decoded.getBytes());
    return encoded.equals(input);
}

From source file:Main.java

public static byte[] fromBase64String(String base64String) {
    //        return Base64.decode(base64String,Base64.DEFAULT);
    return Base64.decodeBase64(base64String);
}

From source file:com.laudandjolynn.avf.utils.SecurityCoder.java

/**
 * base64?
 * 
 * @param data
 * @return
 */
public static byte[] base64Decoder(String data) {
    return Base64.decodeBase64(data);
}

From source file:com.hurence.logisland.util.string.BinaryEncodingUtils.java

public static byte[] decode(String content) {
    return Base64.decodeBase64(content);
}

From source file:com.hangum.tadpole.commons.libs.core.utils.Base64Utils.java

/**
 * decode base64 util/*from  ww  w. j a  v  a  2s . c om*/
 * @param str
 * @return
 */
public static String base64Decode(String str) {
    byte[] decodedBytes = Base64.decodeBase64(str.getBytes());

    return new String(decodedBytes);
}

From source file:com.ad.mediasharing.tvmclient.AESEncryption.java

public static String unwrap(String cipherText, String key) throws Exception {
    byte[] dataToDecrypt = Base64.decodeBase64(cipherText.getBytes());
    byte[] iv = new byte[16];
    byte[] data = new byte[dataToDecrypt.length - 16];

    System.arraycopy(dataToDecrypt, 0, iv, 0, 16);
    System.arraycopy(dataToDecrypt, 16, data, 0, dataToDecrypt.length - 16);

    byte[] plainText = decrypt(data, key, iv);
    return new String(plainText);
}

From source file:com.amazonaws.cognito.sync.demo.client.server.AESEncryption.java

public static String unwrap(String cipherText, String key) throws Exception {
    byte[] dataToDecrypt = Base64.decodeBase64(cipherText.getBytes());
    byte[] initializationVector = new byte[16];
    byte[] data = new byte[dataToDecrypt.length - 16];

    System.arraycopy(dataToDecrypt, 0, initializationVector, 0, 16);
    System.arraycopy(dataToDecrypt, 16, data, 0, dataToDecrypt.length - 16);

    byte[] plainText = decrypt(data, key, initializationVector);
    return new String(plainText);
}

From source file:com.sds.acube.ndisc.xnapi.XNApiDesCipher.java

/**
 * //  w ww  .  j  a v  a  2 s  .co  m
 * 
 * @param data  ?
 * @return  ?
 */
public static String decrypt(String data) {
    try {
        Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
        cipher.init(Cipher.DECRYPT_MODE, getKey());
        byte d[] = cipher.doFinal(Base64.decodeBase64(data.getBytes()));
        return new String(d);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}