Merge commit 'aaadcc73674cc8886e363693a7d7c08ac9b4f516' into feature/4260_merge_foss_1_10_2

# Conflicts:
#	Config/AppVersion.xcconfig
#	Podfile
#	Podfile.lock
#	Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift
#	Riot/Modules/Application/LegacyAppDelegate.m
#	Riot/Modules/Authentication/AuthenticationCoordinator.swift
#	Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift
#	Riot/Modules/ContextMenu/ActionProviders/RoomActionProvider.swift
#	Riot/Modules/Home/AllChats/AllChatsViewController.swift
#	Riot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift
#	Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift
#	Riot/Modules/Room/Settings/RoomSettingsViewController.m
#	fastlane/Fastfile
This commit is contained in:
JanNiklas Grabowski
2023-02-15 14:56:55 +01:00
279 changed files with 7285 additions and 2433 deletions
@@ -32,6 +32,7 @@ class EncryptionKeyManager: NSObject, MXKeyProviderDelegate {
private static let cryptoOlmPickleKey = "cryptoOlmPickleKey"
private static let roomLastMessageIv = "roomLastMessageIv"
private static let roomLastMessageAesKey = "roomLastMessageAesKey"
private static let cryptoSDKStoreKey = "cryptoSDKStoreKey"
private var initialized = false
@@ -54,9 +55,11 @@ class EncryptionKeyManager: NSObject, MXKeyProviderDelegate {
generateIvIfNotExists(forKey: EncryptionKeyManager.roomLastMessageIv, inStore: keychainVault)
generateAesKeyIfNotExists(forKey: EncryptionKeyManager.roomLastMessageAesKey, inStore: keychainVault)
generateKeyIfNotExists(forKey: EncryptionKeyManager.cryptoSDKStoreKey, inStore: keychainVault, size: 32)
assert(keychainVault.objectExists(withKey: EncryptionKeyManager.roomLastMessageIv), "[EncryptionKeyManager] initKeys: Failed to generate IV for room last message")
assert(keychainVault.objectExists(withKey: EncryptionKeyManager.roomLastMessageAesKey), "[EncryptionKeyManager] initKeys: Failed to generate AES Key for room last message encryption")
assert(keychainVault.objectExists(withKey: EncryptionKeyManager.cryptoSDKStoreKey), "[EncryptionKeyManager] initKeys: Failed to generate Key for crypto sdk store")
guard !BWIBuildSettings.shared.forcedPinProtection || !SecureFileStorage.shared.locked else {
MXLog.debug("[EncryptionKeyManager] initKeys: cannot init keys as store is not ready")
@@ -79,6 +82,7 @@ class EncryptionKeyManager: NSObject, MXKeyProviderDelegate {
|| dataType == MXKAccountManagerDataType
|| dataType == MXCryptoOlmPickleKeyDataType
|| dataType == MXRoomLastMessageDataType
|| dataType == MXCryptoSDKStoreKeyDataType
}
func hasKeyForData(ofType dataType: String) -> Bool {
@@ -92,7 +96,10 @@ class EncryptionKeyManager: NSObject, MXKeyProviderDelegate {
case MXRoomLastMessageDataType:
return keychainVault.objectExists(withKey: EncryptionKeyManager.roomLastMessageIv) &&
keychainVault.objectExists(withKey: EncryptionKeyManager.roomLastMessageAesKey)
case MXCryptoSDKStoreKeyDataType:
return keychainVault.objectExists(withKey: EncryptionKeyManager.cryptoSDKStoreKey)
default:
MXLog.warning("[EncryptionKeyManager] hasKeyForData: No key for \(dataType)")
return false
}
}
@@ -118,7 +125,12 @@ class EncryptionKeyManager: NSObject, MXKeyProviderDelegate {
let aesKey = try? keychainVault.data(forKey: EncryptionKeyManager.roomLastMessageAesKey) {
return MXAesKeyData(iv: ivKey, key: aesKey)
}
case MXCryptoSDKStoreKeyDataType:
if let key = try? keychainVault.data(forKey: EncryptionKeyManager.cryptoSDKStoreKey) {
return MXRawDataKey(key: key)
}
default:
MXLog.failure("[EncryptionKeyManager] keyDataForData: Attempting to get data for unknown type", dataType)
return nil
}
return nil