функция Encapsulate [SWS_CRYPT_21813] Upstream: RS_CRYPTO_02102, RS_CRYPTO_02108, RS_CRYPTO_02115
virtual ara::core::Result< std::size_t > Encapsulate (Symmetric Key::Sptr key, ReadWriteMemRegion encapsulatedKey) const noexcept=0;
Encapsulate the provided symmetric key.
Синхронный метод Encapsulate инкапсулирует переданный симметричный ключ (key) и записывает результат в выходной буфер encapsulatedKey [SWS_CRYPT_21813]. При успешном выполнении он возвращает через ara::core::Result<std::size_t> размер инкапсулированного ключа в байтах [SWS_CRYPT_21813].
В случае ошибки возвращается соответствующий код ошибки с семантикой отката (rollback) [SWS_CRYPT_21813]. Релевантными причинами ошибок являются:
UninitializedContext: Контекст не был инициализирован значением открытого ключа [SWS_CRYPT_21813].ara::crypto::CryptoErrc::kUsageViolation: У ключа инкапсуляции отсутствует флаг использованияkAllowKeyWrappingили у инкапсулируемого ключа отсутствуетkAllowSecuredExport[SWS_CRYPT_21813].ara::crypto::CryptoErrc::kIncompatibleObjectилиCryptoErrc::kInvalidInputSize: Объект ключа несовместим или размер ключа не поддерживается контекстом [SWS_CRYPT_21813].CryptoErrc::kUnsupported: Контекст не поддерживает инкапсуляцию предоставленных ключей, поскольку генерирует их самостоятельно во время инкапсуляции [SWS_CRYPT_21813].ara::crypto::CryptoErrc::kInsufficientCapacity: БуферencapsulatedKeyимеет слишком малый размер [SWS_CRYPT_21813].ara::crypto::CryptoErrc::kBusyResourceилиara::crypto::CryptoErrc::kEmptyKeySlot: Ресурс занят или сконфигурированный KeySlot пуст [SWS_CRYPT_21813].
Операция объявлена как const, noexcept, а также специфицирована как thread-safe и exception safe [SWS_CRYPT_21813].
Во взаимодействии с модулем эта функция отличается от альтернативной перегрузки [SWS_CRYPT_50011], которая не принимает существующий ключ, а динамически генерирует симметричный ключ заново и возвращает его вместе с результатом инкапсуляции [SWS_CRYPT_50011].
Автоматически сгенерированное указание по использованию на основе AUTOSAR R25-11.
| Header-Datei | #include "ara/crypto/cryp/key_encapsulator_public_ctx.h" |
|---|---|
| Scope | class ara::crypto::cryp::KeyEncapsulatorPublicCtx |
| Exception-Sicherheit | exception safe |
| Thread-Sicherheit | thread-safe CryptoErrc::k rollback_semantics |
Parameter (in)
| Parameter | Beschreibung |
|---|---|
| key | the symmetric key to be encapsulated |
Parameter (out)
| Parameter | Beschreibung |
|---|---|
| encapsulatedKey | an output buffer the encapsulated key is written to |
Rückgabewert
| Typ | Beschreibung |
|---|---|
| ara::core::Result<std::size_t > | a result containing the size of the encapsulated key or an error |
Fehler
| Fehlercode | Beschreibung |
|---|---|
| UninitializedContext | if the context was not initialized by a public key value |
| ara::crypto::CryptoErrc::kUsageViolation | rollback_semantics if the allowed usage of the encapsulation key does not include k AllowKeyWrapping or if the allowed usage of the encapsulated key does not include kAllowSecuredExport |
| ara::crypto::CryptoErrc::kIncompatibleObject | rollback_semantics if the provided encapsulated key object is incompatible with this context |
| CryptoErrc::kInvalidInputSize | rollback_semantics if this context does not support the size of the encapsulated key |
| CryptoErrc::kUnsupported | rollback_semantics if this context does not support setting the encapsulated key, because it generates the key during encapsulation |
| ara::crypto::CryptoErrc::kInsufficientCapacity | rollback_semantics if the output buffer is too small |
| ara::crypto::CryptoErrc::kBusyResource | rollback_semantics a required resource is busy |
| ara::crypto::CryptoErrc::kEmptyKeySlot | rollback_semantics if a KeySlot was configured that is currently is empty |
| ara::crypto::CryptoErrc::kUsageViolation | rollback_semantics if the allowed usage of the key does not include kAllowKeyWrapping |
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/SWS_CRYPT_21813- Status
- valid/unmigrated
- Version
AUTOSAR/AP/record/SWS_CRYPT_21813@rel:R25-11#53b6f8cd- Content hash
53b6f8cd- Source
- https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_21813
Status: valid/unmigrated
Version: rel:R25-11#5f08acc8
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_21813@rel:R25-11#5f08acc8
Recorded Revisions (8):
- R25-11
rel:R25-11#b3c8ad102026-09-30 - R19-11
rel:R19-11#5df6f2a12026-10-14 - R20-11
rel:R20-11#bc53d66f2026-10-14 - R21-11
rel:R21-11#a093fad52026-10-14 - R22-11
rel:R22-11#9a52ca012026-10-14 - R23-11
rel:R23-11#dadd77c62026-10-14 - R24-11
rel:R24-11#2cf84d842026-10-14 - R25-11
rel:R25-11#5f08acc82026-10-14 active
Requirement Text as-of this release:
Curation Decisions:
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 · Немецкий оригинал