I have a problem to add the Object tag to my signature as our participant need it to be in the signature of the signed XML. I need to add the bellow Object tag to my signature:
<ds:Object>
<xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#">
<xades:SignedProperties Id="_aba0ee84-5f37-499e-a8e8-caa7f398341c-signedprops">
<xades:SignedSignatureProperties>
<xades:SigningTime>2019-02-15T21:09:10+13:00</xades:SigningTime>
</xades:SignedSignatureProperties>
</xades:SignedProperties>
</xades:QualifyingProperties>
</ds:Object>
my current signutare looks like:
<MyElement xmlns="samples">Example text to be signed.
<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#rsa-sha256"/>
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue>Kglqb8fjGmMi2n4W8qXldBIY7VBi0xbNn+dZml7H3xw=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>Iz5LOjZGefMHvIYs/cr1Vmrg/9gXPDGpJetBEx+k/yzHVAdJf18P2/udFkeOoVMCpVUnNn+H4eVihD2idqg7SMosZeFA4LCQC2/Wn7GCE6k+y0mivCtFZTaXu0yUbwDGWDBvvqMUT87uaRx4o61cm7V3DH8wOUJ05mKtoVFpG20=</SignatureValue>
</Signature>
</MyElement>
The final signature I need should look like:
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#_33d232d2-4591-4b49-b28d-3cb825fbeaa4">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>uFw2hAp5tSL4VidzHtTvv3aziis=</ds:DigestValue>
</ds:Reference>
<ds:Reference Type="http://uri.etsi.org/01903/v1.3.2#SignedProperties" URI="#_aba0ee84-5f37-499e-a8e8-caa7f398341c-signedprops">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>X01eQjqcHvYtQbFkpNT7WcvBSxI=</ds:DigestValue>
</ds:Reference>
<ds:Reference>
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>OCCzP5CU0TAgyYSLMR+SIMchxrE=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>b8AhGMpa+fK6Q5q/HXiPttGIKn2PMXc/GQSrxnI+jnW9Agg6E6R/q+cwMKiYkdlskI/P0UAdwxd+
KQ44k6r2OET4HjMyatG99HFQnS0C0awVO7CPF6cO9069DDmXplWIkHIoBPWSgXh7SQHMpaQihJYo
S9iVr5+qhYQBZYCVwHg=</ds:SignatureValue>
<ds:KeyInfo Id="_33d232d2-4591-4b49-b28d-3cb825fbeaa4">
<ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=Test CA, O=Test Institution, C=BD</ds:X509IssuerName>
<ds:X509SerialNumber>12345678</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data>
</ds:KeyInfo>
<ds:Object>
<xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#">
<xades:SignedProperties Id="_aba0ee84-5f37-499e-a8e8-caa7f398341c-signedprops">
<xades:SignedSignatureProperties>
<xades:SigningTime>2019-02-15T21:09:10+13:00</xades:SigningTime>
</xades:SignedSignatureProperties>
</xades:SignedProperties>
</xades:QualifyingProperties>
</ds:Object>
</ds:Signature>
you can check the c# code in the link: https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.xml.x509issuerserial?view=net-5.0