public void GetModificationTimeTest() { // Arrange byte[] derivedKey = new byte[16] { 15, 200, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xf0, 0xf1, 0xfb, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xf3, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR); string title = "Wishlist for holidays"; string text = "peace, happiness, freedom"; Note note = new Note(title, text); NoteSecret noteSecret = new NoteSecret(note, "does not matter", skaAES_CTR, derivedKey); // Act DateTimeOffset modificationTime1 = noteSecret.GetModificationTime(derivedKey); Thread.Sleep(1100); noteSecret.SetNoteTitle("1234567", derivedKey); DateTimeOffset modificationTime2 = noteSecret.GetModificationTime(derivedKey); // Assert Assert.Greater(modificationTime2, modificationTime1); }
public static NoteSimplified TurnIntoEditable(NoteSecret noteSecret, byte[] derivedPassword, int zeroBasedIndexNumber) { return(new NoteSimplified() { zeroBasedIndexNumber = zeroBasedIndexNumber, IsSecure = true, Title = noteSecret.GetNoteTitle(derivedPassword), Text = noteSecret.GetNoteText(derivedPassword), CreationTime = noteSecret.GetCreationTime(derivedPassword).ToString("s", System.Globalization.CultureInfo.InvariantCulture), ModificationTime = noteSecret.GetModificationTime(derivedPassword).ToString("s", System.Globalization.CultureInfo.InvariantCulture), }); }