Saving to encrypted files?

is it posible to save a variable to encrypted file with password, and get variable from the encrypted file.