3
PATH="$PATH":"$new_path"
11
echo "$1 test fail, please check the environment or parameters!"
16
echo ""$1" pass" >>test_getpubak_pass.log
30
tpm2_getpubek -H $ekHandle -g 0x01 -f ek.pub1.out
37
tpm2_getpubak -E $ekHandle -k $akHandle -f ak.pub1.out -n ak.name_1.out |tee output_ak
38
if [ $? != 0 ] || [ ! -e ak.nake_1.out ];then
42
grep -A 3 "Name of loaded key:" output_ak|tr "\n" " " >grep.txt
43
Loadkeyname=`sed -e 's/ //g' grep.txt | awk -F':' '{print $2}'`
45
tpm2_makecredential -e ek.pub1.out -s secret.data -n $Loadkeyname -o makecredential.out
52
tpm2_activatecredential -H $akHandle -k $ekHandle -f makecredential.out -o act_credential.out
54
fail activatecredential
57
tpm2_akparse -f ak.pub1 -k akparse.out
63
##### getrandom & hash
64
tpm2_getrandom -s 20 -o random.out
69
tpm2_hash -H n -g 0x004 -I random.out -o hash.out -t hash_tk.out
75
############context ##############
77
tpm2_createprimary -A p -g 0x0004 -G 0x001 -C context.p1.out
82
tpm2_create -c context.p1.out -g 0x000B -G 0x0008 -o opu1.out -O opr1.out -I secret.data
86
tpm2_load -c context.p1.out -u opu1.out -r opr1.out -n name.load.1.out -C context_load_out1.out
90
tpm2_unseal -c context_load_out1.out -o usl.data.out
96
tpm2_createprimary -A p -g 0x000B -G 0x001 -C context.p2.out
100
tpm2_create -c context.p2.out -g 0x000B -G 0x0008 -o opu2.out -O opr2.out
104
tpm2_load -c context.p2.out -u opu2.out -r opr2.out -n name.load_2.out -C context_load_out2.out
108
tpm2_quote -c context_load_out2.out -g 0x4 -l 16,17,18 -o quote_outFile.out
114
tpm2_createprimary -A e -g 0x000B -G 0x0001 -C context.p3.out
118
tpm2_create -c context.p3.out -g 0x000B -G 0x0008 -o opu3.out -O opr3.out
122
tpm2_load -c context.p3.out -u opu3.out -r opr3.out -n name.load.3.out -C context_load_out3.out
126
tpm2_hmac -c context_load_out3.out -g 0x00B -I secret.data -o hmac.out
132
tpm2_createprimary -A e -g 0x000B -G 0x0001 -C context.p4.out
136
tpm2_create -c context.p4.out -g 0x000B -G 0x0008 -o opu4.out -O opr4.out
140
tpm2_load -c context.p4.out -u opu4.out -r opr4.out -n name.load.4.out -C context_load_out4.out
144
tpm2_readpublic -c context_load_out4.out -o rd-opu.out
150
tpm2_createprimary -A e -g 0x000B -G 0x0001 -C context.p5.out
154
tpm2_create -g 0x000B -G 0x0008 -o opu5.out -O opr5.out -c context.p5.out
158
tpm2_load -c context.p5.out -u opu5.out -r opr5.out -n name.load5.out -C context_load_out5.out
162
tpm2_evictcontrol -A o -c context_load_out5.out -S 0x81010003
166
tpm2_evictcontrol -A o -H 0x81010003 -S 0x81010003
168
fail evictcontrol_release_Handle
172
#####rsaencrypt & rsadecrypt
173
tpm2_createprimary -A e -g 0x000B -G 0x0001 -C context.p6.out
177
tpm2_create -g 0x000B -G 0x0001 -o opu6.out -O opr6.out -c context.p6.out
181
tpm2_loadexternal -H n -u opu6.out -C context_loadexternal_out6.out
185
tpm2_rsaencrypt -c context_loadexternal_out6.out -I secret.data -o rsa_en.out
189
tpm2_load -c context.p6.out -u opu6.out -r opr6.out -n name.load6.out -C context_load_out6.out
193
tpm2_rsadecrypt -c context_load_out6.out -I rsa_en.out -o rsa_de.out
199
tpm2_createprimary -A e -g 0x000B -G 0x0001 -C context.p7.out
204
tpm2_create -g 0x000B -G 0x0008 -o opu7.out -O opr7.out -c context.p7.out
208
tpm2_load -c context.p7.out -u opu7.out -r opr7.out -n name.load7.out -C context_load_out7.out
212
tpm2_sign -c context_load_out7.out -g 0x00B -m secret.data -s sign.f.out
217
tpm2_verifysignature -c context_load_out7.out -g 0x000B -m secret.data -s sign.f.out -t tickt_verify_sign.out
223
tpm2_createprimary -A e -g 0x000B -G 0x0001 -C context.p8.out
227
tpm2_create -g 0x000B -G 0x0025 -o opu8.out -O opr8.out -c context.p8.out
231
tpm2_load -c context.p8.out -u opu8.out -r opr8.out -n name.load8.out -C context_load_out8.out
235
tpm2_encryptdecrypt -c context_load_out8.out -D NO -I secret.data -o endecrypt.out
239
tpm2_encryptdecrypt -c context_load_out8.out -D YES -I endecrypt.out -o endecrypt_de.out
245
tpm2_createprimary -A e -g 0x000B -G 0x0001 -C context.p9.out
249
tpm2_create -g 0x000B -G 0x0001 -o opu9.out -O opr9.out -c context.p9.out
253
tpm2_load -c context.p9.out -u opu9.out -r opr9.out -n name.load9.out -C context_load_out9.out -d 3
257
tpm2_certify -C context.p9.out -c context_load_out9.out -g 0x000B -a attest.out -s certify_signature.out