Feature/refactor encryption key repository

Fixes #23 and #24