def decode_private_key(self, encoded):
"""
Based on spotnab, this is the gzipped version of the key
with base64 applied to it. We decode it and load it.
"""
fileobj = StringIO()
try:
fileobj.write(b64decode(encoded))
except TypeError:
return False
fileobj.seek(0L, SEEK_SET)
private_key = None
with GzipFile(fileobj=fileobj, mode="rb") as f:
private_key = f.read()
if not private_key:
return False
# We were successful
if not self.load(private_key=private_key):
return False
return True
评论列表
文章目录