#NEWLINE# def _run( self , scanObject , result , depth , args ) : #NEWLINE# #INDENT# moduleResult = [ ] #NEWLINE# flags = [ ] #NEWLINE# buffer = scanObject . buffer #NEWLINE# cert = None #NEWLINE# try : #NEWLINE# #INDENT# input_bio = BIO . MemoryBuffer ( buffer ) #NEWLINE# if ( buffer [ : 1 ] == '0' ) : #NEWLINE# #INDENT# p7 = SMIME . PKCS7 ( m2 . pkcs7_read_bio_der ( input_bio . _ptr ( ) ) , 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# p7 = SMIME . load_pkcs7_bio ( input_bio ) #NEWLINE# #UNINDENT# certs = p7 . get0_signers ( X509 . X509_Stack ( ) ) #NEWLINE# i = 0 #NEWLINE# for cert in certs : #NEWLINE# #INDENT# cert_filename = ( '%x.der' % cert . get_serial_number ( ) ) #NEWLINE# moduleResult . append ( ModuleObject ( buffer = cert . as_der ( ) , externalVars = ExternalVars ( filename = cert_filename ) ) ) #NEWLINE# i = ( i + 1 ) #NEWLINE# #UNINDENT# #UNINDENT# except ( QuitScanException , GlobalScanTimeoutError , GlobalModuleTimeoutError ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# ( exc_type , exc_value , exc_traceback ) = sys . exc_info ( ) #NEWLINE# logging . exception ( ( 'Error parsing cert in ' + str ( get_scanObjectUID ( getRootObject ( result ) ) ) ) ) #NEWLINE# ugly_error_string = str ( exc_value ) #NEWLINE# nicer_error_string = ugly_error_string . split ( ':' ) [ 4 ] . split ( ) [ 0 ] #NEWLINE# scanObject . addFlag ( ( 'pkcs7:err:' + nicer_error_string ) ) #NEWLINE# #UNINDENT# return moduleResult