DEENESPTFRRUARHIKOZHNL

类 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

用户指南人工智能生成

支持通过对称密钥加密安全打包和解包密钥。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 16126e8d9692 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

支持通过对称密钥加密安全打包和解包密钥。

上下文 SymmetricKeyWrapperCtx 用于通过对称算法对密钥进行密码学打包和解包。在执行 Wrap 或 UnwrapSymmetricKey 之前,必须通过 SetKey 使用兼容的密钥加密密钥(KEK)配置上下文 [SWS_CRYPT_24018]。所有操作均以相关密钥对象的相应使用权限为前提条件,并通过 ara::core::Result 报告具有回滚语义的错误 [SWS_CRYPT_24014]。该接口具有异常安全性,并且针对并发运行被指定为线程安全。

上下文

类 SymmetricKeyWrapperCtx 定义了 AUTOSAR Adaptive Platform 内对称密钥包装算法(Key Wrapping)的标准化接口。其核心职责包括在导出时对密钥进行密码学保护,以及恢复打包密钥供内部使用。在此过程中,该类主要与密钥加密密钥(Key Encryption Key,KEK)进行交互,这些密钥既可以作为类型为 SymmetricKey 的临时密钥对象提供,也可以通过 KeySlot 持久化提供 [SWS_CRYPT_24018]、[SWS_CRYPT_50034]。在打包时,上下文接收通用的 CryptoObject [SWS_CRYPT_24014],而解包操作则创建并返回一个新的、立即可用的 SymmetricKey 对象 [SWS_CRYPT_24016]。

生命周期

SymmetricKeyWrapperCtx 的实例通过类型化智能指针 Sptr(std::shared_ptr<SymmetricKeyWrapperCtx> 的别名)进行管理 [SWS_CRYPT_24001]。实际的对象创建可能通过主管的提供者工厂进行,因为该类是一个具有纯虚方法的抽象接口。 问题 Q-7b9a1007da43ddcd (未决)该接口的所有成员函数均被指定为异常安全(exception safe)以及线程安全(thread-safe),这使得可以在并发软件组件中安全使用 [SWS_CRYPT_24014]、[SWS_CRYPT_24016]。

在生命周期中,上下文经历两个主要阶段:紧随实例化之后,它处于未初始化状态。在此阶段,密码学操作以及缓冲区计算会因错误 kUninitializedContext 而失败 [SWS_CRYPT_50035]、[SWS_CRYPT_24014]。只有在通过使用兼容的 KEK 或 KeySlot 成功调用 SetKey 之后,上下文才会转入就绪状态,在该状态下可以安全地打包或解包密钥 [SWS_CRYPT_24018]、[SWS_CRYPT_50034]。

使用路径

打包密钥的常规流程需要由配置、缓冲区检查和执行组成的协调顺序。首先,应用程序通过 SetKey 使用所需的 KEK 对象 [SWS_CRYPT_24018] 配置上下文,或将相应的 KeySlot 绑定到上下文 [SWS_CRYPT_50034]。第二步,应用程序通过 GetRequiredWrappedKeyBufferSize 确定待打包目标对象所需的最大输出缓冲区大小 [SWS_CRYPT_50035]。在提供相应尺寸的内存区域(ReadWriteMemRegion)之后,调用 Wrap,该调用将序列化并加密的密钥数据写入缓冲区并返回确切的字节数 [SWS_CRYPT_24014]。

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

时序图:对称密钥打包的典型调用顺序。来源:[SWS_CRYPT_24018]、[SWS_CRYPT_50035]、[SWS_CRYPT_24014]

对于解包的互补过程,应用程序在使用 SetKey 进行配置之后,将包含包装数据的输入缓冲区传递给 UnwrapSymmetricKey [SWS_CRYPT_24016]。此时,必须为新生成的对称密钥显式指定目标算法标识(targetAlgId)以及允许的使用标志(allowedUsage)[SWS_CRYPT_24016]。

错误场景

该类的方法通过返回类型 ara::core::Result 指示错误并具备回滚语义。核心错误场景包括:

  • 缺少初始化:如果在成功进行密钥分配之前调用 GetRequiredWrappedKeyBufferSize、Wrap 或 UnwrapSymmetricKey,它们将返回 ara::crypto::CryptoErrc::kUninitializedContext [SWS_CRYPT_50035]、[SWS_CRYPT_24014]、[SWS_CRYPT_24016]。
  • 违反使用权限:在设置 KEK 时,其必须至少具有权限 kAllowKeyWrapping 或 kAllowKeyUnwrapping,否则 SetKey 将因 ara::crypto::CryptoErrc::kUsageViolation 而失败 [SWS_CRYPT_24018]。在 Wrap 中,KEK 上缺少 kAllowKeyWrapping 或待打包对象上缺少 kAllowSecuredExport 同样会导致 kUsageViolation [SWS_CRYPT_24014]。解包时会检查 KEK 是否允许 kAllowKeyUnwrapping [SWS_CRYPT_24016]。
  • 不兼容性与缓冲区错误:如果 Wrap 的目标缓冲区太小,则报告 ara::crypto::CryptoErrc::kInsufficientCapacity [SWS_CRYPT_24014]。错误的密钥格式或不兼容的类型会导致 ara::crypto::CryptoErrc::kInvalidArgument [SWS_CRYPT_24014]、[SWS_CRYPT_24016]。如果上下文仅支持插槽或仅支持密钥对象,则 SetKey 报告错误 kUnsupported [SWS_CRYPT_24018]、[SWS_CRYPT_50034]。
  • 资源冲突与空插槽:如果操作访问被占用的资源,则返回 ara::crypto::CryptoErrc::kBusyResource;如果引用的 KeySlot 为空,则导致 ara::crypto::CryptoErrc::kEmptyKeySlot [SWS_CRYPT_24014]、[SWS_CRYPT_24016]。

本指南由 AI 创建,仅基于 AUTOSAR 规范。

成员图

类图

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

详细视图

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

方法

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 函数 2

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

重载 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 函数

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;

类型别名

Sptr 类型别名

Smart pointer of the interface.

方法文档

函数 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#35add4b5
Content hash
35add4b5
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

函数 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 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: d0a83598653d 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用法与语义

同步成员函数 SetKey 对 ara::crypto::cryp::SymmetricKeyWrapperCtx 的实例进行配置,以便将传递的对象 SymmetricKey::Sptr 用作后续密钥操作的密钥加密密钥(KEK)[SWS_CRYPT_24018]。该函数被指定为带有 noexcept 的纯虚方法,并且只要分配成功,就返回一个空的 ara::core::Result<void> [SWS_CRYPT_24018]。

错误处理与回滚

若在配置时发生错误,则采用具约束力的回滚语义,从而使上下文状态保持不变 [SWS_CRYPT_24018]。可能的错误原因通过来自 ara::crypto::CryptoErrc 的错误代码映射:

  • kIncompatibleObject:传递的密钥对象与对称上下文不兼容 [SWS_CRYPT_24018]。
  • kUsageViolation:密钥允许的用途既不包含 kAllowKeyWrapping 也不包含 kAllowKeyUnwrapping [SWS_CRYPT_24018]。
  • kUnsupported:上下文实现仅支持通过 KeySlot 设置密钥 [SWS_CRYPT_24018]。

并发性与交互

该方法被指定为 thread-safe 且异常安全(exception safe)[SWS_CRYPT_24018]。若密钥通过槽位进行管理,或上下文仅支持 KeySlot,则对于同一个包装器上下文,存在带有 KeySlot::Sptr 的备选重载 SetKey [SWS_CRYPT_50034]。这会将上下文配置为在密钥包装的执行时间点加载存储在插槽中的密钥 [SWS_CRYPT_50034]。

本使用说明基于 AUTOSAR Adaptive Platform 规范版本 R25-11。

实现者指南即将推出(复杂度 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#fa435c42
Content hash
fa435c42
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

函数 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 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 30d79040bb46 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

虚方法 SetKey 配置上下文 ara::crypto::cryp::SymmetricKeyWrapperCtx,以便在执行密钥封装时立即使用存储在所提供的 KeySlot 中的密钥 [SWS_CRYPT_50034]。该调用期望将包含对称密钥的 KeySlot::Sptr 作为参数 keySlot [SWS_CRYPT_50034]。该函数被同步调用,声明为 noexcept,并返回 ara::core::Result<void> [SWS_CRYPT_50034]。

错误处理

在发生错误时,该方法确保回滚语义并返回以下错误结果之一 [SWS_CRYPT_50034]:

  • ara::crypto::CryptoErrc::kIncompatibleObject:传入的 keySlot 与此上下文不兼容 [SWS_CRYPT_50034]。
  • ara::crypto::CryptoErrc::kUnsupported:该上下文仅支持设置直接的 SymmetricKey [SWS_CRYPT_50034]。

并发性

该操作是线程安全的(thread-safe)并提供有保证的异常安全性(exception safe)[SWS_CRYPT_50034]。

相互作用

在 SymmetricKeyWrapperCtx 内部,该接口构成了带有 SymmetricKey::Sptr 的重载 SetKey 的基于插槽的对应项,后者直接将密钥绑定为密钥加密密钥(KEK)[SWS_CRYPT_24018]。类似的基于插槽的配置函数也用于相关的加密上下文中,例如 KeyDerivationFunctionCtx [SWS_CRYPT_50010]、KeyEncapsulatorPublicCtx [SWS_CRYPT_50012]、VerifierPublicCtx [SWS_CRYPT_50018]、MessageAuthnCodeCtx [SWS_CRYPT_50026] 和 SignerPrivateCtx [SWS_CRYPT_50036]。

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

实现者指南即将推出(复杂度 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#418c105c
Content hash
418c105c
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

函数 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 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: fe87df5f5eae 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

接口 ara::crypto::cryp::SymmetricKeyWrapperCtx 的方法 UnwrapSymmetricKey 使用先前设置的密钥加密密钥(KEK)解密已包装的密钥,并返回一个新的 SymmetricKey 对象 [SWS_CRYPT_24016]。作为参数,该同步函数接收包含受保护密钥数据的输入缓冲区(wrappedKey)、目标密钥的算法标识符(targetAlgId)以及用于其允许转换类型的位标志(allowedUsage)[SWS_CRYPT_24016]。

返回值 ara::core::Result<SymmetricKey::Sptr> 在成功执行时包含指向所生成密钥的智能指针,或通过回滚语义指示错误 [SWS_CRYPT_24016]。可能的错误原因包括:

  • InvalidArgument:无法解包 wrappedKey 中传递的密钥数据,例如由于格式无效或缓冲区大小不正确 [SWS_CRYPT_24016]。
  • ara::crypto::CryptoErrc::kUninitializedContext:包装器上下文尚未用合适的 KEK 进行初始化 [SWS_CRYPT_24016]。
  • ara::crypto::CryptoErrc::kUsageViolation:KEK 的使用限制禁止解包(缺少 kAllowKeyUnwrapping)[SWS_CRYPT_24016]。
  • ara::crypto::CryptoErrc::kUnknownIdentifier:为 targetAlgId 传递的值未知或不受支持 [SWS_CRYPT_24016]。
  • ara::crypto::CryptoErrc::kIncompatibleArguments:指定的 allowedUsage 标志与 targetAlgId 或密钥类型不兼容 [SWS_CRYPT_24016]。
  • ara::crypto::CryptoErrc::kBusyResource:操作所需的系统资源当前被占用 [SWS_CRYPT_24016]。
  • ara::crypto::CryptoErrc::kEmptyKeySlot:为该操作配置的 KeySlot 为空 [SWS_CRYPT_24016]。

该方法声明为 const 以及 noexcept,保证异常安全性,并且根据规范在并发调用时是线程安全的(thread-safe)[SWS_CRYPT_24016]。

本文由 AI 生成,仅供参考。一切以规范为准。

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#131da385
Content hash
131da385
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

函数 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 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 8e6ff8198c9d 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

类 ara::crypto::cryp::SymmetricKeyWrapperCtx 的方法 Wrap(头文件 ara/crypto/cryp/symmetric_key_wrapper_ctx.h)使用预先设置的密钥加密密钥(Key Encryption Key)封装提供的密钥 [SWS_CRYPT_24014]。

该同步函数需要以下参数 [SWS_CRYPT_24014]:

  • key(CryptoObject::Sptr):待封装的密钥。
  • wrappedKey(ReadWriteMemRegion):用于写入封装密钥的输出缓冲区。

作为返回值,该操作提供一个 ara::core::Result<std::size_t>,成功时包含写入缓冲区的封装密钥的字节数 [SWS_CRYPT_24014]。

错误处理与语义

该方法定义为 exception safe,并针对错误情况实现了严格的回滚语义 [SWS_CRYPT_24014]。可能会报告以下错误状态 [SWS_CRYPT_24014]:

  • InvalidArgument:无法封装密钥对象(例如由于大小无效或类型错误)。
  • ara::crypto::CryptoErrc::kUninitializedContext:上下文尚未用密钥值进行初始化。
  • ara::crypto::CryptoErrc::kUsageViolation:KEK 的允许用法不包含 kAllowKeyWrapping,或对象的允许用法不包含 kAllowSecuredExport。
  • ara::crypto::CryptoErrc::kInsufficientCapacity:输出缓冲区 wrappedKey 过小。
  • ara::crypto::CryptoErrc::kBusyResource:所需资源被占用。
  • ara::crypto::CryptoErrc::kEmptyKeySlot:配置的 KeySlot 当前为空。

并发性与限制

该接口被指定为 thread-safe [SWS_CRYPT_24014]。执行的前提条件是预先初始化的上下文以及所涉及密钥的匹配使用属性 [SWS_CRYPT_24014]。

本使用说明基于 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#54899f79
Content hash
54899f79
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

类型别名文档

类型别名 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#2b1d2478
Content hash
2b1d2478
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