[WIP] Switch to an iterator based API for encryption