AusweisApp2
ResponseApdu.h
gehe zur Dokumentation dieser Datei
1 
5 #pragma once
6 
7 #include "Apdu.h"
8 #include "CardReturnCode.h"
9 #include "EnumHelper.h"
10 
11 
12 namespace governikus
13 {
14 defineTypedEnumType(StatusCode, quint16,
15  EMPTY = 0x0000,
16  INVALID = 0x0001,
17  SUCCESS = 0x9000,
18  NO_PKCS15_APP = 0x6200,
19  END_OF_FILE = 0x6282,
20  PIN_DEACTIVATED = 0x6283,
21  FCI_NO_ISO7816_4 = 0x6284,
22  VERIFICATION_FAILED = 0x6300,
23  INPUT_TIMEOUT = 0x6400,
24  INPUT_CANCELLED = 0x6401,
25  PASSWORDS_DIFFER = 0x6402,
26  PASSWORD_OUTOF_RANGE = 0x6403,
27  CARD_EJECTED_AND_REINSERTED = 0x64a2,
28  EEPROM_CELL_DEFECT = 0x6581,
29  SECURITY_ENVIRONMENT = 0x6600,
30  WRONG_LENGTH = 0x6700,
31  NO_BINARY_FILE = 0x6981,
32  LAST_CHAIN_CMD_EXPECTED = 0x6883,
33  ACCESS_DENIED = 0x6982,
34  PASSWORD_COUNTER_EXPIRED = 0x6983,
35  DIRECTORY_OR_PASSWORD_LOCKED_OR_NOT_ALLOWED = 0x6984,
36  NO_PARENT_FILE = 0x6985,
37  NOT_YET_INITIALIZED = 0x6985,
38  NO_CURRENT_DIRECTORY_SELECTED = 0x6986,
39  DATAFIELD_EXPECTED = 0x6987,
40  INVALID_SM_OBJECTS = 0x6988,
41  COMMAND_NOT_ALLOWED = 0x69f0,
42  INVALID_DATAFIELD = 0x6a80,
43  ALGORITHM_ID = 0x6a81,
44  FILE_NOT_FOUND = 0x6a82,
45  RECORD_NOT_FOUND = 0x6a83,
46  INVALID_PARAMETER = 0x6a86,
47  LC_INCONSISTANT = 0x6a87,
48  PASSWORD_NOT_FOUND = 0x6a88,
49  ILLEGAL_OFFSET = 0x6b00,
50  UNSUPPORTED_CLA = 0x6e00,
51  CANT_DISPLAY = 0x6410,
52  INVALID_P1P2 = 0x6a00,
53  UNSUPPORTED_INS = 0x6d00,
54  PIN_BLOCKED = 0x63c0, // retries left: 0
55  PIN_SUSPENDED = 0x63c1, // retries left: 1
56  PIN_RETRY_COUNT_2 = 0x63c2, // retries left: 2
57  )
58 
59 // According to ISO-7816-4, 5.6 Status bytes, Table 6
61  INVALID = 0x00,
68  WRONG_LENGTH = 0x67,
77  SUCCESS = 0x90,
78  )
79 
81  : public Apdu
82 {
83  private:
84  static const int RETURN_CODE_LENGTH = 2;
85 
86  protected:
87  virtual void setBuffer(const QByteArray& pBuffer);
88 
89  public:
90  explicit ResponseApdu(StatusCode pStatusCode);
91  explicit ResponseApdu(const QByteArray& pBuffer = QByteArray());
92  virtual ~ResponseApdu() = default;
93 
94  [[nodiscard]] QByteArray getData() const;
95  [[nodiscard]] int getDataLength() const;
96  [[nodiscard]] StatusCode getReturnCode() const;
97  [[nodiscard]] QByteArray getReturnCodeAsHex() const;
98  [[nodiscard]] int getRetryCounter() const;
99  [[nodiscard]] SW1 getSW1() const;
100  [[nodiscard]] char getSW2() const;
101  [[nodiscard]] CardReturnCode getCardReturnCode() const;
102 };
103 
105 {
106  CardReturnCode mReturnCode = CardReturnCode::UNDEFINED;
108 };
109 
110 #ifndef QT_NO_DEBUG
111 inline bool operator ==(const ResponseApduResult& pLeft, const ResponseApduResult& pRight)
112 {
113  return pLeft.mReturnCode == pRight.mReturnCode && pLeft.mResponseApdu.getBuffer() == pRight.mResponseApdu.getBuffer();
114 }
115 
116 
117 #endif
118 
119 } // namespace governikus
NONVOLATILE_MEMORY_UNCHANGED_2
Definition: ResponseApdu.h:65
SECURITY_ISSUE
Definition: ResponseApdu.h:67
defineTypedEnumType(AccessRight, uint, WRITE_DG17=37, WRITE_DG18=36, WRITE_DG19=35, WRITE_DG20=34, WRITE_DG21=33, RFU_32=32, RFU_31=31, RFU_30=30, RFU_29=29, READ_DG21=28, READ_DG20=27, READ_DG19=26, READ_DG18=25, READ_DG17=24, READ_DG16=23, READ_DG15=22, READ_DG14=21, READ_DG13=20, READ_DG12=19, READ_DG11=18, READ_DG10=17, READ_DG09=16, READ_DG08=15, READ_DG07=14, READ_DG06=13, READ_DG05=12, READ_DG04=11, READ_DG03=10, READ_DG02=9, READ_DG01=8, INSTALL_QUAL_CERT=7, INSTALL_CERT=6, PIN_MANAGEMENT=5, CAN_ALLOWED=4, PRIVILEGED_TERMINAL=3, RESTRICTED_IDENTIFICATION=2, COMMUNITY_ID_VERIFICATION=1, AGE_VERIFICATION=0) defineTypedEnumType(AccessRightNames
const QByteArray & getBuffer() const
Definition: Apdu.cpp:31
Definition: Apdu.h:12
MORE_DATA_AVAILABLE
Definition: ResponseApdu.h:62
WRONG_LE_FIELD
Definition: ResponseApdu.h:73
NO_PRECISE_DIAGNOSIS
Definition: ResponseApdu.h:76
WRONG_PARAMETERS_P1_P2_NO_INFO
Definition: ResponseApdu.h:72
FUNCTIONS_IN_CLASS_NOT_SUPPORTED
Definition: ResponseApdu.h:69
CardReturnCode mReturnCode
Definition: ResponseApdu.h:106
INSTRUCTION_CODE_INVALID
Definition: ResponseApdu.h:74
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:14
ERROR_COMMAND_NOT_ALLOWED
Definition: ResponseApdu.h:70
SUCCESS
Definition: ResponseApdu.h:77
NONVOLATILE_MEMORY_CHANGED_1
Definition: ResponseApdu.h:64
bool operator==(const CVCertificate &pLeft, const CVCertificate &pRight)
Definition: CVCertificate.h:72
WRONG_PARAMETERS_P1_P2
Definition: ResponseApdu.h:71
NONVOLATILE_MEMORY_CHANGED_2
Definition: ResponseApdu.h:66
Definition: ResponseApdu.h:104
ResponseApdu mResponseApdu
Definition: ResponseApdu.h:107
NONVOLATILE_MEMORY_UNCHANGED_1
Definition: ResponseApdu.h:63
quint8
Definition: ResponseApdu.h:60
WRONG_LENGTH
Definition: ResponseApdu.h:68
INVALID
Definition: ResponseApdu.h:61
Definition: ResponseApdu.h:80
CLASS_NOT_SUPPORTED
Definition: ResponseApdu.h:75