Message from discussion
How to create canonicalized XML for XML digital signature
Date: Wed, 29 Feb 2012 20:32:29 -0800 (PST)
From: Pankaj <pank...@gmail.com>
To: android-security-discuss@googlegroups.com
Cc: Pankaj <pank...@gmail.com>
Message-ID: <33083201.6.1330576349078.JavaMail.geo-discussion-forums@pbcwg8>
In-Reply-To: <4F4E2EAF.8090103@telia.com>
References: <9e90a367-4c48-4aac-922d-6f59092fdec7@f5g2000yqm.googlegroups.com>
<4F4E2EAF.8090103@telia.com>
Subject: Re: [android-security-discuss] How to create canonicalized XML for
XML digital signature
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_Part_4_2831915.1330576349072"
------=_Part_4_2831915.1330576349072
Content-Type: multipart/alternative;
boundary="----=_Part_5_15811901.1330576349072"
------=_Part_5_15811901.1330576349072
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
I had tried that but i am not able to reproduce the digest value which
mention in my req xml :
<Reference URI="#_0">
> <Transforms>
> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
> </Transforms>
> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
> <DigestValue>Soj1m/E157CempDHHC6c6gZBd1E=</DigestValue>
> </Reference>
As per the W3C document Reference URI refer to element or ID which need to
canonicalized. In my case ID is
> <u:Timestamp u:Id="_0">
> <u:Created>2012-02-21T04:45:06.429Z</u:Created>
> <u:Expires>2012-02-21T04:50:06.429Z</u:Expires>
> </u:Timestamp>
I had tried my level best to create the SHA1 digest of above message part
to get digest value as per
<DigestValue>Soj1m/E157CempDHHC6c6gZBd1E=</DigestValue>
As per my understanding we need to convert digest value to base64 which I
am doing but I am not able to get close to the above value.
I had attach full XML req which is generated by using Visual Studio Client
& which I had extracted using WireShark tool.
Thanks
On Wednesday, 29 February 2012 19:27:03 UTC+5:30, Anders Rundgren wrote:
>
> If you only need to create a cononicalized XML it is very simple.
> You do the canonicalization manually.
> It means eliminating whitespace between elements.
> Putting attributes in alphabetical order.
>
> When the signatures verifies you are done :-)
>
> Anders
>
> On 2012-02-28 07:38, Pankaj wrote:
> > I want to consume WCF web-service which uses X.509 certificate for
> > mutual authentication. I had imported certificates using keytools in
> > BKS keystore & able to use in android code. Now for mutual
> > authentication i need to create web-request which have message digest
> > & signature in it
> >
> > <s:Header>
> > <o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/
> > oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
> > <u:Timestamp u:Id="_0">
> > <u:Created>2012-02-21T04:45:06.429Z</u:Created>
> > <u:Expires>2012-02-21T04:50:06.429Z</u:Expires>
> > </u:Timestamp>
> > <o:BinarySecurityToken u:Id="uuid-e35f5271-3c4e-47c7-
> > ba34-8d995e414ba3-1" ValueType="http://docs.oasis-open.org/wss/2004/01/
> > oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://
> > docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-
> > security-1.0#Base64Binary">
> >
> MIICbzCCAdygAwIBAgIQfjyZ229iN4tAbV0fiYiVyTAJBgUrDgMCHQUAMD8xPTA7BgNVBAMTNGNsaWVudC5iNTRiYTFkN2U2NzY0ZDdkOWRiMDA3YTgyNmM5ZGE5Ny5jbG91ZGFwcC5uZXQwHhcNMTIwMjE2MTY0MjI1WhcNMzkxMjMxMjM1OTU5WjA/
> >
> MT0wOwYDVQQDEzRjbGllbnQuYjU0YmExZDdlNjc2NGQ3ZDlkYjAwN2E4MjZjOWRhOTcuY2xvdWRhcHAubmV0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRW
> > +Di90XDGulLybdBboUlOilxvbcnfow+NhoNW80uNjmGQiQpxP0oNnYT7RKJ
> > +nP3+sZxUfRfazLgvOTFn0F9SIFQ9T4I5LNFMHhDfExoT0k/
> > aeF870Euy07BiwF7eXw6toSv1dKwKavq20szbIr/NeabIEDS/GzKY6P0/
> >
> TOQfwIDAQABo3QwcjBwBgNVHQEEaTBngBCNb6YOYI3RBR64WvVUjQtPoUEwPzE9MDsGA1UEAxM0Y2xpZW50LmI1NGJhMWQ3ZTY3NjRkN2Q5ZGIwMDdhODI2YzlkYTk3LmNsb3VkYXBwLm5ldIIQfjyZ229iN4tAbV0fiYiVyTAJBgUrDgMCHQUAA4GBAG5v1DZmXQKcaxNzz2VYDZ8aYYrYRQwU4lrBKlI0CnrkcZwQGPmRxdkiET9D91kcN/
> > fmq90nj1F5FZoqhzeT1moqGKXKT9HRX8j6Ln1QDhsr+0JfgJW9/
> > IFaQI14xKwr8bw4+DxIyp0IMpSw9biULmIQ1QuTzfKDEowlcQhsik+E
> > </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="#_0">
> > <Transforms>
> > <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
> > </Transforms>
> > <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
> > <DigestValue>Soj1m/E157CempDHHC6c6gZBd1E=</DigestValue>
> > </Reference>
> > </SignedInfo>
> > <SignatureValue>
> > kqsIYUc3uYoQpuWVWYOio4KcGpon+3wDDhsAzVgZVljQxEhF7z1JS/
> > qzw9ELYCn2JbYIkWMtEeYfXRtPvjrPM1fjJiqbXSKq7jHEeVtMQnOytAHRL1ZFA
> > +dLq4spJQR7uYnmJ1lmgQnu1kYcteSmD29Xm5e5dPUnz4yap3p7zC4=
> > </SignatureValue>
> > <KeyInfo>
> > <o:SecurityTokenReference>
> > <o:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/
> > oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#uuid-
> > e35f5271-3c4e-47c7-ba34-8d995e414ba3-1"/>
> > </o:SecurityTokenReference>
> > </KeyInfo>
> > </Signature>
> > </o:Security>
> > </s:Header>
> >
> > But to create message digest we need perform XML canonicalization with
> > "http://www.w3.org/2001/10/xml-exc-c14n#" transform algorithm. I am
> > not able to found any API or library which perform above task.
> >
> > I had used xmlsec jar but I guess it is not supported by android and
> > also used all the option which I found after googling.
> >
> > Please guide me how to call WCF web-service which involve X.509
> > certificate based mutual authentication.
> >
>
>
On Wednesday, 29 February 2012 19:27:03 UTC+5:30, Anders Rundgren wrote:
>
> If you only need to create a cononicalized XML it is very simple.
> You do the canonicalization manually.
> It means eliminating whitespace between elements.
> Putting attributes in alphabetical order.
>
> When the signatures verifies you are done :-)
>
> Anders
>
> On 2012-02-28 07:38, Pankaj wrote:
> > I want to consume WCF web-service which uses X.509 certificate for
> > mutual authentication. I had imported certificates using keytools in
> > BKS keystore & able to use in android code. Now for mutual
> > authentication i need to create web-request which have message digest
> > & signature in it
> >
> > <s:Header>
> > <o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/
> > oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
> > <u:Timestamp u:Id="_0">
> > <u:Created>2012-02-21T04:45:06.429Z</u:Created>
> > <u:Expires>2012-02-21T04:50:06.429Z</u:Expires>
> > </u:Timestamp>
> > <o:BinarySecurityToken u:Id="uuid-e35f5271-3c4e-47c7-
> > ba34-8d995e414ba3-1" ValueType="http://docs.oasis-open.org/wss/2004/01/
> > oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://
> > docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-
> > security-1.0#Base64Binary">
> >
> MIICbzCCAdygAwIBAgIQfjyZ229iN4tAbV0fiYiVyTAJBgUrDgMCHQUAMD8xPTA7BgNVBAMTNGNsaWVudC5iNTRiYTFkN2U2NzY0ZDdkOWRiMDA3YTgyNmM5ZGE5Ny5jbG91ZGFwcC5uZXQwHhcNMTIwMjE2MTY0MjI1WhcNMzkxMjMxMjM1OTU5WjA/
> >
> MT0wOwYDVQQDEzRjbGllbnQuYjU0YmExZDdlNjc2NGQ3ZDlkYjAwN2E4MjZjOWRhOTcuY2xvdWRhcHAubmV0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRW
> > +Di90XDGulLybdBboUlOilxvbcnfow+NhoNW80uNjmGQiQpxP0oNnYT7RKJ
> > +nP3+sZxUfRfazLgvOTFn0F9SIFQ9T4I5LNFMHhDfExoT0k/
> > aeF870Euy07BiwF7eXw6toSv1dKwKavq20szbIr/NeabIEDS/GzKY6P0/
> >
> TOQfwIDAQABo3QwcjBwBgNVHQEEaTBngBCNb6YOYI3RBR64WvVUjQtPoUEwPzE9MDsGA1UEAxM0Y2xpZW50LmI1NGJhMWQ3ZTY3NjRkN2Q5ZGIwMDdhODI2YzlkYTk3LmNsb3VkYXBwLm5ldIIQfjyZ229iN4tAbV0fiYiVyTAJBgUrDgMCHQUAA4GBAG5v1DZmXQKcaxNzz2VYDZ8aYYrYRQwU4lrBKlI0CnrkcZwQGPmRxdkiET9D91kcN/
> > fmq90nj1F5FZoqhzeT1moqGKXKT9HRX8j6Ln1QDhsr+0JfgJW9/
> > IFaQI14xKwr8bw4+DxIyp0IMpSw9biULmIQ1QuTzfKDEowlcQhsik+E
> > </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="#_0">
> > <Transforms>
> > <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
> > </Transforms>
> > <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
> > <DigestValue>Soj1m/E157CempDHHC6c6gZBd1E=</DigestValue>
> > </Reference>
> > </SignedInfo>
> > <SignatureValue>
> > kqsIYUc3uYoQpuWVWYOio4KcGpon+3wDDhsAzVgZVljQxEhF7z1JS/
> > qzw9ELYCn2JbYIkWMtEeYfXRtPvjrPM1fjJiqbXSKq7jHEeVtMQnOytAHRL1ZFA
> > +dLq4spJQR7uYnmJ1lmgQnu1kYcteSmD29Xm5e5dPUnz4yap3p7zC4=
> > </SignatureValue>
> > <KeyInfo>
> > <o:SecurityTokenReference>
> > <o:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/
> > oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#uuid-
> > e35f5271-3c4e-47c7-ba34-8d995e414ba3-1"/>
> > </o:SecurityTokenReference>
> > </KeyInfo>
> > </Signature>
> > </o:Security>
> > </s:Header>
> >
> > But to create message digest we need perform XML canonicalization with
> > "http://www.w3.org/2001/10/xml-exc-c14n#" transform algorithm. I am
> > not able to found any API or library which perform above task.
> >
> > I had used xmlsec jar but I guess it is not supported by android and
> > also used all the option which I found after googling.
> >
> > Please guide me how to call WCF web-service which involve X.509
> > certificate based mutual authentication.
> >
>
>
------=_Part_5_15811901.1330576349072
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
I had tried that but i am not able to reproduce the digest value which ment=
ion in my req xml :<div><br></div><div><span style=3D"line-height: 18px; ">=
<Reference URI=3D"#_0"></span><br style=3D"line-height: 18px; "><span=
style=3D"line-height: 18px; ">> <Transforms></span><br style=3D"l=
ine-height: 18px; "><span style=3D"line-height: 18px; ">> <Transform =
Algorithm=3D"</span><a href=3D"http://www.w3.org/2001/10/xml-exc-c14n#" tar=
get=3D"_blank" style=3D"border-style: initial; border-color: initial; line-=
height: 18px; ">http://www.w3.org/<wbr>2001/10/xml-exc-c14n#</a><span style=
=3D"line-height: 18px; ">"/></span><br style=3D"line-height: 18px; "><sp=
an style=3D"line-height: 18px; ">> </Transforms></span><br style=
=3D"line-height: 18px; "><span style=3D"line-height: 18px; ">> <Diges=
tMethod Algorithm=3D"</span><a href=3D"http://www.w3.org/2000/09/xmldsig#sh=
a1" target=3D"_blank" style=3D"border-style: initial; border-color: initial=
; line-height: 18px; ">http://www.w3.org/<wbr>2000/09/xmldsig#sha1</a><span=
style=3D"line-height: 18px; ">"/></span><br style=3D"line-height: 18px;=
"><span style=3D"line-height: 18px; ">> <DigestValue>Soj1m/</span=
><wbr style=3D"line-height: 18px; "><span style=3D"line-height: 18px; ">E15=
7CempDHHC6c6gZBd1E=3D</</span><wbr style=3D"line-height: 18px; "><span s=
tyle=3D"line-height: 18px; ">DigestValue></span><br style=3D"line-height=
: 18px; "><span style=3D"line-height: 18px; ">> </Reference></span=
> </div><div><br></div><div>As per the W3C document Reference URI refe=
r to element or ID which need to canonicalized. In my case ID is </div=
><div><br></div><div><span style=3D"border-style: initial; border-color: in=
itial; line-height: 18px; ">> <u:Timestamp u:Id=3D"_0"></span><br =
style=3D"line-height: 18px; "><span style=3D"border-style: initial; border-=
color: initial; line-height: 18px; ">> <u:Created>2012-02-21T04:45=
:</span><wbr style=3D"line-height: 18px; "><span style=3D"border-style: ini=
tial; border-color: initial; line-height: 18px; ">06.429Z</u:Created>=
</span><br style=3D"line-height: 18px; "><span style=3D"border-style: initi=
al; border-color: initial; line-height: 18px; ">> <u:Expires>2012-=
02-21T04:50:</span><wbr style=3D"line-height: 18px; "><span style=3D"border=
-style: initial; border-color: initial; line-height: 18px; ">06.429Z</u:=
Expires></span><br style=3D"line-height: 18px; "><span style=3D"border-s=
tyle: initial; border-color: initial; line-height: 18px; ">> </u:Time=
stamp></span> </div><div><br></div><div>I had tried my level =
best to create the SHA1 digest of above message part to get digest value as=
per </div><div><span style=3D"border-style: initial; border-color: in=
itial; line-height: 18px; "><DigestValue>Soj1m/</span><wbr style=3D"l=
ine-height: 18px; "><span style=3D"border-style: initial; border-color: ini=
tial; line-height: 18px; ">E157CempDHHC6c6gZBd1E=3D</</span><wbr style=
=3D"line-height: 18px; "><span style=3D"border-style: initial; border-color=
: initial; line-height: 18px; ">DigestValue></span> </div><div><br>=
</div><div>As per my understanding we need to convert digest value to base6=
4 which I am doing but I am not able to get close to the above value.</div>=
<div><br></div><div>I had attach full XML req which is generated by using V=
isual Studio Client & which I had extracted using WireShark tool.</div>=
<div><br></div><div>Thanks<br><br>On Wednesday, 29 February 2012 19:27:03 U=
TC+5:30, Anders Rundgren wrote:<blockquote class=3D"gmail_quote" style=3D"=
margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;=
">If you only need to create a cononicalized XML it is very simple.<br>You =
do the canonicalization manually.<br>It means eliminating whitespace betwee=
n elements.<br>Putting attributes in alphabetical order.<p>When the signatu=
res verifies you are done :-)</p><p>Anders</p><p>On 2012-02-28 07:38, Panka=
j wrote:<br>> I want to consume WCF web-service which uses X.509 certifi=
cate for<br>> mutual authentication. I had imported certificates using k=
eytools in<br>> BKS keystore & able to use in android code. Now for =
mutual<br>> authentication i need to create web-request which have messa=
ge digest<br>> & signature in it<br>> <br>> <s:Header><b=
r>> <o:Security xmlns:o=3D"<a href=3D"http://docs.oasis-open.org/wss/=
2004/01/" target=3D"_blank">http://docs.oasis-<wbr>open.org/wss/2004/01/</a=
><br>> oasis-200401-wss-wssecurity-<wbr>secext-1.0.xsd" s:mustUnderstand=
=3D"1"><br>> <u:Timestamp u:Id=3D"_0"><br>> <u:Created>=
;2012-02-21T04:45:<wbr>06.429Z</u:Created><br>> <u:Expires>2=
012-02-21T04:50:<wbr>06.429Z</u:Expires><br>> </u:Timestamp>=
<br>> <o:BinarySecurityToken u:Id=3D"uuid-e35f5271-3c4e-47c7-<br>>=
ba34-8d995e414ba3-1" ValueType=3D"<a href=3D"http://docs.oasis-open.org/ws=
s/2004/01/" target=3D"_blank">http://docs.oasis-<wbr>open.org/wss/2004/01/<=
/a><br>> oasis-200401-wss-x509-token-<wbr>profile-1.0#X509v3" EncodingTy=
pe=3D"http://<br>> <a href=3D"http://docs.oasis-open.org/wss/2004/01/oas=
is-200401-wss-soap-message-" target=3D"_blank">docs.oasis-open.org/wss/2004=
/<wbr>01/oasis-200401-wss-soap-<wbr>message-</a><br>> security-1.0#Base6=
4Binary"><br>> MIICbz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mlns=3D"<a h=
ref=3D"http://www.w3.org/2000/09/xmldsig#" target=3D"_blank">http://www.w3.=
org/2000/<wbr>09/xmldsig#</a>"><br>> <SignedInfo><br>> <C=
anonicalizationMethod Algorithm=3D"<a href=3D"http://www.w3.org/2001/10/xml=
-exc-" target=3D"_blank">http://www.w3.org/<wbr>2001/10/xml-exc-</a><br>>=
; c14n#"/><br>> <SignatureMethod Algorithm=3D"<a href=3D"http://ww=
w.w3.org/2000/09/xmldsig#rsa-" target=3D"_blank">http://www.w3.org/<wbr>200=
0/09/xmldsig#rsa-</a><br>> sha1"/><br>> <Reference URI=3D"#_0"&=
gt;<br>> <Transforms><br>> <Transform Algorithm=3D"<a href=
=3D"http://www.w3.org/2001/10/xml-exc-c14n#" target=3D"_blank">http://www.w=
3.org/<wbr>2001/10/xml-exc-c14n#</a>"/><br>> </Transforms><br>&=
gt; <DigestMethod Algorithm=3D"<a href=3D"http://www.w3.org/2000/09/xmld=
sig#sha1" target=3D"_blank">http://www.w3.org/<wbr>2000/09/xmldsig#sha1</a>=
"/><br>> <DigestValue>Soj1m/<wbr>E157CempDHHC6c6gZBd1E=3D</<=
wbr>DigestValue><br>> </Reference><br>> </SignedInfo><=
br>> <SignatureValue><br>> kqsIYUc3uYoQpuWVWYOio4KcGpon+<wbr>3w=
DDhsAzVgZVljQxEhF7z1JS/<br>> qzw9ELYCn2JbYIkWMtEeYfXRtPvjrP<wbr>M1fjJiqb=
XSKq7jHEeVtMQnOytAHRL1<wbr>ZFA<br>> +<wbr>dLq4spJQR7uYnmJ1lmgQnu1kYcteSm=
<wbr>D29Xm5e5dPUnz4yap3p7zC4=3D<br>> </SignatureValue><br>> <=
;KeyInfo><br>> <o:SecurityTokenReference><br>> <o:Referen=
ce ValueType=3D"<a href=3D"http://docs.oasis-open.org/wss/2004/01/" target=
=3D"_blank">http://docs.oasis-<wbr>open.org/wss/2004/01/</a><br>> oasis-=
200401-wss-x509-token-<wbr>profile-1.0#X509v3" URI=3D"#uuid-<br>> e35f52=
71-3c4e-47c7-ba34-<wbr>8d995e414ba3-1"/><br>> </o:SecurityTokenRef=
erence><br>> </KeyInfo><br>> </Signature><br>> <=
/o:Security><br>> </s:Header><br>> <br>> But to create me=
ssage digest we need perform XML canonicalization with<br>> "<a href=3D"=
http://www.w3.org/2001/10/xml-exc-c14n#" target=3D"_blank">http://www.w3.or=
g/2001/10/<wbr>xml-exc-c14n#</a>" transform algorithm. I am<br>> not abl=
e to found any API or library which perform above task.<br>> <br>> I =
had used xmlsec jar but I guess it is not supported by android and<br>> =
also used all the option which I found after googling.<br>> <br>> Ple=
ase guide me how to call WCF web-service which involve X.509<br>> certif=
icate based mutual authentication.<br>> </p><p></p><p></p><p></p><p></p>=
</blockquote></div><br>On Wednesday, 29 February 2012 19:27:03 UTC+5:30, An=
ders Rundgren wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">If you on=
ly need to create a cononicalized XML it is very simple.<br>You do the cano=
nicalization manually.<br>It means eliminating whitespace between elements.=
<br>Putting attributes in alphabetical order.<p>When the signatures verifie=
s you are done :-)</p><p>Anders</p><p>On 2012-02-28 07:38, Pankaj wrote:<br=
>> I want to consume WCF web-service which uses X.509 certificate for<br=
>> mutual authentication. I had imported certificates using keytools in<=
br>> BKS keystore & able to use in android code. Now for mutual<br>&=
gt; authentication i need to create web-request which have message digest<b=
r>> & signature in it<br>> <br>> <s:Header><br>> <=
o:Security xmlns:o=3D"<a href=3D"http://docs.oasis-open.org/wss/2004/01/" t=
arget=3D"_blank">http://docs.oasis-<wbr>open.org/wss/2004/01/</a><br>> o=
asis-200401-wss-wssecurity-<wbr>secext-1.0.xsd" s:mustUnderstand=3D"1"><=
br>> <u:Timestamp u:Id=3D"_0"><br>> <u:Created>2012-02-21=
T04:45:<wbr>06.429Z</u:Created><br>> <u:Expires>2012-02-21T0=
4:50:<wbr>06.429Z</u:Expires><br>> </u:Timestamp><br>> &l=
t;o:BinarySecurityToken u:Id=3D"uuid-e35f5271-3c4e-47c7-<br>> ba34-8d995=
e414ba3-1" ValueType=3D"<a href=3D"http://docs.oasis-open.org/wss/2004/01/"=
target=3D"_blank">http://docs.oasis-<wbr>open.org/wss/2004/01/</a><br>>=
oasis-200401-wss-x509-token-<wbr>profile-1.0#X509v3" EncodingType=3D"http:=
//<br>> <a href=3D"http://docs.oasis-open.org/wss/2004/01/oasis-200401-w=
ss-soap-message-" target=3D"_blank">docs.oasis-open.org/wss/2004/<wbr>01/oa=
sis-200401-wss-soap-<wbr>message-</a><br>> security-1.0#Base64Binary">=
;<br>> MIICbzCCAdygAwIBAgIQfjyZ229iN4<wbr>tAbV0fiYiVyTAJBgUrDgMCHQUAMD8x=
<wbr>PTA7BgNVBAMTNGNsaWVudC5iNTRiYT<wbr>FkN2U2NzY0ZDdkOWRiMDA3YTgyNmM5<wbr>=
ZGE5Ny5jbG91ZGFwcC5uZXQwHhcNMT<wbr>IwMjE2MTY0MjI1WhcNMzkxMjMxMjM1<wbr>OTU5W=
jA/<br>> MT0wOwYDVQQDEzRjbGllbnQuYjU0Ym<wbr>ExZDdlNjc2NGQ3ZDlkYjAwN2E4Mj=
Zj<wbr>OWRhOTcuY2xvdWRhcHAubmV0MIGfMA<wbr>0GCSqGSIb3DQEBAQUAA4GNADCBiQKB<wb=
r>gQDRW<br>> +<wbr>Di90XDGulLybdBboUlOilxvbcnfow+<wbr>NhoNW80uNjmGQiQpxP=
0oNnYT7RKJ<br>> +nP3+<wbr>sZxUfRfazLgvOTFn0F9SIFQ9T4I5LN<wbr>FMHhDfExoT0=
k/<br>> aeF870Euy07BiwF7eXw6toSv1dKwKa<wbr>vq20szbIr/NeabIEDS/GzKY6P0/<b=
r>> TOQfwIDAQABo3QwcjBwBgNVHQEEaTB<wbr>ngBCNb6YOYI3RBR64WvVUjQtPoUEwP<wb=
r>zE9MDsGA1UEAxM0Y2xpZW50LmI1NGJ<wbr>hMWQ3ZTY3NjRkN2Q5ZGIwMDdhODI2Y<wbr>zlk=
YTk3LmNsb3VkYXBwLm5ldIIQfjy<wbr>Z229iN4tAbV0fiYiVyTAJBgUrDgMCH<wbr>QUAA4GBA=
G5v1DZmXQKcaxNzz2VYDZ8<wbr>aYYrYRQwU4lrBKlI0CnrkcZwQGPmRx<wbr>dkiET9D91kcN/=
<br>> fmq90nj1F5FZoqhzeT1moqGKXKT9HR<wbr>X8j6Ln1QDhsr+0JfgJW9/<br>> I=
FaQI14xKwr8bw4+<wbr>DxIyp0IMpSw9biULmIQ1QuTzfKDEow<wbr>lcQhsik+E<br>> &l=
t;/o:BinarySecurityToken><br>> <Signature xmlns=3D"<a href=3D"http=
://www.w3.org/2000/09/xmldsig#" target=3D"_blank">http://www.w3.org/2000/<w=
br>09/xmldsig#</a>"><br>> <SignedInfo><br>> <Canonicaliza=
tionMethod Algorithm=3D"<a href=3D"http://www.w3.org/2001/10/xml-exc-" targ=
et=3D"_blank">http://www.w3.org/<wbr>2001/10/xml-exc-</a><br>> c14n#"/&g=
t;<br>> <SignatureMethod Algorithm=3D"<a href=3D"http://www.w3.org/20=
00/09/xmldsig#rsa-" target=3D"_blank">http://www.w3.org/<wbr>2000/09/xmldsi=
g#rsa-</a><br>> sha1"/><br>> <Reference URI=3D"#_0"><br>>=
<Transforms><br>> <Transform Algorithm=3D"<a href=3D"http://ww=
w.w3.org/2001/10/xml-exc-c14n#" target=3D"_blank">http://www.w3.org/<wbr>20=
01/10/xml-exc-c14n#</a>"/><br>> </Transforms><br>> <Diges=
tMethod Algorithm=3D"<a href=3D"http://www.w3.org/2000/09/xmldsig#sha1" tar=
get=3D"_blank">http://www.w3.org/<wbr>2000/09/xmldsig#sha1</a>"/><br>>=
; <DigestValue>Soj1m/<wbr>E157CempDHHC6c6gZBd1E=3D</<wbr>DigestVal=
ue><br>> </Reference><br>> </SignedInfo><br>> <S=
ignatureValue><br>> kqsIYUc3uYoQpuWVWYOio4KcGpon+<wbr>3wDDhsAzVgZVljQ=
xEhF7z1JS/<br>> qzw9ELYCn2JbYIkWMtEeYfXRtPvjrP<wbr>M1fjJiqbXSKq7jHEeVtMQ=
nOytAHRL1<wbr>ZFA<br>> +<wbr>dLq4spJQR7uYnmJ1lmgQnu1kYcteSm<wbr>D29Xm5e5=
dPUnz4yap3p7zC4=3D<br>> </SignatureValue><br>> <KeyInfo><=
br>> <o:SecurityTokenReference><br>> <o:Reference ValueType=
=3D"<a href=3D"http://docs.oasis-open.org/wss/2004/01/" target=3D"_blank">h=
ttp://docs.oasis-<wbr>open.org/wss/2004/01/</a><br>> oasis-200401-wss-x5=
09-token-<wbr>profile-1.0#X509v3" URI=3D"#uuid-<br>> e35f5271-3c4e-47c7-=
ba34-<wbr>8d995e414ba3-1"/><br>> </o:SecurityTokenReference><br=
>> </KeyInfo><br>> </Signature><br>> </o:Security&g=
t;<br>> </s:Header><br>> <br>> But to create message digest =
we need perform XML canonicalization with<br>> "<a href=3D"http://www.w3=
.org/2001/10/xml-exc-c14n#" target=3D"_blank">http://www.w3.org/2001/10/<wb=
r>xml-exc-c14n#</a>" transform algorithm. I am<br>> not able to found an=
y API or library which perform above task.<br>> <br>> I had used xmls=
ec jar but I guess it is not supported by android and<br>> also used all=
the option which I found after googling.<br>> <br>> Please guide me =
how to call WCF web-service which involve X.509<br>> certificate based m=
utual authentication.<br>> </p><p></p><p></p><p></p><p></p></blockquote>
------=_Part_5_15811901.1330576349072--
------=_Part_4_2831915.1330576349072
Content-Type: application/xml; name=req.xml
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="req.xml"
X-Attachment-Id: da72905d-cb04-485d-a801-2213c7d9a7d9
PHM6RW52ZWxvcGUgeG1sbnM6cz0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZl
bG9wZS8iIHhtbG5zOnU9Imh0dHA6Ly9kb2NzLm9hc2lzLW9wZW4ub3JnL3dzcy8yMDA0LzAxL29h
c2lzLTIwMDQwMS13c3Mtd3NzZWN1cml0eS11dGlsaX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