signature->add_child("SignatureValue", "dsig");
signature->add_child("KeyInfo", "dsig");
- add_signature_value (signature, "dsig");
+ add_signature_value (signature, "dsig", true);
}
* @param ns Namespace to use for the signature XML nodes.
*/
void
-CertificateChain::add_signature_value (xmlpp::Element* parent, string ns) const
+CertificateChain::add_signature_value (xmlpp::Element* parent, string ns, bool add_indentation) const
{
cxml::Node cp (parent);
xmlpp::Node* key_info = cp.node_child("KeyInfo")->node ();
throw runtime_error ("could not read private key");
}
- indent (parent, 2);
+ if (add_indentation) {
+ indent (parent, 2);
+ }
int const r = xmlSecDSigCtxSign (signature_context, parent->cobj ());
if (r < 0) {
throw MiscError (String::compose ("could not sign (%1)", r));
bool private_key_valid () const;
void sign (xmlpp::Element* parent, Standard standard) const;
- void add_signature_value (xmlpp::Element* parent, std::string ns) const;
+ void add_signature_value (xmlpp::Element* parent, std::string ns, bool add_indentation) const;
boost::optional<std::string> key () const {
return _key;
xmlAddID (0, document->cobj(), (const xmlChar *) i->first.c_str(), i->second->cobj ());
}
+ indent (document->get_root_node(), 0);
return document;
}
xmlpp::Node::NodeList children = doc->get_root_node()->get_children ();
for (xmlpp::Node::NodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
if ((*i)->get_name() == "Signature") {
- signer->add_signature_value (dynamic_cast<xmlpp::Element*>(*i), "ds");
+ signer->add_signature_value (dynamic_cast<xmlpp::Element*>(*i), "ds", false);
}
}