public static void de() { var recoveryFileStream = new RecoveryFileStream(); var byteFile = recoveryFileStream.Read(@"J:\bitlockerauto.rp"); //var bytes = Encoding.UTF8.GetBytes(byteFile); //var str2 = Encoding.UTF8.GetString(bytes); var aes = new AESUtil(); var afterAESStr = aes.AesDecrypt(byteFile, key); Console.WriteLine("解密:" + afterAESStr); }
private void Submit() { var recoveryFileStream = new RecoveryFileStream(); if (string.IsNullOrEmpty(_driveName))//判断当前选中磁盘名 { var xml = new XMLOperation(); _driveName = xml.GetNodeValue("/root/user/currentdrivename"); } var byteFile = recoveryFileStream.Read($@".\Data\bla_{_driveName}.rp"); if (0 == byteFile.Length) { btnErrorHint.Content = "未找到用户密钥文件"; btnErrorHint.Visibility = Visibility.Visible; ClearSimplePassword(); return; } var aes = new AESUtil(); var afterAESStr = aes.AesDecrypt(byteFile, _key); if (string.IsNullOrEmpty(afterAESStr)) { btnErrorHint.Content = "密钥文件解析失败"; btnErrorHint.Visibility = Visibility.Visible; ClearSimplePassword(); return; } var bl = new BitLockerExecute(_driveNumber[0].ToString()); if (!bl.Unlock(afterAESStr)) { btnErrorHint.Content = "加载了非此驱动器的密钥文件"; btnErrorHint.Visibility = Visibility.Visible; ClearSimplePassword(); return; } _onWindowCloseCallback(); Close(); }