Convert public key string type in server

This fixes a segmentation fault caused by an incorrect string encoding
when run in Python 2.7.