Optimization : Add signature node into signNode() instead of returing it and be added after
This commit is contained in:
parent
2f2e4e193e
commit
9556fe862f
|
@ -210,7 +210,7 @@ namespace gourou
|
||||||
void pushTag(void* sha_ctx, uint8_t tag);
|
void pushTag(void* sha_ctx, uint8_t tag);
|
||||||
void hashNode(const pugi::xml_node& root, void *sha_ctx, std::map<std::string,std::string> nsHash);
|
void hashNode(const pugi::xml_node& root, void *sha_ctx, std::map<std::string,std::string> nsHash);
|
||||||
void hashNode(const pugi::xml_node& root, unsigned char* sha_out);
|
void hashNode(const pugi::xml_node& root, unsigned char* sha_out);
|
||||||
std::string signNode(const pugi::xml_node& rootNode);
|
void signNode(pugi::xml_node& rootNode);
|
||||||
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);
|
||||||
|
|
|
@ -236,7 +236,7 @@ namespace gourou
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DRMProcessor::signNode(const pugi::xml_node& rootNode)
|
void DRMProcessor::signNode(pugi::xml_node& rootNode)
|
||||||
{
|
{
|
||||||
// Compute hash
|
// Compute hash
|
||||||
unsigned char sha_out[SHA1_LEN];
|
unsigned char sha_out[SHA1_LEN];
|
||||||
|
@ -260,9 +260,8 @@ namespace gourou
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArray signature(res, sizeof(res));
|
std::string signature = ByteArray(res, sizeof(res)).toBase64();
|
||||||
|
appendTextElem(rootNode, "adept:signature", signature);
|
||||||
return signature.toBase64();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DRMProcessor::addNonce(pugi::xml_node& root)
|
void DRMProcessor::addNonce(pugi::xml_node& root)
|
||||||
|
@ -368,8 +367,7 @@ namespace gourou
|
||||||
addNonce(root);
|
addNonce(root);
|
||||||
appendTextElem(root, "adept:user", user->getUUID());
|
appendTextElem(root, "adept:user", user->getUUID());
|
||||||
|
|
||||||
std::string signature = signNode(root);
|
signNode(root);
|
||||||
appendTextElem(root, "adept:signature", signature);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DRMProcessor::doOperatorAuth(std::string operatorURL)
|
void DRMProcessor::doOperatorAuth(std::string operatorURL)
|
||||||
|
@ -530,13 +528,11 @@ namespace gourou
|
||||||
|
|
||||||
hmacParentNode.remove_child(hmacNode);
|
hmacParentNode.remove_child(hmacNode);
|
||||||
|
|
||||||
std::string signature = signNode(rootNode);
|
signNode(rootNode);
|
||||||
|
|
||||||
// Add removed HMAC
|
// Add removed HMAC
|
||||||
appendTextElem(hmacParentNode, hmacNode.name(), hmacNode.first_child().value());
|
appendTextElem(hmacParentNode, hmacNode.name(), hmacNode.first_child().value());
|
||||||
|
|
||||||
appendTextElem(rootNode, "adept:signature", signature);
|
|
||||||
|
|
||||||
pugi::xpath_node node = acsmDoc.select_node("//operatorURL");
|
pugi::xpath_node node = acsmDoc.select_node("//operatorURL");
|
||||||
if (!node)
|
if (!node)
|
||||||
EXCEPTION(FF_NO_OPERATOR_URL, "OperatorURL not found in ACSM document");
|
EXCEPTION(FF_NO_OPERATOR_URL, "OperatorURL not found in ACSM document");
|
||||||
|
@ -823,10 +819,7 @@ namespace gourou
|
||||||
|
|
||||||
pugi::xml_node root = activateReq.select_node("adept:activate").node();
|
pugi::xml_node root = activateReq.select_node("adept:activate").node();
|
||||||
|
|
||||||
std::string signature = signNode(root);
|
signNode(root);
|
||||||
|
|
||||||
root = activateReq.select_node("adept:activate").node();
|
|
||||||
appendTextElem(root, "adept:signature", signature);
|
|
||||||
|
|
||||||
pugi::xml_document activationDoc;
|
pugi::xml_document activationDoc;
|
||||||
user->readActivation(activationDoc);
|
user->readActivation(activationDoc);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user