Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/XMLDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,21 @@ struct XMLNode: public XMLElem<xmlNode>
return from_base64(operator sv());
}

XMLNode& operator=(sv text) noexcept
XMLNode& operator=(sv text)
{
if(!d)
return *this;
const char *utf = text.cbegin();
int len = int(text.size());
while (utf < text.cend()) {
int uc = xmlGetUTF8Char((const unsigned char *) utf, &len);
if (len < 1) {
THROW("Invalid utf8 string");
} else if ((uc < 0x20) && (uc != 0x9) && (uc != 0xa) && (uc != 0xd)) {
THROW("Invalid character");
}
utf += len;
}
xmlNodeSetContentLen(d, nullptr, 0);
if(!text.empty())
xmlNodeAddContentLen(d, pcxmlChar(text.data()), int(text.length()));
Expand Down
3 changes: 3 additions & 0 deletions src/crypto/Signer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Signer::~Signer() = default;
* @param stateOrProvince
* @param postalCode
* @param countryName
* The strings have to be utf8 encoded and not contain any control values (any char < 0x20 except 0x9, 0xa and 0xd)
*/
void Signer::setSignatureProductionPlace(const string &city,
const string &stateOrProvince, const string &postalCode, const string &countryName)
Expand All @@ -90,6 +91,7 @@ void Signer::setSignatureProductionPlace(const string &city,
* @param stateOrProvince
* @param postalCode
* @param countryName
* The strings have to be utf8 encoded and not contain any control values (any char < 0x20 except 0x9, 0xa and 0xd)
*/
void Signer::setSignatureProductionPlaceV2(const string &city, const string &streetAddress,
const string &stateOrProvince, const string &postalCode, const string &countryName)
Expand Down Expand Up @@ -194,6 +196,7 @@ void Signer::setProfile(const string &profile)
/**
* Sets signature roles according XAdES standard. The parameter may contain the signer’s role and optionally the signer’s resolution. Note that only one signer role value (i.e. one &lt;ClaimedRole&gt; XML element) should be used.
* If the signer role contains both role and resolution then they must be separated with a slash mark, e.g. “role / resolution”.
* The strings have to be utf8 encoded and not contain any control values (any char < 0x20 except 0x9, 0xa and 0xd)
*/
void Signer::setSignerRoles(const vector<string> &signerRoles)
{
Expand Down
Loading