Provides basic types, error domains, and factory functions for cryptographic services and key management.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 253d08fc1defProvenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Provides basic types, error domains, and factory functions for cryptographic services and key management.
The namespace ara::crypto provides the common basic types, memory buffers, and global factory functions for cryptographic services in AUTOSAR Adaptive. Applications create or obtain subsystem instances such as crypto and key storage providers deterministically via entry points such as LoadCryptoProvider[SWS_CRYPT_20099]. All cryptographic operations and key uses are strictly monitored via defined usage flags as well as the standardized error domain with CryptoErrc[SWS_CRYPT_10099]. All factory interfaces require a valid process mapping and are designed to be thread-safe.
Context
The namespace ara::crypto forms the common foundation and central entry point for all cryptographic services, key management functions, and certificate operations of the AUTOSAR Adaptive Platform. Instead of exposing implementation details of the underlying drivers or hardware security modules, the namespace defines standardized interfaces and global factory functions. Via these entry points, applications request instances of the specialized subsystems: the general cryptography provider [SWS_CRYPT_20099], the X.509 provider [SWS_CRYPT_40099], read and write accesses to key slots [SWS_CRYPT_50004][SWS_CRYPT_50005], and formatters for object serialization [SWS_CRYPT_50200].
Context diagram: Interaction between application instances, the entry points in ara::crypto, and the provided subsystem objects. Sources: [SWS_CRYPT_20099], [SWS_CRYPT_40099], [SWS_CRYPT_50004], [SWS_CRYPT_50005], [SWS_CRYPT_50200].
Lifecycle
The lifecycle management of the core cryptographic objects follows the factory pattern via global entry points:
Instantiation and ownership: Applications do not create instances manually via constructors. Instead, the factory functions LoadCryptoProvider[SWS_CRYPT_20099], LoadKeySlot[SWS_CRYPT_50004], LoadWriteableKeySlot[SWS_CRYPT_50005], LoadX509Provider[SWS_CRYPT_40099], and LoadFormatter[SWS_CRYPT_50200] return shared ownership references in the form of ara::core::Result<...::Sptr>.
Singleton and provider lifecycles: The function LoadX509Provider provides the unique instance of the singleton X.509 provider [SWS_CRYPT_40099]. LoadCryptoProvider creates or references the existing instance of the crypto provider modeled via a ara::core::InstanceSpecifier[SWS_CRYPT_20099].
Concurrency and destruction: All factory functions as well as the error domain helpers GetCryptoErrorDomain[SWS_CRYPT_19952] and MakeErrorCode[SWS_CRYPT_19951] are specified as exception-safe (noexcept) and thread-safe (thread-safe). The referenced objects are released automatically as soon as the last held shared pointer expires.
Usage Path
A typical usage path for performing cryptographic operations or managing keys proceeds through the following steps:
Load provider: The application calls LoadCryptoProvider with a suitable ara::core::InstanceSpecifier to obtain access to the cryptographic operations [SWS_CRYPT_20099].
Reference key slot: For key-based procedures, the associated storage location is loaded: read-only via LoadKeySlot[SWS_CRYPT_50004] or with write permissions via LoadWriteableKeySlot[SWS_CRYPT_50005].
Object validation and permission check: Prior to execution, the application verifies the object types (CryptoObjectType[SWS_CRYPT_10016]) and the configured usage restrictions (AllowedUsageFlags[SWS_CRYPT_10015]), for example kAllowDataEncryption[SWS_CRYPT_13101] or kAllowDataDecryption[SWS_CRYPT_13102] matching CryptoTransform[SWS_CRYPT_10019].
Sequence diagram: Call and initialization sequence for loading providers and key slots with subsequent error checking. Sources: [SWS_CRYPT_20099], [SWS_CRYPT_50004], [SWS_CRYPT_19951].
Error Scenarios
Error handling in ara::crypto is based on the global error domain CryptoErrorDomain[SWS_CRYPT_19952], whose enumeration CryptoErrc[SWS_CRYPT_10099] defines all specific error codes:
Argument and buffer errors: Invalid arguments lead to kInvalidArgument, unknown identifiers to kUnknownIdentifier, and incompatible parameter combinations to kIncompatibleArguments[SWS_CRYPT_10099]. If the capacity of a ReadWriteMemRegion[SWS_CRYPT_10031] is insufficient, the interface signals kInsufficientCapacity[SWS_CRYPT_10099]. For incorrect input sizes, kInvalidInputSize occurs [SWS_CRYPT_10099].
State and sequence violations: In case of an incorrect call sequence, the system reports kInvalidUsageOrder[SWS_CRYPT_10099]. Using a context prior to initialization or querying a computation step before completion results in kUninitializedContext, kProcessingNotStarted, or kProcessingNotFinished[SWS_CRYPT_10099].
Permission and security violations: Operations contrary to the permissions declared in AllowedUsageFlags generate kUsageViolation[SWS_CRYPT_10099]. If the verification of an authentication tag fails, kAuthTagNotValid is triggered [SWS_CRYPT_10099].
Slot and mapping errors: Empty or incompatible key containers result in kEmptyKeySlot or kIncompatibleObject[SWS_CRYPT_10099]. If the InstanceSpecifier in LoadCryptoProvider, LoadKeySlot, or LoadWriteableKeySlot does not point to a PortPrototype modeled for the current process, this is considered ProcessMappingViolation ([SWS_CRYPT_20099], [SWS_CRYPT_50004], [SWS_CRYPT_50005]).
Error instances are generated programmatically via the helper function MakeErrorCode and reference CryptoErrorDomain[SWS_CRYPT_19951] without exception.
This guide is based exclusively on the specification requirements of AUTOSAR R25-11.
KI-gestützte Gruppierung auf Basis der Records und Spezifikationsauszüge; keine Gliederung aus der AUTOSAR-Spezifikation.
Class diagram
Abgerundete Rahmen = Namespace- bzw. Klassen-Scopes; hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); graue Boxen = namespace-fremde bzw. externe Basisklassen. Klicken öffnet die jeweilige Klassen- bzw. cppreference-Seite.
This factory method shall create or return the existing instance of a specific Crypto Provider.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: b6b49fc6b39dProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The factory function LoadCryptoProvider in namespace ara::crypto serves as a central entry point to create an instance of a cryptographic service provider or to retrieve an already existing instance [SWS_CRYPT_20099]. Header ara/crypto/common/entry_point.h is required for inclusion [SWS_CRYPT_20099].
Upon invocation, the following parameter and return properties apply [SWS_CRYPT_20099]:
Call parameter: The input parameter iSpecify (type const ara::core::InstanceSpecifier&) identifies the RPortPrototype of type CryptoProviderInterface that is assigned to the calling process [SWS_CRYPT_20099].
Return value: Upon successful instantiation, the function returns a ara::core::Result<cryp::CryptoProvider::Sptr>, which encapsulates a shared pointer to the loaded provider object [SWS_CRYPT_20099].
Concurrency: The function is declared as noexcept, is considered exception safe, and is explicitly specified as thread-safe, so that calls from parallel threads are permissible [SWS_CRYPT_20099].
Regarding error handling, the specification does not define standardized error codes [SWS_CRYPT_20099]. However, a failure of the operation is likely mapped as an error state in the returned ara::core::Result. Question Q-ad283a067489b0eb (open) In addition, the modeling violation ProcessMappingViolation is defined: this occurs if the passed InstanceSpecifier does not point to a PortPrototype that is valid for the current process and typed by a CryptoProviderInterface[SWS_CRYPT_20099].
This text was generated by an AI based on the AUTOSAR R25-11 specification.
ProcessMappingVio- In case InstanceSpecifier does not point to a PortPrototype typed lation by a CryptoProviderInterface modeled for the current process.
Parameter (in)
Parameter
Beschreibung
iSpecify
InstanceSpecifier of the RPortPrototype of type CryptoProvider Interface
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 1ad37ba369f0ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The function LoadFormatter in namespace ara::crypto serves as a factory for creating an instance of Formatter[SWS_CRYPT_50200]. The declaration is provided via the header file ara/crypto/common/formatter.h.
Usage and interface: The call is synchronous and requires no input parameters. As a return value, the function returns a ara::core::Result<ara::crypto::Formatter::Sptr>, which on success encapsulates a shared pointer to the newly created Formatter object [SWS_CRYPT_50200].
Error handling: The specification defines no standardized error codes for LoadFormatter[SWS_CRYPT_50200]. Since the return value is designed as ara::core::Result, implementation-specific errors during object creation are likely transmitted via the error channel of this result type. Question Q-dd9ac8319a9ad931 (open)
Concurrency and execution safety: The function is declared as noexcept and specified as exception-safe (exception safe) as well as thread-safe (thread-safe) [SWS_CRYPT_50200]. It can therefore be called in parallel from different threads without external synchronization measures.
This usage note was generated automatically and is based on the specifications of the AUTOSAR standard.
Load a read-only key slot. This factory method shall load the information associated with the specified KeySlot into a KeySlot object.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 8366de538e98Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The function LoadKeySlot in namespace ara::crypto is designed as a factory method to load a read-only key slot (read-only key slot) [SWS_CRYPT_50004]. When called synchronously, the method loads the metadata and key information associated with the specified slot into a corresponding KeySlot object [SWS_CRYPT_50004]. Header file ara/crypto/common/entry_point.h is used for inclusion.
As input parameter, the function accepts an instance specification iSpecify of type const ara::core::InstanceSpecifier&[SWS_CRYPT_50004]. This identifier must refer to the RPortPrototype of a CryptoKeySlotInterface or a CryptoKeySlotClientInterface that uniquely identifies the key to be loaded [SWS_CRYPT_50004].
As result, the method returns a ara::core::Result<cryp::KeySlot::Sptr>, which provides either a shared pointer to the loaded KeySlot object or an error [SWS_CRYPT_50004]. The specification defines no standardized error codes for LoadKeySlot[SWS_CRYPT_50004]. However, a ProcessMappingViolation is documented: this occurs when the passed InstanceSpecifier does not refer to a port modeled for the current process that is typed by a CryptoKeySlotInterface or CryptoKeySlotClientInterface[SWS_CRYPT_50004].
For execution, the function is declared as noexcept and offers complete exception safety (exception safe) [SWS_CRYPT_50004]. In addition, the call is specified as thread-safe (thread-safe), so that concurrent access by multiple threads is supported [SWS_CRYPT_50004].
This usage note was generated automatically based on the AUTOSAR specification R25-11.
ProcessMappingVio- In case InstanceSpecifier does not point to a PortPrototype typed lation by a CryptoKeySlotInterface or CryptoKeySlotClientInterface modeled for the current process.
Parameter (in)
Parameter
Beschreibung
iSpecify
instance specifier to the RPortPrototype of a CryptoKeySlot Interface or a CryptoKeySlotClientInterface that identifies the key to be loaded
Load a writeable key slot. This factory method shall load the information associated with the specified KeySlot into a WriteableKeySlot object.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 548256d68415ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
use
The function LoadWriteableKeySlot serves as a synchronous factory method to load the information of a specified key slot into a cryp::WriteableKeySlot object [SWS_CRYPT_50005]. The function is defined in namespace ara::crypto and provided via header ara/crypto/common/entry_point.h[SWS_CRYPT_50005].
Parameters:iSpecify (of type const ara::core::InstanceSpecifier&) refers to the RPortPrototype of a CryptoKeySlotInterface and thereby identifies the key to be loaded [SWS_CRYPT_50005].
Return value: A ara::core::Result<cryp::WriteableKeySlot::Sptr> containing either the loaded KeySlot as a shared pointer or an error object [SWS_CRYPT_50005].
Semantics: The call is executed synchronously directly upon execution [SWS_CRYPT_50005].
Error Handling and Boundary Conditions
No standardized error codes are specified for this function [SWS_CRYPT_50005]. Occurring error conditions are presumably communicated via the returned ara::core::Result. Question Q-e2f8966bf78b1569 (open) An architectural or configuration error leads to a ProcessMappingViolation if the passed InstanceSpecifier does not reference a PortPrototype modeled for the current process that is typed by a CryptoKeySlotInterface[SWS_CRYPT_50005].
Concurrency and Interaction
The function is declared thread-safe (thread-safe) and exception-safe (exception safe) with a noexcept guarantee [SWS_CRYPT_50005]. It addresses the overarching cryptography requirement [RS_CRYPTO_02004] and represents the central access point for providing writable key slots in the process [SWS_CRYPT_50005].
This usage note was generated by an AI based on the AUTOSAR R25-11 specification.
ProcessMappingVio- In case InstanceSpecifier does not point to a PortPrototype typed lation by a CryptoKeySlotInterface modeled for the current process.
Parameter (in)
Parameter
Beschreibung
iSpecify
instance specifier to the RPortPrototype of a CryptoKeySlot Interface that identifies the key to be loaded
This factory method shall create or return the existing instance of the singleton X.509 Provider.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 70f8a61e4c9eProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
use
The function LoadX509Provider in namespace ara::crypto serves as a factory method to create the singleton instance of the X.509 provider or retrieve the already existing instance [SWS_CRYPT_40099]. To make the call, header file ara/crypto/common/entry_point.h must be included [SWS_CRYPT_40099]. The call is synchronous and accepts no arguments. As return value, the function provides a ara::core::Result<ara::crypto::x509::X509Provider::Sptr>, which provides a shared pointer to the loaded instance of the X.509 provider [SWS_CRYPT_40099].
Error handling
No standardized error codes are defined in the specification for LoadX509Provider[SWS_CRYPT_40099]. The function is declared with noexcept and specified as exception safe [SWS_CRYPT_40099]. Interpretation: Since the result is encapsulated via type ara::core::Result, system-specific error states during provider initialization are likely transmitted to the caller via this Result object. Question Q-c187f4f152ccc89f (open)
Concurrency and Interaction
According to the specification, LoadX509Provider is classified as thread-safe [SWS_CRYPT_40099]. Consequently, the call can be made in parallel from multiple threads without additional synchronization measures in order to obtain a reference to the same singleton instance. Technically, the function implements the higher-level requirements RS_CRYPTO_02306 and RS_CRYPTO_02301[SWS_CRYPT_40099].
This text was generated by an AI system based on the specification.
gemini-3.8-flash-low· 2026-10-13 · German original