public void CanBeDecryptedWithDerivedPassword() { byte[] derivedKey1 = new byte[16] { 111, 222, 31, 47, 75, 168, 78, 13, 61, 118, 221, 18, 213, 104, 15, 16 }; byte[] derivedKey2 = new byte[16] { 111, 222, 31, 47, 75, 168, 78, 13, 61, 118, 221, 18, 213, 104, 15, 15 }; byte[] initialCounter = new byte[] { 0xa7, 0xb1, 0xcb, 0xcd, 0xaa, 0xc5, 0xd3, 0xb5, 0x58, 0x51, 0x95, 0x2b, 0x33, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 256, settingsAES_CTR); string keyIdentifier = "primary"; // Act LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformation, keyIdentifier, skaAES_CTR, derivedKey1); // Assert Assert.IsTrue(loginInformationSecret.CanBeDecryptedWithDerivedPassword(derivedKey1)); Assert.IsFalse(loginInformationSecret.CanBeDecryptedWithDerivedPassword(null)); Assert.IsFalse(loginInformationSecret.CanBeDecryptedWithDerivedPassword(new byte[] {})); Assert.IsFalse(loginInformationSecret.CanBeDecryptedWithDerivedPassword(derivedKey2)); }