Skip to content

Instantly share code, notes, and snippets.

@toanalien
Created June 26, 2016 02:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toanalien/9f08fca217fe17b544038bb8de4ebd70 to your computer and use it in GitHub Desktop.
Save toanalien/9f08fca217fe17b544038bb8de4ebd70 to your computer and use it in GitHub Desktop.
debug encryption
/*
* Decompiled with CFR 0_110.
*
* Could not load the following classes:
* android.util.Base64
* java.lang.Exception
* java.lang.Object
* java.lang.String
* java.security.Key
* java.security.spec.AlgorithmParameterSpec
* javax.crypto.Cipher
* javax.crypto.spec.IvParameterSpec
* javax.crypto.spec.SecretKeySpec
*/
package com.kpi.megalibrary.encryption;
import android.util.Base64;
import java.security.Key;
import java.security.spec.AlgorithmParameterSpec;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class Encryptor {
static String iV;
static String key;
static {
key = "@kPi#!2016&*Fe9^";
iV = "@kPi#!2016&*Fe9^";
}
public static String decrypt(String string2) {
try {
IvParameterSpec ivParameterSpec = new IvParameterSpec(iV.getBytes("UTF-8"));
// output1: ivParameterSpec
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
// output2: secretKeySpec
Cipher cipher = Cipher.getInstance((String)"AES/CBC/PKCS5PADDING");
// output3: cipher
cipher.init(2, (Key)secretKeySpec, (AlgorithmParameterSpec)ivParameterSpec);
// output4: cipher
String string3 = new String(cipher.doFinal(Base64.decode((byte[])string2.getBytes(), (int)2)));
// output5: string3
return string3;
}
catch (Exception var3_5) {
var3_5.printStackTrace();
return null;
}
}
public static String encrypt(String string2) {
try {
IvParameterSpec ivParameterSpec = new IvParameterSpec(iV.getBytes("UTF-8"));
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance((String)"AES/CBC/PKCS5PADDING");
cipher.init(1, (Key)secretKeySpec, (AlgorithmParameterSpec)ivParameterSpec);
String string3 = new String(Base64.encode((byte[])cipher.doFinal(string2.getBytes()), (int)2));
return string3;
}
catch (Exception var3_5) {
var3_5.printStackTrace();
return null;
}
}
}
// input: nZwWQR63Juh2VT0otVm292ijNWeAw5QU6MPmx1Mt1Sc=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment