Open NicolasBuquet opened 5 months ago
The Secure backup key verification fails here in the matrix-ios-sdk :
func validPrivateKey(forRecoveryKey recoveryKey: String, for keyBackupVersion: MXKeyBackupVersion) throws -> Data {
let key = try BackupRecoveryKey.fromBase58(key: recoveryKey)
guard key.megolmV1PublicKey().publicKey == publicKey(for: keyBackupVersion) else {
throw Error.invalidPrivateKey
}
let privateKey = try MXRecoveryKey.decode(recoveryKey)
log.debug("Created valid private key from recovery key")
return privateKey
}
Printing description of JSONDictionary:
{
algorithm = "m.megolm_backup.v1.curve25519-aes-sha2";
"auth_data" = {
"public_key" = qUqwkb21yIJbeconn6wPivnpydHMBhnbHNV8QWyxrwY;
signatures = {
"@xxxxx.yyyyyyy-beta.gouv.fr:agent.dinum.tchap.gouv.fr" = {
"ed25519:YPJAZRHKVW" = "xexoRSskmVDb4HT0did...G1wXsOzas6R7LfNzLA/eU44UdxgNQZHah9w2sborqf/+GBw";
"ed25519:r5lpLNTV+66IGMBbJFKk2uJGmmmkHP7Zo1oedzyBzfM" = "Mx6SdshgOm+zlYn0RITvXjR1ku...T0r4B0VoSG33Ut5sF7lDFRKaATTS1XNBmWPUNiErlICg";
};
};
};
count = 8934;
etag = 45;
version = 30;
}
publicKey
evaluation inside Xcode session :recoveryKey.megolmV1PublicKey().publicKey
[MXCryptoSDK] DEBUG matrix_sdk_crypto_ffi::backup_recovery_key: megolm_v1_public_key
"yE6IkfNFJT8wltlLtn/w7zXPSLSGLVFl/wFEgHi2KXQ"
key.megolmV1PublicKey().publicKey
[MXCryptoSDK] DEBUG matrix_sdk_crypto_ffi::backup_recovery_key: megolm_v1_public_key
"5IvnKhpDt4e/diKoGSU7Vc2rAiNmZHtFXJvX0wh1iFU"
@pixlwave can you evaluate the severity of this issue?
Steps to reproduce
Outcome
What did you expect?
I expected the Element iOS app to accept the new Secure backup key and restore the messages.
What happened instead?
The Secure Backup key is refused by Element iOS although it is the active Secure Backup code on the account.
Video showing the bug
https://github.com/element-hq/element-ios/assets/18608158/dc7cbf12-e35d-4896-ac1b-cf4eeccf5da5
Your phone model
iPhone 15 Pro simulator
Operating system version
iOS 17.0
Application version
Element iOS 1.11.5
Homeserver
matrix.org
Will you send logs?
No