Encryption service refactoring