Mr_hEx

HTB Mobile challenge APKrypt

Mar 20th, 2024 (edited)
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. // Telegram : @HTB0X
  2. import java.util.Base64;
  3. import javax.crypto.Cipher;
  4. import javax.crypto.spec.SecretKeySpec;
  5. import java.security.Key;
  6.  
  7. public class HelloWorld {
  8.    
  9.     public static String decrypt(String str) throws Exception {
  10.         Key generateKey = generateKey();
  11.         Cipher cipher = Cipher.getInstance("AES");
  12.         cipher.init(Cipher.DECRYPT_MODE, generateKey);
  13.         byte[] decodedBytes = Base64.getDecoder().decode(str);
  14.         return new String(cipher.doFinal(decodedBytes), "UTF-8");
  15.     }
  16.  
  17.     public static Key generateKey() throws Exception {
  18.         return new SecretKeySpec("Dgu8Trf6Ge4Ki9Lb".getBytes(), "AES");
  19.     }
  20.  
  21.     public static void main(String[] args) {
  22.         try {
  23.             System.out.println(decrypt("k+RLD5J86JRYnluaZLF3Zs/yJrVdVfGo1CQy5k0+tCZDJZTozBWPn2lExQYDHH1l"));
  24.         } catch (Exception e) {
  25.             System.out.println('Something went wrong !!');
  26.         }
  27.     }
  28. }
Add Comment
Please, Sign In to add comment