Skip to main content

Encryption

Hadinet Africa uses three distinct layers of encryption to protect data at rest, in transit, and on-chain. This page explains each layer in detail.

Three Layers of Encryption

LayerAlgorithmPurpose
Input encryptionTweetNaCl (Curve25519 + XSalsa20-Poly1305)Encrypts all data before it reaches the blockchain
Document encryptionAES-256-GCM with PBKDF2Encrypts files before IPFS upload
Transport encryptionTLS 1.2/1.3Encrypts all API communication

Layer 1: Input Encryption (Blockchain)

Every piece of data submitted to the Cartesi rollup is encrypted with the rollup's public key before it reaches the blockchain. This means:

  • Blockchain observers cannot read the raw input data
  • Only the Cartesi VM (running inside validators) can decrypt and process it
  • Even if someone reads the blockchain directly, they see encrypted bytes

Technical Details

PropertyValue
LibraryTweetNaCl
Key exchangeCurve25519
Symmetric cipherXSalsa20
AuthenticationPoly1305
Key typeRollup's public key (asymmetric)

How It Works

  1. The frontend encrypts the input payload using the Cartesi rollup's public Curve25519 key
  2. The encrypted payload is submitted to the InputBox contract on Arbitrum
  3. The Cartesi VM decrypts the payload inside the deterministic execution environment
  4. The decrypted data is processed and stored in the rollup's SQLite database
  5. External observers see only the encrypted input — never the raw data

This ensures that even though the blockchain is a shared, replicated data structure, the actual content remains private.

Layer 2: Document Encryption (Vault)

Files in the document vault are encrypted using military-grade symmetric encryption before being uploaded to IPFS.

Technical Details

PropertyValue
AlgorithmAES-256-GCM
Key derivationPBKDF2
SaltUnique random salt per document
ModeGalois/Counter Mode (authenticated encryption)
Key locationInside the attestor's TEE only

How It Works

  1. The user uploads a document through the frontend
  2. The document is sent to the attestor's Trusted Execution Environment (TEE)
  3. A unique encryption key is derived using PBKDF2 with a random salt
  4. The document is encrypted with AES-256-GCM inside the TEE
  5. The encrypted blob is uploaded to IPFS via Pinata's private gateway
  6. Only the metadata (file name, type, size, IPFS hash) is recorded on-chain

Authenticated Encryption

AES-256-GCM provides authenticated encryption, which means:

  • Confidentiality — the file contents cannot be read without the key
  • Integrity — any tampering with the encrypted file is detectable
  • Authentication — the decryptor can verify the file was encrypted by a legitimate source

If someone modifies even a single byte of the encrypted file on IPFS, the decryption will fail and the tampering will be detected.

Key Management

The encryption key exists only inside the attestor's TEE. This means:

  • The server operator cannot access the key
  • IPFS / Pinata cannot access the key
  • The frontend never sees the key
  • The key is protected by hardware-level isolation

Layer 3: Transport Encryption

All communication between components uses HTTPS/TLS:

ConnectionProtocol
User to FrontendHTTPS (TLS 1.2/1.3)
Frontend to AttestorHTTPS (TLS 1.2/1.3)
Attestor to KYC ProviderTLS via zkFetch tunnel
Attestor to IPFS (Pinata)HTTPS
Attestor to CartesiHTTPS

zkFetch TLS Tunnel

The connection between the attestor and the KYC provider uses zkFetch, which establishes a TLS tunnel with an additional property: the TLS session itself is used to generate zero-knowledge proofs. This means the transport encryption also serves as the foundation for the ZK proof generation.

Encryption Summary by Data Type

DataEncryption LayerAlgorithmWho Can Decrypt
Rollup inputsInput encryptionTweetNaClCartesi VM only
Vault documentsDocument encryptionAES-256-GCMAttestor TEE only
API callsTransport encryptionTLS 1.2/1.3Intended recipient
ZK proofsNot encrypted (public)N/AAnyone (for verification)
On-chain metadataInput encryptionTweetNaClCartesi VM only

Security Considerations

What If the Blockchain Is Read Directly?

All inputs are encrypted before submission. An observer reading the blockchain directly sees only encrypted bytes — they cannot determine the content of any input.

What If IPFS Storage Is Compromised?

All documents are encrypted with AES-256-GCM before upload. Even with full access to the IPFS storage, an attacker obtains only encrypted blobs. Without the decryption key (which is inside the TEE), the files are unreadable.

What If Network Traffic Is Intercepted?

All communications use TLS 1.2 or higher. The zkFetch tunnel provides additional cryptographic guarantees through ZK proof generation tied to the TLS session.

Next Steps