aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/test/java
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-03 09:48:36 +0100
committerDanilo M. <danix@danix.xyz>2026-11-03 09:49:56 +0100
commita3c105af9adb2b45ad52fe47218cc8827741dca9 (patch)
tree9cc96c54598262e217a5227cbb6deaeb57339511 /app/src/test/java
parentcb10a78f9de660be32c16f08404137334541d4c0 (diff)
downloadHardenedPass-a3c105af9adb2b45ad52fe47218cc8827741dca9.tar.gz
HardenedPass-a3c105af9adb2b45ad52fe47218cc8827741dca9.zip
fix(git): get sshj's Ed25519 keys from Bouncy Castle
Recent Conscrypt (Android 14 mainline updates) registers a KeyFactory for Ed25519. With sshj leaving provider selection to the JCA, its Ed25519KeyFactory now gets Conscrypt's key class, whose algorithm name sshj does not map to ssh-ed25519: KeyType.fromKey returns UNKNOWN and every Ed25519 host key fails with "Don't know how to encode key", so clone and sync over SSH break. 0.1.4 is affected since the sshj 0.41.2 update. Register a provider at position 1 that serves only KeyFactory.Ed25519 from Bouncy Castle (kept by the existing R8 rule). Everything else, including signatures with Android Keystore keys, still goes through normal JCA provider selection. Verified on an Android 14 tablet: clone over SSH failed before and works with the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit ad3c63f665e6264ed1db42d6ae2dfc0947e33393)
Diffstat (limited to 'app/src/test/java')
-rw-r--r--app/src/test/java/app/passwordstore/util/git/sshj/SshjConfigTest.kt14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/src/test/java/app/passwordstore/util/git/sshj/SshjConfigTest.kt b/app/src/test/java/app/passwordstore/util/git/sshj/SshjConfigTest.kt
index af6eee47..e4bc3eec 100644
--- a/app/src/test/java/app/passwordstore/util/git/sshj/SshjConfigTest.kt
+++ b/app/src/test/java/app/passwordstore/util/git/sshj/SshjConfigTest.kt
@@ -6,7 +6,11 @@
package app.passwordstore.util.git.sshj
import kotlin.test.Test
+import kotlin.test.assertEquals
import kotlin.test.assertNull
+import kotlin.test.assertTrue
+import net.schmizz.sshj.common.Ed25519KeyFactory
+import net.schmizz.sshj.common.KeyType
import net.schmizz.sshj.common.SecurityUtils
class SshjConfigTest {
@@ -19,4 +23,14 @@ class SshjConfigTest {
setUpBouncyCastleForSshj()
assertNull(SecurityUtils.getSecurityProvider())
}
+
+ // Conscrypt's Ed25519 keys map to KeyType.UNKNOWN in sshj, so Ed25519 keys must come from
+ // Bouncy Castle whatever provider the platform puts first.
+ @Test
+ fun ed25519KeysComeFromBouncyCastle() {
+ setUpBouncyCastleForSshj()
+ val key = Ed25519KeyFactory.getPublicKey(ByteArray(32) { 1 })
+ assertTrue(key.javaClass.name.startsWith("org.bouncycastle."), key.javaClass.name)
+ assertEquals(KeyType.ED25519, KeyType.fromKey(key))
+ }
}