类 ara::crypto::cryp::PrivateKey
[SWS_CRYPT_22500] Upstream: RS_CRYPTO_02002, RS_CRYPTO_02403
class PrivateKey : public CryptoObject {...};
Generalized Asymmetric Private Key interface.
| Header-Datei | #include "ara/crypto/cryp/cryobj/private_key.h" |
|---|
| Forwarding-Header | #include "ara/crypto/crypto_fwd.h" |
|---|
| Scope | namespace ara::crypto::cryp |
|---|
| Basisklasse(n) | CryptoObject |
|---|
用户指南人工智能生成
封装非对称私钥并提供对应的公钥。
AI 生成
未审核
模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: cbfbff2bb90c
来源
未决问题(3)
封装非对称私钥并提供对应的公钥。
接口 ara::crypto::cryp::PrivateKey 定义了 AUTOSAR Adaptive 中非对称私钥的通用接口,主要通过共享指针别名 PrivateKey::Sptr 进行管理 [SWS_CRYPT_22501]。其核心函数 GetPublicKey() 允许将关联的公钥作为 PublicKey::Sptr 获取,以便为加密对接操作提供该公钥 [SWS_CRYPT_22511]。此获取操作被指定为线程安全且异常安全,没有标准化错误码,其中潜在错误可能以实现特定的方式通过返回类型 ara::core::Result 指示(解释)。 问题 (未决)
上下文
接口 ara::crypto::cryp::PrivateKey 在 AUTOSAR Adaptive Platform 中充当 crypto 模块内非对称私钥的泛化接口。它在头文件 ara/crypto/cryp/cryobj/private_key.h 中声明,并直接继承自基接口 CryptoObject。作为非对称密码系统的核心组件,PrivateKey 封装了用于生成数字签名或非对称解密过程等加密操作所需的机密密钥材料。
除了基类 CryptoObject 之外,主要交互方尤其包括对应的公钥接口 PublicKey 以及消费加密服务和应用例程。虽然私钥必须始终保密,但该接口允许通过成员函数 GetPublicKey() 直接提供关联的公钥 [SWS_CRYPT_22511]。通过这种方式,实现了私钥与其数学对等物之间固定的类型关联关系。
上下文图:PrivateKey 在加密对象模型中的嵌入及其与对应 PublicKey 的关系。来源:[SWS_CRYPT_22501]、[SWS_CRYPT_22511]
生命周期
接口 PrivateKey 的实例通过类型化智能指针 PrivateKey::Sptr 进行管理和传递,该智能指针被定义为 std::shared_ptr<PrivateKey> 的类型别名 [SWS_CRYPT_22501]。该共享指针确保了共享所有权并通过引用计数实现自动资源管理,从而在最后一个引用失效时立即释放受保护的密钥材料。
由于 PrivateKey 是包含如 GetPublicKey() 等纯虚方法的抽象接口 [SWS_CRYPT_22511],应用程序无法直接实例化该类。PrivateKey::Sptr 具体实例的创建和提供大概率通过 Adaptive 系统的专用工厂、密钥管理组件或加密提供程序进行(解释)。 问题 Q-f0f9fe2258fac168 (未决)该接口本身没有定义离散的内部状态或状态转换。
在并发方面,接口为其核心成员函数 GetPublicKey() 显式指定了线程安全性(thread-safe)[SWS_CRYPT_22511]。这允许多个执行流并发、免同步地读取访问同一密钥实例以获取对应的公钥。
使用路径
PrivateKey 的典型使用路径包括接收私钥以及随后提取对应的公钥以用于验证、注册或通信目的:
- 获取密钥:消费软件组件以
PrivateKey::Sptr 形式接收非对称私钥的有效实例 [SWS_CRYPT_22501]。
- 检索配对密钥:如果下游工作流需要对应的公钥,则组件在该实例上调用成员函数
GetPublicKey() [SWS_CRYPT_22511]。
- 处理结果:该调用返回
ara::core::Result<PublicKey::Sptr> [SWS_CRYPT_22511]。应用程序检查结果对象是否成功,并在成功执行时解包指针 PublicKey::Sptr。
- 后续使用:获取的公钥随后可以传输给外部通信伙伴或传递给本地验证例程。据推测,公钥的派生在内部可能直接根据私钥的数学密钥参数进行(解释)。 问题 Q-464000dc5d638649 (未决)
错误场景
对于无误的集成,GetPublicKey() 的错误特性和边界条件具有决定性意义:
- 标准化错误:根据规范,函数
GetPublicKey() 未定义标准化错误码 [SWS_CRYPT_22511]。
- 错误通道:尽管未指定标准化错误,返回类型
ara::core::Result 仍会传递潜在的失败。如果在内部密钥派生或对象创建期间发生错误,结果对象大概率可能包含底层加密驱动程序的实现特定错误码(解释)。 问题 Q-4af6390594d9c5e1 (未决)
- 异常安全性:该函数被显式归类为异常安全(
exception safe),并带有标识符 noexcept [SWS_CRYPT_22511]。因此,调用方无需捕获 C++ 异常。
- 前置与后置条件:成功调用的前置条件是有效且未释放的
PrivateKey 实例。在成功的情况下,接口保证返回在数学上与私钥完全对应的 PublicKey::Sptr 作为后置条件 [SWS_CRYPT_22511]。
本类指南由 AI 基于 AUTOSAR Adaptive R25-11 规范生成。
UML 类图
Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.
此版本没有元素数据
方法
The interface shall return the public key correspondent to this private key.
类型别名
shared smart pointer of the interface.
方法文档
virtual ara::core::Result< PublicKey::Sptr > GetPublicKey () const noexcept=0;
The interface shall return the public key correspondent to this private key.
AI 生成
未审核
模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 9b62fab60fc4
来源
本使用说明基于 AUTOSAR R25-11 自动生成。
实现者指南即将推出(复杂度 I1)
| Header-Datei | #include "ara/crypto/cryp/cryobj/private_key.h" |
|---|
| Scope | class ara::crypto::cryp::PrivateKey |
|---|
| Exception-Sicherheit | exception safe |
|---|
| Thread-Sicherheit | thread-safe |
|---|
Rückgabewert
| Typ | Beschreibung |
|---|
| ara::core::Result< PublicKey::Sptr > | A result containing a shared pointer to the public key correspondent to this private key |
Fehler
| Fehlercode | Beschreibung |
|---|
| This function does not specify any standardized errors. |
Status: valid/unmigrated
Version: rel:R25-11#e5f0457b
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_22511@rel:R25-11#e5f0457b
Point-in-Time History:
Recorded Revisions (8):
- R25-11
rel:R25-11#f0d041e72026-09-30 - R19-11
rel:R19-11#bb931c232026-10-14 - R20-11
rel:R20-11#85846a1e2026-10-14 - R21-11
rel:R21-11#85846a1e2026-10-14 - R22-11
rel:R22-11#99b114f02026-10-14 - R23-11
rel:R23-11#6fdc19552026-10-14 - R24-11
rel:R24-11#a752dbfc2026-10-14 - R25-11
rel:R25-11#e5f0457b2026-10-14 active
Historical Snapshot:
🚫
Requirement entfallen: Dieses Element ist im gewählten Release nicht mehr enthalten.
Requirement Text as-of this release:
Reachable Artifacts & Dependents:
| Date | Actor | Transition | Reason / Rationale | Campaign |
| 2026-08-13 | tool | none → valid/unmigrated | mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record | 2026-08-13-status-backfill |
类型别名文档
using Sptr = std::shared_ptr<PrivateKey>;
shared smart pointer of the interface.
Status: valid/unmigrated
Version: rel:R25-11#48b56da1
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_22501@rel:R25-11#48b56da1
Point-in-Time History:
Recorded Revisions (8):
- R25-11
rel:R25-11#568a064f2026-09-30 - R19-11
rel:R19-11#c428ba2c2026-10-14 - R20-11
rel:R20-11#fb4c3bbd2026-10-14 - R21-11
rel:R21-11#fb4c3bbd2026-10-14 - R22-11
rel:R22-11#6e7979fe2026-10-14 - R23-11
rel:R23-11#d106cca42026-10-14 - R24-11
rel:R24-11#5eb65ced2026-10-14 - R25-11
rel:R25-11#48b56da12026-10-14 active
Historical Snapshot:
🚫
Requirement entfallen: Dieses Element ist im gewählten Release nicht mehr enthalten.
Requirement Text as-of this release:
Reachable Artifacts & Dependents:
| Date | Actor | Transition | Reason / Rationale | Campaign |
| 2026-08-13 | tool | none → valid/unmigrated | mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record | 2026-08-13-status-backfill |
gemini-3.8-flash-low· 2026-10-13 · 德文原文