我想实现 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