1 /*!
2  * \copyright Copyright (c) 2014-2021 Governikus GmbH & Co. KG, Germany
3  */
4 
5 #include "ASN1TemplateUtil.h"
6 #include "ASN1Util.h"
7 #include "ChipAuthenticationInfo.h"
8 #include "KnownOIDs.h"
9 #include "PaceInfo.h"
10 #include "SecurityInfo.h"
11 
12 #include <QLoggingCategory>
13 
14 
15 using namespace governikus;
16 using namespace KnownOIDs;
17 
18 
19 Q_DECLARE_LOGGING_CATEGORY(card)
20 
21 
22 namespace governikus
23 {
24 
25 ASN1_SEQUENCE(securityinfo_st) = {
26 	ASN1_SIMPLE(securityinfo_st, mProtocol, ASN1_OBJECT),
27 	ASN1_SIMPLE(securityinfo_st, mRequiredData, ASN1_ANY),
28 	ASN1_OPT(securityinfo_st, mOptionalData, ASN1_ANY)
29 }
30 
31 
32 ASN1_SEQUENCE_END(securityinfo_st)
33 
34 IMPLEMENT_ASN1_FUNCTIONS(securityinfo_st)
35 
36 IMPLEMENT_ASN1_OBJECT(securityinfo_st)
37 
38 }  // namespace governikus
39 
40 
SecurityInfo()41 SecurityInfo::SecurityInfo()
42 	: mDelegate(nullptr)
43 {
44 }
45 
46 
SecurityInfo(const QSharedPointer<const securityinfo_st> & pDelegate)47 SecurityInfo::SecurityInfo(const QSharedPointer<const securityinfo_st>& pDelegate)
48 	: mDelegate(pDelegate)
49 {
50 	Q_ASSERT(pDelegate != nullptr);
51 }
52 
53 
getProtocolObjectIdentifier() const54 ASN1_OBJECT* SecurityInfo::getProtocolObjectIdentifier() const
55 {
56 	return mDelegate->mProtocol;
57 }
58 
59 
getProtocolValueBytes() const60 QByteArray SecurityInfo::getProtocolValueBytes() const
61 {
62 	return Asn1ObjectUtil::getValue(getProtocolObjectIdentifier());
63 }
64 
65 
getProtocol() const66 QByteArray SecurityInfo::getProtocol() const
67 {
68 	return Asn1ObjectUtil::convertTo(getProtocolObjectIdentifier());
69 }
70 
71 
~SecurityInfo()72 SecurityInfo::~SecurityInfo()
73 {
74 }
75