Basic Sealing and Unsealing
- Dominant language
- Go
- Stars
- 673
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
I know the example for complete seal and unsealing workflow, including policies. However, just simple tpm2.Seal() und tpm2.Unseal() does not work. For example, I would expect the following to work:
```go
rwc, err := tpm2.OpenTPM("/dev/tpm0")
if err != nil {
log.Fatal(err)
}
defer rwc.Close()
secret := []byte("test")
srkHandle := tpmutil.Handle(0x81000001)
privSeal, pubSeal, err := tpm2.Seal(rwc, srkHandle, "", "", nil, secret)
if err != nil {
log.Fatal(err.Error())
}
sealHandle, _, err := tpm2.Load(rwc, srkHandle, "", pubSeal, privSeal)
if err != nil {
log.Fatal(err.Error())
}
unsealed, err := tpm2.Unseal(rwc, sealHandle, "")
if err != nil {
log.Fatal(err.Error())
}
log.Print(string(unsealed))
```
But I receive this error:
error code 0x2f : authValue or authPolicy is not available for selected entity
I would expect something similar (and compatible) to this:
```bash
echo test | tpm2_create -u test.pub -r test.priv -i- -C 0x81000001
tpm2_load -C 0x81000001 -u test.pub -r test.priv -c test.ctx
tpm2_unseal -c test.ctx
```
Is there something I do wrong?
Contributor guide
Assessment
This issue has not been assessed yet.