示例#1
0
 public static LoginSimplified TurnIntoEditable(LoginInformation loginInformation, int zeroBasedIndexNumber)
 {
     return(new LoginSimplified()
     {
         zeroBasedIndexNumber = zeroBasedIndexNumber,
         IsSecure = false,
         Title = loginInformation.GetTitle(),
         URL = loginInformation.GetURL(),
         Email = loginInformation.GetEmail(),
         Username = loginInformation.GetUsername(),
         Password = loginInformation.GetPassword(),
         Notes = loginInformation.GetNotes(),
         Icon = loginInformation.GetIcon(),
         Category = loginInformation.GetCategory(),
         Tags = loginInformation.GetTags(),
         CreationTime = loginInformation.GetCreationTime().ToString("s", System.Globalization.CultureInfo.InvariantCulture),
         ModificationTime = loginInformation.GetModificationTime().ToString("s", System.Globalization.CultureInfo.InvariantCulture),
     });
 }
        public void GetCreationTimeTest()
        {
            // Arrange
            byte[] derivedKey = new byte[16] {
                111, 222, 31, 4, 5, 68, 78, 83, 9, 110, 211, 128, 213, 104, 15, 16
            };
            byte[] initialCounter = new byte[] { 0xf0, 0xf1, 0xfb, 0xf3, 0xaa, 0xc5, 0xd6, 0xbb, 0xf8, 0x19, 0x11, 0xfb, 0x33, 0xfd, 0xfe, 0xff };

            SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter);

            SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR);

            LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformation, "does not matter", skaAES_CTR, derivedKey);

            // Act
            DateTimeOffset loginInformationCreationTime = loginInformationSecret.GetCreationTime(derivedKey);

            // Assert
            Assert.AreEqual(loginInformation.GetCreationTime(), loginInformationCreationTime);
        }