MuntashirAkon/AppManager · error · BackupException

KeyStore file verification failed.\nFile: ${file}\nFound: ${

Error message

KeyStore file verification failed.\nFile: ${file}\nFound: ${checksum}\nRequired: ${mChecksum.get(file.getName())}

What it means

Before restoring, each keystore file's checksum is recomputed with the backup's checksum algorithm and compared against the checksums recorded at backup time. This error means a keystore file failed checksum verification — its content differs from what was backed up (corruption or tampering). Restore is aborted to avoid installing wrong keystore material.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:429

    private void restoreKeyStore() throws BackupException {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
            // keystore v2 is not supported.
            Log.w(TAG, "Ignoring KeyStore backups for %s", mPackageName);
            return;
        }
        if (mPackageInfo == null) {
            throw new BackupException("KeyStore restore is requested but the app isn't installed.");
        }
        Path[] keyStoreFiles = mBackupItem.getKeyStoreFiles();
        if (keyStoreFiles.length == 0) {
            throw new BackupException("KeyStore files should've existed but they didn't");
        }
        if (!mRequestedFlags.skipSignatureCheck()) {
            String checksum;
            for (Path file : keyStoreFiles) {
                checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, file);
                if (!checksum.equals(mChecksum.get(file.getName()))) {
                    throw new BackupException("KeyStore file verification failed." +
                            "\nFile: " + file +
                            "\nFound: " + checksum +
                            "\nRequired: " + mChecksum.get(file.getName()));
                }
            }
        }
        // Decrypt sources
        try {
            keyStoreFiles = mBackupItem.decrypt(keyStoreFiles);
        } catch (IOException e) {
            throw new BackupException("Failed to decrypt " + Arrays.toString(keyStoreFiles), e);
        }
        // Restore KeyStore files to the /data/misc/keystore folder
        Path keyStorePath = KeyStoreUtils.getKeyStorePath(mUserId);
        // Note down UID/GID
        UidGidPair uidGidPair;
        int mode;
        try {

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Re-transfer the backup and retry — corruption during copy is the usual cause.
  2. Verify the checksums file and checksumAlgo match the backup; re-create the backup if mismatched.
  3. Skip signature check only if you accept the risk (mRequestedFlags.skipSignatureCheck()).
  4. Compare found vs required checksums in the message to identify which file is bad and replace just that file.
Defensive patterns

Strategy: validation

Validate before calling

String found = DigestUtils.getHexDigest(algo, file);
if (!found.equals(expectedChecksums.get(file.getName()))) rejectFile(file, found, expectedChecksums.get(file.getName()));

Try / catch

for (Path file : keyStoreFiles) { if (!checksum.equals(mChecksum.get(file.getName()))) throw new BackupException("KeyStore file verification failed..." ); } // catch per-file to report which file mismatched

Prevention

When it happens

Trigger: DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, file) does not equal mChecksum.get(file.getName()) for some keystore file; occurs when checksum verification is enabled (skipSignatureCheck is false).

Common situations: Files corrupted during transfer (USB copy, cloud sync truncation); checksum file from a different backup version; wrong checksumAlgo metadata; editing/renaming backup files manually.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/9447680f0404e4d6. Report an issue: GitHub.