Re android crypto

From dslsdzc/rev-skills · View interactive version

Re android crypto is an AI agent skill from the GitHub repository dslsdzc/rev-skills. Android 加密体系审计(crypto audit):AndroidKeyStore 密钥体系分析(别名/算法/用途/硬件背书)、 Cipher/KeyInfo 审计、加密调用点 hook(Frida 拦截密钥别名与用途)。 触发词:Keystore、AndroidKeyStore、Cipher、KeyInfo、StrongBox、加密审计、crypto hook、密钥别名。

How to use this skill

Skill file

Android 加密体系审计(crypto audit)

任务分类器(intent → 路径)

| 用户目的 | 路径 |

|---|---|

| 密钥来自 AndroidKeyStore / 硬件背书密钥 | → Keystore 审计(步骤 1) |

| 定位加密调用点 / 拦截密文与明文 | → crypto hook(步骤 2) |

| 分析第三方加密库(BoringSSL / OpenSSL / Tink / libsodium 等) | → 库分析(步骤 3) |

何时使用 / 何时不用

工具准备

所有工具先验证再使用。动态 hook 默认沙箱([[re-analyze/platform-tips]] 最高原则);静态审计可免沙箱。

frida([[re-frida]])—— crypto hook 主力

python3 / jadx —— 静态定位加密调用点

设备侧命令([[re-apk]] adb 章节)

操作步骤

  1. Keystore 审计(AndroidKeyStore 密钥体系):

```java

// 应用进程内枚举(frida 注入或 jadx 反编译定位调用点)

KeyStore ks = KeyStore.getInstance("AndroidKeyStore");

ks.load(null);

java.util.Enumeration<String> aliases = ks.aliases();

```

  1. crypto hook(加密调用点拦截):

```js

// frida:拦截加密调用点,记录算法/模式/密钥别名

// 别名来源:Key 对象本身不携带别名(KeyStore 无 getKeyAlias),须在 getKey 处记录

const KeyStore = Java.use('java.security.KeyStore');

KeyStore.getKey.overload('java.lang.String', '[C').implementation = function (alias, password) {

console.log('KeyStore.getKey', alias);

return this.getKey(alias, password);

};

const Cipher = Java.use('javax.crypto.Cipher');

Cipher.init.overload('int', 'java.security.Key', 'java.security.spec.AlgorithmParameterSpec').implementation =

function (opmode, key, params) {

console.log('Cipher.init', opmode, key.getClass().getName(), params); // 对应别名见上方 getKey 输出

return this.init(opmode, key, params);

};

// 另路取回别名:SecretKeyFactory.getInstance(key.getAlgorithm(), 'AndroidKeyStore')

// .getKeySpec(key, KeyInfo.class) → KeyInfo.getKeystoreAlias()

```

  1. 第三方加密库分析(BoringSSL / OpenSSL / Tink / libsodium 等):
  1. 产出与存证:密钥体系图(别名/算法/用途/背书来源)+ 加密调用点清单 + hook 脚本,sha256 存档供 [[re-ioc]] 引用

跨域联合

常见坑与陷阱

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.