private void BtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (CheckNumber())
            {
                var list = new List <string>();
                foreach (var tb in _textBoxes)
                {
                    list.Add(tb.Text);
                }
                string RecoveryPassword = string.Join("-", list.ToArray());
                var    bytes            = Encoding.UTF8.GetBytes(RecoveryPassword);
                string str2             = Encoding.UTF8.GetString(bytes);

                var key                = "12345678876543211234567887654abc";
                var aes                = new AESUtil();
                var afterAESStr        = aes.AesEncrypt(RecoveryPassword, key);
                var recoveryFileStream = new RecoveryFileStream();
                var result             = recoveryFileStream.Write(@".\Data\", $"bla_{_driveName}.rp", afterAESStr);
                if (result)
                {
                    new AlertWindow("创建密钥文件成功!").Show();
                }
                else
                {
                    new AlertWindow("创建密钥文件失败!").Show();
                }
            }
        }
Esempio n. 2
0
        public static void ae()
        {
            var    bytes = Encoding.UTF8.GetBytes(RecoveryPassword);
            string str2  = Encoding.UTF8.GetString(bytes);

            var aes                = new AESUtil();
            var afterAESStr        = aes.AesEncrypt(RecoveryPassword, key);
            var recoveryFileStream = new RecoveryFileStream();

            recoveryFileStream.Write(@"J:\bitlockerauto.rp", afterAESStr);
        }
        private void SavePassword()
        {
            string password   = pboxPassword1.Password;
            string secretCode = new AppConfigOperation().Read("AppSecret");
            var    aesUtil    = new AESUtil();
            var    byteDatas  = aesUtil.AesEncrypt(password, secretCode);
            var    strData    = Encoding.UTF8.GetString(byteDatas);
            var    xml        = new XMLOperation();

            if (xml.SetNodeValue("/root/user/unlockpassword", strData))
            {
                new AlertWindow("设置密码成功!").Show();
                Close();
            }
            else
            {
                new AlertWindow("设置密码失败!").Show();
            }
        }