IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
CRYPTOGRAPHY ENGINEERING · CR75 · PKI
IoT Security and Privacy
Certificate trust chain and revocation decisions
A valid signature is insufficient: trust anchor, intermediates, validity, hostname and applicable revocation policy all matter.
CR75 · Laboratory mentorAsk about the current operation and its intermediate values.
Related course access:Blockchain for IoT — same laboratory, notebook and completion record.
CR75 · Academic orientation
Scope and objectives
Scope of the experiment
A trust anchor is an externally configured root. Intermediate CAs require appropriate constraints and key usage; the leaf must have suitable usage, identity and time validity.
The focus of this experiment is to trace leaf, intermediate and root trust relationships. Students then test chain, hostname, time and revocation conditions, and verify a local path using OpenSSL and explain why a signature alone is insufficient. The Concepts view explains the operation before the practical work; the Simulation view is used to examine reference and changed inputs, not to substitute for actual measurements.
Learning objectives
Trace leaf, intermediate and root trust relationships.
Test chain, hostname, time and revocation conditions.
Verify a local path using OpenSSL and explain why a signature alone is insufficient.
Record the relevant inputs, intermediate states and final verification result before changing the reference configuration.
Compare the reference calculation or decision with an independent implementation or authorized observation; state any discrepancy and the applicable model boundary.
Expected learning outcomes
On completion, students can trace leaf, intermediate and root trust relationships, test chain, hostname, time and revocation conditions, and verify a local path using OpenSSL and explain why a signature alone is insufficient.
Required deliverables
Submit the derivation or state trace for the named operation, the exact reference and changed configurations, the associated simulator or practical evidence, and a short validation statement addressing verify a local path using OpenSSL and explain why a signature alone is insufficient. Separate predicted values from observations.
Prerequisite knowledge and related learning
Review the following catalogue prerequisites before starting. After completion, continue to IPsec AH/ESP transport and tunnel packet layout.
A standard browser and the experiment-specific Python implementation or Colab notebook. Where the practical uses a protocol model, model results are distinguished from actual local cryptographic operations.
Begin with a manual prediction, record the baseline, change one independent condition at a time, and compare the resulting trace or measurements with the original prediction. Record observations and uncertainty separately from reference values. Follow the experiment’s specific procedure, safety limits, and acceptance checks.
01 · Experiment overview
CR75 · Certificate trust chain and revocation decisions
A valid signature is insufficient: trust anchor, intermediates, validity, hostname and applicable revocation policy all matter. Revocation checking depends on client policy and infrastructure.
Learning objectives
Trace the named operation, reproduce intermediate values, verify the result and explain the consequences of a controlled change.
Complete the six stages in order. Use the same experiment inputs when comparing manual, browser and Python results.
02 · Concepts and mathematical foundations
The root is a configured trust anchor; the intermediate is signed by that root and the leaf by the intermediate. A valid path also requires validity, endpoint name and the applicable revocation policy. The browser shows a simplified conjunction of five policy gates, not a full RFC 5280 validator. The Python/OpenSSL extension performs actual local chain checks, including a generated CRL.
Learning objectives
Trace the named operation, reproduce intermediate values, verify the result and explain the consequences of a controlled change.
Mathematical verification and controlled comparison
Substitute the output into its defining equation or check the protocol invariant. A controlled comparison changes one input while holding others fixed. Cite actual trace values and identify the limitations of the evidence.
Before starting
Environment: standard computer, browser and Python/WSL.
Simulation: Live policy calculation; actual cryptographic operations are demonstrated in the local toolkit.
Technical scope: Explicit path-policy model, not a complete RFC 5280 validator.
PKI path and revocation
1 · Principles and purpose
A trust anchor is an externally configured root. Intermediate CAs require appropriate constraints and key usage; the leaf must have suitable usage, identity and time validity.
2 · Mathematical and algorithmic foundations
Policy combines trust path, signature checks, validity, hostname, purpose and configured revocation checks. A CRL lists revoked serial numbers; OCSP can provide status under its policy.
3 · Worked teaching example
A valid signature alone cannot override expiry or hostname mismatch. Compare local OpenSSL outcomes for a valid chain and one failed condition at a time; do not equate a simplified browser policy with full RFC path validation.
{
"check": "not revoked under configured policy",
"pass": true
}
Recorded result
{
"accepted": true,
"failed": []
}
Captured earlier local execution. Randomized values and timing can differ; compare the invariant.
4 · Verification and experimental interpretation
Step through the following visualization and compare the named operation with the corresponding computed state. Check the mathematical invariant, inverse operation or protocol acceptance condition. Change one input at a time; distinguish a measured output from a prediction.
Concept animation · independent state notebook
Explore the teaching example independently of the simulator. Each step reveals an operation, data relationship or calculated state. The Simulation view has separate editable inputs.
Step 1 of 5 · Calculated state 1
Calculated state 1
check
trusted root
pass
true
Calculated state 2
check
intermediate supplied
pass
true
Calculated state 3
check
validity period
pass
true
Calculated state 4
check
hostname matches
pass
true
Calculated state 5
check
not revoked under configured policy
pass
true
Teaching example only; inspect live calculations or real practical evidence separately.
Shared research workbenches · network designer & advanced studiesConcurrent-device simulation & Monte Carlo research
Verified baseline reference — use the live workstation below to explore steps and compare inputs.
Edit the policy inputs and calculate. The workstation evaluates the selected conditions live; it is an explicit educational model, not a full network implementation.
Calculated or verified result
{
"accepted": true,
"failed": []
}
Complete trace
Guided simulation activity
Use the baseline inputs shown above. Predict a result, advance one operation at a time, inspect the intermediate state, then change only the parameter specified in the Experiments view. Export the trace and compare it with your manual derivation.
The root is a configured trust anchor; the intermediate is signed by that root and the leaf by the intermediate. A valid path also requires validity, endpoint name and the applicable revocation policy. The browser shows a simplified conjunction of five policy gates, not a full RFC 5280 validator. The Python/OpenSSL extension performs actual local chain checks, including a generated CRL.
Predict the baseline result before revealing the calculated state. A controlled comparison changes the named input while keeping the other conditions fixed. Record an observed value separately from an expected value.
Part A · Independent theoretical exercises
Complete each question before running the simulator or Python. Show calculations or protocol traces. The teaching example is a method, not a substitute for the assigned values.
01 · Application and derivation
Application and derivation · Independent work
For a trusted root, valid intermediate, valid time and matching hostname, predict outcomes when exactly one check fails, including revocation under the configured policy. Draw the chain and identify where trust is anchored.
Application and derivation — Policy combines trust path, signature checks, validity, hostname, purpose and configured revocation checks. A CRL lists revoked serial numbers; OCSP can provide status under its policy. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Trust analysis
Trust analysis · Independent work
A chain contains root R and leaf L signed by intermediate I. I is absent and unavailable; R trusted. Predict path validation under this fixture.
Trust analysis — Review the defining equations and compare the input restrictions and state transitions in Concepts. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
Required evidence: state the expected invariant or acceptance condition; record hand-derived results, compare with the simulator or Python trace, and explain the first discrepancy. Do not report a predicted value as a measurement.
Expanded independent theoretical exercise bank
Progress from calculation and interpretation to diagnosis and controlled engineering design. Complete the questions without opening the simulation first; show intermediate steps.
Intermediate · Alternate configuration
Independent theoretical exercise · CR75-01
For the separate teaching-test configuration trusted: true; intermediate: true; time_valid: true; hostname_valid: false; revoked: false, predict accepted using the relevant operation or decision rule. Show intermediate work and state whether this is a deterministic result.
Intermediate · Interpret a computation state
Independent theoretical exercise · CR75-02
A teaching trace for Certificate trust chain and revocation decisions contains check: intermediate supplied; pass: true. Explain the role of pass (recorded value true) and identify the rule or input that determines it. Distinguish an intermediate state from the final result.
Advanced · Identify a terminal invariant
Independent theoretical exercise · CR75-03
The first teaching trace contains check: trusted root; pass: true; the last contains check: not revoked under configured policy; pass: true. Identify one distinction between the initial operation and completion. What additional condition must hold to use the result?
Challenging · Controlled algorithm verification
Independent theoretical exercise · CR75-04
Plan a comparison of trusted: true; intermediate: true; time_valid: true; hostname_valid: true; revoked: false with trusted: true; intermediate: true; time_valid: true; hostname_valid: false; revoked: false. Record the dependent value accepted, identify the changed factor(s), and describe the verification and failure criterion without claiming a real security measurement.
Part B · Guided simulation and practical procedure
Before starting — tools and setup
Standard computer; extract the WSL toolkit into a new directory. For the browser activity, use the integrated workstation. Verified browser scenarios; arbitrary inputs in Python (protocol simulations are models unless identified as executed local protocol tests).
Install Python dependencies only if required by the selected toolkit README. Use its requirements file and virtual environment instructions.
Use the exact baseline input below and write a prediction.
Select the baseline configuration below. Predict the relevant operation using the theory; execute the workstation and record the first and final state. Reproduce the same input with Python.
Save the trace and compare it with the reference output.
Verified baseline reference (check after predicting)
Experimental reference · json
{"accepted":true,"failed":[]}
Compare your baseline with the verified reference output below; for runtime-dependent results, compare invariants and report actual measurements instead of expecting identical timing or randomly generated values.
Evidence to record
Record the named intermediate values and final outputs from the selected trace.
Compare valid and wrong-hostname scenarios. Independently toggle expiry, missing intermediate, revocation and trust in Python; record failure reason.
Record the conditions held fixed: Keep all inputs other than the stated comparison parameter unchanged; where the task compares protocol configurations, document every changed field.
Collect Record the named intermediate values and final outputs from the selected trace. Compare the first differing intermediate step and explain the relationship.
Part E/F · Independent Python verification and deliverables
Download the notebook or toolkit and run the default example.
Reproduce at least one changed input; compare the intermediate values with the browser where supported.
Complete the independent assessment below without copying the worked baseline. Explain discrepancies and distinguish mathematical results from security claims.
Additional investigation instructions
Read the theory and prerequisite labs. Run the baseline and record the input and result.
Compare valid and wrong-hostname scenarios. Independently toggle expiry, missing intermediate, revocation and trust in Python; record failure reason.
Locate the first intermediate step where the two cases differ. Verify the defining equation or decision rule.
Submit a two-row comparison table, trace evidence and a conclusion with limitations.
Case
Input
Observed result
Verification
Limitation
Baseline
Record
Record
Derive
Explain
Changed
Record
Record
Derive
Explain
PKI engineering investigation
Start with all trust gates enabled and revoked=false. Toggle each gate separately; record which check fails. Run verify_chain.py and compare the six actual OpenSSL outcomes to your prediction. Explain why an untrusted root cannot be repaired merely by providing a valid signature.
Record the selected condition, predicted decision, observed state and verification outcome. Change one condition at a time. Explain any difference between the model and actual cryptographic verification.
Use Ubuntu or Kali WSL, not PowerShell. Download the toolkit above to your computer. If Python, venv or unzip is missing, install these prerequisites once (requires administrator permission and network access).
In WSL, enter the actual downloaded ZIP path when prompted (for example, a file under /mnt/c/Users/…/Downloads). Extract to a new, dedicated directory. If this directory already exists from a previous extraction, use the existing verified toolkit or choose a clean directory rather than overwriting it.
Step 1 · Extract · bash
read -r -p "Full path to PSUT_V22_9_9_Cryptography_WSL.zip: " ZIP
DEST="$HOME/psut-crypto-v22.9.9"
if [ -f "$ZIP" ] && [ ! -e "$DEST" ]; then
mkdir "$DEST" && unzip "$ZIP" -d "$DEST"
else
echo "Check ZIP path and use a fresh destination."
fi
Create the isolated environment in the extracted toolkit root, activate it, then enter this experiment’s actual folder. Install only its declared dependencies. A comment-only requirements file requires no third-party packages.
Step 2 · Activate and install · bash
cd ~/psut-crypto-v22.9.9
python3 -m venv .venv
source .venv/bin/activate
cd CR75
ls
python -m pip install -r requirements.txt
Execute the default run and save the genuine program output. Then run the supplied regression test and the baseline fixture through the explicit input interface.
To change inputs, copy example-input.json, edit the copy in a text editor and run the command below. The original fixture is preserved.
Step 4 · Change an input · bash
cp example-input.json my-input.json
# Edit my-input.json with your preferred editor.
python lab.py --inputs "$(cat my-input.json)"
These scripts terminate normally. Use Ctrl+C to stop a long-running calculation if needed. When finished, leave the isolated virtual environment; no global service cleanup is required for these local examples.
Step 5 · Finish · bash
deactivate
Declared dependencies: cryptography>=42 (extended practical); OpenSSL executable required for actual path verification.
Expected terminal output — captured local execution
This excerpt contains the actual first trace step and final result from python lab.py, followed by the actual regression test output. Full stdout is in CR75/verified-output.txt inside the toolkit. Timing, random signatures, keys, certificate fields and implementation-dependent sizes can vary; compare the invariant and record your own observations.
Check the output JSON and the test exit status. An assertion error means the expected invariant was not met. If Python reports a missing module, activate the environment and install the experiment’s requirements file; if a file is missing, check pwd and ls.
Download the notebook, open Google Colab and upload it using File → Upload notebook. For local Linux/WSL execution, follow the command blocks below in order.
Inspect Python source
Documented Python implementation · python
# ------------------------------------------------------------
# PSUT IoT Engineering Studio | CR75
# Experiment: certificate trust chain and revocation decisions
# Purpose: expose algorithm states and verify the experiment invariant.
# ------------------------------------------------------------
# CR75 | Certificate trust chain and revocation decisions
# Execute the named operation; expose states and assert the laboratory invariant.
import json
DEFAULT={'trusted': True, 'intermediate': True, 'time_valid': True, 'hostname_valid': True, 'revoked': False}
ALTERNATE={'hostname_valid': False}
def run(overrides=None):
# Merge only explicitly supplied inputs with the lecture baseline.
params={**DEFAULT, **(overrides or {})}
trusted=params['trusted']
intermediate=params['intermediate']
time_valid=params['time_valid']
hostname_valid=params['hostname_valid']
revoked=params['revoked']
checks={'trusted root':trusted,'intermediate supplied':intermediate,'validity period':time_valid,'hostname matches':hostname_valid,'not revoked under configured policy':not revoked};steps=[{'check':k,'pass':v} for k,v in checks.items()];result={'accepted':all(checks.values()),'failed':[k for k,v in checks.items() if not v]}
# Independently check the stated mathematical or protocol invariant.
assert result["accepted"]== (trusted and intermediate and time_valid and hostname_valid and not revoked), "verification failed"
return {"steps":steps,"result":result}
if __name__ == "__main__":
import argparse
parser=argparse.ArgumentParser();parser.add_argument("--inputs",default="{}");parser.add_argument("--test",action="store_true");args=parser.parse_args()
if args.test:
for case in [{},ALTERNATE]:run(case)
print("PASS")
else:print(json.dumps(run(json.loads(args.inputs)),indent=2))
Baseline reference (randomized fields may vary)
Reference result · json
{
"accepted": true,
"failed": []
}
Extended local verification exercise
Run from the active CR75 directory after completing the toolkit setup. The generated CA is not installed into your system trust store.
# ------------------------------------------------------------
# PSUT IoT Engineering Studio | CR75
# Build and verify an isolated root/intermediate/leaf chain.
# No keys or certificates are installed in a system trust store.
# ------------------------------------------------------------
from datetime import datetime, timedelta, timezone
from pathlib import Path
from tempfile import TemporaryDirectory
import json
import shutil
import subprocess
from cryptography import x509
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.x509.oid import NameOID, ExtendedKeyUsageOID
def verify():
"""Compare OpenSSL path verification under controlled failure conditions."""
if not shutil.which('openssl'):
raise RuntimeError('Install openssl in the Linux environment first.')
now = datetime.now(timezone.utc)
def name(s):
return x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, s)])
def make(subject, key, issuer, signing, ca, path=None):
# The leaf is restricted to server authentication. CA keys sign certificates/CRLs.
builder = (x509.CertificateBuilder().subject_name(name(subject))
.issuer_name(name(issuer)).public_key(key.public_key())
.serial_number(x509.random_serial_number())
.not_valid_before(now - timedelta(days=1))
.not_valid_after(now + timedelta(days=2))
.add_extension(x509.BasicConstraints(ca=ca, path_length=path), True)
.add_extension(x509.KeyUsage(not ca, False, False, False, False, ca, ca, False, False), True)
.add_extension(x509.SubjectKeyIdentifier.from_public_key(key.public_key()), False)
.add_extension(x509.AuthorityKeyIdentifier.from_issuer_public_key(signing.public_key()), False))
if not ca:
builder = (builder.add_extension(x509.SubjectAlternativeName([x509.DNSName(subject)]), False)
.add_extension(x509.ExtendedKeyUsage([ExtendedKeyUsageOID.SERVER_AUTH]), False))
return builder.sign(signing, hashes.SHA256())
root, intermediate, leaf, other = [ec.generate_private_key(ec.SECP256R1()) for _ in range(4)]
r = make('PSUT Lab Root', root, 'PSUT Lab Root', root, True, 1)
i = make('PSUT Lab Intermediate', intermediate, 'PSUT Lab Root', root, True, 0)
c = make('sensor.lab', leaf, 'PSUT Lab Intermediate', intermediate, False)
o = make('Unrelated Root', other, 'Unrelated Root', other, True, 1)
# Local CRL explicitly lists the synthetic leaf serial; no external OCSP/CRL service.
revoked = x509.RevokedCertificateBuilder().serial_number(c.serial_number).revocation_date(now - timedelta(minutes=1)).build()
crl = (x509.CertificateRevocationListBuilder().issuer_name(i.subject)
.last_update(now - timedelta(minutes=2)).next_update(now + timedelta(days=1))
.add_revoked_certificate(revoked)
.add_extension(x509.AuthorityKeyIdentifier.from_issuer_public_key(intermediate.public_key()), False)
.sign(intermediate, hashes.SHA256()))
with TemporaryDirectory(prefix='psut-cr75-') as tmp:
work = Path(tmp)
for n, cert in [('root',r),('intermediate',i),('leaf',c),('other',o),('revoked',crl)]:
(work / (n + '.pem')).write_bytes(cert.public_bytes(serialization.Encoding.PEM))
common = ['-CAfile','root.pem','-untrusted','intermediate.pem','-verify_hostname','sensor.lab','-purpose','sslserver','-x509_strict']
trials = [('baseline',common,True),('hostname mismatch',common+['-verify_hostname','wrong.lab'],False),
('missing intermediate',['-CAfile','root.pem','-verify_hostname','sensor.lab'],False),
('untrusted root',['-CAfile','other.pem','-untrusted','intermediate.pem','-verify_hostname','sensor.lab'],False),
('expired chain',common+['-attime',str(int((now+timedelta(days=3)).timestamp()))],False),
('revoked leaf',common+['-crl_check','-CRLfile','revoked.pem'],False)]
results=[]
for label, args, expected in trials:
p = subprocess.run(['openssl','verify',*args,'leaf.pem'],cwd=work,capture_output=True,text=True,timeout=10)
accepted = p.returncode == 0
assert accepted == expected, (label,p.stdout,p.stderr)
results.append({'trial':label,'accepted':accepted,'expected':expected,'output':(p.stdout+p.stderr).strip()})
return results
if __name__ == '__main__':
print(json.dumps(verify(),indent=2))
Captured local execution output · text
[
{
"trial": "baseline",
"accepted": true,
"expected": true,
"output": "leaf.pem: OK"
},
{
"trial": "hostname mismatch",
"accepted": false,
"expected": false,
"output": "CN=sensor.lab\nerror 62 at 0 depth lookup: hostname mismatch\nerror leaf.pem: verification failed"
},
{
"trial": "missing intermediate",
"accepted": false,
"expected": false,
"output": "CN=sensor.lab\nerror 20 at 0 depth lookup: unable to get local issuer certificate\nerror leaf.pem: verification failed"
},
{
"trial": "untrusted root",
"accepted": false,
"expected": false,
"output": "CN=PSUT Lab Intermediate\nerror 20 at 1 depth lookup: unable to get local issuer certificate\nerror leaf.pem: verification failed"
},
{
"trial": "expired chain",
"accepted": false,
"expected": false,
"output": "CN=PSUT Lab Root\nerror 10 at 2 depth lookup: certificate has expired\nCN=PSUT Lab Intermediate\nerror 10 at 1 depth lookup: certificate has expired\nCN=sensor.lab\nerror 10 at 0 depth lookup: certificate has expired\nerror leaf.pem: verification failed"
},
{
"trial": "revoked leaf",
"accepted": false,
"expected": false,
"output": "CN=sensor.lab\nerror 23 at 0 depth lookup: certificate revoked\nerror leaf.pem: verification failed"
}
]
05 · Interactive flashcards
Recall before revealing. Review and mastery ratings remain on this device.
Browse all explanationsWhat is the defining principle?
A valid signature is insufficient: trust anchor, intermediates, validity, hostname and applicable revocation policy all matter. Revocation checking depends on client policy and infrastructure.
How do I verify the result?
Compare valid and wrong-hostname scenarios. Independently toggle expiry, missing intermediate, revocation and trust in Python; record failure reason.
What does this experiment not establish?
Explicit path-policy model, not a complete RFC 5280 validator.
What input settings define the baseline for this experiment?
What is the first intermediate state in the baseline?
check: trusted root; pass: true
06 · Knowledge assessment
Compare valid and wrong-hostname scenarios. Independently toggle expiry, missing intermediate, revocation and trust in Python; record failure reason. Choose one valid input not included in the browser cases, calculate it in Python, and explain the first changed intermediate value. Include a failure or boundary case where applicable. Criteria: mathematical correctness 40%, reproducible evidence 30%, interpretation 20%, scope 10%.
Part F · Engineering evidence record
Record the baseline, prediction, changed input, observed result, discrepancy and limitation. Save locally or export with the displayed result. This is not an official submission.