Hello, fellow colleagues!
I'm trying to sign an XML SOAP request document using SignedXml via detached signature.
In order to pass signature validation I also need to perform two reference transformations. First one is standard XmlDsigExcC14NTransform which I have no problems with. But second one is not provided by Transform class.
This transformation can be performed before passing document to SignedXml but SignedInfo should still contain entry about this transformation in <Transforms> block.
I'm also trying to avoid deriving Transform method.
Is there a way to add a <Transfrom Algorithm="alg"> block with desired transformation algorithm (which by the way is "urn://smev-gov-ru/xmldsig/transform") into SignedInfo without actually performing one and avoid breaking the signature?
So the structure that is to be formed is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/1.1" xmlns:ns1="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/basic/1.1"><soapenv:Header /><soapenv:Body><ns:SendResponseRequest><ns:SenderProvidedResponseData Id="SIGNED_BY_PROVIDER" xmlns:ns="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/1.1" xmlns:ns1="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/basic/1.1"><ns:MessageID>d37b6d00-ed9c-11e4-b80c-0800200c9a66</ns:MessageID><ns:To>3219|x-artefacts-gibdd-gov-ru_breach_root_1.0_BreachRequest|0e8cfc01-5e81-11e4-a9ff-d4c9eff07b77</ns:To><ns1:MessagePrimaryContent><ns2:Response xmlns:ns2="http://ns.rospotrebnadzor.ru/rpnopeka3/1.0.0">1</ns2:Response></ns1:MessagePrimaryContent></ns:SenderProvidedResponseData><ns:CallerInformationSystemSignature><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411" /><Reference URI="#SIGNED_BY_PROVIDER"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<!-- this entry is to be added -->
<ds:Transform Algorithm="urn://smev-gov-ru/xmldsig/transform" />
<!-- but the transform is already done outside sthe signing process --></ds:Transforms><DigestMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#gostr3411" /><DigestValue>digest_value</DigestValue></Reference></SignedInfo><SignatureValue>signature_value</SignatureValue><KeyInfo><X509Data><X509Certificate>certificate_info</X509Certificate></X509Data></KeyInfo></Signature></ns:CallerInformationSystemSignature></ns:SendResponseRequest></soapenv:Body></soapenv:Envelope>