Refactored existing code and added support for symmetric encryption.

`encrypted[:0]` -> `encrypted`?