Add high-level Security Context API
Fix Python 3 Issues

There were a couple of instances of using encode instead of decode.
These are now fixed.