Android AES Encrypt encrypt(byte[] raw, byte[] clear)

Here you can find the source of encrypt(byte[] raw, byte[] clear)

Description

encrypt

Declaration

private static byte[] encrypt(byte[] raw, byte[] clear)
            throws Exception 

Method Source Code

//package com.java2s;

import javax.crypto.Cipher;

import javax.crypto.spec.SecretKeySpec;

public class Main {
    private static byte[] encrypt(byte[] raw, byte[] clear)
            throws Exception {
        SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
        Cipher cipher = Cipher.getInstance("AES");
        cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
        byte[] encrypted = cipher.doFinal(clear);
        return encrypted;
    }//from ww w  .  j av a 2 s .co  m
}

Related

  1. encryptToBytes(String key, String src)
  2. encryptUrlEncode(String dataPassword, String cleartext)
  3. encryptWithKey(String key, String src)
  4. crypt(byte[] text, byte[] key, int mode)
  5. aesEncode(String seed, String cleartext)
  6. encrypt(Context context, String text)
  7. encrypt(Context context, String text)
  8. encryptedData(String userkey, String userData)
  9. encryptedPassword(String key, String userData)