MuntashirAkon/AppManager · error · BackupException

Could not get crypto " + mBackupInfo.crypto

Error message

Could not get crypto " + mBackupInfo.crypto

What it means

VerifyOp's constructor calls mBackupItem.setCrypto(mBackupInfo.getCrypto()) to instantiate the crypto handler recorded in backup.json. A CryptoException here means the mode is available in principle but the crypto object could not be constructed — bad key material, wrong password, or provider initialization failure. cleanup() runs and this BackupException wraps the cause.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java:50

    VerifyOp(@NonNull BackupItems.BackupItem backupItem) throws BackupException {
        mBackupItem = backupItem;
        try {
            mBackupInfo = mBackupItem.getInfo();
            mBackupFlags = mBackupInfo.flags;
        } catch (IOException e) {
            mBackupItem.cleanup();
            throw new BackupException("Could not read backup info. Possibly due to a malformed json file.", e);
        }
        // Setup crypto
        if (!CryptoUtils.isAvailable(mBackupInfo.crypto)) {
            mBackupItem.cleanup();
            throw new BackupException("Mode " + mBackupInfo.crypto + " is currently unavailable.");
        }
        try {
            mBackupItem.setCrypto(mBackupInfo.getCrypto());
        } catch (CryptoException e) {
            mBackupItem.cleanup();
            throw new BackupException("Could not get crypto " + mBackupInfo.crypto, e);
        }
        try {
            mBackupMetadata = mBackupItem.getMetadata(mBackupInfo).metadata;
        } catch (IOException e) {
            mBackupItem.cleanup();
            throw new BackupException("Could not read backup metadata. Possibly due to a malformed json file.", e);
        }
        // Get checksums
        try {
            mChecksum = mBackupItem.getChecksum();
        } catch (Throwable e) {
            mBackupItem.cleanup();
            throw new BackupException("Could not get checksums.", e);
        }
        // Verify metadata
        try {
            verifyMetadata();
        } catch (BackupException e) {

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Provide the correct password/key material that matches the backup's encryption.
  2. Re-grant OpenPGP (or other provider) access to AppManager in the provider app.
  3. Import the original keystore key to the device before verifying.
  4. Fall back to a fresh unencrypted backup/verify cycle if the key is unrecoverable.

Example fix

// before: keystore key deleted, getCrypto() throws
// after: re-import the key or prompt the user for the password first
String password = promptUserForPassword();
crypto = CryptoUtils.getCrypto(mBackupInfo.crypto, password);
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure key material exists before verification
boolean keyPresent = CryptoUtils.isAvailable(backupInfo.crypto)
        && (keystoreContainsKey(alias) || password != null);

Try / catch

try {
    new VerifyOp(backupItem).verify();
} catch (BackupException e) {
    if (e.getMessage().startsWith("Could not get crypto")) {
        // prompt for password / re-import keystore key, then retry
    }
}

Prevention

When it happens

Trigger: Verifying a backup whose keystore/PGP key is missing or password-protected without the password being supplied, so CryptoUtils can initialize the Crypto interface instance for mBackupInfo.crypto.

Common situations: New device without the original keystore entry, expired/removed PGP key, wrong stored password, or provider (e.g. OpenPGP) installed but not authorized for AppManager.

Related errors


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