DEENESPTFRRUARHIKOZHNL

类 ara::crypto::cryp::ProtectedKeyImportCtx

[SWS_CRYPT_50084] Upstream: RS_CRYPTO_02105

class ProtectedKeyImportCtx :            public CryptoContext {...};

A contexts for importing secured data such as secret key-material.

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

用户指南人工智能生成

用于在应用程序中安全解包和导入受保护的加密密钥与数据。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: a42cd9e6f52b 来源 未决问题(2)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用于在应用程序中安全解包和导入受保护的加密密钥与数据。

该接口支持使用配置的传输密钥 [SWS_CRYPT_50205] 安全解包和导入受保护的加密数据与密钥。解包后的密钥材料既可以直接写入持久性密钥槽,也可以作为密钥对象以类型化方式加载到内存中 [SWS_CRYPT_50207]。所有方法均以线程安全方式工作,并遵循严格的回滚错误语义,而 Reset 则确保无残留地清除内部缓冲区 [SWS_CRYPT_50212]。

上下文

接口 ara::crypto::cryp::ProtectedKeyImportCtx 提供了一个加密上下文,以便将受保护的数据结构(如机密密钥材料)安全地导入和解包到系统中。该上下文充当请求应用程序、基于传输密钥的保护机制与 AUTOSAR 加密的目标结构之间的中介。传入的序列化数据包由该上下文进行身份验证、解密和解析 [SWS_CRYPT_50207]。所需的传输密钥的来源可以是独立的对称密钥对象 [SWS_CRYPT_50205],也可以是密钥存储的密钥槽 [SWS_CRYPT_50206]。作为接收端,解包后的密钥对象可以直接传递给调用应用程序,也可以直接序列化到可写的密钥槽中 [SWS_CRYPT_50207]。

生命周期

通常通过提供的智能指针类型 Sptr 来管理上下文以进行共享访问 [SWS_CRYPT_50085];此时实例预计由负责的加密驱动组件提供。 问题 Q-3517b24b5eec4529 (未决)在实际处理之前,上下文处于未配置的初始状态,其中尚未分配传输密钥。通过方法 SetKey 分配传输密钥,从而使上下文转入就绪状态 [SWS_CRYPT_50205] [SWS_CRYPT_50206]。

在成功执行操作 Import 后,上下文将解包后的数据和元数据保留在内部缓冲区中,从而可以识别对象类型并读取密钥对象 [SWS_CRYPT_50207] [SWS_CRYPT_50208]。通过方法 Reset,上下文恢复为其初始状态:完全清除包含先前导入数据的所有内部缓冲区,并移除存储的传输密钥 [SWS_CRYPT_50212]。所有接口方法均被指定为异常安全且线程安全的,从而使来自多个执行上下文的并发访问保持可控 [SWS_CRYPT_50207]。

ProtectedKeyImportCtxStates Start Uninitialized 初始 / 复位 (无传输密钥) Start->Uninitialized KeyConfigured 已配置传输密钥 Uninitialized->KeyConfigured SetKey() KeyConfigured->Uninitialized Reset() KeyConfigured->KeyConfigured SetKey() DataImported Daten importiert (Ergebnisse abrufbar) KeyConfigured->DataImported Import() DataImported->Uninitialized Reset() DataImported->DataImported Import()

状态图:上下文从配置、导入到清理的生命周期阶段。来源:[SWS_CRYPT_50205]、[SWS_CRYPT_50206]、[SWS_CRYPT_50207]、[SWS_CRYPT_50212]

使用路径

常规工作流程始于传输密钥的配置。为此,应用程序使用 SymmetricKey::Sptr [SWS_CRYPT_50205] 或 KeySlot::Sptr [SWS_CRYPT_50206] 调用 SetKey。在下一步中,执行方法 Import,序列化数据包作为 ReadOnlyMemRegion 传递给该方法 [SWS_CRYPT_50207]。如果密钥需要持久存储,则可以选择直接传递一个 WriteableKeySlot::Sptr,解包后的材料将写入其中 [SWS_CRYPT_50207]。

如果未指定目标槽或密钥需要临时使用,应用程序通过 GetCryptoObjectType 确定最后导入对象的类别 [SWS_CRYPT_50208]。根据该类型,应用程序调用类型对应的检索方法:对于私钥调用 GetPrivateKey [SWS_CRYPT_50209],对于公钥调用 GetPublicKey [SWS_CRYPT_50211],或者对于对称密钥材料调用 GetSymmetricKey [SWS_CRYPT_50210]。如果所使用的导入协议需要向发送方反馈——例如在 SHE-LoadKey 序列的控制块 M4 和 M5 中——则可以通过 GetResponse 将其写入提供的缓冲区中 [SWS_CRYPT_41020]。处理序列完成后,调用 Reset 将上下文重新恢复为初始状态 [SWS_CRYPT_50212]。

导入和检索密钥材料时的流程应用ProtectedKeyImportCtxWriteableKeySlotSetKey(key)Result<void>Import(serialized, keySlot)opt已传递 keySlot直接序列化密钥材料Result<void>GetCryptoObjectType()Result<CryptoObjectType>GetSymmetricKey()Result<SymmetricKey::Sptr>Reset()Result<void>

时序图:导入和读取密钥材料时的典型调用顺序。来源:[SWS_CRYPT_50205]、[SWS_CRYPT_50207]、[SWS_CRYPT_50208]、[SWS_CRYPT_50210]、[SWS_CRYPT_50212]

错误场景

如果方法调用期间发生错误,则严格的回滚语义生效,从而保留调用前的状态。通过 SetKey 进行配置时,如果密钥的使用标志不包含权限 kAllowKeyUnwrapping,则调用失败并返回 CryptoErrc::kUsageViolation [SWS_CRYPT_50205] [SWS_CRYPT_50206]。如果密钥对象或引用的槽原则上不能用作传输密钥,则报告 CryptoErrc::kIncompatibleObject [SWS_CRYPT_50205] [SWS_CRYPT_50206]。

调用 Import 时,输入数据的大小偏差会导致 CryptoErrc::kInvalidInputSize,而格式违规会导致 CryptoErrc::kInvalidArgument [SWS_CRYPT_50207]。如果保护层的完整性或真实性检查失败(例如由于无效的消息认证码或错误的签名),则调用返回 CryptoErrc::kAuthTagNotValid [SWS_CRYPT_50207]。如果加密组件暂时繁忙,则通过 CryptoErrc::kBusyResource 进行指示 [SWS_CRYPT_50207]。

读取导入密钥的前提条件是成功执行 Import;否则 GetPrivateKey、GetPublicKey 和 GetSymmetricKey 将以 CryptoErrc::kProcessingNotFinished 响应 [SWS_CRYPT_50209] [SWS_CRYPT_50210] [SWS_CRYPT_50211]。如果请求的密钥类型与实际解包的对象不匹配,或者尚未导入任何对象,检索方法将以 CryptoErrc::kNoSuchValue 予以确认 [SWS_CRYPT_50208] [SWS_CRYPT_50209] [SWS_CRYPT_50210] [SWS_CRYPT_50211]。如果执行 GetResponse 时输出缓冲区容量不足,将导致 CryptoErrc::kInsufficientCapacity [SWS_CRYPT_41020]。如果具体实现不支持某项子功能(例如特定密钥类型或重置),则统一返回 CryptoErrc::kUnsupported [SWS_CRYPT_50205] [SWS_CRYPT_50208] [SWS_CRYPT_50212]。

本类指南基于 AUTOSAR Adaptive Platform Release R25-11 规范。

成员图

类图

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

G nara__crypto__cryp__ProtectedKeyImportCtx279 ProtectedKeyImportCtx + GetCryptoObjectType() + GetPrivateKey() + GetPublicKey() + GetResponse() + GetSymmetricKey() + Import() + Reset() + SetKey() nara__crypto__cryp__CryptoContext85 CryptoContext nara__crypto__cryp__ProtectedKeyImportCtx279->nara__crypto__cryp__CryptoContext85

详细视图

请在大纲中选择一个条目。

方法

The interface shall return the type of the last successfully unwrapped CryptoObject.

virtual ara::core::Result< CryptoObjectType > GetCryptoObjectType () const noexcept=0;

The interface shall return a shared pointer to the unwrapped PrivateKey.

virtual ara::core::Result< PrivateKey::Sptr > GetPrivateKey () const noexcept=0;

The interface shall return a shared pointer to the unwrapped PublicKey.

virtual ara::core::Result< PublicKey::Sptr > GetPublicKey () const noexcept=0;

The interface shall write the response of the CryptoProvider to the last invocation of Import into the provided output buffer. E.g., this interface could return M4/M5 of a SHE LoadKey operation.

virtual ara::core::Result< std::size_t > GetResponse (ReadWriteMem Region responseBuffer) const noexcept=0; DIRECTION NOT responseBuffer -- DEFINED

The interface shall return a shared pointer to the unwrapped SymmetricKey.

virtual ara::core::Result< SymmetricKey::Sptr > GetSymmetricKey () const noexcept=0;
Import 函数

The interface shall unwrap the protected data provided, parse the content, and make the parsed content (key-material and meta-data) available for retrieval by the application. If optionally a Key Slot is specified, the unwrapped key material shall be directly serialized into the KeySlot.

virtual ara::core::Result< void > Import (ReadOnlyMemRegion serialized, ara::core::Optional< WriteableKeySlot::Sptr > keySlot) noexcept=0;
Reset 函数

The interface shall restore the context to its initial state by ensuring that no key-import-key is set and all previously imported data is deleted from the ProtectedKeyImportCtx’s internal buffers.

virtual ara::core::Result< void > Reset () const noexcept=0;
SetKey 函数 2

The interface shall configure the context to use the provided symmetric key as transport key.

重载 SetKey 2
virtual ara::core::Result< void > SetKey (SymmetricKey::Sptr key) noexcept=0; SWS_CRYPT_50205
virtual ara::core::Result< void > SetKey (KeySlot::Sptr keySlot) noexcept=0; SWS_CRYPT_50206

类型别名

Sptr 类型别名

Smart pointer of the interface.

方法文档

函数 GetCryptoObjectType [SWS_CRYPT_50208] Upstream: RS_CRYPTO_02105

virtual ara::core::Result< CryptoObjectType > GetCryptoObjectType () const noexcept=0;

The interface shall return the type of the last successfully unwrapped CryptoObject.

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

Rückgabewert

TypBeschreibung
ara::core::Result< CryptoObjectType >the CryptoObjectType of the last unwrapped CryptoObject

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context does not support identifying imported objects
ara::crypto::CryptoErrc::kNoSuchValuerollback_semantics if no CryptoObject has been imported yet

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

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

函数 GetPrivateKey [SWS_CRYPT_50209] Upstream: RS_CRYPTO_02105

virtual ara::core::Result< PrivateKey::Sptr > GetPrivateKey () const noexcept=0;

The interface shall return a shared pointer to the unwrapped PrivateKey.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 569ddfa8ee2a 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::crypto::cryp::ProtectedKeyImportCtx 的方法 GetPrivateKey(通过头文件 #include "ara/crypto/cryp/protected_key_import_ctx.h" 提供)用于检索指向先前导入并解包的私钥(PrivateKey::Sptr)的共享指针([SWS_CRYPT_50209])。该接口没有传入参数,并以同步方式将结果作为 ara::core::Result<PrivateKey::Sptr> 返回([SWS_CRYPT_50209])。

执行适用关于顺序、并发和异常安全性的约束性规定:该方法被指定为 thread-safe 以及 exception safe,并声明为 noexcept([SWS_CRYPT_50209])。成功检索的必要前提条件是此前在上下文中已成功执行导入操作([SWS_CRYPT_50209])。

若在提供时发生错误,则对所有错误情况均适用回滚语义([SWS_CRYPT_50209])。在此情况下,返回的 Result 包含以下特定错误代码之一:

  • ara::crypto::CryptoErrc::kProcessingNotFinished:先前的导入步骤尚未成功执行([SWS_CRYPT_50209])。
  • ara::crypto::CryptoErrc::kNoSuchValue:最近导入的 CryptoObject 不是私钥([SWS_CRYPT_50209])。
  • ara::crypto::CryptoErrc::kUnsupported:该上下文原则上不支持私钥导入([SWS_CRYPT_50209])。

本使用说明由 AI 基于 AUTOSAR 规范 R25-11 编写。

实现者指南即将推出(复杂度 I1)

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

Rückgabewert

TypBeschreibung
ara::core::Result<PrivateKey::Sptr >a PrivateKey shared pointer

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context does not support importing private keys
ara::crypto::CryptoErrc::kNoSuchValuerollback_semantics if the last imported CryptoObject is not a PrivateKey
ara::crypto::CryptoErrc::kProcessingNotFinishedrollback_semantics if Import has not been executed successfully before

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

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

函数 GetPublicKey [SWS_CRYPT_50211] Upstream: RS_CRYPTO_02105

virtual ara::core::Result< PublicKey::Sptr > GetPublicKey () const noexcept=0;

The interface shall return a shared pointer to the unwrapped PublicKey.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: b41e5e96382c 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::crypto::cryp::ProtectedKeyImportCtx 的方法 GetPublicKey 用于同步检索指向先前导入并解包的公钥([SWS_CRYPT_50211])的指针。该函数不接收传入参数,并以类型安全的方式将结果作为 ara::core::Result<PublicKey::Sptr> 返回([SWS_CRYPT_50211])。

在调用之前必须已成功完成导入操作;否则调用将失败并返回错误码 ara::crypto::CryptoErrc::kProcessingNotFinished([SWS_CRYPT_50211])。如果最近导入的加密对象不是公钥,则会导致错误 ara::crypto::CryptoErrc::kNoSuchValue([SWS_CRYPT_50211])。如果具体的导入上下文根本不支持引入公钥,则会报告 ara::crypto::CryptoErrc::kUnsupported([SWS_CRYPT_50211])。对于所有指定的错误,该接口均保证回滚语义([SWS_CRYPT_50211])。

关于并发性和故障安全性,该方法被指定为线程安全且异常安全,并且不引发 C++ 异常(noexcept)([SWS_CRYPT_50211])。

在功能上,该导入机制区别于其他接口:在此处是对受保护对象进行解包,而 ara::crypto::cryp::PrivateKey([SWS_CRYPT_22511])上同名函数则提供现有私钥的公钥,该私钥例如是先前通过 GeneratePrivateKey([SWS_CRYPT_20722])生成的。

本段文本由 AI 基于规范要求生成。

实现者指南即将推出(复杂度 I1)

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

Rückgabewert

TypBeschreibung
ara::core::Result< PublicKey::Sptr >a PublicKey shared pointer

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context does not support importing public keys
ara::crypto::CryptoErrc::kNoSuchValuerollback_semantics if the last imported CryptoObject is not a PublicKey
ara::crypto::CryptoErrc::kProcessingNotFinishedrollback_semantics if Import has not been executed successfully before

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

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

函数 GetResponse [SWS_CRYPT_41020] Upstream: RS_CRYPTO_02105

virtual ara::core::Result< std::size_t > GetResponse (ReadWriteMem Region responseBuffer) const noexcept=0; DIRECTION NOT           responseBuffer               -- DEFINED

The interface shall write the response of the CryptoProvider to the last invocation of Import into the provided output buffer. E.g., this interface could return M4/M5 of a SHE LoadKey operation.

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

Rückgabewert

TypBeschreibung
ara::core::Result<std::size_t >the number of Bytes written to the output buffer

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context does not provide a response
ara::crypto::CryptoErrc::kInsufficientCapacityrollback_semantics if the output buffer is too small

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

Record
AUTOSAR/AP/record/SWS_CRYPT_41020
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_41020@rel:R25-11#bd00ea52
Content hash
bd00ea52
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_41020
Status: valid/unmigrated Version: rel:R25-11#7021196a Versionshistorie & Revisions (1 transition, 3 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_41020@rel:R25-11#7021196a
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#68728cfb2026-09-30
  • R24-11rel:R24-11#6d10911c2026-10-14
  • R25-11rel:R25-11#7021196a2026-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

函数 GetSymmetricKey [SWS_CRYPT_50210] Upstream: RS_CRYPTO_02105

virtual ara::core::Result< SymmetricKey::Sptr > GetSymmetricKey () const noexcept=0;

The interface shall return a shared pointer to the unwrapped SymmetricKey.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: cefc876d47db 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::crypto::cryp::ProtectedKeyImportCtx 的方法 GetSymmetricKey 返回指向解包对称密钥(SymmetricKey::Sptr)的共享指针 [SWS_CRYPT_50210]。该调用同步进行,声明为 const 以及 noexcept,且不接收任何参数 [SWS_CRYPT_50210]。

为成功检索,必须遵守特定的前提条件和顺序 [SWS_CRYPT_50210]:

  • 此前必须已成功完成导入过程;否则调用失败并报告错误代码 ara::crypto::CryptoErrc::kProcessingNotFinished [SWS_CRYPT_50210]。
  • 若最近导入的加密对象不是对称密钥,则该方法返回 ara::crypto::CryptoErrc::kNoSuchValue [SWS_CRYPT_50210]。
  • 若所选导入上下文通常不支持导入对称密钥,则报告错误 ara::crypto::CryptoErrc::kUnsupported [SWS_CRYPT_50210]。

在执行安全性方面,该接口被指定为 thread-safe 和 exception-safe [SWS_CRYPT_50210]。所有定义的错误情况均提供回滚语义,从而使上下文的状态在错误情况下保持不变 [SWS_CRYPT_50210]。

本文由 AI 基于 AUTOSAR 规范 R25-11 生成。

实现者指南即将推出(复杂度 I1)

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

Rückgabewert

TypBeschreibung
ara::core::Result<SymmetricKey::Sptr >a SymmetricKey shared pointer

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context does not support importing symmetric keys
ara::crypto::CryptoErrc::kNoSuchValuerollback_semantics if the last imported CryptoObject is not a SymmetricKey
ara::crypto::CryptoErrc::kProcessingNotFinishedrollback_semantics if Import has not been executed successfully before

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

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

函数 Import [SWS_CRYPT_50207] Upstream: RS_CRYPTO_02105

virtual ara::core::Result< void > Import (ReadOnlyMemRegion serialized, ara::core::Optional< WriteableKeySlot::Sptr > keySlot) noexcept=0;

The interface shall unwrap the protected data provided, parse the content, and make the parsed content (key-material and meta-data) available for retrieval by the application. If optionally a Key Slot is specified, the unwrapped key material shall be directly serialized into the KeySlot.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 89f9277cd6aa 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

类ara::crypto::cryp::ProtectedKeyImportCtx的同步方法Import从存储区serialized([SWS_CRYPT_50207])解包受保护的密钥数据。它分析数据内容,并提供提取的密钥材料及元数据以供后续检索。若可选地传入了WriteableKeySlot,则密钥材料直接序列化到该槽中([SWS_CRYPT_50207])。Interpretation:若未传入keySlot,密钥材料大概仅保留在导入上下文的状态中。 问题 Q-130f11475af1bb33 (未决)

错误处理

该函数返回一个ara::core::Result<void>。若操作失败,所有错误代码均采用回滚语义([SWS_CRYPT_50207]):

  • ara::crypto::CryptoErrc::kInvalidInputSize:serialized的输入大小非预期([SWS_CRYPT_50207])。
  • ara::crypto::CryptoErrc::kInvalidArgument:序列化数据不符合预期格式([SWS_CRYPT_50207])。
  • ara::crypto::CryptoErrc::kAuthTagNotValid:身份验证检查(MAC 或签名)失败([SWS_CRYPT_50207])。
  • ara::crypto::CryptoErrc::kBusyResource:该操作暂时无法执行([SWS_CRYPT_50207])。

并发性与交互

该方法是线程安全且异常安全的(noexcept)([SWS_CRYPT_50207])。成功调用后,解包后的密钥对象可通过GetPrivateKey([SWS_CRYPT_50209])、GetSymmetricKey([SWS_CRYPT_50210])或GetPublicKey([SWS_CRYPT_50211])从上下文中获取。若底层协议需要向发送方反馈,GetResponse([SWS_CRYPT_41020])将提供 Crypto-Provider 的响应。对于非保护密钥格式,备选地可以使用工厂类CryptoProvider的方法ImportPublicKey([SWS_CRYPT_20732])、ImportSymmetricKey([SWS_CRYPT_50014])和ImportPrivateKey([SWS_CRYPT_50132])。

本文由 AI 基于 AUTOSAR 规范 R25-11 生成。

实现者指南即将推出(复杂度 I1)

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

Parameter (in)

ParameterBeschreibung
serializedthe memory region that contains the serialized import data
keySlotan optional WriteableKeySlot to directly store the imported key

Rückgabewert

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

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kInvalidInputSizerollback_semantics if serialized cannot be unwrapped due to an unexpected size
ara::crypto::CryptoErrc::kInvalidArgumentrollback_semantics if serialized does not conform to the specified import format
ara::crypto::CryptoErrc::kAuthTagNotValidrollback_semantics if serialized cannot be authenticated (MAC or signature invalid)
ara::crypto::CryptoErrc::kBusyResourcerollback_semantics if the operation temporarily cannot be performed

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

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

函数 Reset [SWS_CRYPT_50212] Upstream: RS_CRYPTO_02105

virtual ara::core::Result< void > Reset () const noexcept=0;

The interface shall restore the context to its initial state by ensuring that no key-import-key is set and all previously imported data is deleted from the ProtectedKeyImportCtx’s internal buffers.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 21bf97fcdbf3 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

方法 Reset 将 ara::crypto::cryp::ProtectedKeyImportCtx 的实例重置为其初始状态 [SWS_CRYPT_50212]。在此过程中,该接口确保不再设置密钥导入密钥(Key-Import-Key,KIK),并且所有先前导入的数据均从上下文的内部缓冲区中完全清除 [SWS_CRYPT_50212]。

该调用同步进行,并且根据规范被归类为 thread-safe 以及 exception safe [SWS_CRYPT_50212]。该方法声明了签名 virtual ara::core::Result<void> Reset() const noexcept = 0;,并需要包含头文件 ara/crypto/cryp/protected_key_import_ctx.h [SWS_CRYPT_50212]。

错误处理

结果通过 ara::core::Result<void> 返回 [SWS_CRYPT_50212]。若操作失败,该接口返回错误代码:

  • ara::crypto::CryptoErrc::kUnsupported:在特定上下文不支持重置其状态时发生(回滚语义)[SWS_CRYPT_50212]。

本使用说明基于 SWS_CRYPT_50212 规范自动生成。

实现者指南即将推出(复杂度 I1)

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

Rückgabewert

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

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context does not support resetting its’ state.

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

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

函数 SetKey [SWS_CRYPT_50205] Upstream: RS_CRYPTO_02105

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

The interface shall configure the context to use the provided symmetric key as transport key.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: bb7a4eb711ea 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类ara::crypto::cryp::ProtectedKeyImportCtx的方法SetKey配置上下文,以便将传入的对称密钥对象key(SymmetricKey::Sptr)用作传输密钥[SWS_CRYPT_50205]。调用以同步方式进行并返回一个ara::core::Result<void>[SWS_CRYPT_50205]。

错误处理

若配置时发生错误,将以回滚语义进行报告,从而使上下文的先前状态保持不变[SWS_CRYPT_50205]。定义了以下错误代码:

  • ara::crypto::CryptoErrc::kUnsupported:若上下文仅支持分配KeySlot,则返回此项[SWS_CRYPT_50205]。
  • ara::crypto::CryptoErrc::kIncompatibleObject:提供的密钥对象不能用作传输密钥[SWS_CRYPT_50205]。
  • ara::crypto::CryptoErrc::kUsageViolation:密钥的使用标志不包含所需权限kAllowKeyUnwrapping[SWS_CRYPT_50205]。

并发性与交互

该操作被指定为线程安全(thread-safe)及异常安全(exception safe),并且不抛出异常(noexcept)[SWS_CRYPT_50205]。类似SymmetricKeyWrapperCtx的上下文绑定用于保护或包装(wrapping)的密钥[SWS_CRYPT_24018],而此处的密钥则用于导入受保护的密钥。错误条件kUnsupported还指涉了上下文备选地通过KeySlot进行配置的架构[SWS_CRYPT_50034]。Interpretation:传输密钥的分配大概必须在后续导入操作之前强制完成。 问题 Q-f1f3eab5ab896b1b (未决)

本使用说明基于 AUTOSAR 规范 R25-11 自动生成。

实现者指南即将推出(复杂度 I2)

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

Parameter (in)

ParameterBeschreibung
keysymmetric key object used as transport key

Rückgabewert

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

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context only supports setting a KeySlot
ara::crypto::CryptoErrc::kIncompatibleObjectrollback_semantics if the provided key object cannot be used as transport key
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage flags of the key 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_50205
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50205@rel:R25-11#6d088df7
Content hash
6d088df7
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50205
Status: valid/unmigrated Version: rel:R25-11#0c3f97a6 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_50205@rel:R25-11#0c3f97a6
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

函数 SetKey [SWS_CRYPT_50206] Upstream: RS_CRYPTO_02105

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

The interface shall configure the context to use the key stored in the provided KeySlot at the time the import operation is started as the transport key.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: e6e7bd1f753c 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

方法SetKey配置上下文[SWS_CRYPT_50206](ara::crypto::cryp::ProtectedKeyImportCtx),以便在导入过程开始时将传入的KeySlot::Sptr keySlot中保存的对称密钥用作传输密钥。调用以同步方式进行并返回一个ara::core::Result<void>。

错误处理

若配置时发生错误,将采用回滚语义[SWS_CRYPT_50206]。具体错误代码包括:

  • ara::crypto::CryptoErrc::kUnsupported:当上下文仅支持设置直接的SymmetricKey对象时[SWS_CRYPT_50206]。
  • ara::crypto::CryptoErrc::kIncompatibleObject:当槽中包含的密钥不能用作传输密钥时[SWS_CRYPT_50206]。
  • ara::crypto::CryptoErrc::kUsageViolation:当KeySlot中密钥允许的使用标志不包含标志kAllowKeyUnwrapping时[SWS_CRYPT_50206]。

并发性与交互

该函数被指定为异常安全(exception safe)和线程安全(thread-safe)[SWS_CRYPT_50206]。密钥仅在后续导入启动时才从槽中求值[SWS_CRYPT_50206]。虽然其他加密上下文如SymmetricKeyWrapperCtx[SWS_CRYPT_50034]或KeyDerivationFunctionCtx[SWS_CRYPT_50010]同样可以绑定槽作为密钥源,但ProtectedKeyImportCtx::SetKey显式要求具有解包密钥的权限。

本段文字由 AI 辅助文档工具生成,不能替代查阅官方 AUTOSAR 规范。

实现者指南即将推出(复杂度 I2)

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

Parameter (in)

ParameterBeschreibung
keySlota keyslot containing a symmetric key used as transport key

Rückgabewert

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

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context only supports setting a SymmetricKey object
ara::crypto::CryptoErrc::kIncompatibleObjectrollback_semantics if the key contained in the provided keySlot cannot be used as transport key
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage flags of the key contained in the provided Key Slot does not include kAllowKeyUnwrapping

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

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

类型别名文档

类型别名 Sptr [SWS_CRYPT_50085] Upstream: RS_CRYPTO_02105

using Sptr = std::shared_ptr<ProtectedKeyImportCtx>;

Smart pointer of the interface.

Header-Datei#include "ara/crypto/cryp/protected_key_import_ctx.h"
Scopeclass ara::crypto::cryp::ProtectedKeyImportCtx
SymbolSptr

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

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