forked from soutade/libgourou
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
20b4e69c3e | |||
878e4e7453 | |||
1eebc88913 | |||
460f452783 |
@@ -85,3 +85,10 @@ License
|
|||||||
libgourou : LGPL v3 or later
|
libgourou : LGPL v3 or later
|
||||||
|
|
||||||
utils : BSD
|
utils : BSD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Special thanks
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* _Jens_ for all test samples and utils testing
|
||||||
|
@@ -58,3 +58,11 @@ License
|
|||||||
libgourou : LGPL v3 or later
|
libgourou : LGPL v3 or later
|
||||||
|
|
||||||
utils : BSD
|
utils : BSD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Special thanks
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* _Jens_ for all test samples and utils testing
|
||||||
|
|
@@ -40,7 +40,7 @@
|
|||||||
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
|
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LIBGOUROU_VERSION "0.2.1"
|
#define LIBGOUROU_VERSION "0.3"
|
||||||
|
|
||||||
namespace gourou
|
namespace gourou
|
||||||
{
|
{
|
||||||
@@ -188,6 +188,7 @@ namespace gourou
|
|||||||
void addNonce(pugi::xml_node& root);
|
void addNonce(pugi::xml_node& root);
|
||||||
void buildAuthRequest(pugi::xml_document& authReq);
|
void buildAuthRequest(pugi::xml_document& authReq);
|
||||||
void buildInitLicenseServiceRequest(pugi::xml_document& initLicReq, std::string operatorURL);
|
void buildInitLicenseServiceRequest(pugi::xml_document& initLicReq, std::string operatorURL);
|
||||||
|
void doOperatorAuth(std::string operatorURL);
|
||||||
void operatorAuth(std::string operatorURL);
|
void operatorAuth(std::string operatorURL);
|
||||||
void buildFulfillRequest(pugi::xml_document& acsmDoc, pugi::xml_document& fulfillReq);
|
void buildFulfillRequest(pugi::xml_document& acsmDoc, pugi::xml_document& fulfillReq);
|
||||||
void buildActivateReq(pugi::xml_document& activateReq);
|
void buildActivateReq(pugi::xml_document& activateReq);
|
||||||
|
@@ -129,6 +129,14 @@ namespace gourou
|
|||||||
fullmessage = strdup(msg.str().c_str());
|
fullmessage = strdup(msg.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Exception(const Exception& other)
|
||||||
|
{
|
||||||
|
this->code = other.code;
|
||||||
|
this->line = line;
|
||||||
|
this->file = file;
|
||||||
|
this->fullmessage = strdup(other.fullmessage);
|
||||||
|
}
|
||||||
|
|
||||||
~Exception()
|
~Exception()
|
||||||
{
|
{
|
||||||
free(fullmessage);
|
free(fullmessage);
|
||||||
|
@@ -1,10 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Pugixml
|
# Pugixml
|
||||||
git clone https://github.com/zeux/pugixml.git lib/pugixml
|
if [ ! -d lib/pugixml ] ; then
|
||||||
pushd lib/pugixml
|
git clone https://github.com/zeux/pugixml.git lib/pugixml
|
||||||
git checkout latest
|
pushd lib/pugixml
|
||||||
popd
|
git checkout latest
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
# Base64
|
# Base64
|
||||||
git clone https://gist.github.com/f0fd86b6c73063283afe550bc5d77594.git lib/base64
|
if [ ! -d lib/base64 ] ; then
|
||||||
|
git clone https://gist.github.com/f0fd86b6c73063283afe550bc5d77594.git lib/base64
|
||||||
|
fi
|
||||||
|
@@ -132,7 +132,8 @@ namespace gourou
|
|||||||
ns = attrName.substr(attrName.find(':')+1);
|
ns = attrName.substr(attrName.find(':')+1);
|
||||||
|
|
||||||
nsHash[ns] = ait->value();
|
nsHash[ns] = ait->value();
|
||||||
break;
|
// Don't break here because we may multiple xmlns definitions
|
||||||
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,6 +368,22 @@ namespace gourou
|
|||||||
appendTextElem(root, "adept:signature", signature);
|
appendTextElem(root, "adept:signature", signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DRMProcessor::doOperatorAuth(std::string operatorURL)
|
||||||
|
{
|
||||||
|
pugi::xml_document authReq;
|
||||||
|
buildAuthRequest(authReq);
|
||||||
|
std::string authURL = operatorURL;
|
||||||
|
unsigned int fulfillPos = authURL.rfind("Fulfill");
|
||||||
|
if (fulfillPos == (authURL.size() - (sizeof("Fulfill")-1)))
|
||||||
|
authURL = authURL.substr(0, fulfillPos-1);
|
||||||
|
ByteArray replyData = sendRequest(authReq, authURL + "/Auth");
|
||||||
|
|
||||||
|
pugi::xml_document initLicReq;
|
||||||
|
std::string activationURL = user->getProperty("//adept:activationURL");
|
||||||
|
buildInitLicenseServiceRequest(initLicReq, authURL);
|
||||||
|
sendRequest(initLicReq, activationURL + "/InitLicenseService");
|
||||||
|
}
|
||||||
|
|
||||||
void DRMProcessor::operatorAuth(std::string operatorURL)
|
void DRMProcessor::operatorAuth(std::string operatorURL)
|
||||||
{
|
{
|
||||||
pugi::xpath_node_set operatorList = user->getProperties("//adept:operatorURL");
|
pugi::xpath_node_set operatorList = user->getProperties("//adept:operatorURL");
|
||||||
@@ -381,20 +398,9 @@ namespace gourou
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pugi::xml_document authReq;
|
doOperatorAuth(operatorURL);
|
||||||
buildAuthRequest(authReq);
|
|
||||||
std::string authURL = operatorURL;
|
|
||||||
int fulfillPos = authURL.rfind("Fulfill");
|
|
||||||
if (fulfillPos == ((int)authURL.size() - 7))
|
|
||||||
authURL = authURL.substr(0, fulfillPos-1);
|
|
||||||
ByteArray replyData = sendRequest(authReq, authURL + "/Auth");
|
|
||||||
|
|
||||||
pugi::xml_document initLicReq;
|
|
||||||
std::string activationURL = user->getProperty("//adept:activationURL");
|
|
||||||
buildInitLicenseServiceRequest(initLicReq, authURL);
|
|
||||||
sendRequest(initLicReq, activationURL + "/InitLicenseService");
|
|
||||||
|
|
||||||
// Add new operatorURL to list
|
// Add new operatorURL to list
|
||||||
pugi::xml_document activationDoc;
|
pugi::xml_document activationDoc;
|
||||||
user->readActivation(activationDoc);
|
user->readActivation(activationDoc);
|
||||||
@@ -454,7 +460,7 @@ namespace gourou
|
|||||||
|
|
||||||
pugi::xml_document acsmDoc;
|
pugi::xml_document acsmDoc;
|
||||||
|
|
||||||
if (!acsmDoc.load_file(ACSMFile.c_str(), pugi::parse_ws_pcdata_single))
|
if (!acsmDoc.load_file(ACSMFile.c_str(), pugi::parse_ws_pcdata_single|pugi::parse_escapes))
|
||||||
EXCEPTION(FF_INVALID_ACSM_FILE, "Invalid ACSM file " << ACSMFile);
|
EXCEPTION(FF_INVALID_ACSM_FILE, "Invalid ACSM file " << ACSMFile);
|
||||||
|
|
||||||
GOUROU_LOG(INFO, "Fulfill " << ACSMFile);
|
GOUROU_LOG(INFO, "Fulfill " << ACSMFile);
|
||||||
@@ -493,7 +499,30 @@ namespace gourou
|
|||||||
|
|
||||||
operatorAuth(operatorURL);
|
operatorAuth(operatorURL);
|
||||||
|
|
||||||
ByteArray replyData = sendRequest(fulfillReq, operatorURL);
|
ByteArray replyData;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
replyData = sendRequest(fulfillReq, operatorURL);
|
||||||
|
}
|
||||||
|
catch (gourou::Exception& e)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Operator requires authentication even if it's already in
|
||||||
|
our operator list
|
||||||
|
*/
|
||||||
|
std::string errorMsg(e.what());
|
||||||
|
if (e.getErrorCode() == GOUROU_ADEPT_ERROR &&
|
||||||
|
errorMsg.find("E_ADEPT_DISTRIBUTOR_AUTH") != std::string::npos)
|
||||||
|
{
|
||||||
|
doOperatorAuth(operatorURL);
|
||||||
|
replyData = sendRequest(fulfillReq, operatorURL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pugi::xml_document fulfillReply;
|
pugi::xml_document fulfillReply;
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
TARGETS=acsmdownloader activate
|
TARGETS=acsmdownloader adept_activate
|
||||||
|
|
||||||
CXXFLAGS=-Wall `pkg-config --cflags Qt5Core Qt5Network` -fPIC -I$(ROOT)/include -I$(ROOT)/lib/pugixml/src/
|
CXXFLAGS=-Wall `pkg-config --cflags Qt5Core Qt5Network` -fPIC -I$(ROOT)/include -I$(ROOT)/lib/pugixml/src/
|
||||||
ifneq ($(STATIC_UTILS),)
|
ifneq ($(STATIC_UTILS),)
|
||||||
@@ -19,7 +19,7 @@ all: $(TARGETS)
|
|||||||
acsmdownloader: drmprocessorclientimpl.cpp acsmdownloader.cpp
|
acsmdownloader: drmprocessorclientimpl.cpp acsmdownloader.cpp
|
||||||
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
|
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
|
||||||
|
|
||||||
activate: drmprocessorclientimpl.cpp activate.cpp
|
adept_activate: drmprocessorclientimpl.cpp adept_activate.cpp
|
||||||
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
|
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
Reference in New Issue
Block a user