@staticmethod
def _getCertNames(cert, includeAlt=None):
    """Returns a set containing the common name(s) for the given cert. If
        includeAlt is not None, then X509v3 alternative names of type includeAlt
        (e.g. 'DNS', 'IPADD') will be included as potential matches."""
    names = set()
    for rdn in cert.get('subject', ()):
        for k, v in rdn:
            if k == 'commonName':
                names.add(v)
    if includeAlt:
        for k, v in cert.get('subjectAltName', ()):
            if k == includeAlt:
                names.add(v)
    return names
