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

उपयोगकर्ता गाइडएआई जनित

विभिन्न प्रारूपों के बीच क्रिप्टोग्राफ़िक डेटा के थ्रेड-सुरक्षित रूपांतरण और क्रमबद्धीकरण (serialization) को सक्षम बनाता है।
एआई-जनित असत्यापित मॉडल: gemini-3.8-flash-medium · प्रयास: medium · तापमान: नियंत्रित नहीं किया जा सकता · प्रॉम्प्ट: f0bec470b702 उद्गम खुले प्रश्न (2)
जर्मन मार्गदर्शिका से अनूदितgemini-3.8-flash-low · 2026-10-13 · जर्मन मूल

विभिन्न प्रारूपों के बीच क्रिप्टोग्राफ़िक डेटा के थ्रेड-सुरक्षित रूपांतरण और क्रमबद्धीकरण (serialization) को सक्षम बनाता है।

इंटरफ़ेस ara::crypto::Formatter रॉ, DER और PEM प्रारूपों के बीच क्रिप्टोग्राफ़िक डेटा के थ्रेड-सुरक्षित रूपांतरण और सीरियलाइज़ेशन को सक्षम बनाता है [SWS_CRYPT_50197]। लक्ष्य प्रारूप निर्धारित करने और आवश्यक बफ़र आकार का पता लगाने के बाद, विधि Convert स्रोत डेटा को तैयार आउटपुट बफ़र में स्थानांतरित करती है [SWS_CRYPT_50198]। सफल निष्पादन के लिए आवश्यक पूर्वशर्त पर्याप्त रूप से बड़ा लक्ष्य मेमोरी आकार और कॉन्फ़िगर किए गए स्रोत प्रारूप के साथ इनपुट डेटा का औपचारिक अनुपालन है।

संदर्भ

मॉड्यूल crypto में इंटरफ़ेस ara::crypto::Formatter क्रिप्टोग्राफ़िक डेटा संरचनाओं के फ़ॉर्मेटिंग, रूपांतरण और सीरियलाइज़ेशन के लिए एक समान इंटरफ़ेस परिभाषित करता है। इसका मुख्य कार्य पेलोड डेटा और क्रिप्टोग्राफ़िक ऑब्जेक्ट्स को किसी एल्गोरिदम पहचानकर्ता (AlgId) को ध्यान में रखते हुए शुद्ध रॉ डेटा (kFormatRawValueOnly), ASN.1-DER-एन्कोडिंग (kFormatDerEncoded) और टेक्स्टुअल PEM प्रारूपों (kFormatPemEncoded) जैसे निरूपणों के बीच परिवर्तित करना है [SWS_CRYPT_50197]। इस प्रक्रिया में, Formatter क्रिप्टोग्राफ़िक ऑब्जेक्ट्स और मेमोरी बफ़र्स के बीच एक मध्यस्थ के रूप में कार्य करता है, जो ReadOnlyMemRegion के माध्यम से डेटा पढ़ता है और ReadWriteMemRegion में आउटपुट देता है [SWS_CRYPT_50198]।

जीवनचक्र

चूँकि ara::crypto::Formatter को पूरी तरह से वर्चुअल इंटरफ़ेस के रूप में घोषित किया गया है, यह संदर्भ और जीवनचक्र प्रबंधन के लिए कैनोनिकल स्मार्ट-पॉइंटर टाइप उपनाम Sptr प्रदान करता है, जिसे std::shared_ptr<Formatter> के रूप में परिभाषित किया गया है [SWS_CRYPT_50191]। व्यवहार में, इंटरफ़ेस के ठोस इंस्टेंस उच्च-स्तरीय क्रिप्टो घटकों के फ़ैक्टरी विधियों के माध्यम से प्रदान किए जाने की संभावना है। प्रश्न Q-99e96992d02b9c13 (खुला) निर्माण के बाद, रूपांतरणों के लिए कॉन्फ़िगरेशन कॉल के माध्यम से तैयार किए जाने से पहले Formatter शुरुआत में एक असंगत प्रारंभिक स्थिति में होता है।

निष्पादन परिवेश के संबंध में, इंटरफ़ेस noexcept के सुसंगत उपयोग और परिणाम प्रकारों [SWS_CRYPT_50197], [SWS_CRYPT_50198], [SWS_CRYPT_50199] के माध्यम से त्रुटि प्रबंधन द्वारा पूर्ण अपवाद-सुरक्षा (exception safe) की गारंटी देता है। इसके अलावा, सभी सदस्य फ़ंक्शन थ्रेड-सुरक्षित (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 के साथ विशिष्ट डेटा रूपांतरणएप्लिकेशनफ़ॉर्मेटरSetFormatConfiguration(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 प्रकार के रिटर्न मानों के माध्यम से त्रुटि स्थितियों को निर्धारक रूप से संकेतित करती हैं। इस प्रक्रिया में, विफल होने वाले ऑपरेशनों के लिए स्पष्ट रोलबैक शब्दार्थ (semantics) परिभाषित हैं:

  • असमर्थित प्रारूप: यदि अंतर्निहित कार्यान्वयन निर्दिष्ट रूपांतरण युग्म या एल्गोरिदम पहचानकर्ता का समर्थन नहीं करता है, तो 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) पर आधारित है और स्वचालित रूप से तैयार की गई थी।

सदस्य मानचित्र

टाइप उपनाम

1

क्लास आरेख

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;
GetExportSize फ़ंक्शन

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;
SetFormatConfiguration फ़ंक्शन

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.

एआई-जनित असत्यापित मॉडल: gemini-3.8-flash-medium · प्रयास: medium · तापमान: नियंत्रित नहीं किया जा सकता · प्रॉम्प्ट: 96118f35b505 उद्गम
जर्मन मार्गदर्शिका से अनूदितgemini-3.8-flash-low · 2026-10-13 · जर्मन मूल

इंटरफ़ेस ara::crypto::Formatter का विशुद्ध वर्चुअल सदस्य फ़ंक्शन (pure virtual member function) 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#7bffa1a8
Content hash
7bffa1a8
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#d14d7a75
Content hash
d14d7a75
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#be5526c5
Content hash
be5526c5
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#e150b7d8
Content hash
e150b7d8
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