signed hpke key config for registration#78
Open
dixitaniket wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the OHTTP/HPKE attestation and registry flow by shifting Nitro/nitriding binding back to the RSA signing key and adding an RSA-signed HPKE config payload intended for “registry V2” verification.
Changes:
- Adjusts nitriding registration hash to
SHA256(DER-encoded RSA SPKI)(no longer hashing an RSA+HPKE transcript). - Adds
get_signed_hpke_config()and an off-chaincompute_ohttp_config_hash()helper to produce a signed HPKE configuration for registry verification. - Updates
/v1/ohttp/configand the/signing-keyembeddedhpkepayload to return the signed HPKE config.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
tee_gateway/tee_manager.py |
Updates nitriding registration hashing and adds signed HPKE config + hash computation helper. |
tee_gateway/controllers/ohttp_controller.py |
Switches /v1/ohttp/config to return the signed HPKE config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+193
to
+199
| def get_signed_hpke_config(self) -> dict: | ||
| """Return HPKE config plus an RSA-PSS signature for registry V2. | ||
|
|
||
| The signature covers the same ABI-encoded hash computed by | ||
| TEERegistryV2.computeOHTTPConfigHash, so the registry can verify that | ||
| the OHTTP key came from the enclave signing key already proven by Nitro | ||
| attestation. |
Comment on lines
+201
to
+218
| config = self.get_hpke_config() | ||
| public_key = bytes.fromhex(config["public_key"]) | ||
| key_config = base64.b64decode(config["key_config"]) | ||
| config_hash = compute_ohttp_config_hash( | ||
| bytes.fromhex(self.tee_id), | ||
| config["key_id"], | ||
| config["kem_id"], | ||
| config["kdf_id"], | ||
| config["aead_id"], | ||
| public_key, | ||
| key_config, | ||
| ) | ||
| return { | ||
| **config, | ||
| "tee_id": f"0x{self.tee_id}", | ||
| "signature": self.sign_data(config_hash), | ||
| "signature_hash": f"0x{config_hash.hex()}", | ||
| } |
Comment on lines
+237
to
+267
| def compute_ohttp_config_hash( | ||
| tee_id: bytes, | ||
| key_id: int, | ||
| kem_id: int, | ||
| kdf_id: int, | ||
| aead_id: int, | ||
| ohttp_public_key: bytes, | ||
| ohttp_key_config: bytes, | ||
| ) -> bytes: | ||
| """Compute TEERegistryV2.computeOHTTPConfigHash off-chain.""" | ||
| if len(tee_id) != 32: | ||
| raise ValueError("tee_id must be 32 bytes") | ||
|
|
||
| def word(value: int) -> bytes: | ||
| return value.to_bytes(32, "big") | ||
|
|
||
| domain = keccak(b"OPENGRADIENT_TEE_OHTTP_CONFIG_V1") | ||
| return keccak( | ||
| b"".join( | ||
| [ | ||
| domain, | ||
| tee_id, | ||
| word(key_id), | ||
| word(kem_id), | ||
| word(kdf_id), | ||
| word(aead_id), | ||
| keccak(ohttp_public_key), | ||
| keccak(ohttp_key_config), | ||
| ] | ||
| ) | ||
| ) |
Comment on lines
404
to
+408
| want to verify the binding to the enclave's PCRs in one step. | ||
| """ | ||
| try: | ||
| tee = get_tee_keys() | ||
| return tee.get_hpke_config(), 200 | ||
| return tee.get_signed_hpke_config(), 200 |
| try: | ||
| tee = get_tee_keys() | ||
| return tee.get_hpke_config(), 200 | ||
| return tee.get_signed_hpke_config(), 200 |
Contributor
|
We should include the HPKE key in the AWS Nitro attestation instead of signing it with the private key IMO, it's a cleaner model that we use for verifying all other generated keys/artifacts too |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.