def METHOD_NAME(self, chain):
    """
    Check that the public keys of the chain and the request match.
    :param chain: :py:class:`X509Chain` object
    """
    if not self.__valid:
        return S_ERROR(DErrno.ENOCERT)
    retVal = chain.getCertInChain()
    if not retVal["OK"]:
        return retVal
    lastCert = retVal["Value"]
    chainPubKey = lastCert.getPublicKey()
    if not chainPubKey["OK"]:
        return chainPubKey
    # as_der will dump public key info, while as_pem
    # dumps private key.
    chainPubKey = chainPubKey["Value"].as_der()
    reqPubKey = self.__reqObj.get_pubkey().as_der()
    if not chainPubKey == reqPubKey:
        return S_ERROR(DErrno.EX509, "Public keys do not match")
    return S_OK(True)