|
| 1 | +# TPM Endorsement Certificates |
| 2 | + |
| 3 | +TPM manufactures provision Endorsement Certificates based on a TPM key. This certificate can be used for signing/endorsement. |
| 4 | + |
| 5 | +The `get_ek_certs` example will enumerate and validate the Endorsement Key Certificates stored in the NV TCG region. |
| 6 | + |
| 7 | +We have loaded some of the root and intermediate CA's into the trusted_certs.h file. |
| 8 | + |
| 9 | +## Example Detail |
| 10 | + |
| 11 | +1) Get handles in the TCG NV range using `wolfTPM2_GetHandles` with `TPM_20_TCG_NV_SPACE`. |
| 12 | +2) Get size of the certificate by reading the public NV information using `wolfTPM2_NVReadPublic`. |
| 13 | +3) Read the NV data (certificate DER/ASN.1) from the NV index using `wolfTPM2_NVReadAuth`. |
| 14 | +4) Get the EK public template using the NV index by calling `wolfTPM2_GetKeyTemplate_EKIndex` or `wolfTPM2_GetKeyTemplate_EK`. |
| 15 | +5) Create the primary endorsement key with public template and TPM_RH_ENDORSEMENT hierarchy using `wolfTPM2_CreatePrimaryKey`. |
| 16 | +6) Parse the ASN.1/DER certificate using `wc_ParseCert` to extract issuer, serial number, etc... |
| 17 | +7) The URI for the CA issuer certificate can be obtained in `extAuthInfoCaIssuer`. |
| 18 | +8) Import the certificate public key and compare it against the primary EK public unique area. |
| 19 | +9) Use the wolfSSL Certificate Manager to validate the EK certificate. Trusted certificates are loaded using `wolfSSL_CertManagerLoadCABuffer` and the EK certificate is validated using `wolfSSL_CertManagerVerifyBuffer`. |
| 20 | +10) Optionally covert to PEM and export using `wc_DerToPem`. |
| 21 | + |
| 22 | +## Example certificate chains |
| 23 | + |
| 24 | +### Infineon SLB9672 |
| 25 | + |
| 26 | +Infineon certificates for TPM 2.0 can be downloaded from the following URLs (replace xxx with 3-digit CA number): |
| 27 | + |
| 28 | +https://pki.infineon.com/OptigaRsaMfrCAxxx/OptigaRsaMfrCAxxx.crt |
| 29 | +https://pki.infineon.com/OptigaEccMfrCAxxx/OptigaEccMfrCAxxx.crt |
| 30 | + |
| 31 | + |
| 32 | +Examples: |
| 33 | + |
| 34 | +- Infineon OPTIGA(TM) RSA Root CA 2 |
| 35 | + - Infineon OPTIGA(TM) TPM 2.0 RSA CA 059 |
| 36 | +- Infineon OPTIGA(TM) ECC Root CA 2 |
| 37 | + - Infineon OPTIGA(TM) TPM 2.0 ECC CA 059 |
| 38 | + |
| 39 | +### STMicro ST33KTPM |
| 40 | + |
| 41 | +Example: |
| 42 | + |
| 43 | +- STSAFE RSA root CA 02 (http://sw-center.st.com/STSAFE/STSAFERsaRootCA02.crt) |
| 44 | + - STSAFE-TPM RSA intermediate CA 10 (http://sw-center.st.com/STSAFE/stsafetpmrsaint10.crt) |
| 45 | +- STSAFE ECC root CA 02 (http://sw-center.st.com/STSAFE/STSAFEEccRootCA02.crt) |
| 46 | + - STSAFE-TPM ECC intermediate CA 10 (http://sw-center.st.com/STSAFE/stsafetpmeccint10.crt) |
0 commit comments