DEENESPTFRRUARHIKOZHNL

класс ara::crypto::cryp::CryptoContext

[SWS_CRYPT_20400] Upstream: RS_CRYPTO_02008

class CryptoContext {...};

A common interface of a mutable cryptographic context, i.e. that is not binded to a single crypto object.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Forwarding-Header#include "ara/crypto/crypto_fwd.h"
Scopenamespace ara::crypto::cryp

Руководство пользователяСОЗДАНО ИИ

Предоставляет базовый интерфейс для изменяемых криптоконтекстов с целью потокобезопасного запроса ID алгоритма.
СОЗДАНО ИИ не проверено Модель: gemini-3.8-flash-medium · Усилие: medium · Температура: не регулируется · Промпт: 40f33685b357 Происхождение Открытые вопросы (2)
переведено с немецкого руководстваgemini-3.8-flash-low · 2026-10-13 · Немецкий оригинал

Предоставляет базовый интерфейс для изменяемых криптоконтекстов с целью потокобезопасного запроса ID алгоритма.

Интерфейс служит общим базовым классом для изменяемых криптографических контекстов, которые не привязаны жестко к отдельному криптообъекту. С помощью чисто виртуального метода GetAlgId() он обеспечивает потокобезопасный запрос идентификатора алгоритма в виде ara::core::Result [SWS_CRYPT_20411]. Чтобы предотвратить нежелательное дублирование состояния, операции копирования и перемещения полностью запрещены [SWS_CRYPT_41003]. Освобождение ресурсов выполняется детерминированно и безопасно через виртуальный деструктор по умолчанию.

Контекст

Интерфейс ara::crypto::cryp::CryptoContext определяет базовую абстракцию для изменяемых криптографических контекстов (mutable cryptographic contexts) внутри криптографического модуля AUTOSAR Adaptive Platform. В отличие от статических криптографических объектов, такой контекст не привязан жестко к отдельному криптографическому объекту. Он служит скорее общим базовым классом для различных контекстов криптографической обработки, внутреннее состояние которых может изменяться во время выполнения криптографических операций.

Центральным элементом этого базового интерфейса выступает чисто виртуальная функция-член GetAlgId(). Она позволяет партнерам по взаимодействию запрашивать идентификатор криптографического алгоритма, сконфигурированного в данный момент в контексте [SWS_CRYPT_20411]. Конкретные контексты криптографических вычислений и преобразований, например для служб хеширования, подписи или шифрования, вероятно, наследуются в системе от CryptoContext для предоставления специфической функциональности алгоритмов. Вопрос Q-203d40209cd355fa (открытый)

Жизненный цикл

Жизненный цикл CryptoContext характеризуется однозначной идентичностью и строгими отношениями владения. Чтобы предотвратить неконтролируемое дублирование или несогласованную передачу состояний контекста во время компиляции, семантические операции копирования полностью запрещены. Как конструктор копирования [SWS_CRYPT_41003], так и оператор присваивания с копированием [SWS_CRYPT_30214] явно объявлены удаленными (=delete).

Таким же образом определение интерфейса предотвращает перемещение контекстов: как конструктор перемещения [SWS_CRYPT_41004], так и оператор присваивания с перемещением [SWS_CRYPT_30215] удалены (=delete). Экземпляры производных классов поэтому постоянно остаются на своем исходном месте в памяти. Уничтожение и освобождение ресурсов происходят детерминированно через виртуальный деструктор, определенный как default и noexcept [SWS_CRYPT_20401]. Это гарантирует безопасное освобождение производных объектов контекста через указатели на базовый интерфейс без утечек ресурсов.

Что касается параллелизма, требование для GetAlgId() явно специфицирует потокобезопасность [SWS_CRYPT_20411]. Таким образом, несколько потоков могут одновременно и без внешней синхронизации считывать идентификатор алгоритма одного и того же контекста.

Путь использования

Поскольку CryptoContext представляет собой чисто виртуальный интерфейс, разработчики приложений не могут создавать прямые экземпляры. Экземпляры специализированных классов контекста обычно создаются через фабричные функции или компоненты-поставщики криптографического стека и предоставляются вызывающей стороне через указатели или ссылки. Вопрос Q-728a7b6dd526eb64 (открытый) Типичный рабочий процесс использования на уровне базового интерфейса включает следующие фазы:

  • Предоставление: вызывающая сторона получает ссылку или указатель на сконфигурированный контекст от криптопровайдера.
  • Проверка алгоритма: с помощью вызова GetAlgId() запрашивается и оценивается идентификатор алгоритма [SWS_CRYPT_20411], чтобы убедиться, что контекст удовлетворяет требуемым спецификациям.
  • Операция и очистка: после выполнения алгоритмо-специфичных операций через производный интерфейс контекст автоматически освобождается через виртуальный деструктор [SWS_CRYPT_20401].

Сценарии ошибок

Концепция обработки ошибок CryptoContext следует общему отказоустойчивому дизайну AUTOSAR Adaptive Platform и не использует исключения C++. Метод GetAlgId() специфицирован как безопасный относительно исключений (exception safe) и возвращает свой результат в ara::core::Result<ara::crypto::AlgIdString> [SWS_CRYPT_20411]. Если при определении ID алгоритма возникает ошибка, она передается по каналу ошибок объекта Result.

Согласно спецификации, GetAlgId() не определяет стандартизированных кодов ошибок [SWS_CRYPT_20411]. Вызывающие стороны должны прежде всего проверять, содержит ли Result допустимое значение, прежде чем обращаться к строке ID алгоритма. При удалении объекта объявленный с noexcept виртуальный деструктор гарантирует, что во время уничтожения исключения не распространяются и очистка всегда завершается надежно [SWS_CRYPT_20401].

Настоящее руководство основано на спецификации AUTOSAR Adaptive R25-11 и сгенерировано с помощью ИИ-ассистента курации.

Карта членов

Конструкторы и деструктор

2

Методы

1

Операторы

1

Диаграмма классов

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

G nara__crypto__cryp__CryptoContext85 CryptoContext + CryptoContext() + operator=() + ~CryptoContext() + GetAlgId() nara__crypto__cryp__AuthCipherCtx142 AuthCipherCtx nara__crypto__cryp__AuthCipherCtx142->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__DecryptorPrivateCtx616 DecryptorPrivateCtx nara__crypto__cryp__DecryptorPrivateCtx616->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__EncryptorPublicCtx829 EncryptorPublicCtx nara__crypto__cryp__EncryptorPublicCtx829->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__HashFunctionCtx412 HashFunctionCtx nara__crypto__cryp__HashFunctionCtx412->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__KeyAgreementPrivateCtx203 KeyAgreementPrivateCtx nara__crypto__cryp__KeyAgreementPrivateCtx203->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__KeyDecapsulatorPrivateCtx748 KeyDecapsulatorPrivateCtx nara__crypto__cryp__KeyDecapsulatorPrivateCtx748->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__KeyDerivationFunctionCtx485 KeyDerivationFunctionCtx nara__crypto__cryp__KeyDerivationFunctionCtx485->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__KeyEncapsulatorPublicCtx699 KeyEncapsulatorPublicCtx nara__crypto__cryp__KeyEncapsulatorPublicCtx699->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__MessageAuthnCodeCtx845 MessageAuthnCodeCtx nara__crypto__cryp__MessageAuthnCodeCtx845->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__ProtectedKeyImportCtx279 ProtectedKeyImportCtx nara__crypto__cryp__ProtectedKeyImportCtx279->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__RandomGeneratorCtx512 RandomGeneratorCtx nara__crypto__cryp__RandomGeneratorCtx512->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__SignerPrivateCtx943 SignerPrivateCtx nara__crypto__cryp__SignerPrivateCtx943->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__SymmetricCipherCtx167 SymmetricCipherCtx nara__crypto__cryp__SymmetricCipherCtx167->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__SymmetricKeyWrapperCtx465 SymmetricKeyWrapperCtx nara__crypto__cryp__SymmetricKeyWrapperCtx465->nara__crypto__cryp__CryptoContext85 nara__crypto__cryp__VerifierPublicCtx35 VerifierPublicCtx nara__crypto__cryp__VerifierPublicCtx35->nara__crypto__cryp__CryptoContext85

Подробный вид

Выберите элемент в оглавлении.

Конструкторы и деструктор

CryptoContext функция 2

Copy-Constructor.

Перегрузки CryptoContext 2
CryptoContext (const CryptoContext &)=delete; SWS_CRYPT_41003
CryptoContext (CryptoContext &&)=delete; SWS_CRYPT_41004
~CryptoContext функция

Destructor.

virtual ~CryptoContext () noexcept=default;

Методы

GetAlgId функция

The interface shall return the AlgId of the context.

virtual ara::core::Result< ara::crypto::AlgIdString > GetAlgId () const noexcept=0;

Операторы

operator= функция 2

Copy-assign another CryptoContext to this instance.

Перегрузки = 2
CryptoContext & operator= (const CryptoContext &other)=delete; SWS_CRYPT_30214
CryptoContext & operator= (CryptoContext &&other)=delete; SWS_CRYPT_30215

Документация методов

функция CryptoContext [SWS_CRYPT_41003] Upstream: RS_CRYPTO_02004

CryptoContext (const CryptoContext &)=delete;

Copy-Constructor.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext

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

Record
AUTOSAR/AP/record/SWS_CRYPT_41003
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_41003@rel:R25-11#e58481af
Content hash
e58481af
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_41003
Status: valid/unmigrated Version: rel:R25-11#98ee9054 Versionshistorie & Revisions (1 transition, 4 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_41003@rel:R25-11#98ee9054
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#8cdfc0542026-09-30
  • R23-11rel:R23-11#24b116da2026-10-14
  • R24-11rel:R24-11#98ee90542026-10-14
  • R25-11rel:R25-11#98ee90542026-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

функция CryptoContext [SWS_CRYPT_41004] Upstream: RS_CRYPTO_02004

CryptoContext (CryptoContext &&)=delete;

Move-Constructor.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext

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

Record
AUTOSAR/AP/record/SWS_CRYPT_41004
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_41004@rel:R25-11#e18ebbc8
Content hash
e18ebbc8
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_41004
Status: valid/unmigrated Version: rel:R25-11#62d2964c Versionshistorie & Revisions (1 transition, 4 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_41004@rel:R25-11#62d2964c
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#e84c8c582026-09-30
  • R23-11rel:R23-11#d9afa7b72026-10-14
  • R24-11rel:R24-11#62d2964c2026-10-14
  • R25-11rel:R25-11#62d2964c2026-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

функция GetAlgId [SWS_CRYPT_20411] Upstream: RS_CRYPTO_02008

virtual ara::core::Result< ara::crypto::AlgIdString > GetAlgId () const noexcept=0;

The interface shall return the AlgId of the context.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Rückgabewert

TypBeschreibung
ara::core::Result<ara::crypto::AlgIdString >the AlgId of the context or an error

Fehler

FehlercodeBeschreibung
This function does not specify any standardized errors.

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

Record
AUTOSAR/AP/record/SWS_CRYPT_20411
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_20411@rel:R25-11#95fedbb6
Content hash
95fedbb6
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_20411
Status: valid/unmigrated Version: rel:R25-11#268ba62b 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_20411@rel:R25-11#268ba62b
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#0505bc8c2026-09-30
  • R19-11rel:R19-11#44b1ac7b2026-10-14
  • R20-11rel:R20-11#1bdef3fa2026-10-14
  • R21-11rel:R21-11#1bdef3fa2026-10-14
  • R22-11rel:R22-11#5dd94a472026-10-14
  • R23-11rel:R23-11#3ac9359d2026-10-14
  • R24-11rel:R24-11#d2d6ca2d2026-10-14
  • R25-11rel:R25-11#268ba62b2026-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

функция operator= [SWS_CRYPT_30214] Upstream: RS_CRYPTO_02004

CryptoContext & operator= (const CryptoContext &other)=delete;

Copy-assign another CryptoContext to this instance.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext

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

Record
AUTOSAR/AP/record/SWS_CRYPT_30214
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_30214@rel:R25-11#b19bc322
Content hash
b19bc322
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_30214
Status: valid/unmigrated Version: rel:R25-11#54e94bf7 Versionshistorie & Revisions (1 transition, 7 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_30214@rel:R25-11#54e94bf7
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#7667e7772026-09-30
  • R20-11rel:R20-11#8da104e32026-10-14
  • R21-11rel:R21-11#78cc10a82026-10-14
  • R22-11rel:R22-11#760b4ede2026-10-14
  • R23-11rel:R23-11#8fd55e4c2026-10-14
  • R24-11rel:R24-11#54e94bf72026-10-14
  • R25-11rel:R25-11#54e94bf72026-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

функция operator= [SWS_CRYPT_30215] Upstream: RS_CRYPTO_02004

CryptoContext & operator= (CryptoContext &&other)=delete;

Move-assign another CryptoContext to this instance.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext

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

Record
AUTOSAR/AP/record/SWS_CRYPT_30215
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_30215@rel:R25-11#de34888b
Content hash
de34888b
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_30215
Status: valid/unmigrated Version: rel:R25-11#f0c7c4e1 Versionshistorie & Revisions (1 transition, 7 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_30215@rel:R25-11#f0c7c4e1
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#e0e202f42026-09-30
  • R20-11rel:R20-11#17d0c85f2026-10-14
  • R21-11rel:R21-11#17d0c85f2026-10-14
  • R22-11rel:R22-11#843bd59e2026-10-14
  • R23-11rel:R23-11#50f4cde12026-10-14
  • R24-11rel:R24-11#f0c7c4e12026-10-14
  • R25-11rel:R25-11#f0c7c4e12026-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

функция ~CryptoContext [SWS_CRYPT_20401] Upstream: RS_CRYPTO_02008

virtual ~CryptoContext () noexcept=default;

Destructor.

Header-Datei#include "ara/crypto/cryp/crypto_context.h"
Scopeclass ara::crypto::cryp::CryptoContext
Exception-Sicherheitexception safe

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

Record
AUTOSAR/AP/record/SWS_CRYPT_20401
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_20401@rel:R25-11#a4db7797
Content hash
a4db7797
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_20401
Status: valid/unmigrated Version: rel:R25-11#0d1ace43 Versionshistorie & Revisions (1 transition, 7 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_20401@rel:R25-11#0d1ace43
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#a3a37bef2026-09-30
  • R20-11rel:R20-11#0a163ac42026-10-14
  • R21-11rel:R21-11#5ba66c7c2026-10-14
  • R22-11rel:R22-11#91bc35ba2026-10-14
  • R23-11rel:R23-11#40c1b8e32026-10-14
  • R24-11rel:R24-11#66216e1d2026-10-14
  • R25-11rel:R25-11#0d1ace432026-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