Code Monkey home page Code Monkey logo

Comments (10)

gwei3 avatar gwei3 commented on August 21, 2024

The policy file for tpm2_create should contain the binary format of the policyAuth. You can create a tools based on TPM2.0-TSS sapi api to create trial session and call policyPCR to update the policyAuth and then export it into a file. You can refer to TPM2.0-TSS/test/tpmclient or tpmtest for how the policyAuth was calculated.

from tpm2-tools.

mikzaq avatar mikzaq commented on August 21, 2024

I created a policyAuth file, and I am able to use this to create and seal an object, but I am able to simply unseal said object no matter what state the PCRs are in, and this is because I have not created a trial session correct? Are there plans to create a tool to do this? I am not sure I have the technical knowledge to create the trial session myself through the sapi

from tpm2-tools.

mikzaq avatar mikzaq commented on August 21, 2024

Also, I see that there is a StartAuthSession.c file in /src, but I have so far been unable to compile this

from tpm2-tools.

gwei3 avatar gwei3 commented on August 21, 2024

you need also add "-A 0x20492" (fixedTPM, fixedParent, noDA, decrypt, adminWithPolicy) as the cmdline option to enforce using policy to access the sealed data.

from tpm2-tools.

mikzaq avatar mikzaq commented on August 21, 2024

Okay, so right now, my method goes as follows:
tpm2_createprimary -A o -P <password> -g 0x4 -G 0x1
tpm2_create -H 0x80000000 -g 0x4 -G 0x1 -A 0x20492 -I key.txt -L policypcr16aaasha1.bin -o out.pub -O out.pri
but this gives me Errorcode 0x2c2, and changing -G 0x1 to -G 0x8 gives me Errorcode 0x2d2, but I am unsure what these mean, or why I am unable to use tpm2_create when I use the -A argument.

from tpm2-tools.

flihp avatar flihp commented on August 21, 2024

hi @mikzaq, I spent the better part of last week working on a tool to decode these TPM_RC codes. If you've got the time it could use some testing and might help us understand the error code you're seeing better. It looks like @gwei3 just merged this too so it should be in master.

from tpm2-tools.

mikzaq avatar mikzaq commented on August 21, 2024

Okay thanks, I'll check it out!

from tpm2-tools.

gwei3 avatar gwei3 commented on August 21, 2024

Sorry, my fault. Please change the attribute from 0x20492 to 0x492(fixedTPM, fixedParent, noDA, adminWithPolicy), and make sure store parent key in a context file and use parent context instead of parent handle like below can succeed in my side:

tpm2_createprimary -A o -g 0x4 -G 0x1 -C ctx.pri
tpm2_create -c ctx.pri -g 0xb -G 0x1 -A 0x492 -I key.txt -L policypcr16aaasha1.bin -o out.pub -O out.pr

from tpm2-tools.

mikzaq avatar mikzaq commented on August 21, 2024

It works! Thanks so much for your help! I'm still unable to unseal, but I believe this is due to the fact that I cannot create a policy session, as there is currently no tool for this.

from tpm2-tools.

schoenbo avatar schoenbo commented on August 21, 2024

I am trying to do the same as mikzaq but creating the object fails. I tried this on two different hardware-TPMs (manuId: AMD, manuId: IFX) on linux-4.4.19. Both give the same error.
Am I doing something wrong? Or is the problem somewhere else?

% tpm2_createprimary -A o -g 0x4 -G 0x1 -C ctx.pri
nameAlg = 0x0004
type = 0x0001
contextFile = ctx.pri

CreatePrimary Succeed ! Handle: 0x80000000
% tpm2_create -c ctx.pri -g 0xb -G 0x1 -A 0x492 -I ~/msg.bin -L policies/policypcr16aaasha1.bin -o out.pub -O out.pri
contextParentFile = ctx.pri
nameAlg = 0x000b
type = 0x0001
inSensitive.t.sensitive.data.t.size = 64
ObjectAttribute: 0x00000492

Create Object Failed ! ErrorCode: 0x921

from tpm2-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.