Skip to content

signed hpke key config for registration#78

Open
dixitaniket wants to merge 1 commit into
mainfrom
ani/ohttp-registry
Open

signed hpke key config for registration#78
dixitaniket wants to merge 1 commit into
mainfrom
ani/ohttp-registry

Conversation

@dixitaniket
Copy link
Copy Markdown
Collaborator

@dixitaniket dixitaniket commented May 22, 2026

  • hpke config now part of the tee registry flow and undergoes on chain verification

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-chain compute_ohttp_config_hash() helper to produce a signed HPKE configuration for registry verification.
  • Updates /v1/ohttp/config and the /signing-key embedded hpke payload 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
@adambalogh
Copy link
Copy Markdown
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

@dixitaniket dixitaniket changed the title ohttp attestation endpoint update signed hpke key config for registration May 26, 2026
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.

3 participants