vis_encrypt.py 文件源码

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

项目:PACE-python 作者: mit-ll 项目源码 文件源码
def _encrypt_with_shares(cls, plaintext, key_id, vis_expr):
        '''
        Arguments:
        plaintext - plaintext portion of the cell to be encrypted
        key_id - the keytor object,contains a key_id and handle on the key_objection 
              to obtain the keys.
        vis_expr - visibility expression of the cell to be encrypted

        Returns - the encrypted shares concatenated with the ciphertext
        or the field of the cell being encrypted 
        '''
        #generate a random key for the cell 
        cell_key = Random.get_random_bytes(key_id.cell_key_length)
        #break into shares and then encrypt
        encrypted_shares = SecretVisTreeEncryptor.encrypt_secret_shares(vis_expr,
                                                                 cell_key,
                                                                 key_id,
                                                                 cls.leaf_class)
        #encrypt the plaintext 
        ciphertext = cls._encrypt(plaintext, cell_key)
        return encrypted_shares + "#" + ciphertext
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号