def get_common_name(cls, csr):
        """ Read information from CSR. """
        from tempfile import NamedTemporaryFile
        fhandle = NamedTemporaryFile()
        fhandle.write(csr.encode('latin1'))
        fhandle.flush()
        output = cls.exec_output('openssl req -noout -subject -in %s' %
                                 fhandle.name)
        if not output:
            return

        common_name = output.split('=')[-1].strip()
        fhandle.close()
        return common_name
def get_common_name ( cls , csr ) : from tempfile import NamedTemporaryFile fhandle = NamedTemporaryFile ( ) fhandle . write ( csr . encode ( 'latin1' ) ) fhandle . flush ( ) output = cls . exec_output ( 'openssl req -noout -subject -in %s' % fhandle . name ) if not output : return common_name = output . split ( '=' ) [ - 1 ] . strip ( ) fhandle . close ( ) return common_name
Read information from CSR.