public void Should_not_return_original_text_when_decrypting_with_different_keys() { var inputText = "this is some text"; var encText = provider.Encrypt(inputText); var result = new RijndaelEncryptionProvider(new PassphraseKeyGenerator("Wrong", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 })).Decrypt(encText); result.ShouldNotEqual(inputText); }
public CookieBasedSessionsFixture() { this.fakeEncryptionProvider = A.Fake <IEncryptionProvider>(); this.fakeHmacProvider = A.Fake <IHmacProvider>(); this.cookieStore = new CookieBasedSessions(this.fakeEncryptionProvider, this.fakeHmacProvider, new Fakes.FakeObjectSerializer()); this.rijndaelEncryptionProvider = new RijndaelEncryptionProvider(new PassphraseKeyGenerator("password", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 1000)); this.defaultHmacProvider = new DefaultHmacProvider(new PassphraseKeyGenerator("anotherpassword", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 1000)); }
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { Console.WriteLine("App startup"); base.ApplicationStartup(container, pipelines); CryptographyConfiguration defaultCc = CryptographyConfiguration.Default; var customEncryptionProvider = new RijndaelEncryptionProvider(new CustomKeyGenerator()); CryptographyConfiguration customCc = new CryptographyConfiguration(customEncryptionProvider, defaultCc.HmacProvider); CookieBasedSessions.Enable(pipelines, defaultCc); }
public RijndaelEncryptionProviderFixture() { this.provider = new RijndaelEncryptionProvider(new PassphraseKeyGenerator("Passphrase", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 })); }