#NEWLINE# def parse_crypt_table( zephyr_class , instance ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# crypt_table = open ( os . path . join ( os . environ [ 'HOME' ] , '.crypt-table' ) ) #NEWLINE# #UNINDENT# except IOError : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# for line in crypt_table . readlines ( ) : #NEWLINE# #INDENT# if ( line . strip ( ) == '' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# match = re . match ( '^crypt-(?P<class>[^:]+):\\s+((?P<algorithm>(AES|DES)):\\s+)?(?P<keypath>\\S+)$' , line ) #NEWLINE# if ( match is None ) : #NEWLINE# #INDENT# logger . debug ( 'Invalid crypt_table line!' ) #NEWLINE# continue #NEWLINE# #UNINDENT# groups = match . groupdict ( ) #NEWLINE# if ( ( groups [ 'class' ] . lower ( ) == zephyr_class ) and ( 'keypath' in groups ) and ( groups . get ( 'algorithm' ) == 'AES' ) ) : #NEWLINE# #INDENT# return zephyr_class [ 'keypath' ] #NEWLINE# #UNINDENT# #UNINDENT# return None