我在 MySQL 中加密了数据,将其存储为 BLOB,然后需要在 C# 中对其进行解密,但没有得到预期的结果。
MYSQL 中的 BLOB:

这是我的结果:

应该只是PD001KY6900430
这是我的 C# 代码
string ConnectionString = "Data Source=win-3doecchgfbt;Initial Catalog=DWH;User id=sa;Password=Password123;";
using (SqlConnection connection = new SqlConnection(ConnectionString))
{
string query = "SELECT * FROM tb_investor";
SqlDataAdapter adapter = new SqlDataAdapter();
var command = new SqlCommand(query, connection);
adapter.SelectCommand = command;
DataTable dTable = new DataTable();
adapter.Fill(dTable);
for(var x =0; x < dTable.Rows.Count; x++)
{
var dr = dTable.Rows;
byte[] accNoByte = (byte[])dr[x].ItemArray[1];
byte[] key = mkey("satu");
var rkey = BitConverter.ToString(key).Replace("-", ""); …Run Code Online (Sandbox Code Playgroud)