def GetRSAPublicKey(self, common_name="Server"):
    """Retrieves the public key for the common_name from data_store.

    This maintains a cache of key pairs or loads them instead from
    data_store.

    Args:
      common_name: The common_name of the key we need.

    Returns:
      A valid rsa public key.

    Raises:
       communicator.UnknownClientCert: cert not found - this will cause the
       client to re-enroll thereby updating our certificate store.
    """
    # We dont want a unicode object here
    common_name = str(common_name)
    try:
      client = self.client_cache.Get(common_name)
      cert = client.Get(client.Schema.CERT)
      return cert.GetPubKey()

    except (__HOLE__, AttributeError):
      # Fetch the client's cert - We will be updating its clock attribute.
      client = aff4.FACTORY.Create(common_name, "VFSGRRClient", mode="rw",
                                   token=self.token, ignore_cache=True)
      cert = client.Get(client.Schema.CERT)
      if not cert:
        stats.STATS.IncrementCounter("grr_unique_clients")
        raise communicator.UnknownClientCert("Cert not found")

      if rdfvalue.RDFURN(cert.common_name) != rdfvalue.RDFURN(common_name):
        logging.error("Stored cert mismatch for %s", common_name)
        raise communicator.UnknownClientCert("Stored cert mismatch")

      self.client_cache.Put(common_name, client)
      stats.STATS.SetGaugeValue("grr_frontendserver_client_cache_size",
                                len(self.client_cache))

      return cert.GetPubKey()
dataset/ETHPy150Open google/grr/grr/lib/flow.py/ServerPubKeyCache.GetRSAPublicKey