MuntashirAkon/AppManager · error · BackupException

Failed to get crypto

Error message

Failed to get crypto 

What it means

SBConverter.convert throws BackupException('Failed to get crypto <crypto>') when ConvertUtils.getV5Metadata throws CryptoException while building destination metadata, i.e. a Crypto instance for the configured destination crypto scheme (mDestMetadata.info.crypto) could not be instantiated.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/SBConverter.java:112

    }

    @Override
    public void convert() throws BackupException {
        // Source metadata
        BackupMetadataV2 sourceMetadata = generateMetadata();
        // Simulate a backup creation
        try {
            mBackupItem = BackupItems.createBackupItemGracefully(mUserId, "SB", mPackageName);
        } catch (IOException e) {
            throw new BackupException("Could not get backup files.", e);
        }
        boolean backupSuccess = false;
        try {
            try {
                // Destination metadata
                mDestMetadata = ConvertUtils.getV5Metadata(sourceMetadata, 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);
            }
            // Backup icon
            backupIcon();
            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()) {

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Check that mDestMetadata.info.crypto names a supported crypto mode for this build
  2. Supply the correct password/key parameters for the destination crypto
  3. Set the destination crypto to none/CryptoUtils.CRYPTO_MODE_NO_ENCRYPT if encryption is not required
  4. Update App Manager if the source used an older/newer crypto scheme
Defensive patterns

Strategy: validation

Validate before calling

int mode = mDestMetadata.info.crypto;
if (!CryptoUtils.isCryptoModeCrypto(mode) /* unsupported scheme */ && mode != CryptoUtils.CRYPTO_MODE_NO_ENCRYPT) {
    throw new IllegalArgumentException("Unsupported destination crypto mode: " + mode);
}

Try / catch

try {
    converter.convert(...);
} catch (BackupException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Failed to get crypto")) {
        // fall back to NO_ENCRYPT or prompt user for correct key/password
    }
}

Prevention

When it happens

Trigger: Destination metadata specifies a crypto scheme (e.g. GCM/none/custom) whose Crypto implementation cannot be created — missing key/parameters, unsupported mode, or CryptoException from the crypto factory.

Common situations: Converting a backup whose metadata references a crypto mode unavailable in this build; incorrect password/key material for the destination encryption; version drift where a crypto scheme was renamed or removed.

Related errors


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