DEENESPTFRRUARHIKOZHNL

类 ara::crypto::cryp::SignerPrivateCtx

[SWS_CRYPT_23500] Upstream: RS_CRYPTO_02204

class SignerPrivateCtx :             public CryptoContext {...};

Signature Private key Context interface.

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

用户指南人工智能生成

用于在单步或流式过程中使用私有加密密钥创建数字签名。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: bdc0b85a137f 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用于在单步或流式过程中使用私有加密密钥创建数字签名。

接口 ara::crypto::cryp::SignerPrivateCtx 封装了 Adaptive Platform 上用于数字签名操作的私钥 [SWS_CRYPT_23501]。通过 SetKey() 配置密钥后,消息既可以通过 Sign() 在单步中签名,也可以通过 Start()、Update() 和 Finish() 进行多阶段签名 [SWS_CRYPT_23515] [SWS_CRYPT_23512] [SWS_CRYPT_50040]。所有调用均是线程安全的,并通过 ara::core::Result [SWS_CRYPT_50040] 发出缓冲区容量不足或无效上下文状态等错误信号。

上下文

接口 ara::crypto::cryp::SignerPrivateCtx 表示在 AUTOSAR Adaptive Platform 上使用私钥执行数字签名操作的加密执行上下文。该类继承自 CryptoContext 并封装了非对称签名算法。为了绑定所需的密钥材料,上下文既可以通过 PrivateKey::Sptr [SWS_CRYPT_23515] 直接与私钥对象交互,也可以通过 KeySlot::Sptr [SWS_CRYPT_50036] 与受管密钥插槽交互。调用方通常通过定义的智能指针类型别名 ara::crypto::cryp::SignerPrivateCtx::Sptr [SWS_CRYPT_23501] 来管理此接口的实例。

生命周期

SignerPrivateCtx 的实例作为有状态对象运行,并通过共享指针结构(std::shared_ptr)进行管理 [SWS_CRYPT_23501]。在执行加密计算之前,该实例处于未初始化状态,并要求分配匹配的密钥。通过方法 SetKey(),可以为上下文分配具体的私钥 [SWS_CRYPT_23515],或者存入一个 KeySlot,其密钥值将在签名计算开始时被采用 [SWS_CRYPT_50036]。一旦成功绑定密钥,上下文即转入就绪状态。所有接口方法均被指定为异常安全(exception safe)和线程安全(thread-safe)[SWS_CRYPT_23512] [SWS_CRYPT_50037]。

在数据处理内部,该接口区分单次签名与多阶段流式处理。流式签名操作由 Start() 发起 [SWS_CRYPT_50037] [SWS_CRYPT_50038],通过 Update() 逐步提供数据块 [SWS_CRYPT_50039],并通过 Finish() 结束 [SWS_CRYPT_50040]。或者,可以随时通过 Cancel() 中止正在进行的流式处理,从而使实例返回就绪状态 [SWS_CRYPT_50041]。

SignerPrivateCtxStates Uninitialized Uninitialized Ready Ready Uninitialized->Ready SetKey() Ready->Ready Sign() / SetKey() Streaming Streaming Ready->Streaming Start() Streaming->Ready Finish() / Cancel() Streaming->Streaming Update()

状态图:签名上下文从配置到操作完成的状态转换。来源:[SWS_CRYPT_23515]、[SWS_CRYPT_50036]、[SWS_CRYPT_23512]、[SWS_CRYPT_50037]、[SWS_CRYPT_50039]、[SWS_CRYPT_50040]、[SWS_CRYPT_50041]

使用路径

应用程序既可以在单步(Single-Call)中生成签名,也可以将其作为连续数据流(Streaming)生成。在执行之前,应用程序通过 GetSignatureSize() 确定所需签名格式的预期缓冲区大小 FormatId [SWS_CRYPT_29004],并通过 GetMaximumChunkSize() 确定单次读取操作的最大允许块大小 [SWS_CRYPT_50042]。

在单步路径中,完整消息通过 Sign() 直接签名。该方法接收输入消息、目标缓冲区 ReadWriteMemRegion、签名格式以及可选的特定于算法的上下文值,并返回实际写入的字节数 [SWS_CRYPT_23512]。

对于较大的数据量或分段消息,流式路径遵循三阶段模式:

  1. 初始化:调用不带参数 [SWS_CRYPT_50037] 的 Start(),或带有应用程序特定上下文缓冲区 ReadOnlyMemRegion [SWS_CRYPT_50038]。
  2. 处理:通过 Update() 重复提供部分消息,其中每个块必须遵守 GetMaximumChunkSize() 给出的上限 [SWS_CRYPT_50039] [SWS_CRYPT_50042]。
  3. 完成或中止:通过 Finish() [SWS_CRYPT_50040] 完成签名生成并写入目标存储器,或使用 Cancel() [SWS_CRYPT_50041] 提前中止正在进行的过程。
使用 SignerPrivateCtx 进行流式签名生成ApplicationSignerPrivateCtxSetKey(key)Result<void>GetSignatureSize(signatureFormat)Result<size_t>Start()Result<void>loop针对每个数据块(Chunk)Update(chunk)Result<void>Finish(signatureBuffer, signatureFormat)Result<size_t>

时序图:包含缓冲区检查和完成的流式签名创建的典型流程。来源:[SWS_CRYPT_23515]、[SWS_CRYPT_29004]、[SWS_CRYPT_50037]、[SWS_CRYPT_50039]、[SWS_CRYPT_50040]

错误场景

方法调用默认返回 ara::core::Result,并在失败时使用来自 ara::crypto::CryptoErrc 具有回滚语义的标准化错误代码。常见的错误原因包括:

本指南仅基于 Release R25-11 中 crypto 模块的 AUTOSAR Adaptive 规范要求。

成员图

类图

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

G nara__crypto__cryp__SignerPrivateCtx943 SignerPrivateCtx + Cancel() + Finish() + GetMaximumChunkSize() + GetSignatureSize() + SetKey() + Sign() + Start() + Update() nara__crypto__cryp__CryptoContext85 CryptoContext nara__crypto__cryp__SignerPrivateCtx943->nara__crypto__cryp__CryptoContext85

详细视图

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

方法

Cancel 函数

Cancel the ongoing streaming operation that has been initiated by Start() and has not yet been finished.

virtual ara::core::Result< void > Cancel () noexcept=0;
Finish 函数

Finish the signature generation and write the signature to the provided output buffer.

virtual ara::core::Result< size_t > Finish (ReadWriteMemRegion signature, FormatId signatureFormat) noexcept=0;

Get the maximum input buffer size supported for processing in single calls to Update() or Sign() by this context.

virtual ara::core::Result< std::size_t > GetMaximumChunkSize () const noexcept=0;

Get size of the signature value produced by the current algorithm in the provided format.

virtual ara::core::Result< std::size_t > GetSignatureSize (FormatId signatureFormat) const noexcept=0;
SetKey 函数 2

Configure the context to use the provided key.

重载 SetKey 2
virtual ara::core::Result< void > SetKey (PrivateKey::Sptr key) noexcept=0; SWS_CRYPT_23515
virtual ara::core::Result< void > SetKey (KeySlot::Sptr keySlot) noexcept=0; SWS_CRYPT_50036
Sign 函数

This function signs a message.

virtual ara::core::Result< std::size_t > Sign (ReadOnlyMemRegion message, ReadWriteMemRegion signature, FormatId signatureFormat, ara::core::Optional< ReadOnlyMemRegion > context) const noexcept=0;
Start 函数 2

Initialize the context for a new signature generation.

重载 Start 2
virtual ara::core::Result< void > Start () noexcept=0; SWS_CRYPT_50037
virtual ara::core::Result< void > Start (ReadOnlyMemRegion context) noexcept=0; SWS_CRYPT_50038
Update 函数

Update the signature generation context by a new part of the message.

virtual ara::core::Result< void > Update (ReadOnlyMemRegion data) noexcept=0;

类型别名

Sptr 类型别名

Smart pointer of the interface.

方法文档

函数 Cancel [SWS_CRYPT_50041] Upstream: RS_CRYPTO_02302

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

Cancel the ongoing streaming operation that has been initiated by Start() and has not yet been finished.

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

方法 Cancel() 用于在类 ara::crypto::cryp::SignerPrivateCtx 内部同步中止正在进行且尚未完成的流式传输操作,该操作先前通过调用 Start() 启动 [SWS_CRYPT_50041]。纯虚接口 virtual ara::core::Result<void> Cancel() noexcept = 0; 在头文件 ara/crypto/cryp/signer_private_ctx.h 中声明,不接受任何传入参数,并通过空的 ara::core::Result<void> [SWS_CRYPT_50041] 指示成功中止。对于调用方而言,该方法被指定为异常安全的(exception safe)且并发线程安全的(thread-safe)[SWS_CRYPT_50041]。

关于调用顺序和错误处理,Cancel() 强制要求必须存在活动处理:如果此前未通过调用方法 Start() 启动数据处理,则中止将失败,并返回具有定义的回滚语义的错误代码 ara::crypto::CryptoErrc::kProcessingNotStarted [SWS_CRYPT_50041]。解释:在成功调用 Cancel() 之后,上下文推测会恢复到未启动的初始状态,以便可以开始新的签名或流过程。 问题 Q-348fb3ae43e424c9 (未决)

该设计遵循加密模块中所有流操作的统一原则。对于相关上下文,存在完全相同的签名和错误语义,如 VerifierPublicCtx [SWS_CRYPT_50023]、MessageAuthnCodeCtx [SWS_CRYPT_50027]、SymmetricCipherCtx [SWS_CRYPT_50046]、HashFunctionCtx [SWS_CRYPT_50058]、DecryptorPrivateCtx [SWS_CRYPT_50069]、AuthCipherCtx [SWS_CRYPT_50077] 以及 EncryptorPublicCtx [SWS_CRYPT_50089]。

本使用说明基于 AUTOSAR Adaptive 的规范要求自动生成。

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

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

Rückgabewert

TypBeschreibung
ara::core::Result< void >an empty result if the ongoing streaming operation was cancelled successfully, or a result containing an error

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kProcessingNotStartedrollback_semantics if data processing was not started by a call of the Start() method

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

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

函数 Finish [SWS_CRYPT_50040] Upstream: RS_CRYPTO_02302, RS_CRYPTO_02203

virtual ara::core::Result< size_t > Finish (ReadWriteMemRegion signature, FormatId signatureFormat) noexcept=0;

Finish the signature generation and write the signature to the provided output buffer.

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

使用

方法 ara::crypto::cryp::SignerPrivateCtx::Finish 同步完成签名生成,并将计算出的签名直接写入所提供的输出缓冲区 signature [SWS_CRYPT_50040]。该函数期待可写内存区域 signature(类型 ReadWriteMemRegion)和所需格式 signatureFormat(类型 FormatId)作为传入参数 [SWS_CRYPT_50040]。ara::core::Result<size_t> 返回所写入签名数据的实际字节大小作为返回值;该数据量可以小于目标缓冲区的容量 [SWS_CRYPT_50040]。

错误处理

针对所有发生的错误情况,均指定了回滚语义 [SWS_CRYPT_50040]。可以通过结果返回以下错误代码:

  • ara::crypto::CryptoErrc::kProcessingNotStarted:签名生成此前未成功启动 [SWS_CRYPT_50040]。
  • ara::crypto::CryptoErrc::kInsufficientCapacity:传入的输出缓冲区 signature 的容量过小 [SWS_CRYPT_50040]。
  • ara::crypto::CryptoErrc::kUnsupportedFormat:signatureFormat 的值未知或不受支持 [SWS_CRYPT_50040]。

并发性与限制

该方法被指定为 thread-safe 和 exception safe,且不得抛出异常 (noexcept) [SWS_CRYPT_50040]。有效调用的绝对先决条件是上下文中的生成过程此前已成功启动 [SWS_CRYPT_50040]。

相互作用

验证所生成签名的直接功能对应项是方法 ara::crypto::cryp::VerifierPublicCtx::Finish [SWS_CRYPT_50022]。与哈希或 MAC 计算的上下文相比(在这些上下文中 Finish() 仅完成计算,而中间或最终结果是单独获取的 [SWS_CRYPT_21115] [SWS_CRYPT_21116]),SignerPrivateCtx::Finish 会将签名直接写入缓冲区 [SWS_CRYPT_50040]。

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

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

Parameter (in)

ParameterBeschreibung
signaturean output buffer that the signature will be written into
signatureFormatthe format in which the signature will be written

Rückgabewert

TypBeschreibung
ara::core::Result< size_t>a result containing the size of the output data or an error. The output data may be smaller than the size of the output buffer signature.

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kProcessingNotStartedrollback_semantics if the signature generation has not been started successfully.
ara::crypto::CryptoErrc::kInsufficientCapacityrollback_semantics if the output buffer is too small
ara::crypto::CryptoErrc::kUnsupportedFormatrollback_semantics if the specified FormatId is unknown or not supported

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50040
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50040@rel:R25-11#989eb587
Content hash
989eb587
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50040
Status: valid/unmigrated Version: rel:R25-11#58202823 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_50040@rel:R25-11#58202823
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

函数 GetMaximumChunkSize [SWS_CRYPT_50042] Upstream: RS_CRYPTO_02309

virtual ara::core::Result< std::size_t > GetMaximumChunkSize () const noexcept=0;

Get the maximum input buffer size supported for processing in single calls to Update() or Sign() by this context.

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

Rückgabewert

TypBeschreibung
ara::core::Result<std::size_t >the maximum buffer size in bytes

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_50042
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50042@rel:R25-11#1e2ba1d1
Content hash
1e2ba1d1
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50042
Status: valid/unmigrated Version: rel:R25-11#a4caf357 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_50042@rel:R25-11#a4caf357
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

函数 GetSignatureSize [SWS_CRYPT_29004] Upstream: RS_CRYPTO_02309

virtual ara::core::Result< std::size_t > GetSignatureSize (FormatId signatureFormat) const noexcept=0;

Get size of the signature value produced by the current algorithm in the provided format.

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

Parameter (in)

ParameterBeschreibung
signatureFormatthe format for which the size of the signature will be calculated

Rückgabewert

TypBeschreibung
ara::core::Result<std::size_t >size of the signature value in bytes or an error

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedFormatrollback_semantics if the specified FormatId is unknown or not supported

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

Record
AUTOSAR/AP/record/SWS_CRYPT_29004
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_29004@rel:R25-11#18363a98
Content hash
18363a98
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_29004
Status: valid/unmigrated Version: rel:R25-11#5dd47914 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_29004@rel:R25-11#5dd47914
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#1da381032026-09-30
  • R20-11rel:R20-11#2a4501722026-10-14
  • R21-11rel:R21-11#d0e232c92026-10-14
  • R22-11rel:R22-11#68e2b9122026-10-14
  • R23-11rel:R23-11#260fdd9b2026-10-14
  • R24-11rel:R24-11#f3c2ba002026-10-14
  • R25-11rel:R25-11#5dd479142026-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_23515] Upstream: RS_CRYPTO_02001, RS_CRYPTO_02003

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

Configure the context to use the provided key.

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

使用

类 ara::crypto::cryp::SignerPrivateCtx 的虚方法 SetKey(#include "ara/crypto/cryp/signer_private_ctx.h")配置签名上下文以使用提供的私钥 [SWS_CRYPT_23515]。类型为 PrivateKey::Sptr 的 key 作为源密钥对象被传递为参数 [SWS_CRYPT_23515]。该方法同步执行并返回一个 ara::core::Result<void>,其在成功时为空,或在失败时传递发生的错误码 [SWS_CRYPT_23515]。

错误处理

如果在配置期间发生错误,将应用回滚语义 [SWS_CRYPT_23515]。指定了以下错误码:

  • ara::crypto::CryptoErrc::kIncompatibleObject:传入的密钥对象与当前上下文不兼容 [SWS_CRYPT_23515]。
  • ara::crypto::CryptoErrc::kUsageViolation:该密钥的允许用途不包括签名生成(kAllowSig Generation)[SWS_CRYPT_23515]。
  • ara::crypto::CryptoErrc::kUnsupported:特定上下文仅支持通过 KeySlot 进行设置 [SWS_CRYPT_23515]。

并发性与限制

该接口被声明为 noexcept,并根据规范被归类为既异常安全(“exception safe”)又线程安全(“thread-safe”)[SWS_CRYPT_23515]。

相互作用

在 SignerPrivateCtx 中或者存在重载 SetKey(KeySlot::Sptr),它对上下文进行配置,使得存储在 KeySlot 中的密钥直到签名计算开始时才被使用 [SWS_CRYPT_50036]。在验证端,ara::crypto::cryp::VerifierPublicCtx 内带有 PublicKey::Sptr 的功能对应项 SetKey 用于检查签名 [SWS_CRYPT_24115]。

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

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

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

Parameter (in)

ParameterBeschreibung
keythe source key 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 context
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the key does not include kAllowSig Generation
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_23515
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_23515@rel:R25-11#212b2998
Content hash
212b2998
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_23515
Status: valid/unmigrated Version: rel:R25-11#71952992 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_23515@rel:R25-11#71952992
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#95d92ab72026-09-30
  • R20-11rel:R20-11#e3c992392026-10-14
  • R21-11rel:R21-11#601e899c2026-10-14
  • R22-11rel:R22-11#a52d4de52026-10-14
  • R23-11rel:R23-11#4a68f6e92026-10-14
  • R24-11rel:R24-11#2c23797e2026-10-14
  • R25-11rel:R25-11#719529922026-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_50036] 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 signature calculation is started.

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

使用

方法 SetKey 配置签名上下文 [SWS_CRYPT_50036] 以使用位于所传递 KeySlot::Sptr 中的密钥。该密钥仅在实际启动签名计算的时间点才被使用 [SWS_CRYPT_50036]。该调用同步进行,声明为 noexcept,并返回一个 ara::core::Result<void> [SWS_CRYPT_50036]。

错误处理

若配置失败,则在返回对象中传递错误,此时适用回滚语义 [SWS_CRYPT_50036]:

  • ara::crypto::CryptoErrc::kIncompatibleObject:在所提供的 keySlot 与此签名上下文不兼容时发生 [SWS_CRYPT_50036]。
  • ara::crypto::CryptoErrc::kUnsupported:如果上下文仅支持直接设置 PrivateKey,则会报告该错误 [SWS_CRYPT_50036]。

并发性与交互

该接口属于类 ara::crypto::cryp::SignerPrivateCtx,并被指定为 thread-safe 以及 exception-safe [SWS_CRYPT_50036]。除了这种基于插槽的变体之外,SignerPrivateCtx 还提供了一个直接接收 PrivateKey::Sptr 对象的重载 [SWS_CRYPT_23515]。类似的插槽绑定也存在于其他密码上下文中,例如在 VerifierPublicCtx 中用于带有 KeySlot 的签名校验 [SWS_CRYPT_50018],或在 KeyDerivationFunctionCtx 中用于密钥派生 [SWS_CRYPT_50010]。

本段文本由 AI 生成,旨在提供参考指引。具有约束力的是 AUTOSAR 规范。

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

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

Parameter (in)

ParameterBeschreibung
keySlota keyslot containing a private 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 PrivateKey

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50036
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50036@rel:R25-11#3c5cc4a9
Content hash
3c5cc4a9
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50036
Status: valid/unmigrated Version: rel:R25-11#26b40256 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_50036@rel:R25-11#26b40256
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

函数 Sign [SWS_CRYPT_23512] Upstream: RS_CRYPTO_02204

virtual ara::core::Result< std::size_t > Sign (ReadOnlyMemRegion message, ReadWriteMemRegion signature, FormatId signatureFormat, ara::core::Optional< ReadOnlyMemRegion > context) const noexcept=0;

This function signs a message.

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

方法 Sign 按照 [SWS_CRYPT_23512] 在单一步骤中对消息进行同步签名。它接收待签名的输入消息(message)、目标缓冲区(signature)、所需的签名格式(signatureFormat)以及可选的上下文值(context)。成功时,该函数通过 ara::core::Result<std::size_t> 返回生成的签名的实际字节大小,该大小可能小于目标缓冲区的容量 [SWS_CRYPT_23512]。

在并发性和异常安全性方面,该方法声明为 noexcept,视为 exception safe,并显式指定为 thread-safe [SWS_CRYPT_23512]。

在调用之前,必须使用密钥值正确初始化上下文;否则将报告 UninitializedContext [SWS_CRYPT_23512]。关于输入长度,Sign 与 [SWS_CRYPT_50042] 协同配合:可以通过 GetMaximumChunkSize 确定用于单步处理的最大支持缓冲区大小,以防范如 ara::crypto::CryptoErrc::kInvalidInputSize 之类的错误 [SWS_CRYPT_23512] [SWS_CRYPT_50042]。

错误处理为特定错误码规定了回滚语义 [SWS_CRYPT_23512]:

  • ara::crypto::CryptoErrc::kInsufficientCapacity:输出缓冲区 signature 过小。
  • ara::crypto::CryptoErrc::kUnsupported:不支持单步处理,或者上下文规范 context 不符合规定。
  • ara::crypto::CryptoErrc::kUnsupportedFormat:指定的 FormatId 未知或不受支持。
  • ara::crypto::CryptoErrc::kUsageViolation:允许的密钥用途不包含 kAllowSig Generation。
  • ara::crypto::CryptoErrc::kEmptyKeySlot 或 ara::crypto::CryptoErrc::kBusyResource:配置的 KeySlot 为空,或所需资源被占用。

本使用说明系自动生成,基于 AUTOSAR 规范的规定。

Header-Datei#include "ara/crypto/cryp/signer_private_ctx.h"
Scopeclass ara::crypto::cryp::SignerPrivateCtx
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe ara::crypto::CryptoErrc::k rollback_semantics

Parameter (in)

ParameterBeschreibung
messagean input buffer containing the message to be signed
signatureFormatthe format in which the signature will be written
contextan optional "context" value

Parameter (out)

ParameterBeschreibung
signaturean output buffer that the signature will be written into

Rückgabewert

TypBeschreibung
ara::core::Result<std::size_t >a result containing the size of the output data or an error. The output data may be smaller than the size of the output buffer signature.

Fehler

FehlercodeBeschreibung
UninitializedContextif the context was not initialized by a key value
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if single-call processing is not supported, or if the context requires setting a context but no context is provided, or if the context does not support setting a context but a context is provided
ara::crypto::CryptoErrc::kInsufficientCapacityrollback_semantics if the output buffer is too small
ara::crypto::CryptoErrc::kInvalidInputSizerollback_semantics if the size of the input buffer is invalid
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 kAllowSig Generation
ara::crypto::CryptoErrc::kUnsupportedFormatrollback_semantics if the specified FormatId is unknown or not supported

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

Record
AUTOSAR/AP/record/SWS_CRYPT_23512
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_23512@rel:R25-11#f689d338
Content hash
f689d338
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_23512
Status: valid/unmigrated Version: rel:R25-11#bc8b5705 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_23512@rel:R25-11#bc8b5705
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#a06a44132026-09-30
  • R19-11rel:R19-11#78781cac2026-10-14
  • R20-11rel:R20-11#1b96176f2026-10-14
  • R21-11rel:R21-11#f8f46bec2026-10-14
  • R22-11rel:R22-11#8b3d99122026-10-14
  • R23-11rel:R23-11#e3aedff12026-10-14
  • R24-11rel:R24-11#2e8d11c12026-10-14
  • R25-11rel:R25-11#bc8b57052026-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

函数 Start [SWS_CRYPT_50037] Upstream: RS_CRYPTO_02302

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

Initialize the context for a new signature generation.

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

无参数方法 Start 初始化类 ara::crypto::cryp::SignerPrivateCtx 的上下文以进行新的签名生成 [SWS_CRYPT_50037]。该调用同步进行,声明为 noexcept,并在初始化成功时返回一个空的 ara::core::Result<void>,或者在出错时返回一个错误代码 [SWS_CRYPT_50037]。

在出错时,该操作支持回滚语义 [SWS_CRYPT_50037]。来自 ara::crypto::CryptoErrc 的已定义错误原因包括:

  • kUninitializedContext:上下文事先未通过提供密钥进行初始化 [SWS_CRYPT_50037]。
  • kEmptyKeySlot:配置的密钥插槽当前为空 [SWS_CRYPT_50037]。
  • kUsageViolation:所分配密钥的权限不包含 kAllowSigGeneration [SWS_CRYPT_50037]。
  • kBusyResource:该操作所需的一项资源被占用 [SWS_CRYPT_50037]。
  • kUnsupported:上下文不支持流式处理,或者签名算法强制要求指定上下文值 [SWS_CRYPT_50037]。

根据规范,该函数是 thread-safe 以及 exception safe 的 [SWS_CRYPT_50037]。若算法需要特定的上下文值,则必须改用重载变体 Start(ReadOnlyMemRegion context) [SWS_CRYPT_50038]。在成功调用 Start 后,可以通过 Update 连续处理待签名的消息部分 [SWS_CRYPT_50039]。

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

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

Header-Datei#include "ara/crypto/cryp/signer_private_ctx.h"
Scopeclass ara::crypto::cryp::SignerPrivateCtx
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe ara::crypto::CryptoErrc::k rollback_semantics

Rückgabewert

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

Fehler

FehlercodeBeschreibung
UninitializedContextif the context was not initialized by deploying a key
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context does not support streaming or the algorithm requires setting a context value
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 kAllowSig Generation

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50037
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50037@rel:R25-11#0bd3ca1a
Content hash
0bd3ca1a
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50037
Status: valid/unmigrated Version: rel:R25-11#2ee5d052 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_50037@rel:R25-11#2ee5d052
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

函数 Start [SWS_CRYPT_50038] Upstream: RS_CRYPTO_02302

virtual ara::core::Result< void > Start (ReadOnlyMemRegion context) noexcept=0;

Initialize the context for a new signature generation.

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

方法 Start 用于在提供上下文值的情况下,同步初始化用于新签名生成的上下文 ara::crypto::cryp::SignerPrivateCtx ([SWS_CRYPT_50038])。它接收类型为 ReadOnlyMemRegion 的参数 context,并返回一个 ara::core::Result<void>。该函数被指定为 noexcept=0,并被声明为异常安全以及线程安全 ([SWS_CRYPT_50038])。

在发生错误时,上下文状态通过回滚语义保持不变 ([SWS_CRYPT_50038])。指定的错误原因包括:

  • UninitializedContext:如果上下文之前未通过提供密钥进行初始化。
  • ara::crypto::CryptoErrc::kUnsupported:如果上下文不支持流式处理,或者算法不允许上下文值。
  • ara::crypto::CryptoErrc::kInvalidInputSize:如果传入的上下文值的缓冲区大小无效。
  • ara::crypto::CryptoErrc::kEmptyKeySlot:如果配置的密钥槽当前为空。
  • ara::crypto::CryptoErrc::kUsageViolation:如果密钥的允许用途不包含签名生成 (kAllowSig Generation)。
  • ara::crypto::CryptoErrc::kBusyResource:如果所需资源被占用。

在典型的处理流程中,待签名的数据在成功启动后大概会相继通过 Update ([SWS_CRYPT_50039]) 传递。 问题 Q-7b821391730c9d38 (未决)若加密方案不需要上下文值,则可替代使用无参数重载 Start() ([SWS_CRYPT_50037])。

本使用说明基于 AUTOSAR 规范自动创建。

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

Header-Datei#include "ara/crypto/cryp/signer_private_ctx.h"
Scopeclass ara::crypto::cryp::SignerPrivateCtx
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe ara::crypto::CryptoErrc::k rollback_semantics

Parameter (in)

ParameterBeschreibung
contexta context value

Rückgabewert

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

Fehler

FehlercodeBeschreibung
UninitializedContextif the context was not initialized by deploying a key
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if the context does not support streaming or the algorithm does not support setting a context value
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 kAllowSig Generation
ara::crypto::CryptoErrc::kInvalidInputSizerollback_semantics if the size of the context is invalid

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50038
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50038@rel:R25-11#15f187b0
Content hash
15f187b0
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50038
Status: valid/unmigrated Version: rel:R25-11#0f9c636d 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_50038@rel:R25-11#0f9c636d
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

函数 Update [SWS_CRYPT_50039] Upstream: RS_CRYPTO_02302

virtual ara::core::Result< void > Update (ReadOnlyMemRegion data) noexcept=0;

Update the signature generation context by a new part of the message.

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

方法 Update 在 [SWS_CRYPT_50039] 中用于通过消息的另一个分段连续扩展签名计算的内部状态。该调用同步进行,并处理类型为 ReadOnlyMemRegion 的所传递内存区域 data。作为结果,该函数提供一个 ara::core::Result<void>,其在成功处理时不包含任何值,或者在其他情况下封装一个错误代码 [SWS_CRYPT_50039]。

在出错时,返回值具有回滚语义 [SWS_CRYPT_50039]:

  • ara::crypto::CryptoErrc::kProcessingNotStarted:在签名计算事先未通过调用方法 Start() 启动时发生 [SWS_CRYPT_50039]。
  • ara::crypto::CryptoErrc::kInvalidInputSize:如果上下文不支持所提供输入数据的大小,则会报告该错误 [SWS_CRYPT_50039]。

关于并发性与安全性,该方法被声明为 thread-safe 以及 exception safe [SWS_CRYPT_50039]。在与签名上下文的交互中,计算强制要求该流程已通过 Start() 启动。单个调用的最大允许缓冲区大小可通过 GetMaximumChunkSize() 查询 [SWS_CRYPT_50042];该限值预计表示上限,超过该上限会导致 kInvalidInputSize。 问题 Q-cf204a853a730365 (未决)

注意:本使用说明基于 AUTOSAR 标准 R25-11 自动生成。

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

Parameter (in)

ParameterBeschreibung
dataa part of the input message that should be processed

Rückgabewert

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

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kProcessingNotStartedrollback_semantics if the signature calculation was not initiated by a call of the Start() method
ara::crypto::CryptoErrc::kInvalidInputSizerollback_semantics if the size of provided data is not supported

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50039
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50039@rel:R25-11#c49b59ac
Content hash
c49b59ac
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50039
Status: valid/unmigrated Version: rel:R25-11#5d5cf894 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_50039@rel:R25-11#5d5cf894
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_23501] Upstream: RS_CRYPTO_02204

using Sptr = std::shared_ptr<SignerPrivateCtx>;

Smart pointer of the interface.

Header-Datei#include "ara/crypto/cryp/signer_private_ctx.h"
Scopeclass ara::crypto::cryp::SignerPrivateCtx
SymbolSptr

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

Record
AUTOSAR/AP/record/SWS_CRYPT_23501
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_23501@rel:R25-11#063e6840
Content hash
063e6840
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_23501
Status: valid/unmigrated Version: rel:R25-11#61a401aa 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_23501@rel:R25-11#61a401aa
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#f562001b2026-09-30
  • R19-11rel:R19-11#acb907532026-10-14
  • R20-11rel:R20-11#046264ae2026-10-14
  • R21-11rel:R21-11#046264ae2026-10-14
  • R22-11rel:R22-11#6b63922b2026-10-14
  • R23-11rel:R23-11#0b7610c02026-10-14
  • R24-11rel:R24-11#0b7610c02026-10-14
  • R25-11rel:R25-11#61a401aa2026-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