Photo encryption on Android works by turning each photo into scrambled data with a secret key, so the file can only be turned back into a picture by someone who has that key. In a well-built vault, every photo gets its own random key, the list of names and thumbnails is encrypted too, and the key that opens everything is locked behind your PIN and the phone's secure hardware. When you unlock the vault, the app uses those keys to decrypt photos in memory for viewing, without writing a readable copy to storage. Below, we follow one photo through HideBerry, the encrypted vault we make for Android, from the moment it goes in to the moment you open it again, and explain each technical term in one plain sentence as it comes up.
This page is part of photo encryption and security explained.
What happens when you put a photo in
Here is the path one photo takes in HideBerry, in order:
- You pick the photo. HideBerry uses Android's own photo picker, so the app receives only the photos you choose. It has no access to the rest of your gallery.
- The app makes a new key for this one photo. It is a random 256-bit key, made fresh for this item and used for nothing else.
- The photo is encrypted with AES-256-GCM. AES is the standard block cipher used to protect data around the globe; 256 is the key length in bits; GCM (Galois/Counter Mode) is a mode, specified by NIST, that encrypts and adds a tamper check in one step. HideBerry does this with Tink, Google's cryptography library.
- Big files go in pieces. Videos and other large files are encrypted in 1 MB segments with Tink's streaming encryption, where each segment is bound to its place in the file, so pieces can't be removed or reordered without the file failing its check.
- The vault's index gets an entry. The name, folder and thumbnail go into a database encrypted with SQLCipher, an encrypted version of SQLite (the small database most Android apps use). File names are not readable on disk.
- The app checks the copy. HideBerry compares the stored copy with the original byte for byte.
- It offers to delete the original. On Android 11 and newer, it asks through Android's own delete dialog. On Android 9 and 10, it tells you to delete the original in your gallery app yourself.
Step 7 matters more than people expect. Until the original is gone from the gallery (and from any cloud photo backup), an unencrypted copy still exists. We cover that step on deleting originals after hiding photos.
What happens when you open a photo
Unlocking runs the chain the other way:
- You enter your PIN or pattern. It goes through Argon2id, a deliberately slow and memory-heavy function that turns a short code into a key. HideBerry uses 64 MiB of memory and 3 passes for each attempt.
- The secure hardware adds its part. The result is wrapped again by a key that lives in the phone's secure hardware through the Android Keystore (StrongBox when the phone has it, otherwise the TEE). That key is used inside the hardware and can't be copied off the phone.
- The master key opens. With both parts in place, the vault's random 256-bit master key becomes usable.
- The photo is decrypted for display. Photos, videos, text and PDFs open inside the app. Nothing is decrypted to a file to view it.
- The vault locks again. When you tap Lock now, or after you leave the app for the time you chose (immediately, 30 seconds by default, 1 minute or 5 minutes).
If you turned on fingerprint unlock, it is a faster way in than typing your code. It is not an extra layer: your PIN or pattern always works too. Android checks the fingerprint itself; the app never receives it.
The key chain at a glance
| Key or secret | How it is made | What it protects | Where it lives |
|---|---|---|---|
| Item key | Random, 256-bit, one per item | One photo, video, note or file | Inside the vault, which stays locked until the master key opens |
| Master key | Random, 256-bit | The whole vault | Locked by your PIN path and by the hardware key |
| PIN-derived key | Your PIN or pattern through Argon2id | The master key | Worked out from your PIN when you unlock |
| Hardware key | Made inside the phone's secure hardware | The PIN-derived layer | Android Keystore (StrongBox or TEE); can't leave the phone |
| Recovery secret | Random, 128-bit, written as 12 words | Opens the vault with a backup file, on any phone | On your paper, nowhere else |
Two design choices in that table are worth explaining.
The master key is not made from your PIN. If a vault's key were simply "your PIN, stretched", anyone with the files could start guessing PINs on their own computer. Keeping the master key random, and using the PIN only to unlock it, means the PIN is one of the gates, not the key itself.
The recovery words take a separate path. They encode a 128-bit random secret using BIP39, a public standard that writes a secret as words from a fixed list of 2,048, with a short checksum so a mistyped word is caught. With a backup file, those words open the vault on any phone. That is how restoring to a new phone works without the old one, and why the words must stay private. More on recovery words.
Why each photo gets its own key
Using one key per item, instead of one key for the whole vault, is a common pattern in careful designs. Each item stands on its own: learning one file's key tells an attacker nothing about any other file, and no single key is used over and over across thousands of photos. It is a small cost for the app and a real limit on how much any one slip can expose.
What the tamper check means for you
GCM, and Tink's streaming mode for big files, add an authentication tag: a short code computed from the key and the data. If even one bit of the file changes, the check fails and the item refuses to open, rather than opening as a garbled picture.
You see this most in backups. A damaged or wrong HideBerry backup file fails with a clear message and never half-restores. When we tested restores between our two test phones on 17 November 2026, a backup file made on a Samsung Galaxy was restored on a Xiaomi Redmi using only the file and the 12 recovery words, and the photo taken out on the Redmi had the same SHA-256 fingerprint as the original: identical, byte for byte.
What is encrypted, and what isn't
| Item | Encrypted in HideBerry? |
|---|---|
| Photo and video content | Yes, AES-256-GCM, one key per item |
| Notes and other files | Yes, the same way |
| File names, folders, thumbnails | Yes, in the SQLCipher index |
Backup file (.vault) | Yes, opened with your 12 recovery words |
| Photos taken with HideBerry's own camera | Yes, they go straight into the vault |
| A copy you take out | No: take out saves a normal, unencrypted copy, and the app labels it as leaving the vault |
| The original in your gallery or a cloud photo backup | No, until you delete it there |
| The HideBerry app icon | Visible on your phone; HideBerry doesn't disguise itself |
Common mistakes with encrypted photos
- Leaving the original in the gallery. The vault copy is encrypted; the original isn't.
- Forgetting the cloud copy. If Google Photos or another service backed the photo up before you moved it, that copy is still in the cloud.
- Taking out and forgetting. A taken-out copy is a normal file again, visible to the gallery.
- Storing the recovery words in a screenshot or note on the same phone. That puts the key next to the lock.
- Trusting the word "encrypted" without details. Ask what is encrypted (content, names, thumbnails) and how the key is protected. The photo encryption pillar lists the questions to ask any app.
People Also Ask
Does Android encrypt my photos already? Yes, the phone's storage is encrypted, but that protection is mainly for a phone that is off or not yet unlocked since it started. After you unlock it, photos are readable to apps with access and to anyone holding the phone. The options for a second layer are on how to encrypt photos on Android.
Is AES-256 better than AES-128? Both are considered strong. AES-256 uses a longer key, which leaves a larger safety margin. For a photo vault, the choice of cipher matters far less than how the key is protected: a strong cipher behind a short, quickly guessable PIN is still weak. That is why PIN stretching and hardware keys matter.
Where is the key stored? In HideBerry, the master key is never stored in a readable form. It is locked by a key made from your PIN and by a second key that stays inside the phone's secure hardware. How that hardware works is on Android Keystore and secure hardware explained.
Can encryption make my photos look worse? No. Encryption is exact: decrypting returns the identical bytes that went in. Our restore test showed the same SHA-256 fingerprint before and after.
FAQs
How does photo encryption work in simple terms?
The app uses a secret key to scramble the photo's data so it looks like random noise. Only the same key can unscramble it. A good vault gives every photo its own key, encrypts the names and thumbnails too, and protects the keys with your PIN and the phone's secure hardware.
What is AES-256-GCM?
It is AES, the standard cipher, used with a 256-bit key in GCM mode. GCM both encrypts the data and attaches a tamper check, so any change to the file makes it fail to open instead of opening wrong. NIST publishes the GCM specification (SP 800-38D).
Is my PIN the encryption key?
Not in HideBerry. The master key is random. Your PIN goes through Argon2id and, together with a key in the phone's secure hardware, unlocks the master key. That is why files copied off the phone can't be opened with the PIN alone.
Are photos decrypted to storage when I view them?
No. In HideBerry, photos, videos, text and PDFs open inside the app without writing a decrypted file. Only Take out creates a normal, unencrypted copy, and the app labels that as leaving the vault's protection.
What happens to encryption when I make a backup?
The backup file is encrypted. It opens with your 12 recovery words on any phone with HideBerry installed, which is how moving to a new phone works. Items in the trash are not included. Make one whenever you have added things you can't afford to lose.
See the whole HideBerry flow
Encryption is the part you never see. The setup, the recovery words and backups are the parts you do. HideBerry is coming soon to Google Play; until then, the full flow from first PIN to restoring on a new phone is on how HideBerry works, and the protections against guessing are on PIN vs pattern.
Sources
- Recommendation for Block Cipher Modes of Operation: GCM and GMAC (SP 800-38D), NIST
- Streaming Authenticated Encryption with Associated Data (Streaming AEAD), Google Developers (Tink)
- SQLCipher: Full Database Encryption for SQLite, Zetetic
- RFC 9106: Argon2 Memory-Hard Function for Password Hashing, IETF
- BIP 39: Mnemonic code for generating deterministic keys, Bitcoin Improvement Proposals
- Android Keystore system, Android Developers
- Encryption, Android Open Source Project