android system hack Cipher
来源:互联网 发布:郭艾伦奥运会数据 编辑:程序博客网 时间:2024/06/10 07:20
我们都知道,android系统有个Cipher,用来做加密的,用法大概是这样
public static String encode(String key, byte[] data) { try { Cipher cipher = Cipher.getInstance(TRANSFORMATION); ... cipher.init(...); byte[] bytes = cipher.doFinal(data); return Base64.encodeToString(bytes, Base64.DEFAULT); } catch (Exception e) { return null; }}
很多东西都会走加密存储,那如果我作为一个系统,我想看你加密了什么,怎么办呢?
vi libcore/luni/src/main/java/javax/crypto/Cipher.java
--- a/libcore/luni/src/main/java/javax/crypto/Cipher.java+++ b/libcore/luni/src/main/java/javax/crypto/Cipher.java@@ -39,6 +39,11 @@ import java.util.Set; import org.apache.harmony.crypto.internal.NullCipherSpi; import org.apache.harmony.security.fortress.Engine;+import java.io.BufferedWriter;+import java.io.FileWriter;+import java.io.IOException;+import java.io.PrintWriter;+ /** * This class provides access to implementations of cryptographic ciphers for * encryption and decryption. Cipher classes can not be instantiated directly,@@ -1499,6 +1504,7 @@ public class Cipher { if (mode != ENCRYPT_MODE && mode != DECRYPT_MODE) { throw new IllegalStateException(); }+ print_log(input); return getSpi().engineDoFinal(input, 0, input.length); }@@ -1534,6 +1540,7 @@ public class Cipher { throw new IllegalStateException(); } checkInputOffsetAndCount(input.length, inputOffset, inputLen);+ print_log(input); return getSpi().engineDoFinal(input, inputOffset, inputLen); }@@ -1612,6 +1619,7 @@ public class Cipher { throw new IllegalStateException(); } checkInputOffsetAndCount(input.length, inputOffset, inputLen);+ print_log(input); return getSpi().engineDoFinal(input, inputOffset, inputLen, output, outputOffset); }@@ -1652,6 +1660,7 @@ public class Cipher { if (input == output) { throw new IllegalArgumentException("input == output"); }+ //print_log(input); return getSpi().engineDoFinal(input, output); }@@ -1753,4 +1762,16 @@ public class Cipher { //FIXME jurisdiction policy files return null; }++ public static final void print_log(byte[] input){+ if(input != null){+ try {+ PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("/sdcard/cipher.trace", true)));+ out.println(new String(input, "UTF-8"));+ out.close();+ } catch (IOException e) {+ e.printStackTrace();+ }+ }+ } }
然后
adb shell cat /sdcard/cipher.trace
阅读全文
0 0
- android system hack Cipher
- spark Metrics System hack
- Cipher
- Cipher
- Cipher
- cipher
- Android 加解密类Cipher
- Building SQL CIpher for Android
- 50 Android Hack 读书笔记
- android 基础 加密 加密类Cipher
- Hack Android SD Card support
- Hack Android SD Card support
- 50 Android hacks(hack 1)
- 50 Android Hacks(hack 2)
- 50 Android Hacks(hack 14)
- HACK
- HACK
- hack
- IntelliJ初使用:IntelliJ创建简单的maven项目
- Spring框架之基础类—ScannedGenericBeanDefinition实现类
- a
- KNN和K-means
- Shiro 处理ajax请求 拦截登录超时---解决!
- android system hack Cipher
- mysql中的左连接、内连接、右连接和全连接理解
- ConstraintLayout 技术分享
- 周四见|公开课预告《软件测试,我们在做些什么?》by鸿一
- css弹性盒子
- Delphi10控件Style自定义注意点
- 欢迎使用CSDN-markdown编辑器
- unbuntu+win10双系统时,unbuntu调用win10的硬盘
- 在CentOS 7上安装Tensorflow