MuntashirAkon/AppManager · error · BackupException

Failed to get crypto " + mDestMetadata.info.crypto

Error message

Failed to get crypto " + mDestMetadata.info.crypto

What it means

ConvertUtils.getV5Metadata builds the App Manager v5 metadata from OAndBackup metadata and may need a Crypto instance matching metadata.info.crypto. If instantiating it throws CryptoException, convert() wraps it as BackupException("Failed to get crypto " + mDestMetadata.info.crypto).

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java:125

    public void convert() throws BackupException {
        if (SPECIAL_BACKUPS.contains(mPackageName)) {
            throw new BackupException("Cannot convert special backup " + mPackageName);
        }
        // Source metadata
        mSourceMetadata = readLogFile();
        // Simulate a backup creation
        try {
            mBackupItem = BackupItems.createBackupItemGracefully(mUserId, "OAndBackup", mPackageName);
        } catch (IOException e) {
            throw new BackupException("Could not get backup files.", e);
        }
        boolean backupSuccess = false;
        try {
            try {
                // Destination metadata
                mDestMetadata = ConvertUtils.getV5Metadata(mSourceMetadata, mBackupItem);
            } catch (CryptoException e) {
                throw new BackupException("Failed to get crypto " + mDestMetadata.info.crypto, e);
            }
            try {
                mChecksum = mBackupItem.getChecksum();
            } catch (IOException e) {
                throw new BackupException("Failed to create checksum file.", e);
            }
            if (mDestMetadata.info.flags.backupApkFiles()) {
                backupApkFile();
            }
            if (mDestMetadata.info.flags.backupData()) {
                backupData();
            }
            // Write modified metadata
            try {
                Map<String, String> filenameChecksumMap = MetadataManager.writeMetadata(mDestMetadata, mBackupItem);
                for (Map.Entry<String, String> filenameChecksumPair : filenameChecksumMap.entrySet()) {
                    mChecksum.add(filenameChecksumPair.getKey(), filenameChecksumPair.getValue());
                }

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Check App Manager's crypto/encryption settings and keys are available for the named scheme
  2. Convert unencrypted backups, or disable encryption in the destination metadata if encryption is not required
  3. Verify the crypto name in the source .log metadata is supported by this App Manager version
  4. Update App Manager — older versions may lack newer crypto schemes

Example fix

// before
metadata.crypto = "GCM"; // key not present on device
// after
metadata.crypto = null; // or configure keys before converting
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check: only convert unencrypted OAB backups or ones whose crypto is configured
String crypto = sourceMetadata.crypto; // from .log if available
if (crypto != null && !isCryptoConfigured(crypto)) {
    throw new IllegalStateException("Crypto not configured: " + crypto);
}

Try / catch

try {
    converter.convert();
} catch (BackupException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Failed to get crypto")) {
        // configure keys or convert with encryption disabled
    }
}

Prevention

When it happens

Trigger: The converted metadata specifies a crypto scheme (e.g. GCM, RSA) whose setup fails — bad/missing key store entry, unsupported crypto name in metadata, or corrupted crypto parameters in the source log.

Common situations: OAndBackup backup used encryption that App Manager cannot reconstruct; encryption keys absent on the new device; metadata crypto field set to a scheme not configured in App Manager.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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