Losing app data can be frustrating, especially when the data contains personal notes, game progress, or confidential work files. While Google Drive or manufacturer cloud services offer convenience, they don’t give you full control over encryption and storage location. This tutorial shows you how to create a **complete, encrypted backup of every app’s data** using only ADB (Android Debug Bridge) and OpenSSL – no root required.
.tar archive that can be moved between computers.AES‑256‑CBC with a salt protects the file even if the storage medium is stolen.Git Bash or Chocolatey (choco install openssl). macOS and Linux usually have it pre‑installed..ab) can contain unencrypted app data if you skip the encryption step. Always keep the encrypted file in a secure location.adb devices
You should see a line like 0123456789ABCDEF device. If the status is unauthorized, check the phone for a dialog asking to Allow USB debugging and tap Allow.adb shell getprop ro.product.model
This confirms you’re talking to the right device.The built‑in ADB backup command packages app APKs, shared storage (photos, downloads) and the app’s private data into a single .ab file.
C:\Backups\Android (Windows) or ~/Backups/Android (macOS/Linux).adb backup -apk -shared -all -f "C:\Backups\Android\full_backup.ab"
-apk – includes the original APK files (useful if you later want to reinstall without Play Store).-shared – backs up the contents of /sdcard (photos, downloads, etc.).-all – backs up every user‑installed app.-f – specifies the output file..ab file, which we will encrypt ourselves.-all with -package com.example.app1 -package com.example.app2..ab File to a Standard .tarThe ADB backup file is a custom format that starts with a 24‑byte header, followed by the raw .tar data (optionally compressed). Converting it makes the archive compatible with OpenSSL and other tools.
full_backup.ab.
cd "C:\Backups\Android"
dd if=full_backup.ab bs=24 skip=1 | openssl zlib -d > full_backup.tar
dd skips the 24‑byte header.openssl zlib -d decompresses the payload (ADB uses zlib compression by default).If you get openssl: command not found, make sure OpenSSL is in your PATH.
tar -tvf full_backup.tar | head
You should see a list of files such as apps/com.example.myapp/.....tar with OpenSSLNow we’ll protect the archive with AES‑256‑CBC. The command prompts you for a passphrase – choose a strong, memorable password or store it in a password manager.
openssl enc -aes-256-cbc -salt -in full_backup.tar -out full_backup.tar.enc
-aes-256-cbc – the encryption algorithm.-salt – adds a random 8‑byte salt, making dictionary attacks harder.full_backup.tar.enc to the same folder.del full_backup.tar # Windows
rm full_backup.tar # macOS/Linux
It’s a good habit to test decryption before you rely on the backup.
full_backup.tar.enc to a temporary folder..tar:
openssl enc -d -aes-256-cbc -in full_backup.tar.enc -out test_restore.tar
test_restore.tar:
tar -tvf test_restore.tar | head
If the list appears correctly, the encryption/decryption cycle works.
del test_restore.tar # Windows
rm test_restore.tar # macOS/Linux
When you need to bring the data back to a device, follow the reverse process.
openssl enc -d -aes-256-cbc -in full_backup.tar.enc -out full_backup.tar
.tar into an .ab file:
printf "ANDROID BACKUP\n1\n\0\0\0\0" | cat - full_backup.tar > full_backup.ab
The printf line writes the 24‑byte header required by ADB. The header fields are:
ANDROID BACKUP10 (no compression because we already have a plain tar)adb restore full_backup.ab
The phone will show a “Restore data” screen. If you set a password when the backup was originally created (you didn’t in this tutorial), you’ll be asked to enter it now.
.ab file is encrypted. The conversion command in Step 3 will fail because OpenSSL expects raw data. Either redo the backup without a password or use the androidbackup tool to decrypt it.dd: cannot skip 24 bytes or openssl: error:06065064dd (Git Bash, Cygwin, macOS/Linux). Windows cmd does not have dd built‑in.android-backup-extractor.jar and run:
java -jar abe.jar unpack full_backup.ab full_backup.tar
This tool does the same header‑skip and decompression work.li>
openssl md5 full_backup.tar.enc
.ab header you recreated matches the format expected by the device (the printf command above is the safest method).android:allowBackup attribute to false. In that case you’ll need to back up those apps individually with adb pull /data/data/…, which requires root.If the ADB backup method feels too heavyweight, consider these options:
.tar, compress it with zip -e (or 7‑Zip) to get a password‑protected archive. This is less robust than OpenSSL’s AES‑256, but easier on Windows..tar in a cloud folder encrypted with rclone crypt. This adds off‑site redundancy.By following the six steps above you gain a portable, strongly encrypted snapshot of every app’s data on your Android device. The workflow is deliberately split into three logical phases – capture (ADB backup), transform (convert to tar), and protect (OpenSSL encryption) – so you can swap out any part if your environment changes. Whether you’re safeguarding game progress, business notes, or a personal finance app, this method gives you full control over where the data lives and who can read it.
Remember: backups are only useful when they’re restorable. Test the decryption and restore process at least once after creating a backup, and keep the encryption password safe. With these habits in place, you’ll never have to worry about losing critical Android app data again.









