예제 #1
0
        public void ProvideHashCode_Empty_Test()
        {
            // arrange in ctor

            // act
            var hashCode1 = _auth.Encrypt();
            var hashCode2 = _auth.Encrypt();

            // assert
            Assert.IsInstanceOfType(hashCode1, typeof(string));
            Assert.IsInstanceOfType(hashCode2, typeof(string));
            Assert.AreNotEqual(hashCode1, hashCode2);
        }
예제 #2
0
        public ProtectedBinary Protect(ProtectedBinary key)
        {
            byte[] data          = key.ReadData();
            byte[] encryptedData = null;
            try
            {
                encryptedData = _cryptProvider.Encrypt(data);

                var result = new ProtectedBinary(true, encryptedData);
                return(result);
            }
            finally
            {
                MemUtil.ZeroByteArray(data);
                if (encryptedData != null)
                {
                    MemUtil.ZeroByteArray(encryptedData);
                }
            }
        }
 public byte[] Encrypt(byte[] data)
 {
     return(_winHelloProvider.Encrypt(data));
 }