Foxtable(狐表)用户栏目专家坐堂 → 请问ASE解密如何解密?


  共有48人关注过本帖树形打印复制链接

主题:请问ASE解密如何解密?

帅哥哟,离线,有人找我吗?
lhpc120
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:636 积分:6346 威望:0 精华:0 注册:2011/5/8 13:21:00
请问ASE解密如何解密?  发帖心情 Post By:2025/1/4 23:14:00 [只看该作者]

Const key As String ="XXXXXXXXXXXXXXXX"
Const iv As String = "XXXXXXXXXXXXXXXX"

Public Function AesEncrypt(ByVal toEncrypt As String) As String
 Dim keyArray As Byte() = UTF8Encoding.UTF8.GetBytes(key)
 Dim ivArray As Byte() = UTF8Encoding.UTF8.GetBytes(iv)
 Dim toEncryptArray As Byte() = UTF8Encoding.UTF8.GetBytes(toEncrypt)
 Dim rDel As SSC.RijndaelManaged = New SSC.RijndaelManaged()
 rDel.Key = keyArray
 rDel.IV = ivArray
 rDel.Mode = SSC.CipherMode.CBC
 rDel.Padding = SSC.PaddingMode.Zeros
 Dim cTransform As SSC.ICryptoTransform = rDel.CreateEncryptor()
 Dim resultArray As Byte() = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length)
 Return Convert.ToBase64String(resultArray, 0, resultArray.Length)
End Function

Public Function AesDecrypt(ByVal toDecrypt As String) As String
 Dim keyArray As Byte() = UTF8Encoding.UTF8.GetBytes(key)
 Dim ivArray As Byte() = UTF8Encoding.UTF8.GetBytes(iv)
 Dim toEncryptArray As Byte() = Convert.FromBase64String(toDecrypt)
 Dim rDel As SSC.RijndaelManaged = New SSC.RijndaelManaged()
 rDel.Key = keyArray
 rDel.IV = ivArray
 rDel.Mode = SSC.CipherMode.CBC
 rDel.Padding = SSC.PaddingMode.Zeros
 Dim cTransform As SSC.ICryptoTransform = rDel.CreateDecryptor()
 Dim resultArray As Byte() = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length)
 Return UTF8Encoding.UTF8.GetString(resultArray)
End Function


比如我有个加密密钥是:1234567890123456
加密后的值为:"SWG12MXQ8evvU1981R0DqnNRL3QqPAn3lT2yXPP6tAn1DW4nB8XUjF9bNgpHK0p/y9MOv2Q6zy03mxOssMBpQ9H+Rz0fMQsxok/AZSF4KqvPHZmHWm7oAq7GRFywwml2p9y0HYi+JLY+y/1a0Z1IQeOXbAHS3D331hwNS5BO2nmFeH/JeH4h9+yKSzKB7nhzv2K9ykdBOrzJrJ3NIJQ0+7+vlzQMrBgH4xK3vDPd+ij+8q89m/uo+57c7j46jyEcdVieNlEo0C2k7TanwWVNPCy5VO08z1OiixspdQ5hu9dsl0J78RxEd4+RkDtkQFvaBQGHoM3lqYcsurCRq3PlUw=="
我想在代码中调用,并传值给函数,怎么使用?


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:111590 积分:568062 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2025/1/5 20:30:00 [只看该作者]

参考这种用法:http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=160819&skin=0

 回到顶部