---
# System prepended metadata

title: Decentralised PubSub Paper
tags: [messaging]

---

# Privacy-Preserving Role-Based Access Control in Decentralized Publish/Subscribe Systems Using Proxy Re-encryption and Verifiable Presentations

## Abstract

This paper presents a novel approach to implementing privacy-preserving broadcast capabilities in decentralized publish/subscribe systems using proxy re-encryption combined with verifiable presentations. We address the fundamental challenge of maintaining message confidentiality while supporting dynamic subscriber management without compromising the decoupling principles of pub/sub architectures. Our solution enables fine-grained role-based access control while preserving privacy and scalability in decentralized environments.

## 1. Introduction

In traditional point-to-point communication, message encryption is straightforward as the sender can encrypt using the recipient's public key. However, broadcast scenarios present unique challenges, particularly when the sender must remain decoupled from subscribers and support message replay capabilities. Current solutions either compromise on decentralization or security, creating a significant gap in enterprise-grade messaging systems.

I'll expand the article with more detailed descriptions, focusing on areas with bullet points.

Title: Privacy-Preserving Role-Based Access Control in Decentralized Publish/Subscribe Systems Using Proxy Re-encryption and Verifiable Presentations

### 1.1 Problem Statement

The primary challenge lies in implementing role-based access control (RBAC) in a decentralized pub/sub system while maintaining several critical properties:

Message confidentiality must be preserved throughout the entire message lifecycle, from publication to consumption, ensuring that only authorized subscribers can access the content. Publisher-subscriber decoupling ensures that publishers need not maintain any information about subscribers, preserving the fundamental pub/sub architecture principle.

The system must maintain scalability across multiple dimensions, including number of subscribers, messages, and channels, without degrading performance. Dynamic access control enables real-time modifications to access permissions without system interruption or message replay.

Message replay capabilities allow new subscribers to access historical messages while maintaining the same security guarantees as real-time messages.

### 1.2 Related Work

Previous attempts at solving this challenge have fallen into several categories:

**Centralized Approaches**
Traditional broker-based systems rely on central authorities to manage message distribution and access control, creating single points of failure. Centralized key management systems suffer from scalability limitations and security vulnerabilities. These approaches introduce single points of failure that compromise the decentralized nature of modern systems.

**Partial Solutions**
Group key management schemes provide some decentralization but struggle with dynamic membership changes. Attribute-based encryption offers fine-grained access control but faces performance challenges at scale. Identity-based broadcast encryption systems provide efficient key management but lack flexibility in role-based access control.

### 2.2 Security Requirements

The system implements several critical security features:

Unique per-subscriber decryption keys are cryptographically bound to subscriber identity through verifiable credentials, preventing key sharing or delegation. The decryption process operates independently from message delivery, enabling asynchronous message processing while maintaining security guarantees.

Private key protection ensures that no participant, including the system itself, can access the private keys of other participants. Zero-knowledge key generation enables secure key creation without exposing sensitive information to any party.

Message content remains private from the messaging service through end-to-end encryption, while forward and backward secrecy prevent access to messages outside the authorized time window.


### 2.3 Performance Requirements

The system maintains several critical performance characteristics:

Scalability with increasing subscribers is achieved through efficient key management and distributed processing. Low latency message delivery ensures real-time communication capabilities even with complex access control mechanisms.

Efficient key management minimizes the computational overhead of cryptographic operations, while maintaining security guarantees. The system employs minimal computational overhead through optimized cryptographic operations and efficient protocol design.


## 3. Proposed Architecture

### 3.1 System Components

The architecture consists of four primary components that work together to provide secure, decentralized publish/subscribe functionality:

**Key Manager**
The Key Manager serves as the cryptographic backbone of the system, performing several critical functions:
- Cryptographic Operations: Handles all encryption, decryption, and key generation tasks using proxy re-encryption schemes
- Access Control Management: Enforces role-based access control policies through verification of credentials and maintenance of access control lists
- Proxy Re-encryption Implementation: Executes the re-encryption process that enables secure message delivery to authorized subscribers
- Verifiable Presentation Validation: Processes and validates verifiable presentations to ensure subscribers have appropriate permissions

The Key Manager operates as a decentralized network using distributed key generation (DKG) protocols to eliminate single points of failure.

**Publishers**
Publishers are entities that generate and distribute content through channels. Their responsibilities include:
- Channel Creation and Management: Establishing new channels and defining their properties
- Message Encryption: Securing content using channel-specific public keys
- Access Control Policy Definition: Specifying which roles and attributes are required for channel access
- Content Distribution: Broadcasting encrypted messages to the messaging infrastructure

Publishers remain completely decoupled from subscribers, maintaining the pub/sub paradigm's core principles.

**Subscribers**
Subscribers are content consumers who interact with the system through several mechanisms:
- Credential Presentation: Providing verifiable presentations that prove their authorization to access specific channels
- Message Reception: Receiving encrypted messages from subscribed channels
- Decryption Operations: Using their private keys to decrypt re-encrypted messages
- Subscription Management: Maintaining and updating their channel subscriptions based on their roles and needs

The subscriber component includes client-side libraries that handle cryptographic operations and credential management.

**Identity Provider**
The Identity Provider forms the trust foundation of the system through:
- Credential Issuance: Creating and signing verifiable credentials that attest to subscriber attributes and roles
- Identity Validation: Verifying the authenticity of subscriber identity claims
- Role Attestation Management: Maintaining and updating role assignments through verifiable credentials
- Revocation Services: Managing the lifecycle of credentials including revocation when necessary

The Identity Provider operates independently of the messaging infrastructure, enabling separation of concerns between identity management and message delivery.

### 3.1.1 Component Interactions

The components interact through standardized protocols that ensure security and scalability:

```mermaid
graph TB
    IP[Identity Provider] -->|Issues Credentials| S[Subscriber]
    S -->|Presents VP| KM[Key Manager]
    P[Publisher] -->|Creates Channel| KM
    P -->|Publishes| MS[Message Store]
    KM -->|Re-encryption Keys| MS
    MS -->|Encrypted Messages| S
```

### 3.3 Trust Model

The system operates under a distributed trust model where:

**Key Manager Trust**
- Operates as a decentralized network using threshold cryptography
- No single node has access to complete key material
- Consensus required for critical operations

**Publisher Trust**
- Publishers are trusted to define appropriate access control policies
- Cannot access subscriber-specific information
- Cannot decrypt re-encrypted messages

**Subscriber Trust**
- Must maintain credential security
- Cannot share or delegate access rights
- Subject to credential revocation

**Identity Provider Trust**
- Trusted for identity attestation
- Cannot access message content
- Cannot impersonate subscribers


### 3.2 Protocol Design

#### 3.2.1 Channel Creation
```python
def create_channel():
    # Generate channel keypair
    pkC, skC = KeyGen(security_parameter)
    
    # Store channel metadata
    channel_metadata = {
        'public_key': pkC,
        'access_policy': policy,
        'created_at': timestamp
    }
    
    return channel_id, pkC
```

```mermaid
sequenceDiagram
    participant P as Publisher
    participant KM as Key Manager
    participant L as Ledger

    P->>KM: RequestChannelCreation(policy)
    KM->>KM: GenerateChannelKeyPair()
    KM->>L: StoreChannelMetadata(pkC, policy)
    L-->>KM: channel_id
    KM-->>P: channel_id, pkC
```

#### 3.2.2 Message Publication
```python
def publish_message(message, channel_id):
    # Retrieve channel public key
    pkC = get_channel_key(channel_id)
    
    # Encrypt message
    ciphertext = Enc(pkC, message)
    
    # Broadcast encrypted message
    broadcast(channel_id, ciphertext)
```

```mermaid
sequenceDiagram
    participant P as Publisher
    participant KM as Key Manager
    participant MS as Message Store
    participant S as Subscriber

    P->>KM: GetChannelKey(channel_id)
    KM-->>P: pkC
    P->>P: Encrypt(message, pkC)
    P->>MS: Publish(encrypted_message)
    MS->>S: Broadcast(encrypted_message)
```

#### 3.2.3 Subscription Process
```python
def subscribe(channel_id, subscriber_vp):
    # Validate verifiable presentation
    if not validate_vp(subscriber_vp):
        raise InvalidCredentialsError
    
    # Generate re-encryption key
    rkB = ReKeyGen(pkC, subscriber_pk)
    
    # Store subscription
    store_subscription(channel_id, subscriber_id, rkB)
```

```mermaid
sequenceDiagram
    participant S as Subscriber
    participant IP as Identity Provider
    participant KM as Key Manager
    participant MS as Message Store

    S->>IP: RequestCredential(identity)
    IP-->>S: VerifiableCredential
    S->>S: CreatePresentation(VC)
    S->>KM: Subscribe(channel_id, VP)
    KM->>KM: ValidatePresentation(VP)
    KM->>KM: GenerateReEncryptionKey()
    KM->>MS: StoreSubscription(sub_id, reKey)
    KM-->>S: SubscriptionConfirmation
```


#### 3.2.4 Message Decryption Sequence

```mermaid
sequenceDiagram
    participant S as Subscriber
    participant MS as Message Store
    participant KM as Key Manager

    S->>MS: RequestMessage(msg_id)
    MS->>KM: GetReEncryptionKey(sub_id)
    KM-->>MS: reKey
    MS->>MS: ReEncrypt(message, reKey)
    MS-->>S: reEncrypted_message
    S->>S: Decrypt(reEncrypted_message)
```

### 3.3 Access Control Mechanism

The system implements RBAC through:
- Verifiable Presentations containing role attestations
- Policy-based access control decisions
- Dynamic role verification
- Credential revocation checking

### 3.4 Key Rotation Sequence

```mermaid
sequenceDiagram
    participant KM as Key Manager
    participant L as Ledger
    participant MS as Message Store
    participant S as Subscriber

    KM->>KM: GenerateNewChannelKeys()
    KM->>L: UpdateChannelKeys(new_pkC)
    KM->>KM: GenerateNewReEncryptionKeys()
    par Key Distribution
        KM->>MS: UpdateReEncryptionKeys()
    and Notification
        KM->>S: NotifyKeyRotation()
    end
```

### 3.5 Revocation Sequence

```mermaid
sequenceDiagram
    participant P as Publisher
    participant KM as Key Manager
    participant L as Ledger
    participant S as Subscriber

    P->>KM: RevokeAccess(sub_id)
    KM->>L: MarkRevoked(sub_id)
    KM->>KM: UpdateChannelKeys()
    par Revocation
        KM->>KM: RevokeReEncryptionKeys(sub_id)
    and Notification
        KM->>S: NotifyRevocation(sub_id)
    end
```

## C4 diagrams

```plantuml
@startuml C4_Context
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml

LAYOUT_WITH_LEGEND()
title System Context diagram for Privacy-Preserving Pub/Sub System

Person(publisher, "Publisher", "Content creator who publishes encrypted messages")
Person(subscriber, "Subscriber", "Content consumer with role-based access")

System(pubsub_system, "Privacy-Preserving Pub/Sub", "Enables secure message broadcasting with role-based access control")

System_Ext(identity_provider, "Identity Provider", "Issues and validates verifiable credentials")

Rel(publisher, pubsub_system, "Publishes encrypted messages")
Rel(subscriber, pubsub_system, "Subscribes and receives messages")
Rel(subscriber, identity_provider, "Obtains credentials")
Rel(pubsub_system, identity_provider, "Verifies credentials")

@enduml

```

```plantuml
@startuml C4_Container
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

LAYOUT_WITH_LEGEND()
title Container diagram for Privacy-Preserving Pub/Sub System

Person(publisher, "Publisher", "Content creator who publishes encrypted messages")
Person(subscriber, "Subscriber", "Content consumer with role-based access")

System_Ext(identity_provider, "Identity Provider", "Issues and validates verifiable credentials")

System_Boundary(pubsub_system, "Privacy-Preserving Pub/Sub") {
    Container(key_manager, "Key Manager", "Distributed Network", "Handles cryptographic operations and access control")
    Container(message_store, "Message Store", "Distributed Storage", "Stores encrypted messages")
    Container(api_gateway, "API Gateway", "REST API", "Handles external communications")
}

Rel(publisher, api_gateway, "Publishes messages", "HTTPS")
Rel(subscriber, api_gateway, "Subscribes/receives messages", "HTTPS")
Rel(api_gateway, key_manager, "Manages keys and permissions", "Internal")
Rel(api_gateway, message_store, "Stores/retrieves messages", "Internal")
Rel(key_manager, identity_provider, "Verifies credentials", "HTTPS")

@enduml

```

## 4. Security Analysis

### 4.1 Threat Model

The system assumes:
- Semi-honest participants
- Potential collusion between subscribers
- Active network adversaries
- Compromised messaging infrastructure

### 4.2 Security Properties

The architecture ensures:
- Perfect forward secrecy
- Collusion resistance
- Key independence
- Message confidentiality
- Access control enforcement

### 4.3 Formal Security Proofs

(Detailed security proofs and mathematical analysis would be included here)

## 5. Implementation Considerations

### 5.1 Key Manager Implementation

Custom key managers must:
- Implement standardized API
- Maintain public accessibility
- Support decentralized operation
- Handle key rotation
- Manage access control policies

### 5.2 Performance Optimizations

The system incorporates:
- Caching mechanisms
- Batch re-encryption
- Lazy key generation
- Efficient revocation handling

### 5.3 Scalability Considerations

Addressing scalability through:
- Distributed key management
- Hierarchical access control
- Efficient message routing
- Load balancing

## 6. Future Work

Several areas warrant further investigation:
- Optimizing re-encryption performance
- Enhancing role-based access control granularity
- Implementing attribute-based access control
- Improving revocation mechanisms
- Developing standardized APIs

## 7. Conclusion

This paper presents a comprehensive solution for privacy-preserving broadcast pub/sub systems that maintains the fundamental principles of decoupling and scalability while providing robust role-based access control. The combination of proxy re-encryption and verifiable presentations enables a secure, scalable, and truly decentralized messaging infrastructure suitable for enterprise applications.

## References

(Relevant academic papers and technical specifications would be listed here)

Sources
