web services - Possible unicode interop issue between WCF and Java EE when using signed messages over HTTPS? -
i'm using custom binding configuration below sign soap message certificate on https:
system.servicemodel.channels.asymmetricsecuritybindingelement asbe = new asymmetricsecuritybindingelement(); asbe.messagesecurityversion = messagesecurityversion.wssecurity11wstrust13wssecureconversation13wssecuritypolicy12; asbe.initiatortokenparameters = new system.servicemodel.security.tokens.x509securitytokenparameters { inclusionmode = securitytokeninclusionmode.never }; asbe.recipienttokenparameters = new system.servicemodel.security.tokens.x509securitytokenparameters { inclusionmode = securitytokeninclusionmode.never }; asbe.messageprotectionorder = system.servicemodel.security.messageprotectionorder.signbeforeencrypt; asbe.securityheaderlayout = securityheaderlayout.strict; asbe.enableunsecuredresponse = true; asbe.includetimestamp = false; asbe.setkeyderivation(false); asbe.defaultalgorithmsuite = system.servicemodel.security.securityalgorithmsuite.basic128rsa15; asbe.endpointsupportingtokenparameters.signed.add(new x509securitytokenparameters()); custombinding mybinding = new custombinding(); mybinding.elements.add(asbe); mybinding.elements.add(new textmessageencodingbindingelement(messageversion.soap11, encoding.utf8)); httpstransportbindingelement httpsbindingelement = new httpstransportbindingelement(); httpsbindingelement.requireclientcertificate = true; mybinding.elements.add(httpsbindingelement); everything working well, until application starts sending chinese characters. java-based web service returns error "the signature or decryption invalid" when soap message sent:
<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <s:header> <o:security s:mustunderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <o:binarysecuritytoken u:id="uuid-f9e416e6-c2bd-42b8-81db-895d878cf239-1" valuetype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#x509v3">miibntccaqagawibagieuwuajtanbgkqhkig9w0baqufadatmrewdwydvqqdewhhcmvlbm92ytaefw0xmza0mtuwnjezmznafw0ymzaymjiwnjezmznambmxetapbgnvbamtcedyzwvub3zhmigfma0gcsqgsib3dqebaquaa4gnadcbiqkbgqclgmjyyrxz17srwpjznmqwez+yv2wlvpx205flie2kg1bitb02/7gfv+l1rqontkyknbuduewrakxao/v5jcy965eblatrjtvmwsddh/ifxir9hiatxanrzqqfyelno1tmb/sre0fefdczq2spebzxtf0y4ed90lnaevivbu6zjqidaqabma0gcsqgsib3dqebbquaa4gbah//yf+emb7nazdyfdnscfq8pnwmv8leyxh5/phm6r4nvpryzuqxerx/yhkv5dg4ywset7rpjj7z1tz3jpdfo5kvpibyd+tkat04zfu51+xp9fmarmkf289n4nzrp8nz7kqudktiuw8vppdpt1c68uthib/3jqizskzfllhff2ru</o:binarysecuritytoken> <signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <signedinfo> <canonicalizationmethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <signaturemethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <reference uri="#_1"> <transforms> <transform algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </transforms> <digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <digestvalue>iikd/cwfzp4myuomh5w5zls1q8i=</digestvalue> </reference> <reference uri="#uuid-f9e416e6-c2bd-42b8-81db-895d878cf239-1"> <transforms> <transform algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </transforms> <digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <digestvalue>ijckcmunrgpbhy6xllfdy9pju84=</digestvalue> </reference> </signedinfo> <signaturevalue>iy0br43enlnmxa3xmzmafxe7tvbroaluv4hctbsuiw6ltxbp6a3w76ntxno111uqae4k55yhpdkdzkqe2iqk5qrl1kvnnehnlfsjixigcab52os2i0ogbfphjypowq0ps6jp8fjz2/lkgqy1lmph7atya4uywnbkk8sfvr+x+bg=</signaturevalue> <keyinfo> <o:securitytokenreference> <x509data> <x509issuerserial> <x509issuername>cn=greenova</x509issuername> <x509serialnumber>1366006413</x509serialnumber> </x509issuerserial> </x509data> </o:securitytokenreference> </keyinfo> </signature> </o:security> </s:header> <s:body u:id="_1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <createuser xmlns="http://webservice.service.vim.logistics.teckwah.com/"> <userinfo xmlns=""> <city>台北市</city> <companyname>個人使用</companyname> <contactemail>pprtest.account@yahoo.com.tw</contactemail> <contactname>黃先, 用先生</contactname> <contactno>+886333333333</contactno> <country>taiwan</country> <custtype>ppr member</custtype> <email>pprtest.account@yahoo.com.tw</email> <fullname>黃, 先生</fullname> <password>$3cr3t!h0y</password> <pickupaddr>台市松德路888號</pickupaddr> <repassword>$3cr3t!h0y</repassword> <salutation>先生</salutation> <tel>+886333333333</tel> <username>pprtest.account@yahoo.com.tw</username> </userinfo> </createuser> </s:body> but code uses same binding configuration above works if chinese characters not present.
<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <s:header> <o:security s:mustunderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <o:binarysecuritytoken u:id="uuid-3dd89dfe-53aa-4f87-a07d-e33c1cb26bd2-1" valuetype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#x509v3">miibntccaqagawibagieuwuajtanbgkqhkig9w0baqufadatmrewdwydvqqdewhhcmvlbm92ytaefw0xmza0mtuwnjezmznafw0ymzaymjiwnjezmznambmxetapbgnvbamtcedyzwvub3zhmigfma0gcsqgsib3dqebaquaa4gnadcbiqkbgqclgmjyyrxz17srwpjznmqwez+yv2wlvpx205flie2kg1bitb02/7gfv+l1rqontkyknbuduewrakxao/v5jcy965eblatrjtvmwsddh/ifxir9hiatxanrzqqfyelno1tmb/sre0fefdczq2spebzxtf0y4ed90lnaevivbu6zjqidaqabma0gcsqgsib3dqebbquaa4gbah//yf+emb7nazdyfdnscfq8pnwmv8leyxh5/phm6r4nvpryzuqxerx/yhkv5dg4ywset7rpjj7z1tz3jpdfo5kvpibyd+tkat04zfu51+xp9fmarmkf289n4nzrp8nz7kqudktiuw8vppdpt1c68uthib/3jqizskzfllhff2ru</o:binarysecuritytoken> <signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <signedinfo> <canonicalizationmethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <signaturemethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <reference uri="#_1"> <transforms> <transform algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </transforms> <digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <digestvalue>pdgvxh62+jpiab/khzmr112gjwm=</digestvalue> </reference> <reference uri="#uuid-3dd89dfe-53aa-4f87-a07d-e33c1cb26bd2-1"> <transforms> <transform algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </transforms> <digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <digestvalue>p+4aooujtgxq55x6crmkva72yqc=</digestvalue> </reference> </signedinfo> <signaturevalue>ba1kjrhxsafa41/rdin11opmz5ulebq+ubxui5sk0g8rp1wk4fqqmyoge5jxz4/eaztfullwy1wlje7kscblyl0pj3wcotc8ygiywf0umovvbpx4evu0brutf6m02oy8odc61465tvp9indksjwkqjzypt5/k+uyysvsfoj1whw=</signaturevalue> <keyinfo> <o:securitytokenreference> <x509data> <x509issuerserial> <x509issuername>cn=greenova</x509issuername> <x509serialnumber>1366006413</x509serialnumber> </x509issuerserial> </x509data> </o:securitytokenreference> </keyinfo> </signature> </o:security> </s:header> <s:body u:id="_1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <createuser xmlns="http://webservice.service.vim.logistics.teckwah.com/"> <userinfo xmlns=""> <city>taipei</city> <companyname>papa rap ltd.</companyname> <contactemail>test909.eizbopf@greenova.tw</contactemail> <contactname>papa rap</contactname> <contactno>+639999999999</contactno> <country>taiwan</country> <custtype>ppr member</custtype> <email>test909.eizbopf@greenova.tw</email> <fullname>papa rap</fullname> <password>by9qjx!)n1^stw</password> <pickupaddr>unit 210-a orbit street</pickupaddr> <repassword>by9qjx!)n1^stw</repassword> <salutation>mr.</salutation> <tel>+639999999999</tel> <username>test909.eizbopf@greenova.tw</username> </userinfo> </createuser> </s:body> can configuration issue?
nop.. there isn't interop issue. server not recognizing unicode characters.
Comments
Post a Comment