'Validate GNTP Message against stored password'

def _validate_password(self, password):

    self.password = password
    if (password is None):
        raise errors.AuthError('Missing    password')
    keyHash = self.info.get('keyHash', None)
    if ((keyHash is None) and (self.password is None)):
        return True
    if (keyHash is None):
        raise errors.AuthError('Invalid    keyHash')
    if (self.password is None):
        raise errors.AuthError('Missing    password')
    keyHashAlgorithmID = self.info.get('keyHashAlgorithmID', 'MD5')
    password = self.password.encode('utf8')
    saltHash = self._decode_hex(self.info['salt'])
    keyBasis = (password + saltHash)
    self.key = self.hash_algo[keyHashAlgorithmID](keyBasis).digest()
    keyHash = self.hash_algo[keyHashAlgorithmID](self.key).hexdigest()
    if (not (keyHash.upper() == self.info['keyHash'].upper())):
        raise errors.AuthError('Invalid    Hash')
    return True
