public void GetLoginInformationTagsTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 47, 75, 168, 78, 83, 91, 110, 221, 18, 213, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xa0, 0xb1, 0xcb, 0xfd, 0xaa, 0xc5, 0xd5, 0xb5, 0x58, 0x59, 0x15, 0xfb, 0x33, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 256, settingsAES_CTR); LoginInformation loginInformationModified = loginInformation.ShallowCopy(); loginInformationModified.UpdateTags("personal"); LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformationModified, "does not matter", skaAES_CTR, derivedKey); // Act string loginInformationTags = loginInformationSecret.GetTags(derivedKey); // Assert Assert.IsFalse(string.IsNullOrEmpty(loginInformationTags)); Assert.AreEqual(loginInformationModified.tags, loginInformationTags); }
public static LoginSimplified TurnIntoEditable(LoginInformationSecret loginInformationSecret, byte[] derivedPassword, int zeroBasedIndexNumber) { return(new LoginSimplified() { zeroBasedIndexNumber = zeroBasedIndexNumber, IsSecure = true, Title = loginInformationSecret.GetTitle(derivedPassword), URL = loginInformationSecret.GetURL(derivedPassword), Email = loginInformationSecret.GetEmail(derivedPassword), Username = loginInformationSecret.GetUsername(derivedPassword), Password = loginInformationSecret.GetPassword(derivedPassword), Notes = loginInformationSecret.GetNotes(derivedPassword), Icon = loginInformationSecret.GetIcon(derivedPassword), Category = loginInformationSecret.GetCategory(derivedPassword), Tags = loginInformationSecret.GetTags(derivedPassword), CreationTime = loginInformationSecret.GetCreationTime(derivedPassword).ToString("s", System.Globalization.CultureInfo.InvariantCulture), ModificationTime = loginInformationSecret.GetModificationTime(derivedPassword).ToString("s", System.Globalization.CultureInfo.InvariantCulture), }); }
public void SetLoginInformationTagsTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 104, 15, 16 }; SymmetricKeyAlgorithm ska = SymmetricKeyAlgorithm.GenerateNew(SymmetricEncryptionAlgorithm.AES_CTR); LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformation, "does not matter", ska, derivedKey); string newTags = "Finance; Home; Travel; Future"; // Act bool shouldBeTrue = loginInformationSecret.SetTags(newTags, derivedKey); string loginInformationTags2 = loginInformationSecret.GetTags(derivedKey); bool shouldBeFalse = loginInformationSecret.SetTags(newTags, new byte[] { 13, 129, 0, 91, 194, 255, 0 }); // Assert Assert.IsTrue(shouldBeTrue); Assert.IsFalse(shouldBeFalse); Assert.IsFalse(string.IsNullOrEmpty(loginInformationTags2)); Assert.AreEqual(newTags, loginInformationTags2); }