命名空间 ara::crypto::cryp
用户指南人工智能生成
定义用于加密计算、密钥对象及其存储管理的接口。
定义用于加密计算、密钥对象及其存储管理的接口。
命名空间 ara::crypto::cryp 为 AUTOSAR Adaptive Platform 中的加密操作、密钥对象和密钥存储提供核心接口。通过中央工厂 CryptoProvider,可以从 KeySlot 的实例获取密钥,并实例化派生自 CryptoContext 的用于加密、签名或哈希的专用执行上下文。在配置了有状态的上下文后,使用输入数据执行加密操作。根据目前的解释,一个重要的约束条件在于通过 CryptoObject 对密钥材料进行严格封装,以及通过 WriteableKeySlot 区分写入权限。
上下文和职责范围
命名空间 ara::crypto::cryp 构成了 AUTOSAR Adaptive 加密模块的功能核心,并为加密原语、对象模型和密钥管理结构提供接口。该架构的核心是接口 CryptoProvider,它充当加密算法的实现实例和工厂,并用于访问密钥存储。基本数据结构和密钥通过通用接口 CryptoObject 表示,具体密钥类型(如 SymmetricKey、PublicKey 和 PrivateKey)派生自该接口。密钥材料的存储位置由 KeySlot 及其可写特化 WriteableKeySlot 映射。
上下文图:CryptoProvider、密钥存储与加密上下文之间的相互作用。来源:有效负载中未指定。
为了执行加密转换,该命名空间提供了一组基于可变基础上下文 CryptoContext 构建的专用接口族。这些执行上下文包括对称密码器(SymmetricCipherCtx、AuthCipherCtx)、非对称加密和解密(EncryptorPublicCtx、DecryptorPrivateCtx)以及用于签名生成和验证的机制(SignerPrivateCtx、VerifierPublicCtx)。这一范围还补充了用于哈希函数(HashFunctionCtx)、基于消息的身份验证码(MessageAuthnCodeCtx)、密钥派生(KeyDerivationFunctionCtx)、密钥协商(KeyAgreementPrivateCtx)、密钥封装(KeyEncapsulatorPublicCtx、KeyDecapsulatorPrivateCtx)、带对称包装的密钥封装(SymmetricKeyWrapperCtx)、随机数生成(RandomGeneratorCtx)以及安全密钥导入(ProtectedKeyImportCtx)的上下文。
生命周期与状态保持
加密工件的管理和生命周期与 CryptoProvider、密钥对象及上下文之间的相互作用密切耦合。根据目前的解释,加密上下文和对象的生命周期主要通过 CryptoProvider 的工厂和管理方法进行控制,该接口充当实例化的中央入口点。派生自 CryptoObject 的对象表示不可变或受管的加密实体,而 CryptoContext 则明确定义为有状态的可变上下文。这要求在相应的上下文实例内维护配置、中间状态和算法参数。
对于密钥材料的持久或临时存储,该命名空间区分了 KeySlot 和 WriteableKeySlot。按照合理解释,KeySlot 与 WriteableKeySlot 之间的分离推测将读取访问与写入密钥修改分开,从而可以保护不可变或写保护的密钥区域免遭意外覆盖。 问题 Q-e1b708ca976f7e99 (未决)因此,密钥和上下文的状态转换在关联 Provider 的控制下进行,该 Provider 确保密钥对象在其整个生命周期内的有效性。
加密操作的使用路径
加密操作通常遵循 Provider 查询、通过 Key-Slot 提供密钥以及初始化有状态上下文的序列。在第一步中,应用程序组件访问主管的 CryptoProvider。通过该 Provider,所需的密钥材料要么从 KeySlot 或 WriteableKeySlot 中加载,要么作为具体的 CryptoObject(例如作为 SymmetricKey、PrivateKey 或 PublicKey)获取。同时或随后,Provider 会创建 CryptoContext 的合适实例,例如用于加密的 SymmetricCipherCtx 或用于数字签名的 SignerPrivateCtx。
序列图:执行加密操作时的典型调用顺序。来源:有效负载中未指定。
在随后的执行步骤中,使用加载的密钥配置所创建的上下文,并为其提供待处理的有效负载数据。由于 CryptoContext 的有状态特性,可以在将最终加密结果(例如密文、签名或哈希值)返回给应用程序之前,分步执行流式操作或多阶段转换。处理完成后,瞬态状态的释放遵循执行上下文和 Provider 的约定。
本段文本由人工智能基于 Release R25-11 的元数据生成。
类
AuthCipherCtxCryptoContextCryptoObjectCryptoProviderDecryptorPrivateCtxEncryptorPublicCtxHashFunctionCtxKeyAgreementPrivateCtxKeyDecapsulatorPrivateCtxKeyDerivationFunctionCtxKeyEncapsulatorPublicCtxKeySlotMessageAuthnCodeCtxPrivateKeyProtectedKeyImportCtxPublicKeyRandomGeneratorCtxSignerPrivateCtxSymmetricCipherCtxSymmetricKeySymmetricKeyWrapperCtxVerifierPublicCtxWriteableKeySlotVerschlüsselung
AuthCipherCtxDecryptorPrivateCtxEncryptorPublicCtxSymmetricCipherCtxSignatur und MAC
HashFunctionCtxMessageAuthnCodeCtxSignerPrivateCtxVerifierPublicCtxSchlüsselmaterial
KeyAgreementPrivateCtxKeyDecapsulatorPrivateCtxKeyDerivationFunctionCtxKeyEncapsulatorPublicCtxProtectedKeyImportCtxSymmetricKeyWrapperCtxSchlüsselobjekte
CryptoObjectPrivateKeyPublicKeySymmetricKeySchlüsselspeicher
KeySlotWriteableKeySlotKontextbasis
CryptoContextCryptoProviderRandomGeneratorCtx主题图
Schlüsselmaterial
6KI-gestützte Gruppierung auf Basis der Records und Spezifikationsauszüge; keine Gliederung aus der AUTOSAR-Spezifikation.
类图
Abgerundete Rahmen = Namespace- bzw. Klassen-Scopes; hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); graue Boxen = namespace-fremde bzw. externe Basisklassen. Klicken öffnet die jeweilige Klassen- bzw. cppreference-Seite.
此版本没有元素数据
Verschlüsselung
Authenticated Cipher Context interface.
继承自 CryptoContext
Interface for asymmetric decryption.
继承自 CryptoContext
Interface for asymmetric encryption.
继承自 CryptoContext
Interface for Symmetric Cipher Operations.
继承自 CryptoContext
Signatur und MAC
Hash function interface.
继承自 CryptoContext
Keyed Message Authentication Code Context interface definition.
继承自 CryptoContext
Signature Private key Context interface.
继承自 CryptoContext
Signature Verification Public key Context interface.
继承自 CryptoContext
Schlüsselmaterial
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
A contexts for importing secured data such as secret key-material.
继承自 CryptoContext
Context of a symmetric key wrap algorithm.
继承自 CryptoContext
Schlüsselobjekte
A common interface for all cryptographic objects recognizable by the Crypto Provider.
继承自 ara::crypto::Serializable
作为基类 PrivateKey, PublicKey, SymmetricKey
Generalized Asymmetric Private Key interface.
继承自 CryptoObject
General Asymmetric Public Key interface.
继承自 CryptoObject
Symmetric Key interface.
继承自 CryptoObject
Schlüsselspeicher
KeySlot interface representing a storage location for a key in a CryptoProvider.
作为基类 WriteableKeySlot
WriteableKeySlot interface representing a writeable storage location for a key in a Crypto Provider.
继承自 KeySlot
Kontextbasis
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
CryptoProviderInterface representing one implementation of a set of cryptographic primitives with a key storage.
Interface of Random Number Generator Context.
继承自 CryptoContext
gemini-3.8-flash-low· 2026-10-13 · 德文原文