wodSmtpServer ActiveX Control - CalcCramMD5 Method
      
 

Description

Calculates CRAM-MD5 value for given password.


Return Type

A String value.  Calculated CRAM-MD5 password, encoded in BASE64.


Syntax

object.CalcCramMD5 (Password)



The CalcCramMD5 Method syntax has these parts:

Part Description
object An expression evaluating to an object of type SmtpUser.
Password Required. A String value. Secret password for user's account.

Remarks

CalcCramMD5 method is used only when Authentication is set to accept client's authentication, and client selects to use AUTH CRAM-MD5 command. In this case, client never sends his password, but he creates digest value using his password and sends it to you. Since this digest value cannot be reverted to get plaintext password, we must do the same on server side - calculate same digest value with the password we know - and then just check if results are the same.

This method is not available at all times - it is only available from inside Authenticate event, because some parameters internally needed are created in that event. As a result of this method, you will get BASE64 encoded string - which should be the same as value stored in User.Password property sent by the user.

Although for this type of authentication much more parameters are required, wodSmtpServer knows all of them except secret password - which you must supply. This is why secret password is the only argument to this method.

Typical usage would be something like this:

Private Sub wodSmtpServer1_Authenticate(ByVal User As WODSMTPSERVERCOMLib.ISmtpUser, ByVal Username As String, ByVal Password As String, ByVal AuthMethod As WODSMTPSERVERCOMLib.SmtpAuthentications, Action As WODSMTPSERVERCOMLib.SmtpActions)
      If AuthMethod = AuthCramMD5 Then
             If Username = "joe" And User.CalcCramMD5("joesecretpassword") = Password Then Action = Allow
      End If
End Sub