DEENESPTFRRUARHIKOZHNL

class ara::crypto::cryp::KeyEncapsulatorPublicCtx

[SWS_CRYPT_21800] Upstream: RS_CRYPTO_02104, RS_CRYPTO_02209

class KeyEncapsulatorPublicCtx :                public CryptoContext {...};

Asymmetric Key Encapsulation Mechanism (KEM) Public key Context interface.

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

User GuideAI-GENERATED

Encapsulates symmetric keys asymmetrically via public keys or generates them during the encapsulation process.
AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: f00bc8643d8f Provenance Open questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Encapsulates symmetric keys asymmetrically via public keys or generates them during the encapsulation process.

The interface ara::crypto::cryp::KeyEncapsulatorPublicCtx enables asymmetric key encapsulation mechanisms (KEM) to wrap symmetric keys for secure exchange or to generate and instantiate them directly during encapsulation ([SWS_CRYPT_50011]). Prior to execution, the context must be initialized via SetKey with a public key or slot and the required output buffer size must be determined ([SWS_CRYPT_21815]). Essential constraints are the required key usage flags such as kAllowKeyWrapping and complete thread safety for all operations.

Context

The interface ara::crypto::cryp::KeyEncapsulatorPublicCtx defines the asymmetric context for Key Encapsulation Mechanisms (KEM) using a public key. Within the cryptography architecture of AUTOSAR Adaptive, the class serves for secure key exchange and key transport. It accepts an asymmetric public key in order to either encapsulate an existing symmetric key ([SWS_CRYPT_21813]) or generate and provide a new symmetric key during encapsulation ([SWS_CRYPT_50011]). The key basis can be bound as a direct key object PublicKey ([SWS_CRYPT_21815]) or via a persisted slot KeySlot ([SWS_CRYPT_50012]).

diag_kem_kontext Anwendung Anwendung KeyEncapsulatorPublicCtx KeyEncapsulatorPublicCtx Anwendung->KeyEncapsulatorPublicCtx SymmetricKey SymmetricKey KeyEncapsulatorPublicCtx->SymmetricKey PublicKey PublicKey PublicKey->KeyEncapsulatorPublicCtx KeySlot KeySlot KeySlot->KeyEncapsulatorPublicCtx

Context diagram: Integration of KeyEncapsulatorPublicCtx between application, key sources, and target keys. Sources: [SWS_CRYPT_21813], [SWS_CRYPT_21815], [SWS_CRYPT_50011], [SWS_CRYPT_50012]

Lifecycle

Instances of KeyEncapsulatorPublicCtx are managed via the typed smart pointer KeyEncapsulatorPublicCtx::Sptr, which is defined as std::shared_ptr<KeyEncapsulatorPublicCtx> ([SWS_CRYPT_21801]). Actual object creation is likely handled via an underlying provider factory of the platform, as the class represents a pure virtual interface. Question Q-3551020e7b9c0f0c (open)

After creation, the context is in an incompletely initialized state. As long as no public key has been assigned to the context, calls for buffer size calculation ([SWS_CRYPT_50013]) and encapsulation operations ([SWS_CRYPT_21813], [SWS_CRYPT_50011]) fail with the error CryptoErrc::kUninitializedContext. Operational readiness is established by configuration via SetKey with PublicKey::Sptr ([SWS_CRYPT_21815]) or KeySlot::Sptr ([SWS_CRYPT_50012]). When assigning a KeySlot, the contained public key is likely read dynamically only at the actual execution time of the encapsulation. Question Q-ea760070f05941d2 (open) All methods of the context are thread-safe according to the specification and guarantee exception safety ([SWS_CRYPT_21813], [SWS_CRYPT_50011], [SWS_CRYPT_50013], [SWS_CRYPT_21815], [SWS_CRYPT_50012]).

Usage Path

Practical application of the context follows a defined sequence of key binding, buffer dimensioning, and encapsulation execution:

  • Key binding: The application initializes the context via SetKey with either a loaded PublicKey ([SWS_CRYPT_21815]) or a KeySlot ([SWS_CRYPT_50012]).
  • Buffer dimensioning: Before providing the output buffer, the application determines the maximum required output size in bytes via GetRequiredOutputBufferSize(algId) ([SWS_CRYPT_50013]) for the intended symmetric target algorithm and reserves a corresponding ReadWriteMemRegion.
  • Execution of encapsulation: Depending on the intended use, the application selects one of the two encapsulation variants:
    • Provisioning of an existing key: Encapsulate(key, encapsulatedKey) encapsulates the passed SymmetricKey and returns the number of written bytes ([SWS_CRYPT_21813]).
    • Autonomous generation: Encapsulate(algId, allowedUsage, encapsulatedKey) generates a new symmetric key according to the required usage flags and returns a pair consisting of the byte size and the new SymmetricKey::Sptr ([SWS_CRYPT_50011]).
Sequence of key encapsulationApplicationKeyEncapsulatorPublicCtxUse Case: Configuration of encapsulation keySetKey(key / keySlot)Result<void>Use Case: Buffer size checkGetRequiredOutputBufferSize(algId)Result<std::size_t>Use Case: KapselungaltExisting keyEncapsulate(key, memRegion)Result<std::size_t>New key is generatedEncapsulate(algId, usage, memRegion)Result<std::pair<std::size_t, SymmetricKey::Sptr>>

Sequence diagram: Typical call sequence from key assignment and buffer calculation through to key encapsulation. Sources: [SWS_CRYPT_21813], [SWS_CRYPT_21815], [SWS_CRYPT_50011], [SWS_CRYPT_50013]

Error Scenarios

Methods of KeyEncapsulatorPublicCtx report errors via ara::core::Result with values from ara::crypto::CryptoErrc and ensure rollback semantics in case of error. Essential error situations include:

This guide is based exclusively on the specifications of AUTOSAR Adaptive Platform Release R25-11.

Member map

Class diagram

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

G nara__crypto__cryp__KeyEncapsulatorPublicCtx699 KeyEncapsulatorPublicCtx + Encapsulate() + GetRequiredOutputBufferSize() + SetKey() nara__crypto__cryp__CryptoContext85 CryptoContext nara__crypto__cryp__KeyEncapsulatorPublicCtx699->nara__crypto__cryp__CryptoContext85

Detail view

Select an entry in the outline.

Methods

Encapsulate function 2

Encapsulate the provided symmetric key.

Overloads Encapsulate 2
virtual ara::core::Result< std::size_t > Encapsulate (Symmetric Key::Sptr key, ReadWriteMemRegion encapsulatedKey) const noexcept=0; SWS_CRYPT_21813
virtual ara::core::Result< std::pair< std::size_t, SymmetricKey::Sptr > > Encapsulate (AlgId algId, AllowedUsageFlags allowedUsage, Read WriteMemRegion encapsulatedKey) const noexcept=0; SWS_CRYPT_50011

Calculate the maximum required size of the output buffer depending on the input size in the current state of the context.

virtual ara::core::Result< std::size_t > GetRequiredOutputBufferSize (AlgId algId) const noexcept;
SetKey function 2

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

Overloads SetKey 2
virtual ara::core::Result< void > SetKey (PublicKey::Sptr key) noexcept=0; SWS_CRYPT_21815
virtual ara::core::Result< void > SetKey (KeySlot::Sptr keySlot) noexcept=0; SWS_CRYPT_50012

Type aliases

Sptr type alias

Smart pointer of the interface.

Method documentation

function Encapsulate [SWS_CRYPT_21813] Upstream: RS_CRYPTO_02102, RS_CRYPTO_02108, RS_CRYPTO_02115

virtual ara::core::Result< std::size_t > Encapsulate (Symmetric Key::Sptr key, ReadWriteMemRegion encapsulatedKey) const noexcept=0;

Encapsulate the provided symmetric key.

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

The synchronous method Encapsulate encapsulates a passed symmetric key (key) and writes the result into the output buffer encapsulatedKey [SWS_CRYPT_21813]. Upon successful execution, it returns the byte size of the encapsulated key via ara::core::Result<std::size_t> [SWS_CRYPT_21813].

In case of an error, a corresponding error code with rollback semantics is returned [SWS_CRYPT_21813]. Relevant error causes are:

  • UninitializedContext: The context was not initialized with a public key value [SWS_CRYPT_21813].
  • ara::crypto::CryptoErrc::kUsageViolation: The encapsulation key lacks the usage flag kAllowKeyWrapping or the key to be encapsulated lacks kAllowSecuredExport [SWS_CRYPT_21813].
  • ara::crypto::CryptoErrc::kIncompatibleObject or CryptoErrc::kInvalidInputSize: The key object is incompatible or the key size is not supported by the context [SWS_CRYPT_21813].
  • CryptoErrc::kUnsupported: The context does not support encapsulating provided keys because it generates them itself during encapsulation [SWS_CRYPT_21813].
  • ara::crypto::CryptoErrc::kInsufficientCapacity: The buffer encapsulatedKey is dimensioned too small [SWS_CRYPT_21813].
  • ara::crypto::CryptoErrc::kBusyResource or ara::crypto::CryptoErrc::kEmptyKeySlot: A resource is busy or a configured KeySlot is empty [SWS_CRYPT_21813].

The operation is declared as const, noexcept and specified as thread-safe and exception safe [SWS_CRYPT_21813].

In interaction with the module, this function differs from the alternative overload [SWS_CRYPT_50011], which does not accept an existing key, but dynamically regenerates the symmetric key and returns it together with the encapsulation result [SWS_CRYPT_50011].

Automatically generated usage note based on AUTOSAR R25-11.

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

Parameter (in)

ParameterBeschreibung
keythe symmetric key to be encapsulated

Parameter (out)

ParameterBeschreibung
encapsulatedKeyan output buffer the encapsulated key is written to

Rückgabewert

TypBeschreibung
ara::core::Result<std::size_t >a result containing the size of the encapsulated key or an error

Fehler

FehlercodeBeschreibung
UninitializedContextif the context was not initialized by a public key value
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the encapsulation key does not include k AllowKeyWrapping or if the allowed usage of the encapsulated key does not include kAllowSecuredExport
ara::crypto::CryptoErrc::kIncompatibleObjectrollback_semantics if the provided encapsulated key object is incompatible with this context
CryptoErrc::kInvalidInputSizerollback_semantics if this context does not support the size of the encapsulated key
CryptoErrc::kUnsupportedrollback_semantics if this context does not support setting the encapsulated key, because it generates the key during encapsulation
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
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the key does not include kAllowKeyWrapping

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

Record
AUTOSAR/AP/record/SWS_CRYPT_21813
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_21813@rel:R25-11#b3c8ad10
Content hash
b3c8ad10
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_21813
Status: valid/unmigrated Version: rel:R25-11#5f08acc8 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_21813@rel:R25-11#5f08acc8
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#b3c8ad102026-09-30
  • R19-11rel:R19-11#5df6f2a12026-10-14
  • R20-11rel:R20-11#bc53d66f2026-10-14
  • R21-11rel:R21-11#a093fad52026-10-14
  • R22-11rel:R22-11#9a52ca012026-10-14
  • R23-11rel:R23-11#dadd77c62026-10-14
  • R24-11rel:R24-11#2cf84d842026-10-14
  • R25-11rel:R25-11#5f08acc82026-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 Encapsulate [SWS_CRYPT_50011] Upstream: RS_CRYPTO_02102, RS_CRYPTO_02108, RS_CRYPTO_02115

virtual ara::core::Result< std::pair< std::size_t, SymmetricKey::Sptr > > Encapsulate (AlgId algId, AllowedUsageFlags allowedUsage, Read WriteMemRegion encapsulatedKey) const noexcept=0;

Generate new a symmetric key and encapsulate it. Optionally store the generated key.

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

Usage and Semantics

The synchronous method Encapsulate internally generates a new symmetric key and encapsulates it using context [SWS_CRYPT_50011]. The target algorithm algId and the permitted usage flags allowedUsage for the generated key are specified as input parameters [SWS_CRYPT_50011]. The ciphertext of the key is written to the output buffer encapsulatedKey [SWS_CRYPT_50011]. Upon success, the return value encapsulates a pair consisting of the actual byte size of the encapsulated key and a smart pointer to the generated key object (std::pair<std::size_t, SymmetricKey::Sptr>) within a ara::core::Result [SWS_CRYPT_50011].

Error Handling and Safeguarding

In case of an error, the return values predominantly feature rollback semantics [SWS_CRYPT_50011]. Possible error causes include:

  • UninitializedContext: The context was not previously initialized with a public key [SWS_CRYPT_50011].
  • CryptoErrc::kUsageViolation: The encapsulation key lacks flag kAllowKeyWrapping or the target key lacks kAllowSecuredExport [SWS_CRYPT_50011].
  • CryptoErrc::kInsufficientCapacity: Output buffer encapsulatedKey does not provide sufficient capacity [SWS_CRYPT_50011].
  • CryptoErrc::kUnknownIdentifier or CryptoErrc::kUnsupported: The algId is unknown or generation during encapsulation is not supported [SWS_CRYPT_50011].
  • CryptoErrc::kEmptyKeySlot or CryptoErrc::kBusyResource: A configured KeySlot is empty or a required resource is busy [SWS_CRYPT_50011].

Concurrency and Interaction

The operation is specified as const, noexcept, thread-safe, and exception-safe [SWS_CRYPT_50011]. In comparison to overload [SWS_CRYPT_21813], to which an existing key is passed and which only returns its size, this method performs key generation and encapsulation in a joint step [SWS_CRYPT_50011].

This text was generated by an AI based on the specification.

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

Parameter (in)

ParameterBeschreibung
algIdthe identifier of the target symmetric crypto algorithm
allowedUsagethe flags that define a list of allowed transformations’ types in which the target key can be used

Parameter (out)

ParameterBeschreibung
encapsulatedKeyan output buffer the encapsulated key is written to

Rückgabewert

TypBeschreibung
ara::core::Result<std::pair< std::size_t, SymmetricKey::Sptr > >a result containing a pair of the size of the encapsulated key and the generated symmetric key or an error

Fehler

FehlercodeBeschreibung
UninitializedContextif the context was not initialized by a public key value
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the encapsulation key does not include k AllowKeyWrapping or if the allowed usage of the encapsulated key does not include kAllowSecuredExport
CryptoErrc::kInvalidInputSizerollback_semantics if this context does not support the size of the encapsulated key
CryptoErrc::kUnsupportedrollback_semantics if this context does not support generating the encapsulated key during encapsulation
ara::crypto::CryptoErrc::kUnknownIdentifierrollback_semantics if algId has an unsupported value
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 via SetKey that is currently is empty
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the key does not include kAllowKeyWrapping

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50011
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50011@rel:R25-11#7f7fdb0c
Content hash
7f7fdb0c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50011
Status: valid/unmigrated Version: rel:R25-11#7f7fdb0c 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_50011@rel:R25-11#7f7fdb0c
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 GetRequiredOutputBufferSize [SWS_CRYPT_50013] Upstream: RS_CRYPTO_02302

virtual ara::core::Result< std::size_t > GetRequiredOutputBufferSize (AlgId algId) const noexcept;

Calculate the maximum required size of the output buffer depending on the input size in the current state of the context.

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

Parameter (in)

ParameterBeschreibung
algIdthe algId of the key to encapsulate

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_50013
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50013@rel:R25-11#8834a17a
Content hash
8834a17a
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50013
Status: valid/unmigrated Version: rel:R25-11#8834a17a 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_50013@rel:R25-11#8834a17a
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_21815] Upstream: RS_CRYPTO_02001, RS_CRYPTO_02003

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

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

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

use

The method SetKey configures the instance of ara::crypto::cryp::KeyEncapsulatorPublicCtx such that the passed key object is used as an encapsulation key [SWS_CRYPT_21815]. Parameter key of type PublicKey::Sptr serves as parameter [SWS_CRYPT_21815]. The call is synchronous and returns a ara::core::Result<void> as the return value, which is empty in case of success or carries an error code [SWS_CRYPT_21815].

Error handling

In case of error, all reported error codes possess rollback semantics [SWS_CRYPT_21815]:

  • ara::crypto::CryptoErrc::kIncompatibleObject: The provided key object is incompatible with the context [SWS_CRYPT_21815].
  • ara::crypto::CryptoErrc::kUsageViolation: The permitted usage of the key does not include the flag kAllowKeyWrapping [SWS_CRYPT_21815].
  • ara::crypto::CryptoErrc::kUnsupported: The context exclusively supports setting a key via a KeySlot [SWS_CRYPT_21815].

Concurrency and Limitations

The function is specified as thread-safe and exception safe with noexcept guarantee [SWS_CRYPT_21815].

Interaction

Configuring the key prepares the context for key encapsulation, which is performed via the Encapsulate method [SWS_CRYPT_50011]. If the context does not support direct key assignment or if the key is to be obtained from a memory area, the overload of SetKey with a KeySlot::Sptr is available as an alternative [SWS_CRYPT_50012].

This usage note was generated by an AI and is based on the specifications of release R25-11.

Implementer's Guide to follow (complexity I2)

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

Parameter (in)

ParameterBeschreibung
keythe key encapsulation key

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 context
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the key does not include kAllowKeyWrapping
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_21815
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_21815@rel:R25-11#97afebd2
Content hash
97afebd2
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_21815
Status: valid/unmigrated Version: rel:R25-11#135664c1 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_21815@rel:R25-11#135664c1
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#97afebd22026-09-30
  • R20-11rel:R20-11#3e034d832026-10-14
  • R21-11rel:R21-11#14e868c82026-10-14
  • R22-11rel:R22-11#c056496f2026-10-14
  • R23-11rel:R23-11#4a9295802026-10-14
  • R24-11rel:R24-11#6638cae22026-10-14
  • R25-11rel:R25-11#135664c12026-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_50012] 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 encapsulation is performed.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: c951ff682a31 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The method SetKey of class ara::crypto::cryp::KeyEncapsulatorPublicCtx configures the context such that the public key stored in a passed key slot (KeySlot) is used at the time of key encapsulation [SWS_CRYPT_50012].

use

The call is made synchronously and is specified as noexcept and exception safe [SWS_CRYPT_50012]. Parameter keySlot of type KeySlot::Sptr serves as the input, which must contain a public key [SWS_CRYPT_50012]. The return value is a ara::core::Result<void>, which contains no value in case of success [SWS_CRYPT_50012].

Error handling

In the event of an error, an error code with rollback semantics is returned [SWS_CRYPT_50012]:

  • ara::crypto::CryptoErrc::kIncompatibleObject: The passed keySlot is incompatible with this context [SWS_CRYPT_50012].
  • ara::crypto::CryptoErrc::kUnsupported: The context only supports setting a PublicKey object [SWS_CRYPT_50012].

Concurrency and Interaction

The function is defined as thread-safe [SWS_CRYPT_50012]. Besides assignment via a key slot, an alternative overload exists for direct passing of a PublicKey::Sptr [SWS_CRYPT_21815]. The configured key is used as soon as key encapsulation is performed via Encapsulate [SWS_CRYPT_50011]. Regarding sequencing, SetKey presumably must be executed before calling Encapsulate so that the context is initialized. Question Q-769923d4fb9a3d1e (open)

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/key_encapsulator_public_ctx.h"
Scopeclass ara::crypto::cryp::KeyEncapsulatorPublicCtx
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
keySlota keyslot containing a public 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 PublicKey

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50012
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50012@rel:R25-11#b5e332fa
Content hash
b5e332fa
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50012
Status: valid/unmigrated Version: rel:R25-11#b5e332fa 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_50012@rel:R25-11#b5e332fa
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

Type alias documentation

type alias Sptr [SWS_CRYPT_21801] Upstream: RS_CRYPTO_02209

using Sptr = std::shared_ptr<KeyEncapsulatorPublicCtx>;

Smart pointer of the interface.

Header-Datei#include "ara/crypto/cryp/key_encapsulator_public_ctx.h"
Scopeclass ara::crypto::cryp::KeyEncapsulatorPublicCtx
SymbolSptr

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

Record
AUTOSAR/AP/record/SWS_CRYPT_21801
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_21801@rel:R25-11#d5df06eb
Content hash
d5df06eb
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_21801
Status: valid/unmigrated Version: rel:R25-11#6c7506e9 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_21801@rel:R25-11#6c7506e9
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#d5df06eb2026-09-30
  • R19-11rel:R19-11#3a23dd282026-10-14
  • R20-11rel:R20-11#b2bfbd8b2026-10-14
  • R21-11rel:R21-11#b2bfbd8b2026-10-14
  • R22-11rel:R22-11#1b749d9b2026-10-14
  • R23-11rel:R23-11#7bb57d5b2026-10-14
  • R24-11rel:R24-11#7bb57d5b2026-10-14
  • R25-11rel:R25-11#6c7506e92026-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