# sajalkmr/sbomctl architecture

> Architecture diagram of the GitHub repository sajalkmr/sbomctl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sajalkmr/sbomctl
- Repository: https://github.com/sajalkmr/sbomctl

## Overview

##### Main Components

a. Core Components:
- CPABE (Ciphertext-Policy Attribute-Based Encryption) Module
- PETRA (Privacy Engine)
- Policy Management System
- SBOM Processing System
- Redaction System

b. Supporting Components:
- Configuration Management
- Database Interface
- Cryptographic Services
- Utility Services

##### Component Relationships and Architecture

Top Layer (Interface):
- Main entry points (User.py and Redaction.py scripts)

Middle Layer (Core Processing):
- PETRA Privacy Engine
- To Policy Management
- To SBOM Processing
- To Redaction System

Bottom Layer (Infrastructure):
- CPABE Rust Implementation
- Database Systems
- Cryptographic Services

##### Specific Design Elements

Use these visual elements:
- Hexagons for policy components
- Blue: Core processing components
- Green: Security/encryption components
- Yellow: Policy components
- Gray: Infrastructure components

##### Key Relationships to Highlight

- Flow from raw SBOM data through the privacy engine
- How policies (AES, IP, weakness, etc.) interact with the core system
- Demonstrate the integration between Python and Rust components (CPABE)
- How the redaction system interfaces with the policy engine

##### Technical Details

Component Specifications:
**CPABE Module (Rust):**
- AC17 implementation
- Cryptographic primitives

**PETRA Core (Python):**
- Policy enforcement
- Parallel encryption
- Tree operations
- SPDX handling

**Policy Framework:**
- Multiple policy types (AES, IP, Log4j, etc.)
- Policy evaluation engine

## Diagram (Mermaid)

```mermaid
%%{init: {'theme': 'base', 'themeVariables': { 'fontSize': '16px'}}}%%

flowchart TB
    subgraph Interface
        UI["User Interface"]:::interface
        RI["Redaction Interface"]:::interface
    end

    subgraph Core["Core Processing Layer"]
        PETRA["PETRA Privacy Engine"]:::core
        SBOM["SBOM Processing"]:::core
        RED["Redaction System"]:::core
        POL["Policy Management"]:::policy
    end

    subgraph Infrastructure["Infrastructure Layer"]
        subgraph CPABE["CPABE Module"]
            AC17["AC17 Implementation"]:::crypto
            CLIB["Core Library"]:::crypto
        end
        DB[(Database)]:::storage
        CRYPTO["Cryptographic Services"]:::crypto
        UTIL["Utility Services"]:::util
        CONFIG["Configuration Management"]:::config
    end

    UI --> PETRA
    RI --> RED
    PETRA <--> POL
    PETRA <--> SBOM
    PETRA <--> RED
    PETRA <--> AC17
    PETRA <--> CLIB
    POL <--> CONFIG
    SBOM <--> DB
    RED <--> DB
    PETRA <--> CRYPTO
    PETRA <--> UTIL

    %% Click Events
    click UI "https://github.com/sajalkmr/SBOMCtl/blob/main/src/scripts/User.py"
    click RI "https://github.com/sajalkmr/SBOMCtl/blob/main/src/scripts/Redaction.py"
    click PETRA "https://github.com/sajalkmr/SBOMCtl/tree/main/src/petra/"
    click SBOM "https://github.com/sajalkmr/SBOMCtl/tree/main/src/petra/lib/sbom/"
    click RED "https://github.com/sajalkmr/SBOMCtl/blob/main/src/petra/lib/Redaction.py"
    click POL "https://github.com/sajalkmr/SBOMCtl/blob/main/src/petra/lib/models/policy.py"
    click AC17 "https://github.com/sajalkmr/SBOMCtl/blob/main/src/cpabe/src/ac17.rs"
    click CLIB "https://github.com/sajalkmr/SBOMCtl/blob/main/src/cpabe/src/lib.rs"
    click DB "https://github.com/sajalkmr/SBOMCtl/tree/main/src/petra/lib/database/"
    click CRYPTO "https://github.com/sajalkmr/SBOMCtl/blob/main/src/petra/lib/crypto.py"
    click UTIL "https://github.com/sajalkmr/SBOMCtl/tree/main/src/petra/lib/util/"
    click CONFIG "https://github.com/sajalkmr/SBOMCtl/tree/main/config/"

    %% Styling
    classDef interface fill:#9CA3AF,stroke:#374151
    classDef core fill:#60A5FA,stroke:#2563EB
    classDef crypto fill:#34D399,stroke:#059669
    classDef policy fill:#FBBF24,stroke:#D97706
    classDef storage fill:#6B7280,stroke:#374151
    classDef util fill:#A78BFA,stroke:#7C3AED
    classDef config fill:#F472B6,stroke:#DB2777

    %% Legend
    subgraph Legend
        L1["Interface Components"]:::interface
        L2["Core Components"]:::core
        L3["Cryptographic Components"]:::crypto
        L4["Policy Components"]:::policy
        L5["Storage Components"]:::storage
        L6["Utility Components"]:::util
        L7["Configuration Components"]:::config
    end
```
