3 echo "hello world.." > hello_tpm.txt
5 # Load the Child context in TPM
6 rm -f ChildKeyName ContextChild
7 tpm2_load -H 0x81000011 -u outPub -r outPriv -n ChildKeyName -C ContextChild
9 echo "tpm2_hash -H o -g 0x00B -I hello_tpm.txt -o hello_tpm_hash.bin -t outTicket"
10 rm -f hello_tpm_hash.bin outTicket
11 tpm2_hash -H o -g 0x00B -I hello_tpm.txt -o hello_tpm_hash.bin -t outTicket
14 echo "tpm2_sign -c ContextChild -g 0x000B -m hello_tpm.txt -s hello_tpm.sig"
16 tpm2_sign -c ContextChild -g 0x000B -m hello_tpm.txt -s hello_tpm.sig
19 echo "tpm2_verifysignature -c ContextChild -g 0x000b -m hello_tpm.txt -s hello_tpm.sig -t tk.sig"
21 tpm2_verifysignature -c ContextChild -g 0x000b -m hello_tpm.txt -s hello_tpm.sig -t tk.sig
24 echo "Extracting signature from TPM format"
25 echo "dd if=hello_tpm.sig of=hello_tpm.sig.raw bs=1 skip=6 count=256"
26 rm -f hello_tpm.sig.raw
27 dd if=hello_tpm.sig of=hello_tpm.sig.raw bs=1 skip=6 count=256
30 echo "openssl dgst -verify public.pem -keyform pem -sha256 -signature hello_tpm.sig.raw hello_tpm.txt"
31 openssl dgst -verify public.pem -keyform pem -sha256 -signature hello_tpm.sig.raw hello_tpm.txt
34 rm -f hello_tpm_hash.bin outTicket tk.sig