Skip to main content

wFabricSecurity

Zero Trust Security System for Hyperledger Fabric

Python Version License PyPI Version Documentation


Overview

wFabricSecurity is a comprehensive Zero Trust Security System designed for Hyperledger Fabric environments. This library implements cryptographic identity verification, code integrity validation, communication permissions, message integrity checks, rate limiting, and retry mechanisms.

Core Philosophy

In a Zero Trust architecture:

  • Never Trust, Always Verify - Every request must be authenticated and authorized
  • Least Privilege - Participants only have permissions they explicitly need
  • Assume Breach - All communications are encrypted and verified

Key Features

Feature Description
Code Integrity SHA-256 hash verification of source code to detect tampering
Digital Signatures ECDSA P-256 cryptographic signatures for message authentication
Access Control Zero Trust communication permissions defining who can communicate with whom
Message Integrity Hash verification for transmission integrity with TTL support
Rate Limiting Token bucket algorithm for DoS protection
Retry Logic Exponential backoff ensures reliable communication
Certificate Caching LRU cache with TTL for performance optimization

Installation

pip install wFabricSecurity

Requirements

  • Python 3.10 or higher
  • cryptography >= 41.0.0
  • ecdsa >= 0.18.0
  • requests >= 2.31.0
  • pyyaml >= 6.0.1

Quick Start

from wFabricSecurity import FabricSecurity

# Initialize security system
security = FabricSecurity(
    me="Master",
    msp_path="/path/to/msp"
)

# Register identity and code
security.register_identity()
security.register_code(["master.py"], "1.0.0")

# Register communication permissions
security.register_communication("CN=Master", "CN=Slave")

# Create and verify signed message
message = security.create_message(
    recipient="CN=Slave",
    content='{"operation": "process_data"}'
)

if security.verify_message(message):
    print("Message verified successfully!")

Architecture

The library follows a layered modular architecture:

┌─────────────────────────────────────────────────────────────┐
│                    PRESENTATION LAYER                        │
│              CLI Tool          API Gateway                   │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                    APPLICATION LAYER                         │
│         FabricSecurity        FabricSecuritySimple           │
└─────────────────────────────────────────────────────────────┘
                              │
        ┌─────────────────────┼─────────────────────┐
        ▼                     ▼                     ▼
┌────────────────┐  ┌────────────────┐  ┌────────────────────┐
│ IntegrityVerifier│  │PermissionManager│  │  MessageManager   │
└────────┬───────┘  └────────────────┘  └────────────────────┘
         │
         ▼
┌─────────────────────────────────────────────────────────────┐
│                   CRYPTOGRAPHIC LAYER                       │
│   HashingService        SigningService       IdentityManager │
└─────────────────────────────────────────────────────────────┘

Security Flow

MASTER                           SLAVE                            FABRIC
   │                               │                                 │
   │  1. Compute SHA-256 hash_a   │                                 │
   │───────────────────────────────│                                 │
   │  2. Sign hash_a (ECDSA)       │                                 │
   │───────────────────────────────│                                 │
   │  3. POST {payload, hash_a, sig} ─────►│                        │
   │                               │ 4. Verify ECDSA signature       │
   │                               │────────────────────────────────│
   │                               │ 5. Check permission table      │
   │                               │────────────────────────────────│
   │                               │ 6. Query code_hash ──────────►│
   │                               │                    7. Get data │
   │                               │◄────────────────────── 8. Return│
   │                               │                                 │
   │                    ┌──────────┴──────────┐                     │
   │                    │   CODE VALID?       │                     │
   │                    └──────────┬──────────┘                     │
   │                    YES        │        NO                       │
   │                    │          │                                 │
   │◄──────────────────┘          │ 9. Raise CodeIntegrityError    │
   │  10. Process task           │                                 │
   │──────────────────────────────►│                                 │
   │  11. Response {result, hash_b} ◄─────────────────────────────│

Components

Security Services

Service Description
IntegrityVerifier Verifies code integrity using SHA-256 hashing
PermissionManager Manages communication permissions between participants
MessageManager Handles secure message creation, signing, and verification
RateLimiter Token bucket algorithm for DoS protection
RetryLogic Exponential backoff retry decorator

Cryptographic Services

Service Algorithm Purpose
HashingService SHA-256, BLAKE2 Code and message integrity
SigningService ECDSA P-256 Digital signatures
IdentityManager X.509 Certificate management with caching

Fabric Integration

Component Description
FabricGateway Main Fabric blockchain gateway
FabricNetwork Network abstraction layer
FabricContract Chaincode function interface

Use Cases

Industry Application
Healthcare Secure patient data exchange between hospitals
Finance Regulatory compliance with tamper-proof audit trails
Supply Chain Product tracking with integrity-verified smart contracts
Government Zero Trust architecture for citizen services
IoT Device authentication and secure communication

Documentation

📚 Complete documentation available at: https://wFabricSecurity.readthedocs.io/en/latest/

Includes:

  • Installation guide
  • API reference
  • Step-by-step tutorials
  • Architecture diagrams
  • FAQ

License

MIT License - Copyright (c) 2026 William Rodriguez

See LICENSE for details.


Author

William Rodriguez


Resource URL
PyPI https://pypi.org/project/wFabricSecurity/
Documentation https://wFabricSecurity.readthedocs.io/en/latest/
GitHub https://github.com/wisrovi/wFabricSecurity/
Issues https://github.com/wisrovi/wFabricSecurity/issues

Metadata

Release files for wFabricSecurity 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wFabricSecurity 1.0.1
File Size Uploaded Provenance
wfabricsecurity-1.0.1.tar.gz 41.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for wFabricSecurity 1.0.1
File Interpreter ABI Platform
wfabricsecurity-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 101.1 kB

Release files / wfabricsecurity-1.0.1.tar.gz

Download URL wfabricsecurity-1.0.1.tar.gz
Size 41.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1d93181492c37ac4cac403e301968d543a4518064dda38589051dae70b35a53b
BLAKE2b-256 checksum
How to use checksums
6498d4f5a858acc1833b1de959e3f9546aa9bb90e21d21c8a38a191941ec5132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / wfabricsecurity-1.0.1-py3-none-any.whl

Download URL wfabricsecurity-1.0.1-py3-none-any.whl
Size 59.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35cc2bfb7e6467822120211aff16ecab345cdc1c33d34a89661005753f6b750c
BLAKE2b-256 checksum
How to use checksums
bbe61d423427bd86760aac19fc5ca86666d3ebb918ee6c491fd518a09314a29e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for wFabricSecurity 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page