AusweisApp2
ChipAuthenticationInfo.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 
10 #include "SecurityInfo.h"
11 
12 
13 namespace governikus
14 {
15 
28 {
29  ASN1_OBJECT* mProtocol;
30  ASN1_INTEGER* mVersion;
31  ASN1_INTEGER* mKeyId;
32 };
33 DECLARE_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  [[nodiscard]] QByteArray encode() const;
55 
56  [[nodiscard]] int getVersion() const;
57  [[nodiscard]] bool hasKeyId() const;
58  [[nodiscard]] int getKeyId() const;
59 };
60 
61 
62 inline QDebug operator<<(QDebug pDbg, const QSharedPointer<const ChipAuthenticationInfo>& pChipAuthenticationInfo)
63 {
64  QDebugStateSaver saver(pDbg);
65  if (pChipAuthenticationInfo->hasKeyId())
66  {
67  pDbg.nospace().noquote() << pChipAuthenticationInfo->getOid()
68  << ", version: " << pChipAuthenticationInfo->getVersion()
69  << ", keyId: " << pChipAuthenticationInfo->getKeyId();
70  }
71  else
72  {
73  pDbg.nospace().noquote() << pChipAuthenticationInfo->getOid()
74  << ", version: " << pChipAuthenticationInfo->getVersion();
75  }
76  return pDbg;
77 }
78 
79 
80 } // namespace governikus
#define DECLARE_ASN1_OBJECT(name)
Definition: ASN1TemplateUtil.h:176
Definition: ChipAuthenticationInfo.h:42
Definition: SecurityInfo.h:48
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16
QByteArray encode() const
QDebug operator<<(QDebug pDbg, const CommandApdu &pCommandApdu)
Definition: CommandApdu.h:94
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