DEENESPTFRRUARHIKOZHNL

类 ara::crypto::cryp::CryptoObject

[SWS_CRYPT_20500] Upstream: RS_CRYPTO_02005

class CryptoObject :           public ara::crypto::Serializable {...};

A common interface for all cryptographic objects recognizable by the Crypto Provider.

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

用户指南人工智能生成

用作对加密对象进行线程安全检查和持久存储的通用接口。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 156a618ba987 来源 未决问题(2)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用作对加密对象进行线程安全检查和持久存储的通用接口。

接口 ara::crypto::cryp::CryptoObject 为 Adaptive 加密栈中的所有加密对象定义了通用抽象,并通过 Sptr 管理其生命周期 [SWS_CRYPT_20501]。它支持对算法标识符以及使用标志进行线程安全的读取,并支持在 WriteableKeySlot 中持久覆盖密钥材料 [SWS_CRYPT_20505], [SWS_CRYPT_20517]。在存储过程中,具有回滚语义的已定义错误码可确保底层存储槽的数据完整性 [SWS_CRYPT_20517]。

上下文

接口 ara::crypto::cryp::CryptoObject 构成了可由 Crypto-Provider 识别和管理的所有加密对象的通用抽象。该类继承自 ara::crypto::Serializable,并定义了基本属性,如算法识别、使用限制以及用于持久存储的机制。典型的交互方包括发起调用的应用程序、提供服务的 Crypto-Provider 以及 WriteableKeySlot 实例形式的目标存储。

生命周期

在平台内部,加密对象主要通过共享所有权进行管理。为此,该类将规范的智能指针别名 ara::crypto::cryp::CryptoObject::Sptr 定义为 std::shared_ptr<CryptoObject> [SWS_CRYPT_20501]。具体实例应该由 Crypto-Provider 的专用工厂和加载例程实例化,并通过此指针类型提供给调用者。 问题 Q-36e2bd12d7dc8b98 (未决)该接口声明的所有方法均被指定为线程安全和异常安全的 (exception safe, noexcept),从而确保了跨多个线程的安全并发读取和存储访问 [SWS_CRYPT_20505], [SWS_CRYPT_50092], [SWS_CRYPT_20517]。一旦最后一个 Sptr 引用失效,该对象及关联密钥材料的释放就会自动进行。

使用路径

典型使用路径包括识别对象的加密属性及其随后的持久存储。首先,应用程序通过 GetAlgId() 将对象的算法标识符作为 ara::crypto::AlgIdString 查询 [SWS_CRYPT_20505]。随后,通过 GetAllowedUsage() 确定允许的使用标志 (AllowedUsageFlags) [SWS_CRYPT_50092],以确保该对象已被授权用于预期的操作。为了进行持久保存,应用程序将可写的密钥槽传递给方法 Save() [SWS_CRYPT_20517]。密钥材料及相关元数据随后保存在目标槽中,槽中原有的数据将被覆盖 [SWS_CRYPT_20517]。

CryptoObject 的检查与持久化应用CryptoObjectWriteableKeySlotGetAlgId()AlgIdStringGetAllowedUsage()AllowedUsageFlags (kAllowPersist)Save(keyslot)写入密钥材料和元数据SpeicherquittungResult<void>

时序图:在 KeySlot 中检查和持久化加密对象的典型流程。来源:[SWS_CRYPT_20505], [SWS_CRYPT_50092], [SWS_CRYPT_20517]。

错误场景

虽然 GetAlgId() [SWS_CRYPT_20505] 和 GetAllowedUsage() [SWS_CRYPT_50092] 未标明标准化错误码并在成功时将各自结果在 ara::core::Result 中返回,但持久化操作 Save() 定义了具有强制回滚语义的具体错误条件 [SWS_CRYPT_20517]:

  • ara::crypto::CryptoErrc::kIncompatibleObject:当对象与传入的 WriteableKeySlot 不兼容时发生,例如因为算法标识符 (AlgId) 互不相同或密钥槽属于不同的 Crypto-Provider [SWS_CRYPT_20517]。
  • ara::crypto::CryptoErrc::kUsageViolation:如果通过 GetAllowedUsage() 声明的密钥使用标志不包含持久化权限 (kAllowPersist),则发出非法使用信号 [SWS_CRYPT_50092], [SWS_CRYPT_20517]。
  • ara::crypto::CryptoErrc::kBusyResource:当底层存储资源被临时占用且操作无法立即执行时返回 [SWS_CRYPT_20517]。

借助回滚语义,在发生上述任何错误时,WriteableKeySlot 的状态均保持完好,因此不会在存储中残留部分写入或损坏的密钥数据 [SWS_CRYPT_20517]。

本指南基于 AUTOSAR Adaptive R25-11 规范,总结了对接口 ara::crypto::cryp::CryptoObject 的要求。

成员图

类图

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

G nara__crypto__cryp__CryptoObject679 CryptoObject + GetAlgId() + GetAllowedUsage() + Save() nara__crypto__Serializable855 Serializable nara__crypto__cryp__CryptoObject679->nara__crypto__Serializable855 nara__crypto__cryp__PrivateKey762 PrivateKey nara__crypto__cryp__PrivateKey762->nara__crypto__cryp__CryptoObject679 nara__crypto__cryp__PublicKey940 PublicKey nara__crypto__cryp__PublicKey940->nara__crypto__cryp__CryptoObject679 nara__crypto__cryp__SymmetricKey111 SymmetricKey nara__crypto__cryp__SymmetricKey111->nara__crypto__cryp__CryptoObject679

详细视图

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

方法

GetAlgId 函数

The interface shall return the AlgId of this CryptoObject.

virtual ara::core::Result< ara::crypto::AlgIdString > GetAlgId () const noexcept=0;

The interface shall return the allowed usage of the key.

virtual ara::core::Result< AllowedUsageFlags > GetAllowedUsage () const noexcept=0;
Save 函数

The interface shall persistently store the key-material and its meta-data in the provided WriteableKeySlot. Data previously stored in keyslot shall be overwritten.

virtual ara::core::Result< void > Save (WriteableKeySlot::Sptr keyslot) const noexcept=0;

类型别名

Sptr 类型别名

Smart pointer of the interface.

方法文档

函数 GetAlgId [SWS_CRYPT_20505] Upstream: RS_CRYPTO_02005

virtual ara::core::Result< ara::crypto::AlgIdString > GetAlgId () const noexcept=0;

The interface shall return the AlgId of this CryptoObject.

Header-Datei#include "ara/crypto/cryp/cryobj/crypto_object.h"
Scopeclass ara::crypto::cryp::CryptoObject
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Rückgabewert

TypBeschreibung
ara::core::Result<ara::crypto::AlgIdString >A result containing the AlgId of this CryptoObject

Fehler

FehlercodeBeschreibung
This function does not specify any standardized errors.

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

Record
AUTOSAR/AP/record/SWS_CRYPT_20505
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_20505@rel:R25-11#80f85084
Content hash
80f85084
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_20505
Status: valid/unmigrated Version: rel:R25-11#974298db 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_20505@rel:R25-11#974298db
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#fa5364ac2026-09-30
  • R20-11rel:R20-11#3073d8c92026-10-14
  • R21-11rel:R21-11#3073d8c92026-10-14
  • R22-11rel:R22-11#131cf8662026-10-14
  • R23-11rel:R23-11#b34bd5a42026-10-14
  • R24-11rel:R24-11#36c55a302026-10-14
  • R25-11rel:R25-11#974298db2026-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

函数 GetAllowedUsage [SWS_CRYPT_50092] Upstream: RS_CRYPTO_02005

virtual ara::core::Result< AllowedUsageFlags > GetAllowedUsage () const noexcept=0;

The interface shall return the allowed usage of the key.

Header-Datei#include "ara/crypto/cryp/cryobj/crypto_object.h"
Scopeclass ara::crypto::cryp::CryptoObject
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Rückgabewert

TypBeschreibung
ara::core::Result<AllowedUsageFlags >A result containing the allowed usage of the key

Fehler

FehlercodeBeschreibung
This function does not specify any standardized errors.

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

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

函数 Save [SWS_CRYPT_20517] Upstream: RS_CRYPTO_02004

virtual ara::core::Result< void > Save (WriteableKeySlot::Sptr keyslot) const noexcept=0;

The interface shall persistently store the key-material and its meta-data in the provided WriteableKeySlot. Data previously stored in keyslot shall be overwritten.

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

接口 ara::crypto::cryp::CryptoObject 的方法 Save 用于将密钥材料及其关联元数据持久化存储在所提供的 WriteableKeySlot 中([SWS_CRYPT_20517])。执行时,先前存储在目标 KeySlot 中的数据将被覆盖([SWS_CRYPT_20517])。

作为参数,将传递类型为 WriteableKeySlot::Sptr 的 keyslot,它代表底层存储空间([SWS_CRYPT_20517])。该函数被指定为 noexcept 以及 exception safe,并返回一个 ara::core::Result<void> 作为返回值,该返回值在成功时为空([SWS_CRYPT_20517])。

在出错情况下,适用回滚语义([SWS_CRYPT_20517])。具体返回以下错误码:

  • ara::crypto::CryptoErrc::kIncompatibleObject:密钥与 KeySlot 不兼容,例如由于不同的 AlgId 或分配给了不同的 CryptoProvider([SWS_CRYPT_20517])。
  • ara::crypto::CryptoErrc::kUsageViolation:密钥的允许用途不包含权限 kAllowPersist([SWS_CRYPT_20517])。
  • ara::crypto::CryptoErrc::kBusyResource:该操作暂时无法执行([SWS_CRYPT_20517])。

关于并发性,该方法被声明为 thread-safe([SWS_CRYPT_20517])。

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

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

Header-Datei#include "ara/crypto/cryp/cryobj/crypto_object.h"
Scopeclass ara::crypto::cryp::CryptoObject
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
keyslotKeySlot representing the underlying storage

Rückgabewert

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

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kIncompatibleObjectrollback_semantics if the key is incompatible to the KeySlot, e.g., because the AlgId of the KeySlot is incompatible to the AlgId of the key or because the KeySlot belongs to a different CryptoProvider
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the key does not include kAllowPersist
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_20517
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_20517@rel:R25-11#5462cb81
Content hash
5462cb81
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_20517
Status: valid/unmigrated Version: rel:R25-11#27ad83e4 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_20517@rel:R25-11#27ad83e4
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#401495a62026-09-30
  • R19-11rel:R19-11#12df20182026-10-14
  • R20-11rel:R20-11#74dce1282026-10-14
  • R21-11rel:R21-11#9fdecde72026-10-14
  • R22-11rel:R22-11#4e577c772026-10-14
  • R23-11rel:R23-11#302bac292026-10-14
  • R24-11rel:R24-11#7745263b2026-10-14
  • R25-11rel:R25-11#27ad83e42026-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_20501] Upstream: RS_CRYPTO_02005

using Sptr = std::shared_ptr<CryptoObject>;

Smart pointer of the interface.

Header-Datei#include "ara/crypto/cryp/cryobj/crypto_object.h"
Scopeclass ara::crypto::cryp::CryptoObject
SymbolSptr

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

Record
AUTOSAR/AP/record/SWS_CRYPT_20501
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_20501@rel:R25-11#39b3acc3
Content hash
39b3acc3
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_20501
Status: valid/unmigrated Version: rel:R25-11#4816c7c1 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_20501@rel:R25-11#4816c7c1
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#2f0be81f2026-09-30
  • R19-11rel:R19-11#b83af8272026-10-14
  • R20-11rel:R20-11#eb73b7d72026-10-14
  • R21-11rel:R21-11#eb73b7d72026-10-14
  • R22-11rel:R22-11#cc06a6ac2026-10-14
  • R23-11rel:R23-11#0db32e6b2026-10-14
  • R24-11rel:R24-11#0db32e6b2026-10-14
  • R25-11rel:R25-11#4816c7c12026-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