Many Android users need a quick way to safeguard the data inside a specific app—whether it’s a game save, a private journal, or a work‑related database—without resorting to a full device backup or rooting the phone. The Android Debug Bridge (ADB) can pull a per‑app backup file, and OpenSSL can turn that file into a strong, password‑protected archive.
This tutorial assumes you have a PC (Windows, macOS, or Linux) with administrative rights and a USB cable that can transfer data.
Build number seven times.USB debugging on.choco install openssl (requires Chocolatey) or use the pre‑built binaries.brew install openssl.sudo apt install openssl (Debian/Ubuntu) or the equivalent for your distro.adb devices. You should see a line like xxxxxxxxxxxx device. If the device shows as unauthorized, check your phone’s prompt and tap Allow.adb shell pm list packages | grep -i "appname", replacing appname with a keyword from the app’s title. Example output: package:com.example.myapp. The string after package: is the package name.ADB can export a .ab file that contains the app’s APK (optional) and its private data. The command below backs up only the data, which keeps the file smaller and avoids the need to reinstall the APK later.
com.example.myapp with your package name:
adb backup -f myapp_backup.ab -noapk -nosystem -shared -all -apk -f myapp_backup.ab com.example.myapp
-f myapp_backup.ab – output file on the computer.-noapk – skips the APK; only data is saved.-nosystem – excludes system apps.-shared – includes files on the shared storage that belong to the app.-apk – optional; include if you want the APK as well.Now that you have myapp_backup.ab, we’ll wrap it in AES‑256‑CBC encryption. This method is compatible with any modern OS and does not require special Android tools.
.ab file.mysecurepassword with the password you noted earlier):
openssl enc -aes-256-cbc -salt -in myapp_backup.ab -out myapp_backup.ab.enc -pass pass:mysecurepassword
-aes-256-cbc – strong symmetric cipher.-salt – adds random data to prevent dictionary attacks.-pass pass:… – supplies the password directly; you can also use -pass file:pwd.txt for better security.myapp_backup.ab.enc. The original .ab file can now be deleted if you wish to keep only the encrypted version.It’s easy to forget to test decryption before you need the backup. Run a quick sanity check:
openssl enc -d -aes-256-cbc -in myapp_backup.ab.enc -out temp_backup.ab -pass pass:mysecurepassword
temp_backup.ab. It should be similar to the original unencrypted file. If the size is zero or the command reports an error, re‑enter the password and try again..ab file with adb restore in “dry‑run” mode (available on Android 7+). This step is not mandatory but gives confidence that the archive is intact.When you need to bring the data back to the same or a different device, follow these steps:
openssl enc -d -aes-256-cbc -in myapp_backup.ab.enc -out myapp_backup.ab -pass pass:mysecurepassword
adb devices.adb restore myapp_backup.ab
The phone will display a “Full restore” dialog. Tap Restore my data and, if prompted, enter the same password you used when creating the backup (leave blank if you didn’t set one)..ab file directly during backupADB supports a password prompt that encrypts the .ab file on the device. If you prefer a single step, you can set a password when running the backup command (omit -noapk if you also want the APK). The downside is that the encryption algorithm used by ADB is older (AES‑128 with a static salt) and cannot be customised. For stronger security, the OpenSSL method described above is recommended.
android:allowBackup="false" manifest flag. In that case you cannot back up the data without root. Look for an alternative export option inside the app or use the app’s own cloud sync.-apk during backup or install the app manually before restoring.The ADB‑OpenSSL workflow shines when you only need a single app’s data, want to keep the backup size minimal, or wish to move data between devices that cannot share the same Google account. A full‑device backup (via adb backup -all) is convenient for cloning a phone, but it creates a much larger file and may include apps you don’t intend to migrate.
By combining the universal ADB backup tool with OpenSSL’s proven encryption, you gain a portable, root‑free solution for protecting Android app data. The steps above cover preparation, backup creation, encryption, verification, and restoration, along with a troubleshooting guide for the most common hiccups. Keep your password safe, store the encrypted file in a secure location, and you’ll have peace of mind that your app’s data is both backed up and shielded from prying eyes.









