def cert_info(app_dir, tools_dir):
 try:
  print '[INFO] Reading Code Signing Certificate'
  cert = os.path.join(app_dir, 'META-INF/')
  cp_path = (tools_dir + 'CertPrint.jar')
  files = [f for f in os.listdir(cert) if os.path.isfile(os.path.join(cert, f))]
  certfile = None
  dat = ''
  if ('CERT.RSA' in files):
   certfile = os.path.join(cert, 'CERT.RSA')
  else:
   for file_name in files:
    if file_name.lower().endswith('.rsa'):
     certfile = os.path.join(cert, file_name)
    elif file_name.lower().endswith('.dsa'):
     certfile = os.path.join(cert, file_name)
  if certfile:
   args = [(settings.JAVA_PATH + 'java'), '-jar', cp_path, certfile]
   issued = 'good'
   dat = subprocess.check_output(args)
   unicode_output = unicode(dat, encoding='utf-8', errors='replace')
   dat = escape(unicode_output).replace('\n', '</br>')
  else:
   dat = 'No Code Signing Certificate Found!'
   issued = 'missing'
  if re.findall('Issuer: CN=Android Debug|Subject: CN=Android Debug', dat):
   issued = 'bad'
  cert_dic = {'cert_info': dat, 'issued': issued}
  return cert_dic
 except:
  PrintException('[ERROR] Reading Code Signing Certificate')

def cert_info ( app_dir , tools_dir ) : try : print '[INFO] Reading Code Signing Certificate' cert = os . path . join ( app_dir , 'META-INF/' ) cp_path = ( tools_dir + 'CertPrint.jar' ) files = [ f for f in os . listdir ( cert ) if os . path . isfile ( os . path . join ( cert , f ) ) ] certfile = None dat = '' if ( 'CERT.RSA' in files ) : certfile = os . path . join ( cert , 'CERT.RSA' ) else : for file_name in files : if file_name . lower ( ) . endswith ( '.rsa' ) : certfile = os . path . join ( cert , file_name ) elif file_name . lower ( ) . endswith ( '.dsa' ) : certfile = os . path . join ( cert , file_name ) if certfile : args = [ ( settings . JAVA_PATH + 'java' ) , '-jar' , cp_path , certfile ] issued = 'good' dat = subprocess . check_output ( args ) unicode_output = unicode ( dat , encoding = 'utf-8' , errors = 'replace' ) dat = escape ( unicode_output ) . replace ( '\n' , '</br>' ) else : dat = 'No Code Signing Certificate Found!' issued = 'missing' if re . findall ( 'Issuer: CN=Android Debug|Subject: CN=Android Debug' , dat ) : issued = 'bad' cert_dic = { 'cert_info' : dat , 'issued' : issued } return cert_dic except : PrintException ( '[ERROR] Reading Code Signing Certificate' )
get the certificate info needed to render the dashboard section for the given student and course .