/
Secure Storage Testing

Secure Storage Testing

The app uses an encrypted Realm.io database to store sensitive location information. For debug builds, we can add log statements to each platform that can print out the hex encoded encryption key.

Get Encryption Key

Android

// RealmSecureStorage.kt getEncryptionKey() // find where the key is generated and add the last line below. val newKey = ByteArray(64) SecureRandom().nextBytes(newKey) Log.d("EncryptionKey", newKey.asUByteArray().joinToString("") { it.toString(16).padStart(2, '0') })

iOS

// RealmSecureStorage.swift getEncryptionKey() // find where the key is generated and add the last line below. let keyData = NSMutableData(length: 64)! let result = SecRandomCopyBytes(kSecRandomDefault, 64, keyData.mutableBytes.bindMemory(to: UInt8.self, capacity: 64)) assert(result == 0, "Failed to get random bytes") if (result != 0) { return nil } print (keyData.map {String (format: "% .2hhx", $0)}.joined())

Download Database From Device

Android

  1. Enable USB debugging

  2. Open the Device File Explorer in Android Studio

  3. Navigate to data/data/org.pathcheck.covidsafepaths/files

  4. Right click on safepaths.realm and save as to your preferred location

  5. Open your safepaths.realm file in Realm Studio https://realm.io/products/realm-studio/

  6. When asked, paste in the encryption key captured from earlier

iOS

  1. Open Xcode -> Window - Devices and Simulators

  2. Select your device on the left hand side

  3. In the middle of the screen, you should see the Safe Paths app under the "Installed Apps" heading

  4. Click on the gear beneath and click Download Container

  5. Right click on the download <filename>.xcappdata folder and show package contents

  6. Open default.realm found in AppData/Documents using Realm Studio https://realm.io/products/realm-studio/