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