def _get_csr_extensions(csr):
 ret = OrderedDict()
 csrtempfile = tempfile.NamedTemporaryFile()
 csrtempfile.write(csr.as_pem())
 csrtempfile.flush()
 csryaml = _parse_openssl_req(csrtempfile.name)
 csrtempfile.close()
 if (csryaml and ('Requested Extensions' in csryaml['Certificate Request']['Data'])):
  csrexts = csryaml['Certificate Request']['Data']['Requested Extensions']
  if (not csrexts):
   return ret
  for (short_name, long_name) in six.iteritems(EXT_NAME_MAPPINGS):
   if (csrexts and (long_name in csrexts)):
    ret[short_name] = csrexts[long_name]
 return ret

def _get_csr_extensions ( csr ) : ret = OrderedDict ( ) csrtempfile = tempfile . NamedTemporaryFile ( ) csrtempfile . write ( csr . as_pem ( ) ) csrtempfile . flush ( ) csryaml = _parse_openssl_req ( csrtempfile . name ) csrtempfile . close ( ) if ( csryaml and ( 'Requested Extensions' in csryaml [ 'Certificate Request' ] [ 'Data' ] ) ) : csrexts = csryaml [ 'Certificate Request' ] [ 'Data' ] [ 'Requested Extensions' ] if ( not csrexts ) : return ret for ( short_name , long_name ) in six . iteritems ( EXT_NAME_MAPPINGS ) : if ( csrexts and ( long_name in csrexts ) ) : ret [ short_name ] = csrexts [ long_name ] return ret
returns a list of dicts containing the name .