Modern Apps git

← Modern-Apps.git

e2ee: drop legacy RSA path and dev.whyoleg.cryptography dep

Commit
cc21b2c3c9f9859130f0af1920aee99913ea6389
Author
vayun-mathur <[email protected]>
When
2026-09-04 14:29 UTC (3 months ago)
Parents
8c56c02

Diff

SUPPLY_CHAIN_RISKS.md
diff --git a/SUPPLY_CHAIN_RISKS.md b/SUPPLY_CHAIN_RISKS.mdindex cdec62b4f3..50057d7c9c 100644--- a/SUPPLY_CHAIN_RISKS.md+++ b/SUPPLY_CHAIN_RISKS.md@@ -155,7 +155,6 @@ Summed old per-crate locks (before workspace) = 712 total (641 excluding voxels) | `com.github.luben:zstd-jni` via JitPack | — | see `libs.versions.toml` | The only remaining JitPack coordinate. Third-party rather than a personal fork, so lower risk than `Stockfish-Library` was | `settings.gradle.kts` | | `jitpack.io` itself | — | above | Supply chain SPOF | `settings.gradle.kts` | | `io.github.dokar3:quickjs-kt` | `1.0.5` | `youpipe` | Single maintainer (dokar3), JS eval for YouTube signature decipher — critical path | `youpipe/build.gradle.kts`, `libs.versions.toml:8` |-| `dev.whyoleg.cryptography:cryptography-core` + `cryptography-provider-jdk` | `0.6.0` | `library:e2ee-p2p` → `office` E2EE | Single person (whyoleg), crypto-critical for PQC KEM | `library:e2ee-p2p/build.gradle.kts`, `libs.versions.toml:75` | | `org.linguafranca.pwdb:KeePassJava2-dom` | `2.2.4` | `passwords` | Single maintainer, last release 2021, security-sensitive KDBX parsing | `passwords/build.gradle.kts`, `libs.versions.toml:82` | | `org.wololo:flatgeobuf` | `3.29.0` | `maps` | Niche geo format, single maintainer | `maps/build.gradle.kts`, `libs.versions.toml:13` | | `com.google.code.findbugs:jsr305` + `javax.annotation-api:1.3.2` | `3.0.2` / `1.3.2` | `extractor` | Deprecated 7+ years, replaced by JetBrains annotations | `libs.versions.toml:5,114` |@@ -170,7 +169,6 @@ Summed old per-crate locks (before workspace) = 712 total (641 excluding voxels) | `com.google.mediapipe:tasks-vision` | `0.10.35` (unified) | `camera` (face), vision segmentation | Native lib size; inline `0.10.14` drift resolved | `camera/build.gradle.kts:124`, `libs.versions.toml` | | `net.zetetic:sqlcipher-android` | `4.18.0` | `library:room` → `passwords`, `notes` | Small company, adds ~2MB `.so`, encrypted DB. `4.18.0` is the first release with `SQLCipherDriver` (an `androidx.sqlite.SQLiteDriver`), which is what lets encrypted databases work on Room 3 at all: Room 3 removed `openHelperFactory(...)` | `library/room/build.gradle.kts`, `libs.versions.toml:117` | | `io.coil-kt:coil-compose` + `coil-svg` + `coil-video` | `2.7.0` | `photos`, `maps`, `email`, `travel`, `education`, `pdf` | <3 maintainers, but widely adopted image loader | `libs.versions.toml:50` |-| `org.bouncycastle:bcprov-jdk18on` + `bcpkix-jdk18on` | `1.85` | `pdf`, `passwords`, `messages`, `e2ee-p2p` | Small org, long-lived, well-audited PQC ML-KEM/ML-DSA; resource conflicts handled in `common-conventions-app` | `libs.versions.toml:84,226` | | `com.google.zxing:core` | `3.5.4` | `messages` (QR), `library:ocr`, `pdf` | Old, community fork `zxing-cpp` preferred | `libs.versions.toml:83` | | `com.google.ai.edge.litertlm:litertlm-android` | `0.14.0` experimental | `openassistant` | Google AI Edge experimental, GPU backend `libLiteRtTopKOpenClSampler.so`, requires `kotlinx-coroutines 1.11.0` conflict win | `openassistant/build.gradle.kts`, `libs.versions.toml:30` | 
findfamily/src/main/java/com/vayunmathur/findfamily/data/FFDatabase.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/data/FFDatabase.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/data/FFDatabase.ktindex f6240b4e5e..fe63ba62e7 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/data/FFDatabase.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/data/FFDatabase.kt@@ -119,9 +119,6 @@ interface UserDao {     @Query("UPDATE User SET locationName = :locationName, lastWaypointId = :lastWaypointId, lastLocationChangeTime = :lastLocationChangeTime WHERE id = :id")     suspend fun updateLocationMeta(id: Long, locationName: String, lastWaypointId: Long?, lastLocationChangeTime: Long) -    @Query("UPDATE User SET encryptionKey = :encryptionKey WHERE id = :id")-    suspend fun setEncryptionKey(id: Long, encryptionKey: String)-     @Query("UPDATE User SET pqcEncryptionKey = :pqcEncryptionKey WHERE id = :id")     suspend fun setPqcEncryptionKey(id: Long, pqcEncryptionKey: String) 
gradle/libs.versions.toml
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex f3a8210475..2bd7610053 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -77,8 +77,6 @@ protobufJavalite = "4.35.0" # protobufJavalite above and are the most likely first build-friction point. grpc = "1.69.0" grpcKotlin = "1.4.1"-# BouncyCastle: ed25519 verification of Accrescent's signify-signed repodata (:appstore).-bouncycastle = "1.79" # @javax.annotation.Generated referenced by grpc-java generated stubs. javaxAnnotation = "1.3.2" jsr305 = "3.0.2"@@ -107,7 +105,6 @@ quickjs = "1.0.5" jgit = "6.10.1.202505221210-r"  # Crypto, security & credential storage-cryptographyCore = "0.6.0" sqlcipherAndroid = "4.18.0" # Pinned at 0.101.0, not Maven Central's newest (0.86.5): the CDSI enclave identity is compiled into the # native library, and 0.86.5/0.92.0 carry a retired MRENCLAVE, so contact discovery requests@@ -258,7 +255,6 @@ grpc-stub = { module = "io.grpc:grpc-stub", version.ref = "grpc" } grpc-kotlin-stub = { module = "io.grpc:grpc-kotlin-stub", version.ref = "grpcKotlin" } grpc-protoc-gen-java = { module = "io.grpc:protoc-gen-grpc-java", version.ref = "grpc" } grpc-protoc-gen-kotlin = { module = "io.grpc:protoc-gen-grpc-kotlin", version.ref = "grpcKotlin" }-bouncycastle-bcprov = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncycastle" } javax-annotation-api = { module = "javax.annotation:javax.annotation-api", version.ref = "javaxAnnotation" } google-jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "jsr305" } zxing-core = { module = "com.google.zxing:core", version.ref = "zxing" }@@ -283,8 +279,6 @@ quickjs-kt = { module = "io.github.dokar3:quickjs-kt", version.ref = "quickjs" } jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "jgit" }  # Crypto, security & credential storage-cryptography-core = { module = "dev.whyoleg.cryptography:cryptography-core", version.ref = "cryptographyCore" }-cryptography-provider-jdk = { module = "dev.whyoleg.cryptography:cryptography-provider-jdk", version.ref = "cryptographyCore" } sqlcipher-android = { module = "net.zetetic:sqlcipher-android", version.ref = "sqlcipherAndroid" } libsignal-android = { module = "org.signal:libsignal-android", version.ref = "libsignalAndroid" } ringrtc-android = { module = "org.signal:ringrtc-android", version.ref = "ringrtcAndroid" }
library/e2ee-p2p/build.gradle.kts
diff --git a/library/e2ee-p2p/build.gradle.kts b/library/e2ee-p2p/build.gradle.ktsindex dde155c04d..9752118d88 100644--- a/library/e2ee-p2p/build.gradle.kts+++ b/library/e2ee-p2p/build.gradle.kts@@ -22,9 +22,3 @@ androidComponents { // armeabi-v7a as well as arm64: :cast:tv runs on 32-bit-userspace Google TV hardware // and links this .so. Phone apps filter it back out via their arm64-only abiFilters. rustNativeLib("e2ee_pqc", "e2ee-pqc", extraAbis = listOf(ABI_ARMV7))--dependencies {-    implementation(libs.cryptography.core)-    implementation(libs.cryptography.provider.jdk)--}
library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2ee.kt
diff --git a/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2ee.kt b/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2ee.ktindex 2fb567c28f..1dec387f72 100644--- a/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2ee.kt+++ b/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2ee.kt@@ -1,83 +1,19 @@ package com.vayunmathur.e2ee -import dev.whyoleg.cryptography.CryptographyProvider-import dev.whyoleg.cryptography.algorithms.RSA-import dev.whyoleg.cryptography.algorithms.SHA512 import java.security.SecureRandom import javax.crypto.Cipher import javax.crypto.spec.GCMParameterSpec import javax.crypto.spec.SecretKeySpec  /**- * Shared end-to-end-encryption operations used across apps so they always use identical techniques:- *  - **asymmetric** (RSA-OAEP): encrypt small payloads / wrap keys to a peer's public key,- *  - **symmetric** (AES-256-GCM): encrypt document content with a random content key,- *  - **verification**: the [SecurityCode] safety number from two public keys.+ * Shared **symmetric** encryption primitives (AES-256-GCM), used across apps so content is always+ * encrypted the same way: take a key from [newContentKey], then [aesEncrypt] / [aesDecrypt] with it.  *- * The hybrid pattern for sharing a document: generate a content key with [newContentKey], encrypt- * the document with [aesEncrypt], and give each recipient the content key wrapped via [encryptTo]- * (to their public key). Recipients [E2eeIdentity.decrypt] the wrapped key, then [aesDecrypt].+ * [Pqc] builds on this as well — `Pqc.encryptTo` / `Pqc.decrypt` AES-encrypt the payload under the+ * ML-KEM shared secret. For asymmetric operations (encrypting to a peer, signatures, and the+ * [SecurityCode] safety number) use [Pqc] and [PqcIdentity].  */ object E2ee {-    private val rsa get() = CryptographyProvider.Default.get(RSA.OAEP)--    /** Decodes a peer's public key from PEM bytes. */-    suspend fun decodePublicKeyPem(pem: ByteArray): RSA.OAEP.PublicKey =-        rsa.publicKeyDecoder(SHA512).decodeFromByteArray(RSA.PublicKey.Format.PEM, pem)--    /** Encrypts a (small) payload to a recipient identified by their PEM public key. */-    suspend fun encryptTo(recipientPublicKeyPem: ByteArray, plaintext: ByteArray): ByteArray =-        decodePublicKeyPem(recipientPublicKeyPem).encryptor().encrypt(plaintext)--    /** Canonical DER form of a PEM public key (stable across incidental formatting differences). */-    suspend fun canonicalDer(pem: ByteArray): ByteArray =-        decodePublicKeyPem(pem).encodeToByteArray(RSA.PublicKey.Format.DER)--    // --- Signatures (SHA256withRSA / PKCS#1 v1.5 — available on Android, unlike RSASSA-PSS) -----    private fun pemToDer(pem: ByteArray): ByteArray {-        val body = pem.decodeToString().lineSequence().filterNot { it.startsWith("-----") }.joinToString("").trim()-        return java.util.Base64.getDecoder().decode(body)-    }--    /** Signs [data] with a private key (PEM). Used to authenticate op authorship / owner roster changes. */-    fun sign(privateKeyPem: ByteArray, data: ByteArray): ByteArray {-        val key = java.security.KeyFactory.getInstance("RSA")-            .generatePrivate(java.security.spec.PKCS8EncodedKeySpec(pemToDer(privateKeyPem)))-        return java.security.Signature.getInstance("SHA256withRSA").run {-            initSign(key); update(data); sign()-        }-    }--    /** Verifies a signature produced by [sign] against a public key (PEM). */-    fun verify(publicKeyPem: ByteArray, data: ByteArray, signature: ByteArray): Boolean = runCatching {-        val key = java.security.KeyFactory.getInstance("RSA")-            .generatePublic(java.security.spec.X509EncodedKeySpec(pemToDer(publicKeyPem)))-        java.security.Signature.getInstance("SHA256withRSA").run {-            initVerify(key); update(data); verify(signature)-        }-    }.getOrDefault(false)--    /**-     * Verification security code between this device and a peer, from their PEM public keys.-     * Identical on both devices; compare out-of-band to confirm no key was substituted.-     */-    suspend fun securityCode(myPublicKeyPem: ByteArray, peerPublicKeyPem: ByteArray): String =-        SecurityCode.compute(canonicalDer(myPublicKeyPem), canonicalDer(peerPublicKeyPem))--    /** Generates a fresh RSA keypair (e.g. for an anonymous share link), returned as PEM bytes. */-    suspend fun generateKeyPair(): KeyPairPem {-        val kp = rsa.keyPairGenerator(digest = SHA512).generateKey()-        return KeyPairPem(-            kp.publicKey.encodeToByteArray(RSA.PublicKey.Format.PEM),-            kp.privateKey.encodeToByteArray(RSA.PrivateKey.Format.PEM),-        )-    }--    class KeyPairPem(val publicKeyPem: ByteArray, val privateKeyPem: ByteArray)--    // --- Symmetric content encryption (AES-256-GCM) ----     private const val GCM_TAG_BITS = 128     private const val IV_LEN = 12 @@ -100,29 +36,4 @@ object E2ee {         cipher.init(Cipher.DECRYPT_MODE, SecretKeySpec(key, "AES"), GCMParameterSpec(GCM_TAG_BITS, iv))         return cipher.doFinal(ct)     }--    // --- Hybrid encryption (arbitrary-length payloads to a public key) -----    /**-     * Seals an **arbitrary-length** payload to a recipient's public key: a fresh AES key encrypts-     * the payload, and only that 32-byte key is RSA-wrapped (so the RSA-OAEP size limit never-     * applies to the payload). Layout: `[2-byte wrappedKeyLen][wrappedKey][aes(iv||ct)]`.-     */-    suspend fun sealTo(recipientPublicKeyPem: ByteArray, plaintext: ByteArray): ByteArray {-        val cek = newContentKey()-        val wrapped = encryptTo(recipientPublicKeyPem, cek)-        val ct = aesEncrypt(cek, plaintext)-        val out = ByteArray(2 + wrapped.size + ct.size)-        out[0] = ((wrapped.size ushr 8) and 0xFF).toByte()-        out[1] = (wrapped.size and 0xFF).toByte()-        wrapped.copyInto(out, 2)-        ct.copyInto(out, 2 + wrapped.size)-        return out-    }--    /** Splits a [sealTo] blob into its wrapped-key and ciphertext parts. */-    internal fun splitSealed(data: ByteArray): Pair<ByteArray, ByteArray> {-        val len = ((data[0].toInt() and 0xFF) shl 8) or (data[1].toInt() and 0xFF)-        return data.copyOfRange(2, 2 + len) to data.copyOfRange(2 + len, data.size)-    } }
library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2eeIdentity.kt
diff --git a/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2eeIdentity.kt b/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2eeIdentity.ktdeleted file mode 100644index e45232ef3f..0000000000--- a/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2eeIdentity.kt+++ /dev/null@@ -1,85 +0,0 @@-package com.vayunmathur.e2ee--import dev.whyoleg.cryptography.CryptographyProvider-import dev.whyoleg.cryptography.algorithms.RSA-import dev.whyoleg.cryptography.algorithms.SHA512--/**- * A device's long-lived end-to-end-encryption identity: an RSA-OAEP keypair generated on-device and- * persisted via an [E2eeKeyStore]. The private key never leaves the device; the public key is what- * you register in a directory / embed in a share link so others can encrypt to you.- *- * All apps share this so key generation, storage, and formats are identical and interoperable.- */-class E2eeIdentity internal constructor(-    /** This identity's public key in PEM bytes (as stored / registered). */-    val publicKeyPem: ByteArray,-    private val privateKeyPem: ByteArray,-    private val publicKey: RSA.OAEP.PublicKey,-    private val privateKey: RSA.OAEP.PrivateKey,-) {-    /** Canonical DER encoding of the public key (stable fingerprint input). */-    suspend fun publicKeyDer(): ByteArray = publicKey.encodeToByteArray(RSA.PublicKey.Format.DER)--    /** Decrypts data that was encrypted to this identity's public key (see [E2ee.encryptTo]). */-    suspend fun decrypt(ciphertext: ByteArray): ByteArray = privateKey.decryptor().decrypt(ciphertext)--    /** Signs [data] with this identity's private key (authenticates authorship). */-    suspend fun sign(data: ByteArray): ByteArray = E2ee.sign(privateKeyPem, data)--    /** Reverses [E2ee.sealTo]: unwraps the AES key with the private key, then AES-decrypts. */-    suspend fun unseal(data: ByteArray): ByteArray {-        val (wrapped, ct) = E2ee.splitSealed(data)-        val cek = decrypt(wrapped)-        return E2ee.aesDecrypt(cek, ct)-    }--    companion object {-        private val provider get() = CryptographyProvider.Default.get(RSA.OAEP)--        /**-         * Loads the persisted keypair, generating and storing a new one on first use. Uses the same-         * [E2eeKeyStore] keys across launches so a device keeps a stable identity.-         *-         * Fixed race: after attempting to store a newly-generated keypair with `onlyIfAbsent=true`-         * we re-read the final persisted values. If another concurrent initializer won the race-         * (fresh install with UI + service both starting), we return the winner's keys from disk-         * instead of an ephemeral pair that would fail to decrypt peer ciphertexts-         * (OAEP_DECODING_ERROR).-         */-        suspend fun loadOrCreate(-            store: E2eeKeyStore,-            publicName: String = "publicKey",-            privateName: String = "privateKey",-        ): E2eeIdentity {-            val p = provider-            val pubBytes = store.getBytes(publicName)-            val privBytes = store.getBytes(privateName)-            if (pubBytes != null && privBytes != null) {-                return E2eeIdentity(-                    pubBytes,-                    privBytes,-                    p.publicKeyDecoder(SHA512).decodeFromByteArray(RSA.PublicKey.Format.PEM, pubBytes),-                    p.privateKeyDecoder(SHA512).decodeFromByteArray(RSA.PrivateKey.Format.PEM, privBytes),-                )-            }-            val kp = p.keyPairGenerator(digest = SHA512).generateKey()-            val pubPem = kp.publicKey.encodeToByteArray(RSA.PublicKey.Format.PEM)-            val privPem = kp.privateKey.encodeToByteArray(RSA.PrivateKey.Format.PEM)-            store.setBytes(publicName, pubPem, onlyIfAbsent = true)-            store.setBytes(privateName, privPem, onlyIfAbsent = true)-            // Re-read final persisted values to handle concurrent winners.-            val finalPub = store.getBytes(publicName) ?: pubPem-            val finalPriv = store.getBytes(privateName) ?: privPem-            if (finalPub.contentEquals(pubPem) && finalPriv.contentEquals(privPem)) {-                return E2eeIdentity(finalPub, finalPriv, kp.publicKey, kp.privateKey)-            }-            return E2eeIdentity(-                finalPub,-                finalPriv,-                p.publicKeyDecoder(SHA512).decodeFromByteArray(RSA.PublicKey.Format.PEM, finalPub),-                p.privateKeyDecoder(SHA512).decodeFromByteArray(RSA.PrivateKey.Format.PEM, finalPriv),-            )-        }-    }-}
library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2eeKeyStore.kt
diff --git a/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2eeKeyStore.kt b/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2eeKeyStore.ktindex 270a63506e..51c850342f 100644--- a/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2eeKeyStore.kt+++ b/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/E2eeKeyStore.kt@@ -1,7 +1,7 @@ package com.vayunmathur.e2ee  /**- * Minimal persistence abstraction used by [E2eeIdentity] to store the device keypair. Apps adapt+ * Minimal persistence abstraction used by [PqcIdentity] to store the device keypair. Apps adapt  * their own secure storage (e.g. an encrypted DataStore) to this interface so the e2ee module stays  * decoupled from any particular storage implementation.  */
library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/SecurityCode.kt
diff --git a/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/SecurityCode.kt b/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/SecurityCode.ktindex d4deb3d834..d682e41a8d 100644--- a/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/SecurityCode.kt+++ b/library/e2ee-p2p/src/main/java/com/vayunmathur/e2ee/SecurityCode.kt@@ -9,8 +9,9 @@ import java.security.MessageDigest  * each other's genuine keys — i.e. no one (not the server) substituted a key to intercept the  * end-to-end-encrypted channel.  *- * Inputs are the **canonical DER** encodings of the public keys (see [E2ee.canonicalDer]) so the- * result is independent of incidental PEM formatting differences.+ * Inputs are each side's public key material exactly as it is held and exchanged — [Pqc.securityCode]+ * passes the raw public bundles, with no re-encoding. It is the canonical *ordering* of the two+ * fingerprints, not any canonical encoding, that makes both devices arrive at the same code.  */ object SecurityCode { 
library/e2ee-p2p/src/test/java/com/vayunmathur/e2ee/PqcTest.kt
diff --git a/library/e2ee-p2p/src/test/java/com/vayunmathur/e2ee/PqcTest.kt b/library/e2ee-p2p/src/test/java/com/vayunmathur/e2ee/PqcTest.ktindex a4e7c8a8dc..fe56c0bb2a 100644--- a/library/e2ee-p2p/src/test/java/com/vayunmathur/e2ee/PqcTest.kt+++ b/library/e2ee-p2p/src/test/java/com/vayunmathur/e2ee/PqcTest.kt@@ -28,7 +28,7 @@ class PqcTest {         val (kemPub, kemPriv) = Pqc.generateKem()         val (dsaPub, _) = Pqc.generateDsa()         val bundle = Pqc.bundle(kemPub, dsaPub)-        val msg = "post-quantum hello — a longer payload than RSA-OAEP could ever hold in one shot".encodeToByteArray()+        val msg = "post-quantum hello — a payload comfortably longer than one KEM ciphertext".encodeToByteArray()         val ct = Pqc.encryptTo(bundle, msg)         assertContentEquals(msg, Pqc.decrypt(kemPriv, ct))     }
library/e2ee-p2p/src/test/java/com/vayunmathur/e2ee/SignTest.kt
diff --git a/library/e2ee-p2p/src/test/java/com/vayunmathur/e2ee/SignTest.kt b/library/e2ee-p2p/src/test/java/com/vayunmathur/e2ee/SignTest.ktdeleted file mode 100644index e2b479b105..0000000000--- a/library/e2ee-p2p/src/test/java/com/vayunmathur/e2ee/SignTest.kt+++ /dev/null@@ -1,20 +0,0 @@-package com.vayunmathur.e2ee--import kotlinx.coroutines.runBlocking-import kotlin.test.Test-import kotlin.test.assertFalse-import kotlin.test.assertTrue--class SignTest {-    @Test-    fun sign_verify_roundtrip_reusing_identity_key() = runBlocking {-        val kp = E2ee.generateKeyPair() // OAEP-generated key, reused for PSS signatures-        val data = "the quick brown fox".encodeToByteArray()-        val sig = E2ee.sign(kp.privateKeyPem, data)-        assertTrue(E2ee.verify(kp.publicKeyPem, data, sig), "valid signature verifies")-        assertFalse(E2ee.verify(kp.publicKeyPem, "different".encodeToByteArray(), sig), "tampered data fails")--        val other = E2ee.generateKeyPair()-        assertFalse(E2ee.verify(other.publicKeyPem, data, sig), "wrong key fails")-    }-}