Refactor encrypt/decrypt to take Readers/Writers