Great --- let's map this directly to your HAB ( i.MXRT) / CST workflow, so it becomes crystal clear.
🔐 1. Big picture: where your key pair is used
When you run:
openssl genrsa -out ca_key.pem 2048
``
👉 You create the root of trust (private key)
From that, everything else is built:
[ Private Key ] → derive → [ Public Key ]
↓ ↓
used to sign embedded in certificate
↓ ↓
firmware signing verification in ROM (HAB)
🧱 2. Full HAB PKI flow (your real use case)
✅ Step 1: Generate private key (SRK or CA)
openssl genrsa -out srk1_key.pem 2048
👉 This is your signing key
Keep it secret 🔒
✅ Step 2: Generate certificate (contains public key)
openssl req -new -x509 -key srk1_key.pem -out srk1_cert.pem
``
👉 This creates:
-
X.509 certificate
-
Contains:
-
Public key ✅
-
Metadata (issuer, validity)
-
✅ Step 3: Build SRK table
-
Multiple certificates (
srk1_cert.pem,srk2_cert.pem, etc.) -
Combined into SRK table
👉 Then:
-
Hash is burned into eFuse
SRK Hash → stored in chip (immutable)
✅ Step 4: Sign firmware (using private key)
CST uses your private key:
cst --input csf.txt --output csf.bin
Inside CSF:
Install SRK
Install CSF Key
Authenticate Data
👉 Signing happens using:
srk1_key.pem (PRIVATE)
✅ Step 5: Boot-time verification (HAB)
ROM does:
1. Read SRK hash from eFuse
2. Compare with certificate in image
3. Extract PUBLIC KEY from certificate
4. Verify signature
👉 Important:
-
ROM never sees private key
-
It only uses public key from certificate
🔁 3. Mapping commands → HAB roles
| Step | Command | Used for | HAB Role |
|---|---|---|---|
| Key generation | openssl genrsa |
Private key | Signing |
| Public extraction | openssl rsa -pubout |
Public key | Embedded |
| Certificate | openssl req |
Wrap public key | SRK |
| CST signing | cst |
Use private key | Sign image |
| Boot ROM | (hardware) | Uses cert public key | Verify |
🧠 4. Key insight (VERY important)
👉 In HAB:
The certificate is just a container for the public key
The private key is the real authority
🔍 5. Why you don't explicitly "generate a pair"
You asked:
how to use
genrsato generate key pair?
Answer in HAB context:
You already did ✅
openssl genrsa -out srk1_key.pem 2048
👉 This file already contains:
-
Full private key
-
Enough info to derive public key
Then:
openssl rsa -in srk1_key.pem -pubout -out srk1_pub.pem
👉 Extracts public portion
⚠️ 6. Common mistakes (important for your debugging)
❌ Mistake 1: Thinking certificate = key pair
- Certificate only has public key
❌ Mistake 2: Losing private key
-
If
srk_key.pemis lost:-
You can still boot old images ✅
-
But cannot sign new firmware ❌
-
❌ Mistake 3: Mismatch key and cert
-
If cert doesn't match private key:
- HAB authentication fails
✅ 7. Simple diagram (HAB trust chain)
[ srk_key.pem ] (PRIVATE 🔒)
↓
signs firmware
↓
-------------------
| firmware + |
| certificate |
-------------------
↓
[ i.MX RT Boot ROM ]
↓
extract PUBLIC KEY from cert
↓
verify signature ✅
✅ Final takeaway
In HAB:
openssl genrsacreates the root signing authority (private key)Public key is derived and wrapped into a certificate
Private key signs firmware, public key verifies it in hardware