tpm_initialize.py 文件源码

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

项目:python-keylime 作者: mit-ll 项目源码 文件源码
def get_mod_from_tpm(keyhandle):
    (retout,code)  = tpm_exec.run("getpubkey -ha %s -pwdk %s"%(keyhandle,get_tpm_metadata('aik_pw')),raiseOnError=False)
    if code!=tpm_exec.EXIT_SUCESS and len(retout)>0 and retout[0].startswith("Error Authentication failed (Incorrect Password) from TPM_GetPubKey"):
        return None

    # now to parse things!
    inMod = False
    public_modulus = []
    for line in retout:
        if line.startswith("Modulus"):
            inMod = True
            continue
        if inMod:
            tokens = line.split()
            for token in tokens:
                public_modulus.append(string.atol(token,base=16))
    return base64.b64encode(bytearray(public_modulus))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号