1 /*
2 *      Copyright (C) 2016-2016 peak3d
3 *      http://www.peak3d.de
4 *
5 *  This Program is free software; you can redistribute it and/or modify
6 *  it under the terms of the GNU General Public License as published by
7 *  the Free Software Foundation; either version 2, or (at your option)
8 *  any later version.
9 *
10 *  This Program is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *  GNU General Public License for more details.
14 *
15 *  <http://www.gnu.org/licenses/>.
16 *
17 */
18 
19 #pragma once
20 
21 #include "Iaes_decrypter.h"
22 
23 #include "Ap4Types.h"
24 
25 #include <string>
26 
27 #include <kodi/AddonBase.h>
28 
29 class ATTRIBUTE_HIDDEN AESDecrypter : public IAESDecrypter
30 {
31 public:
AESDecrypter(const std::string & licenseKey)32   AESDecrypter(const std::string& licenseKey) : m_licenseKey(licenseKey){};
33   virtual ~AESDecrypter() = default;
34 
35   void decrypt(const AP4_UI08* aes_key,
36                const AP4_UI08* aes_iv,
37                const AP4_UI08* src,
38                AP4_UI08* dst,
39                size_t dataSize);
40   std::string convertIV(const std::string& input);
41   void ivFromSequence(uint8_t* buffer, uint64_t sid);
getLicenseKey()42   const std::string& getLicenseKey() const { return m_licenseKey; };
43   bool RenewLicense(const std::string& pluginUrl);
44 
45 private:
46   std::string m_licenseKey;
47 };
48