private void TestWithSecretUtf8CharsWithClosedSecretShouldFail() { char[] secretChars = { 'a', 'b' }; ProtectedMemorySecret secret = ProtectedMemorySecret.FromCharArray(secretChars, protectedMemoryAllocatorController); secret.Close(); Assert.Throws <InvalidOperationException>(() => { secret.WithSecretUtf8Chars(decryptedChars => true); }); }
private void TestWithSecretUtf8CharsWithClosedSecretShouldFail(IProtectedMemoryAllocator protectedMemoryAllocator) { Debug.WriteLine("TestWithSecretUtf8CharsWithClosedSecretShouldFail"); char[] secretChars = { 'a', 'b' }; ProtectedMemorySecret secret = ProtectedMemorySecret.FromCharArray(secretChars, protectedMemoryAllocator, configuration); secret.Close(); Assert.Throws <InvalidOperationException>(() => { secret.WithSecretUtf8Chars(decryptedChars => true); }); }
private void TestWithSecretUtf8CharsAction() { char[] secretChars = { 'a', 'b' }; using (ProtectedMemorySecret secret = ProtectedMemorySecret.FromCharArray(secretChars, protectedMemoryAllocatorController)) { secret.WithSecretUtf8Chars(decryptedChars => { Assert.Equal(secretChars, decryptedChars); }); } }
private void TestWithSecretUtf8CharsAction(IProtectedMemoryAllocator protectedMemoryAllocator) { Debug.WriteLine("TestWithSecretUtf8CharsAction"); char[] secretChars = { 'a', 'b' }; using (ProtectedMemorySecret secret = ProtectedMemorySecret.FromCharArray(secretChars, protectedMemoryAllocator, configuration)) { secret.WithSecretUtf8Chars(decryptedChars => { Assert.Equal(secretChars, decryptedChars); }); } }