def Input(self, n=None, m=None, s=None):  # pylint: disable=arguments-differ
    """Input parameters to the auth function.

    Callers should provide n, OR m and s.

    Args:
      n: str, nonce from client, an integer in str form e.g. '12345'
      m: str, message from client
      s: str, b64 signature from client
    Raises:
      ValueError: if invalid combination of arguments supplied
    """
    super(Auth1, self).Input()
    self.ResetState()  # paranoia clear auth_state, tests run OK without

    if n is not None and m is None and s is None:
      #logging.debug('Auth step 1')

      try:
        cn = int(n)
      except ValueError:
        logging.critical('Non-integer Cn was supplied: %s', str(n))
        self.AuthFail()
        return

      if cn < MIN_VALUE_CN:
        logging.critical('Cn value is too small: %d', cn)
        self.AuthFail()
        return

      sn = self.Nonce()
      m = self._AssembleMessage(str(cn), str(sn))
      sig = self.Sign(m)
      sig = base64.urlsafe_b64encode(sig)
      m = self._AssembleMessage(m, sig)
      self._AddOutput(m)
      self.SessionSetCnSn(cn, sn)
      #logging.debug('Server supplied Sn %s for Cn %s', sn, cn)
    elif m is not None and s is not None and n is None:
      #logging.debug('Auth step 2')

      class _Error(Exception):
        """Temporary exception used here."""

      log_prefix = ''
      cn = None

      try:
        # open up the message to get the client cert 'c'.
        try:
          (c, cn, sn) = self._SplitMessage(m, 3)
        except MessageError, e:
          raise _Error('SplitMessage MessageError (%s)', str(e))

        log_prefix = ''

        # signature 's' and client cert 'c' are urlsafe_base64
        try:
          s = base64.urlsafe_b64decode(str(s))
          c = base64.urlsafe_b64decode(str(c))
        except __HOLE__, e:
          raise _Error('Invalid c or s parameter b64 format(%s)', str(e))

        # load X509 client cert 'c' into object
        try:
          client_cert = self.LoadOtherCert(c)
        except ValueError, e:
          raise _Error('Invalid cert supplied %s' % str(e))

        # sanity check
        if not client_cert.GetPublicKey():
          raise _Error('Malformed X509 cert with no public key')

        client_cert.SetRequiredIssuer(self._required_issuer)
        try:
          client_cert.CheckAll()
        except x509.Error, e:
          raise _Error('X509 certificate error: %s' % str(e))

        # obtain uuid from cert
        uuid = client_cert.GetSubject()
        log_prefix = uuid

        # client_cert is loaded
        #logging.debug('%s Client cert loaded', log_prefix)
        #logging.debug('%s Message = %s', log_prefix, m)

        # verify that the client cert is legitimate
        if not self.VerifyCertSignedByCA(client_cert):
          raise _Error('Client cert is not signed by the required CA')

        # verify that the message was signed by the client cert
        if not self.VerifyDataSignedWithCert(m, s, client_cert):
          raise _Error('Signed message does not verify')

        # verify that the Sn was the one offered to this Cn previously
        if not self.SessionVerifyKnownCnSn(cn, sn):
          raise _Error('Client offered unknown Sn %s', sn)

        # success!
        #logging.debug('%s Client auth successful', log_prefix)

        # careful here, switching the state setting and AddOutput
        # lines causes a hard to test bug (because Input() test mocks out
        # AuthToken())
        self._auth_state = AuthState.OK
        token = self.SessionCreateAuthToken(uuid)
        self._AddOutput(token)

      except (_Error, CryptoError), e:
        logging.warning('%s Auth error: %s', log_prefix, e.args)
        logging.debug('%s Auth message: %s', log_prefix, m)
        logging.debug(
            '%s Auth sig: %s', log_prefix, base64.urlsafe_b64encode(s))
        self.AuthFail()

      # no matter what, delete the current cn:sn pair if an attempt
      # was made to auth against it, success or not.
      if cn is not None:
        self.SessionDelCn(cn)
    else:
      #logging.debug('Auth step unknown')
      raise ValueError('invalid input')
dataset/ETHPy150Open google/simian/src/simian/auth/base.py/Auth1.Input