# systoolz/sndbxkey architecture

> Architecture diagram of the GitHub repository systoolz/sndbxkey, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/systoolz/sndbxkey
- Repository: https://github.com/systoolz/sndbxkey

## Overview

##### Main Components
- Key Decoder: Represented by sbkeydec.c; this module decodes or analyses Sandboxie activation keys.
- Key Generator: Represented by sbactive.c; note that it is unfinished but conceptually similar to the decoder.
- Trial Reset Tool: Represented by sbtreset.c; responsible for resetting the trial period.
- Shared Helper/Utility Module: Represented by sbhelper.h, plus common support libraries like defines.h, pool.h.
- Big Number Library: bignum.c and bignum.h, which provide routines for RSA or other large integer operations.
- CRC Utility: crc.c, which provides cyclic redundancy check functions.
- Dynamic Library Loader: dlloader.c and dlloader.h (from WOCARLib) which handles runtime loading of modules if needed.

##### Relationships and Interactions
- Each of the main tool components (decoder, generator, trial reset) depends on the shared utilities and underlying libraries.
- The Big Number and CRC functionalities are support libraries and should appear as a sub-layer that the key tools reference for cryptographic and integrity calculations.

##### Architectural Patterns and Design Principles
- Modular separation: Each tool (key decoder, key generator, trial reset) is a stand-alone executable that reuses common underlying libraries.
- Component reuse: Many files originate from standardized libraries (Sandboxie’s big number/CRC implementations and WOCARLib’s dynamic loader), which is an example of leveraging external modules for common tasks.
- Top Layer: Tool executables (sbkeydec, sbactive, sbtreset)
- Middle Layer: Shared helper functions and common utilities (sbhelper.h, defines.h, pool.h)
- Lower Layer: Core libraries (bignum, crc, and dlloader modules)

##### Relevant Technologies, Frameworks, or Libraries
- That the big number and CRC libraries are critical for cryptographic functions, essential in activation key handling.
- That the dynamic library loader enables runtime extensibility or plugin loading if required.
- Although not a networked system, represent that each module is carefully isolated and integrates via well-defined API boundaries (as indicated by the header files).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Tool Executables
    subgraph "Tool Executables"
        Kd("Key Decoder (sbkeydec.c)"):::tool
        Kg("Key Generator (sbactive.c)"):::tool
        Tr("Trial Reset Tool (sbtreset.c)"):::tool
    end

    %% Shared Utilities
    subgraph "Shared Utilities"
        S1("Shared Helper (sbhelper.h)"):::utility
        S2("Defines (defines.h)"):::utility
        S3("Pool (pool.h)"):::utility
    end

    %% Core Libraries
    subgraph "Core Libraries"
        subgraph "Big Number Library"
            BN1("bignum.c"):::core
            BN2("bignum.h"):::core
        end
        CRC("CRC Utility (crc.c)"):::core
        subgraph "Dynamic Loader"
            DL1("dlloader.c"):::core
            DL2("dlloader.h"):::core
        end
    end

    %% Dependencies from Key Decoder
    Kd -->|"depends"| S1
    Kd -->|"depends"| S2
    Kd -->|"depends"| S3
    Kd -->|"uses"| BN1
    Kd -->|"uses"| BN2
    Kd -->|"uses"| CRC
    Kd -->|"loads"| DL1
    Kd -->|"loads"| DL2

    %% Dependencies from Key Generator
    Kg -->|"depends"| S1
    Kg -->|"depends"| S2
    Kg -->|"depends"| S3
    Kg -->|"uses"| BN1
    Kg -->|"uses"| BN2
    Kg -->|"uses"| CRC
    Kg -->|"loads"| DL1
    Kg -->|"loads"| DL2

    %% Dependencies from Trial Reset Tool
    Tr -->|"depends"| S1
    Tr -->|"depends"| S2
    Tr -->|"depends"| S3
    Tr -->|"uses"| BN1
    Tr -->|"uses"| BN2
    Tr -->|"uses"| CRC

    %% Click events
    click Kd "https://github.com/systoolz/sndbxkey/blob/master/sbkeydec.c"
    click Kg "https://github.com/systoolz/sndbxkey/blob/master/sbactive.c"
    click Tr "https://github.com/systoolz/sndbxkey/blob/master/sbtreset.c"
    click S1 "https://github.com/systoolz/sndbxkey/blob/master/sbhelper.h"
    click S2 "https://github.com/systoolz/sndbxkey/blob/master/defines.h"
    click S3 "https://github.com/systoolz/sndbxkey/blob/master/pool.h"
    click BN1 "https://github.com/systoolz/sndbxkey/blob/master/bignum.c"
    click BN2 "https://github.com/systoolz/sndbxkey/blob/master/bignum.h"
    click CRC "https://github.com/systoolz/sndbxkey/blob/master/crc.c"
    click DL1 "https://github.com/systoolz/sndbxkey/blob/master/dlloader.c"
    click DL2 "https://github.com/systoolz/sndbxkey/blob/master/dlloader.h"

    %% Styles
    classDef tool fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef utility fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef core fill:#f94144,stroke:#333,stroke-width:2px;
```
