Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package giaimathu;
- import java.security.NoSuchAlgorithmException;
- import javax.crypto.Cipher;
- import javax.crypto.NoSuchPaddingException;
- import javax.crypto.spec.IvParameterSpec;
- import javax.crypto.spec.SecretKeySpec;
- public final class at {
- private IvParameterSpec a = new IvParameterSpec(MyApplication.a.getBytes());
- private SecretKeySpec b = new SecretKeySpec(MyApplication.b.getBytes(),
- "AES");
- private Cipher c;
- public at() {
- try {
- this.c = Cipher.getInstance("AES/CBC/NoPadding");
- return;
- } catch (NoSuchAlgorithmException localNoSuchAlgorithmException) {
- localNoSuchAlgorithmException.printStackTrace();
- return;
- } catch (NoSuchPaddingException localNoSuchPaddingException) {
- localNoSuchPaddingException.printStackTrace();
- }
- }
- // private static byte[] b(String paramString) {
- // byte[] arrayOfByte = null;
- // if (paramString == null) {
- // return null;
- // } else {
- // while (true) {
- // int i = paramString.length();
- // arrayOfByte = null;
- // if (i < 2)
- // continue;
- // int j = paramString.length() / 2;
- // arrayOfByte = new byte[j];
- // for (int k = 0; k < j; k++)
- // arrayOfByte[k] = (byte) Integer.parseInt(
- // paramString.substring(k * 2, 2 + k * 2), 16);
- // return arrayOfByte;
- // }
- // }
- // }
- public final byte[] a(String paramString) {
- if ((paramString == null) || (paramString.length() == 0)) {
- return null;
- } else {
- try {
- this.c.init(2, this.b, this.a);
- byte[] arrayOfByte = this.c.doFinal(HexToBytes.fromHexString(paramString));
- return arrayOfByte;
- } catch (Exception localException) {
- return null;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment