def prepare_v(instance):
# be very careful printing K, U, or V as they leak in logs stored on unprotected disks
if common.DEVELOP_IN_ECLIPSE:
logger.debug("b64_V (non encrypted): " + instance['v'])
if instance.get('b64_encrypted_V',"") !="":
b64_encrypted_V = instance['b64_encrypted_V']
logger.debug("Re-using cached encrypted V")
else:
# encrypt V with the public key
b64_encrypted_V = base64.b64encode(crypto.rsa_encrypt(crypto.rsa_import_pubkey(instance['public_key']),str(base64.b64decode(instance['v']))))
instance['b64_encrypted_V'] = b64_encrypted_V
logger.debug("b64_encrypted_V:" + b64_encrypted_V)
post_data = {
'encrypted_key': b64_encrypted_V
}
v_json_message = json.dumps(post_data)
return v_json_message
评论列表
文章目录