Load TSS2 Private Key generated with tpm2tss-genkey
- Dominant language
- Go
- Stars
- 673
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to use an existing private key made using `tpm2tss-genkey ` (a PEM encoded private key), but cannot seem to find a way to import it correctly.
I see no direct possibility to import it using go-tpm, so I have tried importing it using tpm2tools by running `tpm2_loadexternal -r private.key -T device:/dev/tpmrm0 -c private.ctx` to get a context file and then load that file in the following way
```
rwc, err := tpm2.OpenTPM("/dev/tpmrm0")
b, err := ioutil.ReadFile("primary.ctx")
kh, err := tpm2.ContextLoad(rwc, b)
```
The issue is I get err == EOF, and that doesn't really tell me what is going wrong.
Essentially my question is: Are there any way to import the private key to use it with go-tpm?
Contributor guide
Research direction
Start with the OpenTPM and ContextLoad entry points used in the report, then compare their expected context format with the private.key and primary.ctx produced by tpm2tss-genkey and tpm2_loadexternal. Done means the existing PEM-encoded key can be loaded for use through go-tpm, with the reported EOF either resolved or clearly diagnosed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100