# kjyoffice/onefileencryptdecrypt architecture

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

- Interactive diagram: https://gitdiagram.com/kjyoffice/onefileencryptdecrypt
- Repository: https://github.com/kjyoffice/onefileencryptdecrypt

## Overview

OneFileEncryptDecrypt is a .NET command-line tool for encrypting and decrypting individual files. The principal workflow parses an encrypt/decrypt command, builds a work order, then processes the file into or out of a packaged encrypted result; the README documents AES-256 CBC and GCM modes. Supporting layers cover temporary work paths, metadata and integrity checks, cryptographic helpers, file operations, and console progress/messages. The excerpts establish the CLI and parts of the encrypt/decrypt flows; some internal dispatch and algorithm calls are not shown, so those links are omitted or marked unverified.

Main entry points: [`OneFileEncryptDecrypt/Program.cs`](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/Program.cs) (Program entry), [`OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs`](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs) (Encrypt processing), [`OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs`](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs) (Decrypt processing), [`OneFileEncryptDecrypt/XWork/DecryptWork.cs`](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/DecryptWork.cs) (Decrypt workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_program["Program entry<br/>[Program.cs]"]
  node_command["Command options<br/>[CryptoCommand.cs]"]
end

subgraph group_workflow["File workflows"]
  node_encrypt["Encrypt workflow<br/>[EncryptWork.cs]"]
  node_encryptaes["Encrypt processing"]
  node_decrypt["Decrypt workflow<br/>[DecryptWork.cs]"]
  node_decryptaes["Decrypt processing"]
end

subgraph group_crypto["Cryptography"]
  node_keys["Key derivation<br/>[CryptoKeySet.cs]"]
  node_hash["Hash and HMAC<br/>[HashWork.cs]"]
  node_cbc["AES CBC<br/>[AES256CBC.cs]"]
  node_gcm["AES GCM<br/>[AES256GCM.cs]"]
end

subgraph group_support["Data and support"]
  node_settings["App settings<br/>[AppSettingsX.cs]"]
  node_messages["Localized messages<br/>[WorkMessageSet.cs]"]
  node_console["Console output"]
  node_order["Crypto work order<br/>[CryptoWorkOrder.cs]"]
  node_paths["Work file paths<br/>[CryptoXFilePath.cs]"]
  node_records["Crypto records"]
  node_json["JSON conversion<br/>[JsonWork.cs]"]
  node_filework["File operations<br/>[FileWork.cs]"]
  node_values["Crypto constants<br/>[ProcessValue.cs]"]
  node_progress["Progress tracking<br/>[ProgressViewer.cs]"]
end

node_user(("CLI user"))

node_user -->|"runs"| node_program
node_program -->|"creates"| node_settings
node_program -->|"creates"| node_console
node_program -->|"registers"| node_command
node_program -->|"dispatches encrypt"| node_encrypt
node_program -->|"dispatches decrypt"| node_decrypt
node_command -->|"builds order"| node_order
node_command -->|"validates with"| node_settings
node_settings -->|"creates"| node_messages
node_settings -->|"creates work paths"| node_paths
node_settings -->|"reads constants"| node_values
node_encrypt -.->|"delegates to"| node_encryptaes
node_decrypt -->|"extracts archive"| node_filework
node_decrypt -->|"loads metadata via"| node_json
node_decrypt -->|"checks metadata"| node_records
node_decrypt -->|"dispatches mode"| node_decryptaes
node_encryptaes -->|"reads and packages"| node_filework
node_encryptaes -->|"derives keys"| node_keys
node_encryptaes -->|"computes HMAC"| node_hash
node_encryptaes -->|"writes metadata"| node_json
node_encryptaes -->|"uses work paths"| node_paths
node_decryptaes -->|"derives keys"| node_keys
node_decryptaes -->|"checks integrity"| node_hash
node_decryptaes -->|"reads and writes"| node_filework
node_decryptaes -->|"uses work paths"| node_paths
node_decryptaes -->|"reads metadata"| node_records
node_keys -->|"uses password order"| node_order
node_filework -->|"updates progress"| node_progress
node_cbc -->|"updates progress"| node_progress
node_gcm -->|"updates progress"| node_progress
node_hash -->|"updates progress"| node_progress
node_console -.->|"formats messages"| node_messages

click node_program "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/Program.cs"
click node_command "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCommand/CryptoCommand.cs"
click node_settings "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XAppSettings/AppSettingsX.cs"
click node_messages "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XMessage/WorkMessageSet.cs"
click node_console "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XConsole/ConsoleWriteMessageSet.cs"
click node_encrypt "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/EncryptWork.cs"
click node_encryptaes "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs"
click node_decrypt "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/DecryptWork.cs"
click node_decryptaes "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs"
click node_order "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XModel/CryptoWorkOrder.cs"
click node_paths "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XModel/CryptoXFilePath.cs"
click node_records "https://github.com/kjyoffice/onefileencryptdecrypt/tree/main/OneFileEncryptDecrypt/XModel"
click node_json "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/JsonWork.cs"
click node_filework "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/FileWork.cs"
click node_keys "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCrypto/CryptoKeySet.cs"
click node_hash "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCrypto/HashWork.cs"
click node_cbc "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCrypto/AES256CBC.cs"
click node_gcm "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCrypto/AES256GCM.cs"
click node_values "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XValue/ProcessValue.cs"
click node_progress "https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XModel/ProgressViewer.cs"

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_program,node_command,node_user toneBlue
class node_encrypt,node_encryptaes,node_decrypt,node_decryptaes toneAmber
class node_keys,node_hash,node_cbc,node_gcm toneMint
class node_settings,node_messages,node_console,node_order,node_paths,node_records,node_json,node_filework,node_values,node_progress toneRose
```

## Components

### Command line

- [Program entry](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/Program.cs): `OneFileEncryptDecrypt/Program.cs`
- [Command options](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCommand/CryptoCommand.cs): `OneFileEncryptDecrypt/XCommand/CryptoCommand.cs`

### File workflows

- [Encrypt workflow](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/EncryptWork.cs): `OneFileEncryptDecrypt/XWork/EncryptWork.cs`
- [Encrypt processing](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs): `OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs`
- [Decrypt workflow](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/DecryptWork.cs): `OneFileEncryptDecrypt/XWork/DecryptWork.cs`
- [Decrypt processing](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs): `OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs`

### Cryptography

- [Key derivation](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCrypto/CryptoKeySet.cs): `OneFileEncryptDecrypt/XCrypto/CryptoKeySet.cs`
- [Hash and HMAC](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCrypto/HashWork.cs): `OneFileEncryptDecrypt/XCrypto/HashWork.cs`
- [AES CBC](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCrypto/AES256CBC.cs): `OneFileEncryptDecrypt/XCrypto/AES256CBC.cs`
- [AES GCM](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XCrypto/AES256GCM.cs): `OneFileEncryptDecrypt/XCrypto/AES256GCM.cs`

### Data and support

- [App settings](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XAppSettings/AppSettingsX.cs): `OneFileEncryptDecrypt/XAppSettings/AppSettingsX.cs`
- [Localized messages](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XMessage/WorkMessageSet.cs): `OneFileEncryptDecrypt/XMessage/WorkMessageSet.cs`
- [Console output](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XConsole/ConsoleWriteMessageSet.cs): `OneFileEncryptDecrypt/XConsole/ConsoleWriteMessageSet.cs`
- [Crypto work order](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XModel/CryptoWorkOrder.cs): `OneFileEncryptDecrypt/XModel/CryptoWorkOrder.cs`
- [Work file paths](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XModel/CryptoXFilePath.cs): `OneFileEncryptDecrypt/XModel/CryptoXFilePath.cs`
- [Crypto records](https://github.com/kjyoffice/onefileencryptdecrypt/tree/main/OneFileEncryptDecrypt/XModel): `OneFileEncryptDecrypt/XModel`
- [JSON conversion](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/JsonWork.cs): `OneFileEncryptDecrypt/XWork/JsonWork.cs`
- [File operations](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XWork/FileWork.cs): `OneFileEncryptDecrypt/XWork/FileWork.cs`
- [Crypto constants](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XValue/ProcessValue.cs): `OneFileEncryptDecrypt/XValue/ProcessValue.cs`
- [Progress tracking](https://github.com/kjyoffice/onefileencryptdecrypt/blob/main/OneFileEncryptDecrypt/XModel/ProgressViewer.cs): `OneFileEncryptDecrypt/XModel/ProgressViewer.cs`

### Other components

- **CLI user**

## Connections

- CLI user → Program entry: runs (evidence: `README.md`)
- Program entry → App settings: creates (evidence: `OneFileEncryptDecrypt/Program.cs`)
- Program entry → Console output: creates (evidence: `OneFileEncryptDecrypt/Program.cs`)
- Program entry → Command options: registers (evidence: `OneFileEncryptDecrypt/Program.cs`)
- Program entry → Encrypt workflow: dispatches encrypt (evidence: `OneFileEncryptDecrypt/Program.cs`)
- Program entry → Decrypt workflow: dispatches decrypt (evidence: `OneFileEncryptDecrypt/Program.cs`)
- Command options → Crypto work order: builds order (evidence: `OneFileEncryptDecrypt/XCommand/CryptoCommand.cs`)
- Command options → App settings: validates with (evidence: `OneFileEncryptDecrypt/XCommand/CryptoCommand.cs`)
- App settings → Localized messages: creates (evidence: `OneFileEncryptDecrypt/XAppSettings/AppSettingsX.cs`)
- App settings → Work file paths: creates work paths (evidence: `OneFileEncryptDecrypt/XAppSettings/AppSettingsX.cs`)
- App settings → Crypto constants: reads constants (evidence: `OneFileEncryptDecrypt/XAppSettings/AppSettingsX.cs`)
- Encrypt workflow → Encrypt processing: delegates to
- Decrypt workflow → File operations: extracts archive (evidence: `OneFileEncryptDecrypt/XWork/DecryptWork.cs`)
- Decrypt workflow → JSON conversion: loads metadata via (evidence: `OneFileEncryptDecrypt/XWork/DecryptWork.cs`)
- Decrypt workflow → Crypto records: checks metadata (evidence: `OneFileEncryptDecrypt/XWork/DecryptWork.cs`)
- Decrypt workflow → Decrypt processing: dispatches mode (evidence: `OneFileEncryptDecrypt/XWork/DecryptWork.cs`)
- Encrypt processing → File operations: reads and packages (evidence: `OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs`)
- Encrypt processing → Key derivation: derives keys (evidence: `OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs`)
- Encrypt processing → Hash and HMAC: computes HMAC (evidence: `OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs`)
- Encrypt processing → JSON conversion: writes metadata (evidence: `OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs`)
- Encrypt processing → Work file paths: uses work paths (evidence: `OneFileEncryptDecrypt/XWork/EncryptWork_AES256.cs`)
- Decrypt processing → Key derivation: derives keys (evidence: `OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs`)
- Decrypt processing → Hash and HMAC: checks integrity (evidence: `OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs`)
- Decrypt processing → File operations: reads and writes (evidence: `OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs`)
- Decrypt processing → Work file paths: uses work paths (evidence: `OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs`)
- Decrypt processing → Crypto records: reads metadata (evidence: `OneFileEncryptDecrypt/XWork/DecryptWork_AES256.cs`)
- Key derivation → Crypto work order: uses password order (evidence: `OneFileEncryptDecrypt/XCrypto/CryptoKeySet.cs`)
- File operations → Progress tracking: updates progress (evidence: `OneFileEncryptDecrypt/XWork/FileWork.cs`)
- AES CBC → Progress tracking: updates progress (evidence: `OneFileEncryptDecrypt/XCrypto/AES256CBC.cs`)
- AES GCM → Progress tracking: updates progress (evidence: `OneFileEncryptDecrypt/XCrypto/AES256GCM.cs`)
- Hash and HMAC → Progress tracking: updates progress (evidence: `OneFileEncryptDecrypt/XCrypto/HashWork.cs`)
- Console output → Localized messages: formats messages
