Skip to content

fix: address v1.23 settings and EC SSH regressions - #180

Merged
pando85 merged 1 commit into
mainfrom
fix/v1.23-regressions
Sep 23, 2026
Merged

pando85 merged 1 commit into
mainfrom
fix/v1.23-regressions

Conversation

@pando85

@pando85 pando85 commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fix two regressions observed after the v1.23.0 release:

  • restore Git/SSH authentication with Android Keystore-backed EC private keys under SSHJ 0.41.1
  • stop constructing the OpenPGP backend before SettingsActivity is attached to its base context

Git / EC private-key regression

v1.23.0 upgraded SSHJ from 0.40.0 to 0.41.1. Existing Android Keystore-backed EC SSH keys can then fail during Git operations with:

cannot identify EC private key: java.security.InvalidKeyException: no encoding for EC private key

APS already disables BouncyCastle before handing an Android Keystore key to SSHJ because those private keys are intentionally non-exportable and must be used through the platform provider.

SSHJ 0.41.1 changed SecurityUtils.setSecurityProvider(null) so that it also resets the BouncyCastle registration mode to automatic. APS was doing:

SecurityUtils.setRegisterBouncyCastle(false)
SecurityUtils.setSecurityProvider(null)

The second call therefore undid the first one. On the next signature operation SSHJ could select the full BC provider installed by APS. BC cannot reconstruct a non-exportable Android Keystore EC private key from getEncoded() and fails with the reported exception.

Fix the provider setup order:

SecurityUtils.setSecurityProvider(null)
SecurityUtils.setRegisterBouncyCastle(false)

This keeps SSHJ 0.41.1 while ensuring Android Keystore-backed keys are signed by the platform provider.

Settings crash

SettingsActivity constructs its settings providers as property initializers, before the Activity has been attached to its base Context and before onCreate() runs.

The OpenPGP provider integration added this eager initialization to PGPSettings:

private val backend = OpenPgpApiBackend(activity.applicationContext)

That reads activity.applicationContext during SettingsActivity construction, when the Activity is not yet attached. The crash therefore happens while opening Settings, before the OpenPGP provider picker is ever used.

Fix it by constructing OpenPgpApiBackend lazily, so applicationContext is only read after the Activity is attached. The Activity Result interaction handler remains eagerly registered because launchers must be registered before the activity reaches STARTED.

Scope

No OpenPGP encryption/decryption behavior is changed. The delegated-provider feature remains available, provider discovery behavior is unchanged, and SSHJ remains on 0.41.1.

@pando85
pando85 force-pushed the fix/v1.23-regressions branch 2 times, most recently from 4537b95 to 4ea307e Compare September 23, 2026 15:33
@forkline-bot

forkline-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

The spotless formatting violation in PGPSettings.kt from the failed CI run on commit 185c95d is already fixed in the current branch head (4ea307e). Verified locally: ./gradlew spotlessCheck passes cleanly. CI should pass on the next run.

@forkline-bot

forkline-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

✅ Fix pushed:

The spotless formatting violation in PGPSettings.kt was already fixed in the current branch head (4ea307e). Verified locally that ./gradlew spotlessCheck passes cleanly. Posted a status comment to PR #180.

@forkline-bot

forkline-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

⏸️ CI Auto-Fix paused

A user commit was detected after an automated fix. CI auto-fix is now paused
to prevent conflicts with your changes.

To resume CI auto-fix, use the /reset or /reset-ci-auto-fix command.

@pando85
pando85 force-pushed the fix/v1.23-regressions branch from 50e476b to 9cc70e9 Compare September 23, 2026 15:40
@pando85
pando85 enabled auto-merge September 23, 2026 15:42
@pando85
pando85 merged commit 8b92e95 into main Sep 23, 2026
5 checks passed
@pando85
pando85 deleted the fix/v1.23-regressions branch September 23, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant