private void TestCopySecret() { byte[] secretBytes = { 0, 1 }; using (ProtectedMemorySecret secret = new ProtectedMemorySecret((byte[])secretBytes.Clone(), protectedMemoryAllocatorController)) { using (ProtectedMemorySecret secretCopy = (ProtectedMemorySecret)secret.CopySecret()) { secretCopy.WithSecretBytes(decryptedBytes => { Assert.Equal(secretBytes, decryptedBytes); }); } } }
private void TestCopySecret(IProtectedMemoryAllocator protectedMemoryAllocator) { Debug.WriteLine("TestCopySecret"); byte[] secretBytes = { 0, 1 }; using (ProtectedMemorySecret secret = new ProtectedMemorySecret((byte[])secretBytes.Clone(), protectedMemoryAllocator, configuration)) { using (ProtectedMemorySecret secretCopy = (ProtectedMemorySecret)secret.CopySecret()) { secretCopy.WithSecretBytes(decryptedBytes => { Assert.Equal(secretBytes, decryptedBytes); }); } } }