How to create a XAdES-BES Envelope

May 8, 2012 at 1:49 PM
Edited May 8, 2012 at 1:50 PM

Can anyone help me with the following:

For the project I'm working on, I need to sign some data and put in the following format:

 

<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="urn:envelope">
  <Gegevenslevering Id="idGegevenslevering">
    <!-- Resultaat bericht gegevenslevering -->
  </Gegevenslevering>
  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
    <SignedInfo>
      <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
      <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
      <Reference URI="#idGegevenslevering">
        <Transforms>
          <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
        </Transforms>
        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
        <DigestValue>
          <!-- Waarde van de digest over het element Gegevenslevering -->
        </DigestValue>
      </Reference>
      <Reference URI="#idKeyInfo">
        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
        <DigestValue>
          <!-- Waarde van de digest over het element KeyInfo -->
        </DigestValue>
      </Reference>
    </SignedInfo>
    <SignatureValue>
      <!-- Elektronische handtekening -->
    </SignatureValue>
    <KeyInfo Id="idKeyInfo">
      <X509Data>
        <X509Certificate>
          <!-- Certificaat -->
        </X509Certificate>
      </X509Data>
    </KeyInfo>
  </Signature>
</Envelope>

Can the XadesNet library help me with this? I have the data to enter between the <Gegevenslevering> tags and that's the data I need to sign. I also can grab a certificate. Do I need to do some extra work to get this specific format?

Basically what I'm looking for is a way to go from "XMLtobeSigned" -> "Output specified in example".

Any help is appreciated!