DEENESPTFRRUARHIKOZHNL

클래스 ara::crypto::Formatter

[SWS_CRYPT_50190] Upstream: RS_CRYPTO_02105

class Formatter {...};

Formatter object interface.

Header-Datei#include "ara/crypto/common/formatter.h"
Forwarding-Header#include "ara/crypto/crypto_fwd.h"
Scopenamespace ara::crypto

사용자 가이드AI 생성

서로 다른 포맷 간 암호화 데이터의 스레드 안전한 변환 및 직렬화를 가능하게 합니다.
AI 생성 미검증 모델: gemini-3.8-flash-medium · 노력: medium · 온도: 제어 불가 · 프롬프트: f0bec470b702 출처 열린 질문 (2)
독일어 가이드에서 번역됨gemini-3.8-flash-low · 2026-10-13 · 독일어 원문

서로 다른 포맷 간 암호화 데이터의 스레드 안전한 변환 및 직렬화를 가능하게 합니다.

인터페이스 ara::crypto::Formatter은(는) 원시, DER 및 PEM 포맷 간 암호화 데이터의 스레드 안전한 변환 및 직렬화를 가능하게 합니다 [SWS_CRYPT_50197]. 대상 포맷을 결정하고 필요한 버퍼 크기를 확인한 후, 메서드 Convert은(는) 준비된 출력 버퍼 [SWS_CRYPT_50198](으)로 소스 데이터를 전송합니다. 성공적인 실행을 위한 필수 전제 조건은 충분한 크기의 대상 메모리와 구성된 소스 포맷에 대한 입력 데이터의 형식적 일치입니다.

컨텍스트

인터페이스 ara::crypto::Formatter은(는) crypto 모듈에서 암호화 데이터 구조의 포맷팅, 변환 및 직렬화를 위한 통일된 인터페이스를 정의합니다. 주요 역할은 알고리즘 식별자(AlgId)를 고려하여 순수 원시 데이터(kFormatRawValueOnly), ASN.1 DER 인코딩(kFormatDerEncoded) 및 텍스트 PEM 포맷(kFormatPemEncoded)과 같은 표현 간에 페이로드 및 암호화 객체를 변환하는 것입니다 [SWS_CRYPT_50197]. 여기서 Formatter는 ReadOnlyMemRegion을(를) 통해 데이터를 읽고 ReadWriteMemRegion(으)로 출력함으로써 암호화 객체와 메모리 버퍼 간의 연결 고리 역할을 합니다 [SWS_CRYPT_50198].

수명 주기

ara::crypto::Formatter은(는) 순수 가상 인터페이스로 선언되어 있으므로, 참조 및 수명 주기 관리를 위해 std::shared_ptr<Formatter>(으)로 정의된 표준 스마트 포인터 타입 별칭 Sptr을(를) 제공합니다 [SWS_CRYPT_50191]. 인터페이스의 구체적인 인스턴스는 실제 환경에서 상위 크립토 컴포넌트의 팩토리 메서드를 통해 제공될 것으로 보입니다. 질문 Q-99e96992d02b9c13 (열림) 생성된 후 Formatter는 변환을 위한 구성 호출을 통해 준비되기 전까지 초기에는 구성되지 않은 초기 상태에 있습니다.

실행 환경과 관련하여, 인터페이스는 noexcept의 일관된 사용 및 Result 타입을 통한 오류 처리를 통해 완전한 예외 안전성(exception safe)을 보장합니다 [SWS_CRYPT_50197], [SWS_CRYPT_50198], [SWS_CRYPT_50199]. 또한 모든 멤버 함수는 스레드 안전(thread-safe)한 것으로 명시되어 있습니다 [SWS_CRYPT_50197], [SWS_CRYPT_50198], [SWS_CRYPT_50199]. 이를 통해 경쟁적인 재구성이 발생하지 않는 한, 공유된 Formatter 인스턴스에 대한 여러 스레드의 병렬 읽기 및 변환 접근이 허용됩니다.

사용 경로

ara::crypto::Formatter의 일반적인 사용은 매개변수화, 용량 확인 및 변환이라는 정해진 순서를 따릅니다:

  1. 포맷 구성: SetFormatConfiguration을(를) 통해 처리할 데이터의 예상 입력 포맷(inputFormat), 원하는 출력 포맷(outputFormat) 및 알고리즘 식별자(algId)가 확정적으로 지정됩니다 [SWS_CRYPT_50197].
  2. 크기 결정: 실제 변환 전에 애플리케이션은 현재 구성에서 직렬화된 객체에 필요한 정확한 메모리 크기(바이트 단위)를 확인하기 위해 GetExportSize을(를) 호출합니다 [SWS_CRYPT_50199]. 이를 통해 대상 메모리를 알맞은 크기로 할당할 수 있습니다.
  3. 데이터 변환: 마지막으로 Convert은(는) 수행된 구성에 따라 ReadOnlyMemRegion의 소스 데이터를 대상 버퍼 ReadWriteMemRegion(으)로 변환합니다 [SWS_CRYPT_50198].
Formatter를 사용한 일반적인 데이터 변환애플리케이션FormatterSetFormatConfiguration(inputFormat, outputFormat, algId)Result<void>GetExportSize()Result<std::size_t>(버퍼 크기)Convert(input, out)Result<void>

시퀀스 다이어그램: 포맷 선택부터 버퍼 크기 결정, 실제 변환에 이르는 일반적인 변환 순서. 출처: [SWS_CRYPT_50197], [SWS_CRYPT_50199], [SWS_CRYPT_50198]

오류 시나리오

ara::crypto::Formatter의 메서드는 ara::core::Result 타입의 반환값을 통해 결정론적으로 오류 상태를 알립니다. 이때 실패한 연산에 대해 명확한 롤백 시맨틱이 정의되어 있습니다:

  • 지원되지 않는 포맷: 기본 구현이 지정된 변환 쌍 또는 알고리즘 식별자를 지원하지 않는 경우, SetFormatConfiguration은(는) 오류 코드 ara::crypto::CryptoErrc::kUnsupportedFormat을(를) 반환합니다 [SWS_CRYPT_50197].
  • 유효하지 않은 입력 데이터: 버퍼에 전달된 원시 데이터가 구성된 포맷과 일치하지 않거나 구문적으로 유효하지 않은 경우, Convert은(는) ara::crypto::CryptoErrc::kInvalidArgument(으)로 실패합니다 [SWS_CRYPT_50198].
  • 불충분한 대상 버퍼: 제공된 ReadWriteMemRegion이(가) 직렬화된 결과에 비해 너무 작은 경우, Convert은(는) ara::crypto::CryptoErrc::kInsufficientCapacity(으)로 중단됩니다 [SWS_CRYPT_50198]. 이 문제는 GetExportSize을(를) 통한 사전 쿼리를 통해 선제적으로 방지할 수 있습니다 [SWS_CRYPT_50199].
  • 사전 구성 누락: GetExportSize에 대해 표준화된 오류 코드가 나열되어 있지는 않지만 [SWS_CRYPT_50199], 일관된 크기 결정 또는 변환이 수행될 수 있도록 사전에 SetFormatConfiguration을(를) 통한 유효한 구성이 반드시 설정되어 있어야 할 것으로 추정됩니다. 질문 Q-e7cf4306bc7cfb49 (열림)

이 가이드는 AUTOSAR Adaptive Platform R25-11(crypto 모듈) 명세를 기반으로 하며 자동으로 생성되었습니다.

멤버 맵

클래스 다이어그램

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

G nara__crypto__Formatter631 Formatter + Convert() + GetExportSize() + SetFormatConfiguration()

상세 보기

개요에서 항목을 선택하세요.

메서드

Convert 함수

Converts the data according to the previous configuration of the Formatter.

virtual ara::core::Result< void > Convert (ReadOnlyMemRegion input, ReadWriteMemRegion out) const noexcept=0;

Get the size in bytes of the object when serialized using the current configuration of the Formatter.

virtual ara::core::Result< std::size_t > GetExportSize () const noexcept=0;

Configure the formatter with the expected input format, output format, and the AlgId of the data to be formatted. The input and output format may be kFormatRawValueOnly, kFormatDer Encoded, or kFormatPemEncoded.

virtual ara::core::Result< void > SetFormatConfiguration (FormatId inputFormat, FormatId outputFormat, AlgId algId) noexcept=0;

타입 별칭

Sptr 타입 별칭

Smart pointer of the interface.

using Sptr = std::shared_ptr<Formatter>;

메서드 문서

함수 Convert [SWS_CRYPT_50198] Upstream: RS_CRYPTO_02112

virtual ara::core::Result< void > Convert (ReadOnlyMemRegion input, ReadWriteMemRegion out) const noexcept=0;

Converts the data according to the previous configuration of the Formatter.

AI 생성 미검증 모델: gemini-3.8-flash-medium · 노력: medium · 온도: 제어 불가 · 프롬프트: 96118f35b505 출처
독일어 가이드에서 번역됨gemini-3.8-flash-low · 2026-10-13 · 독일어 원문

인터페이스 ara::crypto::Formatter의 순수 가상 멤버 함수 Convert은(는) 포매터 객체의 사전 정의된 구성에 따라 데이터의 동기 변환을 실행합니다 [SWS_CRYPT_50198]. 선언은 헤더 #include "ara/crypto/common/formatter.h"을(를) 통해 제공됩니다 [SWS_CRYPT_50198]. 호출을 위해 호출자는 원래 형식의 입력 데이터를 ReadOnlyMemRegion 유형의 버퍼 input을(를) 통해 전달하고, 변환된 데이터가 대상 형식으로 기록될 ReadWriteMemRegion 유형의 쓰기 가능한 버퍼 out을(를) 전달합니다 [SWS_CRYPT_50198].

반환값은 ara::core::Result<void>(으)로 정의되어 성공 또는 발생한 오류를 알립니다 [SWS_CRYPT_50198]. 변환 중에 문제가 발생하면 다음과 같은 특정 오류 코드와 함께 롤백 시맨틱이 적용됩니다 [SWS_CRYPT_50198]:

  • ara::crypto::CryptoErrc::kInvalidArgument: 직렬화된 입력 데이터가 지정된 형식과 일치하지 않는 경우 반환됩니다 [SWS_CRYPT_50198].
  • ara::crypto::CryptoErrc::kInsufficientCapacity: 전달된 출력 버퍼 out의 용량이 결과 데이터를 수용하기에 너무 작을 때 발생합니다 [SWS_CRYPT_50198].

동시성 및 결함 허용성과 관련하여 이 메서드는 스레드 안전(thread-safe) 및 예외 안전(exception safe)으로 명시되어 있습니다 [SWS_CRYPT_50198]. 시그니처에 지정자 const 및 noexcept이(가) 지정되어 있으므로, 이 연산은 C++ 예외를 발생시키지 않으며 포매터 인스턴스의 상태를 변경하지 않습니다 [SWS_CRYPT_50198].

이 사용 지침은 사양을 기반으로 AI에 의해 자동 생성되었습니다.

Header-Datei#include "ara/crypto/common/formatter.h"
Scopeclass ara::crypto::Formatter
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
inputan input buffer containing the data in the input format

Parameter (out)

ParameterBeschreibung
outan output buffer that the data will be written to in the output format

Rückgabewert

TypBeschreibung
ara::core::Result< void >An empty result or an error.

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kInvalidArgumentrollback_semantics if serialized does not conform to the specified format
ara::crypto::CryptoErrc::kInsufficientCapacityrollback_semantics if the output buffer is too small

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50198
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50198@rel:R25-11#80c66d99
Content hash
80c66d99
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50198
Status: valid/unmigrated Version: rel:R25-11#19644f36 Versionshistorie & Revisions (1 transition)
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_50198@rel:R25-11#19644f36
Point-in-Time History:
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

함수 GetExportSize [SWS_CRYPT_50199] Upstream: RS_CRYPTO_02112

virtual ara::core::Result< std::size_t > GetExportSize () const noexcept=0;

Get the size in bytes of the object when serialized using the current configuration of the Formatter.

Header-Datei#include "ara/crypto/common/formatter.h"
Scopeclass ara::crypto::Formatter
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Rückgabewert

TypBeschreibung
ara::core::Result<std::size_t >A result containing the size in bytes of the serialized object 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_50199
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50199@rel:R25-11#7f08a2b9
Content hash
7f08a2b9
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50199
Status: valid/unmigrated Version: rel:R25-11#b96bc7d6 Versionshistorie & Revisions (1 transition)
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_50199@rel:R25-11#b96bc7d6
Point-in-Time History:
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

함수 SetFormatConfiguration [SWS_CRYPT_50197] Upstream: RS_CRYPTO_02112

virtual ara::core::Result< void > SetFormatConfiguration (FormatId inputFormat, FormatId outputFormat, AlgId algId) noexcept=0;

Configure the formatter with the expected input format, output format, and the AlgId of the data to be formatted. The input and output format may be kFormatRawValueOnly, kFormatDer Encoded, or kFormatPemEncoded.

Header-Datei#include "ara/crypto/common/formatter.h"
Scopeclass ara::crypto::Formatter
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
inputFormatthe input format
outputFormatthe output format
algIdthe AlgId of the data to be formatted

Rückgabewert

TypBeschreibung
ara::core::Result< void >An empty result or an error.

Fehler

FehlercodeBeschreibung
ara::crypto::CryptoErrc::kUnsupportedFormatrollback_semantics if the specified conversion is not supported

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50197
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50197@rel:R25-11#2b08a690
Content hash
2b08a690
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50197
Status: valid/unmigrated Version: rel:R25-11#25ee4601 Versionshistorie & Revisions (1 transition)
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_50197@rel:R25-11#25ee4601
Point-in-Time History:
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

타입 별칭 문서

타입 별칭 Sptr [SWS_CRYPT_50191] Upstream: RS_CRYPTO_02306

using Sptr = std::shared_ptr<Formatter>;

Smart pointer of the interface.

Header-Datei#include "ara/crypto/common/formatter.h"
Scopeclass ara::crypto::Formatter
SymbolSptr

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

Record
AUTOSAR/AP/record/SWS_CRYPT_50191
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_50191@rel:R25-11#fe0d6882
Content hash
fe0d6882
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_50191
Status: valid/unmigrated Version: rel:R25-11#869e375a Versionshistorie & Revisions (1 transition)
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_50191@rel:R25-11#869e375a
Point-in-Time History:
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