Exemplo n.º 1
0
        public Masterkey(byte[] keyBytes)
        {
            var encryptedKey = CryptMemoryProtection.EncryptInMemoryData(keyBytes);

            Value        = encryptedKey;
            encryptedKey = null;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Takes a byte array and stores it savely in the <see cref="_secureDatacache"/>
        /// </summary>
        internal void AddToSecureMemoryDC(Guid foreignKey, byte[] modelBytes)
        {
            CheckDatacache();
            var encrpytedBytes = CryptMemoryProtection.EncryptInMemoryData(modelBytes);

            modelBytes = null;
            _secureDatacache.Add(foreignKey, encrpytedBytes);
        }
Exemplo n.º 3
0
        private void Apply_Button_Click(object sender, RoutedEventArgs e)
        {
            // If the pw hasnt been changed, return false.
            if (_pwAtStart == Password_Textbox.Text)
            {
                Password_Textbox.Text = string.Empty;
                _pwAtStart            = string.Empty;
                DialogResult          = false;
                return;
            }
            else if (Password_Textbox.Text == string.Empty)
            {
                Information_Textblock.Text = "An empty password is not an option.";
                return;
            }

            // A bit ugly to put 3 methods into each other, but I want to avoid creating many extra variables when handling sensible data.
            ChangedPasswordEncrypted = CryptMemoryProtection.EncryptInMemoryData(ByteHelper.StringToByteArray(Password_Textbox.Text));
            Password_Textbox.Text    = string.Empty;
            _pwAtStart   = string.Empty;
            DialogResult = true;
        }