Skip to content

Support for TPM-backed signers#25

Closed
getvictor wants to merge 4 commits intoremitly-oss:mainfrom
getvictor:support-tpm
Closed

Support for TPM-backed signers#25
getvictor wants to merge 4 commits intoremitly-oss:mainfrom
getvictor:support-tpm

Conversation

@getvictor
Copy link
Copy Markdown
Contributor

I am using HTTP signatures with a TPM (Trusted Platform Module), where the private key for the algorithm is located in the hardware, and I must use system APIs for signing.

This change allows the usage of a custom crypto.Signer:

httpsig.SigningKey{
	Key:       myTPM.Signer(),
	MetaKeyID: keyID,
}

I have verified this as working on our project, and we plan to put these changes into production within the next month:
https://github.com/fleetdm/fleet/tree/victor/29935-tpm-agent

@getvictor
Copy link
Copy Markdown
Contributor Author

@leelynne Can you take a look at this PR? Let me know if you have feedback/suggestions.

@getvictor
Copy link
Copy Markdown
Contributor Author

@leelynne Do you know when you'll be able to take a look at this PR?

getvictor added a commit to fleetdm/fleet that referenced this pull request Jul 14, 2025
For #30473

This change adds a vendored `httpsig-go` library to our repo. We cannot
use the upstream library because it has not merged the change we need:
remitly-oss/httpsig-go#25

Thus, we need our own copy at this point.

The instructions for keeping this library up to date (if needed) are in
`UPDATE_INSTRUCTIONS`.

None of the coderabbitai review comments are relevant to the
code/features we are going to use for HTTP message signatures.

We will use this library in subsequent PRs for the TPM-backed HTTP
message signature feature.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Introduced a Go library for HTTP message signing and verification,
supporting multiple cryptographic algorithms (RSA, ECDSA, Ed25519,
HMAC).
* Added utilities for key management, including JWK and PEM key
handling.
* Provided HTTP client and server helpers for automatic request signing
and signature verification.
* Implemented structured error handling and metadata extraction for
signatures.

* **Documentation**
  * Added comprehensive README, usage examples, and update instructions.
* Included license and configuration files for third-party and testing
tools.

* **Tests**
* Added extensive unit, integration, and fuzz tests covering signing,
verification, and key handling.
* Included official RFC test vectors and various test data files for
robust validation.

* **Chores**
* Integrated continuous integration workflows and ignore files for code
quality and security analysis.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@leelynne
Copy link
Copy Markdown
Collaborator

@getvictor My apologies I need to get my github notifications in order! Taking a look now.

Copy link
Copy Markdown
Collaborator

@leelynne leelynne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be able to able to add a test for usage of crypto.Signer? If not, no worries I will add the funcitonality and test. I need to add a set of tests for sign anyway.

@getvictor
Copy link
Copy Markdown
Contributor Author

Please add a test. I'm confident it works since we have integration tests using this library, and we'll be shipping it to production in ~2 weeks (after QA is done).

Also, I assume you will merge the PRs that you approved. I don't have permissions to merge them myself.

@leelynne
Copy link
Copy Markdown
Collaborator

leelynne commented Aug 17, 2025

Going to close this in favor of #32.

Note that the crypto.Signer compatible Sign method for ecdsa returns the ASN.1 encoding of the signature which is not compatible with the RFC. If you used a version of this code be sure to update the signature logic.

@leelynne leelynne closed this Aug 17, 2025
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.

2 participants