reimplement openSSH export to work around pycrypto bug in python 3; fix various encoding issues with authn tokens