模块 ara::crypto — Cryptography
模块指南人工智能生成
为应用程序提供隔离的密码学操作、密钥管理以及 X.509 证书服务。
为应用程序提供隔离的密码学操作、密钥管理以及 X.509 证书服务。
功能集群 Cryptography 为对称与非对称加密、签名验证以及安全密钥和证书管理提供标准化安全服务(PlatformDesign 第71页)。对密码学操作和持久性密钥槽的访问严格通过平台特定 Provider 以及清单中声明式锚定的实例标识符进行隔离(SWS Cryptography 第39页)。在此过程中,使用限制的强制执行可防止敏感密钥材料遭到泄露([SWS_CRYPT_50092])。
功能集群 Cryptography(ara::crypto)为 AUTOSAR Adaptive Platform 提供全面的安全架构(PlatformDesign 第71页)。为抵御受损的用户应用程序,密钥保存和密码学执行通常封装在隔离的平台守护进程或硬件安全模块(HSM)中(AUTOSAR AP EXP SWArchitecture 第97页、SWS Cryptography 第87页)。整体功能划分为用于计算原语的专用 CryptoProvider、用于持久性密钥槽(KeySlots)的密钥存储区,以及用于 PKI 证书管理的机器级 X509Provider(SWS Cryptography 第39页)。
上下文图:应用程序、守护进程与 Provider 之间的功能集群 Cryptography 架构与组件关系。来源:SWS Cryptography 第39页、PlatformDesign 第71页、AUTOSAR AP EXP SWArchitecture 第97页。
应用程序通过其 Provider(AUTOSAR AP EXP SWArchitecture 第99页)创建密码学上下文,例如对称密码([SWS_CRYPT_20742])、认证密码([SWS_CRYPT_20745])、哈希函数([SWS_CRYPT_20747])或签名器和验证器实例([SWS_CRYPT_20756]、[SWS_CRYPT_20757])。其处理遵循确定性的生命周期:在密钥绑定(SetKey)之后,转换通过 Start() 启动,通过 Update() 进行流式传输,并通过 Finish() 结束(AUTOSAR AP TR SystemTests 第206页、EXP SWArchitecture 第104页)。不可变的 AllowedUsageFlags 可有效防止未经授权的密钥使用([SWS_CRYPT_50092]、AUTOSAR AP TR SystemTests 第177页)。
状态图:密码学转换上下文从分配到重置的生命周期。来源:[SWS_CRYPT_20742]、[SWS_CRYPT_23911]、[SWS_CRYPT_23625]、[SWS_CRYPT_50046]、[SWS_CRYPT_50212]。
证书和 CSR 通过 X509Provider 进行管理([SWS_CRYPT_40099]、[SWS_CRYPT_40640]),而验证上下文在考量 CRL 吊销列表([SWS_CRYPT_50183])和 OCSP 响应([SWS_CRYPT_50124])的情况下来校验证书链(AUTOSAR AP TR SystemTests 第194页)。向应用程序分配 KeySlots 和证书是在清单中基于模型通过 InstanceSpecifier 完成的(AUTOSAR AP TPS ManifestSpecification 第245页、AUTOSAR AP TPS ManifestSpecification 第649页)。所有接口均采用无异常的 ara::core::Result 返回值工作,并通过 CryptoErrorDomain 发送错误信号([SWS_CRYPT_19902]、SWS Cryptography 第208页)。
架构、安全域与守护进程隔离
功能集群 Cryptography(ara::crypto)构成了 AUTOSAR Adaptive Platform 的核心安全基础,并提供密码学基础机制、密钥管理以及证书服务(PlatformDesign 第71页)。根据平台的信任模型,平台功能集群属于受信任的基石,而 Adaptive Applications 则在非特权用户空间中执行(SWS Cryptography 第37页)。为了在应用程序发生潜在受损时仍能有效保护密钥材料和密码学操作,该架构通常设计为基于守护进程的形式;实际执行与密钥保存保留在隔离的平台进程或安全执行环境中(AUTOSAR AP EXP SWArchitecture 第97页、SWS Cryptography 第87页)。
该架构将密码学功能划分为三个主要领域:用于计算原语和密钥转换的 CryptoProvider、用于持久性对象保存的密钥存储区(ara::crypto::keys),以及用于证书管理的 X509Provider(ara::crypto::x509)(SWS Cryptography 第39页、SWS Cryptography 第87页)。在一个 ECU 上可以并行存在多个专用的 CryptoProvider 实例,例如用于接入不同的硬件安全模块(HSM、TPM)或基于软件的驱动程序(SWS Cryptography 第39页)。然而,不同 Provider 之间故意不具备互操作性:一个密码学对象或密钥严格属于某一个 Provider,无法被另一个 Provider 处理(SWS Cryptography 第39页)。这种严格的封装主要应归因于硬件安全域从物理上强制执行其密钥边界,且密钥句柄不具备跨域有效性。 问题 Q-63efe107cf111983 (未决)
上下文图:应用程序、守护进程与 Provider 之间的功能集群 Cryptography 架构与组件关系。来源:SWS Cryptography 第39页、PlatformDesign 第71页、AUTOSAR AP EXP SWArchitecture 第97页。
密码学 Provider 的入口点与初始化
进入该模块是通过全局入口函数进行的,这些函数充当核心抽象接口的工厂(SWArchitecture 第71页)。应用程序通过函数 [SWS_CRYPT_20099] 在指定建模的 ara::core::InstanceSpecifier 的情况下创建或加载 CryptoProvider 的实例。针对证书管理,整个系统中恰好存在一个全局证书 Provider,通过 [SWS_CRYPT_40099] 进行加载(SWS Cryptography 第39页)。此外还提供全局辅助服务,其中包括通过 [SWS_CRYPT_30098] 直接生成随机数据以及通过 [SWS_CRYPT_20098] 查询硬件支持的安全计数器(SWArchitecture 第71页)。
持久性密钥资源不是直接实例化的,而是通过逻辑密钥槽(KeySlots)加载。为此,运行时环境提供了用于只读访问的函数 [SWS_CRYPT_50004] 和用于可写密钥槽的函数 [SWS_CRYPT_50005],它们针对权限配置对传入的实例标识符进行校验(SWS Cryptography 第87页、AUTOSAR AP TPS ManifestSpecification 第649页)。通过所获取的 KeySlot 实例,可以使用 [SWS_CRYPT_30403] 查询关联的 Provider 实例,从而确保存储位置与执行环境之间的紧密绑定始终得到保证(SWS Cryptography 第39页)。
一旦 CryptoProvider 实例可用,它便充当用于实例化特定密码学工作上下文的核心工厂(AUTOSAR AP EXP SWArchitecture 第99页)。可创建的上下文包括用于随机数生成器的上下文([SWS_CRYPT_20741])、对称块密码与流密码上下文([SWS_CRYPT_20742])、认证加密上下文([SWS_CRYPT_20745])、消息认证码(MAC)上下文([SWS_CRYPT_20746])、密码学哈希函数上下文([SWS_CRYPT_20747])、非对称加密或解密上下文([SWS_CRYPT_20750]、[SWS_CRYPT_20751])以及签名与验证上下文([SWS_CRYPT_20756]、[SWS_CRYPT_20757])等(EXP SWArchitecture 第99页)。
密码学转换上下文与数据处理
ara::crypto 中的密码学数据处理遵循严格基于状态的生命周期,以确保算法配置、密钥绑定与流式处理之间的解耦(AUTOSAR AP TR SystemTests 第211页)。通过 Provider 分配上下文后,它最初处于未初始化状态。只有通过 SetKey() 的类型专用重载传入兼容的密钥——例如用于对称密钥([SWS_CRYPT_23911])、私钥([SWS_CRYPT_23515])或直接来自 KeySlot([SWS_CRYPT_50043])——上下文才会转换为就绪状态(AUTOSAR AP TR SystemTests 第206页)。
对于流式处理,转换由 Start() 启动,可选择传入初始化向量或上下文([SWS_CRYPT_22110]、[SWS_CRYPT_23625]、[SWS_CRYPT_50020])。随后可以通过 Update() 逐步馈送数据块([SWS_CRYPT_21113]、[SWS_CRYPT_22113]、[SWS_CRYPT_50139])。在认证加密(AEAD)中,接口严格区分通过 [SWS_CRYPT_20313] 处理的关联数据和通过 [SWS_CRYPT_50074] 处理的机密有效载荷(EXP SWArchitecture 第104页)。转换的结束通过 Finish() 或 FinishEncrypt() 进行([SWS_CRYPT_21115]、[SWS_CRYPT_23618]、[SWS_CRYPT_50075]),随后可通过 GetDigest() 读出认证标签或校验和([SWS_CRYPT_21116]、[SWS_CRYPT_22116])。
除流式模式外,对称密码和认证密码等上下文类还支持通过 [SWS_CRYPT_50047] 或 [SWS_CRYPT_50078] 进行紧凑的单次调用,从而无需多步协议调用即可高效加密或解密短有效载荷(SWS Cryptography 第58页)。若要中止正在进行的操作,调用 Cancel()([SWS_CRYPT_50023]、[SWS_CRYPT_50046])或 Reset()([SWS_CRYPT_50212])可将上下文确定性地恢复到清理后的初始状态(EXP SWArchitecture 第100页)。
状态图:密码学转换上下文从分配到重置的生命周期。来源:[SWS_CRYPT_20742]、[SWS_CRYPT_23911]、[SWS_CRYPT_23625]、[SWS_CRYPT_50046]、[SWS_CRYPT_50212]。
密钥管理、封装与权限执行
密码学密钥在对象模型中被类型化为 CryptoObject 或 RestrictedUseObject(AUTOSAR AP EXP SWArchitecture 第111页、EXP SWArchitecture 第111页)。平台标准区对称密钥(SymmetricKey)、私有非对称密钥(PrivateKey)与公钥(PublicKey)(SWS Cryptography 第291页)。密钥材料可以直接通过 CryptoProvider 生成([SWS_CRYPT_20721]、[SWS_CRYPT_20722]),或者通过使用基础密钥参数化 KeyDerivationFunctionCtx([SWS_CRYPT_20748])并通过 [SWS_CRYPT_21515] 执行来从现有密钥材料中派生(EXP SWArchitecture 第108页)。
为了执行最小权限原则,每个密钥对象都带有不可变的使用限制(AllowedUsageFlags),可通过 [SWS_CRYPT_50092] 查询(AUTOSAR AP TR SystemTests 第177页)。密码栈在每次绑定尝试时(SetKey)都会校验目标上下文的操作(例如加密、签名、派生或导出)是否获得密钥标志的授权,并严格拒绝未经允许的使用(AUTOSAR AP TR SystemTests 第177页、SWArchitecture 第95页)。某种算法的默认配置可通过 [SWS_CRYPT_20955] 确定。
为了实现安全密钥交换,该模块实现了多种标准化方法:在非对称密钥协商(Diffie-Hellman / ECDH)中,通过 [SWS_CRYPT_20758] 创建一个 KeyAgreementPrivateCtx,私钥绑定到该对象上([SWS_CRYPT_21313]);随后,方法 [SWS_CRYPT_21312] 在结合对端公钥的情况下计算共享的目标对称密钥(AUTOSAR AP TR SystemTests 第179页)。在密钥封装机制(KEM)中,KeyEncapsulatorPublicCtx([SWS_CRYPT_20752])使用 [SWS_CRYPT_21813] 封装对称密钥,而对端则通过 KeyDecapsulatorPrivateCtx([SWS_CRYPT_20753])经由 [SWS_CRYPT_21412] 执行解封装(AUTOSAR AP TR SystemTests 第173页、AUTOSAR TR AdaptivePlatformSystemTests 第188页)。对于受保护的密钥传输,提供密钥包装(Key Wrapping,[SWS_CRYPT_24014]、[SWS_CRYPT_24016])与安全导出([SWS_CRYPT_20728])(AUTOSAR AP TR SystemTests 第174页、AUTOSAR AP TR SystemTests 第182页)。
时序图:通过 Diffie-Hellman 的非对称密钥协商以及对称有效载荷密钥的派生。来源:[SWS_CRYPT_20758]、[SWS_CRYPT_21313]、[SWS_CRYPT_21312]、AUTOSAR AP TR SystemTests 第179页。
非对称签名通过独立的上下文处理:签名通过 SignerPrivateCtx([SWS_CRYPT_20756])和方法 [SWS_CRYPT_23512] 完成,而验证则通过 VerifierPublicCtx([SWS_CRYPT_20757])和方法 [SWS_CRYPT_24112] 执行(AUTOSAR AP TR SystemTests 第164页、SWArchitecture 第84页)。如果 KeySlot 在后台被特权管理服务更新(例如 OTA 密钥轮换),消费库可通过更新观察器经由 [SWS_CRYPT_30404] 收到通知,以便同步重新加载其密钥材料(AUTOSAR AP SWS Cryptography 第36页)。
时序图:利用独立的私有和公开上下文生成与验证签名的流程。来源:[SWS_CRYPT_20756]、[SWS_CRYPT_23515]、[SWS_CRYPT_23512]、[SWS_CRYPT_20757]、[SWS_CRYPT_24115]、[SWS_CRYPT_24112]、AUTOSAR AP TR SystemTests 第164页。
X.509 证书管理、验证与分组
子系统 ara::crypto::x509 为公钥基础设施(PKI)提供标准化功能(EXP SWArchitecture 第116页)。核心 X509Provider([SWS_CRYPT_40099])既支持易失性会话存储,也支持持久性存储(SWS Cryptography 第39页)。证书与证书链通过 [SWS_CRYPT_40614] 或 [SWS_CRYPT_40616] 从字节缓冲区解析。为了申请新的身份证书,应用程序可通过 [SWS_CRYPT_40640] 生成经密码学签名的证书签名请求(CSR),其中签名器上下文和可分辨名称(DN)通过 [SWS_CRYPT_50186] 传入(AUTOSAR AP TR SystemTests 第189页)。
为了进行符合性与有效性检查,应用程序通过 [SWS_CRYPT_50125] 实例化一个 CertificateValidationCtx。通过 [SWS_CRYPT_50117] 向该上下文添加信任锚点(Trust Anchors),通过 [SWS_CRYPT_50120] 定义验证选项,并通过 [SWS_CRYPT_50121] 存入参考时间戳。针对信任链的层次化链校验通过 [SWS_CRYPT_50122] 或 [SWS_CRYPT_50123] 进行(AUTOSAR AP TR SystemTests 第194页)。为了获取证书吊销情况,可以导入证书吊销列表(CRL)([SWS_CRYPT_50183]),或者通过 [SWS_CRYPT_40626]、[SWS_CRYPT_50185] 和 [SWS_CRYPT_50124] 将在线证书状态查询(符合 RFC 6960 的 OCSP)纳入验证状态(AUTOSAR AP TR SystemTests 第194页)。
为了在密钥更换时将证书使用者与具体的单个证书实例解耦,清单支持 CryptoCertificateGroup 概念(AUTOSAR AP TPS ManifestSpecification 第657页)。消费型应用程序通过 [SWS_CRYPT_50126] 加载整个逻辑关联的证书组,而特权管理服务则可通过 [SWS_CRYPT_50127] 和 [SWS_CRYPT_50128] 动态替换或清理证书(AUTOSAR AP TPS ManifestSpecification 第657页)。
时序图:带有证书链、CRL 导入和在线 OCSP 状态检查的 X.509 证书验证。来源:[SWS_CRYPT_40099]、[SWS_CRYPT_50125]、[SWS_CRYPT_50122]、[SWS_CRYPT_50183]、[SWS_CRYPT_50124]、AUTOSAR AP TR SystemTests 第194页。
清单建模、端口接口与部署
将密码学资源集成到整车架构中是在 ARXML 清单中通过 AUTOSAR 元模型声明式完成的(AUTOSAR AP TPS ManifestSpecification 第244页)。软件组件在设计层面通过端口(RPortPrototype)对其安全要求进行建模,这些端口由 CryptoInterface 的特化进行类型化:CryptoKeySlotInterface 用于密钥槽,CryptoCertificateInterface 用于证书资源,CryptoProviderInterface 用于访问执行 Provider(TPS ManifestSpecification 第167页、AUTOSAR AP TPS ManifestSpecification 第245页)。接口的属性不可变地规定了是授予读权限还是写权限(writeAccess),以及允许哪些对象类型(TPS ManifestSpecification 第168页、TPS ManifestSpecification 第438页)。
在部署清单中,目标配置(Target Configuration)将抽象端口原型与具体的物理平台资源连接起来(AUTOSAR AP TPS ManifestSpecification 第649页)。元模型元素 CryptoKeySlotToPortPrototypeMapping 将进程的端口映射到机器的 CryptoModuleInstantiation 中声明的 CryptoKeySlot(TPS ManifestSpecification 第614页、TPS ManifestSpecification 第646页)。CryptoCertificateToPortPrototypeMapping 以类似方式分配证书(TPS ManifestSpecification 第655页)。在运行时,清单中端口的路径代表 ara::core::InstanceSpecifier,应用程序代码将其传递给诸如 [SWS_CRYPT_50004] 等加载函数(ManifestSpecification 第154页)。
对于功能集群之间的平台交互——例如在 Communication Management(SecOC、IPsec、TLS)与密码栈之间——不存在传统的端口原型(TPS ManifestSpecification 第861页)。在此,InstanceSpecifier 改为由派生自 FunctionalClusterInteractsWithFunctionalClusterMapping 的元素构成,例如 ComKeyToCryptoKeySlotMapping 或 SecOcJobMapping(TPS ManifestSpecification 第861页、TPS ManifestSpecification 第864页、ManifestSpecification 第411页)。持久性安全保护(Persistency 部署)与软件集群校验和也通过这些标准化的清单映射绑定其密钥与 Provider(TPS ManifestSpecification 第867页、TPS ManifestSpecification 第896页)。
发生错误时的行为
密码模块的错误处理概念遵循 Adaptive Platform 对安全可靠且无异常代码的严格规定(noexcept)(SWS Cryptography 第145页)。所有同步操作均通过通用结果类型 ara::core::Result<T, ara::core::ErrorCode> 返回错误情况(SWS Cryptography 第208页)。错误码锚定在由 [SWS_CRYPT_19902] 表示的专用错误域中;其名称可通过 [SWS_CRYPT_19950] 查询,文本错误描述可通过 [SWS_CRYPT_19953] 查询。对于显式使用异常处理的应用程序,该栈提供了异常类型 CryptoException([SWS_CRYPT_19906])和辅助函数 [SWS_CRYPT_19954]。
典型的功能错误码包括上下文违规,例如在调用 SetKey() 之前触发加密操作时的 CryptoErrc::kUninitializedContext,或者当传入的输入数据缓冲区与要求的块网格不匹配时的 CryptoErrc::kInvalidInputSize(SWS Cryptography 第208页)。在序列化和转换过程中,CryptoErrc::kUnknownIdentifier 指示不支持的实参值,而 CryptoErrc::kIncompatibleArguments 指示不兼容的参数组合(SWS Cryptography 第145页)。在访问密钥资源时,该协议栈通过返回 kAccessViolation 来阻止未授权访问(SWS Cryptography 第87页)。在解析有缺陷的自定义 X.509 证书扩展时,解析器将以 CryptoErrc::kRuntimeFault 中止(SWS Cryptography 第280页、SWS Cryptography 第356页)。
为了在发生错误后恢复上下文中的已定义状态,并避免守护进程中出现内存泄漏或挂起的流式传输缓冲区,调用方必须清理上下文。这可以通过调用 Cancel()([SWS_CRYPT_50046]、[SWS_CRYPT_50089])有针对性地完成(从而丢弃未完成的转换),或者通过 Reset()([SWS_CRYPT_50212])完成,后者会将上下文完全重置为密钥绑定之前的状态(EXP SWArchitecture 第100页)。
进一步详细证据
Cryptography 模块的规范基于一系列核心需求和架构文档,下文对其进行梳理归类:
- 全局入口点和工厂:规范 [SWS_CRYPT_20099](
LoadCryptoProvider)和 [SWS_CRYPT_40099](LoadX509Provider)定义了对两个主要提供者域(SWArchitecture 第71页、SWS Cryptography 第39页)的规范性访问。 - 密钥存储和端口绑定:函数 [SWS_CRYPT_50004](
LoadKeySlot)和 [SWS_CRYPT_50005](LoadWriteableKeySlot)规范地实现了清单中的端口建模与 KSP 中隔离的物理存储访问之间的交互(SWS Cryptography 第87页、AUTOSAR AP TPS ManifestSpecification 第649页)。 - 原语和上下文工厂:围绕 [SWS_CRYPT_20745](
CreateAuthCipherCtx)、[SWS_CRYPT_20756](CreateSignerPrivateCtx)和 [SWS_CRYPT_20757](CreateVerifierPublicCtx)的接口组规定了用于加密作业的标准化状态机的动态创建(AUTOSAR AP EXP SWArchitecture 第99页、AUTOSAR AP TR SystemTests 第164页)。 - X.509 验证和吊销检查:通过 [SWS_CRYPT_50125](
CreateCertificateValidationCtx)、[SWS_CRYPT_50122](ValidateCertificate)、[SWS_CRYPT_50183](ImportCrl)和 [SWS_CRYPT_50124](AddOcspResponse)对完整的汽车级 PKI 检查链进行了标准化(AUTOSAR AP TR SystemTests 第194页、EXP SWArchitecture 第116页)。
本模块指南由 AI 策展助手基于 AUTOSAR Adaptive 规范 R25-11 生成。
function: 261 type alias: 43 variable: 43 class: 34 enumeration: 5 struct: 1
类
AuthCipherCtxCertificateCertificateValidationCtxCertificateValidationResultCertSignRequestCryptoContextCryptoErrorDomainCryptoExceptionCryptoObjectCryptoProviderDecryptorPrivateCtxEncryptorPublicCtxFormatterHashFunctionCtxKeyAgreementPrivateCtxKeyDecapsulatorPrivateCtxKeyDerivationFunctionCtxKeyEncapsulatorPublicCtxKeySlotMessageAuthnCodeCtxOcspResponsePrivateKeyProtectedKeyImportCtxPublicKeyRandomGeneratorCtxSecureCounterSerializableSignerPrivateCtxSymmetricCipherCtxSymmetricKeySymmetricKeyWrapperCtxVerifierPublicCtxWriteableKeySlotX509DNX509Provider函数
GetCryptoErrorDomainLoadCryptoProvider (ara::crypto)LoadFormatterLoadKeySlotLoadWriteableKeySlotLoadX509ProviderMakeErrorCode类型
AlgIdAlgIdStringAllowedUsageFlagsCertificateValidationOptionsFormatIdLoadCryptoProviderReadOnlyMemRegionReadWriteMemRegionTimestampX509ExtendedKeyUsageX509KeyUsage枚举
CertificateValidationStatusCryptoErrcCryptoObjectTypeCryptoTransformOcspResponseStatus常量
kAllowDataDecryptionkAllowDataEncryptionkAllowDerivedPlaintextExportkAllowHashCalculationkAllowKeyAgreementkAllowKeyDerivationkAllowKeyUnwrappingkAllowKeyWrappingkAllowMackAllowPersistkAllowPlaintextExportkAllowRngInitkAllowSecuredExportkAllowSigGenerationkAllowSigVerificationkClientAuthkCodeSigningkConstrCrlSignkConstrDataEnciphermentkConstrDecipherOnlykConstrDigitalSignaturekConstrEncipherOnlykConstrKeyAgreementkConstrKeyCertSignkConstrKeyEnciphermentkConstrNonRepudiationkEmailProtectionkFormatDerEncodedkFormatPemEncodedkFormatRawValueOnlykIgnoreCrlkIgnoreNotAfterkIgnoreNotBeforekIgnoreUnknownCriticalExtensionskOcspOffkOcspResponseCompleteChainkOcspResponseTargetOnlykOCSPSigningkProprietaryFormatkServerAuthkTimeStamping主题图
ara::crypto
42ara::crypto::cryp
23ara::crypto::x509
34此版本没有元素数据
ara::crypto
Crypto Error Domain class that provides interfaces as defined by ara::core::ErrorDomain such as a name of the Crypto Error Domain or message
继承自 ara::core::ErrorDomain
Exception type thrown for CRYPTO errors.
继承自 ara::core::Exception
Formatter object interface.
128 bit secure counter made up of two uint64_t’s representing the most significant and least significant bits
Serializable object interface.
Return a reference to the global CryptoErrorDomain.
constexpr const ara::core::ErrorDomain & GetCryptoErrorDomain () noexcept;This factory method shall create or return the existing instance of a specific Crypto Provider.
ara::core::Result< cryp::CryptoProvider::Sptr > LoadCryptoProvider (const ara::core::InstanceSpecifier &iSpecify) noexcept;Factory that creates a Formatter.
ara::core::Result< Formatter::Sptr > LoadFormatter () noexcept;Load a read-only key slot. This factory method shall load the information associated with the specified KeySlot into a KeySlot object.
ara::core::Result< cryp::KeySlot::Sptr > LoadKeySlot (const ara::core::InstanceSpecifier &iSpecify) noexcept;Load a writeable key slot. This factory method shall load the information associated with the specified KeySlot into a WriteableKeySlot object.
ara::core::Result< cryp::WriteableKeySlot::Sptr > LoadWriteableKeySlot (const ara::core::InstanceSpecifier &iSpecify) noexcept;This factory method shall create or return the existing instance of the singleton X.509 Provider.
ara::core::Result< x509::X509Provider::Sptr > LoadX509Provider () noexcept;Makes Error Code instances from the Crypto Error Domain. The returned ErrorCode instance always references to CryptoErrorDomain.
constexpr ara::core::ErrorCode MakeErrorCode (CryptoErrorDomain::Errc code, ara::core::ErrorDomain::SupportDataType data) noexcept;Defines the error codes for the ara::crypto::CryptoErrorDomain
enum class CryptoErrc : ara::core::ErrorDomain::CodeType {...};Enumeration of all types of crypto objects, i.e. types of content that can be stored to a key slot.
enum class CryptoObjectType : std::uint8_t {...};Enumeration of cryptographic transformation directions.
enum class CryptoTransform : std::uint8_t {...};Type for holding StringView of algorithm according to standardized format described in the chapter ’Naming Convention’.
using AlgId = ara::core::StringView;Type for holding String of algorithm according to standardized format described in the chapter ’Naming Convention’.
using AlgIdString = ara::core::String;Type for holding bit-flags of allowed usages of a key.
using AllowedUsageFlags = std::uint32_t;A container type for the encoding format identifiers.
using FormatId = std::uint32_t;Type for holding StringView of algorithm according to standardized format described in the chapter ’Naming Convention’.
using AlgId = ara::core::StringView;Read-Only Memory Region (intended for [in] arguments)
using ReadOnlyMemRegion = ara::core::Span<const std::uint8_t>;Read-Write Memory Region (intended for [out] or [in/out] arguments)
using ReadWriteMemRegion = ara::core::Span<std::uint8_t>;Type for timestamps.
using Timestamp = std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>;The key can be used for data decryption.
constexpr AllowedUsageFlags kAllowDataDecryption {0x0002};The following constants define 1-bit values representing allowed usages. The key can be used for data encryption
constexpr AllowedUsageFlags kAllowDataEncryption {0x0001};The derived key can be exported in plaintext.
constexpr AllowedUsageFlags kAllowDerivedPlaintextExport {0x4000};The key can be used as input to a HashFunctionCtx.
constexpr AllowedUsageFlags kAllowHashCalculation {0x1000};The key can be used as private or public input to key agreement.
constexpr AllowedUsageFlags kAllowKeyAgreement {0x0020};The key can be used for key derivation.
constexpr AllowedUsageFlags kAllowKeyDerivation {0x0040};The key can be used as a key encryption key for key unwrapping or key decapsulation.
constexpr AllowedUsageFlags kAllowKeyUnwrapping {0x0100};The key can be used as a key encryption key for key wrapping or key encapsulation.
constexpr AllowedUsageFlags kAllowKeyWrapping {0x0080};The key can be used for MAC generation and verification.
constexpr AllowedUsageFlags kAllowMac {0x0004};The key can persisted.
constexpr AllowedUsageFlags kAllowPersist {0x0200};The key can be exported in plaintext.
constexpr AllowedUsageFlags kAllowPlaintextExport {0x2000};The symmetric key can be used for seeding of a RandomGeneratorCtx.
constexpr AllowedUsageFlags kAllowRngInit {0x0800};The key can be securely exported (protected export)
constexpr AllowedUsageFlags kAllowSecuredExport {0x0400};The key can be used for signature generation.
constexpr AllowedUsageFlags kAllowSigGeneration {0x0008};The key can be used for signature verification.
constexpr AllowedUsageFlags kAllowSigVerification {0x0010};Export DER-encoded value of an object.
constexpr FormatId kFormatDerEncoded {2};Export PEM-encoded value of an object.
constexpr FormatId kFormatPemEncoded {3};Export only raw value of an object, i.e., a plain byte array for symmetric keys and ISO/IEC 7816-8 / IEEE P1363 encoding for combined values.
constexpr FormatId kFormatRawValueOnly {1};Proprietary format that is only valid in the context of a CryptoProvider.
constexpr FormatId kProprietaryFormat {0};ara::crypto::cryp
Authenticated Cipher Context interface.
继承自 CryptoContext
A common interface of a mutable cryptographic context, i.e
作为基类 AuthCipherCtx, DecryptorPrivateCtx, EncryptorPublicCtx, HashFunctionCtx, KeyAgreementPrivateCtx, KeyDecapsulatorPrivateCtx, KeyDerivationFunctionCtx, KeyEncapsulatorPublicCtx, MessageAuthnCodeCtx, ProtectedKeyImportCtx, RandomGeneratorCtx, SignerPrivateCtx, SymmetricCipherCtx, SymmetricKeyWrapperCtx, VerifierPublicCtx
A common interface for all cryptographic objects recognizable by the Crypto Provider.
继承自 ara::crypto::Serializable
作为基类 PrivateKey, PublicKey, SymmetricKey
CryptoProviderInterface representing one implementation of a set of cryptographic primitives with a key storage.
Interface for asymmetric decryption.
继承自 CryptoContext
Interface for asymmetric encryption.
继承自 CryptoContext
Hash function interface.
继承自 CryptoContext
Key Agreement Private key Context interface.
继承自 CryptoContext
Asymmetric Key Encapsulation Mechanism (KEM) Private key Context interface.
继承自 CryptoContext
Key Derivation Function interface.
继承自 CryptoContext
Asymmetric Key Encapsulation Mechanism (KEM) Public key Context interface.
继承自 CryptoContext
KeySlot interface representing a storage location for a key in a CryptoProvider.
作为基类 WriteableKeySlot
Keyed Message Authentication Code Context interface definition.
继承自 CryptoContext
Generalized Asymmetric Private Key interface.
继承自 CryptoObject
A contexts for importing secured data such as secret key-material.
继承自 CryptoContext
General Asymmetric Public Key interface.
继承自 CryptoObject
Interface of Random Number Generator Context.
继承自 CryptoContext
Signature Private key Context interface.
继承自 CryptoContext
Interface for Symmetric Cipher Operations.
继承自 CryptoContext
Symmetric Key interface.
继承自 CryptoObject
Context of a symmetric key wrap algorithm.
继承自 CryptoContext
Signature Verification Public key Context interface.
继承自 CryptoContext
WriteableKeySlot interface representing a writeable storage location for a key in a Crypto Provider.
继承自 KeySlot
ara::crypto::x509
X.509 Certificate interface.
继承自 ara::crypto::Serializable
Certificate Validation Context.
X.509 Certificate Validation Result.
Certificate Signing Request (CSR) object interface.
继承自 ara::crypto::Serializable
Interface of OcspResponse.
Interface of X.509 Distinguished Name (DN).
继承自 ara::crypto::Serializable
X.509 Provider interface.
Certificate Validation Status.
enum class CertificateValidationStatus : std::uint8_t {...};On-line Certificate Status Protocol (OCSP) Response Status.
enum class OcspResponseStatus : std::uint8_t {...};Type for holding bit-flags of certificate validation options.
using CertificateValidationOptions = std::uint32_t;X.509 v3 Extended Key Usage type definition.
using X509ExtendedKeyUsage = std::uint32_t;X.509 v3 Key Usage type definition.
using X509KeyUsage = std::uint32_t;TLS WWW client authentication.
constexpr X509ExtendedKeyUsage kClientAuth {0x4000};Signing of downloadable executable code.
constexpr X509ExtendedKeyUsage kCodeSigning {0x2000};The key can be used for Certificates Revokation Lists (CRL) signing.
constexpr X509KeyUsage kConstrCrlSign {0x0200};The key can be used for data encipherment.
constexpr X509KeyUsage kConstrDataEncipherment {0x1000};The enciphermet key can be used for deciphering only.
constexpr X509KeyUsage kConstrDecipherOnly {0x0080};The key can be used for digital signature production.
constexpr X509KeyUsage kConstrDigitalSignature {0x8000};The enciphermet key can be used for enciphering only.
constexpr X509KeyUsage kConstrEncipherOnly {0x0100};The key can be used for a key agreement protocol execution.
constexpr X509KeyUsage kConstrKeyAgreement {0x0800};The key can be used for certificates signing.
constexpr X509KeyUsage kConstrKeyCertSign {0x0400};The key can be used for key encipherment.
constexpr X509KeyUsage kConstrKeyEncipherment {0x2000};The key can be used in cases requiring the "non-repudiation" guarantee.
constexpr X509KeyUsage kConstrNonRepudiation {0x4000};Email protection.
constexpr X509ExtendedKeyUsage kEmailProtection {0x1000};ignore previously imported CRLs
constexpr CertificateValidationOptions kIgnoreCrl {0x0008};ignore the NotAfter field
constexpr CertificateValidationOptions kIgnoreNotAfter {0x0002};ignore the NotBefore field
constexpr CertificateValidationOptions kIgnoreNotBefore {0x0001};ignore all unknown critical extensions
constexpr CertificateValidationOptions kIgnoreUnknownCritical Extensions {0x0004};do not require OCSP response during certificate validation. This is the default behavior.
constexpr CertificateValidationOptions kOcspOff {0x0040};require OCSP response for all certificates of chain
constexpr CertificateValidationOptions kOcspResponseCompleteChain {0x0010};require OCSP response only for target certificate
constexpr CertificateValidationOptions kOcspResponseTargetOnly {0x0020};Signing OCSP responses.
constexpr X509ExtendedKeyUsage kOCSPSigning {0x0400};TLS WWW server authentication.
constexpr X509ExtendedKeyUsage kServerAuth {0x8000};Binding the hash of an object to a time.
constexpr X509ExtendedKeyUsage kTimeStamping {0x0800};命名空间
- ara::crypto 5 Klassen, 7 freie Funktionen
- ara::crypto::cryp 23 Klassen, 0 freie Funktionen
- ara::crypto::x509 7 Klassen, 0 freie Funktionen
模块的 UML 类图
Abgerundete Rahmen = Namespaces; hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); graue Boxen = modulfremde bzw. externe Basisklassen. Klicken öffnet die Klassenseite.
gemini-3.8-flash-low· 2026-10-13 · 德文原文