AusweisApp2
 Alle Klassen Namensbereiche Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Propertys Freundbeziehungen Makrodefinitionen
PersoSimWorkaround.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 #include "CardConnectionWorker.h"
10 #include "Commands.h"
11 
12 #include <QDataStream>
13 
14 namespace governikus
15 {
16 
18 {
19  private:
22  Q_DISABLE_COPY(PersoSimWorkaround)
23 
24  public:
25  /*
26  * The PersoSim engine needs a select on EF.CardAccess to properly process MSE:Set AT.
27  *
28  * This is now needed, because we read EF.CardAccess just once on card recognition and store it.
29  * Therefore sending an MSE:Set AT is now no longer preceded by selecting and reading EF.CardAccess.
30  * This change caused the error with PersoSim.
31  *
32  * As soon as PersoSim is fixed in that point, we will remove the workaround.
33  */
34  static CardReturnCode sendingMseSetAt(const QSharedPointer<CardConnectionWorker>& pCardConnectionWorker)
35  {
36  ResponseApdu response;
37  const CardReturnCode returnCode = pCardConnectionWorker->transmit(SelectBuilder(FileRef::efCardAccess()).build(), response);
38  return (returnCode == CardReturnCode::COMMAND_FAILED && response.getReturnCode() != StatusCode::EMPTY) ? CardReturnCode::OK : returnCode;
39  }
40 
41 
42  /*
43  * The PersoSim engine sends the result bytes in the control output of PACE in little endian.
44  * So we try to parse it that way, if we get unknown return codes.
45  *
46  * As soon as PersoSim is fixed in that point, we will remove the workaround.
47  */
48  static CardReturnCode parsingEstablishPACEChannelOutput(const QByteArray& pControlOutput, PACE_PASSWORD_ID pPasswordId)
49  {
50  quint32 paceReturnCode;
51  QDataStream(pControlOutput.mid(0, 4)) >> paceReturnCode;
52  return EstablishPACEChannelOutput::parseReturnCode(paceReturnCode, pPasswordId);
53  }
54 
55 
56  /*
57  * The PersoSim engine sends 6A80 on wrong CAN entry in PACE. This means "Invalid data" which is
58  * wrong. We interpret it as wrong CAN
59  *
60  * As soon as PersoSim is fixed in that point, we will remove the workaround.
61  */
62  static bool isWrongCanEntry(QSharedPointer<ResponseApdu> pResponseApdu)
63  {
64  return pResponseApdu->getReturnCode() == StatusCode::INVALID_DATAFIELD;
65  }
66 
67 
68 };
69 
70 } /* namespace governikus */
static CardReturnCode sendingMseSetAt(const QSharedPointer< CardConnectionWorker > &pCardConnectionWorker)
Definition: PersoSimWorkaround.h:34
Definition: PersoSimWorkaround.h:17
static FileRef efCardAccess()
Definition: FileRef.cpp:22
static CardReturnCode parsingEstablishPACEChannelOutput(const QByteArray &pControlOutput, PACE_PASSWORD_ID pPasswordId)
Definition: PersoSimWorkaround.h:48
Definition: Commands.h:28
StatusCode getReturnCode() const
Definition: Apdu.cpp:280
static CardReturnCode parseReturnCode(quint32 pPaceReturnCode, PACE_PASSWORD_ID pPasswordId)
Definition: EstablishPACEChannel.cpp:434
static bool isWrongCanEntry(QSharedPointer< ResponseApdu > pResponseApdu)
Definition: PersoSimWorkaround.h:62
Definition: Apdu.h:118