How Inner Gallery Encrypts Your Photos (Technical Breakdown)
A transparent look at Inner Gallery's encryption: ChaChaPoly (ChaCha20-Poly1305), PBKDF2 key derivation, NSFileProtection — every algorithm explained, no vague claims.
"Military-grade encryption." "Bank-level security."
These phrases are on every vault app's marketing page. They mean nothing. They're designed to sound impressive without committing to anything verifiable.
I'd rather just show you what Inner Gallery does. Every algorithm, every parameter. If you know crypto, you can verify it. If you don't, at least someone was willing to explain instead of hiding behind buzzwords.
Your PIN becomes a key
A 6-digit PIN has only a million possible combinations. Used directly as an encryption key, it would be cracked in seconds. So Inner Gallery doesn't use it directly.
Instead, Inner Gallery runs PBKDF2-HMAC-SHA256 — a key derivation function standardized in RFC 8018 — with 100,000 iterations. It takes your PIN plus a random 32-byte salt, and produces a 256-bit encryption key.
On a modern iPhone, this takes about 0.3 seconds. You don't notice. But an attacker brute-forcing all million 6-digit PINs would need roughly 3.5 days of continuous computation — and that's assuming they already have access to the encrypted files and the salt.
Each space gets its own unique salt. Same PIN on two spaces = completely different encryption keys.
ChaChaPoly encrypts every file
With the derived key, Inner Gallery encrypts each photo and video individually using ChaChaPoly — specifically the ChaCha20-Poly1305 AEAD construction, standardized by the IETF in RFC 8439.
The components:
- ChaCha20 — a stream cipher designed by Daniel J. Bernstein. Google adopted it for TLS as a replacement for RC4. WireGuard uses it exclusively. It's fast, well-studied, and has no known practical attacks after over a decade of cryptanalysis.
- Poly1305 — an authentication tag that ensures encrypted data hasn't been tampered with. Change one bit, decryption fails. This prevents an attacker from modifying encrypted files to manipulate what you see.
- AEAD — Authenticated Encryption with Associated Data. Encryption and authentication happen in a single atomic operation. You literally can't do one without the other. This eliminates an entire class of implementation mistakes.
Each file gets a unique random nonce. The output is CryptoKit's native ChaChaPoly.SealedBox format: 12-byte nonce + ciphertext + 16-byte Poly1305 tag.
Why ChaChaPoly over AES?
AES is a solid algorithm. Every iPhone has dedicated AES hardware. But ChaChaPoly has specific advantages:
- Resistant to side-channel attacks by design. AES implemented in software is vulnerable to timing attacks and cache attacks. ChaCha20's arithmetic operations avoid these issues structurally — it's not something you have to "get right," it's baked into the algorithm's design.
- Single construction. AES requires choosing an operating mode — CBC, GCM, CTR, ECB — and choosing wrong can be catastrophic (Matthew Green's analysis is worth reading). ChaChaPoly is one complete construction. One choice, done.
- Native in Apple's CryptoKit. Inner Gallery uses Apple's CryptoKit framework directly. The entire crypto stack is Apple's.
- Where the industry is heading. TLS 1.3 prioritizes ChaChaPoly. WireGuard mandates it. It's also used in SSH, S/MIME 4.0, and OTRv4.
NSFileProtection: a second layer
On top of app-level encryption, every Inner Gallery file is tagged with NSFileProtectionComplete. This tells iOS to encrypt the file at the hardware level, using keys tied to the device passcode and the Secure Enclave — a dedicated security processor that stores keys in hardware.
When the iPhone is locked, these files become cryptographically inaccessible. Not just "locked" — the decryption keys are physically unavailable until the device is unlocked again.
Inner Gallery files are double-encrypted:
- App-level: ChaChaPoly, keyed from your PIN
- OS-level: NSFileProtection, tied to device hardware
To access a photo, an attacker needs your Inner Gallery PIN, your iPhone passcode, and physical possession of that specific device.
What's deliberately absent
Inner Gallery is defined as much by what it omits as what it includes.
The app has zero server infrastructure. There's no backend, no "forgot PIN" recovery, no account system. I don't hold a copy of your key. Nobody does.
There are zero analytics SDKs — no Amplitude, no Firebase Analytics, no Mixpanel. I have no idea how you use the app.
There's zero networking code for photo transfer. Your photos physically cannot leave the device through Inner Gallery.
And there are zero third-party dependencies. The entire app runs on Foundation + SwiftUI + CryptoKit. 6,325 lines of Swift. Every line is auditable.
The honest trade-offs
Cloud backup: none. If you lose your phone without a separate backup, your Inner Gallery photos are gone. That's the cost of genuine local-only storage.
PIN recovery: none. I can't reset your PIN because I don't hold your encryption key. Nobody does. Forget your PIN, lose access to that space. This is encryption working as designed.
Cross-device sync: none. Photos exist on one device. There's no server to route through.
Every "convenient" feature that other vault apps offer — cloud backup, password recovery, multi-device sync — requires a server that can read your photos. I chose to skip that server entirely.
Inner Gallery encrypts every photo locally with ChaChaPoly. Zero servers, zero accounts, zero tracking. Download it free.
Ready to take your photos private?
Inner Gallery is a private photo vault for iPhone. Encrypted, offline, no subscription.
Download on the App Store