Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows hacking #2

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft

Windows hacking #2

wants to merge 27 commits into from

Conversation

hslatman
Copy link
Member

@hslatman hslatman commented Nov 8, 2022

No description provided.

mjg59 and others added 14 commits April 28, 2022 17:07
There's currently no support for creating application keys on Windows systems. This patch transitions the Windows key type to specifically refer to attestation keys, and reuses the existing wrapped key support for application keys. This allows the creation of keys in the platform store, while still allowing said keys to be manipulated with existing TPM functionality rather than duplicating it.
When generating a new key using a Windows TPM, a `wrappedKey20` was
returned, which couldn't be used for signing on Windows, as it's
backed by a `windowsTPM`. The `wrappedKey20` seems to be a type
specifically aimed at usage with a `wrappedTPM20`, which in turn
seems to be used on Linux and for testing, but not when instantiating
a TPM on Windows.

This commit adds the `newWindowsKey20` function, which returns
a key backed by a `windowsTPM`. The key is a `windowsAK20`,
now also conforming to the `key` interface, so that it can be used
for signing purposes.
@gitstream-cm
Copy link

gitstream-cm bot commented Jan 4, 2023

/: gitStream was installed on this repo, but no automation rules were added. It can add estimated review time to your PRs. get started

This message will appear only once for you in this repo

@CLAassistant
Copy link

CLAassistant commented Jan 4, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 3 committers have signed the CLA.

✅ hslatman
❌ brandonweeks
❌ mjg59
You have signed the CLA already but the status is still pending? Let us recheck it.

On Windows, when the key is managed by the OS, keys are stored on
the filesystem. When trying to create a key with the same name, this will
fail with the following error:

`NCryptCreatePersistedKey returned 8009000F: The operation completed successfully.`

This commit adds support for deleting these keys, so that a new
key can be created with the same name.

Have only tested this on Windows so far. My assumption is that for
keys created with `go-attestation` on Linux, the keys aren't persisted
"inside the TPM", so there's nothing to do when deleting them, except
for any keys managed externally.
@hslatman hslatman changed the base branch from patches to master January 13, 2023 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants