AusweisApp
Lade ...
Suche ...
Keine Treffer
KeyAgreement.h
gehe zur Dokumentation dieser Datei
1
9#pragma once
10
14
15#include <QSharedPointer>
16
17namespace governikus
18{
19
28
30{
31 protected:
33 {
34 CardReturnCode mReturnCode = CardReturnCode::UNDEFINED;
36 };
37
38 private:
39 const QSharedPointer<CardConnectionWorker> mCardConnectionWorker;
40 QByteArray mEncryptionKey;
41 QByteArray mMacKey;
42 QByteArray mCarCurr;
43 QByteArray mCarPrev;
44 const QSharedPointer<const PaceInfo> mPaceInfo;
45 KeyDerivationFunction mKeyDerivationFunction;
46
47
48 CardResult createTransmitResult(CardReturnCode pReturnCode,
51 const char* pLogMessage) const;
52
59 CardResult determineNonce(const QByteArray& pPin);
60
67 virtual CardResult determineSharedSecret(const QByteArray& pNonce) = 0;
68
74 virtual QByteArray getUncompressedTerminalPublicKey() = 0;
75
80 CardResult transmitGAEncryptedNonce();
81
87 KeyAgreementStatus performMutualAuthenticate();
88
89 protected:
90 KeyAgreement(const QSharedPointer<const PaceInfo>& pPaceInfo, const QSharedPointer<CardConnectionWorker>& pCardConnectionWorker);
91
98
105
112
113 [[nodiscard]] const QSharedPointer<const PaceInfo>& getPaceInfo() const;
114
115 public:
122 static QSharedPointer<KeyAgreement> create(const QSharedPointer<const PaceInfo>& pPaceInfo,
124
125 virtual ~KeyAgreement();
126
133
140
147
153 [[nodiscard]] const QByteArray& getEncryptionKey() const;
154
160 [[nodiscard]] const QByteArray& getMacKey() const;
161
166 [[nodiscard]] const QByteArray& getCarCurr() const;
167
172 [[nodiscard]] const QByteArray& getCarPrev() const;
173};
174
175} // namespace governikus
Definition GeneralAuthenticateResponse.h:132
Definition KeyAgreement.h:30
const QByteArray & getEncryptionKey() const
Subsequent to the key agreement an encryption key is determined.
Definition KeyAgreement.cpp:242
CardResult transmitGAMappingData(const QByteArray &pMappingData) const
Transmit the General Authenticate (Mapping Data) command to the card.
Definition KeyAgreement.cpp:207
KeyAgreement(const QSharedPointer< const PaceInfo > &pPaceInfo, const QSharedPointer< CardConnectionWorker > &pCardConnectionWorker)
Definition KeyAgreement.cpp:72
const QByteArray & getCarPrev() const
Subsequent to the key agreement a certificate authority reference (CAR) may be determined.
Definition KeyAgreement.cpp:254
GAMutualAuthenticationResponse transmitGAMutualAuthentication(const QByteArray &pMutualAuthenticationData)
Transmit the General Authenticate (Mutual Authentication) command to the card.
Definition KeyAgreement.cpp:221
KeyAgreementStatus perform(const QByteArray &pPin)
Perform the key agreement.
Definition KeyAgreement.cpp:87
virtual QByteArray getUncompressedCardPublicKey()=0
Returns the uncompressed card's ephemeral public key calculated during key agreement.
const QByteArray & getCarCurr() const
Subsequent to the key agreement a certificate authority reference (CAR) may be determined.
Definition KeyAgreement.cpp:248
const QByteArray & getMacKey() const
Subsequent to the key agreement a MAC key is determined.
Definition KeyAgreement.cpp:260
const QSharedPointer< const PaceInfo > & getPaceInfo() const
Definition KeyAgreement.cpp:236
virtual QByteArray getCompressedCardPublicKey()=0
Returns the compressed card's ephemeral public key calculated during key agreement.
CardResult transmitGAEphemeralPublicKey(const QByteArray &pEphemeralPublicKey)
Transmit the General Authenticate (Ephemeral Public Key) command to the card.
Definition KeyAgreement.cpp:194
static QSharedPointer< KeyAgreement > create(const QSharedPointer< const PaceInfo > &pPaceInfo, QSharedPointer< CardConnectionWorker > pCardConnectionWorker)
Factory method to create an instance of KeyAgreement.
Definition KeyAgreement.cpp:57
Definition KeyDerivationFunction.h:20
Implementation of GeneralAuthenticate response APDUs.
Definition CommandApdu.h:17
KeyAgreementStatus
Definition KeyAgreement.h:21
QSharedPointer< T > decodeObject(const QByteArray &pData, bool pLogging=true)
Template function for decoding an OpenSSL type from DER encoded QByteArray.
Definition ASN1TemplateUtil.h:114
SUCCESS
Definition ResponseApdu.h:81
Definition KeyAgreement.h:33
QByteArray mData
Definition KeyAgreement.h:35
CardReturnCode mReturnCode
Definition KeyAgreement.h:34