add encrypt support and save to file