XForms digital signature

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

XForms digital signature

Deepak Tewani
Hi,

I want to develop a xml signature through xforms on a xforms document.
I mean to say that i want to develop a button on xforms document which
will sign the xml file that is been genertaed by xforms form.

Please help me in developing xml signature code.

Thanks and Regards,
Deepak Tewani
Programmer
N.I.C
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: XForms digital signature

Aaron Reed
I would suggest bringing this up with the W3C XForms mailing list.  The
XForms Working Group has done a lot of thinking about digital signing
and XForms.  There is even a paper on it, I believe.  They would know
more about the implementation side of things than most of us, I'd think.

--Aaron

Deepak Tewani wrote:

> Hi,
>
> I want to develop a xml signature through xforms on a xforms document.
> I mean to say that i want to develop a button on xforms document which
> will sign the xml file that is been genertaed by xforms form.
>
> Please help me in developing xml signature code.
>
> Thanks and Regards,
> Deepak Tewani
> Programmer
> N.I.C
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: XForms digital signature

Deepak Tewani
On Oct 22, 10:07 pm, Aaron Reed <[hidden email]> wrote:

> I would suggest bringing this up with the W3C XForms mailing list.  The
> XForms Working Group has done a lot of thinking about digital signing
> and XForms.  There is even a paper on it, I believe.  They would know
> more about the implementation side of things than most of us, I'd think.
>
> --Aaron
>
> Deepak Tewani wrote:
> > Hi,
>
> > I want to develop a xml signature through xforms on a xforms document.
> > I mean to say that i want to develop a button on xforms document which
> > will sign the xml file that is been genertaed by xforms form.
>
> > Please help me in developing xml signature code.
>
> > Thanks and Regards,
> > Deepak Tewani
> > Programmer
> > N.I.C

Thnaks Aaron for taking your time out and replying me.
I am sending you the code that i have written to put digital signature
on xml file through xforms, please check the code and kindly reply me
if you feel something should be updated or deleted from the code so
that xml file can be digitally signed.

Here is the code..

<html
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:xforms="http://www.w3.org/2002/xforms"
 xmlns:ev="http://www.w3.org/2001/xml-events"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#"
 xmlns:custom="http://www.ibm.com/xmlns/prod/XFDL/Custom"
 xmlns:designer="http://www.ibm.com/xmlns/prod/workplace/forms/
designer/2.6"
 xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
 xmlns:dsxp="http://www.w3.org/2002/06/xmldsig-filter2"
 xmlns:sigmeta="http://www.ibm.com/xmlns/prod/forms/signature/metadata/
1.0"
 xmlns:xfdl="http://www.ibm.com/xmlns/prod/XFDL/7.6">

<head>

<xforms:model>

<xforms:instance id="GeneratedInstance" xmlns="">
   <generated>

      <test/>
      <PAGE1>
         <BUTTON1>
             <ds:Signature>

                <ds:SignedInfo>
                   <ds:CanonicalizationMethod Algorithm="http://
www.w3.org/TR/2001/REC-xml-c14n-20010315"></ds:CanonicalizationMethod>
                   <ds:SignatureMethod Algorithm="http://www.w3.org/
2000/09/xmldsig#rsa-sha1">
                   </ds:SignatureMethod>
                   <ds:Reference>
                      <ds:Transforms>
                         <ds:Transform Algorithm="http://www.w3.org/
2002/06/xmldsig-filter2">
                            <dsxp:XPath Filter="subtract">/xfdl:XFDL/
xfdl:globalpage/xfdl:global/xfdl:xformsmodels/xforms:model/
xforms:instance[@id="GeneratedInstance"]/generated/PAGE1/BUTTON1/
ds:Signature</dsxp:XPath>

                         </ds:Transform>
                      </ds:Transforms>
                      <ds:DigestMethod Algorithm="http://www.w3.org/
2000/09/xmldsig#sha1">
                      </ds:DigestMethod>
                      <ds:DigestValue></ds:DigestValue>
                   </ds:Reference>
                   <ds:Reference URI="">
                      <ds:Transforms>
                         <ds:Transform Algorithm="http://www.w3.org/
2002/06/xmldsig-filter2">

                         <dsxp:XPath Filter="intersect">here()/
ancestor::ds:Signature[1]/ds:Object[sigmeta:metadata]</dsxp:XPath>
                         </ds:Transform>
                       </ds:Transforms>
                       <ds:DigestMethod Algorithm="http://www.w3.org/
2000/09/xmldsig#sha1"/>
                       <ds:DigestValue></ds:DigestValue>
                   </ds:Reference>
                 </ds:SignedInfo>
              <ds:SignatureValue></ds:SignatureValue>

              <ds:Object>
                 <sigmeta:metadata>
                    <sigmeta:timestamp>
                       <sigmeta:signtime></sigmeta:signtime>
                       <sigmeta:dst></sigmeta:dst>
                       <sigmeta:date></sigmeta:date>
                    </sigmeta:timestamp>
                    <sigmeta:signformat>
                    application/signature+xml;
                       engine="GenericRSA"
                    </sigmeta:signformat>

                 </sigmeta:metadata>
              </ds:Object>
           </ds:Signature>
         </BUTTON1>
      </PAGE1>
   </generated>
</xforms:instance>

 <xforms:submission id="saveDoc" action="data.xml" replace="none"
method="put" />
                <xforms:submission id="loadDoc" action="data.xml" replace="instance"
method="get"/>

<xforms:signature ref="ds:Signature" id="X">
<xforms:action ev:event="signature-create">
Actions to prepare dsig:Signature
</xforms:action>
<xforms:action ev:event="signature-create-done">
Actions to post-process success
</xforms:action>
<xforms:action ev:event="signature-create-error">
Actions that respond to failure
</xforms:action>

</xforms:signature>


</xforms:model>

<!-- <script language="javascript" type="text/javascript">

                        function setCertStr(cert) {
                                document.getElementById('cert_data').value = '';
                                document.getElementById('cert_data').value = cert;
                        }

                </script> -->

</head>
<body>
<p>name</p>
<xforms:input ref="test"/>

<xforms:button sid="BUTTON1">
         <xforms:trigger ref="instance('GeneratedInstance')/PAGE1/
               BUTTON1/ds:Signature/ds:SignatureValue">
            <xforms:label>Click to Sign</xforms:label>
         </xforms:trigger>
         <xforms:itemlocation>

            <below>FIELD3</below>
            <width>246</width>
         </xforms:itemlocation>
         <xforms:value compute="signer == 'INVALID' ? invalid() :
signer">
         </xforms:value>
         <xforms:type>signature</xforms:type>
         <xforms:signer></xforms:signer>

         <xforms:signformat>application/signature
+xml;engine="GenericRSA"</xforms:signformat>


      </xforms:button>
<!-- <textarea rows="6" cols="50" id="cert_data"></textarea>

       <applet code="gov.nic.keyupload.gui.KeyRegister.class"
        archive="sign.jar,plugin.jar"
        width="500" height="150" name="CertRead" id="CertRead">
        <param name="appType" value="read" />
        </applet> -->

    <xforms:submit submission="saveDoc">
                        <xforms:label>Save Doc</xforms:label>
                </xforms:submit>

                <xforms:submit submission="loadDoc">

                        <xforms:label>Load Doc</xforms:label>
                </xforms:submit>

</body>
</html>
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms