Hi, I believe you have used the default SigningContext with the NewDefaultSigningContext method with default MakeC14N11Canonicalizer: func NewDefaultSigningContext(ks X509KeyStore) *SigningContext { return &SigningContext{ Hash: crypto.SHA256, KeyStore: ks, IdAttribute: DefaultIdAttr, Prefix: DefaultPrefix, Canonicalizer: *MakeC14N11Canonicalizer*(), } }
Try to create custom signing context with *MakeC14N10RecCanonicalizer* as a Canonicalizer, like this: ctx := &SigningContext { Hash: crypto.SHA256, KeyStore: ks, IdAttribute: DefaultIdAttr, Prefix: DefaultPrefix, Canonicalizer: *MakeC14N10RecCanonicalizer*(), } On Thu, Dec 22, 2022 at 10:49 AM Reeturaj Sahoo < reeturajsahoo.2...@gmail.com> wrote: > Hello Karlovsky, > > Thank you for the update . > After using this library I was able to generate Signed XML . > > Output is : > > <?xml version="1.0" encoding="UTF-8"?> > <ReqDiagnostic> > <Head origInst="IP11" refId="919b92e5792f463a82801f5f46923531526" > ts="2022-12-19T15:26:28+05:30" ver="1.0"/> > <ds:Signature > xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> > <ds:SignedInfo> > <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2006/12/xml-c14n11 > "/> > <ds:SignatureMethod Algorithm=" > http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> > <ds:Reference URI=""> > <ds:Transforms> > <ds:Transform Algorithm=" > http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> > <ds:Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"/> > </ds:Transforms> > <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> > > <ds:DigestValue>uTdNgPrRhLpLJ3YZQOymIkr3DxyJeKJQarBZMe9b/Z8=</ds:DigestValue> > </ds:Reference> > </ds:SignedInfo> > > <ds:SignatureValue>dYgNUeSQA8bN0dmeb3BgRk0la5AQN8sbYBMGmFrNYfw63C2xBmHAP6cGHHyCHysQlpg5Q6WKnzZld24v8pTfr8qNHuJlyQ2bcpXirxRBU26RipFxUY5zkSmspkvwarHS39uITITljiNOtjNrBIQoG4zfnVXPZ0d2E1jrdggt3jg=</ds:SignatureValue> > <ds:KeyInfo> > <ds:X509Data> > > <ds:X509Certificate>MIIBlTCB/6ADAgECAgEAMA0GCSqGSIb3DQEBCwUAMAAwHhcNMjIxMjIyMDkyNTQzWhcNMjMxMjIyMDkzMDQzWjAAMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAnI1e774HYixO1xMYc5iyYRuc+lsphegJgEzBGbk5Ba2+LMU78H/OP4ovrLIfTCxyqzwV4HGehTQtLkK+CNaoT5k9vpODVE5GHkapYhhXkqd9xMb8TXLF9imVQhZE/iEuey2AV2iphkrRj5l6qAAKtedkFC12J1VfCFWlGrraiwIDAQABoyAwHjAOBgNVHQ8BAf8EBAMCB4AwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOBgQBmLMDfozjxxG2Scrj/p9IwQS8hLL8HXQZ9BgeoG8MW1c0ZOmo/9ElFlQhih0YspzgKKYozNN6X8WkuKPJtTRJk5uCaQqOLkGn1+0HLBbnaWW3v+2Ca7MLIZihlq6xwf25aRwYGiEoBgJ9PyaLaR/vYd0+N7Z6yQbNxh5D4zzEm/A==</ds:X509Certificate> > </ds:X509Data> > </ds:KeyInfo> > </ds:Signature> > </ReqDiagnostic> > > > But i am getting <ds:CanonicalizationMethod Algorithm=" > http://www.w3.org/2006/12/xml-c14n11"/> > where i want to change <CanonicalizationMethod Algorithm=" > http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/> > > How can I change the algorithm type? > > > > > > > On Thu, Dec 22, 2022 at 5:11 AM Karlovsky Alexey <yexe...@gmail.com> > wrote: > >> Hi, I can recommend to start with this library >> https://github.com/russellhaering/goxmldsig >> >> On Tue, 20 Dec 2022, 19:03 Reeturaj Sahoo, <reeturajsahoo.2...@gmail.com> >> wrote: >> >>> Hello Golang Team, >>> >>> I want to implement Signed XML to my XML Data . >>> If anyone have reference document .Kindly share >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golang-nuts+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/0c91f4a8-ccc2-428c-ab80-b81f269b64dan%40googlegroups.com >>> <https://groups.google.com/d/msgid/golang-nuts/0c91f4a8-ccc2-428c-ab80-b81f269b64dan%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> > > -- > *Thanks & Regards* > * Reeturaj* > > -- Kind regards, Alexey -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAMDzThg4mYg8Tp0J1tKN%3D6DDQfV_mR1DEiA4-_sNmo1iLgtxww%40mail.gmail.com.