[prev in list] [next in list] [prev in thread] [next in thread]
List: xml-security-dev
Subject: RE: SHA1 hash of canonicalized xml
From: <raghav.rao () wipro ! com>
Date: 2007-08-04 8:43:10
Message-ID: 20D88322B9D55444A327FEB661C30390206DA5 () HYD-MDP-MBX01 ! wipro ! com
[Download RAW message or body]
Hi,
You can use the following method in DSIGSignature class :
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *createBlankSignature(
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
canonicalizationMethod cm = CANON_C14N_NOC,
signatureMethod sm = SIGNATURE_DSA,
hashMethod hm = HASH_SHA1
);
Since you only need a SHA1 HASH, pass the signatureMethod as SIGNATURE_NONE.
Br,
Raghu.
thanks Sean for your reply, i'm using the c++ lib and was looking for the solution \
in the xml-securty-c.
So is there a way to do this using the c++ libs
thanks!!
> Date: Thu, 2 Aug 2007 15:31:43 -0400
> From: Sean.Mullan@Sun.COM
> Subject: Re: SHA1 hash of canonicalized xml
> To: security-dev@xml.apache.org
>
> k b wrote:
> > How do i generate SHA1 hash of canonicalized xml ?
> > i just want the sha1 hash.
> >
> > I know while signing a doc one can get the hash,
> > but in this case i just want the hash and don't want to go through the
> > signing process. is there an easier way ?
> >
>
> Yes, but you will have to use one of the following APIs:
>
> 1. javax.xml.crypto.dsig.TransformService if you are using the JSR 105 API
>
> 2. org.apache.xml.security.c14n.Canonicalizer
>
>
> Use one of these APIs to canonicalize the node-set, and then use a
> java.security.MessageDigest or java.security.DigestOutputStream to
> digest the resulting bytes.
>
> --Sean
The information contained in this electronic message and any attachments to this \
message are intended for the exclusive use of the addressee(s) and may contain \
proprietary, confidential or privileged information. If you are not the intended \
recipient, you should not disseminate, distribute or copy this e-mail. Please notify \
the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check \
this email and any attachments for the presence of viruses. The company accepts no \
liability for any damage caused by any virus transmitted by this email.
www.wipro.com
[Attachment #3 (text/html)]
<HTML dir=ltr><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#000000 size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>You can use the following method in DSIGSignature \
class :</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> \
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement \
*createBlankSignature(<BR> \
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument \
*doc,<BR> \
canonicalizationMethod cm = \
CANON_C14N_NOC,<BR> \
signatureMethod sm = \
SIGNATURE_DSA,<BR> \
hashMethod hm = HASH_SHA1<BR> \
);<BR></FONT></DIV> <DIV><FONT face=Arial size=2>Since you only need a SHA1 HASH, \
pass the signatureMethod as SIGNATURE_NONE.</FONT></DIV> <DIV><FONT face=Arial \
size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Br,</FONT></DIV>
<DIV><FONT face=Arial size=2>Raghu.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>thanks Sean for your reply, i'm using the c++ lib \
and was looking for the solution in the xml-securty-c.<BR><BR>So is there a way to do \
this using the c++ libs<BR>thanks!!<BR><BR>> Date: Thu, 2 Aug 2007 15:31:43 \
-0400<BR>> From: Sean.Mullan@Sun.COM<BR>> Subject: Re: SHA1 hash of \
canonicalized xml<BR>> To: security-dev@xml.apache.org<BR>> <BR>> k b \
wrote:<BR>> > How do i generate SHA1 hash of canonicalized xml ?<BR>> > i \
just want the sha1 hash.<BR>> > <BR>> > I know while signing a doc one \
can get the hash,<BR>> > but in this case i just want the hash and don't want \
to go through the<BR>> > signing process. is there an easier way ?<BR>> > \
<BR>> <BR>> Yes, but you will have to use one of the following APIs:<BR>> \
<BR>> 1. javax.xml.crypto.dsig.TransformService if you are using the JSR 105 \
API<BR>> <BR>> 2. org.apache.xml.security.c14n.Canonicalizer<BR>> <BR>> \
<BR>> Use one of these APIs to canonicalize the node-set, and then use a<BR>> \
java.security.MessageDigest or java.security.DigestOutputStream to<BR>> digest the \
resulting bytes.<BR>> <BR>> --Sean<BR></DIV></FONT></BODY></HTML> \
<table><tr><td bgcolor=#ffffff><font color=#000000><br> The information contained in \
this electronic message and any attachments to this message are intended for the \
exclusive use of the addressee(s) and may contain proprietary, confidential or \
privileged information. If you are not the intended recipient, you should not \
disseminate, distribute or copy this e-mail. Please notify the sender immediately and \
destroy all copies of this message and any attachments. <br> <br>
WARNING: Computer viruses can be transmitted via email. The recipient should check \
this email and any attachments for the presence of viruses. The company accepts no \
liability for any damage caused by any virus transmitted by this email.<br> <br>
www.wipro.com<br>
</font></td></tr></table>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic