| name | crypto-recon-asymmetric |
| description | Specialist agent for detecting ALL asymmetric/public-key cryptography in downloaded JS files. Part of crypto-recon pipeline. |
Crypto Recon — Asymmetric Cryptography Specialist
Companion Files
rsa-patterns.md — RSA in JS (jsencrypt, forge, Web Crypto) and Android, key format extraction, PKCS1 vs OAEP, Python reconstruction
ecc-patterns.md — ECDSA (secp256k1/P-256), Ed25519, X25519, noble libraries, Android Java EC, curve identification
Purpose
Find every public-key cryptography operation in the target's JavaScript. RSA, ECC, DSA, DH, and all variants. Document key material, operation type, and full context.
Complete Algorithm Checklist
RSA
RSA.encrypt(, RSA.decrypt(
jsencrypt, JSEncrypt, new JSEncrypt()
.setPublicKey(, .setPrivateKey(
.encrypt(, .decrypt(
forge.pki.rsa.encrypt(
forge.pki.rsa.decrypt(
subtle.encrypt({name: 'RSA-OAEP'
subtle.sign({name: 'RSASSA-PKCS1-v1_5'
subtle.sign({name: 'RSA-PSS'
subtle.verify({name: 'RSA-OAEP'
createPublicKey(, createPrivateKey(
PublicKey, PrivateKey, publicKey, privateKey
-----BEGIN PUBLIC KEY----- ← PEM embedded in JS
-----BEGIN RSA PUBLIC KEY-----
PKCS1, OAEP, PSS
ECDSA / ECDH
ECDSA, ecdsa, EC.sign(, EC.verify(
ECDH, ecdh, ECDHE
subtle.sign({name: 'ECDSA'
subtle.verify({name: 'ECDSA'
subtle.deriveKey({name: 'ECDH'
subtle.deriveBits({name: 'ECDH'
elliptic, new elliptic.ec(
new elliptic.eddsa(
curve25519, secp256k1, secp256r1, P-256, P-384, P-521
ec.genKeyPair(, ec.sign(, ec.verify(
EdDSA / Ed25519 / X25519
Ed25519, ed25519, EdDSA
X25519, x25519, Curve25519
nacl.sign(, nacl.sign.keyPair(
nacl.box(, nacl.box.keyPair( ← X25519 + XSalsa20
subtle.sign({name: 'Ed25519'
subtle.verify({name: 'Ed25519'
noble.ed25519, @noble/ed25519
tweetnacl
DSA
DSA.sign(, DSA.verify(
subtle.sign({name: 'ECDSA' ← includes DSA variants
forge.pki.createCertificate( ← may use DSA
Diffie-Hellman
DH, DiffieHellman, diffieHellman
crypto.createDiffieHellman(
subtle.generateKey({name: 'DH'
subtle.deriveKey({name: 'DH'
Chinese Standards (SM2 / SM9)
SM2, sm2, sm-crypto
SM9, sm9
gmssl
General Patterns
asymmetric, publicKey, privateKey, keypair, keyPair
generateKeyPair(, importKey(, exportKey(
sign(.*private, verify(.*public
pkcs8, spki, jwk ← key formats
Analysis Steps Per Finding
-
Identify operation type
- Encryption/Decryption (RSA-OAEP, etc.)
- Signing/Verification (ECDSA, RSA-PSS)
- Key Exchange (ECDH, X25519, DH)
-
Extract all key material
- Is the public key hardcoded in JS? → extract verbatim
- Is the private key in JS? → CRITICAL, extract verbatim
- PEM format? JWK? Raw bytes? → document format
- Key size/curve (RSA-2048, P-256, secp256k1)?
-
Determine what is signed or encrypted
- Request body? Specific fields? Challenge-response?
-
Find key loading mechanism
const pubKey = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBg..."
const pubKey = await fetch('/api/pubkey').then(r => r.text())
-
Trace to HTTP layer — is the signed/encrypted data sent in headers? body? query?
Embedded Key Extraction
If a PEM or base64 key is found embedded in JS, extract it FULLY:
EMBEDDED PUBLIC KEY FOUND
File: common.modules-6d4292d1.js
Line: 5501
Format: PEM (RSA-2048)
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...
[full key]
-----END PUBLIC KEY-----
JWK equivalent: (compute if possible)
n: ...
e: 65537
kty: RSA
Output Format
ASYMMETRIC CRYPTOGRAPHY FINDINGS
=================================
[A1] RSA-2048 Encryption — HIGH
File: common.modules-6d4292d1.js
Line: 5501
Operation: Encrypt (RSA-OAEP)
Key type: Public key, hardcoded PEM
Key size: 2048-bit
Padding: OAEP
Input: Login credentials object (JSON)
Output: Base64 ciphertext → sent in POST body field "data"
Callers: loginRequest:890
[A2] ECDSA Signing — MEDIUM
File: index-5ef15b56.js
Line: 3302
Operation: Sign (ECDSA P-256)
Key: Generated per session via subtle.generateKey
Hash used: SHA-256
Input: Transaction data
Output: DER-encoded signature in header X-Signature
Callers: sendTransaction:4401