DEENESPTFRRUARHIKOZHNL

类 ara::crypto::cryp::CryptoContext

[SWS_CRYPT_20400] Upstream: RS_CRYPTO_02008

class CryptoContext {...};

A common interface of a mutable cryptographic context, i.e. that is not binded to a single crypto object.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Forwarding-Header#include "ara/crypto/crypto_fwd.h"
Scopenamespace ara::crypto::cryp

用户指南人工智能生成

为可变加密上下文提供基础接口,用于线程安全地查询算法 ID。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 40f33685b357 来源 未决问题(2)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

为可变加密上下文提供基础接口,用于线程安全地查询算法 ID。

该接口充当未牢固绑定到单个加密对象的可变加密上下文的通用基类。通过纯虚方法 GetAlgId(),它允许线程安全地将算法标识符查询为 ara::core::Result [SWS_CRYPT_20411]。为了防止不希望的状态重复,完全禁止了复制和移动操作 [SWS_CRYPT_41003]。释放通过虚默认析构函数确定性且安全地进行。

上下文

接口 ara::crypto::cryp::CryptoContext 定义了 AUTOSAR Adaptive Platform 加密模块内可变加密上下文(mutable cryptographic contexts)的基本抽象。与静态加密对象不同,此类上下文并不硬性绑定到单个加密对象。相反,它充当各种加密处理上下文的通用基类,这些上下文的内部状态在执行加密操作期间可能会发生变化。

纯虚成员函数 GetAlgId() 充当该基本接口的核心元素。它允许交互伙伴查询当前在上下文中配置的加密算法的标识符 [SWS_CRYPT_20411]。系统中的具体加密计算和转换上下文(例如用于哈希、签名或加密服务)可能派生自 CryptoContext,以提供特定的算法功能。 问题 Q-203d40209cd355fa (未决)

生命周期

CryptoContext 的生命周期具有明确的标识和严格的所有权特征。为了防止在编译时对上下文状态进行不受控制的复制或不一致的传输,完全禁止了语义复制过程。复制构造函数 [SWS_CRYPT_41003] 和复制赋值运算符 [SWS_CRYPT_30214] 均被显式声明为已删除(=delete)。

同样,接口定义禁止移动上下文:移动构造函数 [SWS_CRYPT_41004] 和移动赋值运算符 [SWS_CRYPT_30215] 均已删除(=delete)。因此,派生类的实例永久保留在其原始内存位置。销毁和资源释放通过定义为 default 和 noexcept 的虚析构函数确定性地发生 [SWS_CRYPT_20401]。这确保了派生上下文对象可以通过指向基接口的指针安全地释放,且不会发生资源泄漏。

关于并发性,针对 GetAlgId() 的要求明确指定了线程安全性 [SWS_CRYPT_20411]。因此,多个线程可以同时且无需外部同步地读取同一上下文的算法标识符。

使用路径

由于 CryptoContext 是纯虚接口,应用程序开发人员无法直接创建实例。特化上下文类的实例通常可能通过加密栈的工厂函数或提供者组件进行实例化,并通过指针或引用提供给调用者。 问题 Q-728a7b6dd526eb64 (未决)基接口级别的典型使用流程包括以下阶段:

  • 提供:调用者从加密提供者接收对已配置上下文的引用或指针。
  • 算法检查:通过调用 GetAlgId() 查询并评估算法标识符 [SWS_CRYPT_20411],以确保上下文满足所需规范。
  • 操作和清理:在通过派生接口执行特定于算法的操作后,上下文将通过虚析构函数自动释放 [SWS_CRYPT_20401]。

错误场景

CryptoContext 的错误处理概念遵循 AUTOSAR Adaptive Platform 的通用故障安全设计,并且不使用 C++ 异常。方法 GetAlgId() 被指定为异常安全(exception safe),并在 ara::core::Result<ara::crypto::AlgIdString> 中返回其结果 [SWS_CRYPT_20411]。如果在确定算法 ID 时发生错误,该错误将在 Result 对象的错误通道中传输。

根据规范,GetAlgId() 未定义标准化的错误代码 [SWS_CRYPT_20411]。因此,调用者在访问算法 ID 字符串之前,必须主要检查 Result 是否包含有效值。在拆卸对象时,声明为 noexcept 的虚析构函数可确保在销毁期间不传播异常,并始终可靠地完成清理 [SWS_CRYPT_20401]。

本指南基于 AUTOSAR Adaptive 规范 R25-11,由 AI 策展助手生成。

成员图

构造函数和析构函数

2

方法

1

运算符

1

类图

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

G nara__crypto__cryp__CryptoContext85 CryptoContext + CryptoContext() + operator=() + ~CryptoContext() + GetAlgId() nara__crypto__cryp__AuthCipherCtx142 AuthCipherCtx nara__crypto__cryp__AuthCipherCtx142->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__DecryptorPrivateCtx616 DecryptorPrivateCtx nara__crypto__cryp__DecryptorPrivateCtx616->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__EncryptorPublicCtx829 EncryptorPublicCtx nara__crypto__cryp__EncryptorPublicCtx829->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__HashFunctionCtx412 HashFunctionCtx nara__crypto__cryp__HashFunctionCtx412->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__KeyAgreementPrivateCtx203 KeyAgreementPrivateCtx nara__crypto__cryp__KeyAgreementPrivateCtx203->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__KeyDecapsulatorPrivateCtx748 KeyDecapsulatorPrivateCtx nara__crypto__cryp__KeyDecapsulatorPrivateCtx748->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__KeyDerivationFunctionCtx485 KeyDerivationFunctionCtx nara__crypto__cryp__KeyDerivationFunctionCtx485->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__KeyEncapsulatorPublicCtx699 KeyEncapsulatorPublicCtx nara__crypto__cryp__KeyEncapsulatorPublicCtx699->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__MessageAuthnCodeCtx845 MessageAuthnCodeCtx nara__crypto__cryp__MessageAuthnCodeCtx845->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__ProtectedKeyImportCtx279 ProtectedKeyImportCtx nara__crypto__cryp__ProtectedKeyImportCtx279->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__RandomGeneratorCtx512 RandomGeneratorCtx nara__crypto__cryp__RandomGeneratorCtx512->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__SignerPrivateCtx943 SignerPrivateCtx nara__crypto__cryp__SignerPrivateCtx943->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__SymmetricCipherCtx167 SymmetricCipherCtx nara__crypto__cryp__SymmetricCipherCtx167->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__SymmetricKeyWrapperCtx465 SymmetricKeyWrapperCtx nara__crypto__cryp__SymmetricKeyWrapperCtx465->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__VerifierPublicCtx35 VerifierPublicCtx nara__crypto__cryp__VerifierPublicCtx35->nara__crypto__cryp__CryptoContext85

详细视图

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

构造函数和析构函数

CryptoContext 函数 2

Copy-Constructor.

重载 CryptoContext 2
CryptoContext (const CryptoContext &)=delete; SWS_CRYPT_41003
CryptoContext (CryptoContext &&)=delete; SWS_CRYPT_41004

Destructor.

virtual ~CryptoContext () noexcept=default;

方法

GetAlgId 函数

The interface shall return the AlgId of the context.

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

运算符

operator= 函数 2

Copy-assign another CryptoContext to this instance.

重载 = 2
CryptoContext & operator= (const CryptoContext &other)=delete; SWS_CRYPT_30214
CryptoContext & operator= (CryptoContext &&other)=delete; SWS_CRYPT_30215

方法文档

函数 CryptoContext [SWS_CRYPT_41003] Upstream: RS_CRYPTO_02004

CryptoContext (const CryptoContext &)=delete;

Copy-Constructor.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext

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

Record
AUTOSAR/AP/record/SWS_CRYPT_41003
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_41003@rel:R25-11#d103425e
Content hash
d103425e
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_41003
Status: valid/unmigrated Version: rel:R25-11#98ee9054 Versionshistorie & Revisions (1 transition, 4 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_41003@rel:R25-11#98ee9054
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#8cdfc0542026-09-30
  • R23-11rel:R23-11#24b116da2026-10-14
  • R24-11rel:R24-11#98ee90542026-10-14
  • R25-11rel:R25-11#98ee90542026-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

函数 CryptoContext [SWS_CRYPT_41004] Upstream: RS_CRYPTO_02004

CryptoContext (CryptoContext &&)=delete;

Move-Constructor.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext

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

Record
AUTOSAR/AP/record/SWS_CRYPT_41004
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_41004@rel:R25-11#6fca9970
Content hash
6fca9970
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_41004
Status: valid/unmigrated Version: rel:R25-11#62d2964c Versionshistorie & Revisions (1 transition, 4 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_41004@rel:R25-11#62d2964c
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#e84c8c582026-09-30
  • R23-11rel:R23-11#d9afa7b72026-10-14
  • R24-11rel:R24-11#62d2964c2026-10-14
  • R25-11rel:R25-11#62d2964c2026-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

函数 GetAlgId [SWS_CRYPT_20411] Upstream: RS_CRYPTO_02008

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

The interface shall return the AlgId of the context.

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

Rückgabewert

TypBeschreibung
ara::core::Result<ara::crypto::AlgIdString >the AlgId of the context or an error

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_20411
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_20411@rel:R25-11#93c9493a
Content hash
93c9493a
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_20411
Status: valid/unmigrated Version: rel:R25-11#268ba62b 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_20411@rel:R25-11#268ba62b
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#0505bc8c2026-09-30
  • R19-11rel:R19-11#44b1ac7b2026-10-14
  • R20-11rel:R20-11#1bdef3fa2026-10-14
  • R21-11rel:R21-11#1bdef3fa2026-10-14
  • R22-11rel:R22-11#5dd94a472026-10-14
  • R23-11rel:R23-11#3ac9359d2026-10-14
  • R24-11rel:R24-11#d2d6ca2d2026-10-14
  • R25-11rel:R25-11#268ba62b2026-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

函数 operator= [SWS_CRYPT_30214] Upstream: RS_CRYPTO_02004

CryptoContext & operator= (const CryptoContext &other)=delete;

Copy-assign another CryptoContext to this instance.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext

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

Record
AUTOSAR/AP/record/SWS_CRYPT_30214
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_30214@rel:R25-11#a538aa2e
Content hash
a538aa2e
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_30214
Status: valid/unmigrated Version: rel:R25-11#54e94bf7 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_30214@rel:R25-11#54e94bf7
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#7667e7772026-09-30
  • R20-11rel:R20-11#8da104e32026-10-14
  • R21-11rel:R21-11#78cc10a82026-10-14
  • R22-11rel:R22-11#760b4ede2026-10-14
  • R23-11rel:R23-11#8fd55e4c2026-10-14
  • R24-11rel:R24-11#54e94bf72026-10-14
  • R25-11rel:R25-11#54e94bf72026-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

函数 operator= [SWS_CRYPT_30215] Upstream: RS_CRYPTO_02004

CryptoContext & operator= (CryptoContext &&other)=delete;

Move-assign another CryptoContext to this instance.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext

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

Record
AUTOSAR/AP/record/SWS_CRYPT_30215
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_30215@rel:R25-11#b0e1e440
Content hash
b0e1e440
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_30215
Status: valid/unmigrated Version: rel:R25-11#f0c7c4e1 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_30215@rel:R25-11#f0c7c4e1
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#e0e202f42026-09-30
  • R20-11rel:R20-11#17d0c85f2026-10-14
  • R21-11rel:R21-11#17d0c85f2026-10-14
  • R22-11rel:R22-11#843bd59e2026-10-14
  • R23-11rel:R23-11#50f4cde12026-10-14
  • R24-11rel:R24-11#f0c7c4e12026-10-14
  • R25-11rel:R25-11#f0c7c4e12026-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

函数 ~CryptoContext [SWS_CRYPT_20401] Upstream: RS_CRYPTO_02008

virtual ~CryptoContext () noexcept=default;

Destructor.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext
Exception-Sicherheitexception safe

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

Record
AUTOSAR/AP/record/SWS_CRYPT_20401
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_20401@rel:R25-11#0d140112
Content hash
0d140112
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_20401
Status: valid/unmigrated Version: rel:R25-11#0d1ace43 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_20401@rel:R25-11#0d1ace43
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#a3a37bef2026-09-30
  • R20-11rel:R20-11#0a163ac42026-10-14
  • R21-11rel:R21-11#5ba66c7c2026-10-14
  • R22-11rel:R22-11#91bc35ba2026-10-14
  • R23-11rel:R23-11#40c1b8e32026-10-14
  • R24-11rel:R24-11#66216e1d2026-10-14
  • R25-11rel:R25-11#0d1ace432026-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