Android AES Encrypt encryptBase64(byte[] source)

Here you can find the source of encryptBase64(byte[] source)

Description

encrypt Base

Declaration

public static String encryptBase64(byte[] source) throws Throwable 

Method Source Code

//package com.java2s;
import javax.crypto.Cipher;

import android.util.Base64;

public class Main {
    private static Cipher encryptCipher;

    public static String encryptBase64(byte[] source) throws Throwable {
        if (source == null || source.length < 1) {
            return null;
        }// w  w  w  .ja va2  s  .  c  om

        byte[] encrypted = encryptCipher.doFinal(source);
        return Base64.encodeToString(encrypted, Base64.NO_WRAP);
    }
}

Related

  1. encrypt(byte[] raw, byte[] clear)
  2. encrypt(byte[] raw, byte[] clear)
  3. encrypt(byte[] raw, byte[] clear)
  4. encrypt(byte[] source)
  5. encryptBase64(String content, String key)
  6. encryptBytes(String seed, byte[] cleartext)
  7. encryptBytes(byte[] data, byte[] key)
  8. encryptHex(String content, String key)
  9. encryptHex(String content, String username, String password)