enrollz_tpm12 - openconfig/featureprofiles GitHub Wiki
This document details the RotateAIK enrollment flow for devices equipped with TPM 1.2. It describes the interaction between the EnrollZ Service and the device, the cryptographic structures involved, and the mapping to the RotateAIKCertRequest and RotateAIKCertResponse Protocol Buffers.
The RotateAIK flow for TPM 1.2 is used to generate an Attestation Identity Key (AIK) pair on the device, certify it using the device's Endorsement Key (EK), and install the resulting AIK Certificate.
This flow requires the service to have prior knowledge of the device's public Endorsement Key (EK), which is typically retrieved from the device's Endorsement Certificate. TPM 1.2 utilizes the MakeIdentity protocol. This process involves the device generating a TPM_IDENTITY_REQ, and the service responding with an encrypted credential that only the device's EK can decrypt.
The flow relies on the RotateAIKCertRequest and RotateAIKCertResponse messages.
// The RotateAIKCertRequest handles the workflow for enrollment of TPM 1.2
// devices.
message RotateAIKCertRequest {
message IssuerCertPayload {
// This field contains the TPM_ASYM_CA_CONTENTS encrypted with the EK.
// Despite the name 'symmetric_key_blob', this contains the asymmetric
// encryption of the session key.
bytes symmetric_key_blob = 1;
// This field contains the AIK Certificate encrypted with the session key
// defined in the symmetric_key_blob.
bytes aik_cert_blob = 2;
}
oneof value {
// Step 1: Service provides the Privacy CA (Issuer) Public Key.
bytes issuer_public_key = 1;
// Step 3: Service provides the encrypted credentials.
IssuerCertPayload issuer_cert_payload = 2;
// Step 5: Service confirms finalization.
bool finalize = 3;
}
// Switch control card selected identifier.
ControlCardSelection control_card_selection = 4;
}
message RotateAIKCertResponse {
oneof value {
// Step 2: Device sends the TPM_IDENTITY_REQ blob.
bytes application_identity_request = 1;
// Step 4: Device returns the decrypted PEM cert to prove possession of EK.
string aik_cert = 2;
}
// Vendor identity fields of the selected control card.
ControlCardVendorId control_card_id = 3;
}The workflow relies on the correct formation, serialization, and parsing of several TPM 1.2 structures which are defined in the TPM 1.2 TCG specifications, including:
TPM_IDENTITY_REQTPM_IDENTITY_PROOFTPM_IDENTITY_CONTENTSTPM_PUBKEYTPM_SYMMETRIC_KEYTPM_ASYM_CA_CONTENTSTPM_SYM_CA_ATTESTATION
This section validates that the device correctly implements the service-driven TPM 1.2 RotateAIK enrollment workflow. The following test cases cover both the successful enrollment path and various failure scenarios from the device's perspective.
| ID | Case | Expected Result |
|---|---|---|
| enrollz-2.1 | Successful enrollment flow. | The device successfully completes the enrollment and obtains AIK cert. |
| enrollz-2.2 | RotateAIKCertRequest with a missing control_card_selection. | The device returns an invalid request error and closes the stream. |
| enrollz-2.3 | RotateAIKCertRequest with an invalid control_card_selection. | The device returns an invalid request error and closes the stream. |
| enrollz-2.4 | Service sends an initial RotateAIKCertRequest with a missing issuer_public_key. | The device returns an invalid request error and closes the stream. |
| enrollz-2.5 | Service sends an initial RotateAIKCertRequest with a malformed issuer_public_key. | The device returns an invalid request error and closes the stream. |
| enrollz-2.6 | Service sends RotateAIKCertRequest with issuer_cert_payload but the symmetric_key_blob is missing. | The device returns an invalid request error and closes the stream. |
| enrollz-2.7 | Service sends RotateAIKCertRequest with issuer_cert_payload where the aik_cert_blob is missing. | The device returns an invalid request error and closes the stream. |
| enrollz-2.8 | Service sends RotateAIKCertRequest with issuer_cert_payload but the symmetric_key_blob is not decryptable with the device's EK. | The device cannot decrypt the session key and returns an error, closing the stream. |
| enrollz-2.9 | Service sends RotateAIKCertRequest with issuer_cert_payload where symmetric_key_blob is malformed (e.g., not valid RSAES-OAEP format). | The device fails to decrypt the symmetric_key_blob and returns an error. |
| enrollz-2.10 | Service sends RotateAIKCertRequest with issuer_cert_payload where symmetric_key_blob decrypts, but the TPM_ASYM_CA_CONTENTS digest does not match the AIK. | The device's TPM fails the TPM_ActivateIdentity step, and the device returns an error. |
| enrollz-2.11 | Service sends RotateAIKCertRequest with issuer_cert_payload where the aik_cert_blob is not decryptable with the recovered session key. | The device cannot decrypt the AIK certificate and returns an error. |
| enrollz-2.12 | Service sends RotateAIKCertRequest with issuer_cert_payload where aik_cert_blob is a malformed TPM_SYM_CA_ATTESTATION structure. | The device fails to parse the structure and returns an error. |
| enrollz-2.13 | Service sends RotateAIKCertRequest with issuer_cert_payload where the decrypted aik_cert_blob contains a malformed PEM certificate. | The device fails to install the certificate and returns an error. |
| enrollz-2.14 | Service sends an aik_cert_blob which, when decrypted, contains a certificate for a different AIK public key than the one generated by the device in Phase 1. | The device should detect the mismatch and return an error, refusing to install the certificate. |
| enrollz-2.15 | Service sends a RotateAIKCertRequest with finalize = true before the device has returned its aik_cert in Phase 4. | The device should return an error indicating the state is unexpected. |
| enrollz-2.16 | Service closes the stream prematurely at any stage. | The device enrollment process is aborted. No new AIK certificate is persisted. |
| enrollz-2.17 | Reboot at any time during enrollment (before finalize message) and restart enrollment. | The device successfully completes the enrollment and obtains AIK cert. |
| enrollz-2.18 | Reboot after successful enrollment (after finalize message) | The device comes up successfully and has AIK cert still present on the device. |
- Service: Generates an RSA 2048-bit Issuer key pair.
-
Service: Sends the
RotateAIKCertRequestcontaining theissuer_public_keyto the device. -
Device: Calls
TPM_MakeIdentity(viaTspi_TPM_collateIdentityRequestor similar).- This generates the new AIK key pair.
- This creates a
TPM_IDENTITY_REQstructure containing theTPM_IDENTITY_PROOF. -
Note: The
TPM_IDENTITY_REQinvolves a symmetric key (symBlob) and an asymmetric encryption of that key (asymBlob) using the providedissuer_public_key.
-
Device: Sends
RotateAIKCertResponsecontaining theapplication_identity_request(the rawTPM_IDENTITY_REQbytes).
Upon receiving the application_identity_request, the EnrollZ Service performs the following:
-
Parse Request: Parses the
TPM_IDENTITY_REQstructure. -
Decrypt Session Key: Uses the Issuer Private Key to decrypt the
asymBlob, retrieving theTPM_SYMMETRIC_KEY. -
Decrypt Proof: Uses the
TPM_SYMMETRIC_KEYto decrypt thesymBlob, retrieving theTPM_IDENTITY_PROOF. -
Reconstruct Contents: Constructs the
TPM_IDENTITY_CONTENTSstructure to verify the signature.-
Ver:0x01010000 -
Ordinal:0x00000079 -
labelPrivCADigest:SHA1(identityLabel || privacyCA) -
identityLabel:"Identity"(UTF-8:0x4964656e74697479) -
privacyCA: Theissuer_public_key(TPM_PUBKEY) -
identityPubKey: The AIK Public Key extracted from theTPM_IDENTITY_PROOF.
-
-
Verify Signature: Verifies the
identityBindingsignature (from the proof) against the hash of the reconstructedTPM_IDENTITY_CONTENTSusing theidentityPubKey(AIK Public Key).
Once the AIK is verified:
- Generate Cert: The Service sends the AIK Public Data to the CA and receives the AIK Certificate (PEM).
- Create Session Key: Generates a new AES-256 symmetric key.
-
Encapsulate Key (
TPM_ASYM_CA_CONTENTS):- Creates a
TPM_ASYM_CA_CONTENTSstructure. -
Digest:SHA1(TPM_PUBKEY)(Hash of the AIK Public Key). -
Encryption: Encrypts this structure using the device's Endorsement Key (EK) public key.
-
Algorithm: RSAES-OAEP with SHA-1 and MGF1. -
OAEP Parameter:"TCPA"(Required for TPM 1.2 compatibility).
-
-
Output: This forms the
symmetric_key_blobfield inIssuerCertPayload.
- Creates a
-
Encrypt Certificate:
- Encrypts the PEM-encoded AIK Certificate using the AES-256 session key generated in Step 2 (AES CBC).
- A unique Initialization Vector (IV) must be used and is typically prepended to the ciphertext.
-
Output: This forms the
aik_cert_blobfield inIssuerCertPayload(e.g.,iv || ciphertext).
-
Send: The Service sends the
RotateAIKCertRequestcontaining theIssuerCertPayloadto the device.
-
Device: Receives the
IssuerCertPayload. -
Decrypt (Activate Identity):
- The device uses its EK Private Key to decrypt the
symmetric_key_blob. This recovers the AES-256 session key. -
Note: In standard TSS, this maps to
TPM_ActivateIdentity, which validates theTPM_ASYM_CA_CONTENTSdigest against the loaded AIK.
- The device uses its EK Private Key to decrypt the
-
Decrypt Certificate: The device uses the recovered session key to decrypt the
aik_cert_blob. - Install: The device installs/stores the plaintext AIK Certificate.
-
Prove Possession: The device sends a
RotateAIKCertResponsecontaining the plaintextaik_certback to the Service.
-
Service: Compares the received
aik_certwith the original certificate it generated. -
Service: If they match, sends a
RotateAIKCertRequestwithfinalize = true. - Device: Marks the enrollment as complete.
| Parameter | Value |
|---|---|
| TPM Version | 1.2 |
| Identity Label |
"Identity" (0x4964656e74697479) |
| Structure Version | 0x01010000 |
| OAEP Parameter | "TCPA" |
| Hash Algorithm | SHA-1 |
| Symmetric Key | AES-256 (for Cert encryption) |
| Issuer Key | RSA 2048 |
paths:
rpcs:
gnmi:
gNMI.Subscribe:{}