OpenCrypt Documentation

A comprehensive technical reference for OpenCrypt's client-side cryptographic architecture, algorithm implementations, container formats, and operational workflows.

1. Overview

In contemporary internet software, data privacy is frequently compromised by centralized server architectures. Cloud encryption tools often require users to upload confidential files to third-party endpoints, introducing severe attack surfaces: interception during transit, remote database breaches, rogue internal operators, and server-side log retention.

OpenCrypt addresses this challenge by redefining encryption as an entirely localized, client-side browser capability. By implementing standardized cryptographic ciphers through native browser APIs, OpenCrypt ensures that raw files, confidential messages, and derived encryption keys never leave the boundaries of your local machine.

What is OpenCrypt?

OpenCrypt is an in-browser, client-side cryptographic workstation designed for encrypting individual files, multi-gigabyte datasets, nested folder structures, and sensitive text payloads.

All cryptographic operations are performed directly in your local hardware memory using the W3C standard Web Crypto API (window.crypto.subtle). OpenCrypt requires no software installations, operates without browser plugins, contains zero third-party tracking scripts, and communicates with no external server endpoints during the encryption or decryption lifecycle.

Client-Side vs. Cloud Encryption Architecture

  • Traditional Cloud Tools: User File → HTTPS Upload → Remote Server (Key Derived & Stored on Server) → Download Encrypted Output. High risk of interception, subpoenas, and data exfiltration.
  • OpenCrypt Architecture: User File → Local RAM / Web Worker → AES-256-GCM Hardware-Accelerated Local Cipher → Instant Local File Save. Zero byte transmission.

Core Principles

OpenCrypt was engineered around four foundational principles of modern operational security:

100% Client-Side Privacy

Passphrases, raw plaintexts, and derived cryptographic keys reside strictly in transient memory. No metadata or telemetry is ever stored or transmitted.

Authenticated AEAD

All ciphertexts are protected with 128-bit Galois authentication tags, mathematically preventing data corruption, truncation, and chosen-ciphertext tampering.

Air-Gapped Operation

OpenCrypt operates completely offline. You can disconnect your network connection, turn on Airplane Mode, or run it on air-gapped workstations securely.

2. Algorithms in Use

Cryptographic systems must avoid custom, untested algorithms. OpenCrypt relies exclusively on NIST-standardized, mathematically proven primitives approved for defense-grade security.

Primitive Category Algorithm Cryptographic Parameters Security Guarantee
Symmetric Cipher AES-256-GCM 256-bit key length, 96-bit (12-byte) CSPRNG IV, 128-bit MAC tag Confidentiality and bit-level integrity verification (AEAD).
Key Derivation Function PBKDF2-HMAC-SHA256 600,000 iterations (OWASP 2023+ recommended), 16-byte random salt Resistance against GPU/ASIC rainbow tables and brute-force cracking.
Data Compression Raw Deflate (RFC 1951) LZ77 + Huffman dynamic table encoding via fflate engine Reduces file size and eliminates statistical plaintext patterns.
Entropy Generator CSPRNG window.crypto.getRandomValues() Cryptographically secure pseudo-random number generation for salts and nonces.

AES-256-GCM (Authenticated Encryption)

Advanced Encryption Standard (AES) with a 256-bit key provides 2256 potential key combinations, rendering brute-force decryption physically impossible with existing and foreseeable supercomputers.

OpenCrypt deploys AES in Galois/Counter Mode (GCM). GCM is an Authenticated Encryption with Associated Data (AEAD) mode that combines counter-mode encryption with Galois field multiplication (GF(2128)) to compute a 128-bit Message Authentication Code (MAC) tag over the ciphertext.

Security Impact: Unlike unauthenticated modes (such as AES-CBC or AES-CTR without HMAC), GCM prevents bit-flipping and padding oracle attacks. If an adversary modifies even a single bit in the encrypted container, decryption fails immediately and unconditionally, aborting before corrupted data can be executed.

PBKDF2-HMAC-SHA256 (Key Derivation)

User passphrases vary widely in entropy and cannot be used directly as raw cryptographic keys. OpenCrypt utilizes PBKDF2 (Password-Based Key Derivation Function 2) parameterized with HMAC-SHA-256 to stretch the human-entered password into a 256-bit cryptographic key:

Mathematical Derivation Specification
Key = PBKDF2(PRF=HMAC-SHA-256, Password=P, Salt=S[16 bytes], Iterations=600,000, Length=256 bits)

The 600,000 Iteration Threshold: Deriving a single key requires calculating HMAC-SHA-256 600,000 times in a chained feedback loop. While this takes only a fraction of a second on a modern user CPU, it forces an attacker attempting to crack a stolen container to perform hundreds of thousands of hashing operations per guess, multiplying the financial and computational cost of brute-force attacks by several orders of magnitude.

16-Byte Cryptographic Salt: For each encryption operation, OpenCrypt generates a fresh 16-byte random salt via CSPRNG. This ensures that even if two users choose identical passphrases, their derived keys and resulting ciphertexts will be completely different, nullifying precomputed rainbow tables.

Pre-Encryption Compression (Deflate)

Plaintext data (such as code, JSON, logs, spreadsheets, and documents) frequently exhibits high redundancy and predictable frequency distributions.

When compression is enabled, OpenCrypt compresses the plaintext using the Deflate algorithm (RFC 1951) prior to ciphering.

Why Compress BEFORE Encryption?

  • Compression Principle: Robust encryption outputs high-entropy pseudo-random bytes indistinguishable from white noise. As a consequence, encrypted data cannot be compressed.
  • Security Advantage: Compressing data before encryption flattens repeating byte sequences, removing structural patterns that side-channel cryptanalysts might exploit.
  • Bandwidth & Storage: Reduces payload size by up to 70–90% for text and JSON, enabling faster transmission over email, messaging apps, or cloud drives.

3. File Encryption

The Files module provides high-throughput client-side encryption for files of any size, from small office documents to multi-gigabyte database dumps, disk images, and multimedia archives.

File & Folder Workflow

01

Intake & Manifest Creation

Drag and drop files or entire folders into the vault dropzone. OpenCrypt parses the directory hierarchy, builds a binary manifest, and bundles the files into a single streaming container.

02

Passphrase & Settings Configuration

Input a master passphrase or generate a high-entropy 24-character random passphrase. Optionally toggle streaming, pre-compression, or obfuscation in Advanced Settings.

03

Encryption & Restoration

Click Encrypt File. OpenCrypt processes the data locally with live MB/s throughput stats. Decrypting restores the exact original file names and folder structures.

Advanced Option: Large File Streaming Architecture

Standard in-memory web encryption loads the entire file into a single contiguous JavaScript ArrayBuffer. When processing multi-gigabyte files, this causes catastrophic browser memory spikes and crashes the tab due to heap limits.

OpenCrypt solves this with a Streaming Pipeline (1 MiB default, up to 64 MiB maximum chunk size) using deterministic counter nonce derivation and cryptographic Associated Authenticated Data (AAD) binding:

Progressive Slice Pipeline

Source files are read in discrete slices via File.slice() and transferred to a background Web Worker via zero-copy ArrayBuffer transfers.

Deterministic Counter Nonce

Every chunk i derives an isolated 12-byte IV: Nonce[0..3] = BaseIV[0..3] and Nonce[4..11] = BaseIV[4..11] ⊕ Uint64BE(i).

Direct AAD Binding

Each chunk is cryptographically bound to the header and sequence index: AAD = CanonicalHeader || Uint64BE(i) || FinalFlag(1B), preventing reordering or truncated frames.

Advanced Option: Pre-Encryption Compression

When encrypting uncompressed formats (e.g., CSV databases, log files, text archives, SQL dumps, or software source trees), enabling Pre-Encryption Compression invokes raw Deflate compression on the payload stream before ciphering.

This delivers substantial container size reductions without sacrificing encryption throughput, while automatically bypassing pre-compressed files (like JPEG or MP4) where compression yields no benefit.

Advanced Option: Signature Obfuscation (Stealth Containers)

Standard encrypted archives carry fixed, recognizable magic byte signatures (for example, the ASCII sequence OCPT at offset 0). Firewalls, network monitors, and Deep Packet Inspection (DPI) scanners search for these magic bytes to identify, flag, or quarantine encrypted containers.

When Signature Obfuscation is enabled:

  • The static OCPT magic header is stripped and replaced with pseudo-random high-entropy bytes.
  • Container format markers are randomized and structurally blended across the cryptographic salt and IV.
  • The resulting output file resembles a completely random stream of uniform binary entropy, indistinguishable from white noise or hardware random numbers.

4. Text Encryption

The Text module is designed for securing secret messages, sensitive notes, recovery phrases, API secrets, and server configuration files into compact, portable strings that can be copied into chat apps or emails.

Text Encryption Workflow

Simply paste or type your sensitive note into the input textarea, enter your chosen passphrase, and click Encrypt Text. OpenCrypt derives a 256-bit AES key via PBKDF2, seals the text with AES-256-GCM, and produces an armored string with one-click copy and download options.

To decrypt, paste the armored string into the input box, supply the original passphrase, and click Decrypt Text to recover the exact original plaintext.

Armored Format (OCPT_...)

Binary ciphertexts cannot be safely transmitted through messaging apps (e.g., WhatsApp, Signal, Telegram, Discord), web forums, or email without risking character corruption caused by Unicode encoding, line breaks, or whitespace normalization.

OpenCrypt encodes ciphertexts into a robust Base64URL armored envelope prefixed with OCPT_:

Standard Armored Ciphertext Sample
OCPT_AQAAk1oW1r4_kL90Q0b3x8xM8hQ4wN7vC9p_3K2yL6jR5mT1xYz8vB4wQ...

Binary Armoring Layout: The base64url payload packs the container flags, 16-byte PBKDF2 salt, 12-byte GCM nonce, 128-bit authentication tag, and the encrypted ciphertext into a single URL-safe string using only [A-Za-z0-9-_=].

Text Signature Obfuscation

When Signature Obfuscation is enabled in the Text module, the explicit OCPT_ prefix and version markers are removed. The output becomes a pure, non-prefixed high-entropy base64 string, preventing signature-matching chat filters and automated text scrapers from identifying the message as an OpenCrypt payload.

Text Pre-Encryption Compression

Enabling compression in the Text module compresses extensive text documents (such as JSON config trees, database exports, private keys, or lengthy markdown documentation) using Deflate prior to encryption. This can reduce the resulting armored string length by 50% to 80%, making it far easier to share across platforms with strict message length limits.

5. Technical Notes

In-depth technical specifications covering OpenCrypt's threading model, threat boundaries, container binary layouts, and open-source licensing.

Memory Management & Web Workers

Browser main threads are shared with UI rendering and user interactions. Executing PBKDF2 with 600,000 iterations or streaming gigabytes of data on the main thread would cause catastrophic UI freezing and trigger browser "Page Unresponsive" warnings.

OpenCrypt offloads all computationally intensive tasks to a dedicated background Web Worker:

  • Thread Isolation: Hashing, compression, and AES encryption execute on separate OS threads without blocking UI animations or button states.
  • Transferable ArrayBuffers: Data buffers are transferred between the main thread and the worker using zero-copy postMessage(buffer, [buffer]) semantics, avoiding redundant memory cloning.
  • Zero Disk Caching: All intermediate data chunks are discarded from RAM as soon as they are processed, ensuring no residual plaintext lingers in persistent browser storage.

Security & Threat Model

Security Assurances & Threat Boundaries

  • Network Adversaries: Because all crypto is executed 100% client-side, adversaries monitoring network traffic, Wi-Fi networks, or ISP routers see zero plaintext or encryption keys.
  • Server Compromise: Even if the hosting server were completely compromised, attackers cannot decrypt user containers because keys and plaintexts never touch the server.
  • Passphrase Entropy Requirement: OpenCrypt's cryptographic strength is directly linked to passphrase quality. A weak or short password (e.g. password123) can still be vulnerable to dictionary attacks despite the 600,000 PBKDF2 rounds. Users are strongly urged to use passphrases with ≥ 80 bits of entropy.
  • Zero Backdoors: OpenCrypt contains no recovery keys, escrow systems, or backdoors. If a passphrase is lost, the data is mathematically unrecoverable.

Container Binary Layout

OpenCrypt employs deterministic binary container layouts for both standard and stealth operational modes, validated with Authenticated Associated Data (AAD) binding:

1. Standard File Container (.opencrypt — 44 + M Bytes Header)

Byte Offset Field Name Length Data Type & Representation Description
0x00 - 0x03 Magic Signature 4 Bytes ASCII string OCPT Binary container identification signature.
0x04 Format Version 1 Byte Uint8 (0x01) Current OpenCrypt container schema version.
0x05 Container Mode 1 Byte Uint8 (0x01 or 0x02) 0x01 = Single-Pass Payload, 0x02 = Chunked Stream.
0x06 - 0x09 Chunk Size 4 Bytes Uint32 Big-Endian Chunk buffer size in bytes (e.g., 1,048,576 for 1 MiB default; 0 for single-pass).
0x0A - 0x0D PBKDF2 Iterations 4 Bytes Uint32 Big-Endian Iteration count for key derivation (default: 600,000).
0x0E - 0x1D PBKDF2 Salt 16 Bytes Binary (128-bit CSPRNG) Cryptographic random salt for key derivation.
0x1E - 0x29 Base Nonce / IV 12 Bytes Binary (96-bit CSPRNG) Base initialization vector for AES-256-GCM cipher operations.
0x2A - 0x2B Metadata Length (M) 2 Bytes Uint16 Big-Endian Byte length M of the subsequent UTF-8 JSON metadata payload.
0x2C - 0x2B+M File Metadata M Bytes UTF-8 JSON string Original file name, MIME type, file size, compression mode, and directory tree manifest.
0x2C+M - ... Encrypted Payload Variable AES-256-GCM Bytes Single-pass ciphertext + 16B tag, or sequence of framed stream chunks with independent counter IVs.

2. Text Armored Envelope Layout (34 Bytes Header + Ciphertext)

Prior to Base64URL encoding (with OCPT_ prefix), text ciphertexts are packed into a compact 34-byte binary envelope:

Byte Offset Field Name Length Format Description
0x00 Version 1 Byte Uint8 (0x01) Format version indicator.
0x01 Compression Flag 1 Byte Uint8 (0x00 / 0x01) 0x00 = None, 0x01 = Gzip/Deflate.
0x02 - 0x05 Iterations 4 Bytes Uint32 Big-Endian PBKDF2-HMAC-SHA256 round count (e.g. 600,000).
0x06 - 0x15 Salt 16 Bytes Binary CSPRNG 128-bit key derivation salt.
0x16 - 0x21 Nonce / IV 12 Bytes Binary CSPRNG 96-bit AES-GCM initialization vector.
0x22 - ... Ciphertext + Tag Variable + 16B AES-256-GCM Encrypted UTF-8 text followed by 128-bit MAC authentication tag.

3. Stealth / Obfuscated File Container (55 + M Bytes Header)

Byte Offset Field Name Length Description
0x00 - 0x2F Randomized Envelope 48 Bytes 8B token + 1B version + 1B compression + 4B iterations + 16B salt + 12B IV + 6B filler.
0x30 Container Mode 1 Byte Operational mode byte (Single-Pass or Stream).
0x31 - 0x34 Chunk Size 4 Bytes Uint32 Big-Endian chunk size.
0x35 - 0x36 Metadata Length (M) 2 Bytes Uint16 Big-Endian byte length of JSON metadata.
0x37 - 0x36+M Metadata JSON M Bytes UTF-8 JSON metadata payload.
0x37+M - ... Encrypted Payload Variable Uniform high-entropy AES-256-GCM ciphertext stream.

Open Source & License

OpenCrypt is free software distributed under the terms of the GNU Affero General Public License v3.0 (AGPL-3.0).

Under the AGPL-3.0 license, you are free to inspect, audit, modify, and self-host OpenCrypt on private internal networks or air-gapped hardware. Any modifications or deployments made available over computer networks must make their corresponding source code publicly available under the same license terms.

Auditing and Source Code:

GitHub Repository: https://github.com/omwardhanM/OpenCrypt ↗

Developer: Omwardhan Mishra ↗