Libgourou

Libgourou Git Source Tree

Root/include/user.h

1/*
2 Copyright 2021 Grégory Soutadé
3
4 This file is part of libgourou.
5
6 libgourou is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 libgourou is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with libgourou. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef _USER_H_
21#define _USER_H_
22
23#include <string>
24#include <map>
25
26#include "bytearray.h"
27
28#include <pugixml.hpp>
29
30namespace gourou
31{
32 class DRMProcessor;
33
34 /**
35 * @brief This class is a container for activation.xml (activation info). It should not be used by user.
36 */
37 class User
38 {
39 public:
40 User(DRMProcessor* processor, const std::string& activationFile);
41
42/**
43 * @brief Retrieve some values from activation.xml
44 */
45std::string& getUUID();
46std::string& getPKCS12();
47std::string& getDeviceUUID();
48std::string& getDeviceFingerprint();
49std::string& getUsername();
50std::string& getLoginMethod();
51std::string getLicenseServiceCertificate(std::string url);
52std::string& getAuthenticationCertificate();
53std::string& getPrivateLicenseKey();
54
55/**
56 * @brief Read activation.xml and put result into doc
57 */
58void readActivation(pugi::xml_document& doc);
59
60/**
61 * @brief Update activation.xml with new data
62 */
63void updateActivationFile(const char* data);
64
65/**
66 * @brief Update activation.xml with doc data
67 */
68void updateActivationFile(const pugi::xml_document& doc);
69
70/**
71 * @brief Get one value of activation.xml
72 */
73std::string getProperty(const std::string property);
74
75/**
76 * @brief Get all nodes with property name
77 */
78pugi::xpath_node_set getProperties(const std::string property);
79
80/**
81 * @brief Create activation.xml and devicesalt files if they did not exists
82 *
83 * @param processor Instance of DRMProcessor
84 * @param dirName Directory where to put files (.adept)
85 * @param ACSServer Server used for signIn
86 */
87static User* createUser(DRMProcessor* processor, const std::string& dirName, const std::string& ACSServer);
88
89 private:
90DRMProcessor* processor;
91pugi::xml_document activationDoc;
92
93 std::string activationFile;
94std::string pkcs12;
95std::string uuid;
96std::string deviceUUID;
97std::string deviceFingerprint;
98std::string username;
99std::string loginMethod;
100std::map<std::string,std::string> licenseServiceCertificates;
101std::string authenticationCertificate;
102std::string privateLicenseKey;
103
104User(DRMProcessor* processor);
105
106void parseActivationFile(bool throwOnNull=true);
107ByteArray signIn(const std::string& adobeID, const std::string& adobePassword,
108 ByteArray authenticationCertificate);
109 };
110}
111
112#endif

Archive Download this file