AusweisApp2
 Alle Klassen Namensbereiche Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Propertys Freundbeziehungen Makrodefinitionen
KeyAgreement.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 #include "asn1/SecurityInfo.h"
10 #include "CardConnectionWorker.h"
11 #include "CardOperationResult.h"
14 
15 #include <QSharedPointer>
16 
17 namespace governikus
18 {
19 
20 
21 class PACEInfo;
22 
23 
25 {
26  SUCCESS,
28  FAILED,
30 };
31 
33 {
34  private:
35  const QSharedPointer<CardConnectionWorker> mCardConnectionWorker;
36  QByteArray mEncryptionKey;
37  QByteArray mMacKey;
38  QByteArray mCarCurr, mCarPrev;
39 
46  CardOperationResult<QByteArray> determineNonce(const QString& pPin);
47 
54  virtual CardOperationResult<QByteArray> determineSharedSecret(const QByteArray& pNonce) = 0;
55 
61  virtual QByteArray getUncompressedTerminalPublicKey() = 0;
62 
67  CardOperationResult<QByteArray> transmitGAEncryptedNonce();
68 
74  KeyAgreementStatus performMutualAuthenticate();
75 
76  protected:
77  const QSharedPointer<const PACEInfo> mPaceInfo;
79 
80  KeyAgreement(const QSharedPointer<const PACEInfo>& pPaceInfo, const QSharedPointer<CardConnectionWorker>& pCardConnectionWorker);
81 
87  CardOperationResult<QByteArray> transmitGAMappingData(const QByteArray& pMappingData);
88 
94  CardOperationResult<QByteArray> transmitGAEphemeralPublicKey(const QByteArray& pEphemeralPublicKey);
95 
101  QSharedPointer<GAMutualAuthenticationResponse> transmitGAMutualAuthentication(const QByteArray& pMutualAuthenticationData);
102 
103  public:
109  virtual QByteArray getUncompressedCardPublicKey() = 0;
110 
116  virtual QByteArray getCompressedCardPublicKey() = 0;
117 
124  static QSharedPointer<KeyAgreement> create(const QSharedPointer<const PACEInfo>& pPaceInfo,
125  QSharedPointer<CardConnectionWorker> pCardConnectionWorker);
126  virtual ~KeyAgreement();
127 
133  KeyAgreementStatus perform(const QString& pPin);
134 
140  const QByteArray& getEncryptionKey() const;
141 
147  const QByteArray& getMacKey() const;
148 
153  const QByteArray& getCarCurr() const;
154 
159  const QByteArray& getCarPrev() const;
160 };
161 
162 } /* namespace governikus */
CardOperationResult< QByteArray > transmitGAMappingData(const QByteArray &pMappingData)
Transmit the General Authenticate (Mapping Data) command to the card.
Definition: KeyAgreement.cpp:196
Definition: KeyAgreement.h:32
QSharedPointer< GAMutualAuthenticationResponse > transmitGAMutualAuthentication(const QByteArray &pMutualAuthenticationData)
Transmit the General Authenticate (Mutual Authentication) command to the card.
Definition: KeyAgreement.cpp:208
KeyAgreement(const QSharedPointer< const PACEInfo > &pPaceInfo, const QSharedPointer< CardConnectionWorker > &pCardConnectionWorker)
Definition: KeyAgreement.cpp:68
virtual QByteArray getCompressedCardPublicKey()=0
Returns the compressed card&#39;s ephemeral public key calculated during key agreement.
const QSharedPointer< const PACEInfo > mPaceInfo
Definition: KeyAgreement.h:77
CardOperationResult< QByteArray > transmitGAEphemeralPublicKey(const QByteArray &pEphemeralPublicKey)
Transmit the General Authenticate (Ephemeral Public Key) command to the card.
Definition: KeyAgreement.cpp:185
const QByteArray & getCarPrev() const
Subsequent to the key agreement a certificate authority reference (CAR) may be determined.
Definition: KeyAgreement.cpp:235
Definition: KeyDerivationFunction.h:16
KeyAgreementStatus
Definition: KeyAgreement.h:24
static QSharedPointer< KeyAgreement > create(const QSharedPointer< const PACEInfo > &pPaceInfo, QSharedPointer< CardConnectionWorker > pCardConnectionWorker)
Factory method to create an instance of KeyAgreement.
Definition: KeyAgreement.cpp:53
KeyDerivationFunction mKeyDerivationFunction
Definition: KeyAgreement.h:78
KeyAgreementStatus perform(const QString &pPin)
Perform the key agreement.
Definition: KeyAgreement.cpp:85
virtual QByteArray getUncompressedCardPublicKey()=0
Returns the uncompressed card&#39;s ephemeral public key calculated during key agreement.
const QByteArray & getMacKey() const
Subsequent to the key agreement a MAC key is determined.
Definition: KeyAgreement.cpp:241
const QByteArray & getCarCurr() const
Subsequent to the key agreement a certificate authority reference (CAR) may be determined.
Definition: KeyAgreement.cpp:229
Definition: CardOperationResult.h:14
virtual ~KeyAgreement()
Definition: KeyAgreement.cpp:80
const QByteArray & getEncryptionKey() const
Subsequent to the key agreement an encryption key is determined.
Definition: KeyAgreement.cpp:223