LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
cmac.hpp
Go to the documentation of this file.
1#ifndef CMAC_HPP__
2#define CMAC_HPP__
3
4#include <vector>
5#include <memory>
9
10namespace logicalaccess
11{
12namespace openssl
13{
17class LLA_CRYPTO_API CMACCrypto
18{
19 public:
21 {
22 OpenSSLInitializer::GetInstance();
23 }
25 {
26 }
27
28 /*
29 * \brief Calculate CMAC for a crypto algorithm and key.
30 * \param key The key to use.
31 * \param crypto The crypto algorithm (3DES, AES, ...).
32 * \param data The data buffer to calculate CMAC.
33 * \param padding_size The padding size.
34 * \return The CMAC result for the message.
35 */
36 static ByteVector cmac(const ByteVector &key, std::string crypto,
37 const ByteVector &data, const ByteVector &iv = {},
38 int padding_size = 0);
39
49 static ByteVector cmac(const ByteVector &key,
50 std::shared_ptr<SymmetricCipher> cipherMAC,
51 const ByteVector &data, const ByteVector &lastIV = {},
52 unsigned int padding_size = 0, bool forceK2Use = false);
53
62 static ByteVector cmac_iks(const std::string &iks_key_name, const ByteVector &data,
63 const ByteVector &lastIv, unsigned int padding_size,
64 const std::shared_ptr<RemoteCrypto> &remote_crypto);
65
71 static ByteVector shift_string(const ByteVector &buf, unsigned char xorparam = 0x00);
72};
73}
74}
75
76#endif
Definition: cmac.hpp:18
~CMACCrypto()
Definition: cmac.hpp:24
CMACCrypto()
Definition: cmac.hpp:20
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
OpenSSL global functions.
OpenSSL symmetric cipher base class.