Back Up and Encrypt Android App Data with ADB and OpenSSL

13 min read Step‑by‑step guide to create a local backup of Android app data using ADB and protect it with OpenSSL encryption, all without rooting the device. October 01, 2026 07:00 How to Back Up and Encrypt Android App Data with ADB and OpenSSL (No Root)

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.

Before you start

  • Enable Developer Options on your phone: Settings ▶ About phone ▶ Tap Build number seven times.
  • Activate USB debugging: Settings ▶ System ▶ Developer options ▶ Toggle USB debugging on.
  • Make sure the phone is charged above 50 % and connected to a reliable USB‑A or USB‑C port.
  • Install ADB platform‑tools on your computer (download from the official Android developer site).
  • Install OpenSSL:
    • Windows: choco install openssl (requires Chocolatey) or use the pre‑built binaries.
    • macOS: brew install openssl.
    • Linux: sudo apt install openssl (Debian/Ubuntu) or the equivalent for your distro.
  • Pick a secure password you can remember but that isn’t easy to guess. Write it down in a password manager; losing it means you cannot decrypt the backup.

Step 1 – Verify ADB connectivity

  1. Open a terminal (Command Prompt, PowerShell, Terminal, etc.).
  2. Run adb devices. You should see a line like xxxxxxxxxxxx device. If the device shows as unauthorized, check your phone’s prompt and tap Allow.
  3. If no devices appear, reconnect the USB cable, try a different port, and ensure the correct USB mode (usually File Transfer / MTP).

Step 2 – Identify the package name of the app you want to back up

  1. On the phone, go to Settings ▶ Apps, locate the app, and tap it. The package name often appears at the bottom of the screen; if not, continue to the next sub‑step.
  2. In the terminal, type 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.

Step 3 – Create an unencrypted ADB backup

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.

  1. Run the following, replacing 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.
  2. When the phone shows the “Full backup” dialog, you will be asked to set a password. Leave it blank for an unencrypted file (we’ll encrypt it in the next step). Tap Back up my data.
  3. After the progress bar disappears, verify the file exists in the folder where you ran the command.

Step 4 – Encrypt the backup with OpenSSL

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.

  1. Open a terminal in the same directory as the .ab file.
  2. Run the encryption command (replace 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.
  3. After the command finishes, you’ll have myapp_backup.ab.enc. The original .ab file can now be deleted if you wish to keep only the encrypted version.

Step 5 – Verify the encrypted archive

It’s easy to forget to test decryption before you need the backup. Run a quick sanity check:

  1. Decrypt to a temporary file:
    openssl enc -d -aes-256-cbc -in myapp_backup.ab.enc -out temp_backup.ab -pass pass:mysecurepassword
  2. Inspect the size of 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.
  3. Optional: list the contents of the .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.

Step 6 – Restoring the backup

When you need to bring the data back to the same or a different device, follow these steps:

  1. Decrypt the encrypted file:
    openssl enc -d -aes-256-cbc -in myapp_backup.ab.enc -out myapp_backup.ab -pass pass:mysecurepassword
  2. Connect the target phone, enable USB debugging, and verify it appears with adb devices.
  3. Run the restore command:
    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).
  4. Wait for the progress bar. When it disappears, open the app to confirm that the data appears as expected.

Alternative workflow: Encrypt the .ab file directly during backup

ADB 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.

Common pitfalls and troubleshooting

  • Backup fails with “Backup failed”: Some apps disable ADB backup via the 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.
  • OpenSSL reports “bad decrypt”: Most likely the password entered during decryption does not match the one used for encryption. Double‑check spelling, case, and any trailing spaces.
  • ADB says “device unauthorized”: Re‑connect the phone, revoke USB debugging authorisations (Settings ▶ Developer options ▶ Revoke USB debugging authorisations), then accept the new prompt.
  • File size is 0 KB: The backup command may have completed before the phone finished writing data. Ensure you tap “Back up my data” on the phone and wait for the progress bar to finish.
  • Restoring to a different device fails: The target device must run the same or a newer Android version and the app must be installed (or the backup must contain the APK). Use -apk during backup or install the app manually before restoring.

Security considerations

  • Store the encrypted backup in a location that is itself protected (e.g., an encrypted folder, a cloud service with zero‑knowledge encryption, or a USB‑OTG stick that you keep physically secure).
  • Never share the password in plain text. If you need to transmit the backup, send the password through a separate channel (e.g., a secure messaging app).
  • Remember that the backup contains raw app data, which may include login tokens, personal notes, or cached files. Treat it as sensitive as you would the original device.

When to use this method vs. full device backup

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.

Wrapping up

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.

User Comments (0)

Add Comment
We'll never share your email with anyone else.