def names(self): """What are the subject names of this certificate? :returns: the subject names :rtype: `list` of `str` :raises .CertStorageError: if could not find cert file. """ target = self.current_target("cert") if target is None: raise errors.CertStorageError("could not find cert file") with open(target) as f: return crypto_util.get_names_from_cert(f.read())
def names(self): """What are the subject names of this certificate? :returns: the subject names :rtype: `list` of `str` :raises .CertStorageError: if could not find cert file. """ target = self.current_target("cert") if target is None: raise errors.CertStorageError( "could not find the certificate file") with open(target) as f: # TODO: Remove the cast once certbot package is fully typed return crypto_util.get_names_from_cert(cast(bytes, f.read()))
def names(self, version=None): """What are the subject names of this certificate? (If no version is specified, use the current version.) :param int version: the desired version number :returns: the subject names :rtype: `list` of `str` :raises .CertStorageError: if could not find cert file. """ if version is None: target = self.current_target("cert") else: target = self.version("cert", version) if target is None: raise errors.CertStorageError("could not find cert file") with open(target) as f: return crypto_util.get_names_from_cert(f.read())
def _call(cls, *args, **kwargs): from certbot.crypto_util import get_names_from_cert return get_names_from_cert(*args, **kwargs)