AusweisApp2
 Alle Klassen Namensbereiche Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Propertys Freundbeziehungen Makrodefinitionen
SecureMessaging.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
10 #include "Apdu.h"
11 #include "pace/CipherMac.h"
12 #include "pace/SymmetricCipher.h"
13 
14 #include <QByteArray>
15 
16 
17 namespace governikus
18 {
19 
25  : public ASN1_OCTET_STRING {};
27 
28 
30 {
31  private:
32  SymmetricCipher mCipher;
33  CipherMac mCipherMac;
34  quint32 mSendSequenceCounter;
35 
36  QByteArray padToCipherBlockSize(const QByteArray& pData) const;
37  QByteArray unpadFromCipherBlockSize(const QByteArray& pData) const;
38  QByteArray createSecuredHeader(const CommandApdu& pCommandApdu) const;
39  QByteArray createMac(const QByteArray& pSecuredHeader, const QByteArray& pFormattedEncryptedData, const QByteArray& pSecuredLe);
40  int createNewLe(const QByteArray& pSecuredData, int pOldLe) const;
41  QByteArray getSendSequenceCounter() const;
42  QByteArray getEncryptedIv();
43 
44  QByteArray createSecuredLe(int pLe);
45 
46  public:
47  SecureMessaging(const QByteArray& pPaceAlgorithm, const QByteArray& pEncKey, const QByteArray& pMacKey);
48  virtual ~SecureMessaging();
49 
53  bool isInitialized();
54 
55  CommandApdu encrypt(const CommandApdu& pCommandApdu);
56  bool decrypt(const ResponseApdu& pEncryptedResponseApdu, ResponseApdu& pDecryptedResponseApdu);
57 };
58 
59 } /* namespace governikus */
Definition: CipherMac.h:15
Message part of the Secure Messaging command APDU containing the expected length. ...
Definition: SecureMessaging.h:24
Definition: Apdu.h:91
Definition: SymmetricCipher.h:15
#define DECLARE_ASN1_OBJECT(name)
Definition: ASN1TemplateUtil.h:152
Definition: SecureMessaging.h:29
Definition: Apdu.h:118