cloud_verifier_common.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:python-keylime 作者: mit-ll 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号