AusweisApp2
Lade ...
Suche ...
Keine Treffer
SecurityInfo.h
gehe zur Dokumentation dieser Datei
1
7#pragma once
8
9#include "ASN1TemplateUtil.h"
10#include "SecurityProtocol.h"
11
12#include <QSharedPointer>
13#include <openssl/asn1.h>
14
15
16namespace governikus
17{
18
29{
30 ASN1_OBJECT* mProtocol;
31 ASN1_TYPE* mRequiredData;
32 ASN1_TYPE* mOptionalData;
33};
34
35DECLARE_ASN1_FUNCTIONS(securityinfo_st)
36#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
37DECLARE_STACK_OF(securityinfo_st)
38#else
39DEFINE_STACK_OF(securityinfo_st)
40#endif
42
43/*
44 * Because OpenSSL's template macro system does not support inheritance,
45 * we wrap the securityinfo_st in class SecurityInfo and use this for inheritance.
46 */
48{
49 Q_DISABLE_COPY(SecurityInfo)
50 friend class QSharedPointer<const SecurityInfo>;
51
52 private:
53 const QSharedPointer<const securityinfo_st> mDelegate;
54
55 explicit SecurityInfo(const QSharedPointer<const securityinfo_st>& pDelegate);
56
57 /*
58 * Sub classes must override this method to allow the base class to access
59 * the protocol's ASN1_OBJECT pointer.
60 */
61 [[nodiscard]] virtual ASN1_OBJECT* getProtocolObjectIdentifier() const;
62
63 protected:
65
66 public:
67 static QSharedPointer<const SecurityInfo> decode(const QByteArray& pBytes);
68
69 virtual ~SecurityInfo() = default;
70
74 [[nodiscard]] Oid getOid() const;
75
79 [[nodiscard]] SecurityProtocol getProtocol() const;
80};
81
82
83inline QDebug operator<<(QDebug pDbg, const QSharedPointer<const SecurityInfo>& pSecurityInfo)
84{
85 QDebugStateSaver saver(pDbg);
86 pDbg.nospace().noquote() << pSecurityInfo->getOid();
87 return pDbg;
88}
89
90
91} // namespace governikus
#define DECLARE_ASN1_OBJECT(name)
Definition: ASN1TemplateUtil.h:176
Definition: SecurityInfo.h:48
virtual ~SecurityInfo()=default
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16
Oid getOid() const
QDebug operator<<(QDebug pDbg, const CommandApdu &pCommandApdu)
Definition: CommandApdu.h:94
Definition: SecurityInfo.h:29
ASN1_TYPE * mOptionalData
Definition: SecurityInfo.h:32
ASN1_OBJECT * mProtocol
Definition: SecurityInfo.h:30
ASN1_TYPE * mRequiredData
Definition: SecurityInfo.h:31