.net CRAM-MD5 Sasl机制的实现

.net CRAM-MD5 Sasl机制的实现,.net,cryptography,sasl,.net,Cryptography,Sasl,我想实现CRAM-MD5 sasl机制的使用,我正在查看System.Security.Cryptography.HMACMD5,但不知道从哪里开始。谁能帮我,教程文章什么都欢迎 Public Function CRAMMD5Credentials(ByVal userName As String, ByVal password As String, ByVal b64challenge As String) As String Dim cram As New System.Securi

我想实现CRAM-MD5 sasl机制的使用,我正在查看
System.Security.Cryptography.HMACMD5
,但不知道从哪里开始。谁能帮我,教程文章什么都欢迎

Public Function CRAMMD5Credentials(ByVal userName As String, ByVal password As String, ByVal b64challenge As String) As String
    Dim cram As New System.Security.Cryptography.HMACMD5(System.Text.Encoding.ASCII.GetBytes(password))
    Dim challenge As String = System.Text.Encoding.ASCII.GetString(System.Convert.FromBase64String(b64challenge))
    Dim digest As String = System.Text.Encoding.ASCII.GetString(cram.ComputeHash(System.Text.Encoding.ASCII.GetBytes(challenge)))
    Return System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(userName & " " & digest.ToLower))
End Function

到目前为止你尝试了什么?CRAM-MD5在Wikipedia()和相应的RFC(RFC 2095,RFC 2195)中都有清楚的描述。

是的,nickolay我读过定义,我没有密码学背景,但我正在尽力,我用一种可能有效的方法编辑了我的问题,这个问题,我没有办法用服务器测试它,我尝试了gmail,live,他们中没有人使用CRAM-MD5 Sasl机制。您应该设置服务器并检查它。这对于虚拟Linuxes/FreeBSD来说很简单。