refactor encryption types to use classes with an interface.

Interface lives in the serialization module rather than interfaces.py