def is_file_encrypted(self, filename):
        '''
        Given a file. Check if it is already encrypted.
        '''
        if not os.path.exists(filename):
            print "Invalid filename %s. Does not exist" % filename
            return False

        fhandle = open(filename, "rb")
        data = fhandle.read()
        fhandle.close()

        if data.startswith(AnsiVault.HEADER):
            return True
        else:
            return False
def is_file_encrypted ( self , filename ) : if not os . path . exists ( filename ) : print "Invalid filename %s. Does not exist" % filename return False fhandle = open ( filename , "rb" ) data = fhandle . read ( ) fhandle . close ( ) if data . startswith ( AnsiVault . HEADER ) : return True else : return False
Given a file. Check if it is already encrypted.