DEENESPTFRRUARHIKOZHNL

class ara::crypto::cryp::SymmetricKeyWrapperCtx

[SWS_CRYPT_24000] Upstream: RS_CRYPTO_02104, RS_CRYPTO_02208

class SymmetricKeyWrapperCtx :               public CryptoContext {...};

Context of a symmetric key wrap algorithm.

Header-Datei#include "ara/crypto/cryp/symmetric_key_wrapper_ctx.h"
Forwarding-Header#include "ara/crypto/crypto_fwd.h"
Scopenamespace ara::crypto::cryp
Basisklasse(n)CryptoContext

User GuideAI-GENERATED

Enables the secure wrapping and unwrapping of keys by means of symmetric key encryption.
AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 16126e8d9692 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Enables the secure wrapping and unwrapping of keys by means of symmetric key encryption.

The context SymmetricKeyWrapperCtx serves for the cryptographic wrapping and unwrapping of keys using symmetric algorithms. Prior to executing Wrap or UnwrapSymmetricKey, the context must be configured with a compatible key encryption key (KEK) via SetKey [SWS_CRYPT_24018]. All operations require corresponding usage permissions of the involved key objects and report errors via ara::core::Result with rollback semantics [SWS_CRYPT_24014]. The interface is exception-safe and specified as thread-safe for concurrent operation.

Context

The class SymmetricKeyWrapperCtx defines the standardized interface for symmetric key wrapping algorithms within the AUTOSAR Adaptive Platform. Its central responsibility consists in the cryptographic protection of keys during export as well as in restoring wrapped keys for internal use. In doing so, the class primarily interacts with key encryption keys (KEK) that are provided either as a volatile key object of type SymmetricKey or persistently via a KeySlot [SWS_CRYPT_24018], [SWS_CRYPT_50034]. During wrapping, the context accepts a generic CryptoObject [SWS_CRYPT_24014], whereas the unwrapping operation creates and returns a new, ready-to-use SymmetricKey object [SWS_CRYPT_24016].

Lifecycle

Instances of SymmetricKeyWrapperCtx are managed via the typed smart pointer Sptr (an alias for std::shared_ptr<SymmetricKeyWrapperCtx>) [SWS_CRYPT_24001]. The actual object creation is likely performed via a responsible provider factory, as the class represents an abstract interface with pure virtual methods. Question Q-7b9a1007da43ddcd (open) All member functions of the interface are specified as exception-safe as well as thread-safe, which enables safe use in concurrent software components [SWS_CRYPT_24014], [SWS_CRYPT_24016].

During its lifecycle, the context passes through two main phases: Immediately after instantiation, it is in an uninitialized state. In this phase, cryptographic operations and buffer calculations fail with the error kUninitializedContext [SWS_CRYPT_50035], [SWS_CRYPT_24014]. Only upon the successful call of SetKey with a compatible KEK or KeySlot does the context transition to the operational state in which keys can be securely wrapped or unwrapped [SWS_CRYPT_24018], [SWS_CRYPT_50034].

Usage Path

The regular procedure for wrapping a key requires a coordinated sequence of configuration, buffer verification, and execution. First, the application configures the context via SetKey with the desired KEK object [SWS_CRYPT_24018] or binds a corresponding KeySlot [SWS_CRYPT_50034]. In the second step, the application determines the maximum required output buffer size for the target object to be wrapped via GetRequiredWrappedKeyBufferSize [SWS_CRYPT_50035]. After a correspondingly sized memory area (ReadWriteMemRegion) has been provided, Wrap is called, which writes the serialized and encrypted key data into the buffer and returns the exact number of bytes [SWS_CRYPT_24014].

Symmetrischer Key-Wrapping-AblaufApplicationSymmetricKeyWrapperCtxSetKey(kek)ara::core::Result<void>GetRequiredWrappedKeyBufferSize(key)ara::core::Result<std::size_t>Wrap(key, wrappedKey)ara::core::Result<std::size_t>

Sequence diagram: Typical call sequence for symmetric key wrapping. Sources: [SWS_CRYPT_24018], [SWS_CRYPT_50035], [SWS_CRYPT_24014]

For the complementary process of unwrapping, the application passes the input buffer containing the wrapped data to UnwrapSymmetricKey after configuration via SetKey [SWS_CRYPT_24016]. In doing so, the target algorithm identifier (targetAlgId) and the permitted usage flags (allowedUsage) for the symmetric key to be newly created must be explicitly specified [SWS_CRYPT_24016].

Error Scenarios

Methods of the class signal errors via the return type ara::core::Result with rollback semantics. Central error scenarios include:

  • Missing initialization: If GetRequiredWrappedKeyBufferSize, Wrap, or UnwrapSymmetricKey are called before a successful key assignment, they return ara::crypto::CryptoErrc::kUninitializedContext [SWS_CRYPT_50035], [SWS_CRYPT_24014], [SWS_CRYPT_24016].
  • Violation of usage rights: When setting the KEK, it must possess at least the permission kAllowKeyWrapping or kAllowKeyUnwrapping; otherwise, SetKey fails with ara::crypto::CryptoErrc::kUsageViolation [SWS_CRYPT_24018]. For Wrap, the absence of kAllowKeyWrapping on the KEK or the absence of kAllowSecuredExport on the object to be wrapped likewise leads to kUsageViolation [SWS_CRYPT_24014]. During unwrapping, a check is performed to determine whether the KEK permits kAllowKeyUnwrapping [SWS_CRYPT_24016].
  • Incompatibilities and buffer errors: If the target buffer for Wrap is too small, ara::crypto::CryptoErrc::kInsufficientCapacity is reported [SWS_CRYPT_24014]. Faulty key formats or incompatible types lead to ara::crypto::CryptoErrc::kInvalidArgument [SWS_CRYPT_24014], [SWS_CRYPT_24016]. If the context only supports slots or only key objects, SetKey reports the error kUnsupported [SWS_CRYPT_24018], [SWS_CRYPT_50034].
  • Resource conflicts and empty slots: If the operation accesses a busy resource, ara::crypto::CryptoErrc::kBusyResource is returned; if the referenced KeySlot is empty, this results in ara::crypto::CryptoErrc::kEmptyKeySlot [SWS_CRYPT_24014], [SWS_CRYPT_24016].

This guide was created by an AI and relies exclusively on the AUTOSAR specification.

Member map

Class diagram

Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.

G nara__crypto__cryp__SymmetricKeyWrapperCtx465 SymmetricKeyWrapperCtx + GetRequiredWrappedKeyBufferSize() + SetKey() + UnwrapSymmetricKey() + Wrap() nara__crypto__cryp__CryptoContext85 CryptoContext nara__crypto__cryp__SymmetricKeyWrapperCtx465->nara__crypto__cryp__CryptoContext85

Detail view

Select an entry in the outline.

Methods

Calculate the maximum required size of the wrapped key output buffer depending on the key to be wrapped.

virtual ara::core::Result< std::size_t > GetRequiredWrappedKeyBuffer Size (const CryptoObject &key) const noexcept;
SetKey function 2

Configure the context to use the provided key as key encryption key.

Overloads SetKey 2
virtual ara::core::Result< void > SetKey (SymmetricKey::Sptr key) noexcept=0; SWS_CRYPT_24018
virtual ara::core::Result< void > SetKey (KeySlot::Sptr keySlot) noexcept=0; SWS_CRYPT_50034

Unwrap a wrapped key using the previously set key encryption key and return an SymmetricKey.

virtual ara::core::Result< SymmetricKey::Sptr > UnwrapSymmetricKey (ReadOnlyMemRegion wrappedKey, AlgId targetAlgId, AllowedUsageFlags allowedUsage) const noexcept=0;
Wrap function

Wrap the provided key using the previously set key encryption key.

virtual ara::core::Result< std::size_t > Wrap (CryptoObject::Sptr key, ReadWriteMemRegion wrappedKey) const noexcept=0;

Type aliases

Sptr type alias

Smart pointer of the interface.

Method documentation

function GetRequiredWrappedKeyBufferSize [SWS_CRYPT_50035] Upstream: RS_CRYPTO_02302

virtual ara::core::Result< std::size_t > GetRequiredWrappedKeyBuffer Size (const CryptoObject &key) const noexcept;

Calculate the maximum required size of the wrapped key output buffer depending on the key to be wrapped.

Header-Datei#include "ara/crypto/cryp/symmetric_key_wrapper_ctx.h"
Scopeclass ara::crypto::cryp::SymmetricKeyWrapperCtx
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
keykey to be wrapped

Rückgabewert

TypBeschreibung
ara::core::Result<std::size_t >a result containing the required capacity of the output buffer in bytes or an error

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUninitializedContextrollback_semantics if the context was not initialized by deploying a key

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CRYPT_50035
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50035@rel:R25-11#79bcf3cd
Content hash
79bcf3cd
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50035
Status: valid/unmigrated Version: rel:R25-11#79bcf3cd Versionshistorie & Revisions (1 transition)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CRYPT_50035@rel:R25-11#79bcf3cd
Point-in-Time History:
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

function SetKey [SWS_CRYPT_24018] Upstream: RS_CRYPTO_02001, RS_CRYPTO_02003

virtual ara::core::Result< void > SetKey (SymmetricKey::Sptr key) noexcept=0;

Configure the context to use the provided key as key encryption key.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: d0a83598653d Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Usage and Semantics

The synchronous member function SetKey configures an instance of ara::crypto::cryp::SymmetricKeyWrapperCtx such that the passed object SymmetricKey::Sptr is used as a Key Encryption Key (KEK) for subsequent key operations [SWS_CRYPT_24018]. The function is specified as a pure virtual method with noexcept and returns an empty ara::core::Result<void> if the assignment was successful [SWS_CRYPT_24018].

Error Handling and Rollback

If an error occurs during configuration, mandatory rollback semantics apply, ensuring that the state of the context remains unchanged [SWS_CRYPT_24018]. Possible error causes are mapped via error codes from ara::crypto::CryptoErrc:

  • kIncompatibleObject: The passed key object is incompatible with the symmetric context [SWS_CRYPT_24018].
  • kUsageViolation: The permitted usage of the key includes neither kAllowKeyWrapping nor kAllowKeyUnwrapping [SWS_CRYPT_24018].
  • kUnsupported: The context implementation exclusively supports setting a key via a KeySlot [SWS_CRYPT_24018].

Concurrency and Interaction

The method is specified as thread-safe and exception safe [SWS_CRYPT_24018]. If keys are managed via slots or the context exclusively supports KeySlots, the alternative overload SetKey with KeySlot::Sptr exists for the same wrapper context [SWS_CRYPT_50034]. This configures the context to load the key stored in the slot at the execution time of the key wrapping [SWS_CRYPT_50034].

This usage note is based on the specification AUTOSAR Adaptive Platform Release R25-11.

Implementer's Guide to follow (complexity I2)

Header-Datei#include "ara/crypto/cryp/symmetric_key_wrapper_ctx.h"
Scopeclass ara::crypto::cryp::SymmetricKeyWrapperCtx
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
keythe the key encryption key (KEK) object

Rückgabewert

TypBeschreibung
ara::core::Result< void >An empty result or an error

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kIncompatibleObjectrollback_semantics if the provided key object is incompatible with this symmetric key context
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the key does not include kAllowKey Wrapping or kAllowKeyUnwrapping
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context only supports setting a KeySlot

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CRYPT_24018
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_24018@rel:R25-11#07e64025
Content hash
07e64025
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_24018
Status: valid/unmigrated Version: rel:R25-11#5ba8abd5 Versionshistorie & Revisions (1 transition, 7 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CRYPT_24018@rel:R25-11#5ba8abd5
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#07e640252026-09-30
  • R20-11rel:R20-11#dc67c1dc2026-10-14
  • R21-11rel:R21-11#34c85a1a2026-10-14
  • R22-11rel:R22-11#4ead34ac2026-10-14
  • R23-11rel:R23-11#9ca31f482026-10-14
  • R24-11rel:R24-11#bb17e6102026-10-14
  • R25-11rel:R25-11#5ba8abd52026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

function SetKey [SWS_CRYPT_50034] Upstream: RS_CRYPTO_02001, RS_CRYPTO_02003

virtual ara::core::Result< void > SetKey (KeySlot::Sptr keySlot) noexcept=0;

Configure the context to use the key stored in the provided KeySlot at the time the key wrapping is performed.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 30d79040bb46 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The virtual method SetKey configures the context ara::crypto::cryp::SymmetricKeyWrapperCtx such that the key stored in the provided KeySlot is used as soon as key wrapping is executed [SWS_CRYPT_50034]. The call expects as parameter keySlot a KeySlot::Sptr containing a symmetric key [SWS_CRYPT_50034]. The function is called synchronously, is declared with noexcept, and returns a ara::core::Result<void> [SWS_CRYPT_50034].

Error handling

In case of error, the method ensures rollback semantics and returns one of the following error results [SWS_CRYPT_50034]:

  • ara::crypto::CryptoErrc::kIncompatibleObject: The passed keySlot is incompatible with this context [SWS_CRYPT_50034].
  • ara::crypto::CryptoErrc::kUnsupported: The context exclusively supports setting a direct SymmetricKey [SWS_CRYPT_50034].

Concurrency

The operation is thread-safe and offers guaranteed exception safety (exception safe) [SWS_CRYPT_50034].

Interaction

Within SymmetricKeyWrapperCtx, the interface represents the slot-based counterpart to overload SetKey with SymmetricKey::Sptr, which binds a key directly as Key Encryption Key (KEK) [SWS_CRYPT_24018]. Analogous slot-based configuration functions are also used in related cryptographic contexts such as KeyDerivationFunctionCtx [SWS_CRYPT_50010], KeyEncapsulatorPublicCtx [SWS_CRYPT_50012], VerifierPublicCtx [SWS_CRYPT_50018], MessageAuthnCodeCtx [SWS_CRYPT_50026], and SignerPrivateCtx [SWS_CRYPT_50036].

This usage note was generated automatically based on the specification of AUTOSAR Adaptive R25-11.

Implementer's Guide to follow (complexity I2)

Header-Datei#include "ara/crypto/cryp/symmetric_key_wrapper_ctx.h"
Scopeclass ara::crypto::cryp::SymmetricKeyWrapperCtx
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
keySlota keyslot containing a symmetric key

Rückgabewert

TypBeschreibung
ara::core::Result< void >An empty result or an error

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kIncompatibleObjectrollback_semantics if the provided keySlot is incompatible with this context
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context only supports setting a SymmetricKey

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CRYPT_50034
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50034@rel:R25-11#c06f6729
Content hash
c06f6729
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50034
Status: valid/unmigrated Version: rel:R25-11#c06f6729 Versionshistorie & Revisions (1 transition)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CRYPT_50034@rel:R25-11#c06f6729
Point-in-Time History:
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

function UnwrapSymmetricKey [SWS_CRYPT_24016] Upstream: RS_CRYPTO_02115

virtual ara::core::Result< SymmetricKey::Sptr > UnwrapSymmetricKey (ReadOnlyMemRegion wrappedKey, AlgId targetAlgId, AllowedUsageFlags allowedUsage) const noexcept=0;

Unwrap a wrapped key using the previously set key encryption key and return an SymmetricKey.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: fe87df5f5eae Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The method UnwrapSymmetricKey of interface ara::crypto::cryp::SymmetricKeyWrapperCtx decrypts a wrapped key using the previously set key encryption key (KEK) and returns a new SymmetricKey object [SWS_CRYPT_24016]. As parameters, the synchronous function accepts the input buffer with the protected key data (wrappedKey), the algorithm identifier for the target key (targetAlgId), and bit flags for its permitted transformation types (allowedUsage) [SWS_CRYPT_24016].

Upon successful execution, the return value ara::core::Result<SymmetricKey::Sptr> contains a smart pointer to the generated key or signals an error with rollback semantics [SWS_CRYPT_24016]. Possible error causes are:

  • InvalidArgument: The passed key data in wrappedKey cannot be unpacked, for instance due to an invalid format or an incorrect buffer size [SWS_CRYPT_24016].
  • ara::crypto::CryptoErrc::kUninitializedContext: The wrapper context has not yet been initialized with a matching KEK [SWS_CRYPT_24016].
  • ara::crypto::CryptoErrc::kUsageViolation: The usage restrictions of the KEK prohibit unwrapping (absence of kAllowKeyUnwrapping) [SWS_CRYPT_24016].
  • ara::crypto::CryptoErrc::kUnknownIdentifier: The passed value for targetAlgId is not known or is not supported [SWS_CRYPT_24016].
  • ara::crypto::CryptoErrc::kIncompatibleArguments: The specified allowedUsage flags are incompatible with targetAlgId or the key type [SWS_CRYPT_24016].
  • ara::crypto::CryptoErrc::kBusyResource: A system resource required for the operation is currently busy [SWS_CRYPT_24016].
  • ara::crypto::CryptoErrc::kEmptyKeySlot: A KeySlot configured for the operation is empty [SWS_CRYPT_24016].

The method is declared as const and noexcept, guarantees exception safety, and is thread-safe for concurrent calls according to the specification [SWS_CRYPT_24016].

This text was created by an AI and serves as an orientation guide. Authoritative is the specification.

Header-Datei#include "ara/crypto/cryp/symmetric_key_wrapper_ctx.h"
Scopeclass ara::crypto::cryp::SymmetricKeyWrapperCtx
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe ara::crypto::CryptoErrc::k rollback_semantics

Parameter (in)

ParameterBeschreibung
wrappedKeyan input buffer that contains the wrapped key
targetAlgIdthe algId of the to be created unwrapped key
allowedUsagebit-flags that define a list of allowed transformations’ types in which the unwrapped key can be used

Rückgabewert

TypBeschreibung
ara::core::Result<SymmetricKey::Sptr >a result containing the unwrapped SymmetricKey object or an error

Fehler

FehlercodeBeschreibung
InvalidArgumentif the wrapped key data cannot be unwrapped (e.g., invalid format or size)
ara::crypto::CryptoErrc::kUninitializedContextrollback_semantics if the context was not initialized by a key value
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the KEK does not include kAllowKey Unwrapping
ara::crypto::CryptoErrc::kUnknownIdentifierrollback_semantics if targetAlgId has an unsupported value
ara::crypto::CryptoErrc::kIncompatibleArgumentsrollback_semantics if the allowedUsage is incompatible with the targetAlgId or the key type
ara::crypto::CryptoErrc::kBusyResourcerollback_semantics a required resource is busy
ara::crypto::CryptoErrc::kEmptyKeySlotrollback_semantics if a KeySlot was configured that is currently is empty
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the KEK does not include kAllowKey Unwrapping

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CRYPT_24016
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_24016@rel:R25-11#74bd38af
Content hash
74bd38af
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_24016
Status: valid/unmigrated Version: rel:R25-11#7d151daa Versionshistorie & Revisions (1 transition, 8 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CRYPT_24016@rel:R25-11#7d151daa
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#74bd38af2026-09-30
  • R19-11rel:R19-11#8ec5b1a02026-10-14
  • R20-11rel:R20-11#496f81ad2026-10-14
  • R21-11rel:R21-11#354b26632026-10-14
  • R22-11rel:R22-11#767017ac2026-10-14
  • R23-11rel:R23-11#624822262026-10-14
  • R24-11rel:R24-11#9c4b80db2026-10-14
  • R25-11rel:R25-11#7d151daa2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

function Wrap [SWS_CRYPT_24014] Upstream: RS_CRYPTO_02201

virtual ara::core::Result< std::size_t > Wrap (CryptoObject::Sptr key, ReadWriteMemRegion wrappedKey) const noexcept=0;

Wrap the provided key using the previously set key encryption key.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 8e6ff8198c9d Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The method Wrap of class ara::crypto::cryp::SymmetricKeyWrapperCtx (header file ara/crypto/cryp/symmetric_key_wrapper_ctx.h) packs a provided key using the previously set key encryption key (Key Encryption Key) [SWS_CRYPT_24014].

The synchronous function expects the following parameters [SWS_CRYPT_24014]:

  • key (CryptoObject::Sptr): The key to be wrapped.
  • wrappedKey (ReadWriteMemRegion): An output buffer into which the wrapped key is written.

As return value, the operation returns a ara::core::Result<std::size_t> that, in case of success, contains the number of bytes of the wrapped key written to the buffer [SWS_CRYPT_24014].

Error Handling and Semantics

The method is defined as exception safe and implements strict rollback semantics for error cases [SWS_CRYPT_24014]. The following error states can be reported [SWS_CRYPT_24014]:

  • InvalidArgument: The key object cannot be wrapped (e.g. due to invalid size or incorrect type).
  • ara::crypto::CryptoErrc::kUninitializedContext: The context has not yet been initialized with a key value.
  • ara::crypto::CryptoErrc::kUsageViolation: The permitted usage of the KEK does not include kAllowKeyWrapping, or that of the object does not include kAllowSecuredExport.
  • ara::crypto::CryptoErrc::kInsufficientCapacity: The output buffer wrappedKey is too small.
  • ara::crypto::CryptoErrc::kBusyResource: A required resource is busy.
  • ara::crypto::CryptoErrc::kEmptyKeySlot: A configured KeySlot is currently empty.

Concurrency and Limitations

The interface is specified as thread-safe [SWS_CRYPT_24014]. Prerequisites for execution are a previously initialized context as well as matching usage attributes of the involved keys [SWS_CRYPT_24014].

This usage note was generated automatically based on the specification of AUTOSAR Adaptive R25-11.

Header-Datei#include "ara/crypto/cryp/symmetric_key_wrapper_ctx.h"
Scopeclass ara::crypto::cryp::SymmetricKeyWrapperCtx
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe ara::crypto::CryptoErrc::k rollback_semantics

Parameter (in)

ParameterBeschreibung
keythe key to be wrapped

Parameter (out)

ParameterBeschreibung
wrappedKeyan output buffer that the wrapped key will be written to

Rückgabewert

TypBeschreibung
ara::core::Result<std::size_t >a result containing either a the number of bytes of the wrapped key or an error

Fehler

FehlercodeBeschreibung
InvalidArgumentif the key object cannot be wrapped (e.g., invalid size or type)
ara::crypto::CryptoErrc::kUninitializedContextrollback_semantics if the context was not initialized by a key value
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the KEK does not include kAllowKey Wrapping or the allowed usage of the object does not include k AllowSecuredExport
ara::crypto::CryptoErrc::kInsufficientCapacityrollback_semantics if the output buffer is too small
ara::crypto::CryptoErrc::kBusyResourcerollback_semantics a required resource is busy
ara::crypto::CryptoErrc::kEmptyKeySlotrollback_semantics if a KeySlot was configured that is currently is empty

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CRYPT_24014
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_24014@rel:R25-11#ac935a36
Content hash
ac935a36
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_24014
Status: valid/unmigrated Version: rel:R25-11#d59df6cf Versionshistorie & Revisions (1 transition, 8 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CRYPT_24014@rel:R25-11#d59df6cf
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#ac935a362026-09-30
  • R19-11rel:R19-11#b94a246e2026-10-14
  • R20-11rel:R20-11#999104362026-10-14
  • R21-11rel:R21-11#d51795ed2026-10-14
  • R22-11rel:R22-11#f7dabf992026-10-14
  • R23-11rel:R23-11#5c3c2d942026-10-14
  • R24-11rel:R24-11#90cde3442026-10-14
  • R25-11rel:R25-11#d59df6cf2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

Type alias documentation

type alias Sptr [SWS_CRYPT_24001] Upstream: RS_CRYPTO_02201

using Sptr = std::shared_ptr<SymmetricKeyWrapperCtx>;

Smart pointer of the interface.

Header-Datei#include "ara/crypto/cryp/symmetric_key_wrapper_ctx.h"
Scopeclass ara::crypto::cryp::SymmetricKeyWrapperCtx
SymbolSptr

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CRYPT_24001
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_24001@rel:R25-11#10e154c5
Content hash
10e154c5
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_24001
Status: valid/unmigrated Version: rel:R25-11#aef6197c Versionshistorie & Revisions (1 transition, 8 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CRYPT_24001@rel:R25-11#aef6197c
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#10e154c52026-09-30
  • R19-11rel:R19-11#521f46bb2026-10-14
  • R20-11rel:R20-11#0ab69c592026-10-14
  • R21-11rel:R21-11#8d463cfa2026-10-14
  • R22-11rel:R22-11#7a7fa6972026-10-14
  • R23-11rel:R23-11#4b170d372026-10-14
  • R24-11rel:R24-11#4b170d372026-10-14
  • R25-11rel:R25-11#aef6197c2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill