AusweisApp2
Lade ...
Suche ...
Keine Treffer
ChipAuthenticationInfo.h
gehe zur Dokumentation dieser Datei
1
7#pragma once
8
9
10#include "SecurityInfo.h"
11
12
13namespace governikus
14{
15
28{
29 ASN1_OBJECT* mProtocol;
30 ASN1_INTEGER* mVersion;
31 ASN1_INTEGER* mKeyId;
32};
33DECLARE_ASN1_FUNCTIONS(chipauthenticationinfo_st)
35
36
37/*
38 * Wrapper for structure chipauthenticationinfo_st.
39 */
41 : public SecurityInfo
42{
43 friend class QSharedPointer<const ChipAuthenticationInfo>;
44
45 private:
46 const QSharedPointer<const chipauthenticationinfo_st> mDelegate;
47
48 explicit ChipAuthenticationInfo(const QSharedPointer<const chipauthenticationinfo_st>& pDelegate);
49 [[nodiscard]] ASN1_OBJECT* getProtocolObjectIdentifier() const override;
50 static bool acceptsProtocol(const ASN1_OBJECT* pObjectIdentifier);
51
52 public:
53 static QSharedPointer<const ChipAuthenticationInfo> decode(const QByteArray& pBytes)
54 {
55 if (const auto& delegate = decodeObject<chipauthenticationinfo_st>(pBytes, false))
56 {
57 if (ChipAuthenticationInfo::acceptsProtocol(delegate->mProtocol))
58 {
59 return QSharedPointer<const ChipAuthenticationInfo>::create(delegate);
60 }
61 }
62 return QSharedPointer<const ChipAuthenticationInfo>();
63 }
64
65
66 [[nodiscard]] QByteArray encode() const
67 {
68 return encodeObject(const_cast<chipauthenticationinfo_st*>(mDelegate.data()));
69 }
70
71
72 [[nodiscard]] int getVersion() const;
73 [[nodiscard]] int getKeyId() const;
74};
75
76
77inline QDebug operator<<(QDebug pDbg, const QSharedPointer<const ChipAuthenticationInfo>& pChipAuthenticationInfo)
78{
79 QDebugStateSaver saver(pDbg);
80 pDbg.nospace().noquote() << pChipAuthenticationInfo->getOid()
81 << ", version: " << pChipAuthenticationInfo->getVersion()
82 << ", keyId: " << pChipAuthenticationInfo->getKeyId();
83 return pDbg;
84}
85
86
87} // namespace governikus
#define DECLARE_ASN1_OBJECT(name)
Definition: ASN1TemplateUtil.h:169
Definition: ChipAuthenticationInfo.h:42
static QSharedPointer< const ChipAuthenticationInfo > decode(const QByteArray &pBytes)
Definition: ChipAuthenticationInfo.h:53
QByteArray encode() const
Definition: ChipAuthenticationInfo.h:66
Definition: SecurityInfo.h:47
A simple template renderer.
Definition: ActivationContext.h:15
QByteArray encodeObject(T *pObject)
Template function for encoding an OpenSSL type as DER encoded QByteArray.
Definition: ASN1TemplateUtil.h:64
QDebug operator<<(QDebug pDbg, const CommandApdu &pCommandApdu)
Definition: CommandApdu.h:89
Definition: ChipAuthenticationInfo.h:28
ASN1_OBJECT * mProtocol
Definition: ChipAuthenticationInfo.h:29
ASN1_INTEGER * mKeyId
Definition: ChipAuthenticationInfo.h:31
ASN1_INTEGER * mVersion
Definition: ChipAuthenticationInfo.h:30