コード例 #1
0
        private void TestWithSecretUtf8CharsWithClosedSecretShouldFail(ISecureMemoryAllocator protectedMemoryAllocator)
        {
            Debug.WriteLine("TestWithSecretUtf8CharsWithClosedSecretShouldFail");
            char[]             secretChars = { 'a', 'b' };
            SecureMemorySecret secret      =
                SecureMemorySecret.FromCharArray(secretChars, protectedMemoryAllocator, configuration);

            secret.Close();
            Assert.Throws <InvalidOperationException>(() => { secret.WithSecretUtf8Chars(decryptedChars => true); });
        }
コード例 #2
0
 private void TestWithSecretUtf8CharsAction(ISecureMemoryAllocator protectedMemoryAllocator)
 {
     Debug.WriteLine("TestWithSecretUtf8CharsAction");
     char[] secretChars = { 'a', 'b' };
     using (SecureMemorySecret secret =
                SecureMemorySecret.FromCharArray(secretChars, protectedMemoryAllocator, configuration))
     {
         secret.WithSecretUtf8Chars(decryptedChars =>
         {
             Assert.Equal(secretChars, decryptedChars);
         });
     }
 }