def receive_hispubkey(mypub=None):
"""
Try to get his public key from clipboard, saved to "hispub"
return True if success else False
"""
if mypub is None:
mypub = storage_get("mypub")
try:
rawdata = clipboard_read()
hispub = d64(rawdata)
if not isinstance(hispub, rsa.PublicKey):
return False
if hispub == mypub:
return False # clipboard not changed
else:
storage_save("hispub",hispub)
return True,hispub
except:
return False
评论列表
文章目录