Serves as an interface for symmetric encryption and decryption operations in data streams or single calls.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 0261b663ca0dProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Serves as an interface for symmetric encryption and decryption operations in data streams or single calls.
The class ara::crypto::cryp::SymmetricCipherCtx serves as a thread-safe interface for symmetric encryption and decryption operations in AUTOSAR Adaptive [SWS_CRYPT_50044]. After configuring a key via SetKey(), data can be processed either in a single call or stepwise in a streaming cycle of Start(), Update(), and Finish()[SWS_CRYPT_50138], [SWS_CRYPT_50139]. All methods are specified as noexcept and signal errors such as missing initialization or undersized buffers via ara::core::Result[SWS_CRYPT_50140].
Context
The interface ara::crypto::cryp::SymmetricCipherCtx encapsulates symmetric cryptographic transformations, which include both encryption and decryption operations. Within the crypto architecture, the class acts as an execution context for symmetric algorithms and cooperates with key objects and memory buffers. To configure the cryptographic key, the class interacts either directly with volatile keys via SymmetricKey[SWS_CRYPT_50138] or with keys managed persistently or in isolation via KeySlot[SWS_CRYPT_50043]. Plaintexts and ciphertexts to be processed as well as initialization vectors (IV) are passed and received via memory areas of type ReadOnlyMemRegion and ReadWriteMemRegion[SWS_CRYPT_50048], [SWS_CRYPT_50049].
Lifecycle
Lifecycle and ownership of the interface are primarily controlled via the typed smart pointer alias Sptr (std::shared_ptr<SymmetricCipherCtx>) [SWS_CRYPT_50137]. In practice, the provision of a concrete instance is likely to take place via a higher-level crypto factory method (interpretation), as the interface definition itself does not feature creation functions. Question Q-5b5f5ffdf964c91f (open)
After instantiation, the context passes through several operational phases:
Uninitialized: Immediately after instantiation, no key is assigned to the context. Any processing call in this phase leads to error CryptoErrc::kUninitializedContext[SWS_CRYPT_50044], [SWS_CRYPT_50047].
Initialized / key bound: By calling SetKey() with a SymmetricKey[SWS_CRYPT_50138] or KeySlot[SWS_CRYPT_50043], the context becomes ready for use. From this state, either stateless single-call operations can be executed or a stateful streaming process can be started.
All methods of SymmetricCipherCtx are declared as noexcept, ensure exception safety (\"exception safe\"), and are specified as thread-safe for concurrent access [SWS_CRYPT_50044], [SWS_CRYPT_50139].
Determining the required buffer and chunk sizes is recommended before the actual data transformation. Via GetMinimumChunkSize()[SWS_CRYPT_50144] and GetMaximumChunkSize()[SWS_CRYPT_50050], the permitted limits for input blocks can be determined. If initialization vectors are required, their length limits can be queried using GetMinimumInputIvSize()[SWS_CRYPT_50141], GetMaximumInputIvSize()[SWS_CRYPT_50142], or GetOutputIvSize()[SWS_CRYPT_50143]. The maximum required destination buffer size for an operation is calculated using GetRequiredOutputBufferSize()[SWS_CRYPT_50140].
For stepwise stream encryption or decryption, the following standard procedure applies:
Configure key: Binding the cryptographic key to the context via SetKey()[SWS_CRYPT_50138].
Start transformation: Calling Start() specifying the transformation direction (encryption or decryption) and optional IV [SWS_CRYPT_23625] or without IV [SWS_CRYPT_50044].
Transform data blocks: Repeated calling of Update() for the stepwise passing of input data and retrieval of output data [SWS_CRYPT_50139]. If needed, navigation within the data stream is possible via Seek()[SWS_CRYPT_23613].
Completion: Finalization via Finish()[SWS_CRYPT_50045] or via FinishEncrypt() if the IV generated by the context is to be returned [SWS_CRYPT_23618].
As an alternative to this streaming pattern, the interface supports synchronous single calls. If the entire payload is available, the operation can be executed directly via ProcessSingleCall()[SWS_CRYPT_50047], ProcessSingleCallWithInputIv()[SWS_CRYPT_50048], or for context-owned IV generation via EncryptSingleCallWithOutputIv()[SWS_CRYPT_50049].
Methods of the class signal errors via ara::core::Result with codes of error domain ara::crypto::CryptoErrc. Essential error conditions include:
CryptoErrc::kUninitializedContext: Occurs when processing calls such as Start()[SWS_CRYPT_50044], single-call routines [SWS_CRYPT_50047], or GetRequiredOutputBufferSize()[SWS_CRYPT_50140] are called before a key has been configured via SetKey().
CryptoErrc::kInsufficientCapacity: The provided destination buffer for data or IVs is smaller than the minimum required capacity [SWS_CRYPT_50139], [SWS_CRYPT_50049].
CryptoErrc::kUsageViolation and CryptoErrc::kIncompatibleObject: The passed key type is inappropriate for the transformation, or the usage rules defined in the key prohibit the operation (e.g., absence of kAllowDataEncryption or kAllowDataDecryption) [SWS_CRYPT_50044], [SWS_CRYPT_50047].
CryptoErrc::kEmptyKeySlot and CryptoErrc::kBusyResource: Indicates that a configured KeySlot does not contain a key at runtime or a resource required for the crypto operation is blocked [SWS_CRYPT_50048], [SWS_CRYPT_50049].
CryptoErrc::kUnsupported: Is returned when an operating mode (such as stream processing, single-call, or Seek()) is not supported by the selected context or algorithm [SWS_CRYPT_23613], [SWS_CRYPT_50047].
This guide was prepared by an AI assistant based on the specification requirements.
Get the maximum input buffer size supported for processing in single calls to Update(), Finish(), FinishEncrypt(), or ProcessSingleCall() by this context.
Get the maximum IV size required to be passed to the context in the functions Start() and ProcessSingleCallWithInputIv() for the given transformDirection.
Get the minimum input buffer size supported for processing in single calls to Update(), Finish(), FinishEncrypt(), or ProcessSingleCall() by this context.
Get the minimum IV size required to be passed to the context in the functions Start() and ProcessSingleCallWithInputIv() for the given transformDirection.
Get the output IV size that will be returned by the functions FinishEncrypt() (in case no IV has been provided by the application during the call to Start()), and EncryptSingleCallWithOutputIv().
Cancel the ongoing streaming operation that has been initiated by Start() and has not yet been finished.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 0bea3f0e1d0dProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The synchronous method Cancel() of class ara::crypto::cryp::SymmetricCipherCtx serves to prematurely abort an ongoing streaming operation that was previously initiated with Start() and has not yet finished [SWS_CRYPT_50046]. The interface is declared without parameters in ara/crypto/cryp/symmetric_cipher_ctx.h and returns an empty ara::core::Result<void> upon successful execution [SWS_CRYPT_50046].
If data processing was not started beforehand by calling Start(), the operation fails with the specific error code ara::crypto::CryptoErrc::kProcessingNotStarted and rollback semantics [SWS_CRYPT_50046]. For the call context, the specification guarantees thread safety (thread-safe) as well as exception safety (exception safe) with a noexcept declaration [SWS_CRYPT_50046]. Interpretation: Due to the rollback semantics, the object will likely return to a ready initial state after an abort. Question Q-b6deb8db5367acc5 (open)
Perform encryption in a single-call and return an IV generated by the context.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 9c4059afbb11ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Usage and Buffer Handling
The synchronous method EncryptSingleCallWithOutputIv performs symmetric encryption in a single call and returns the initialization vector generated by the context via the buffer ivOut[SWS_CRYPT_50049]. The input data are passed via in, while out accommodates the encrypted data [SWS_CRYPT_50049]. Upon successful execution, the result ara::core::Result<std::size_t> provides the actual size of the generated output data, which may be smaller than the total capacity of out[SWS_CRYPT_50049]. If the selected algorithm does not require an initialization vector, no data are written to ivOut[SWS_CRYPT_50049].
Interaction and Preconditions
Prior to the call, the context must be initialized via a suitable key [SWS_CRYPT_50049]. To ensure sufficient capacity of the buffer ivOut, the required IV length can be determined in advance via GetOutputIvSize()[SWS_CRYPT_50143]. If authentication with tag calculation is additionally required, ara::crypto::cryp::AuthCipherCtx provides the corresponding counterpart [SWS_CRYPT_50080].
Error Handling and Concurrency
The interface is specified as thread-safe and exception safe (“exception safe”) and applies rollback semantics in case of errors [SWS_CRYPT_50049]. Interpretation: These rollback semantics are presumably intended to ensure that, in the event of errors, the context state remains intact and no incomplete data remain valid in the buffer. Question Q-841087731518d866 (open) Relevant errors include:
UninitializedContext: No key has yet been assigned to the context [SWS_CRYPT_50049].
ara::crypto::CryptoErrc::kInsufficientCapacity: The capacity of out or ivOut is insufficient [SWS_CRYPT_50049].
ara::crypto::CryptoErrc::kUnsupported: Single-call encryption is not supported or the algorithm enforces the specification of an input IV [SWS_CRYPT_50049].
ara::crypto::CryptoErrc::kUsageViolation or ara::crypto::CryptoErrc::kIncompatibleObject: The key type does not match the transformation or the key usage does not permit data encryption [SWS_CRYPT_50049].
This usage note was generated by an AI based on the AUTOSAR Adaptive specifications.
an input data buffer containing the ciphertext or plaintext
Parameter (out)
Parameter
Beschreibung
out
an output data buffer that the encrypted or decrypted data is written to
ivOut
an output data buffer that the initialization vector (IV) generated by the context will be written to. If the algorithm does not use an IV, no data will be written into the buffer.
Finalize the encryption/decryption without returning an IV.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 041cbaba2731ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
use
The synchronous method Finish finalizes a symmetric encryption or decryption within ara::crypto::cryp::SymmetricCipherCtx without returning an initialization vector ([SWS_CRYPT_50045]). It processes the last data section from the input buffer in (ReadOnlyMemRegion) and writes the resulting data into the output buffer out (ReadWriteMemRegion) ([SWS_CRYPT_50045]). The buffer size required for this can be queried in advance via GetRequiredOutputBufferSize() ([SWS_CRYPT_50045]). In case of success, the return value of type ara::core::Result<std::size_t> provides the exact number of written bytes, which may be smaller than the total capacity of out ([SWS_CRYPT_50045]).
Error handling
In case of an error, the method returns a ara::core::Result with specific error codes ([SWS_CRYPT_50045]):
ProcessingNotStarted: Data processing was not previously initiated by Start() ([SWS_CRYPT_50045]).
ara::crypto::CryptoErrc::kInsufficientCapacity: The output buffer out is too small ([SWS_CRYPT_50045]).
ara::crypto::CryptoErrc::kInvalidInputSize: The size of the input data cannot be processed ([SWS_CRYPT_50045]).
ara::crypto::CryptoErrc::kInvalidArgument: The passed input data are invalid ([SWS_CRYPT_50045]).
ara::crypto::CryptoErrc::kUnsupported: Stream processing is not supported by the current context ([SWS_CRYPT_50045]).
If one of the CryptoErrc errors occurs, rollback semantics take effect ([SWS_CRYPT_50045]).
Concurrency and Interaction
The operation is defined as thread-safe and exception safe ([SWS_CRYPT_50045]). Before the call, the transformation must strictly have been started by Start() ([SWS_CRYPT_50045]). The maximum permitted input size for individual calls of Finish() can be determined via GetMaximumChunkSize() ([SWS_CRYPT_50050]). After completion, the transformation run is presumably terminated, and a new call to Start() will likely be required for further operations. Question Q-c4ffc8028e8f522b (open)
This text was generated by an AI based on the AUTOSAR specification R25-11.
Finalize the encryption and return the IV generated by the context.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: c0e4f2ad1bdcProvenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The FinishEncrypt method completes an encryption operation and returns the initialization vector (IV) generated by the context [SWS_CRYPT_23618]. It processes the final input data buffer in and writes the resulting data to the output buffer out as well as the IV to ivOut. As a return value, it provides a ara::core::Result<std::size_t> with the actual size of the written output data, which can be smaller than the capacity of out[SWS_CRYPT_23618].
For error-free execution, buffer dimensions and context state must be coordinated in advance:
The required buffer size for out can be determined via [SWS_CRYPT_50140] with parameter isFinal = true set. If out is dimensioned too small, the call fails with CryptoErrc::kInsufficientCapacity[SWS_CRYPT_23618].
If data processing was not previously initiated by Start(), the method reports CryptoErrc::kProcessingNotStarted[SWS_CRYPT_23618]. If the input buffer contains invalid data, CryptoErrc::kInvalidArgument follows [SWS_CRYPT_23618]. Error CryptoErrc::kUnsupported occurs if stream processing is not supported, the context does not use an IV, or an IV was already passed in Start()[SWS_CRYPT_23618]. All errors have rollback semantics [SWS_CRYPT_23618]. According to the specification, the call is thread-safe and exception safe (noexcept) [SWS_CRYPT_23618].
This usage note was generated automatically based on the AUTOSAR payload.
rollback_semantics if stream processing is not supported by the context or if this context does not use an IV or if the IV has been provided by the application in the Start() function
Request a governed re-review of this record. The record is not changed immediately.
Get the maximum input buffer size supported for processing in single calls to Update(), Finish(), FinishEncrypt(), or ProcessSingleCall() by this context.
Get the maximum IV size required to be passed to the context in the functions Start() and ProcessSingleCallWithInputIv() for the given transformDirection.
Get the minimum input buffer size supported for processing in single calls to Update(), Finish(), FinishEncrypt(), or ProcessSingleCall() by this context.
Get the minimum IV size required to be passed to the context in the functions Start() and ProcessSingleCallWithInputIv() for the given transformDirection.
Get the output IV size that will be returned by the functions FinishEncrypt() (in case no IV has been provided by the application during the call to Start()), and EncryptSingleCallWithOutputIv().
if true, calculate maximum required output buffer size for Finish(), FinishEncrypt(), ProcessSingleCallWithInputIv(), and Encrypt SingleCallWithOutputIv(), otherwise for Update()
Perform en-/decryption in a single-call without setting or returning an IV.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 4a1fdc95f521Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The ProcessSingleCall method performs encryption or decryption in a single synchronous call without an initialization vector (IV) ([SWS_CRYPT_50047]). The data buffer in (ReadOnlyMemRegion) and the transformation direction transformDirection (CryptoTransform) serve as input parameters, while the result is written into the buffer out (ReadWriteMemRegion). Upon successful execution, the function returns a ara::core::Result<std::size_t> containing the number of written bytes; this value may be smaller than the total capacity of the output buffer.
Regarding concurrency and safety, the method is specified as thread-safe and exception safe ([SWS_CRYPT_50047]). The processable input size of in is subject to the limits defined by the context, which can be queried via [SWS_CRYPT_50144] (GetMinimumChunkSize) and [SWS_CRYPT_50050] (GetMaximumChunkSize).
ara::crypto::CryptoErrc::kUninitializedContext: The context was not initialized beforehand by assigning a key.
ara::crypto::CryptoErrc::kUnsupported: Single-call processing is not supported, or the transformation requires setting or reading an IV.
ara::crypto::CryptoErrc::kInsufficientCapacity: The output buffer out does not offer sufficient capacity.
ara::crypto::CryptoErrc::kInvalidInputSize: The input size cannot be processed by the context.
ara::crypto::CryptoErrc::kUsageViolation: The key usage does not cover the requested operation (kAllowDataEncryption or kAllowDataDecryption).
ara::crypto::CryptoErrc::kIncompatibleObject, kEmptyKeySlot, kInvalidArgument, or kBusyResource: Key is incompatible, key slot is empty, input data are invalid, or required resources are busy.
In interaction with other interfaces, the call requires a fully configured context; for authenticating ciphers with additional tag processing, the alternative interface [SWS_CRYPT_50078] is available in AuthCipherCtx.
This usage note was automatically generated based on the AUTOSAR specification.
rollback_semantics if single-call en-/decryption is not supported, or if the context requires setting or returning an IV in the passed transformDirection
rollback_semantics if the allowed usage of the key does not include kAllowData Encryption for encryption, or kAllowDataDecryption for decryption, respectively
Perform en-/decryption in a single-call, providing an IV to be used during en-/decryption.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: f491c775eb62Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The ProcessSingleCallWithInputIv method on ara::crypto::cryp::SymmetricCipherCtx performs symmetric encryption or decryption of data in a single synchronous call (single-call) [SWS_CRYPT_50048]. In doing so, the initialization vector used for the transformation is explicitly passed via the input buffer iv.
Usage and Interaction
transformDirection controls whether the data from in are encrypted or decrypted. The result is written into the buffer out. The returned ara::core::Result<std::size_t> contains the actual number of written bytes, which may be less than the total capacity of out[SWS_CRYPT_50048].
Helper functions are available for dimensioning the buffers:
The required buffer size for out can be calculated in advance via GetRequiredOutputBufferSize with the parameter isFinal = true[SWS_CRYPT_50140].
The permitted length for iv can be determined for the selected transformation direction via GetMinimumInputIvSize[SWS_CRYPT_50141] as well as GetMaximumInputIvSize[SWS_CRYPT_50142].
If the generation or verification of an authentication tag is additionally required, ara::crypto::cryp::AuthCipherCtx::ProcessSingleCallWithInputIv must be used instead [SWS_CRYPT_50079].
Error Handling and Concurrency
The operation is defined as thread-safe and exception safe[SWS_CRYPT_50048]. All errors have rollback semantics:
CryptoErrc::kUninitializedContext or CryptoErrc::kEmptyKeySlot: No key was assigned to the context or the KeySlot is empty [SWS_CRYPT_50048].
CryptoErrc::kUsageViolation: The key does not permit the selected direction (kAllowDataEncryption or kAllowDataDecryption is missing) [SWS_CRYPT_50048].
CryptoErrc::kIncompatibleObject: The key type is incompatible with the transformation [SWS_CRYPT_50048].
CryptoErrc::kInsufficientCapacity: The output buffer out is too small [SWS_CRYPT_50048].
CryptoErrc::kInvalidInputSize or CryptoErrc::kInvalidArgument: Buffer size or content of in is invalid [SWS_CRYPT_50048].
CryptoErrc::kUnsupported: Single-call processing or input IVs are not supported [SWS_CRYPT_50048].
CryptoErrc::kBusyResource: A required resource is busy [SWS_CRYPT_50048].
This text was created by an AI and serves to support the use of the specification element.
rollback_semantics if the allowed usage of the key does not include kAllowData Encryption for encryption, or kAllowDataDecryption for decryption, respectively
Set the position of the next byte within the data stream.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 2287fbd40f75ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The method Seek of the interface ara::crypto::cryp::SymmetricCipherCtx sets the position of the next byte to be processed within a data stream [SWS_CRYPT_23613]. The call is likely to be synchronous due to the absence of asynchronous return types such as futures. Question Q-fccf732722263f60 (open)
offset: Byte offset in the data stream, relative either to the beginning of the stream or the current position [SWS_CRYPT_23613].
fromBegin: Reference point of the positioning; true addresses the offset from the beginning of the stream, false relative to the current position [SWS_CRYPT_23613].
The function is declared as noexcept and returns a ara::core::Result<void>, which signals successful completion or contains an occurred error object [SWS_CRYPT_23613].
Concurrency and Limitations
According to the specification, Seek is classified as exception safe (exception safe) and thread-safe (thread-safe) [SWS_CRYPT_23613]. A prerequisite for execution is that data processing was previously initiated by calling Start()[SWS_CRYPT_23613].
Error handling
All error cases are subject to a defined rollback semantics (rollback_semantics), so that the internal state remains consistent upon errors [SWS_CRYPT_23613]:
ara::crypto::CryptoErrc::kUnsupported: The seek operation is not supported by the current cryptographic context [SWS_CRYPT_23613].
ara::crypto::CryptoErrc::kProcessingNotStarted: Data processing was not started in advance via Start()[SWS_CRYPT_23613].
ara::crypto::CryptoErrc::kOutOfBounds: The resulting offset is too small or too large for the data stream [SWS_CRYPT_23613].
ara::crypto::CryptoErrc::kInvalidArgument: The resulting offset is not aligned to a block boundary, although the context requires block alignment [SWS_CRYPT_23613].
Configure the context to use the key stored in the provided KeySlot at the time the en-/decryption is started.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 72406ca015eaProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The pure virtual method SetKey configures the instance of ara::crypto::cryp::SymmetricCipherCtx so that it uses the key from the passed KeySlot for future cryptographic operations [SWS_CRYPT_50043].
Usage and Call Context
The call is synchronous and accepts a KeySlot::Sptr containing a SymmetricKey as parameter keySlot[SWS_CRYPT_50043]. The return value is a ara::core::Result<void> that indicates success or, in case of an error, conveys an error code [SWS_CRYPT_50043]. The configuration causes the key stored in the slot not to be consulted until the actual encryption or decryption is started [SWS_CRYPT_50043].
Error handling
In case of an error, no exception is thrown (the method is specified as noexcept and exception safe); instead, an error code with rollback semantics is returned [SWS_CRYPT_50043]:
ara::crypto::CryptoErrc::kIncompatibleObject: The passed KeySlot is incompatible with the cipher context [SWS_CRYPT_50043].
ara::crypto::CryptoErrc::kUnsupported: The context implementation exclusively supports setting a direct key (such as SymmetricKey) and not assignment via a KeySlot[SWS_CRYPT_50043].
Concurrency and Interaction
The method is designated as thread-safe[SWS_CRYPT_50043]. Interpretation: The actual reading of the key material is presumably performed only when starting encryption or decryption, meaning that the slot must remain consistent until the transformation starts. Question Q-799125800ab0f93c (open) The concept of configuring contexts via KeySlot::Sptr instead of direct key objects aligns with the unified pattern of related crypto contexts, including KeyDerivationFunctionCtx[SWS_CRYPT_50010], MessageAuthnCodeCtx[SWS_CRYPT_50026], SymmetricKeyWrapperCtx[SWS_CRYPT_50034], and VerifierPublicCtx[SWS_CRYPT_50018].
This text was generated by an AI based on the AUTOSAR Adaptive R25-11 specification.
Configure the context to use the provided symmetric key.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 7e5086bb8751Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
use
The method SetKey serves to configure an instance of ara::crypto::cryp::SymmetricCipherCtx to use a passed symmetric key [SWS_CRYPT_50138]. As an input parameter, the function accepts the key to be used as a smart pointer key of type SymmetricKey::Sptr. The call is synchronous and returns an ara::core::Result<void>, which is empty upon successful assignment or provides an error code in case of error [SWS_CRYPT_50138]. The declaration is included via header ara/crypto/cryp/symmetric_cipher_ctx.h.
Error handling
Error handling guarantees rollback semantics, so that the context remains in its previous state upon failure of the assignment [SWS_CRYPT_50138]. Two specific errors are defined:
ara::crypto::CryptoErrc::kUnsupported: Occurs when the context exclusively supports assigning a key via a KeySlot[SWS_CRYPT_50138].
ara::crypto::CryptoErrc::kIncompatibleObject: Returned when the passed key object is not compatible with the context [SWS_CRYPT_50138].
Concurrency and Interaction
The virtual function is defined as noexcept, is considered exception-safe, and is implemented thread-safe according to the specification [SWS_CRYPT_50138]. Similar interfaces for assigning SymmetricKey::Sptr can be found in related crypto contexts such as AuthCipherCtx[SWS_CRYPT_23911] as well as SymmetricKeyWrapperCtx[SWS_CRYPT_24018]. Furthermore, context classes that alternatively accept KeySlot::Sptr illustrate the interaction with key containers [SWS_CRYPT_50034].
This usage note was generated automatically based on AUTOSAR specification R25-11.
Initialize the context for a new encryption or decryption and set the IV used by the context.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 33beff56357bProvenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
use
The method Start initializes the context ara::crypto::cryp::SymmetricCipherCtx for a new synchronous encryption or decryption operation and sets the associated initialization vector (IV) or nonce value [SWS_CRYPT_23625]. The transformation direction is specified via the parameter transformDirection, while iv provides the initialization vector as ReadOnlyMemRegion[SWS_CRYPT_23625]. The permitted size of the buffer can be queried in advance via the methods GetMinimumInputIvSize() and GetMaximumInputIvSize()[SWS_CRYPT_23625]. The call returns a ara::core::Result<void>, is declared as noexcept, and is considered exception safe [SWS_CRYPT_23625].
Error handling
In the event of an error, an error code with rollback semantics is returned [SWS_CRYPT_23625]:
ara::crypto::CryptoErrc::kUninitializedContext: The context was not previously initialized by assigning a key [SWS_CRYPT_23625].
ara::crypto::CryptoErrc::kInvalidInputSize: The passed IV size is not supported [SWS_CRYPT_23625].
ara::crypto::CryptoErrc::kUnsupported: Setting an IV in the specified transformation direction or stream processing is not supported by the context [SWS_CRYPT_23625].
ara::crypto::CryptoErrc::kEmptyKeySlot: A configured KeySlot is currently empty [SWS_CRYPT_23625].
ara::crypto::CryptoErrc::kUsageViolation: The permitted key usage does not include kAllowDataEncryption for encryption or kAllowDataDecryption for decryption [SWS_CRYPT_23625].
ara::crypto::CryptoErrc::kIncompatibleObject: The key type is incompatible with the transformation or transformation direction [SWS_CRYPT_23625].
ara::crypto::CryptoErrc::kBusyResource: A required resource is busy [SWS_CRYPT_23625].
Concurrency and Interaction
The function is specified as thread-safe [SWS_CRYPT_23625]. In the course of stream processing, Start acts as an initiating step, which is followed, for example, by positioning operations via Seek[SWS_CRYPT_23613] or finalization via FinishEncrypt[SWS_CRYPT_23618].
This text was generated by an AI system based on AUTOSAR specification R25-11.
the transformation direction, i.e., encryption or decryption
iv
an Initialization Vector (IV) or "nonce" value. The allowed size of the IV can be queried using the functions GetMinimumInputIvSize() and GetMaximumInputIvSize().
rollback_semantics if the context does not support setting an IV in the given transform Direction or if stream processing is not supported by the context
rollback_semantics if the allowed usage of the key does not include kAllowData Encryption for encryption, or kAllowDataDecryption for decryption, respectively
Initialize the context for a new encryption or decryption. An IV is either not required for this context in this transformation direction, or set by the context itself.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 09affb4844e4Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
use
The Start method initializes an instance of ara::crypto::cryp::SymmetricCipherCtx synchronously for upcoming encryption or decryption ([SWS_CRYPT_50044]). It is used when no initialization vector (IV) is required for the transformation direction specified via the parameter transformDirection or when the context generates it itself ([SWS_CRYPT_50044]). If, however, the context requires an explicit IV in the selected direction, the overload with IV parameter must be called ([SWS_CRYPT_23625]).
Error Handling and Concurrency
The operation is specified as thread-safe and exception-safe ([SWS_CRYPT_50044]). In case of an error, the function returns a ara::core::Result<void> with rollback semantics ([SWS_CRYPT_50044]). Relevant causes of error are:
ara::crypto::CryptoErrc::kUninitializedContext: No key was assigned to the context in advance ([SWS_CRYPT_50044]).
ara::crypto::CryptoErrc::kUnsupported: Stream processing is not supported or the operation mandatory requires setting an IV in this direction ([SWS_CRYPT_50044]).
ara::crypto::CryptoErrc::kUsageViolation: The key does not possess the required permission kAllowDataEncryption or kAllowDataDecryption ([SWS_CRYPT_50044]).
ara::crypto::CryptoErrc::kIncompatibleObject or ara::crypto::CryptoErrc::kEmptyKeySlot: The key type does not match the transformation or the configured key slot is empty ([SWS_CRYPT_50044]).
ara::crypto::CryptoErrc::kBusyResource: A required resource is currently occupied ([SWS_CRYPT_50044]).
Interaction
After successful initialization, the data stream can be positioned via Seek if required ([SWS_CRYPT_23613]). If the IV was determined by the context itself, it is passed to the caller via FinishEncrypt at the end of encryption ([SWS_CRYPT_23618]).
This usage note was automatically created based on AUTOSAR specification R25-11.
rollback_semantics if the allowed usage of the key does not include kAllowData Encryption for encryption, or kAllowDataDecryption for decryption, respectively
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 5cb4a9bba31dProvenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The synchronous method Update() serves in ara::crypto::cryp::SymmetricCipherCtx for step-by-step encryption or decryption of partial data streams [SWS_CRYPT_50139]. It processes an input buffer in (type ReadOnlyMemRegion) containing plaintext or ciphertext and writes the transformed data into the output buffer out (type ReadWriteMemRegion) [SWS_CRYPT_50139]. In case of success, the return value ara::core::Result<std::size_t> provides the exact number of bytes actually written to out, which may be less than the total capacity of the destination buffer [SWS_CRYPT_50139].
Defined preconditions and buffer rules apply to the call:
Execution order: Data processing must mandatorily have been initiated beforehand using the method Start(); otherwise, the call fails with ara::crypto::CryptoErrc::kProcessingNotStarted[SWS_CRYPT_50139].
Buffer sizing: The maximum input size permitted per single call can be determined via GetMaximumChunkSize()[SWS_CRYPT_50050]; the method acknowledges invalid buffer sizes with ara::crypto::CryptoErrc::kInvalidInputSize[SWS_CRYPT_50139]. The required output buffer can be queried via GetRequiredOutputBufferSize()[SWS_CRYPT_50139]; a buffer that is too small leads to ara::crypto::CryptoErrc::kInsufficientCapacity[SWS_CRYPT_50139].
Streaming support: If the concrete context does not support continuous stream processing, the call fails with ara::crypto::CryptoErrc::kUnsupported[SWS_CRYPT_50139].
The interface is specified as thread-safe as well as exception safe and guarantees rollback semantics for every error [SWS_CRYPT_50139]. In the processing cycle, it interacts with GetMaximumChunkSize() as well as concluding operations such as Finish() or FinishEncrypt()[SWS_CRYPT_50050].
This usage note was generated automatically based on the AUTOSAR specification R25-11.
an input data buffer containing a part of the ciphertext or plaintext
Parameter (out)
Parameter
Beschreibung
out
an output data buffer that the encrypted or decrypted data will be written into. The required size of this buffer can be queried using GetRequiredOutputBufferSize()
gemini-3.8-flash-low· 2026-10-13 · German original