[WAL-447] feat: Ed25519 + secp256k1 support on iOS/Android#1768
[WAL-447] feat: Ed25519 + secp256k1 support on iOS/Android#1768szijpeter wants to merge 17 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
e5b2384 to
92bd45f
Compare
f88c5bc to
d2f2aa4
Compare
92bd45f to
056528c
Compare
d2f2aa4 to
e783af1
Compare
056528c to
69af854
Compare
e783af1 to
3b66f9a
Compare
69af854 to
02e4409
Compare
3b66f9a to
51e5e46
Compare
02e4409 to
281f0bc
Compare
51e5e46 to
44b530d
Compare
281f0bc to
df9f457
Compare
44b530d to
8c6b5fd
Compare
df9f457 to
b7ac35b
Compare
8c6b5fd to
7962659
Compare
b7ac35b to
9db5ca8
Compare
7962659 to
92556fd
Compare
143be5c to
c5773eb
Compare
92556fd to
2bfda9f
Compare
c5773eb to
6eb4763
Compare
2bfda9f to
7da54e8
Compare
c951d06 to
e2c5347
Compare
26ec99d to
c4d0b40
Compare
e2c5347 to
c82fbd8
Compare
c4d0b40 to
cd1c73e
Compare
3dc5c3f to
3756273
Compare
waltkb
left a comment
There was a problem hiding this comment.
Looks pretty fine in this state already
cd1c73e to
2c1a8c8
Compare
…hy-kotlin Signum only supports NIST curves (P-256/P-384/P-521) and RSA. This adds Ed25519 and secp256k1 as software-backed keys using cryptography-kotlin 0.6.0: - iOS: CryptoKit provider (Ed25519) + OpenSSL3 prebuilt (secp256k1) - Android: JDK provider backed by BouncyCastle Architecture changes: - IosKey/AndroidKey refactored into sealed class with Hardware/Software subclasses - HardwareKeyStore renamed to PlatformKeyStore, supports software key persistence - PlatformKeyProvider extended with loadSoftwareKey/exportSoftwareKeyMaterial - SQLite schema gains key_material column for software key JWK storage - JWKKey.ios.kt gains Ed25519/secp256k1 support via SoftwareKeyOps helper Bug fix: RSA sign/verify was using PKCS1 padding but Signum defaults to PSS.
3756273 to
23eb415
Compare
…5519-secp256k1-mobile # Conflicts: # waltid-libraries/crypto/waltid-crypto/src/androidMain/kotlin/id/walt/crypto/AndroidKey.kt # waltid-libraries/crypto/waltid-crypto/src/iosMain/kotlin/id/walt/crypto/keys/jwk/JWKKey.ios.kt
…5519-secp256k1-mobile
…5519-secp256k1-mobile
|



Summary
Add Ed25519 and secp256k1 support on iOS and Android, addressing the algorithm gap left by Signum (which only supports NIST curves + RSA). Uses cryptography-kotlin 0.6.0 as a supplementary crypto backend for the unsupported algorithms.
Why
Walt-id supports 8 key types. Signum handles 6 (P-256, P-384, P-521, RSA/2048/3072/4096). The 2 it cannot:
These algorithms cannot be hardware-backed on either platform (neither Android KeyStore nor iOS Secure Enclave support them). They are software-backed keys by necessity.
Architecture
No top-level companion / factory — callers go directly to the subclass they need. The type system enforces the distinction.
Persistence:
PlatformKeyStore(renamed fromHardwareKeyStore) stores software key material (JWK) in a SQLite column alongside hardware key metadata. Hardware keys persist in the platform keystore; software keys persist in the database.Platform crypto providers
cryptography-provider-optimal)cryptography-provider-openssl3-prebuilt)cryptography-provider-jdk)cryptography-provider-jdk)Dependency sizes
What changed
Crypto module (
waltid-crypto):IosKey.kt/AndroidKey.kt→ sealed hierarchy withHardware+SoftwaresubclassesJWKKey.ios.kt→ Ed25519/secp256k1 support viaSoftwareKeyOpshelperIosKeyTest.kt,JWKKeyIosTest.kt)AndroidKeyTest.ktwith parameterized hardware + software testsWallet persistence (
waltid-openid4vc-wallet-persistence):HardwareKeyStore→PlatformKeyStore(handles both hardware + software keys)PlatformKeyProviderinterface extended withloadSoftwareKey(),exportSoftwareKeyMaterial(),isHardwareBacked()key_material TEXTcolumn for software key JWK storageIosPlatformKeyProvider/AndroidPlatformKeyProviderupdated to dispatch by key typeJWS construction for EdDSA/ES256K
Signum's
indispensable-josefhas noJwsAlgorithm.EdDSAorJwsAlgorithm.ES256K— its JOSE types are a closed set (EC + RSA only). For software keys, JWS is constructed manually using existing utilities:KeyUtils.rawSignaturePayloadForJws()— builds header + payload base64urlKeyUtils.signJwsWithRawSignature()— concatenates into compact serializationJwsUtils.decodeJwsStrings()— parses JWS for verificationNo new utility files were needed — everything reuses existing code.
Future work
kSecAttrKeyTypeEdDSAsince iOS 13) for OS-level persistence instead of SQLiteTest plan
Related to WAL-447