def encode_public_key(self):
"""
Based on spotnab, this is the gzipped version of the key
with base64 applied to it. We encode it as such and
return it.
"""
fileobj = StringIO()
with GzipFile(fileobj=fileobj, mode="wb") as f:
try:
f.write(self.public_pem())
except TypeError:
# It wasn't initialized yet
return None
return b64encode(fileobj.getvalue())
评论列表
文章目录