public void ExportShouldNullifyKey() { SQLiteDatabase db = GetVaultDatabase(); string password = "******"; Vault v = Vault.Retrieve(db, "EncryptedData", password); VaultKeyInfo keyInfo = v.ExportKey(); v.VaultKey.ShouldBeNull(); }
public void _1_1_ShouldThrowIfVaultKeyNotSet() { Expect.Throws(() => { Vault testVault = Vault.Retrieve(nameof(_1_1_ShouldThrowIfVaultKeyNotSet), $"{nameof(_1_1_ShouldThrowIfVaultKeyNotSet)}_password".RandomLetters(8)); VaultKeyInfo keyInfo = testVault.ExportKey(); testVault["should fail"] = "this shouldn't make it into the database"; }, ex => { ex.IsObjectOfType <VaultKeyNotSetException>(); }); }
public void CanExportVaultKey() { SQLiteDatabase db = GetVaultDatabase(); string password = "******"; string sensitiveValue = "Sensitive Value"; string keyName = "SensitiveInformation"; Vault v = Vault.Retrieve(db, "EncryptedData", password); v.Set(keyName, sensitiveValue); VaultKeyInfo keyInfo = v.ExportKey(); string data = v[keyName]; Expect.IsNull(data); OutLine(keyInfo.ToJson()); v.ImportKey(keyInfo); data = v[keyName]; Expect.AreEqual(sensitiveValue, data); }