asp的加密解密问题。请教。

wklx041030 2005-03-17 12:32:38
asp中经常使用加密函数,如md5,rsa。那么这些函数应该存在服务器上。在网络上传递的是密文,当传送到客户端如何对密文解密?
客户端向服务器传诵数据如何对数据加密?(我觉得可能是调用服务器上的函数,那么这个函数就放在了客户机上,那要是被破解了不就完了?)
...全文
193 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
wokeke 2005-06-12
  • 打赏
  • 举报
回复
学习
ShiningstarHu 2005-06-11
  • 打赏
  • 举报
回复
有 PKI . SSL连接,就可以完全解决你的问题。

还有,千万不要用MD5或者SHA1对你的数据进行加密。

MD5和SHA1算法不是用来对数据进行加密的!

如果你不理解MD5或者SHA1的算法,可以看我最近的帖子。

http://community.csdn.net/Expert/TopicView.asp?id=4069250

power_guo 2005-06-11
  • 打赏
  • 举报
回复
asp代码最好的办法就是封装成组件,其他我目前没发现更好的办法。
关注中,期待更多的高手讨论这个问题。
feibar 2005-06-11
  • 打赏
  • 举报
回复
最好在客户端就加密
lovebanyi 2005-06-11
  • 打赏
  • 举报
回复
Private Function EncryptString(strString)
Dim CharHexSet, intStringLen, strTemp, strRAW, i, intKey, intOffSet
Randomize Timer

intKey = Round((RND * 1000000) + 1000000) '##### Key Bitsize
intOffSet = Round((RND * 1000000) + 1000000) '##### KeyOffSet Bitsize

If IsNull(strString) = False Then
strRAW = strString
intStringLen = Len(strRAW)

For i = 0 to intStringLen - 1
strTemp = Left(strRAW, 1)
strRAW = Right(strRAW, Len(strRAW) - 1)
CharHexSet = CharHexSet & Hex(Asc(strTemp) * intKey)& Hex(intKey)
Next

EncryptString = CharHexSet & "|" & Hex(intOffSet + intKey) & "|" & Hex(intOffSet)
Else
EncryptString = ""
End If
End Function

Private Function DecryptString(strCryptString)
Dim strRAW, arHexCharSet, i, intKey, intOffSet, strRawKey, strHexCrypData

strRawKey = Right(strCryptString, Len(strCryptString) - InStr(strCryptString, "|"))
intOffSet = Right(strRawKey, Len(strRawKey) - InStr(strRawKey,"|"))
intKey = HexConv(Left(strRawKey, InStr(strRawKey, "|") - 1)) - HexConv(intOffSet)
strHexCrypData = Left(strCryptString, Len(strCryptString) - (Len(strRawKey) + 1))

arHexCharSet = Split(strHexCrypData, Hex(intKey))

For i=0 to UBound(arHexCharSet)
strRAW = strRAW & Chr(HexConv(arHexCharSet(i))/intKey)
Next

DecryptString = strRAW
End Function

Private Function HexConv(hexVar)
Dim hxx, hxx_var, multiply
IF hexVar <> "" THEN
hexVar = UCASE(hexVar)
hexVar = StrReverse(hexVar)
DIM hx()
REDIM hx(LEN(hexVar))
hxx = 0
hxx_var = 0
FOR hxx = 1 TO LEN(hexVar)
IF multiply = "" THEN multiply = 1
hx(hxx) = mid(hexVar,hxx,1)
hxx_var = (get_hxno(hx(hxx)) * multiply) + hxx_var
multiply = (multiply * 16)
NEXT
hexVar = hxx_var
HexConv = hexVar
END IF
End Function

Private Function get_hxno(ghx)
If ghx = "A" Then
ghx = 10
ElseIf ghx = "B" Then
ghx = 11
ElseIf ghx = "C" Then
ghx = 12
ElseIf ghx = "D" Then
ghx = 13
ElseIf ghx = "E" Then
ghx = 14
ElseIf ghx = "F" Then
ghx = 15
End If
get_hxno = ghx
End Function
班门弄斧 2005-06-11
  • 打赏
  • 举报
回复
学习
zwrtv 2005-06-11
  • 打赏
  • 举报
回复
路过学习下
zhanglemail 2005-03-17
  • 打赏
  • 举报
回复
加油加油!
wklx041030 2005-03-17
  • 打赏
  • 举报
回复
你用简单的语言将一下原理就是了
sinlo 2005-03-17
  • 打赏
  • 举报
回复
来这里下在一个ASP源程序就知道了!
http://www.sinlo.com
wklx041030 2005-03-17
  • 打赏
  • 举报
回复
能讲的再详细点吗?谢谢!
jzywh 2005-03-17
  • 打赏
  • 举报
回复
网络传输中在http中是明文
wklx041030 2005-03-17
  • 打赏
  • 举报
回复
高手们!给个答案!

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧