DEENESPTFRRUARHIKOZHNL

类 ara::crypto::cryp::PublicKey

[SWS_CRYPT_22700] Upstream: RS_CRYPTO_02202

class PublicKey :           public CryptoObject {...};

General Asymmetric Public Key interface.

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

用户指南人工智能生成

提供非对称公钥的通用接口和共享指针。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 49ae23e669f8 来源 未决问题(3)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

提供非对称公钥的通用接口和共享指针。

接口 ara::crypto::cryp::PublicKey 表示模块 crypto 中的通用非对称公钥对象,并派生自 CryptoObject。为了进行引用和传递,该类提供了作为 std::shared_ptr<PublicKey> 的类型别名 Sptr,该别名通过头文件 "ara/crypto/cryp/cryobj/public_key.h" 引入 [SWS_CRYPT_22701]。解释:应用程序应可将 PublicKey::Sptr [SWS_CRYPT_22701] 的实例传递给加密上下文类以进行非对称验证或加密。 问题 (未决)公钥的生命周期和释放完全通过共享智能指针的引用计数器进行控制。

上下文

类 ara::crypto::cryp::PublicKey 定义了 AUTOSAR Adaptive Platform 模块 crypto 内通用非对称公钥接口(General Asymmetric Public Key interface)。根据其语法声明,该类公有继承自 CryptoObject。在此角色中,它充当加密操作中所使用的所有非对称公钥结构的基础类型和统一接口契约。作为公钥,该类的对象表示非对称密钥对在数学上公开的部分,该部分用于验证或加密目的,且不包含敏感的私钥参数。对接口定义的访问通过头文件 #include "ara/crypto/cryp/cryobj/public_key.h" 根据 [SWS_CRYPT_22701] 进行。解释:由于 PublicKey 直接派生自 CryptoObject,该接口应会共享平台加密对象的通用属性和约定,同时提供非对称密钥的特定抽象。 问题 Q-83979c7ba039e328 (未决)

生命周期

为了管理和传递实例,该类提供了类型别名 Sptr,其定义为 std::shared_ptr<PublicKey> [SWS_CRYPT_22701]。因此,公钥的所有权基于共享所有权(Shared Ownership)。这使得不同的系统组件和调用方能够并行引用同一个密钥实例,而无需强制指定唯一的所有者。具体密钥实例的生命周期通过标准智能指针的引用计数器进行控制。一旦最后一个引用被释放且计数器归零,对象就会进行受控销毁。解释:显式提供别名 Sptr [SWS_CRYPT_22701] 应表明,PublicKey 的实例通常通过加密模块的工厂或加载例程创建并作为共享指针直接传递给使用者,而不是作为原始指针或值对象进行管理。 问题 Q-0cdb961ab357bc3b (未决)在并发方面,通过 std::shared_ptr 进行引用允许跨线程传递指针,由于纯公钥主要用作不可变的引用参数,因此通常不会发生并行修改。

使用路径

ara::crypto::cryp::PublicKey 的典型使用路径始于包含相应的头文件 "ara/crypto/cryp/cryobj/public_key.h" [SWS_CRYPT_22701]。随后,应用程序以类型化智能指针 ara::crypto::cryp::PublicKey::Sptr [SWS_CRYPT_22701] 的形式获取对密钥对象的引用。该指针表示可供使用的非对称密钥对象。解释:所获取的 Sptr 实例 [SWS_CRYPT_22701] 随后应会传递给加密上下文类,例如用于验证数字签名或非对称加密数据。 问题 Q-b4800044ca9f058a (未决)在加密验证或计算操作完成后,密钥对象要么保留在共享所有权中以供将来的校验过程使用,要么在离开本地 Sptr 的作用域时自动释放。通过封装为抽象接口,调用方无需了解密钥的内部算法细节,而是通过 PublicKey 的统一接口进行交互。

本指南基于 AUTOSAR Adaptive 规范 R25-11,系自动生成。

UML 类图

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

G nara__crypto__cryp__PublicKey940 PublicKey nara__crypto__cryp__CryptoObject679 CryptoObject nara__crypto__cryp__PublicKey940->nara__crypto__cryp__CryptoObject679 nara__crypto__Serializable855 Serializable nara__crypto__cryp__CryptoObject679->nara__crypto__Serializable855

类型别名

Sptr 类型别名

Shared smart pointer of the interface.

using Sptr = std::shared_ptr<PublicKey>;

类型别名文档

类型别名 Sptr [SWS_CRYPT_22701] Upstream: RS_CRYPTO_02202

using Sptr = std::shared_ptr<PublicKey>;

Shared smart pointer of the interface.

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

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

Record
AUTOSAR/AP/record/SWS_CRYPT_22701
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_22701@rel:R25-11#fbee57f1
Content hash
fbee57f1
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_22701
Status: valid/unmigrated Version: rel:R25-11#0850f625 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_22701@rel:R25-11#0850f625
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#5b6df2722026-09-30
  • R19-11rel:R19-11#a5415fce2026-10-14
  • R20-11rel:R20-11#2eac49f72026-10-14
  • R21-11rel:R21-11#2eac49f72026-10-14
  • R22-11rel:R22-11#d5b69f5e2026-10-14
  • R23-11rel:R23-11#a4933a2b2026-10-14
  • R24-11rel:R24-11#ad436f552026-10-14
  • R25-11rel:R25-11#0850f6252026-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