AusweisApp
Lade ...
Suche ...
Keine Treffer
KeyAgreement.h
gehe zur Dokumentation dieser Datei
1
5#pragma once
6
10
11#include <QSharedPointer>
12
13
14namespace governikus
15{
16
25
27{
28 protected:
30 {
31 CardReturnCode mReturnCode = CardReturnCode::UNDEFINED;
33 };
34
35 private:
36 const QSharedPointer<CardConnectionWorker> mCardConnectionWorker;
37 QByteArray mEncryptionKey;
38 QByteArray mMacKey;
39 QByteArray mCarCurr;
40 QByteArray mCarPrev;
41 const QSharedPointer<const PaceInfo> mPaceInfo;
42 KeyDerivationFunction mKeyDerivationFunction;
43
44
45 CardResult createTransmitResult(CardReturnCode pReturnCode,
48 const char* pLogMessage) const;
49
56 CardResult determineNonce(const QByteArray& pPin);
57
64 virtual CardResult determineSharedSecret(const QByteArray& pNonce) = 0;
65
71 virtual QByteArray getUncompressedTerminalPublicKey() = 0;
72
77 CardResult transmitGAEncryptedNonce();
78
84 KeyAgreementStatus performMutualAuthenticate();
85
86 protected:
87 KeyAgreement(const QSharedPointer<const PaceInfo>& pPaceInfo, const QSharedPointer<CardConnectionWorker>& pCardConnectionWorker);
88
95
102
109
110 [[nodiscard]] const QSharedPointer<const PaceInfo>& getPaceInfo() const;
111
112 public:
119 static QSharedPointer<KeyAgreement> create(const QSharedPointer<const PaceInfo>& pPaceInfo,
121
122 virtual ~KeyAgreement();
123
130
137
144
150 [[nodiscard]] const QByteArray& getEncryptionKey() const;
151
157 [[nodiscard]] const QByteArray& getMacKey() const;
158
163 [[nodiscard]] const QByteArray& getCarCurr() const;
164
169 [[nodiscard]] const QByteArray& getCarPrev() const;
170};
171
172} // namespace governikus
Definition GeneralAuthenticateResponse.h:128
Definition KeyAgreement.h:27
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
Defines the AccessRight and AccessRole enum.
Definition CommandApdu.h:17
KeyAgreementStatus
Definition KeyAgreement.h:18
QSharedPointer< T > decodeObject(const QByteArray &pData, bool pLogging=true)
Template function for decoding an OpenSSL type from DER encoded QByteArray.
Definition ASN1TemplateUtil.h:112
SUCCESS
Definition ResponseApdu.h:82
Definition KeyAgreement.h:30
QByteArray mData
Definition KeyAgreement.h:32
CardReturnCode mReturnCode
Definition KeyAgreement.h:31