DEENESPTFRRUARHIKOZHNL

类 ara::crypto::cryp::EncryptorPublicCtx

[SWS_CRYPT_50173] Upstream: RS_CRYPTO_02201

class EncryptorPublicCtx :             public CryptoContext {...};

Interface for asymmetric encryption.

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

用户指南人工智能生成

在单步操作或多分部流式操作中非对称加密数据。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 9ba841f18186 来源 未决问题(2)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

在单步操作或多分部流式操作中非对称加密数据。

该接口用于在 AUTOSAR Adaptive Platform 上非对称加密明文数据,并通过提供的智能指针进行管理 [SWS_CRYPT_50174]。在分配了匹配的公钥后,消息既可以在单个处理流程中紧凑转换,也可以通过多分部流式会话连续转换 [SWS_CRYPT_50090]。为了正确执行,必须预先计算缓冲区大小,其中上下文的所有操作均被指定为异常安全和线程安全。

上下文

C++ 类 ara::crypto::cryp::EncryptorPublicCtx 为 AUTOSAR Adaptive Platform 中的非对称数据加密提供了标准化接口。它供客户端应用程序使用非对称公钥加密明文数据。加密密钥的配置既可以直接通过密钥对象([SWS_CRYPT_50175])进行,也可以通过对密钥存储位置的引用(KeySlot、[SWS_CRYPT_50086])进行。数据传递通过高效利用内存的缓冲区区域进行(ReadOnlyMemRegion 用于明文数据,ReadWriteMemRegion 用于密文输出)。

生命周期

上下文的实例通过类型别名 Sptr 中定义的共享指针 std::shared_ptr<EncryptorPublicCtx> 进行管理([SWS_CRYPT_50174])。创建本身不属于此接口定义的一部分;推测通过加密架构的上层工厂组件进行实例化。 问题 Q-5b7490ba113bb861 (未决)该对象在其生命周期内经历明确定义的状态:

  • 未初始化:实例化后,上下文尚未拥有密钥。在此状态下不允许执行数据处理操作。
  • 已配置(就绪):通过使用 PublicKey([SWS_CRYPT_50175])或 KeySlot([SWS_CRYPT_50086])调用 SetKey(),上下文进入就绪状态。在此状态下,既可以执行单步加密,也可以启动流式会话。
  • 流式处理活动:调用 Start()([SWS_CRYPT_50087])将上下文置于流式状态。连续的数据块通过 Update()([SWS_CRYPT_50176])进行处理。会话要么通过 Finish()([SWS_CRYPT_50088])完成,要么通过 Cancel()([SWS_CRYPT_50089])中止,从而使上下文返回到已配置状态。

该类的所有方法均被指定为异常安全(exception safe)和线程安全(thread-safe)。如果在流式操作尚未结束时销毁上下文,则底层实现可能会清理分配的缓冲区并隐式丢弃该会话。 问题 Q-3eadc946a0bdbdfd (未决)

Lebenszyklus Uninitialized 未初始化 Configured Konfiguriert (Bereit) Uninitialized->Configured SetKey() Configured->Configured SetKey() / Encrypt() Streaming 流媒体活跃 Configured->Streaming Start() Streaming->Configured Finish() / Cancel() Streaming->Streaming Update()

状态图:上下文从配置到转换的生命周期和状态转换。来源:[SWS_CRYPT_50086]、[SWS_CRYPT_50175]、[SWS_CRYPT_50087]、[SWS_CRYPT_50176]、[SWS_CRYPT_50088]、[SWS_CRYPT_50089]、[SWS_CRYPT_50090]

使用路径

该类支持两种处理模式:用于完整数据集的单步处理和用于分段数据流的多步流式处理。在执行加密之前,应用程序必须考虑缓冲区限制:

  • 通过 GetMinimumChunkSize()` (<a class="spec-record-ref" data-req="SWS_CRYPT_50178">[SWS_CRYPT_50178]</a>) und <code>GetMaximumChunkSize()([SWS_CRYPT_50091])可以确定单次调用所支持的最小和最大输入大小。
  • 必须预先使用 GetRequiredOutputBufferSize()([SWS_CRYPT_50177])查询输出缓冲区所需的容量。参数 isFinal 在此控制计算是针对中间步骤(false)还是针对最终调用或单步操作(true)进行。

流式加密的典型流程分为以下步骤:

  1. 使用有效的 PublicKey([SWS_CRYPT_50175])通过 SetKey() 分配密钥。
  2. 通过调用 Start()([SWS_CRYPT_50087])初始化流式会话。
  3. 使用 GetRequiredOutputBufferSize(inputSize, false)([SWS_CRYPT_50177])计算中间块所需的输出缓冲区大小。
  4. 通过 Update()([SWS_CRYPT_50176])重复转换数据块。
  5. 确定最后一个块的缓冲区大小(isFinal = true),并通过 Finish()([SWS_CRYPT_50088])完成操作。

对于可以在单次处理中完成的紧凑数据,Encrypt()([SWS_CRYPT_50090])提供直接的单步调用,而无需划分为启动、更新和完成阶段。

非对称流式加密流程应用EncryptorPublicCtxUse Case: 配置与初始化SetKey(key)Result<void>Start()Result<void>Use Case: Streaming-VerarbeitungGetRequiredOutputBufferSize(inputSize, false)Result<size_t>Update(in, out)Result<size_t>(密文长度)Use Case: AbschlussGetRequiredOutputBufferSize(finalInputSize, true)Result<size_t>Finish(finalIn, out)Result<size_t>(最终密文长度)

时序图:包含缓冲区大小确定的多分部流式加密的典型流程。来源:[SWS_CRYPT_50175]、[SWS_CRYPT_50087]、[SWS_CRYPT_50177]、[SWS_CRYPT_50176]、[SWS_CRYPT_50088]

错误场景

所有方法均使用 ara::core::Result 进行错误指示,并在发生错误时保证回滚语义:

本指南基于 AUTOSAR Adaptive Platform Release R25-11 的要求,并总结了 ara::crypto::cryp::EncryptorPublicCtx 类的规范。

成员图

类图

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

G nara__crypto__cryp__EncryptorPublicCtx829 EncryptorPublicCtx + Cancel() + Encrypt() + Finish() + GetMaximumChunkSize() + GetMinimumChunkSize() + GetRequiredOutputBufferSize() + SetKey() + Start() + Update() nara__crypto__cryp__CryptoContext85 CryptoContext nara__crypto__cryp__EncryptorPublicCtx829->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;
Encrypt 函数

Encrypt data in a single-call.

virtual ara::core::Result< std::size_t > Encrypt (ReadOnlyMemRegion in, ReadWriteMemRegion out) noexcept=0;
Finish 函数

Finalize the encryption.

virtual ara::core::Result< std::size_t > Finish (ReadOnlyMemRegion in, ReadWriteMemRegion out) noexcept=0;

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

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

Get the minimum input buffer size supported for processing in single calls to Update(), Finish(), or Encrypt() by this context.

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

Calculate the maximum required size of the output buffer depending on the input size in the current state of the context.

virtual ara::core::Result< std::size_t > GetRequiredOutputBufferSize (std::size_t inputSize, bool isFinal) const noexcept;
SetKey 函数 2

Configure the context to use the key stored in the provided KeySlot at the time the encryption is started.

重载 SetKey 2
virtual ara::core::Result< void > SetKey (KeySlot::Sptr keySlot) noexcept=0; SWS_CRYPT_50086
virtual ara::core::Result< void > SetKey (PublicKey::Sptr key) noexcept=0; SWS_CRYPT_50175
Start 函数

Initialize the context for a new encryption.

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

Encrypt a data buffer.

virtual ara::core::Result< std::size_t > Update (ReadOnlyMemRegion in, ReadWriteMemRegion out) noexcept=0;

类型别名

Sptr 类型别名

Smart pointer of the interface.

方法文档

函数 Cancel [SWS_CRYPT_50089] 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 · 温度: 不可控 · 提示词: c2111af75063 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

方法 Cancel() 中止上下文 ara::crypto::cryp::EncryptorPublicCtx 中活动的流式操作,该操作先前通过 Start() 启动且尚未结束 [SWS_CRYPT_50089]。它不接受任何传入参数,并返回一个在成功情况下为空的 ara::core::Result<void> [SWS_CRYPT_50089]。由于该签名直接提供 Result 而非 Future,因此中止可能是同步执行的。 问题 Q-cd18e56d693fe1a4 (未决)

错误处理与并发

如果数据处理未事先通过 Start() 启动,则该操作在遵循回滚语义的情况下失败,并带有错误代码 ara::crypto::CryptoErrc::kProcessingNotStarted [SWS_CRYPT_50089]。根据规范,该接口声明为 noexcept,具有异常安全性(exception safe),且针对并发访问被归类为线程安全(thread-safe)[SWS_CRYPT_50089]。

加密栈中的相互作用

通过 Cancel() 实现的中止行为遵循加密模块中有状态流式操作的统一设计模式。具有相同错误语义的类似接口存在于:

此文本由 AI 创建,基于 AUTOSAR Adaptive R25-11。

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

Header-Datei#include "ara/crypto/cryp/encryptor_public_ctx.h"
Scopeclass ara::crypto::cryp::EncryptorPublicCtx
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_50089
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50089@rel:R25-11#ad66ceca
Content hash
ad66ceca
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50089
Status: valid/unmigrated Version: rel:R25-11#e205d10b 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_50089@rel:R25-11#e205d10b
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

函数 Encrypt [SWS_CRYPT_50090] Upstream: RS_CRYPTO_02302

virtual ara::core::Result< std::size_t > Encrypt (ReadOnlyMemRegion in, ReadWriteMemRegion out) noexcept=0;

Encrypt data in a single-call.

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

同步方法 Encrypt 用于在单个调用中加密明文数据([SWS_CRYPT_50090])。它从缓冲区 in(ReadOnlyMemRegion)接收输入数据,并将密文写入输出缓冲区 out(ReadWriteMemRegion)([SWS_CRYPT_50090])。在成功的情况下,返回值 ara::core::Result<std::size_t> 提供实际写入的输出数据大小,该大小可能小于 out 的总容量([SWS_CRYPT_50090])。

在并发性方面,该函数被指定为线程安全(thread-safe)以及异常安全(exception safe)([SWS_CRYPT_50090])。

在与上下文 EncryptorPublicCtx 配合使用时,调用前必须注意以下缓冲区边界:

  • 输入大小必须在 [SWS_CRYPT_50178](GetMinimumChunkSize)和 [SWS_CRYPT_50091](GetMaximumChunkSize)指定的限制范围内。
  • 输出缓冲区 out 的最大所需容量可预先通过带有参数 isFinal = true 的 GetRequiredOutputBufferSize 进行计算([SWS_CRYPT_50177])。

所有错误情况均具有回滚语义([SWS_CRYPT_50090])。来自 ara::crypto::CryptoErrc 的已定义错误包括:

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

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

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

Parameter (in)

ParameterBeschreibung
inan input data buffer containing the plaintext

Parameter (out)

ParameterBeschreibung
outan output data buffer that the encrypted data is written to

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 out.

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUninitializedContextrollback_semantics if the context was not initialized by deploying a key
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if single-call encryption is not supported
ara::crypto::CryptoErrc::kInsufficientCapacityrollback_semantics if the output buffer is too small
ara::crypto::CryptoErrc::kInvalidInputSizerollback_semantics if the size of the input buffer cannot be processed
ara::crypto::CryptoErrc::kInvalidArgumentrollback_semantics if the provided input data contains invalid data
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 kAllowData Encryption
ara::crypto::CryptoErrc::kIncompatibleObjectrollback_semantics if type of the key is incompatible to the transformation

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50090
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50090@rel:R25-11#662e49fc
Content hash
662e49fc
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50090
Status: valid/unmigrated Version: rel:R25-11#6de65ef2 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_50090@rel:R25-11#6de65ef2
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_50088] Upstream: RS_CRYPTO_02302

virtual ara::core::Result< std::size_t > Finish (ReadOnlyMemRegion in, ReadWriteMemRegion out) noexcept=0;

Finalize the encryption.

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

使用

方法 Finish 结束 ara::crypto::cryp::EncryptorPublicCtx 上下文中的非对称加密过程 [SWS_CRYPT_50088]。调用同步进行,并被指定为 noexcept、异常安全以及线程安全。作为参数,该函数通过 in(ReadOnlyMemRegion)接收结束明文片段,并将生成的密文数据写入输出缓冲区 out(ReadWriteMemRegion)。out 所需的缓冲区大小可预先通过 GetRequiredOutputBufferSize() 确定。在成功的情况下,返回值 ara::core::Result<std::size_t> 提供实际写入的字节数,该字节数可能小于输出缓冲区的总容量 [SWS_CRYPT_50088]。

错误处理与并发

所有错误情况都具有回滚语义,因此上下文状态在失败时保持一致 [SWS_CRYPT_50088]。该方法报告来自 ara::crypto::CryptoErrc 的以下特定错误代码:

  • kProcessingNotStarted:此前未通过调用 Start() 启动数据处理。
  • kInsufficientCapacity:提供的输出缓冲区 out 尺寸过小。
  • kInvalidInputSize:in 的缓冲区大小无法被上下文处理。
  • kInvalidArgument:传入的输入数据包含无效值。
  • kUnsupported:具体上下文不支持流式处理。

相互作用

终结操作结束加密处理流程 [SWS_CRYPT_50088]。作为解密的互补对等物由 DecryptorPrivateCtx::Finish [SWS_CRYPT_50068] 担任,而在对称加密领域,SymmetricCipherCtx::Finish [SWS_CRYPT_50045] 提供了类似的处理模式。

该文本由 AI 流程基于规范生成。

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

Parameter (in)

ParameterBeschreibung
inan input data buffer containing a part of the plaintext

Parameter (out)

ParameterBeschreibung
outan output data buffer that contains encrypted data. The required size of this buffer can be queried using GetRequiredOutputBuffer Size()

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 out.

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kProcessingNotStartedrollback_semantics if data processing was not started by a call of the Start() method
ara::crypto::CryptoErrc::kInsufficientCapacityrollback_semantics if the output buffer is too small
ara::crypto::CryptoErrc::kInvalidInputSizerollback_semantics if the size of the input buffer cannot be processed
ara::crypto::CryptoErrc::kInvalidArgumentrollback_semantics if the provided input data contains invalid data
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if stream processing is not supported by the context

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50088
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50088@rel:R25-11#9a322b47
Content hash
9a322b47
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50088
Status: valid/unmigrated Version: rel:R25-11#3b39f5a6 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_50088@rel:R25-11#3b39f5a6
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_50091] 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(), Finish(), or Encrypt() by this context.

Header-Datei#include "ara/crypto/cryp/encryptor_public_ctx.h"
Scopeclass ara::crypto::cryp::EncryptorPublicCtx
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_50091
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50091@rel:R25-11#9eca2583
Content hash
9eca2583
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50091
Status: valid/unmigrated Version: rel:R25-11#45b93821 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_50091@rel:R25-11#45b93821
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

函数 GetMinimumChunkSize [SWS_CRYPT_50178] Upstream: RS_CRYPTO_02309

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

Get the minimum input buffer size supported for processing in single calls to Update(), Finish(), or Encrypt() by this context.

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

Rückgabewert

TypBeschreibung
ara::core::Result<std::size_t >the minimum 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_50178
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50178@rel:R25-11#ade3630c
Content hash
ade3630c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50178
Status: valid/unmigrated Version: rel:R25-11#96524bdd 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_50178@rel:R25-11#96524bdd
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

函数 GetRequiredOutputBufferSize [SWS_CRYPT_50177] Upstream: RS_CRYPTO_02302

virtual ara::core::Result< std::size_t > GetRequiredOutputBufferSize (std::size_t inputSize, bool isFinal) const noexcept;

Calculate the maximum required size of the output buffer depending on the input size in the current state of the context.

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

Parameter (in)

ParameterBeschreibung
inputSizesize of input data
isFinalif true, calculate maximum required output buffer size for Finish() or Encrypt(), otherwise for Update()

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 and setting the transformation direction

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50177
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50177@rel:R25-11#87107dda
Content hash
87107dda
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50177
Status: valid/unmigrated Version: rel:R25-11#7b76dbd4 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_50177@rel:R25-11#7b76dbd4
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_50086] 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 encryption is started.

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

用法与调用上下文

接口 ara::crypto::cryp::EncryptorPublicCtx(头文件 ara/crypto/cryp/encryptor_public_ctx.h)的纯虚方法 SetKey 用于为非对称加密操作分配密钥[SWS_CRYPT_50086]。类型为 KeySlot::Sptr 的智能指针 keySlot 作为参数传递,其中必须包含一个 PublicKey[SWS_CRYPT_50086]。调用同步进行,并通过空的 ara::core::Result<void> 指示成功。对该语义至关重要的是,存储在槽中的密钥仅在加密启动的时间点才会被提取[SWS_CRYPT_50086]。(解释:由于密钥解析仅在实际加密启动时才进行,因此在此启动时间点之前对槽内容的更新可能仍然有效。) 问题 Q-25c5d462aafde8a1 (未决)

错误处理

如果配置失败,将在 Result 对象中返回具有回滚语义的错误码[SWS_CRYPT_50086]:

  • ara::crypto::CryptoErrc::kIncompatibleObject:当提供的 keySlot 与此上下文不兼容时报告[SWS_CRYPT_50086]。
  • ara::crypto::CryptoErrc::kUnsupported:当具体上下文实现仅支持直接设置 PublicKey 且不允许通过 KeySlot 进行密钥绑定时出现[SWS_CRYPT_50086]。

并发性与交互

该操作被声明为 noexcept,被指定为异常安全(exception safe),且在并发使用时被指定为线程安全(thread-safe)[SWS_CRYPT_50086]。

通过 KeySlot 进行间接密钥引用的概念以类似方式也存在于其他非对称上下文中,例如 VerifierPublicCtx::SetKey [SWS_CRYPT_50018] 和 KeyEncapsulatorPublicCtx::SetKey [SWS_CRYPT_50012]。它与直接接收密钥对象的方法(例如在 [SWS_CRYPT_24115] 或 [SWS_CRYPT_21815] 中)有所区别。

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

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

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

Parameter (in)

ParameterBeschreibung
keySlota keyslot containing a PublicKey.

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 PublicKey

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50086
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50086@rel:R25-11#db190df7
Content hash
db190df7
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50086
Status: valid/unmigrated Version: rel:R25-11#bd5ede4d 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_50086@rel:R25-11#bd5ede4d
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_50175] Upstream: RS_CRYPTO_02001, RS_CRYPTO_02003

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

Configure the context to use the provided key.

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

使用

类ara::crypto::cryp::EncryptorPublicCtx的虚方法SetKey配置上下文以使用提供的公钥[SWS_CRYPT_50175]。\n通过参数key(类型为PublicKey::Sptr)传入用于加密的密钥对象[SWS_CRYPT_50175]。\n执行以同步方式进行并返回一个ara::core::Result<void>,成功时其不包含任何值[SWS_CRYPT_50175]。

错误处理

若配置时发生错误,将报告具有明确回滚语义的相应错误代码[SWS_CRYPT_50175]:

  • ara::crypto::CryptoErrc::kUsageViolation:密钥的允许用法不允许数据加密(kAllowDataEncryption)[SWS_CRYPT_50175]。
  • ara::crypto::CryptoErrc::kIncompatibleObject:传入的密钥对象与此加密上下文不兼容[SWS_CRYPT_50175]。
  • ara::crypto::CryptoErrc::kUnsupported:具体上下文实现仅支持通过KeySlot进行绑定[SWS_CRYPT_50175]。

并发性与限制

该接口定义为noexcept,并指定了既 thread-safe 又 exception safe 的行为[SWS_CRYPT_50175]。\n得益于回滚语义,发生错误时上下文将保持在其先前状态。\nInterpretation:成功的调用应是后续加密操作的必要先决条件,因为上下文在没有分配密钥的情况下无法执行操作。 问题 Q-ab4779cac18793fa (未决)

相互作用

该过程遵循非对称上下文的模块级模式,正如在VerifierPublicCtx::SetKey[SWS_CRYPT_24115]和KeyEncapsulatorPublicCtx::SetKey[SWS_CRYPT_21815]中用于密钥绑定一样。\n作为替代,相关接口在配置上也提供了KeySlot变体,例如在VerifierPublicCtx[SWS_CRYPT_50018]或KeyEncapsulatorPublicCtx[SWS_CRYPT_50012]中。

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

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

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

Parameter (in)

ParameterBeschreibung
keythe PublicKey to be used for encryption

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 is incompatible with this context
ara::crypto::CryptoErrc::kUsageViolationrollback_semantics if the allowed usage of the key does not include kAllowData Encryption

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50175
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50175@rel:R25-11#1a363494
Content hash
1a363494
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50175
Status: valid/unmigrated Version: rel:R25-11#52d22e05 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_50175@rel:R25-11#52d22e05
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_50087] Upstream: RS_CRYPTO_02302

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

Initialize the context for a new encryption.

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

用法与语义

类 ara::crypto::cryp::EncryptorPublicCtx 的纯虚方法 Start 用于初始化新加密的上下文 [SWS_CRYPT_50087]。它不接收任何传入参数并同步执行。作为返回值,该函数提供一个 ara::core::Result<void>,该返回值要么确认成功初始化,要么传递发生的错误代码 [SWS_CRYPT_50087]。

错误处理与回滚行为

如果加密操作所需的前提条件不满足,则调用失败。规范确保了错误情况下的回滚语义,并定义了以下错误原因 [SWS_CRYPT_50087]:

  • UninitializedContext:未预先向上下文分配密钥。
  • ara::crypto::CryptoErrc::kEmptyKeySlot:配置的 KeySlot 当前未被占用。
  • ara::crypto::CryptoErrc::kUsageViolation:密钥的权限不包含使用标志 kAllowDataEncryption。
  • ara::crypto::CryptoErrc::kIncompatibleObject:分配的密钥类型与所需的变换不兼容。
  • ara::crypto::CryptoErrc::kBusyResource:初始化所需的资源被占用。
  • ara::crypto::CryptoErrc::kUnsupported:具体上下文不支持流式处理。

并发性与交互

该方法被指定为 thread-safe 和 exception safe [SWS_CRYPT_50087]。在上下文中提供合适的密钥是成功的必要先决条件。从概念上讲,该函数融入了加密上下文的标准化生命周期中,在这些生命周期中,操作通过无参数调用进行准备——可与签名校验 [SWS_CRYPT_50019]、签名生成 [SWS_CRYPT_50037] 或 MAC 计算 [SWS_CRYPT_22111] 相比。该调用可能是实际执行流加密之前强制性的起始点。 问题 Q-db262c3914e6b4cf (未决)

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

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

Header-Datei#include "ara/crypto/cryp/encryptor_public_ctx.h"
Scopeclass ara::crypto::cryp::EncryptorPublicCtx
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::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 kAllowData Encryption
ara::crypto::CryptoErrc::kIncompatibleObjectrollback_semantics if type of the key is incompatible to the transformation
ara::crypto::CryptoErrc::kUnsupportedrollback_semantics if stream processing is not supported by the context

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50087
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50087@rel:R25-11#ea408416
Content hash
ea408416
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50087
Status: valid/unmigrated Version: rel:R25-11#d8c9987f 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_50087@rel:R25-11#d8c9987f
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_50176] Upstream: RS_CRYPTO_02302

virtual ara::core::Result< std::size_t > Update (ReadOnlyMemRegion in, ReadWriteMemRegion out) noexcept=0;

Encrypt a data buffer.

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

使用

类ara::crypto::cryp::EncryptorPublicCtx的同步方法Update用于逐步加密明文的数据块[SWS_CRYPT_50176]。通过参数in(ReadOnlyMemRegion)传入明文的一部分,同时加密后的数据被写入输出缓冲区out(ReadWriteMemRegion)[SWS_CRYPT_50176]。作为返回值,该函数通过ara::core::Result<std::size_t>提供实际写入的字节数,该值可能小于out提供的容量[SWS_CRYPT_50176]。

流程与交互

在首次调用Update之前,必须强制通过Start()启动数据处理[SWS_CRYPT_50176]。单次调用允许的最大输入大小可通过方法GetMaximumChunkSize()查询[SWS_CRYPT_50091]。此外,out所需的最小大小可通过GetRequiredOutputBufferSize()计算[SWS_CRYPT_50176]。

错误处理与并发

若执行期间发生错误,将以回滚语义报告该错误[SWS_CRYPT_50176]:

  • ara::crypto::CryptoErrc::kProcessingNotStarted:此前未通过Start()开始数据处理[SWS_CRYPT_50176]。
  • ara::crypto::CryptoErrc::kInsufficientCapacity:缓冲区out的容量不足以容纳结果[SWS_CRYPT_50176]。
  • ara::crypto::CryptoErrc::kInvalidInputSize:in的缓冲区大小无效[SWS_CRYPT_50176]。
  • ara::crypto::CryptoErrc::kUnsupported:当前上下文不支持流处理[SWS_CRYPT_50176]。

该方法声明为异常安全且线程安全[SWS_CRYPT_50176]。尽管如此,在同一上下文对象上并行调用多个操作大概需要外部同步,以确保加密数据片段的确定性顺序。 问题 Q-b22ffe505b583b25 (未决)

本段文字由 AI 生成,仅供参考。规范具约束力。

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

Parameter (in)

ParameterBeschreibung
inan input data buffer containing a part of the plaintext

Parameter (out)

ParameterBeschreibung
outan output data buffer that the encrypted data will be written into. The required size of this buffer can be queried using GetRequired OutputBufferSize()

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 out.

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kProcessingNotStartedrollback_semantics if data processing was not started by a call of the Start() method
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::kUnsupportedrollback_semantics if stream processing is not supported by the context

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50176
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50176@rel:R25-11#6dab37cc
Content hash
6dab37cc
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50176
Status: valid/unmigrated Version: rel:R25-11#89552c35 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_50176@rel:R25-11#89552c35
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_50174] Upstream: RS_CRYPTO_02201

using Sptr = std::shared_ptr<EncryptorPublicCtx>;

Smart pointer of the interface.

Header-Datei#include "ara/crypto/cryp/encryptor_public_ctx.h"
Scopeclass ara::crypto::cryp::EncryptorPublicCtx
SymbolSptr

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

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