10 echo "$0 [--out-public primaty_public_bin_file (optional)]"
15 out_primary_public="out_parent_public"
20 #echo "out-public file: $out_primary_public"
23 echo "tpm2_startup -clear -T tabrmd -V"
24 tpm2_startup -clear -T tabrmd -V
25 if [ $? -ne 0 ]; then echo; echo -e "${RED}Error, Exit."; exit 1; fi
29 echo "tpm2_takeownership -o new -e new -l new -T tabrmd -V"
30 tpm2_takeownership -o new -e new -l new -T tabrmd -V
31 if [ $? -ne 0 ]; then echo; echo -e "${RED}Error, Exit."; exit 1; fi
34 # Create Primary Key in RH_OWNER hierarchy
36 echo "tpm2_createprimary -P new -A o -g 0x000B -G 0x0001 -T tabrmd -V -C PrimaryKeyBlob"
37 tpm2_createprimary -P new -A o -g 0x000B -G 0x0001 -T tabrmd -V -C PrimaryKeyBlob
38 if [ $? -ne 0 ]; then echo; echo -e "${RED}Error, Exit."; exit 1; fi
41 # Store Primary Key in TPMs NV RAM
42 echo "tpm2_evictcontrol -A o -c ./PrimaryKeyBlob -S 0x81000011 -T tabrmd -V -P new"
43 tpm2_evictcontrol -A o -c ./PrimaryKeyBlob -S 0x81000011 -T tabrmd -V -P new
44 if [ $? -ne 0 ]; then echo; echo -e "${RED}Error, Exit."; exit 1; fi
48 # To test, Read public portion of TPM primary key with stored handle
49 rm -f $out_primary_public
50 echo "tpm2_readpublic -H 0x81000011 --opu $out_primary_public -T tabrmd -V"
51 tpm2_readpublic -H 0x81000011 --opu $out_primary_public -T tabrmd -V
52 if [ $? -ne 0 ]; then echo; echo -e "${RED}Error, Exit."; exit 1; fi
56 # Some TPM commands to test
57 #tpm2_load -c PrimaryKeyBlob -u outPub -r outPriv -n ChildKeyName -C ContextChild