# eduardoklosowski/rsfn-file architecture

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

- Interactive diagram: https://gitdiagram.com/eduardoklosowski/rsfn-file
- Repository: https://github.com/eduardoklosowski/rsfn-file

## Overview

RSFN File is a command-line tool for inspecting and validating RSFN security headers, and for encrypting or decrypting files. Its principal workflow runs from CLI options through the encryption/decryption actions, which coordinate certificate and key handling, content encoding/compression, cryptography, and the version-3 header. The README also documents standalone header inspection and validation. The sampled excerpts establish the CLI dispatch and core action dependencies; details of some unsampled action internals are represented only where their dependencies are explicit.

Main entry points: [`src/actions.rs`](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/actions.rs) (Encryption workflow), [`src/bin/rsfnfile.rs`](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/bin/rsfnfile.rs) (rsfnfile commands), [`src/header/mod.rs`](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/header/mod.rs) (Security header), [`src/cert.rs`](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/cert.rs) (Certificate handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI"]
  node_cli_app["rsfnfile commands<br/>[rsfnfile.rs]"]
  node_header_inspection["Header inspection<br/>[rsfnfile.rs]"]
  node_encrypt_command["Encrypt command<br/>[rsfnfile.rs]"]
  node_decrypt_command["Decrypt command<br/>[rsfnfile.rs]"]
end

subgraph group_processing["File processing"]
  node_encrypter["Encryption workflow<br/>[actions.rs]"]
  node_decrypter["Decryption workflow<br/>[actions.rs]"]
  node_result_output["Result reporting<br/>[actions.rs]"]
end

subgraph group_format["RSFN format"]
  node_header_load["Header loading<br/>[actions.rs]"]
  node_header["Security header<br/>[mod.rs]"]
  node_header_fields["Header fields<br/>[mod.rs]"]
end

subgraph group_security["Security and content"]
  node_cert_handling["Certificate handling<br/>[cert.rs]"]
  node_cipher_ops["RSA and AES<br/>[mod.rs]"]
  node_compression["Compression<br/>[mod.rs]"]
  node_encoding["Encoding<br/>[mod.rs]"]
end

node_user(("User"))
node_files["Input/output files"]

node_user -->|"selects command"| node_cli_app
node_cli_app -->|"dispatches"| node_header_inspection
node_cli_app -->|"dispatches"| node_encrypt_command
node_cli_app -->|"dispatches"| node_decrypt_command
node_header_inspection -->|"reads file"| node_files
node_header_inspection -->|"loads header"| node_header_load
node_header_inspection -->|"writes display"| node_files
node_header_load -->|"parses"| node_header
node_header -->|"uses fields"| node_header_fields
node_encrypt_command -->|"reads input"| node_files
node_encrypt_command -->|"invokes"| node_encrypter
node_encrypter -->|"loads certificates"| node_cert_handling
node_encrypter -->|"encrypts content"| node_cipher_ops
node_encrypter -->|"compresses content"| node_compression
node_encrypter -->|"encodes content"| node_encoding
node_encrypter -->|"formats header"| node_header
node_encrypt_command -->|"prints result"| node_result_output
node_result_output -->|"writes output"| node_files
node_decrypt_command -->|"reads input"| node_files
node_decrypt_command -->|"invokes"| node_decrypter
node_decrypter -->|"loads header"| node_header_load
node_decrypter -->|"loads certificates"| node_cert_handling
node_decrypter -->|"decrypts and verifies"| node_cipher_ops
node_decrypter -->|"decompresses content"| node_compression
node_decrypter -->|"decodes content"| node_encoding
node_decrypt_command -->|"prints result"| node_result_output
node_result_output -->|"writes content"| node_files

click node_cli_app "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/bin/rsfnfile.rs"
click node_header_inspection "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/bin/rsfnfile.rs"
click node_encrypt_command "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/bin/rsfnfile.rs"
click node_decrypt_command "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/bin/rsfnfile.rs"
click node_header_load "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/actions.rs"
click node_header "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/header/mod.rs"
click node_header_fields "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/header/fields/mod.rs"
click node_encrypter "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/actions.rs"
click node_decrypter "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/actions.rs"
click node_cert_handling "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/cert.rs"
click node_cipher_ops "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/ciphers/mod.rs"
click node_compression "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/compress/mod.rs"
click node_encoding "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/encode/mod.rs"
click node_result_output "https://github.com/eduardoklosowski/rsfn-file/blob/main/src/actions.rs"

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_cli_app,node_header_inspection,node_encrypt_command,node_decrypt_command,node_user toneBlue
class node_encrypter,node_decrypter,node_result_output toneAmber
class node_header_load,node_header,node_header_fields toneMint
class node_cert_handling,node_cipher_ops,node_compression,node_encoding toneRose
class node_files toneIndigo
```

## Components

### CLI

- [rsfnfile commands](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/bin/rsfnfile.rs): `src/bin/rsfnfile.rs`
- [Header inspection](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/bin/rsfnfile.rs): `src/bin/rsfnfile.rs`
- [Encrypt command](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/bin/rsfnfile.rs): `src/bin/rsfnfile.rs`
- [Decrypt command](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/bin/rsfnfile.rs): `src/bin/rsfnfile.rs`

### File processing

- [Encryption workflow](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/actions.rs): `src/actions.rs`
- [Decryption workflow](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/actions.rs): `src/actions.rs`
- [Result reporting](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/actions.rs): `src/actions.rs`

### RSFN format

- [Header loading](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/actions.rs): `src/actions.rs`
- [Security header](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/header/mod.rs): `src/header/mod.rs`
- [Header fields](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/header/fields/mod.rs): `src/header/fields/mod.rs`

### Security and content

- [Certificate handling](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/cert.rs): `src/cert.rs`
- [RSA and AES](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/ciphers/mod.rs): `src/ciphers/mod.rs`
- [Compression](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/compress/mod.rs): `src/compress/mod.rs`
- [Encoding](https://github.com/eduardoklosowski/rsfn-file/blob/main/src/encode/mod.rs): `src/encode/mod.rs`

### Other components

- **User**
- **Input/output files**

## Connections

- User → rsfnfile commands: selects command
- rsfnfile commands → Header inspection: dispatches
- rsfnfile commands → Encrypt command: dispatches
- rsfnfile commands → Decrypt command: dispatches
- Header inspection → Input/output files: reads file
- Header inspection → Header loading: loads header
- Header inspection → Input/output files: writes display
- Header loading → Security header: parses
- Security header → Header fields: uses fields
- Encrypt command → Input/output files: reads input
- Encrypt command → Encryption workflow: invokes
- Encryption workflow → Certificate handling: loads certificates
- Encryption workflow → RSA and AES: encrypts content
- Encryption workflow → Compression: compresses content
- Encryption workflow → Encoding: encodes content
- Encryption workflow → Security header: formats header
- Encrypt command → Result reporting: prints result
- Result reporting → Input/output files: writes output
- Decrypt command → Input/output files: reads input
- Decrypt command → Decryption workflow: invokes
- Decryption workflow → Header loading: loads header
- Decryption workflow → Certificate handling: loads certificates
- Decryption workflow → RSA and AES: decrypts and verifies
- Decryption workflow → Compression: decompresses content
- Decryption workflow → Encoding: decodes content
- Decrypt command → Result reporting: prints result
- Result reporting → Input/output files: writes content
