Skip to content
Back to overview
Knowledge Base
August 11, 2026

SecOC: Secure Onboard Communication in AUTOSAR

SecOC (Secure Onboard Communication) in AUTOSAR - renco knowledge base article title graphic

Talk to engineers who’ve been here before

If you’re responsible for an EV program and want to reduce uncertainty before it becomes risk, let’s talk.

Reach us now

Share:

Download
Share
Copy to clipboard
JASPAR
Japan Automotive Software Platform and Architecture: an industry body whose SecOC configuration is standardized as AUTOSAR SecOC Profile 3.
UDS
Unified Diagnostic Services (ISO 14229): the diagnostic communication protocol used for ECU testing, configuration and key updates.
RTE
Runtime Environment: the AUTOSAR layer that connects application software components to the basic software (BSW).
SHE
Secure Hardware Extension: an automotive standard for a lightweight on-chip security module and key store, often used to hold the keys an HSM works with.
I-PDU
Interaction layer PDU: the application-level PDU that carries signals between ECUs in AUTOSAR communication. SecOC protects the Authentic I-PDU and produces the Secured I-PDU.
JTAG
Joint Test Action Group — Standardized hardware interface (IEEE 1149.1) for testing, debugging, and programming chips. Provides low-level access to internals, often targeted in security attacks.
AUTOSAR
AUTomotive Open System ARchitecture — Standardized automotive software architecture for scalable, reusable software across vehicle platforms. Defines layered components, communication mechanisms, and configuration methods.
ARXML
AUTOSAR XML — XML-based file format describing AUTOSAR software components, interfaces, and configurations. Standard data exchange format between AUTOSAR development tools.
AES
Advanced Encryption Standard — Symmetric block cipher standardized by NIST, encrypting data in 128-bit blocks with 128/192/256-bit keys. Core building block in automotive cybersecurity.
HSM
Hardware Security Module — Tamper-resistant hardware component securely storing cryptographic keys and performing crypto operations. Isolates security-critical functions from the main ECU processor.
FVM
Freshness Value Manager — AUTOSAR SecOC sub-module managing freshness values (counters) used to prevent replay attacks. Provides, tracks, and verifies freshness values for authenticated messages.
MAC
Message Authentication Code — Cryptographic checksum using a secret key to verify message integrity and authenticity. Confirms data is unaltered and from a legitimate sender.
CMAC
Cipher-based Message Authentication Code — MAC construction built from a block cipher, standardized as AES-CMAC. Widely used in SecOC to authenticate CAN/Ethernet messages.
ECU
Electronic Control Unit — Embedded computer controlling vehicle subsystems like engine, brakes, or infotainment. Modern cars contain dozens, networked via CAN, LIN, or Ethernet.
PDU
Protocol Data Unit — Data unit exchanged between network layers, containing payload plus protocol control info. Basic building block in AUTOSAR COM/PduR routing.
SecOC
Secure Onboard Communication — AUTOSAR module authenticating in-vehicle messages via freshness counter and truncated MAC. Protects against replay attacks without full encryption.
GB/T
Guobiao Tuijian. China's recommended national standards, including its EV charging connector and protocol.
Pt1000
A platinum resistance temperature sensor (1000 ohms at 0 degrees C) used to monitor contact temperature.
10BASE-T1S
A single-pair Ethernet variant for short, low-speed links, used by the Megawatt Charging System in place of powerline communication.
AFIR
Alternative Fuels Infrastructure Regulation. An EU regulation setting targets and requirements for alternative-fuel infrastructure, including EV charging.
BMS
Battery Management System. The electronics that monitor and protect a battery pack, managing its charge, voltage, temperature and safety.
CAN
Controller Area Network. A robust bus standard that lets controllers and devices communicate without a central computer, widely used in vehicles.
DIN
Deutsches Institut fuer Normung. Germany's national standards organization.
DTC
Diagnostic Trouble Code. A standardized code stored by a vehicle's electronics to record a detected fault.
EVSE
Electric Vehicle Supply Equipment. The equipment that supplies electrical energy to charge an electric vehicle; in everyday terms, the charging station.
IEC
International Electrotechnical Commission. The international body that prepares and publishes standards for electrical and electronic technologies.
ISO
International Organization for Standardization. An independent body that develops and publishes worldwide technical standards.
NRMM
Non-road mobile machinery. Mobile machines not intended for use on public roads, such as construction and agricultural equipment.
RFID
Radio Frequency Identification. Identifying and reading data from a tag wirelessly using radio waves.
SAE
SAE International. A standards organization for the automotive, commercial-vehicle and aerospace industries.
TLS
Transport Layer Security. A cryptographic protocol that encrypts and authenticates data sent over a network.
VCU
Vehicle Control Unit. The central electronic controller that coordinates a vehicle's subsystems.

Introduction

Secure Onboard Communication (SecOC) is a security mechanism defined in the AUTOSAR standard to protect in-vehicle network communication. The primary objective of SecOC is to ensure the authenticity and integrity of sensitive data. The SecOC module validates the authenticity and freshness of the PDU messages between ECUs to make sure that the message comes from a known source and contains the correct data and protects against key threats such as message spoofing, message tampering and replay attacks. 

The SecOC concept is commonly used in applications where secure communication is necessary, such as authenticating messages during software updates and safeguarding intra-vehicle communication in safety-critical systems such as braking and steering.

SecOC Message Structure

A SecOC message consists of two parts:

  • Authentic Payload: This is the standard raw data exchanged between ECUs such as motor speed, torque requests, and sensor readings etc.
  • Authentication Information: On the sender side, the SecOC module creates a secure payload consisting of a truncated CMAC value and a truncated freshness value, positioned based on the module configuration, which is used later on the receiver side. Depending on the message configuration, this information is either appended to the authentic payload and sent as a single message, or sent as a separate message with a dedicated message identifier and link data to ensure that it maps correctly to the authentic payload.
Secured I-PDU Headeroptional
Authentic I-PDUpayload
Freshness Valueoptional, truncated
Authenticatortruncated MAC
.
Authentic payload
Authentication information
Secured I-PDU
The header, present only in some configurations, carries the length of the authentic I-PDU. The authentication information is the truncated freshness value followed by the truncated authenticator (MAC). Depending on the message configuration, these fields travel with the payload or in a separate message linked to it.

Freshness Values & The FVM

Freshness values are used to ensure that messages are recent and to prevent attackers from using previously valid messages. When a SecOC message is received, the receiving ECU validates the freshness value against the expected bounds and rejects the message if the freshness value is too old, repetitive or outside the acceptance window. The complete Freshness Value is typically constructed by combining a Trip Counter, Reset Counter, Message Counter and a Reset Flag.

MSBLSB
SecOCFreshnessValueLength
Freshness Value
Trip Counter
Reset Counter
Message Counter
MsgCntUpper
MsgCntLower
Reset Flag
TripCntLength
ResetCntLength
MsgCntLength
ResetFlagLength
SecOCFreshnessValueTxLength
The full freshness value spans the trip counter, reset counter, message counter and reset flag (SecOCFreshnessValueLength). Only the least significant part, the lower message counter bits plus the reset flag, is transmitted on the bus (SecOCFreshnessValueTxLength); the receiver reconstructs the rest from its own synchronized counters.

The Freshness Value Manager (FVM) is a logical component responsible for managing freshness values across all SecOC-protected messages in a vehicle network. It handles the generation, storage, updating, and validation of freshness values, ensuring they remain consistent even across ECU restarts and different operating modes. 

On the sender side, the FVM retrieves or increments the current freshness value, and hands it over to the SecOC module for MAC (Message Authentication Code) computation. 

On the receiver side, the FVM checks the incoming freshness value against the expected value within a defined acceptance window. If the value falls outside this threshold, the SecOC module rejects the message entirely. Depending on the implementation, this rejection can be reported as a security event or as a diagnostic fault.

Synchronization messages are transmitted periodically to ensure that all ECUs in a vehicle network use the same Trip Counter and Reset Counter values.

Message Authentication Codes (MAC)

A MAC is a cryptographic checksum computed using the SecOC Data ID, payload data, freshness value, and a shared symmetric key which is securely stored on the HSM.

The main purpose of the MAC is to ensure that the payload data and freshness value have not been manipulated, and that the correct data has been received by the ECU. On the receiver side, the ECU independently calculates the MAC using the same inputs and compares it against the received value. If there is any mismatch between these values which could indicate tampered data or an invalid key, the SecOC message will not be processed further.

SecOC Profiles

SecOC profiles are predefined security configurations that specify the cryptographic algorithms and modes to be used for the MAC computation, and defines how truncation is applied to the MAC and freshness value in a SecOC message.  

AUTOSAR specifies three profiles with different truncation sizes for freshness value and MAC. All profiles use the CMAC with AES-128 encryption algorithm.

Profile Alias MAC algorithm Truncated MAC Truncated freshness value
Profile 1 24Bit-CMAC-8Bit-FV CMAC / AES-128 24 bit 8 bit
Profile 2 24Bit-CMAC-No-FV CMAC / AES-128 24 bit 0 bit (none)
Profile 3 JASPAR CMAC / AES-128 28 bit 4 bit
All three AUTOSAR profiles use CMAC based on AES-128 and differ only in how many bits of the MAC and freshness value are carried in the secured message. The truncated freshness value is the number of least significant bits transmitted; the receiver reconstructs the full value from its synchronized counters.

Processing SecOC Messages

Transmitter

Application Layer RTE SecOC (Sender) FVM Input data(arbitrary length) Secret key K MACgeneration full MAC(128 bit) FV MAC Truncation ID AuthI-PDU ID AuthI-PDU FVMAC Secured I-PDU to bus
  1. 1Prepare the Secured I-PDUThe SecOC module retrieves the payload data and allocates the buffer for the full Secured I-PDU.
  2. 2Construct data for authenticationThe module collects the MAC inputs: SecOC Data ID, payload data and the full freshness value from the FVM.
  3. 3Compute the MACThe crypto stack, on many ECUs an HSM, computes the CMAC-AES-128 with the secret key and returns a 16-byte MAC.
  4. 4Construct the Secured I-PDUThe MAC and freshness value are truncated to the profile size and placed after the authentic payload.
  5. 5Broadcast the Secured I-PDUThe Secured I-PDU is handed to the PDU router and sent on the bus. The receiver, a separate ECU, starts only when it arrives.
  6. 6Increment the freshness counterAfter sending, the FVM increments the counter locally so the next message carries a unique freshness value.

Receiver

Application Layer RTE SecOC (Receiver) FVM Secret key K MACverification OKNOK FV MAC from bus ID AuthI-PDU FVMAC Secured I-PDU AuthenticI-PDU
  1. 1Parse the Secured I-PDUThe module receives the Secured I-PDU and extracts the authentic payload, the truncated freshness value and the truncated MAC.
  2. 2Verify the freshness valueThe FVM reconstructs the full freshness value and checks the acceptance window; an out-of-window value is rejected before any MAC check.
  3. 3Construct data for authenticationData ID, authentic payload and the reconstructed freshness value are assembled with the shared key for verification.
  4. 4Verify the MACThe MAC is recomputed and compared with the received truncated MAC. A match gives OK; a mismatch gives NOK and the message is discarded.
  5. 5Confirm to the FVMOn success the module confirms to the FVM, which updates its counter to stay in sync with the sender.
  6. 6Deliver the payloadThe authentic payload is passed to the PDU router for the upper communication layers.

Technical Challenges in SecOC Implementation

While implementing the SecOC concept, we encountered three major challenges that we had to work through. Below are the issues we tackled.

Dynamic positioning of linked data

During the early implementation phase, we assumed that the Message Linker data position would be the same for the Authentic I-PDU and the Cryptographic I-PDU within a Secured PDU Collection message. When reviewing the AUTOSAR standard (Specification of Secure Onboard Communication AUTOSAR CP R22-11), we found only a few requirements closely related to the Message Linker, such as [SWS_SecOC_00209] and [SWS_SecOC_00210]. These requirements state that the Message Linker is extracted from the Authentic I-PDU using bit position SecOCMessageLinkPos for a length of SecOCMessageLinkLen bits, and that the Cryptographic I-PDU is constructed by concatenating Authentication Data and Message Linker. However, neither requirement explicitly specifies the Message Linker position in a Cryptographic I-PDU message.

The initial ARXML configuration files we worked with always placed the message linker after the authenticator at the same bit position in the Authentic and Cryptographic PDU message, which reinforced our assumption that it was correct. During testing, however, we discovered that this assumption was incorrect.

We later adjusted our implementation so that for Cryptographic I-PDUs, the linked data is appended after the Truncated Freshness Value and Truncated CMAC fields. Its position is dynamic, depending on the FV and CMAC positions as well as the SecOC profile being used.

Endianness issue with data fields like the Unique Data ID

To protect against message spoofing, SecOC includes several data fields like a unique 2-byte Data Identifier as part of the CMAC computation. This is where we ran into a classic embedded systems issue: depending on the underlying microcontroller's architecture, these values could get byte-flipped, and we ended up having the wrong CMAC values. As a result, all SecOC messages were simply not validated and logged as authentication failures, because the CMAC values on each side no longer matched.

The fix was to enforce MSB / Big Endian format across any SecOC data handling independent from the hardware used, as proposed by the AUTOSAR standard. Making sure that bytes always enter the CMAC computation in correct order.

Format Issues in Freshness Value Construction

To verify SecOC messages on the receiver side, the Freshness Value Manager (FVM) reconstructs the Freshness Value. This starts with determining which format (Format 1, 2, and 3) shall be used, based on the conditions specified in AUTOSAR Standard Table 9, by evaluating the reset flag status, trip counter increments, and lower-end message counter values.

While implementing this format-selection logic, the standard does not clearly define the syntax used to interpret the “Trip counter | reset counter comparison” condition, specifically with the symbol "|". Elsewhere in the standard (Specification of Secure Onboard Communication AUTOSAR CP R22-11), under [SWS_SecOC_00209], "|" is explicitly defined as concatenation. Since Table 9 does not explicitly clarify whether the same convention applies here, it was not clear whether the condition meant testing a concatenated value of the trip and reset counters or testing the trip and reset counter values individually. To get clarity on this, we had to refer to other implementations and available sources, and ultimately concluded that in this particular scenario, "|" indicates that the trip counter and reset counter values are to be tested independently.

Turning this multi-conditional logic into C code was more challenging than we expected. Handling the typical cases like out-of-sequence messages, accurately tracking previously received values across different messages in the network, and managing counter wraps led to frequent logic errors during the initial implementation phase. We had to implement a strict state machine and followed by extensive unit testing to get the transitions between Formats 1, 2, and 3 right without losing any synchronization.

Conclusion

SecOC is not just an optional addition to a vehicle's software stack. UN Regulation No. 155 requires a cybersecurity management system for vehicle type approval, and ISO/SAE 21434 sets the cybersecurity engineering process behind it, which is why authenticating in-vehicle messages has become standard practice. By combining symmetric cryptography with strict freshness synchronization, SecOC authenticates in-vehicle PDUs and closes off message spoofing, tampering, and replay as attack vectors on the bus.

Our team delivers SecOC integration expertise, backed by extensive validation and testing through advanced Hardware-in-the-loop (HIL) test setups.

Frequently Asked Questions

What is SecOC in AUTOSAR?

Secure Onboard Communication (SecOC) is the AUTOSAR mechanism that authenticates selected PDUs between ECUs. It adds a truncated message authentication code (MAC) and a truncated freshness value to each protected message so the receiver can verify who sent it and that it is not a replay.

Which attacks does SecOC protect against?

Message spoofing (injecting messages that pretend to come from a legitimate ECU), message tampering (altering data in transit) and replay attacks (re-sending previously valid messages). The MAC covers spoofing and tampering; the freshness value covers replay.

Does SecOC encrypt the data?

No. SecOC provides authenticity and integrity, not confidentiality. The payload remains readable on the bus; it is the acceptance of forged or replayed messages that SecOC prevents.

What is a freshness value?

A counter-based value included in the MAC computation and partly transmitted with the message. It is typically built from a Trip Counter, Reset Counter and Message Counter, managed by the Freshness Value Manager (FVM). A receiver rejects messages whose freshness value falls outside the acceptance window, which blocks replays.

Why are the MAC and freshness value truncated?

Payload budget. A full CMAC is 16 bytes, twice the payload of a classic CAN frame. The AUTOSAR profiles truncate the MAC to 24 or 28 bits and the freshness value to 0, 4 or 8 bits so that protection fits alongside the actual data.

Which algorithm do the SecOC profiles use?

All three AUTOSAR profiles use CMAC based on AES-128. Profile 1 (24Bit-CMAC-8Bit-FV) uses a 24 bit MAC with an 8 bit freshness value, Profile 2 (24Bit-CMAC-No-FV) omits the freshness value, and Profile 3 (JASPAR) uses a 28 bit MAC with a 4 bit freshness value.

Subscribe to our newsletter

System-level insights on EV integration, control software, and validation. Written by engineers who've been building electric vehicles since 2009.

[!] Incorrect Format
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.