DEENESPTFRRUARHIKOZHNL

classe 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

Guia do utilizadorGERADO POR IA

Encapsula chaves simétricas assimetricamente por meio de chaves públicas ou as gera no processo de encapsulamento.
GERADO POR IA não revisado Modelo: gemini-3.8-flash-medium · Esforço: medium · Temperatura: não controlável · Prompt: f00bc8643d8f Procedência Perguntas em aberto (2)
traduzido do guia alemãogemini-3.8-flash-low · 2026-10-13 · Original em alemão

Encapsula chaves simétricas assimetricamente por meio de chaves públicas ou as gera no processo de encapsulamento.

A interface ara::crypto::cryp::KeyEncapsulatorPublicCtx permite mecanismos de encapsulamento assimétrico de chave (KEM) para empacotar chaves simétricas para troca segura ou gerá-las novamente durante o encapsulamento ([SWS_CRYPT_50011]). Antes da execução, o contexto deve ser inicializado via SetKey com uma chave pública ou slot, e o tamanho de buffer de saída necessário deve ser determinado ([SWS_CRYPT_21815]). Condições de contorno essenciais são as flags de uso de chave necessárias, como kAllowKeyWrapping, bem como a total segurança de threads de todas as operações.

Contexto

A interface ara::crypto::cryp::KeyEncapsulatorPublicCtx define o contexto assimétrico para Key Encapsulation Mechanisms (KEM) utilizando uma chave pública. Na arquitetura de criptografia da AUTOSAR Adaptive, a classe serve para a troca e o transporte seguros de chaves. Ela recebe uma chave assimétrica pública para encapsular uma chave simétrica existente ([SWS_CRYPT_21813]) ou gerar e fornecer uma nova chave simétrica no decurso do encapsulamento ([SWS_CRYPT_50011]). A base de chaves pode ser vinculada como um objeto de chave direto PublicKey ([SWS_CRYPT_21815]) ou por meio de um slot persistido 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

Diagrama de contexto: integração do KeyEncapsulatorPublicCtx entre aplicação, fontes de chave e chaves de destino. Fontes: [SWS_CRYPT_21813], [SWS_CRYPT_21815], [SWS_CRYPT_50011], [SWS_CRYPT_50012]

Ciclo de vida

Instâncias de KeyEncapsulatorPublicCtx são gerenciadas por meio do smart pointer tipado KeyEncapsulatorPublicCtx::Sptr, que está definido como std::shared_ptr<KeyEncapsulatorPublicCtx> ([SWS_CRYPT_21801]). A criação efetiva do objeto provavelmente ocorre por meio de uma factory de provedor subordinada da plataforma, uma vez que a classe representa uma interface puramente virtual. Pergunta Q-3551020e7b9c0f0c (aberta)

Após a criação, o contexto se encontra no estado de inicialização incompleta. Enquanto nenhuma chave pública for atribuída ao contexto, as chamadas para cálculo de tamanho de buffer ([SWS_CRYPT_50013]) e as operações de encapsulamento ([SWS_CRYPT_21813], [SWS_CRYPT_50011]) falham com o erro CryptoErrc::kUninitializedContext. A prontidão operacional é estabelecida pela configuração via SetKey com PublicKey::Sptr ([SWS_CRYPT_21815]) ou KeySlot::Sptr ([SWS_CRYPT_50012]). Na atribuição de um KeySlot, a chave pública contida provavelmente só é lida dinamicamente no momento da execução efetiva do encapsulamento. Pergunta Q-ea760070f05941d2 (aberta) Todos os métodos do contexto são thread-safe conforme a especificação e garantem segurança contra exceções ([SWS_CRYPT_21813], [SWS_CRYPT_50011], [SWS_CRYPT_50013], [SWS_CRYPT_21815], [SWS_CRYPT_50012]).

Caminho de utilização

A aplicação prática do contexto segue uma ordem definida de vinculação de chave, dimensionamento de buffer e execução do encapsulamento:

  • Vinculação de chave: a aplicação inicializa o contexto via SetKey com um PublicKey carregado ([SWS_CRYPT_21815]) ou com um KeySlot ([SWS_CRYPT_50012]).
  • Dimensionamento de buffer: antes de disponibilizar o buffer de saída, a aplicação determina o tamanho máximo de saída necessário em bytes por meio de GetRequiredOutputBufferSize(algId) ([SWS_CRYPT_50013]) para o algoritmo simétrico de destino pretendido e reserva uma ReadWriteMemRegion correspondente.
  • Execução do encapsulamento: dependendo da finalidade de uso, a aplicação escolhe uma das duas variantes de encapsulamento:
    • Disponibilização de uma chave existente: Encapsulate(key, encapsulatedKey) encapsula o SymmetricKey fornecido e retorna a quantidade de bytes gravados ([SWS_CRYPT_21813]).
    • Geração autônoma: Encapsulate(algId, allowedUsage, encapsulatedKey) gera uma nova chave simétrica de acordo com as flags de uso exigidas e retorna um par composto pelo tamanho em bytes e pelo novo SymmetricKey::Sptr ([SWS_CRYPT_50011]).
Sequência do encapsulamento de chavesAplicaçãoKeyEncapsulatorPublicCtxUse Case: Configuração da chave de encapsulamentoSetKey(key / keySlot)Result<void>Use Case: Verificação do tamanho do bufferGetRequiredOutputBufferSize(algId)Result<std::size_t>Use Case: KapselungaltChave existenteEncapsulate(key, memRegion)Result<std::size_t>Nova chave é geradaEncapsulate(algId, usage, memRegion)Result<std::pair<std::size_t, SymmetricKey::Sptr>>

Diagrama de sequência: sequência de chamadas típica, desde a atribuição da chave e o cálculo do buffer até o encapsulamento da chave. Fontes: [SWS_CRYPT_21813], [SWS_CRYPT_21815], [SWS_CRYPT_50011], [SWS_CRYPT_50013]

Cenários de erro

Métodos de KeyEncapsulatorPublicCtx reportam erros por meio de ara::core::Result com valores de ara::crypto::CryptoErrc e garantem semântica de rollback em caso de falha. Situações de erro essenciais incluem:

  • CryptoErrc::kUninitializedContext: ocorre quando GetRequiredOutputBufferSize ([SWS_CRYPT_50013]) ou Encapsulate ([SWS_CRYPT_21813], [SWS_CRYPT_50011]) é chamado sem configuração bem-sucedida prévia mediante SetKey.
  • CryptoErrc::kUsageViolation: sinaliza usos inadmissíveis de chave. Isso ocorre quando falta a flag kAllowKeyWrapping à chave de encapsulamento ([SWS_CRYPT_21815], [SWS_CRYPT_21813], [SWS_CRYPT_50011]) ou quando a chave simétrica a ser encapsulada não está liberada para exportação protegida via kAllowSecuredExport ([SWS_CRYPT_21813]).
  • CryptoErrc::kIncompatibleObject: indica que uma chave ou slot fornecido não é compatível com o algoritmo do contexto ([SWS_CRYPT_21815], [SWS_CRYPT_50012], [SWS_CRYPT_21813]).
  • CryptoErrc::kInsufficientCapacity e CryptoErrc::kInvalidInputSize: são acionados caso a ReadWriteMemRegion fornecida não possua a capacidade de buffer necessária ou o tamanho de entrada da chave não seja suportado ([SWS_CRYPT_21813], [SWS_CRYPT_50011]).
  • CryptoErrc::kEmptyKeySlot e CryptoErrc::kBusyResource: surgem quando um KeySlot vinculado via SetKey está vazio no momento da execução do encapsulamento ou quando um recurso de hardware envolvido está ocupado ([SWS_CRYPT_21813], [SWS_CRYPT_50011]).
  • CryptoErrc::kUnsupported: é retornado quando a implementação do contexto suporta exclusivamente objetos de chave em vez de slots ([SWS_CRYPT_50012]) ou vice-versa ([SWS_CRYPT_21815]), ou se a definição de chaves externas ou a geração autônoma de chaves não for suportada no contexto ([SWS_CRYPT_21813], [SWS_CRYPT_50011]).

Este guia baseia-se exclusivamente nas especificações da AUTOSAR Adaptive Platform Release R25-11.

Mapa de membros

Diagrama de classes

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

Vista de detalhes

Selecione uma entrada no índice.

Métodos

Encapsulate função 2

Encapsulate the provided symmetric key.

Sobrecargas 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 função 2

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

Sobrecargas 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

Aliases de tipo

Sptr alias de tipo

Smart pointer of the interface.

Documentação dos métodos

função 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.

GERADO POR IA não revisado Modelo: gemini-3.8-flash-medium · Esforço: medium · Temperatura: não controlável · Prompt: 998c7d355307 Procedência
traduzido do guia alemãogemini-3.8-flash-low · 2026-10-13 · Original em alemão

O método síncrono Encapsulate encapsula uma chave simétrica fornecida (key) e escreve o resultado no buffer de saída encapsulatedKey [SWS_CRYPT_21813]. Em caso de execução bem-sucedida, retorna através de ara::core::Result<std::size_t> o tamanho em bytes da chave encapsulada [SWS_CRYPT_21813].

Em caso de erro, é retornado um código de erro correspondente com semântica de rollback [SWS_CRYPT_21813]. As causas de erro relevantes são:

  • UninitializedContext: O contexto não foi inicializado com um valor de chave pública [SWS_CRYPT_21813].
  • ara::crypto::CryptoErrc::kUsageViolation: Falta a flag de uso kAllowKeyWrapping na chave de encapsulamento ou falta kAllowSecuredExport na chave a ser encapsulada [SWS_CRYPT_21813].
  • ara::crypto::CryptoErrc::kIncompatibleObject ou CryptoErrc::kInvalidInputSize: O objeto de chave é incompatível ou o tamanho da chave não é suportado pelo contexto [SWS_CRYPT_21813].
  • CryptoErrc::kUnsupported: O contexto não suporta o encapsulamento de chaves fornecidas porque ele mesmo as gera durante o encapsulamento [SWS_CRYPT_21813].
  • ara::crypto::CryptoErrc::kInsufficientCapacity: O buffer encapsulatedKey está dimensionado pequeno demais [SWS_CRYPT_21813].
  • ara::crypto::CryptoErrc::kBusyResource ou ara::crypto::CryptoErrc::kEmptyKeySlot: Um recurso está ocupado ou um KeySlot configurado está vazio [SWS_CRYPT_21813].

A operação é declarada como const, noexcept e especificada como thread-safe e exception safe [SWS_CRYPT_21813].

Na interação com o módulo, esta função difere da sobrecarga alternativa [SWS_CRYPT_50011], que não recebe uma chave existente, mas gera dinamicamente uma nova chave simétrica e a retorna juntamente com o resultado do encapsulamento [SWS_CRYPT_50011].

Nota de uso gerada automaticamente com base no 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#09f02e90
Content hash
09f02e90
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

função 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.

GERADO POR IA não revisado Modelo: gemini-3.8-flash-medium · Esforço: medium · Temperatura: não controlável · Prompt: 68e8fc3273e7 Procedência
traduzido do guia alemãogemini-3.8-flash-low · 2026-10-13 · Original em alemão

Utilização e semântica

O método síncrono Encapsulate gera internamente uma nova chave simétrica e a encapsula utilizando o contexto [SWS_CRYPT_50011]. Como parâmetros de entrada, são especificados o algoritmo de destino algId bem como as flags de uso permitidas allowedUsage para a chave gerada [SWS_CRYPT_50011]. O criptograma da chave é gravado no buffer de saída encapsulatedKey [SWS_CRYPT_50011]. Em caso de sucesso, o valor de retorno encapsula um par composto pelo tamanho real em bytes da chave encapsulada e um smart pointer para o objeto de chave gerado (std::pair<std::size_t, SymmetricKey::Sptr>) dentro de um ara::core::Result [SWS_CRYPT_50011].

Tratamento de erros e proteção

Em caso de erro, os valores de retorno possuem predominantemente semântica de rollback [SWS_CRYPT_50011]. As possíveis causas de erro incluem:

  • UninitializedContext: o contexto não foi inicializado previamente com uma chave pública [SWS_CRYPT_50011].
  • CryptoErrc::kUsageViolation: falta à chave de encapsulamento a flag kAllowKeyWrapping ou falta à chave de destino kAllowSecuredExport [SWS_CRYPT_50011].
  • CryptoErrc::kInsufficientCapacity: o buffer de saída encapsulatedKey não oferece capacidade suficiente [SWS_CRYPT_50011].
  • CryptoErrc::kUnknownIdentifier ou CryptoErrc::kUnsupported: a algId é desconhecida ou a geração durante o encapsulamento não é suportada [SWS_CRYPT_50011].
  • CryptoErrc::kEmptyKeySlot ou CryptoErrc::kBusyResource: um KeySlot configurado está vazio ou um recurso necessário está ocupado [SWS_CRYPT_50011].

Concorrência e interação

A operação é especificada como const, noexcept, thread-safe bem como exception-safe [SWS_CRYPT_50011]. Em comparação com a sobrecarga [SWS_CRYPT_21813], à qual é passada uma chave existente e que retorna apenas o seu tamanho, este método executa a geração e o encapsulamento da chave em uma etapa conjunta [SWS_CRYPT_50011].

Este texto foi gerado por uma IA com base na especificação.

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#9148effb
Content hash
9148effb
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

função 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#1f230f43
Content hash
1f230f43
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

função 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.

GERADO POR IA não revisado Modelo: gemini-3.8-flash-medium · Esforço: medium · Temperatura: não controlável · Prompt: 4803853a1afa Procedência
traduzido do guia alemãogemini-3.8-flash-low · 2026-10-13 · Original em alemão

usar

O método SetKey configura a instância de ara::crypto::cryp::KeyEncapsulatorPublicCtx de modo que o objeto de chave passado seja utilizado como chave de encapsulamento [SWS_CRYPT_21815]. Como parâmetro serve key do tipo PublicKey::Sptr [SWS_CRYPT_21815]. A chamada ocorre de forma síncrona e fornece como valor de retorno um ara::core::Result<void>, que está vazio em caso de sucesso ou transporta um código de erro [SWS_CRYPT_21815].

Tratamento de erros

Em caso de erro, todos os códigos de erro reportados possuem semântica de rollback [SWS_CRYPT_21815]:

  • ara::crypto::CryptoErrc::kIncompatibleObject: O objeto de chave fornecido é incompatível com o contexto [SWS_CRYPT_21815].
  • ara::crypto::CryptoErrc::kUsageViolation: O uso permitido da chave não contém a flag kAllowKeyWrapping [SWS_CRYPT_21815].
  • ara::crypto::CryptoErrc::kUnsupported: O contexto suporta exclusivamente a definição de uma chave por meio de um KeySlot [SWS_CRYPT_21815].

Simultaneidade e restrições

A função está especificada como thread-safe e exception safe com garantia noexcept [SWS_CRYPT_21815].

Interação

Por meio da configuração da chave, o contexto é preparado para o encapsulamento de chave, que é executado através do método Encapsulate [SWS_CRYPT_50011]. Se o contexto não suportar a atribuição direta de chave ou se a chave tiver de ser obtida de uma área de armazenamento, a sobrecarga de SetKey com um KeySlot::Sptr está disponível como alternativa [SWS_CRYPT_50012].

Esta nota de uso foi gerada por uma IA e baseia-se nas especificações do release R25-11.

Guia do implementador em breve (complexidade 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#1f578c38
Content hash
1f578c38
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

função 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.

GERADO POR IA não revisado Modelo: gemini-3.8-flash-medium · Esforço: medium · Temperatura: não controlável · Prompt: c951ff682a31 Procedência Perguntas em aberto (1)
traduzido do guia alemãogemini-3.8-flash-low · 2026-10-13 · Original em alemão

O método SetKey da classe ara::crypto::cryp::KeyEncapsulatorPublicCtx configura o contexto de forma que a chave pública armazenada em um slot de chave transmitido (KeySlot) seja utilizada no momento do encapsulamento da chave [SWS_CRYPT_50012].

usar

A chamada ocorre de forma síncrona e está especificada como noexcept, bem como exception safe [SWS_CRYPT_50012]. Como parâmetro, serve keySlot do tipo KeySlot::Sptr, o qual deve conter uma chave pública [SWS_CRYPT_50012]. O valor de retorno é um ara::core::Result<void>, que não contém valor em caso de sucesso [SWS_CRYPT_50012].

Tratamento de erros

Em caso de erro, é retornado um código de erro com semântica de rollback [SWS_CRYPT_50012]:

  • ara::crypto::CryptoErrc::kIncompatibleObject: o keySlot fornecido é incompatível com este contexto [SWS_CRYPT_50012].
  • ara::crypto::CryptoErrc::kUnsupported: O contexto suporta exclusivamente a definição de um objeto PublicKey [SWS_CRYPT_50012].

Concorrência e interação

A função está definida como thread-safe [SWS_CRYPT_50012]. Além da atribuição por meio de um slot de chave, existe uma sobrecarga alternativa para a transferência direta de um PublicKey::Sptr [SWS_CRYPT_21815]. A chave configurada é empregada assim que o encapsulamento de chave for executado via Encapsulate [SWS_CRYPT_50011]. Em relação à ordem, SetKey presumivelmente deve ser executado antes da chamada de Encapsulate para que o contexto esteja inicializado. Pergunta Q-769923d4fb9a3d1e (aberta)

Esta nota de uso foi gerada automaticamente com base na especificação do AUTOSAR Adaptive R25-11.

Guia do implementador em breve (complexidade 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#009f90cf
Content hash
009f90cf
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

Documentação dos aliases de tipo

alias de tipo 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#06a39f4e
Content hash
06a39f4e
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