public void MachineCannotReadUser() { var protector = new AspNetWrapper(); var entropy = new byte[] { 24, 76, 211, 4, 255 }; var encrypted = protector.Protect(_sampleBytes, entropy, DataProtectionScope.CurrentUser); Assert.ThrowsAny <CryptographicException>(() => protector.Unprotect(encrypted, entropy, DataProtectionScope.LocalMachine)); }
public void DifferentEntropyFailsUser() { var protector = new AspNetWrapper(); var entropy1 = new byte[] { 24, 76, 211, 4, 255 }; var entropy2 = new byte[] { 24, 76, 211, 4, 254 }; var encrypted = protector.Protect(_sampleBytes, entropy1, DataProtectionScope.CurrentUser); Assert.ThrowsAny <CryptographicException>(() => protector.Unprotect(encrypted, entropy2, DataProtectionScope.CurrentUser)); }