# aiysss/iapp-decrypt architecture

> Architecture diagram of the GitHub repository aiysss/iapp-decrypt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aiysss/iapp-decrypt
- Repository: https://github.com/aiysss/iapp-decrypt

## Overview

This is a Python HTTP service for decrypting iApp v3 APK source, extracting APK/library parameters, repairing dynamic encryption, and handling large uploads. The main workflow is a client sending an APK or lib.so and decryption parameters to the HTTP API, which dispatches work to extraction, decryption, or repair services and returns source or a downloadable archive. The README documents additional cache, upload, and web-documentation capabilities. Several handler and service excerpts are incomplete, so uncertain dispatch links are dashed rather than asserted as verified calls.

Main entry points: [`server/handler.py`](https://github.com/aiysss/iapp-decrypt/blob/main/server/handler.py) (HTTP handler), [`services/decrypt.py`](https://github.com/aiysss/iapp-decrypt/blob/main/services/decrypt.py) (Source decryption), [`algorithms/common.py`](https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/common.py) (Decrypt orchestration), [`algorithms/factory.py`](https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/factory.py) (Algorithm selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP service"]
  node_entry["Server entry<br/>[main.py]"]
  node_router["HTTP handler<br/>[handler.py]"]
  node_logging["Request logging<br/>[log.py]"]
end

subgraph group_workflows["Product workflows"]
  node_extract["APK extraction<br/>[apk_extract.py]"]
  node_decrypt["Source decryption<br/>[decrypt.py]"]
  node_repair["Dynamic repair<br/>[repair.py]"]
  node_upload["Chunked upload<br/>[upload.py]"]
  node_cache[("Result cache<br/>[cache.py]")]
end

subgraph group_crypto["Decryption engine"]
  node_common["Decrypt orchestration<br/>[common.py]"]
  node_factory["Algorithm selection<br/>[factory.py]"]
  node_current["Current algorithm<br/>[current.py]"]
  node_legacy["Legacy algorithm<br/>[legacy4.py]"]
  node_transitional["Transitional algorithm<br/>[transitional.py]"]
  node_elf["ELF analysis<br/>[elf.py]"]
  node_aes["AES utilities<br/>[aes.py]"]
  node_slky["SLKY derivation<br/>[slky.py]"]
end

subgraph group_web["Web interface"]
  node_webclient["Web interface<br/>[index.html]"]
  node_docs["API documentation<br/>[docs.html]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_entry
node_entry -->|"starts handler"| node_router
node_router -.->|"dispatches extraction"| node_extract
node_router -.->|"dispatches decryption"| node_decrypt
node_router -.->|"dispatches repair"| node_repair
node_router -.->|"dispatches uploads"| node_upload
node_router -.->|"checks cache"| node_cache
node_router -.->|"records requests"| node_logging
node_decrypt -.->|"uses orchestration"| node_common
node_decrypt -.->|"selects algorithm"| node_factory
node_factory -.->|"selects family"| node_current
node_factory -.->|"selects family"| node_transitional
node_decrypt -.->|"supports legacy"| node_legacy
node_common -->|"derives markers"| node_slky
node_common -->|"decrypts members"| node_aes
node_current -->|"derives keys"| node_slky
node_transitional -->|"decrypts container"| node_aes
node_transitional -->|"derives keys"| node_slky
node_router -.->|"serves interface"| node_webclient
node_router -.->|"serves documentation"| node_docs

click node_entry "https://github.com/aiysss/iapp-decrypt/blob/main/main.py"
click node_router "https://github.com/aiysss/iapp-decrypt/blob/main/server/handler.py"
click node_extract "https://github.com/aiysss/iapp-decrypt/blob/main/services/apk_extract.py"
click node_decrypt "https://github.com/aiysss/iapp-decrypt/blob/main/services/decrypt.py"
click node_repair "https://github.com/aiysss/iapp-decrypt/blob/main/services/repair.py"
click node_upload "https://github.com/aiysss/iapp-decrypt/blob/main/services/upload.py"
click node_cache "https://github.com/aiysss/iapp-decrypt/blob/main/services/cache.py"
click node_logging "https://github.com/aiysss/iapp-decrypt/blob/main/services/log.py"
click node_common "https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/common.py"
click node_factory "https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/factory.py"
click node_current "https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/current.py"
click node_legacy "https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/legacy4.py"
click node_transitional "https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/transitional.py"
click node_elf "https://github.com/aiysss/iapp-decrypt/blob/main/crypto/elf.py"
click node_aes "https://github.com/aiysss/iapp-decrypt/blob/main/crypto/aes.py"
click node_slky "https://github.com/aiysss/iapp-decrypt/blob/main/crypto/slky.py"
click node_webclient "https://github.com/aiysss/iapp-decrypt/blob/main/temp/index.html"
click node_docs "https://github.com/aiysss/iapp-decrypt/blob/main/temp/docs.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_router,node_logging,node_client toneBlue
class node_extract,node_decrypt,node_repair,node_upload,node_cache toneAmber
class node_common,node_factory,node_current,node_legacy,node_transitional,node_elf,node_aes,node_slky toneMint
class node_webclient,node_docs toneRose
```

## Components

### HTTP service

- [Server entry](https://github.com/aiysss/iapp-decrypt/blob/main/main.py): `main.py`
- [HTTP handler](https://github.com/aiysss/iapp-decrypt/blob/main/server/handler.py): `server/handler.py`
- [Request logging](https://github.com/aiysss/iapp-decrypt/blob/main/services/log.py): `services/log.py`

### Product workflows

- [APK extraction](https://github.com/aiysss/iapp-decrypt/blob/main/services/apk_extract.py): `services/apk_extract.py`
- [Source decryption](https://github.com/aiysss/iapp-decrypt/blob/main/services/decrypt.py): `services/decrypt.py`
- [Dynamic repair](https://github.com/aiysss/iapp-decrypt/blob/main/services/repair.py): `services/repair.py`
- [Chunked upload](https://github.com/aiysss/iapp-decrypt/blob/main/services/upload.py): `services/upload.py`
- [Result cache](https://github.com/aiysss/iapp-decrypt/blob/main/services/cache.py): `services/cache.py`

### Decryption engine

- [Decrypt orchestration](https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/common.py): `algorithms/common.py`
- [Algorithm selection](https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/factory.py): `algorithms/factory.py`
- [Current algorithm](https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/current.py): `algorithms/current.py`
- [Legacy algorithm](https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/legacy4.py): `algorithms/legacy4.py`
- [Transitional algorithm](https://github.com/aiysss/iapp-decrypt/blob/main/algorithms/transitional.py): `algorithms/transitional.py`
- [ELF analysis](https://github.com/aiysss/iapp-decrypt/blob/main/crypto/elf.py): `crypto/elf.py`
- [AES utilities](https://github.com/aiysss/iapp-decrypt/blob/main/crypto/aes.py): `crypto/aes.py`
- [SLKY derivation](https://github.com/aiysss/iapp-decrypt/blob/main/crypto/slky.py): `crypto/slky.py`

### Web interface

- [Web interface](https://github.com/aiysss/iapp-decrypt/blob/main/temp/index.html): `temp/index.html`
- [API documentation](https://github.com/aiysss/iapp-decrypt/blob/main/temp/docs.html): `temp/docs.html`

### Other components

- **API client**

## Connections

- API client → Server entry: sends requests (evidence: `README.md`)
- Server entry → HTTP handler: starts handler (evidence: `main.py`)
- HTTP handler → APK extraction: dispatches extraction (evidence: `server/handler.py`)
- HTTP handler → Source decryption: dispatches decryption (evidence: `server/handler.py`)
- HTTP handler → Dynamic repair: dispatches repair (evidence: `server/handler.py`)
- HTTP handler → Chunked upload: dispatches uploads (evidence: `server/handler.py`)
- HTTP handler → Result cache: checks cache (evidence: `server/handler.py`)
- HTTP handler → Request logging: records requests (evidence: `server/handler.py`)
- Source decryption → Decrypt orchestration: uses orchestration (evidence: `services/decrypt.py`)
- Source decryption → Algorithm selection: selects algorithm (evidence: `services/decrypt.py`)
- Algorithm selection → Current algorithm: selects family (evidence: `algorithms/factory.py`)
- Algorithm selection → Transitional algorithm: selects family (evidence: `algorithms/factory.py`)
- Source decryption → Legacy algorithm: supports legacy (evidence: `services/decrypt.py`)
- Decrypt orchestration → SLKY derivation: derives markers (evidence: `algorithms/common.py`)
- Decrypt orchestration → AES utilities: decrypts members (evidence: `algorithms/common.py`)
- Current algorithm → SLKY derivation: derives keys (evidence: `algorithms/current.py`)
- Transitional algorithm → AES utilities: decrypts container (evidence: `algorithms/transitional.py`)
- Transitional algorithm → SLKY derivation: derives keys (evidence: `algorithms/transitional.py`)
- HTTP handler → Web interface: serves interface
- HTTP handler → API documentation: serves documentation
