Learning objectives
After reading this guide, you should be able to:
- Explain the security goals and limitations of AUTOSAR Secure Onboard Communication (SecOC).
- Distinguish the authentic I-PDU, secured I-PDU, freshness value and authenticator.
- Locate SecOC in a typical AUTOSAR Classic communication path.
- Describe sender and receiver processing, including freshness handling and cryptographic-service integration.
- Identify configuration items that must match across communicating ECUs.
- Plan positive, negative, boundary and recovery tests.
- Investigate authentication failures without exposing secret key material.
Scope note: SecOC parameters, interfaces, supported profiles, generated APIs and module boundaries vary by AUTOSAR release, platform configuration and OEM security architecture. The diagrams and examples below are conceptual. Use the exact AUTOSAR release, supplier implementation documentation and project security baseline as the authority for implementation details.
1. What is AUTOSAR SecOC?
Secure Onboard Communication (SecOC) is an AUTOSAR mechanism for protecting communication between electronic control units (ECUs). It is designed to provide:
- Authenticity: evidence that a message was generated by an entity possessing the appropriate cryptographic key.
- Integrity: detection of unauthorized modification to the protected message data.
- Freshness / replay protection: a means for the receiver to distinguish current communication from previously valid messages that are replayed.
SecOC associates the authentic data with freshness-related information and a message authenticator. The receiver validates the security information before the authentic data is accepted by the configured communication path.
SecOC does not inherently encrypt the application payload. A captured secured PDU may still reveal its authentic data. If confidentiality is required, it must be addressed by a separately designed and approved mechanism.
1.1 Threats addressed and limitations
| Threat or requirement | SecOC contribution | Important limitation |
|---|---|---|
| Payload modification in transit | Authentication detects changes to protected data | Only the configured authenticated data and inputs are covered |
| Forged message injection | A valid authenticator requires the appropriate key | Key compromise can undermine this protection |
| Replay of an old valid message | Freshness checks help reject stale messages | Correct state management and recovery are essential |
| Payload confidentiality | Not provided by SecOC itself | Use a separate confidentiality design if required |
| Availability / denial of service | Not solved by message authentication | Network and system-level protections are still required |
SecOC is one part of a vehicle cybersecurity architecture. It does not replace secure boot, secure diagnostics, access control, key lifecycle management, network segmentation or system-level threat analysis.
2. SecOC architecture in AUTOSAR Classic
SecOC is commonly integrated into the communication stack so that application software can continue to exchange its configured I-PDUs while the communication infrastructure performs protection and verification.
A simplified transmit path is:
SWC → RTE → COM → PduR → SecOC → PduR / lower communication modules → bus
A corresponding receive path is conceptually:
bus → lower communication modules → PduR → SecOC → PduR → COM → RTE → SWC
The exact placement, routing and API relationships depend on the ECU configuration and AUTOSAR release. Some architectures use different routing arrangements, including gateway or protection-termination designs.
Important: This diagram is a functional overview, not a mandatory module-call sequence. For a real ECU, confirm the configured PDU paths, direction-specific routing and generated interfaces.
2.1 Main responsibilities
| Element | Typical responsibility in the communication design |
|---|---|
| COM | Packs and unpacks configured signals into I-PDUs |
| PduR | Routes I-PDUs between configured communication modules |
| SecOC | Creates or verifies secured I-PDUs and applies configured freshness checks |
| Communication interface / driver | Transfers the PDU through the selected network hardware and protocol stack |
| Freshness management | Provides or reconstructs freshness information according to the configured design |
| Cryptographic service path | Performs the configured cryptographic operation using approved key references |
The freshness and cryptographic functions may be integrated through configured interfaces and services. Do not assume that every vendor implementation exposes identical module boundaries or API names.
3. Core SecOC data elements
| Element | Purpose | Engineering consideration |
|---|---|---|
| Authentic I-PDU | Original communication PDU whose data is protected | Define exactly which PDU and bits are covered |
| Freshness value (FV) | Provides freshness context for replay protection | Sender and receiver need compatible state and interpretation |
| Data identifier / profile inputs | Bind authentication to the configured message context where required | Use consistent profile inputs at both endpoints |
| Authenticator | Cryptographic value used to verify authenticity and integrity | Algorithm, input construction, output length and truncation must match |
| Secured I-PDU | Transmitted representation containing authentic data and configured security information | Field placement, bit lengths and total length are configuration-dependent |
A project may transmit only part of the full freshness value and a truncated authenticator to fit network payload constraints. The receiver uses the received freshness information and its local state according to the configured freshness-management scheme.
Do not assume a universal field order, byte layout, bit length, algorithm or freshness reconstruction method.
3.1 Authentic data versus secured representation
The authentic I-PDU is the communication data that the project intends to protect. The secured I-PDU is the representation sent over the configured communication path after the security information has been added.
Conceptually:
Authentic I-PDU
|
+---- Freshness information
|
+---- Configured profile inputs
|
v
Cryptographic authentication
|
v
Authenticator
|
v
Secured I-PDU = authentic data + configured security fields
This is a conceptual relationship only. Actual serialization and field placement are determined by the configured SecOC profile and PDU layout.
4. Sender-side processing
At a functional level, the sender performs the following operations:
- Receives the authentic I-PDU from the configured communication path.
- Obtains the freshness information required for this transmission.
- Forms the authentication input from the configured authentic data and profile-defined inputs.
- Requests the configured cryptographic processing to calculate the authenticator.
- Constructs the secured I-PDU using the configured layout and transmitted freshness representation.
- Passes the secured PDU to the configured lower communication path.
4.1 Sender engineering checks
During integration, verify:
- The authentic PDU selected for protection is the intended PDU and has the expected length.
- The freshness source returns a valid value at the time the PDU is protected.
- The configured profile inputs are stable and consistent with the receiver.
- The cryptographic operation completes successfully and uses the intended key reference.
- The authenticator is inserted at the correct configured position and with the configured truncation.
- The secured PDU length and routing configuration match the receiving endpoint.
A sender-side success indication does not by itself prove that the receiver will accept the PDU. End-to-end interoperability must be verified.
5. Receiver-side processing
The receiver performs the corresponding verification:
- Receives the secured I-PDU through the configured communication path.
- Separates authentic data and received security fields according to the configured layout.
- Obtains or reconstructs a candidate freshness value using receiver state and the received freshness information.
- Forms the expected authentication input.
- Calculates or verifies the expected authenticator using the matching profile and key reference.
- Applies the configured authentication and freshness acceptance rules.
- Delivers the authentic data only when the required checks succeed; otherwise rejects the PDU or reports the failure according to the integration design.
The receiver's decision may depend on both cryptographic verification and freshness acceptance. The exact order and internal implementation are release- and vendor-dependent.
6. Freshness management and replay protection
A valid authenticator on an old message does not prove that the message is current. Freshness is therefore a central part of SecOC.
Depending on the system design, freshness may use counters or another configured mechanism. The secured PDU can carry a shortened freshness representation rather than the complete value. The receiver may reconstruct a candidate full value using stored state and the received freshness bits.
6.1 Sender and receiver state
The sender and receiver must maintain compatible interpretations of freshness. The design needs to define:
- How the sender obtains and advances freshness.
- Which part of the freshness information is transmitted.
- How the receiver reconstructs or validates the candidate value.
- What freshness window or acceptance policy is configured.
- How state is initialized and retained across resets.
- How message loss, rollover and resynchronization are handled.
Do not assume that the sender and receiver simply increment a counter once for every application update. The configured mechanism, transmission behavior and system requirements determine the actual progression rules.
6.2 Important boundary conditions
| Condition | Engineering question |
|---|---|
| Message loss | How many missed transmissions can be tolerated by the configured receiver policy? |
| Out-of-order delivery | Is reordering possible on this path, and how is it handled? |
| Counter rollover | How is the boundary represented and reconstructed? |
| ECU reset | Is freshness state restored, reinitialized or resynchronized? |
| Power interruption | Can persistent state be corrupted or rolled back? |
| Resynchronization | What controlled recovery process is permitted? |
| Multiple transmitters | Is freshness state correctly separated for each protected communication context? |
Freshness behavior is system- and profile-dependent. Treat freshness as security state, not as an ordinary application signal.
7. Cryptographic service integration and key handling
SecOC relies on configured cryptographic processing. It must not be treated as an ordinary checksum calculation.
In many AUTOSAR Classic designs, cryptographic operations are integrated through a configured cryptographic service path. The architecture may involve:
- CSM (Crypto Service Manager): provides configured cryptographic service access to software modules.
- CryIf (Crypto Interface): abstracts access to configured cryptographic drivers.
- Crypto Driver: connects the service request to the selected software or hardware cryptographic implementation.
These names describe common AUTOSAR Classic architectural roles. The exact interfaces, job configuration, supported algorithms and integration details must be checked against the selected AUTOSAR release and supplier implementation.
7.1 Key-management requirements
The ECU security design should establish:
- Which cryptographic service path is used.
- Which key reference or key slot is associated with each protected communication.
- How keys are provisioned, activated, updated, revoked and retired.
- How key availability and lifecycle state are reported.
- How development and production environments differ.
- Which diagnostic information may be logged.
Never place secret keys in source control, ordinary logs, screenshots, unsecured diagnostic traces or test reports. Use approved key-management and test procedures. A key identifier or slot reference may help troubleshooting, but it is not a substitute for secure key handling.
8. Configuration alignment between ECUs
SecOC interoperability depends on compatible configuration at both endpoints. A payload can look correct in a bus trace and still fail verification because the authentication inputs or freshness interpretation differ.
| Configuration area | Sender/receiver alignment to verify |
|---|---|
| Authentic and secured PDU mapping | Correct PDU relationship and routing at both endpoints |
| Protected data | Same data and bit range are authenticated |
| Profile inputs / data identifier | Matching configured context where required |
| Algorithm and profile | Compatible cryptographic algorithm and profile selection |
| Authenticator | Matching input construction, output length and truncation |
| Freshness | Compatible length, transmitted portion, reconstruction and state policy |
| Key reference | Intended key identity, valid lifecycle state and correct environment |
| PDU layout | Matching field offsets, bit ordering, byte ordering and total length |
| Routing and gateways | Protected fields are preserved or protection is deliberately terminated and re-established |
| Error handling | Rejection, reporting and recovery behavior are defined |
8.1 Illustrative configuration comparison
The following table is a review aid, not a vendor-specific ARXML schema or a universal parameter set.
| Review item | Sender ECU | Receiver ECU | Expected review |
|---|---|---|---|
| Authentic PDU | VehicleSpeed_A | VehicleSpeed_A | Same protected communication |
| Secured PDU layout | Project profile A | Project profile A | Compatible field layout |
| Authenticator profile | Project profile A | Project profile A | Same algorithm/profile inputs |
| Authenticator length | Configured value | Configured value | Must match |
| Freshness representation | Configured transmitted portion | Matching interpretation | Must be compatible |
| Key reference | Approved key slot reference | Corresponding approved key slot reference | Same intended key material and lifecycle |
| Receiver policy | Not applicable | Project-defined freshness acceptance | Meets system security requirements |
Use actual project values in the ECU configuration review. Do not copy illustrative labels or guessed bit lengths into production configuration.
9. Worked example: protecting a vehicle-speed PDU
Consider a sender ECU publishing a vehicle-speed PDU that is consumed by another ECU.
The project configures SecOC protection for the authentic PDU. The sender obtains its freshness input and uses the configured cryptographic profile to calculate an authenticator over the required data and profile-defined inputs. The secured PDU is assembled using the configured field layout. It may contain the authentic data, a transmitted portion of the freshness value and a truncated authenticator.
During integration, capture a representative transmission and create a controlled comparison record containing:
- Exact secured-PDU bytes as transmitted.
- Sender and receiver PDU identifiers and configuration versions.
- Protection profile and configured field layout.
- Freshness state information captured through an approved test interface.
- Receiver's reconstructed freshness result and acceptance decision.
- Relevant key identifier or key-slot reference, never the secret key.
9.1 Example investigation
Assume the sender reports successful protection and the receiver rejects every received PDU.
A disciplined investigation would proceed as follows:
- Confirm that both ECUs use the same intended software and configuration baseline.
- Compare the authentic PDU length and protected bit range.
- Compare the configured security-field positions and secured-PDU length.
- Confirm that both endpoints use compatible profile inputs and authenticator truncation.
- Inspect freshness state and reconstruction using approved diagnostic instrumentation.
- Confirm that the intended key references are active in the correct test environment.
- Check whether a gateway or routing transformation changes any protected field.
This order helps isolate configuration and data-path problems before changing cryptographic settings. Do not attempt to solve a mismatch by weakening authentication or freshness acceptance criteria.
This example describes a debugging method, not a universal AUTOSAR PDU format. Confirm the actual data model and generated configuration for the selected release and project.
10. Practical debugging workflow
When SecOC authentication fails, use a repeatable process rather than changing multiple configuration parameters at once.
- Capture the secured PDU: record exact bytes, timestamp, channel and communication context.
- Confirm endpoint configuration: compare software versions, PDU mapping and protection-profile configuration.
- Check protected-data definition: verify authentic PDU, length, bit positions and profile-defined inputs.
- Inspect freshness behavior: compare sender progression, receiver state, reconstruction and reset handling.
- Verify cryptographic configuration: check algorithm/profile selection, key reference and lifecycle state without exposing secret material.
- Check routing and gateways: confirm protected fields are not modified, truncated or incorrectly repacked.
- Review rejection reporting: correlate configured receiver status/error reporting with the captured PDU.
- Change one variable at a time: repeat the same controlled test after each correction.
10.1 Symptoms and likely investigation areas
| Symptom | Investigation area |
|---|---|
| Every message is rejected | Profile mismatch, key reference, PDU mapping or field-layout error |
| Failure begins after ECU reset | Freshness persistence, initialization or resynchronization |
| Intermittent rejection under bus load | Message loss, counter progression or receiver synchronization policy |
| Works in one software build but not another | Generated configuration, profile or key-lifecycle change |
| Payload looks correct but verification fails | Authenticated bit range, freshness input, byte ordering or authenticator truncation |
| Failure occurs only through a gateway | Routing, repacking or transformation of protected fields |
| Cryptographic request fails before verification | Service configuration, driver availability, key access or job/resource handling |
These are diagnostic starting points, not definitive root-cause mappings.
10.2 Example fault-isolation record
For each failed test, record a traceable evidence set:
| Evidence | Record |
|---|---|
| Test identifier | Unique test-case ID and software baseline |
| Communication | Channel, PDU identity and timestamp |
| Received data | Secured-PDU bytes from an approved trace |
| Configuration | Sender/receiver configuration versions |
| Freshness | Approved state snapshot and receiver decision |
| Cryptographic service | Job/result status and key reference, without secret values |
| Outcome | Accepted/rejected and associated diagnostic status |
| Change made | One controlled configuration or software change |
This makes failures reproducible and prevents sensitive cryptographic information from entering ordinary reports.
11. Verification and test cases
A useful SecOC test plan should cover normal operation, negative cases, state transitions and recovery.
| Test case | Stimulus | Expected result |
|---|---|---|
| Valid secured PDU | Correct data, authenticator and expected freshness | Accepted and authentic data delivered |
| Protected payload modified | Change a protected payload bit | Authentication fails; data is not accepted as authentic |
| Authenticator modified | Change an authenticator bit | Verification fails |
| Replay | Re-send a previously valid secured PDU | Rejected according to configured freshness policy |
| Stale freshness | Provide freshness outside permitted acceptance policy | Rejected or handled according to defined synchronization policy |
| Message gap | Drop one or more transmissions | Receiver follows specified gap-handling behavior |
| Sender/receiver restart | Restart one or both endpoints | Freshness recovery follows defined reset strategy |
| Profile mismatch | Use intentionally incompatible test configuration | Verification fails safely |
| Key unavailable | Use a controlled test setup with unavailable/invalid key state | Defined error handling occurs; no insecure fallback |
| Gateway forwarding | Forward a protected message through configured gateway | Protected fields remain valid, or protection is terminated and re-established by design |
| Rollover boundary | Exercise configured freshness boundary in a controlled test | Sender and receiver handle rollover as specified |
| Key update | Perform approved key lifecycle transition | Communication follows defined activation and transition behavior |
Define acceptance criteria before executing tests. A rejection is not necessarily a defect: it may be the intended security response.
11.1 Test execution precautions
- Use approved test keys and a controlled bench or simulation environment.
- Never use production secret keys in ordinary development scripts or reports.
- Keep sender, receiver and test-tool configuration baselines traceable.
- Preserve raw traces securely and redact sensitive information before sharing.
- Verify both the security decision and the application-visible behavior.
- Include startup, message-loss, rollover and recovery scenarios, not only nominal cyclic traffic.
12. Common engineering mistakes
- Treating the freshness field as an ordinary application signal.
- Assuming that SecOC encrypts the application payload.
- Using different protection-profile settings at sender and receiver.
- Ignoring the effect of truncated freshness or authenticator fields.
- Failing to define behavior for ECU reset, message loss and resynchronization.
- Assuming a gateway can modify a protected PDU without invalidating its authenticator.
- Logging secret keys or sensitive cryptographic intermediate values.
- Treating a successful nominal test as sufficient evidence of replay protection.
- Copying configuration or API assumptions from a different AUTOSAR release without checking compatibility.
- Weakening freshness or authentication checks to make an integration test pass instead of finding the underlying mismatch.
13. Integration review checklist
Before releasing a SecOC-protected communication path, confirm that:
- Authentic and secured PDU mappings are consistent at both endpoints.
- Protected data and profile-defined authentication inputs are identical.
- Algorithm, authenticator length and truncation settings match.
- Freshness transmission, reconstruction, persistence and reset behavior are defined.
- Key references and key lifecycle procedures are validated.
- Cryptographic service integration and error handling are verified.
- Gateway behavior preserves or correctly re-establishes protection.
- Negative tests cover modified payloads, modified authenticators and replay attempts.
- Startup, rollover, message-loss and recovery scenarios are tested.
- Logs and test reports do not expose secret key material.
- Implementation is checked against the project's selected AUTOSAR release and OEM security requirements.
14. Frequently asked questions
Does SecOC provide encryption?
No. SecOC's primary purpose is message authenticity, integrity and freshness protection. Confidentiality requires a separate mechanism where it is needed.
Why can a correct application payload be rejected?
Verification depends on more than the visible payload. Freshness state, protected-data boundaries, profile inputs, key reference, authenticator length and field layout must also match.
Does SecOC always transmit the complete freshness counter?
No. A configured representation may transmit only part of the freshness information. The receiver may reconstruct the full value using its state and the received bits.
Can a gateway forward a SecOC-protected PDU?
It can forward protected data if the architecture preserves the authenticated fields and end-to-end protection remains valid. If a gateway modifies protected data, the original authenticator will generally no longer validate. The architecture must define where protection is terminated and re-established.
What is the role of CSM, CryIf and the Crypto Driver?
They are commonly used elements of the AUTOSAR Classic cryptographic service architecture. Their exact interfaces and configuration must be checked against the selected release and supplier implementation.
Are SecOC APIs and configuration identical across AUTOSAR releases?
No. Consult the exact release's SecOC and cryptographic-service specifications, generated configuration documentation and OEM requirements.
Related articles
- ISO/SAE 21434: A Practical Automotive Engineering Guide
- Vehicle Security: A Practical Automotive Engineering Guide
References and further study
For implementation work, consult the AUTOSAR SecOC specification for the project's selected release, together with the relevant cryptographic-service specifications, generated configuration documentation and OEM security profile. Use the project baseline as the authority for exact field sizes, interfaces, algorithms, freshness handling and error behavior.
