beemdevelopment/Aegis · error

Unsupported Algorithm

Error message

Unsupported Algorithm: %s

What it means

When encoding to a migration payload, getUri maps the OtpInfo's algorithm string to the protobuf Algorithm enum. Only SHA1, SHA256, SHA512, and MD5 are supported by the Google Authenticator format; any other algorithm string hits the default branch and throws a GoogleAuthInfoException.

Solutions

  1. Re-key the token with a supported algorithm (SHA1/SHA256/SHA512/MD5) before exporting
  2. Filter out entries with unsupported algorithms instead of failing the export
  3. Extend the switch to map additional algorithms if the target format supports them

Example fix

// before
TotpInfo info = new TotpInfo(secret, "SHA3-256", 6, 30); // then export
// after
TotpInfo info = new TotpInfo(secret, "SHA256", 6, 30); // then export
Defensive patterns

Strategy: validation

Validate before calling

Set<String> supported = Set.of("SHA1", "SHA256", "SHA512", "MD5");
if (!supported.contains(entry.getInfo().getAlgorithm(false))) { /* skip entry */ }

Try / catch

try {
    uri = GoogleAuthInfo.getUri(entry);
} catch (GoogleAuthInfoException e) {
    skipped.add(entry); // unsupported algorithm for Google export
}

Prevention

When it happens

Trigger: Calling GoogleAuthInfo.getUri (via export/exportGoogleUris) on an entry whose info.getOtpInfo().getAlgorithm(false) is not one of SHA1/SHA256/SHA512/MD5 (case per the switch).

Common situations: Custom algorithm values from fork-specific token types (e.g. 'SHA3-512' or steam-style entries), or databases with algorithm strings outside the standard set.

Related errors


AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08). Data as JSON: /api/errors/f6dc11d8027ea310. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java:426

                        .setSecret(ByteString.copyFrom(info.getOtpInfo().getSecret()))
                        .setName(info.getAccountName())
                        .setIssuer(info.getIssuer());

                switch (info.getOtpInfo().getAlgorithm(false)) {
                    case "SHA1":
                        parameters.setAlgorithm(GoogleAuthProtos.MigrationPayload.Algorithm.ALGORITHM_SHA1);
                        break;
                    case "SHA256":
                        parameters.setAlgorithm(GoogleAuthProtos.MigrationPayload.Algorithm.ALGORITHM_SHA256);
                        break;
                    case "SHA512":
                        parameters.setAlgorithm(GoogleAuthProtos.MigrationPayload.Algorithm.ALGORITHM_SHA512);
                        break;
                    case "MD5":
                        parameters.setAlgorithm(GoogleAuthProtos.MigrationPayload.Algorithm.ALGORITHM_MD5);
                        break;
                    default:
                        throw new GoogleAuthInfoException(info.getUri(), String.format("Unsupported Algorithm: %s", info.getOtpInfo().getAlgorithm(false)));
                }

                switch (info.getOtpInfo().getDigits()) {
                    case 6:
                        parameters.setDigits(GoogleAuthProtos.MigrationPayload.DigitCount.DIGIT_COUNT_SIX);
                        break;
                    case 8:
                        parameters.setDigits(GoogleAuthProtos.MigrationPayload.DigitCount.DIGIT_COUNT_EIGHT);
                        break;
                    default:
                        throw new GoogleAuthInfoException(info.getUri(), String.format("Unsupported number of digits: %s", info.getOtpInfo().getDigits()));
                }

                switch (info.getOtpInfo().getType().toLowerCase()) {
                    case HotpInfo.ID:
                        parameters.setType(GoogleAuthProtos.MigrationPayload.OtpType.OTP_TYPE_HOTP);
                        parameters.setCounter(((HotpInfo) info.getOtpInfo()).getCounter());
                        break;

View on GitHub (pinned to d6f4e5925a)