CR85 · Laboratory mentorAsk about the current operation and its intermediate values.
Related course access:Blockchain for IoT — same laboratory, notebook and completion record.
CR85 · Academic orientation
Scope and objectives
Scope of the experiment
Replay means reusing a previously valid message. Integrity verification detects changes but does not by itself establish freshness. Sequence counters, nonce caches and timestamps have different persistence and clock assumptions.
The focus of this experiment is to evaluate timestamp windows, sequence numbers and nonce-cache state. Students then trace fresh, duplicate and not-yet-valid requests, and distinguish replay detection from authenticated-message verification. 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
Evaluate timestamp windows, sequence numbers and nonce-cache state.
Trace fresh, duplicate and not-yet-valid requests.
Distinguish replay detection from authenticated-message verification.
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 evaluate timestamp windows, sequence numbers and nonce-cache state, trace fresh, duplicate and not-yet-valid requests, and distinguish replay detection from authenticated-message verification.
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 distinguish replay detection from authenticated-message verification. Separate predicted values from observations.
Prerequisite knowledge and related learning
Review the following catalogue prerequisites before starting. After completion, continue to Kerberos V5 AS/TGS/service ticket dialogue.
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
CR85 · Replay cache, sequence and timestamp checks
Freshness requires receiver state. A nonce cache rejects duplicates; a timestamp window rejects stale messages and assumes clock synchronization. The model assumes tag verification precedes freshness checks.
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
Freshness requires receiver state. A nonce cache rejects duplicates; a timestamp window rejects stale messages and assumes clock synchronization. The model assumes tag verification precedes freshness checks.
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: Recorded, verified Python scenarios; use Python for arbitrary inputs
Technical scope: Freshness model assumes authenticated inputs.
Replay prevention
1 · Principles and purpose
Replay means reusing a previously valid message. Integrity verification detects changes but does not by itself establish freshness. Sequence counters, nonce caches and timestamps have different persistence and clock assumptions.
2 · Mathematical and algorithmic foundations
A sample acceptance predicate is valid tag AND sequence>last AND nonce not seen. Commit state only after checks. Timestamp windows require clock policy and replay cache within the window.
With last sequence 2, a valid message at 3 can be accepted once; replay at 3 fails. An invalid tag at 100 must not update the state. Real systems need atomic state and reset handling.
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.
Replay rejection and clock boundaries
This model uses an inclusive symmetric clock-skew window and a single authenticated synthetic nonce. A nonce is recorded after a valid first request. Cache resets between independent runs; a real cache must be durable or scoped to authenticated sessions, and entries should expire consistently with the replay window.
Use the operation-by-operation diagram below. The highlighted stage follows the active Simulation trace. Change inputs in Simulation, then return here to inspect the updated sequence.
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 2 · Calculated state 1
Calculated state 1
attempt
1
age
2
within_window
true
nonce_unused
true
accepted
true
Calculated state 2
attempt
2
age
2
within_window
true
nonce_unused
false
accepted
false
Teaching example only; inspect live calculations or real practical evidence separately.
Shared research workbenches · network designer & advanced studiesConcurrent-device simulation & Monte Carlo research
Calculated baseline diagram · enable JavaScript to explore changed inputs.
Edit the parameters, then Calculate / run. The local model recomputes the trace. No remote service or host configuration is changed.
Calculated result · current inputs
{
"first": true,
"second": false
}
Complete trace
Guided simulation activity
Set now=100 and window=5. Test timestamps 94, 95, 100, 105 and 106. Record signed age, time-window decision and both replay attempts. Explain why the cache is committed only after acceptance and why clock checks alone cannot stop reuse.
Freshness requires receiver state. A nonce cache rejects duplicates; a timestamp window rejects stale messages and assumes clock synchronization. The model assumes tag verification precedes freshness checks.
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
Set now=100 and inclusive window=5 seconds. Assume valid tags and an initially empty nonce cache. Test (timestamp98, nonce A), repeat A, then (90,B), then (95,C). Explain when state changes.
Application and derivation — A sample acceptance predicate is valid tag AND sequence>last AND nonce not seen. Commit state only after checks. Timestamp windows require clock policy and replay cache within the window. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Boundary reasoning
Boundary reasoning · Independent work
Clock now200, allowable absolute skew5 seconds, nonce cache contains A. Independently test (timestamp195,nonceB), (206,C), (200,A), assuming valid authentication.
Boundary reasoning — 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 · CR85-01
For the separate teaching-test configuration now: 100; timestamp: 90; window: 5, predict first 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 · CR85-02
A teaching trace for Replay cache, sequence and timestamp checks contains attempt: 2; age: 2; within_window: true; nonce_unused: false; accepted: false. Explain the role of accepted (recorded value false) and identify the rule or input that determines it. Distinguish an intermediate state from the final result.
Intermediate · Compare two recorded states
Independent theoretical exercise · CR85-03
The first and final trace records show attempt = 1 and 2. Calculate the signed difference and explain whether it is an operation count, a state value or a measurement.
Challenging · Controlled algorithm verification
Independent theoretical exercise · CR85-04
Plan a comparison of now: 100; timestamp: 98; window: 5 with now: 100; timestamp: 90; window: 5. Record the dependent value first, 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.
Experimental inputs
Experimental reference · json
{"now":100,"timestamp":98,"window":5}
Verified baseline reference (check after predicting)
Experimental reference · json
{"first":true,"second":false}
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.
Set now=100 and window=5. Test timestamps 94, 95, 100, 105 and 106. Record signed age, time-window decision and both replay attempts. Explain why the cache is committed only after acceptance and why clock checks alone cannot stop reuse.
Record inputs and complete traces for each trial, holding all other parameters constant.
Compare Python results to the corresponding browser model; report any difference in scope or measured behavior.
Trial
Input configuration
Prediction
Observed
Verification
1
{"now":100,"timestamp":98,"window":5}
2
{"now":100,"timestamp":90,"window":5}
Use the table as a recording template; enter your own measured values in the field below or reproduce it in your report.
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 timestamps 98 and 90 with window=5. Explain how cache reset and clock skew affect guarantees.
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.
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 CR85
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: # Python standard library only
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 CR85/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 | CR85
# Experiment: replay cache sequence and timestamp checks
# Purpose: expose algorithm states and verify the experiment invariant.
# ------------------------------------------------------------
# CR85 | Replay cache, sequence and timestamp checks
# Execute the named operation; expose states and assert the laboratory invariant.
import json
DEFAULT={'now': 100, 'timestamp': 98, 'window': 5}
ALTERNATE={'timestamp': 90}
def run(overrides=None):
# Merge only explicitly supplied inputs with the lecture baseline.
params={**DEFAULT, **(overrides or {})}
now=params['now']
timestamp=params['timestamp']
window=params['window']
if any(type(x) is not int or not 0 <= x <= 1000000 for x in (now,timestamp,window)):
raise ValueError('Invalid classroom input')
seen=set();steps=[];nonce='classroom-1'
for attempt in range(2):
timely=abs(now-timestamp)<=window;fresh=nonce not in seen;accepted=timely and fresh
if accepted:seen.add(nonce)
steps.append({'attempt':attempt+1,'age':now-timestamp,'within_window':timely,'nonce_unused':fresh,'accepted':accepted})
result={'first':steps[0]['accepted'],'second':steps[1]['accepted']}
# Independently check the stated mathematical or protocol invariant.
assert result["first"]==(abs(now-timestamp)<=window) and not result["second"], "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
{
"first": true,
"second": false
}
05 · Interactive flashcards
Recall before revealing. Review and mastery ratings remain on this device.
Browse all explanationsWhat is the defining principle?
Freshness requires receiver state. A nonce cache rejects duplicates; a timestamp window rejects stale messages and assumes clock synchronization. The model assumes tag verification precedes freshness checks.
How do I verify the result?
Compare timestamps 98 and 90 with window=5. Explain how cache reset and clock skew affect guarantees.
What does this experiment not establish?
Freshness model assumes authenticated inputs.
What input settings define the baseline for this experiment?
now = 100; timestamp = 98; window = 5
What is the first intermediate state in the baseline?
Compare timestamps 98 and 90 with window=5. Explain how cache reset and clock skew affect guarantees. 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.