|
| 1 | +%% specs/diagrams/decryption.mmd |
| 2 | +%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#F5F5F5'}}}%% |
| 3 | +flowchart TD |
| 4 | + Start([Start]) --> A["Input 'File/Folder'"] |
| 5 | + A --> B{Is it a folder?} |
| 6 | + B -->|Yes| C["Search for file with same name + 'CURRENT_EXT'"] |
| 7 | + C --> D{Does the file exist?} |
| 8 | + D -->|Yes| E["Set 'file_to_decrypt' to the found file"] |
| 9 | + D -->|No| F["Emit 'File Not Found' error"] --> End |
| 10 | + B -->|No| G["Set input file as 'file_to_decrypt'"] |
| 11 | + E --> H |
| 12 | + G --> H{Is a separate IV file provided?} |
| 13 | + H -->|Yes| I["Check legacy format using IV file"] |
| 14 | + H -->|No| J["Check legacy format without IV file"] |
| 15 | + I --> K{Is legacy format detected?} |
| 16 | + J --> K |
| 17 | + K -->|Yes| L["Emit 'Legacy File' error"] --> End |
| 18 | + K -->|No| M["Read 'FILE_HEADER'"] |
| 19 | + M --> N{Does the header match?} |
| 20 | + N -->|No| O["Emit 'Invalid File' error"] --> End |
| 21 | + N -->|Yes| P{Is a recovery key provided?} |
| 22 | + P -->|Yes| Q["Read key from recovery file"] |
| 23 | + P -->|No| R{Is a password provided?} |
| 24 | + R -->|No| S["Emit 'Missing Credentials' error"] --> End |
| 25 | + R -->|Yes| T["Derive key from password"] |
| 26 | + Q --> U |
| 27 | + T --> U["Retrieve IV from file or separate file"] |
| 28 | + U --> V["Verify IV hash"] |
| 29 | + V --> W{Does the hash match?} |
| 30 | + W -->|No| X["Emit 'Integrity Error'"] --> End |
| 31 | + W -->|Yes| Y["Decrypt password check"] |
| 32 | + Y --> Z{Does it match 'PASS_TEXT'?} |
| 33 | + Z -->|No| AA["Emit 'Decryption Error'"] --> End |
| 34 | + Z -->|Yes| AB["Decrypt data with progress reporting"] |
| 35 | + AB --> AC["Create extraction directory"] |
| 36 | + AC --> AD["Write decrypted data"] |
| 37 | + AD --> AE["Verify data hash"] |
| 38 | + AE --> AF{Does the hash match?} |
| 39 | + AF -->|No| AG["Emit 'Data Integrity Warning'"] |
| 40 | + AG --> AH |
| 41 | + AF -->|Yes| AH["Verify 'EOF_MARKER'"] |
| 42 | + AH --> AI{Is the marker present?} |
| 43 | + AI -->|No| AJ["Emit 'File Format Error'"] |
| 44 | + AJ --> AK |
| 45 | + AI -->|Yes| AK{Is it a tar file?} |
| 46 | + AK -->|Yes| AL["Check for 'MARKER_FILE'"] |
| 47 | + AL --> AM{Is the marker present?} |
| 48 | + AM -->|Yes| AN["Extract archive"] |
| 49 | + AN --> AO["Remove marker and tar file"] |
| 50 | + AM -->|No| AK |
| 51 | + AK -->|No| AP |
| 52 | + AO --> AP |
| 53 | + AK --> AP["Perform cleanup operations"] |
| 54 | + AP --> AQ{Should files be removed afterward?} |
| 55 | + AQ -->|Yes| AR["Delete encrypted file and keys"] |
| 56 | + AQ -->|No| AS |
| 57 | + AR --> AS["Emit 'Decryption Successful'"] |
| 58 | + AS --> End([End]) |
| 59 | + |
| 60 | + style Start fill:#4CAF50,stroke:#388E3C |
| 61 | + style End fill:#F44336,stroke:#D32F2F |
| 62 | + style B fill:#64B5F6,stroke:#1976D2 |
| 63 | + style D fill:#64B5F6,stroke:#1976D2 |
| 64 | + style H fill:#64B5F6,stroke:#1976D2 |
| 65 | + style K fill:#64B5F6,stroke:#1976D2 |
| 66 | + style N fill:#64B5F6,stroke:#1976D2 |
| 67 | + style P fill:#64B5F6,stroke:#1976D2 |
| 68 | + style R fill:#64B5F6,stroke:#1976D2 |
| 69 | + style W fill:#64B5F6,stroke:#1976D2 |
| 70 | + style Z fill:#64B5F6,stroke:#1976D2 |
| 71 | + style AF fill:#64B5F6,stroke:#1976D2 |
| 72 | + style AI fill:#64B5F6,stroke:#1976D2 |
| 73 | + style AK fill:#64B5F6,stroke:#1976D2 |
| 74 | + style AM fill:#64B5F6,stroke:#1976D2 |
| 75 | + style AQ fill:#64B5F6,stroke:#1976D2 |
| 76 | + |
0 commit comments