Example #1
0
 bool checkAuthentication(byte[] buffer, int authMechanismPos, int authMechLen, int authValuePos, int authValueLen)
 {
     if (password != null && password != "")
     {
         AcseAuthenticationMechanism mechanism = checkAuthMechanismName(buffer, authMechanismPos, authMechLen);
         return(authenticateClient(mechanism, buffer, authValuePos, authValueLen, Encoding.ASCII.GetBytes(password)));
     }
     else
     {
         return(true);
     }
 }
Example #2
0
 bool authenticateClient(AcseAuthenticationMechanism mechanism, byte[] buffer, int authValuePos, int authValueLen, byte[] password)
 {
     if (mechanism == AcseAuthenticationMechanism.ACSE_AUTH_PASSWORD)
     {
         for (int i = 0; i < authValueLen; i++)
         {
             if (buffer[authValuePos + i] != password[i])
             {
                 return(false);
             }
         }
     }
     return(true);
     //return authenticator(authenticatorParameter, authParameter, &(securityToken));
 }
Example #3
0
        AcseAuthenticationMechanism checkAuthMechanismName(byte[] buffer, int authMechanismPos, int authMechLen)
        {
            AcseAuthenticationMechanism authenticationMechanism = AcseAuthenticationMechanism.ACSE_AUTH_NONE;

            if (buffer != null)
            {
                if (authMechLen == 3)
                {
                    //if (memcmp(auth_mech_password_oid, authMechanism, 3) == 0) {
                    authenticationMechanism = AcseAuthenticationMechanism.ACSE_AUTH_PASSWORD;
                    for (int i = 0; i < 3; i++)
                    {
                        if (buffer[authMechanismPos + i] != auth_mech_password_oid[i])
                        {
                            authenticationMechanism = AcseAuthenticationMechanism.ACSE_AUTH_NONE;
                        }
                    }
                }
            }
            return(authenticationMechanism);
        }