File: gettime.sh

package info (click to toggle)
tpm2-tools 5.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,988 kB
  • sloc: ansic: 45,737; sh: 14,915; xml: 8,342; makefile: 610; python: 51
file content (25 lines) | stat: -rw-r--r-- 463 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# SPDX-License-Identifier: BSD-3-Clause

source helpers.sh

cleanup() {
    rm -f attest.sig attest.data
    if [ "$1" != "no-shut-down" ]; then
	shut_down
    fi
}
trap cleanup EXIT

start_up

tpm2 createprimary -C e -c primary.ctx

tpm2 create -G rsa -u rsa.pub -r rsa.priv -C primary.ctx

tpm2 load -C primary.ctx -u rsa.pub -r rsa.priv -c rsa.ctx

tpm2 gettime -c rsa.ctx -o attest.sig --attestation attest.data

tpm2 print -t TPMS_ATTEST attest.data

exit 0