SlideShare ist ein Scribd-Unternehmen logo
1 von 71
Downloaden Sie, um offline zu lesen
XAdES Specification based on the Apache
           XMLSec Project

       Zdravko Danailov             Krassen Deltchev
Email: nqkoi_ot_bg@yahoo.com Email: Krassen.Deltchev@rub.de




                        Project thesis

                              at

             Chair for Network and Data Security
                    Prof. Dr. Jörg Schwenk

             advised through Dipl.Ing. Lijun Liao


                         22.05.2007




       Horst-Görtz Institute Ruhr-University of Bochum
Abstract
XML Advanced Electronic Signature (XAdES) provides basic authentication and integrity protection, and
satisfies the legal requirements for advanced electronic signatures.There are several implementations of
XAdES, but most of them are not OpenSource, or are partialy proprietary software. Great project concerned
with Digital Electronic Signatures is the OpenSource Apache XML Security Project. For the developer and
common user there is an implementation for the XMLDSIG specification, but still no one for XAdES.
The free source code implemetations of XAdES threat this project as a separate one and there is no interface,
which can explicit assemble them into the Apache XML Sec. That’s why, the scope of our project is to create
a library, that implements XAdES into the OpenSource Apache XML Security- to extend its functionality
and level of security, so using the Apache XML Sec, gives the opportunity to handle Advanced Electronic
Signatures, which is a standard of security nowadays.
The library is developed in Java, because shouldn’t be any kind of OS platform - dependencies, using it as a
plug-in to the Security Project of Apache.
   More detailed, to validate the signing and verifying of signatures, and also test our code, we use the text-
based test suite of JUnit.




                                                       i
Acknowledgements
We want to express our gratitude to our families and friends, who gave their moral support all the time
and contributed for the better working atmosphere.
To Dipl.Ing. Lijun Liao, we want to thank for the technical input and support.




                                                  ii
Contents

1 Introduction                                                                                                                                              1
  1.1 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                   1
  1.2 Related works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                     2

2 Background                                                                                                                                                4
  2.1 Definitions and Abbreviations . . . . . . . . . . . . .                .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   4
  2.2 XML . . . . . . . . . . . . . . . . . . . . . . . . . .               .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   5
  2.3 XML Advanced Electronic Signature Data Structures .                   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   6
      2.3.1 XML Signature . . . . . . . . . . . . . . . . .                 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   6
      2.3.2 XAdES- XML Advanced Electronic Signature                        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   8

3 XAdES Elements                                                                                                                                            10
  3.1 Overview . . . . . . . . . . . . . . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
  3.2 QualifyingProperties . . . . . . . . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   12
  3.3 SignedProperties . . . . . . . . . . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   14
  3.4 UnsignedProperties . . . . . . . . . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   16
  3.5 SignedSignatureProperties . . . . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   17
  3.6 SignedDataObjectProperties . . . . . . . . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   19
  3.7 UnsignedSignatureProperties . . . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   21
  3.8 The SigningTime element . . . . . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   23
  3.9 The SigningCertificate element . . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   24
  3.10 The SignaturePolicyIdentifier element . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   25
  3.11 The SignatureProductionPlace element . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   30
  3.12 The SignerRole element . . . . . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   31
  3.13 The DataObjectFormat element . . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   34
  3.14 The CommitmentTypeIndication element . . .           .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   37
  3.15 The AllDataObjectsTimeStamp element . . . .          .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   39
  3.16 The IndividualDataObjectsTimeStamp element           .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   40
  3.17 The CounterSignature element . . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   41

4 Datatypes                                                                                                                                                 42
  4.1 The ObjectIdentifierType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                       42
  4.2 The EncapsulatedPKIDataType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                         44
  4.3 The TimeStampType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                         45

5 Conclusion                                                                                                                                                47

6 Author’s addresses                                                                                                                                        48

7 Bibliography                                                                                                                                              49

A Appendix - XAdES                                                                                                                                           i



                                                     iii
B Appendix - XAdES-BES                      iv

C Appendix - XAdES-More then one Element    vi

D Appendix - Screenshots                    xi




                                       iv
List of Figures

 2.1    XMLDSIG Specification . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   6
 2.2    XMLDSIG example . . . . . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   7
 2.3    Advanced Electronic Signature(XAdES)       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   8
 2.4    XAdES Specification . . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   9

 3.1    QualifyingProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                           .   .   .   .   .   .   .   .   12
 3.2    Method setSignedProperties . . . . . . . . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   12
 3.3    Method setUnsignedProperties . . . . . . . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   13
 3.4    Method setTarget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                           .   .   .   .   .   .   .   .   13
 3.5    SignedProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                           .   .   .   .   .   .   .   .   14
 3.6    Methods setSignedSignatureProperties, setSignedDataObjectProperties . . .                                                  .   .   .   .   .   .   .   .   15
 3.7    UnsignedProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                           .   .   .   .   .   .   .   .   16
 3.8    Method setUnsignedSignatureProperties . . . . . . . . . . . . . . . . . . . .                                              .   .   .   .   .   .   .   .   16
 3.9    Method setUnsignedDataObjectProperties . . . . . . . . . . . . . . . . . . .                                               .   .   .   .   .   .   .   .   17
 3.10   SignedSignatureProperties . . . . . . . . . . . . . . . . . . . . . . . . . . .                                            .   .   .   .   .   .   .   .   17
 3.11   Contructor SignedSignatureProperties . . . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   19
 3.12   SignedDataObjectProperties . . . . . . . . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   20
 3.13   Methods setCommitmentTypeIndication, setDataObjectFormat . . . . . . . .                                                   .   .   .   .   .   .   .   .   20
 3.14   Methods setAllDataObjectsTimeStamp, setIndividualDataObjectsTimeStamp                                                      .   .   .   .   .   .   .   .   21
 3.15   UnsignedSignatureProperties . . . . . . . . . . . . . . . . . . . . . . . . . .                                            .   .   .   .   .   .   .   .   22
 3.16   Method setCounterSignature . . . . . . . . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   22
 3.17   SigningTime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                          .   .   .   .   .   .   .   .   23
 3.18   Constructor SigningTime . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                            .   .   .   .   .   .   .   .   23
 3.19   SigningCertificate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                          .   .   .   .   .   .   .   .   24
 3.20   Method setSigningCertificate . . . . . . . . . . . . . . . . . . . . . . . . . .                                            .   .   .   .   .   .   .   .   25
 3.21   SignaturePolicyIdentifier . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                           .   .   .   .   .   .   .   .   26
 3.22   Method setSignaturePolicyId . . . . . . . . . . . . . . . . . . . . . . . . . .                                            .   .   .   .   .   .   .   .   27
 3.23   Methods setSigPolicyId, setSigPolicyHash . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   27
 3.24   Methods setTransforms1, setSigPolicyQualifiers . . . . . . . . . . . . . . . .                                              .   .   .   .   .   .   .   .   28
 3.25   Method setSigPolicyQualifiers . . . . . . . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   29
 3.26   SignatureProductionPlace . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                           .   .   .   .   .   .   .   .   30
 3.27   Methods: setStateOrProvince, setCity . . . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   30
 3.28   Methods: setPostalCode, setCountryName . . . . . . . . . . . . . . . . . . .                                               .   .   .   .   .   .   .   .   31
 3.29   SignerRole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                           .   .   .   .   .   .   .   .   32
 3.30   Methods: setClaimedRoles, setCertifiedRoles . . . . . . . . . . . . . . . . .                                               .   .   .   .   .   .   .   .   32
 3.31   Constructor CertifiedRolesList . . . . . . . . . . . . . . . . . . . . . . . . .                                            .   .   .   .   .   .   .   .   33
 3.32   Constructor ClaimedRolesList . . . . . . . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   33
 3.33   DataObjectFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                           .   .   .   .   .   .   .   .   34
 3.34   Method setDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                            .   .   .   .   .   .   .   .   34
 3.35   Method setObjectIdentifier . . . . . . . . . . . . . . . . . . . . . . . . . . .                                            .   .   .   .   .   .   .   .   35
 3.36   Method setMimeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                             .   .   .   .   .   .   .   .   35



                                                       v
3.37   Method setEncoding . . . . . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   35
3.38   Method setObjectReference attribite . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   36
3.39   CommitmentTypeIndication . . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   37
3.40   Constructor CommitmentTypeIndication . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   38
3.41   Method setCommitmentTypeQualifier . . . .         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   38
3.42   AllDataObjectsTimeStamp . . . . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   39
3.43   Method setAllDataObjectsTimeStamp . . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   39
3.44   IndividualDataObjectsTimeStamp . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   40
3.45   Method setIndividualDataObjectsTimeStamp         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   40
3.46   CounterSignature . . . . . . . . . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   41

4.1    ObjectIdentifierType . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                    .   .   .   .   .   .   .   .   .   42
4.2    IdentifierType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                  .   .   .   .   .   .   .   .   .   42
4.3    DocumentationReferencesType . . . . . . . . . . . . . . . . . . . . . . . .                                      .   .   .   .   .   .   .   .   .   43
4.4    Methods setIdentifier, setDescription, setDocumentationReferences . . . .                                         .   .   .   .   .   .   .   .   .   43
4.5    EncapsulatedPKIDataType . . . . . . . . . . . . . . . . . . . . . . . . . .                                      .   .   .   .   .   .   .   .   .   44
4.6    Method setID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                   .   .   .   .   .   .   .   .   .   45
4.7    TimeStampType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                    .   .   .   .   .   .   .   .   .   46
4.8    Method setHashDataInfo, setEncapsulatedTimeStamp, setXMLTimeStamp                                                .   .   .   .   .   .   .   .   .   46

D.1 Screenshot - Eclipse IDE JUnit plug-in console output . . . . . . . . . . . . . . . . . . . . xii
D.2 Screenshot - Eclipse IDE console output . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii




                                                   vi
List of Tables

 2.1   Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    4
 2.2   Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .     5
 2.3   XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .       6

 A.1 XAdES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        iii

 B.1 XAdES-BES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .           v

 C.1 XAdES-More then one Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .             x




                                                    vii
1 Introduction
The XML Signature is a method of associating a key with referenced data (octets); it does not normatively
specify how keys are associated with persons or institutions, nor the meaning of the data, being referenced
and signed.
   The main goal of our project is to build a library, which extends the Apache XML Security Project, to
meet the XAdES specification, so that the user shall be able to create advanced electronic signatures and be
able to validate them.
   The XAdES (XML Advanced Electronic Signature) specification is sophisticated and there are strong
hierarchies among the different XML elements. Every one of them is discussed in separated sections of this
thesis(in chapter 3 and chapter 4), where the reader gets an overview on the XML notation, regarding every
specific XAdES element, associated with Java code samples: important constructors, variables, constants;
and at last, but not at least a pointer to the JUnit test, which verifies the right execution of the code in the
library, regarding this particular XAdES element.
   The XAdES specification is extended by the: XAdES-T, XAdES-C, XAdES-X, XAdES-X-L, XAdES-A;
we describe in this thesis only the implemented specifications in our project library of XAdES and XAdES-
BES (Basic Electronic Signature).
   We concentrate only on the creation and verification of electronic signatures, which are valid, requiring
only one signer party; therefore, neither independent (parallel signers, without ordering requirement), nor
embedded (multiple party signers with signer ordering requirement) digital signatures (such as: contracts,
signed between two parties) are described in this work, or find implementation in this version of our project.


1.1 Tools
In this section we will specify the necessary tools and mention some requirements, which are obligatory for
the use, execution and further development of this project.


     1. Tools for development:
            - Java Development Kit (at least version 1.5)1
            - IBM Eclipse IDE2
            - JUnit 3.8.1(Plug-In for Eclipse)3
     2. Tools for the common user:
            - Java Runtime Environment (at least version 1.5)4
  NOTE: We cannot test the functionality of this project and especially of our library with a lower
version of JUnit, because there are no such ones available.
 1
   http://java.sun.com/
 2
   http://www.eclipse.org/
    NOTE: you can use also the Apache Ant toolkit, instead of Eclipse-
    http://ant.apache.org/
 3
   http://www.junit.org/index.htm
 4
   http://java.sun.com/




                                                               1
1.2 Related works
At this moment, there are two projects (JDigiDoc and DContract), which are concerned with XAdES. On
one side, JDigiDoc is a framework and implementation of digital signatures. It validates the private keys of
Estonian ID Cards and Mobile ID Cards for mobile PC devices. JDigiDoc is contrived as an OpenSource.
The java project can be obtained from the website and tested with the Apache XML toolkit, but it is not
designed explicit as a library for the Apache XML Project.

   • JDigiDoc
     Veiko Sinivee
     Veiko.Sinivee@seb.se
     openxades@openxades.org
     http://www.openxades.org/


  On another side, DContract provides a toolbox for the management of digital contracts within Java.It
supports all XML Advanced Electronic Signature types (XAdES v1.3.2 2006-03): XAdES-BES, XAdES-
EPES, XAdES-T, XAdES-C, XAdES-X, XAdES-X-L. It uses PKCS12 key repository management and can
generate RSA key pairs up to 2048 bit. The DContract project is not an OpenSource.

   • DContract
     Frank Cornelis
     http://www.frankcornelis.be
     info@frankcornelis.be


  Other contributions to XAdES shall be listed as follows:

   • Baltimore Technologies
     Vivekanand Sakaram
     (vsakaram@baltimore.com)
     Project information:
     Language: Java
     probably only commercial license
     (code source can be negotiated only on individual basis)


   • Institute for Applied Information Processing and Communications (IAIK),
     Graz University of Technology
     Martin Centner
     (mcentner@iaik.tugraz.at)
     Peter Lipp
     (plipp@iaik.tugraz.at)
     Project information:
     Language: Java
     free for educational use and research (code for commercial license only)




                                                     2
• Kopint-Datorg Rt. (Kopdat)
  Balazs Andras Dohanyos
  (balazs.dohanyos@kopdat.hu)
  Project information:
  Language: C++ (compiled in VC6.0)
  contact sales( no source availability)


• Microsoft
  Eddy Rubens
  (eddyrube@microsoft.com)
  Stefan Santesson
  (stefans@microsoft.com)
  Project information:
  Language: C#
  free library( code availability - yes)


• Universitat Politecnica de Catalunya (UPC)
  Joan Arnedo (joanar@ac.upc.es)
  Juan Carlos Cruellas (cruellas@ac.upc.es)
  Project information:
  Language: Java
  probably commercial licence( no source availability)


• Agencia Catalana de Certificacio [CATCert]
  Marta Cruellas
  (mcruellas@catcert.net)
  Project information:
  no furthur information




                                                3
2 Background
For the better understanding of this thesis and the goal of our library, we shall specify some basic terms and
expound the essence of the main ‘Building Blocks’.


2.1 Definitions and Abbreviations
For the purposes of the current work, the following terms and definitions apply:

  Term                                         Definition
  Arbitrator                                   entity that arbitrates in disputes between a signer and a
                                               verifier
  Attributes Authorities                       provide users with attributes linked to public key certifi-
                                               cates
  Certification Authorities                     provide users with public key certificates
  Registration Authorities                     allow the identification and registration of entities before
                                               a CA generates certificates

  Repository Authorities                       publish CRLs issued by CAs, signature policies issued by
                                               signature policy issuers and optionally public key certifi-
                                               cates
  Signature Policy Issuers                     define the technical and procedural requirements for elec-
                                               tronic signature creation and validation, in order to meet a
                                               particular business need

  Signer                                       entity that creates the electronic signature
  Time-Stamping Authorities                    attest that some data object was formed before a given
                                               trusted time
  Time-Marking Authorities                     record that some data was formed before a given trusted
                                               time
  Trusted Service Providers                    one or more entities that help to build trust relationships
                                               between the signer and verifier
  Verifier                                      entity that verifies the electronic signature

                                           Table 2.1: Definitions




                                                      4
Term                                    Abbreviation
                Attribute Certificate                    AC
                Certification Authority                  CA
                Cryptographic Message Syntax            CMS
                Certificate Revocation List              CRL
                Document Type Definition                 DTD
                Electronic Signature                    ES
                Hyper Text Transfer Protocol            HTTP
                Online Certificate Status Protocol       OCSP
                Object IDentifier                        OID
                Public Key Certificate                   PKC
                Time-Stamping Authorities               TSA
                Trusted Service Providers               TSP
                Time Stamping Unit                      TSU
                Uniform Resource Identifier              URI
                Uniform Resource Name                   URN
                XML Advanced Electronic Signature       XAdES
                XAdES Archiving validation data         XAdES-A
                XAdES Basic Electronic Signature        XAdES-BES
                XAdES Complete validation data          XAdES-C
                XAdES Explicit Policy based Elec-       XAdES-EPES
                tronic Signature
                XAdES with Time-stamp                   XAdES-T
                XAdES eXtended validation data          XAdES-X
                eXtensible Markup Language              XML
                eXtensible Markup Language Digital      XMLDSIG
                SIGnature
                eXtensible Stylesheet Language          XSL
                eXtensible Stylesheet Language          XSLT
                Transformations

                                        Table 2.2: Abbreviations



2.2 XML
As mentioned above XML [XML][XML-schema-part-1][XML-schema-part-2] is the abbreviation for eX-
tensible Markup Language. Its main purpose is to facilitate the sharing of data across different informa-
tion systems, particularly via the Internet. By adding semantic constraints, application languages such as
XHTML, RSS, MathML, GraphML, Scalable Vector Graphics, can be implemented in XML. Moreover,
XML is sometimes used as the specification language for such application languages.
   XML is recommended by the World Wide Web Consortium (W3C). It is a fee-free open standard. The
W3C recommendation specifies both the lexical grammar, and the requirements for parsing.




                                                    5
eXtensible Markup Language
            File extension                       .xml
            Uniform Type                         public.xml
            MIME type                            application/xml, text/xml (deprecated)
            Developed by                         World Wide Web Consortium

            Type of format                        Markup language

            Extended from                         SGML

            Extended to                           XHTML, RSS, Atom, ...

            Standard(s)                           1.0 (Fourth Edition) 1.1 (Second Edition)

                                              Table 2.3: XML




2.3 XML Advanced Electronic Signature Data Structures
2.3.1 XML Signature
This section provides an overview and examples of XML digital signature syntax. An informal representa-
tion and examples are used to describe the structure of the XML signature syntax. This representation and
examples may omit attributes, details and potential features that are explained later.
   XML Signatures are applied to arbitrary digital content (data objects) via an indirection. Data objects are
digested, the resulting value is placed in an element with other information and that element is then digested
and cryptographically signed. XML digital signatures are represented by the Signature element which has
the following structure:

                                              XMLDSIG
< d s : S i g n a t u r e ID ? >− − − − − − − − −+− − − − −+
   <ds:SignedInfo>                               |         |
        <ds:CanonicalizationMethod />            |         |
        <ds:SignatureMethod / >                  |         |
        ( < d s : R e f e r e n c e URI? >       |         |
            (<ds:Transforms>)?                   |         |
            <ds:DigestMethod>                    |         |
            <ds:DigestValue>                     |         |
        < / d s : R e f e r e n c e >)+          |         |
   </ ds:SignedInfo>                             |         |
   <ds:SignatureValue>                           |         |
   ( < d s : K e y I n f o >)?− − − − − − − − − +          |
   <ds:Object>                                             |
< d s : S i g n a t u r e >− − − − − − − − − − − − − − − −+


                                    Figure 2.1: XMLDSIG Specification




                                                      6
Signatures are related to data objects via URIs. Within an XML document, signatures are related to local
data objects via fragment identifiers. Such local data can be included within an enveloping signature or
can enclose an enveloped signature. Detached signatures are over external network resources or local data
objects that reside within the same XML document as sibling elements; in this case, the signature is neither
enveloping (signature is parent) nor enveloped attribute (signature is child). Since a Signature element (and
its Id value/name) may co-exist or be combined with other elements (and their IDs) within a single XML
document, care should be taken in choosing names such that there are no subsequent collisions that violate
the ID uniqueness validity constraint.
   The following example is a detached signature of the content of the HTML4.01 in XML specification.


< n d s : R o o t E l e m e n t x m l n s : n d s = " h t t p : / / www. n d s . r u b . de / x a d e s " >
    < n d s : A I −NDS−HGI I d = " AI−NDS−HGI−18378667 " >Some s i m p l e t e x t < / n d s : A I −NDS−HGI>
    < S i g n a t u r e xmlns = " h t t p : / / www. w3 . o r g / 2 0 0 0 / 0 9 / x m l d s i g # " I d = " S i g n a t u r e I d " >
        <SignedInfo>
        <CanonicalizationMethod
        A l g o r i t h m = " h t t p : / / www. w3 . o r g / TR / 2 0 0 1 / REC−xml−c14n −20010315 " / >
        < S i g n a t u r e M e t h o d A l g o r i t h m = " h t t p : / / www. w3 . o r g / 2 0 0 0 / 0 9 / x m l d s i g # dsa−s h a 1 " / >
            < R e f e r e n c e URI= " #AI−NDS−HGI−18378667 " >
                <Transforms>
                     < T r a n s f o r m A l g o r i t h m = " h t t p : / / www. w3 . o r g / 2 0 0 1 / 1 0 / xml−exc−c14n # " / >
                < / Transforms>
                < D i g e s t M e t h o d A l g o r i t h m = " h t t p : / / www. w3 . o r g / 2 0 0 0 / 0 9 / x m l d s i g # s h a 1 " / >
                < D i g e s t V a l u e >+e0UhqPaZkX7+5 x V r b g 5 0 I T c h 2 I =< / D i g e s t V a l u e >
            </ Reference>
            +< R e f e r e n c e URI= " # S i g n e d P r o p e r t i e s −11626165 " >< / R e f e r e n c e >
            +< R e f e r e n c e URI= " # U n s i g n e d P r o p e r t i e s −25392791 " >< / R e f e r e n c e >
    </ SignedInfo>
    < S i g n a t u r e V a l u e >SVlS9m97Q0t12pi . . . . . < / S i g n a t u r e V a l u e >
    <KeyInfo>
        <X509Data >
            < X 5 0 9 C e r t i f i c a t e >MIIC3DCCApoCBEY1 . . . . . < / X 5 0 9 C e r t i f i c a t e >
        < / X509Data >
        <KeyValue >
            <DSAKeyValue>
                <P> / X9TgR11EilS30qcLuz . . . . . < / P>
                <Q>l2BQjxUjC8yykrmCouuEC /BYHPU=< / Q>
                <G>9+ GghdabPd7LvKtc . . . . . < / G>
                <Y>OglcRuqvCSTioZQ . . . . . < / Y>
            < / DSAKeyValue>
        < / KeyValue >
    < / KeyInfo>
    +< O b j e c t >< / O b j e c t >
    </ Signature>
< / nds:RootElement>


                                                  Figure 2.2: XMLDSIG example



  The required SignedInfo element is the information that is actually signed. Core validation of SignedInfo
consists of two mandatory processes: validation of the signature over SignedInfo and validation of each



                                                                      7
Reference digest within SignedInfo. Note that the algorithms used in calculating the SignatureValue are
also included in the signed information while the SignatureValue element is outside SignedInfo.
    The CanonicalizationMethod is the algorithm that is used to canonicalize the SignedInfo element before
it is digested as part of the signature operation. Note that the example in Figure 2.2 , as well as all examples
in this specification, are not in canonical form.

2.3.2 XAdES- XML Advanced Electronic Signature
An XML Advanced Electronic Signature [XAdES][ESI-XAdES] is illustrated in Figure 2.3 .




                            Figure 2.3: Advanced Electronic Signature(XAdES)


   The XML Advanced Electronic Signature (XAdES)- its format is the one defined in [XMLDSIG] with
the addition of signed properties (SigningTime, SigningCertificate, SignaturePolicyIdentifier, SignaturePro-
ductionPlace, SignerRole, AllDataObjectsTimeStamp, IndividualDataObjectsTimeStamp, DataObjectFor-
mat and CommitmentTypeIndication) and unsigned properties (CounterSignature) (where "?" denotes zero
or one occurrence; "+" denotes one or more occurrences; and "*" denotes zero or more occurrences):




                                                       8
XMLDSIG
                                                 |
< d s : S i g n a t u r e ID ? >− − − − − − − − −+− − − − −+
    <ds:SignedInfo>                              |         |
        <ds:CanonicalizationMethod />            |         |
        <ds:SignatureMethod / >                  |         |
        ( < d s : R e f e r e n c e URI? >       |         |
            (<ds:Transforms>)?                   |         |
            <ds:DigestMethod>                    |         |
            <ds:DigestValue>                     |         |
        < / d s : R e f e r e n c e >)+          |         |
    </ ds:SignedInfo>                            |         |
    <ds:SignatureValue>                          |         |
    ( < d s : K e y I n f o >)?− − − − − − − − − +         |
                                                           |
    <ds:Object>                                            |
                                                           |
        <QualifyingProperties>                             |
                                                           |
            <SignedProperties>                             |
                                                           |
                <SignedSignatureProperties>                |
                    ( SigningTime )                        |
                    ( SigningCertificate )                 |
                    ( SignaturePolicyIdentifier )          |
                    ( SignatureProductionPlace )?          |
                    ( SignerRole )?                        |
                </ SignedSignatureProperties>              |
                                                           |
                <SignedDataObjectProperties>               |
                    ( DataObjectFormat )∗                  |
                    ( CommitmentTypeIndication )∗          |
                    ( AllDataObjectsTimeStamp )∗           |
                    ( IndividualDataObjectsTimeStamp )∗    |
                </ SignedDataObjectProperties>             |
                                                           |
            </ SignedProperties>                           |
                                                           |
            <UnsignedProperties>                           |
                                                           |
                <UnsignedSignatureProperties>              |
                    ( CounterSignature )∗                  |
                </ UnsignedSignatureProperties>            |
                                                           |
            </ UnsignedProperties>                         |
                                                           |
        </ QualifyingProperties>                           |
                                                           |
    </ ds:Object>                                          |
                                                           |
< / d s : S i g n a t u r e >− − − − − − − − − − − − − − − +
                                                           |
                                                        XAdES


                                   Figure 2.4: XAdES Specification


                                                  9
3 XAdES Elements
3.1 Overview
The reader shall understand that, there are several requirements for the sake of the proper run of the project
library. The original OpenSource Apache XML Security Project can be found at:
http://santuario.apache.org/Java/index.html , where the developer can find the source and binary packages (
http://xml.apache.org/security/dist/ ) and important installation notes(
http://santuario.apache.org/Java/installation.html) Our project library is tested on the former version of the
Apache XMLSec Project- v1.3.0. Furthermore, the Apache Project is created as an ’Eclipse Java Project’
and we use Sun JDK 1.5.0_11. For the reader concerned, regarding the implementation of the Project, using
JDK 1.4.x (only Windows NT 4.0 and old Unix-based distributions with kernel 2.4.x) please refer to the
installation site of the project. The developer must be aware of the following facts:
   • Copy all files from ’xml-security-bin-1_3_0/xml-security-1_3_0/libs’ to the ’xml-security-src-1_3_0/
     xml-security-1_3_0/libs’, so the Apache XMLSec Project( xml-security-src-1_3_0) can be loaded as
     a standard Eclipse Java Project and properly run,
   • In the new Eclipse Java Project load the JUnit 3.8.1 library, so the XAdES JUnit tests can be executed.
  We didn’t test our project library with the current version of JUnit namely version 4.1.
  We decided to separate the XAdES library package (.../xml-security-src-1_3_0/xml-security-src-1_3_0/
xml-security-1_3_0/src-xades/ ) in the following sub-packages:
   • ’.../input/ ’- where the Java Keystore data is specified;
   • ’.../doc/’- where the JavaDoc shall be found,
   • ’.../org/apache/xml/security/xades/ ’- where the user can find the source code of our XAdES library;
     the following Java classes are important for the discussion in this introduction to the thesis:
         – QualifyingProperties- the fundamental XAdES element, which embeds all qualifying
           properties of an Advanced XML Signature; The QualifyingProperties is a child element
           of Object (one of the four base XAdES elements-’SignedInfo’, ’SignatureValue’,
           ’KeyInfo’ and ’Object’); if we regret the use of the Object element, then an Advanced
           Electronic Signature cannot be built, because the other sub-elements: ’SignedInfo’,
           ’SignatureValue’, ’KeyInfo’ in their selves do not fulfill completely the XAdES specifi-
           cation ,
         – Constants- all used constants for the different types of elements/attributes, namespaces, al-
           gorithms’ descriptions are defined,
   • ’.../org/apache/xml/security/xades/sp’- the SignedProperties XAdES element and its sub-
     elements ( conform to the XMLDSIG notation) are specified,
   • ’.../org/apache/xml/security/xades/up’- the user shall find all the classes, which describe the basic
     child-element UnsignedProperties( of the QualifyingProperties) and its sub-elements,
     which are optional( see further)



                                                     10
• ’.../org/apache/xml/security/xades/tests’- where we have specified all Signature-creation tests and the
     JUnit tests:
        – The class CreateSignatureSDOPalland- every single element of the XAdES notation is
          created, so the XML notation of XAdES is fully described. The output is can be found in : /xml-
          security-src-1_3_0/xml-security-1_3_0/signature.xml (see Appendix A - XAdES specification)
        – The class CreateSignatureSignedSignatureProperties- where the
          XAdES-BES specification is implemented:
          the basic child-element of QualifyingProperties- SignedProperties, with its sub-
          element:
          SignedSignatureProperties, further its child-elements: SigningTime,
          SigningCertificate, SignaturePolicyIdentifier, which are all
          required elements in the XAdES notation. The output is illustrated in : /xml-security-src-
          1_3_0/xml-security-1_3_0/signature1.xml (see Appendix B- XAdES-BES)
        – The class CreateSignatureMoreThanOneElements- according to the XAdES specifi-
          cation, XML elements, which can occur min. ’0’ and max. ’unbounded’, e.g. more than one el-
          ements from the same type are allowed to exist, are demonstrated for their multiple use. The out-
          put for this case is represented due : /xml-security-src-1_3_0/xml-security-1_3_0/signature2.xml
          (see Appendix C- XAdES More than one element)
        – The class JUtests- where we specify the different JUnit tests on our library, separated in two
          general sections:

   • positive tests- which illustrate the verification of the first three classes(
     CreateSignatureSDOPalland,CreateSignatureSignedSignatureProper-
     ties, CreateSignatureMoreThanOneElements)

   • negative tests- which verify the right implementation of all required elements of the XAdES notation
     in the project library (refer to the separate explanation on every test in the further sections of the
     thesis); if the library is able to create the signature without using a required element, nor giving an
     IllegalArgumentException the particular negative test shall fail.

  Now let’s concentrate more detailed on every one XML element of the XAdES notation with its specific
use, structure and its implementation in the project library.




                                                    11
3.2 QualifyingProperties
     The basic element of Object is the QualifyingProperties element, which contains the whole qual-
     ifying information for the Advanced Electronic Signature. This element has the following structure:

     < x s d : e l e m e n t name= " Q u a l i f y i n g P r o p e r t i e s "
     type =" Q u a l i f y i n g P r o p e r t i e s T y p e " / >
     < x s d : c o m p l e x T y p e name= " Q u a l i f y i n g P r o p e r t i e s T y p e " >
         <xsd:sequence>
             < x s d : e l e m e n t name= " S i g n e d P r o p e r t i e s " t y p e = " S i g n e d P r o p e r t i e s T y p e "
                  minOccurs=" 0 " / >
             < x s d : e l e m e n t name= " U n s i g n e d P r o p e r t i e s " t y p e = " U n s i g n e d P r o p e r t i e s T y p e "
                  minOccurs=" 0 " / >
         </ xsd:sequence>
         < x s d : a t t r i b u t e name= " T a r g e t " t y p e = " x s d : a n y U R I " u s e = " r e q u i r e d " / >
         < x s d : a t t r i b u t e name= " I d " t y p e = " x s d : I D " u s e = " o p t i o n a l " / >
     < / xsd:complexType>


                                                                   Figure 3.1: QualifyingProperties



        The QualifyingProperties element is extended by its two general sub-elements - the
     SignedProperties and the UnsignedProperties. The main function of the
     SignedProperties is to contribute to the cryptographic justification of the XML signature, while the
     UnsignedProperties is required, generally for an embracement of all variations of the XAdES nota-
     tion (XAdES, XAdES-T, XAdES-C, XAdES-X, XAdES-A1 and to illustrate all kind of different cases by
     creating Advanced Electronic signature: single signer - one signature; parallel signer without requirement
     of ordering for signing the sensitive data, multiple signer with ordering by signing the electronic document .
        The SignedProperties must be protected by a Reference element in SignedInfo and must ap-
     pear only once within the QualifyingProperties.The Target attribute is required and it’s used
     as a reference to the XML signature, and the optional Id attribute references to the container of the
     QualifyingProperties element.


 1   /∗∗
 2   ∗ Method s e t S i g n e d P r o p e r t i e s
 3   ∗
 4   ∗ @param s p
 5   ∗/
 6   public void s e t S i g n e d P r o p e r t i e s ( S i g n e d P r o p e r t i e s sp ) {
 7      i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( s p ! = n u l l ) )
 8      {
 9         t h i s . _ c o n s t r u c t i o n E l e m e n t . appendChild ( sp . getElement ( ) ) ;
10         XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
11      }
12   }



                                                             Figure 3.2: Method setSignedProperties



       1
           http://www.w3.org/TR/XAdES/




                                                                                             12
1   /∗∗
 2     ∗
 3     ∗ Method s e t U n s i g n e d P r o p e r t i e s
 4     ∗
 5     ∗ @param u s p
 6     ∗/
 7   publ ic void s e t U n s i g n e d P r o p e r t i e s ( U n s i g n e d P r o p e r t i e s usp )
 8   {    if
 9        ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( u s p ! = n u l l ) )
10        {
11                t h i s . _ c o n s t r u c t i o n E l e m e n t . appendChild ( usp . getElement ( ) ) ;
12               XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
13        }
14   }



                                                         Figure 3.3: Method setUnsignedProperties




        The two child-elements - SignedProperties and UnsignedProperties, are created using a
     set-Method. Because of their occurrence, it is necessary to define the conditions:

         1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode"
            ((this._state == MODE_SIGN));

         2. And also, whether the XML-element (SignedProperties,UnsignedProperties) is not an
            empty one((sp != null)or (usp != null));

       If any one of these both statements is not fulfilled, no child-element of QualifyingProperties
     would be created.

 1
 2   /∗∗
 3     ∗ S e t s t h e <code >T a r g e t </ code > a t t r i b u t e
 4     ∗
 5     ∗ @param T a r g e t ( anyURI )
 6     ∗ @throws I l l e g a l A r g u m e n t E x c e p t i o n ∗∗∗∗ b e c a u s e o f " u s e= r e q u i r e d " ∗∗∗∗
 7     ∗/
 8        public void s e t T a r g e t ( S t r i n g Target ) {
 9                i f ( T a r g e t == n u l l ) { throw new
10                IllegalArgumentException ( " Target Attibute is required ! " ) ;
11                }
12        e l s e i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( T a r g e t ! = n u l l ) ) {
13        this . _constructionElement . setAttributeNS
14        ( n u l l , C o n s t a n t s . _ATT_TARGET , T a r g e t ) ;
15                }
16        }



                                                                    Figure 3.4: Method setTarget




                                                                                          13
The Target Attribute, as we already mentioned above, is a required one. Within a set-Method two
    general cases are tested:

        1. First of all, whether this attribute is an empty one (which is forbidden), so an IllegalArgumentExcep-
           tion should be executed with the relevant message.


1      i f ( T a r g e t == n u l l } ) {
2         throw b f new I l l e g a l A r g u m e n t E x c e p t i o n ( " T a r g e t A t t i b u t e i s
3         required ! " );
4      }




        2. Second of all, whether the present state of the signature-creation is -"Signing Mode"((this._state ==
           MODE_SIGN)), and whether the attribute is not an empty one((Target != null));

      At the end, we shall mention this requirement of the Target attribute, as a test-case (JUnit test), which is
    implemented in our project library as a JUnit negative test ("testNeg_QP_Target_required"), refers to class
    JUtests in the package org.apache.xml.security.xades.tests.


    3.3 SignedProperties
    The SignedProperties has two elements - SignedSignatureProperties and
    SignedDataObjectProperties. The SignedSignatureProperties element is required and
    must occur only once within the SignedProperties.
       The other sub-element of the SignedProperties, SignedDataObjectProperties, is optional
    and contains elements that can appear one or more than once in the XML signature, which is good illustrated
    in our JUnit tests.
       The schema definition of SignedProperties element as it follows:


    < x s d : e l e m e n t name= " S i g n e d P r o p e r t i e s " t y p e = " S i g n e d P r o p e r t i e s T y p e " / >
    < x s d : c o m p l e x T y p e name= " S i g n e d P r o p e r t i e s T y p e " >
        <xsd:sequence>
            < x s d : e l e m e n t name= " S i g n e d S i g n a t u r e P r o p e r t i e s "
                 type =" S i g n e d S i g n a t u r e P r o p e r t i e s T y p e " / >
                < x s d : e l e m e n t name= " S i g n e d D a t a O b j e c t P r o p e r t i e s "
                    t y p e =" S i g n e d D a t a O b j e c t P r o p e r t i e s T y p e " minOccurs=" 0 " / >
        </ xsd:sequence>
        < x s d : a t t r i b u t e name= " I d " t y p e = " x s d : I D " u s e = " o p t i o n a l " / >
    < / xsd:complexType>


                                                               Figure 3.5: SignedProperties




                                                                                   14
1   /∗∗
 2     ∗ Method s e t S i g n e d S i g n a t u r e P r o p e r t i e s
 3     ∗
 4     ∗ @param s s p
 5     ∗/
 6        public void s e t S i g n e d S i g n a t u r e P r o p e r t i e s ( S i g n e d S i g n a t u r e P r o p e r t i e s ssp ) {
 7            i f ( s s p == n u l l ) {
 8            throw new I l l e g a l A r g u m e n t E x c e p t i o n (
 9                    " S i g n e d S i g n a t u r e P r o p e r t i e s Element i s r e q u i r e d ! " ) ;
10            }
11            e l s e i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( s s p ! = n u l l ) ) {
12            t h i s . _constructionElement . appendChild ( ssp . getElement ( ) ) ;
13            XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
14            }
15        }
16
17   /∗∗
18     ∗ Method s e t S i g n e d D a t a O b j e c t P r o p e r t i e s
19     ∗
20     ∗ @param s d o p
21     ∗/
22        p u b l i c void s e t S i g n e d D a t a O b j e c t P r o p e r t i e s ( S i g n e d D a t a O b j e c t P r o p e r t i e s sdop ) {
23                i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( s d o p ! = n u l l ) ) {
24                t h i s . _ c o n s t r u c t i o n E l e m e n t . appendChild ( sdop . getElement ( ) ) ;
25               XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
26               }
27        }



                        Figure 3.6: Methods setSignedSignatureProperties, setSignedDataObjectProperties




     The two child-elements - SignedSignatureProperties and
     SignedDataObjectProperties, are created using a set-Method. Because of their different way of
     occurrence, it is necessary to define the following conditions:

         1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode"
            ((this._state == MODE_SIGN));

         2. And also, whether the XML-element (SignedSignatureProperties,
            SignedDataObjectProperties) is not an empty one((ssp != null)or (sdop != null));

     If any one of these both statements is not fulfilled, no child-element of SignedProperties would be
     created. By the SignedSignatureProperties element we use the JUnit test to demonstrate the
     obligatorily occurrence, with other words: if this element is an empty one, an IllegalArgumentException
     should be executed with the relevant message.


 1      i f ( s s p == n u l l } {
 2         throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g n e d S i g n a t u r e P r o p e r t i e s E l e m e n t i s
 3         required ! " );
 4      }




     Refers to the negative JUnit test testNeg_SignedSignatureProperties in
     org.apache.xml.security.xades.tests.JUtests.



                                                                                         15
3.4 UnsignedProperties
     The UnsignedProperties element and its sub-elements are not signed by the [XMLDSIG] signature.
     They are divided on *SignatureProperties and *DataObjectProperties just like the
     SignedProperties.


     < x s d : e l e m e n t name= " U n s i g n e d P r o p e r t i e s " t y p e = " U n s i g n e d P r o p e r t i e s T y p e " / >
     < x s d : c o m p l e x T y p e name= " U n s i g n e d P r o p e r t i e s T y p e " >
             <xsd:sequence>
                 < x s d : e l e m e n t name= " U n s i g n e d S i g n a t u r e P r o p e r t i e s "
                     t y p e =" U n s i g n e d S i g n a t u r e P r o p e r t i e s T y p e " minOccurs=" 0 " / >
                     < x s d : e l e m e n t name= " U n s i g n e d D a t a O b j e c t P r o p e r t i e s "
                          t y p e =" U n s i g n e d D a t a O b j e c t P r o p e r t i e s T y p e " minOccurs=" 0 " / >
             </ xsd:sequence>
             < x s d : a t t r i b u t e name= " I d " t y p e = " x s d : I D " u s e = " o p t i o n a l " / >
     < / xsd:complexType>


                                                               Figure 3.7: UnsignedProperties



        In this case we can make a reference to the UnsignedProperties element using the optional Id
     attribute.
     The two child-elements - UnsignedSignatureProperties and
     UnsignedDataObjectProperties, are created using a set-Method. Because of their occurrence, it
     is necessary to define the following conditions:

         1. It should not be proved, whether the present state of the signature’ creation is -"Signing Mode"
            ((this._state == MODE_SIGN)), because the UnsignedProperties element consists of "chil-
            dren", that are not signed by the XMLDSIG signature;

         2. So it appears only one condition to be proved, whether the XML-element
            (UnsignedSignatureProperties, UnsignedDataObjectProperties) is not an empty
            one((ussp != null)or (usdop != null));



 1   /∗∗
 2     ∗ Method s e t U n s i g n e d S i g n a t u r e P r o p e r t i e s
 3     ∗
 4     ∗ @param u s s p
 5     ∗/
 6        public void s e t U n s i g n e d S i g n a t u r e P r o p e r t i e s ( U n s i g n e d S i g n a t u r e P r o p e r t i e s ussp ) {
 7            i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( u s s p ! = n u l l ) ) {
 8              t h i s . _constructionElement . appendChild ( ussp . getElement ( ) ) ;
 9              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
10            }
11        }



                                               Figure 3.8: Method setUnsignedSignatureProperties




                                                                                      16
1   /∗∗
 2     ∗ Method s e t U n s i g n e d D a t a O b j e c t P r o p e r t i e s
 3     ∗
 4     ∗ @param u s d o p
 5     ∗/
 6        p u b l i c void s e t U n s i g n e d D a t a O b j e c t P r o p e r t i e s ( U n s i g n e d D a t a O b j e c t P r o p e r t i e s usdop ) {
 7                i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( u s s p ! = n u l l ) ) {
 8                  t h i s . _ c o n s t r u c t i o n E l e m e n t . appendChild ( usdop . get El eme nt ( ) ) ;
 9                  XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
10               }
11        }



                                               Figure 3.9: Method setUnsignedDataObjectProperties




       If the statement mentioned above, is not fulfilled, no child-element of UnsignedProperties would
     be created.


     3.5 SignedSignatureProperties
     The SignedSignatureProperties has three required Elements (SigningTime,
     SigningCertificate, SignaturePolicyIdentifier) and two optional ones
     (SignatureProductionPlace, SignerRole).The XAdES-BES specification is applied through the
     SigningTime, SigningCertificate, SignaturePolicyIdentifier elements.



     < x s d : e l e m e n t name= " S i g n e d S i g n a t u r e P r o p e r t i e s "
     type =" S i g n e d S i g n a t u r e P r o p e r t i e s T y p e " / >
     < x s d : c o m p l e x T y p e name= " S i g n e d S i g n a t u r e P r o p e r t i e s T y p e " >
         <xsd:sequence>
             < x s d : e l e m e n t name= " S i g n i n g T i m e " t y p e = " x s d : d a t e T i m e " / >
             < x s d : e l e m e n t name= " S i g n i n g C e r t i f i c a t e " t y p e = " C e r t I D L i s t T y p e " / >
             < x s d : e l e m e n t name= " S i g n a t u r e P o l i c y I d e n t i f e r "
                type =" S i g n a t u r e P o l i c y I d e n t i f i e r T y p e " / >
             < x s d : e l e m e n t name= " S i g n a t u r e P r o d u c t i o n P l a c e "
             t y p e =" S i g n a t u r e P r o d u c t i o n P l a c e T y p e " minOccurs=" 0 " / >
             < x s d : e l e m e n t name= " S i g n e r R o l e " t y p e = " S i g n e r R o l e T y p e " m i n O c c u r s = " 0 " / >
         </ xsd:sequence>
     < / xsd:complexType>


                                                           Figure 3.10: SignedSignatureProperties



        The child-elements of the SignedSignatureProperties are added, using a constructor. As men-
     tioned above, the SigningTime, SigningCertificate and
     SignaturePolicyIdentifier elements are required. Thorough, their occurrence is tested: if one
     of these obligatory elements is missing, an IllegalArgumentException should be executed with the relevant
     message:




                                                                                        17
1     i f ( s i g n i n g t i m e == n u l l } | | ( s i g n i n g c e r t i f i c a t e == n u l l } | | (
2     s i g n a t u r e p o l i c y i d e n t i f i e r == n u l l )
3     {
4         throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " Wrong E l e m e n t V a l u e ! " ) ;
5     }




       Refers to the negative JUnit tests testNeg_SigningTime, testNeg_SigningCertificate and
    testNeg_SignaturePolicyIdentifier and to the positive JUnit test
    testPositive_SignedSignatureProperties_Elements_required in
    org.apache.xml.security.xades.tests.JUtests.
       The same statements are used to prove that the present phase of signature’ creation is -"Signing Mode"
    ((this._state == MODE_SIGN)), and the XML-element (SigningTime, SigningCertificate and
    SignaturePolicyIdentifier) is not an empty one((signingtime!= null)or (signingcertificate!= null))
    or ((signaturepolicyidentifier!= null)).Likewise, for the other two elements the tested conditions are, whether
    the present state of the signature’ creation is -"Signing Mode"
    ((this._state == MODE_SIGN)), and also whether the XML-element (
    SignatureProductionPlace, SignerRole) is not an empty one
    ((signatureproductionplace! = null) or (signerrole! = null));




                                                                                   18
1   /∗∗
 2     ∗ Constructor SignedSignatureProperties
 3     ∗
 4     ∗ @param doc
 5     ∗ @param s i g n i n g t i m e S i g n i n g T i m e
 6     ∗ @param s i g n i n g c e r t i f i c a t e S i g n i n g C e r t i f i c a t e
 7     ∗ @param s i g n a t u r e p o l i c y i d e n t i f i e r S i g n a t u r e P o l i c y I d e n t i f i e r
 8     ∗ @param s i g n a t u r e p r o d u c t i o n p l a c e S i g n a t u r e P r o d u c t i o n P l a c e
 9     ∗ @param s i g n e r r o l e S i g n e r R o l e
10     ∗/
11        p u b l i c S i g n e d S i g n a t u r e P r o p e r t i e s ( Document doc , S i g n i n g T i m e s i g n i n g t i m e ,
12   SigningCertificate signingcertificate , SignaturePolicyIdentifier
13   signaturepolicyidentifier , SignatureProductionPlace
14   signatureproductionplace , SignerRole s i g n e r r o l e ) {
15        s u p e r ( doc ) ;
16        i f ( s i g n i n g t i m e == n u l l | | s i g n i n g c e r t i f i c a t e == n u l l | |
17                s i g n a t u r e p o l i c y i d e n t i f i e r == n u l l )
18                throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " Wrong E l e m e n t V a l u e ! " ) ;
19
20           t h i s . _constructionElement . appendChild ( signingtime . getElement ( ) ) ;
21           XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
22
23           t h i s . _constructionElement . appendChild ( s i g n i n g c e r t i f i c a t e . getElement ( ) ) ;
24           XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
25
26           t h i s . _constructionElement . appendChild ( s i g n a t u r e p o l i c y i d e n t i f i e r . getElement ( ) ) ;
27           XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
28
29         i f ( ( s i g n a t u r e p r o d u c t i o n p l a c e != n u l l ) {
30             t h i s . _constructionElement . appendChild ( s i g n a t u r e p r o d u c t i o n p l a c e . getElement ( ) ) ;
31             XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
32         }
33         i f ( s i g n e r r o l e != n u l l ) {
34           t h i s . _constructionElement . appendChild ( s i g n e r r o l e . getElement ( ) ) ;
35           XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
36         }
37   }



                                                 Figure 3.11: Contructor SignedSignatureProperties




     3.6 SignedDataObjectProperties
     SignedDataObjectProperties contains sub- elements that qualify some of the signed data objects.
     DataObjectFormat, CommitmentTypeIndication,
     AllDataObjectsTimeStamp, IndividualDataObjectsTimeStamp can occur more than once
     within the SignedDataObjectProperties elements.



     All these properties qualify the signed data object after all the required transforms have been made.




                                                                                       19
< x s d : e l e m e n t name= " S i g n e d D a t a O b j e c t P r o p e r t i e s "
     type =" SignedDataObjectPropertiesType " / >
     < x s d : c o m p l e x T y p e name= " S i g n e d D a t a O b j e c t P r o p e r t i e s T y p e " >
         <xsd:sequence>
             < x s d : e l e m e n t name= " D a t a O b j e c t F o r m a t " t y p e = " D a t a O b j e c t F o r m a t T y p e "
                  m i n O c c u r s = " 0 " maxOccurs = " unbounded " / >
             < x s d : e l e m e n t name= " C o m m i t m e n t T y p e I n d i c a t i o n "
                  t y p e =" CommitmentTypeIndicationType " minOccurs=" 0 "
                  maxOccurs = " unbounded " / >
             < x s d : e l e m e n t name= " A l l D a t a O b j e c t s T i m e S t a m p " t y p e = " TimeStampType "
                  m i n O c c u r s = " 0 " maxOccurs = " unbounded " / >
             < x s d : e l e m e n t name= " I n d i v i d u a l D a t a O b j e c t s T i m e S t a m p " t y p e = " TimeStampType "
                  m i n O c c u r s = " 0 " maxOccurs = " unbounded " / >
         </ xsd:sequence>
     < / xsd:complexType>


                                               Figure 3.12: SignedDataObjectProperties




 1   /∗∗
 2     ∗ Method s e t D a t a O b j e c t F o r m a t
 3     ∗
 4     ∗ @param d a t a o b j e c t f o r m a t
 5     ∗/
 6        public void setDataObjectFormat ( DataObjectFormat d a t a o b j e c t f o r m a t ) {
 7            i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( d a t a o b j e c t f o r m a t ! = n u l l ) ) {
 8              t h i s . _constructionElement . appendChild ( d a t a o b j e c t f o r m a t . getElement ( ) ) ;
 9              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
10            }
11        }
12   /∗∗
13     ∗ Method s e t C o m m i t m e n t T y p e I n d i c a t i o n
14     ∗
15     ∗ @param c o m m i t m e n t t y p e i n d i c a t i o n
16     ∗/
17        public void setCommitmentTypeIndication ( CommitmentTypeIndication
18   commitmenttypeindication ) {
19            i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( c o m m i t m e n t t y p e i n d i c a t i o n ! = n u l l ) ) {
20              t h i s . _constructionElement . appendChild ( commitmenttypeindication . getElement ( ) ) ;
21              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
22            }
23        }



                         Figure 3.13: Methods setCommitmentTypeIndication, setDataObjectFormat




                                                                        20
1   /∗∗
 2     ∗ Method s e t A l l D a t a O b j e c t s T i m e S t a m p
 3     ∗
 4     ∗ @param a l l d a t a o b j e c t s t i m e s t a m p
 5     ∗/
 6        public void setAllDataObjectsTimeStamp ( AllDataObjectsTimeStamp
 7   alldataobjectstimestamp ) {
 8            i f ( ( t h i s . _ s t a t e == MODE_SIGN)&&( a l l d a t a o b j e c t s t i m e s t a m p ! = n u l l ) )
 9              { t h i s . _constructionElement . appendChild ( a l l d a t a o b j e c t s t i m e s t a m p . getElement ( ) ) ;
10              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
11              }
12        }
13
14   /∗∗
15     ∗ Method s e t I n d i v i d u a l D a t a O b j e c t s T i m e S t a m p
16     ∗
17     ∗ @param i n d i v i d u a l d a t a o b j e c t s t i m e s t a m p
18     ∗/
19        public void setIn dividual DataObje ctsTimeS tamp ( IndividualDataObjectsTimeStamp
20         individualdataobjectstimestamp ) {
21            i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( i n d i v i d u a l d a t a o b j e c t s t i m e s t a m p ! =
22            null )){
23              t h i s . _constructionElement . appendChild
24              ( ind ivid uald ata obje ctst imes tamp . getElement ( ) ) ;
25              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
26            }
27         }



                Figure 3.14: Methods setAllDataObjectsTimeStamp, setIndividualDataObjectsTimeStamp



     The child-elements - DataObjectFormat, CommitmentTypeIndicationType,
     AllDataObjectsTimeStamp and IndividualDataObjectsTimeStamp, are created using a set-
     Method. Because of their occurrence, it is necessary to define the following conditions:

        1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode"
           ((this._state == MODE_SIGN));

        2. And also, whether the XML-element (DataObjectFormat,
           CommitmentTypeIndicationType,
           AllDataObjectsTimeStamp and IndividualDataObjectsTimeStamp) is not an empty
           one((dataobjectformat!= null), (commitmenttypeindication!= null), (alldataobjectstimestamp != null),
           (individualdataobjectstimestamp != null));

       If any one of these both statements is not fulfilled, no child-element of
     SignedDataObjectProperties would be created.


     3.7 UnsignedSignatureProperties
     The UnsignedSignatureProperties element contains CounterSignature,
     SignatureTimeStamp, CompleteCertificateRefs, CompleteCertificateRefs,
     SigAndRefsTimeStamp, RefsOnlyTimeStamp, CertificateValues,
     RevocationValues, ArchiveTimeStamp. In our Project we will pay attention only to the
     CounterSignature element, because of the structure of XAdES. This will be discussed more detailed
     in section 3.17.



                                                                           21
< x s d : e l e m e n t name= " U n s i g n e d S i g n a t u r e P r o p e r t i e s "
     type =" U n s i g n e d S i g n a t u r e P r o p e r t i e s T y p e " / >
     < x s d : c o m p l e x T y p e name= " U n s i g n e d S i g n a t u r e P r o p e r t i e s T y p e " >
         <xsd:sequence>
             < x s d : e l e m e n t name= " C o u n t e r S i g n a t u r e " t y p e = " C o u n t e r S i g n a t u r e T y p e "
                  m i n O c c u r s = " 0 " maxOccurs = " unbounded " / >
             < x s d : e l e m e n t name= " S i g n a t u r e T i m e S t a m p " t y p e = " TimeStampType "
                  m i n O c c u r s = " 0 " maxOccurs = " unbounded " / >
             < x s d : e l e m e n t name= " C o m p l e t e C e r t i f i c a t e R e f s "
                  t y p e =" C o m p l e t e C e r t i f i c a t e R e f s T y p e " minOccurs=" 0 " / >
             < x s d : e l e m e n t name= " C o m p l e t e R e v o c a t i o n R e f s "
                  t y p e =" CompleteRevocationRefsType " minOccurs=" 0 " / >
             <xsd:choice>
                 < x s d : e l e m e n t name= " SigAndRefsTimeStamp " t y p e = " TimeStampType "
                      m i n O c c u r s = " 0 " maxOccurs = " unbounded " / >
                 < x s d : e l e m e n t name= " RefsOnlyTimeStamp " t y p e = " TimeStampType "
                      m i n O c c u r s = " 0 " maxOccurs = " unbounded " / >
             </ xsd:choice>
             < x s d : e l e m e n t name= " C e r t i f i c a t e V a l u e s " t y p e = " C e r t i f i c a t e V a l u e s T y p e "
                  minOccurs=" 0 " / >
             < x s d : e l e m e n t name= " R e v o c a t i o n V a l u e s " t y p e = " R e v o c a t i o n V a l u e s T y p e "
                  minOccurs=" 0 " / >
             < x s d : e l e m e n t name= " A r c h i v e T i m e S t a m p " t y p e = " TimeStampType "
                  m i n O c c u r s = " 0 " maxOccurs = " unbounded " / >
         </ xsd:sequence>
     < / xsd:complexType>


                                                    Figure 3.15: UnsignedSignatureProperties




     Only the CounterSignature element, using a set-Method, is specified, because the other sub-elements
     of the UnsignedSignatureProperties are not included in the XAdES XML structure. Note, that
     only the value of the element is tested, because the "children" of
     UnsignedProperties element, are not signed by the XMLDSIG signature.


 1   /∗∗
 2     ∗ Method s e t C o u n t e r S i g n a t u r e
 3     ∗ @param s i g n a t u r e
 4     ∗/
 5        public void s e t C o u n t e r S i g n a t u r e ( C o u n t e r S i g n a t u r e         signature ) {
 6            i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( s i g n a t u r e ! = n u l l ) ) {
 7              t h i s . _constructionElement . appendChild ( s i g n a t u r e . getElement ( ) ) ;
 8              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
 9            }
10        }



                                                    Figure 3.16: Method setCounterSignature




                                                                                 22
3.8 The SigningTime element
     The SigningTime element is meant for showing the date and time at which the signer has created the
     signed XML signature. It is a sub-element of SignedSignatureProperties and in view of that
     contributes for the cryptographic justification of the XML signature. This element must occur exactly once
     within the signature. However the SigningTime can take only the local time of the computer on which
     the signature is created.
        The definition of this element, as it follows:


     < x s d : e l e m e n t name= " S i g n i n g T i m e " t y p e = " x s d : d a t e T i m e " / >


                                                                      Figure 3.17: SigningTime




 1   /∗∗
 2     ∗ Constructor SigningTime
 3     ∗
 4     ∗ @param doc
 5     ∗ @param d a t e T i m e
 6     ∗/
 7        p u b l i c S i g n i n g T i m e ( Document doc , D a t e d a t e T i m e ) {
 8               s u p e r ( doc ) ;
 9                t h i s . a d d T e x t ( toXMLDate ( d a t e T i m e ) . t o S t r i n g ( ) ) ;
10        }



                                                            Figure 3.18: Constructor SigningTime




        The SigningTime is created using a specific constructor, with two variables doc and dateTime. For
     this function we use the javax.xml.datatype.XMLGregorianCalendar and
     java.util.GregorianCalendar libraries.




                                                                                         23
3.9 The SigningCertificate element
Using the SigningCertificate element could be avoided a simple substitution of the certificate.
As sub-elements, it has the CertDigest and IssuerSerial elements, which consist of references
to the DigestMethod URI and DigestValue, as well as a reference to the X509IssuerSerial
(X509IssuerName, X509SerialNumber).Just like the SigningTime element,
SigningCertificate is sub-element of the SignedSignatureProperties, its use is required
and must appear only once.
   Below follows the schema definition:


< x s d : e l e m e n t name= " S i g n i n g C e r t i f i c a t e " t y p e = " C e r t I D L i s t T y p e " / >
< x s d : c o m p l e x T y p e name= " C e r t I D L i s t T y p e " >
    <xsd:sequence>
        < x s d : e l e m e n t name= " C e r t " t y p e = " C e r t I D T y p e " maxOccurs = " unbounded " / >
    </ xsd:sequence>
< / xsd:complexType>
< x s d : c o m p l e x T y p e name= " C e r t I D T y p e " >
    <xsd:sequence>
        < x s d : e l e m e n t name= " C e r t D i g e s t " t y p e = " D i g e s t A l g A n d V a l u e T y p e " / >
        < x s d : e l e m e n t name= " I s s u e r S e r i a l " t y p e = " d s : X 5 0 9 I s s u e r S e r i a l T y p e " / >
    </ xsd:sequence>
< / xsd:complexType>
< x s d : c o m p l e x T y p e name= " D i g e s t A l g A n d V a l u e T y p e " >
    <xsd:sequence>
        < x s d : e l e m e n t name= " D i g e s t M e t h o d " t y p e = " d s : D i g e s t M e t h o d T y p e " / >
        < x s d : e l e m e n t name= " D i g e s t V a l u e " t y p e = " d s : D i g e s t V a l u e T y p e " / >
    </ xsd:sequence>
< / xsd:complexType>


                                                   Figure 3.19: SigningCertificate




   The SigningCertificate element is created using a set-Method, and because of its type is specified
as CertIDList ("(CertIDList SigningCertificate)").Again it is necessary to define the following condi-
tions:

    1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode"
       ((this._state == MODE_SIGN));

    2. And also, whether the XML-element (SigningCertificate) is not an empty one
       ((SigningCertificate!= null);

   If any one of these both statements is not fulfilled, no SigningCertificate element would be cre-
ated. This shall be illustrated in the next table:




                                                                      24
1   /∗∗
 2     ∗ Method s e t S i g n i n g C e r t i f i c a t e
 3     ∗
 4     ∗ @param S i g n i n g C e r t i f i c a t e
 5     ∗/
 6        public void s e t S i g n i n g C e r t i f i c a t e ( C e r t I D L i s t S i g n i n g C e r t i f i c a t e ) {
 7            i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g n i n g C e r t i f i c a t e ! = n u l l ) ) {
 8              t h i s . _constructionElement . appendChild ( S i g n i n g C e r t i f i c a t e . getElement ( ) ) ;
 9              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
10            }
11        }



                                                 Figure 3.20: Method setSigningCertificate




     3.10 The SignaturePolicyIdentifier element
     The SignaturePolicyIdentifier is a combination of norms for the build up and validation of a sig-
     nature, so the validity of the signature can be confirmed. The uniqueness of the signer is protected, through a
     hash value of the signature policy. Moreover the implementation of the SignaturePolicyIdentifier
     element prevents the hash value and the identifier to be faked, thus it proves the globally unique reference
     of the signature policy to the XML signature and the signer as a part of the signature computation. With the
     SigningTime and the SigningCertificate elements it defines the XAdES-BES format. Only one
     SignaturePolicyIdentifier element must occur within the
     SignedSignatureProperties.On the next page follows the schema definition for this type, see Fig-
     ure 3.22 .
        There are two options for using the elements of the SignaturePolicyIdentifier:

        1. SignaturePolicyId has four sub-elements- SigPolicyId, Transforms,
           SigPolicyHash, SigPolicyQualifiers.
                 • SigPolicyId is required and it specifies the Identifier, Description and the
                   DocumentationReferences elements, which uniquely designates the specific version of
                   the signature policy.
                 • The Transforms element references to the Transforms in the SignedInfo.
                 • SigPolicyHash consists of two sub-elements- DigestMethod Algorithm, identifier of
                   the hash algorithm, and the DigestValue - hash value of the signature policy.
                 • Within the SigPolicyQualifiers extra information, qualifying the policy identifier can
                   appear.
        2. SignaturePolicyImplied
             Alternatively, an empty SignaturePolicyImplied element confirms that the data object(s) be-
             ing signed and other external data designate the signature policy.



        The SignaturePolicyId element is added as a child-element of the
     SignaturePolicyIdentifier, using a set-Method. Because of its specific type this element is de-
     fined as SignaturePolicyIdType. Like the other SignedProperties is necessary to define the
     following conditions:



                                                                            25
< x s d : e l e m e n t name= " S i g n a t u r e P o l i c y I d e n t i f i e r "
    type =" S i g n a t u r e P o l i c y I d e n t i f i e r T y p e " / > <xsd:complexType
    name= " S i g n a t u r e P o l i c y I d e n t i f i e r T y p e " >
        <xsd:choice>
            < x s d : e l e m e n t name= " S i g n a t u r e P o l i c y I d " t y p e = " S i g n a t u r e P o l i c y I d T y p e " / >
            < x s d : e l e m e n t name= " S i g n a t u r e P o l i c y I m p l i e d " / >
        </ xsd:choice>
    < / x s d : c o m p l e x T y p e > < x s d : c o m p l e x T y p e name= " S i g n a t u r e P o l i c y I d T y p e " >
        <xsd:sequence>
            < x s d : e l e m e n t name= " S i g P o l i c y I d " t y p e = " O b j e c t I d e n t i f i e r T y p e " / >
            < x s d : e l e m e n t r e f =" d s : T r a n s f o r m s " minOccurs=" 0 " / >
            < x s d : e l e m e n t name= " S i g P o l i c y H a s h " t y p e = " D i g e s t A l g A n d V a l u e T y p e " / >
            < x s d : e l e m e n t name= " S i g P o l i c y Q u a l i f i e r s "
                 t y p e =" S i g P o l i c y Q u a l i f i e r s L i s t T y p e " minOccurs=" 0 " / >
        </ xsd:sequence>
    < / xsd:complexType> <xsd:complexType
    name= " S i g P o l i c y Q u a l i f i e r s L i s t T y p e " >
        <xsd:sequence>
            < x s d : e l e m e n t name= " S i g P o l i c y Q u a l i f i e r " t y p e = " AnyType "
                 maxOccurs = " unbounded " / >
        </ xsd:sequence>
    < / xsd:complexType>


                                                          Figure 3.21: SignaturePolicyIdentifier


        1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode"
           ((this._state == MODE_SIGN));

        2. And also, whether the XML-element (SignaturePolicyId) is not an empty one
           ((SignaturePolicyId!= null));

    If any one of these both statements is not fulfilled, no SignaturePolicyIdelement would be created.
    By the SignaturePolicyId element we use the JUnit test to demonstrate the obligatorily occurrence,
    with other words: if this element is an empty one, an IllegalArgumentException should be executed with
    the relevant message:


1   i f ( S i g n a t u r e P o l i c y I d == n u l l ) {
2         throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g n a t u r e P o l i c y I d E l e m e n t
3         is required ! " );
4     }




                                                                                       26
1   /∗∗
 2     ∗ Method s e t S i g n a t u r e P o l i c y I d
 3     ∗
 4     ∗ @param S i g n a t u r e P o l i c y I d
 5     ∗/
 6        public void s e t S i g n a t u r e P o l i c y I d ( S i g n a t u r e P o l i c y I d T y p e S i g n a t u r e P o l i c y I d ){
 7            i f ( S i g n a t u r e P o l i c y I d == n u l l ) {
 8              throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g n a t u r e P o l i c y I d E l e m e n t
 9              is required ! " );
10            }
11            e l s e i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g n a t u r e P o l i c y I d ! = n u l l ) ) {
12              t h i s . _constructionElement . appendChild ( S i g n a t u r e P o l i c y I d . getElement ( ) ) ;
13              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
14            }
15        }



                                                       Figure 3.22: Method setSignaturePolicyId



     Refers to the negative JUnit test testNeg_SignaturePolicyId_Element_required in
     org.apache.xml.security.xades.tests.JUtests. The following codesamples can illustrate all this
     ( refer to the class:SignaturePolicyIdType).

 1   /∗∗
 2     ∗ Method s e t S i g P o l i c y I d
 3     ∗ @param S i g P o l i c y I d
 4     ∗/
 5        public void s e t S i g P o l i c y I d ( O b j e c t I d e n t i f i e r S i g P o l i c y I d ){
 6            i f ( S i g P o l i c y I d == n u l l ) {
 7              throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g P o l i c y I d E l e m e n t i s r e q u i r e d ! " ) ;
 8            }
 9            e l s e i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g P o l i c y I d ! = n u l l ) ) {
10              t h i s . _constructionElement . appendChild ( SigPolicyId . getElement ( ) ) ;
11              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
12            }
13        }
14
15   /∗∗
16     ∗ Method s e t S i g P o l i c y H a s h
17     ∗ @param S i g P o l i c y H a s h
18     ∗/
19        public void s e t S i g P o l i c y H a s h ( DigestAlgAndValue SigPolicyHash ){
20            i f ( S i g P o l i c y H a s h == n u l l ) {
21              throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g P o l i c y H a s h E l e m e n t i s r e q u i r e d ! " ) ;
22            }
23            else        i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g P o l i c y H a s h ! = n u l l ) ) {
24              t h i s . _constructionElement . appendChild ( SigPolicyHash . getElement ( ) ) ;
25              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
26            }
27        }



                                             Figure 3.23: Methods setSigPolicyId, setSigPolicyHash




     The child-elements, which define the format SignaturePolicyIdType - SigPolicyId,
     SigPolicyHash, Transforms, and SigPolicyQualifiers, are all created using set-Methods.
     Because of their occurrence, it is necessary to define the following conditions:



                                                                                      27
1   /∗∗
 2     ∗ Method s e t T r a n s f o r m s 1
 3     ∗ @param t r a n s f o r m s 1
 4     ∗/
 5        public void setTransforms1 ( Transforms1 t r a n s f o r m s 1 ){
 6            i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( t r a n s f o r m s 1 ! = n u l l ) ) {
 7              t h i s . _constructionElement . appendChild ( transforms1 . getElement ( ) ) ;
 8              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
 9            }
10        }
11
12   /∗∗
13     ∗ Method s e t S i g P o l i c y Q u a l i f i e r s
14     ∗
15     ∗ @param S i g P o l i c y Q u a l i f i e r s
16     ∗/
17        public void s e t S i g P o l i c y Q u a l i f i e r s ( S i g P o l i c y Q u a l i f i e r s L i s t T y p e
18        S i g P o l i c y Q u a l i f i e r s ){
19               i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g P o l i c y Q u a l i f i e r s ! = n u l l ) ) {
20                 t h i s . _constructionElement . appendChild ( S i g P o l i c y Q u a l i f i e r s . getElement ( ) ) ;
21                 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
22               }
23        }



                                        Figure 3.24: Methods setTransforms1, setSigPolicyQualifiers


         1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode"
            ((this._state == MODE_SIGN));

         2. And also, whether the XML-element (SigPolicyId, SigPolicyHash, Transforms,
            and SigPolicyQualifiers) is not an empty one((SigPolicyId != null), (SigPolicyHash != null),
            (transforms1 != null), (SigPolicyQualifiers != null));

     If any one of these both statements is not fulfilled, no child-element of
     SignaturePolicyIdType would be created. By the SigPolicyId and SigPolicyHash elements
     we use the JUnit tests to demonstrate the obligatorily occurrence, with other words: if this element is an
     empty one, an IllegalArgumentException should be executed with the relevant message:


 1   i f ( S i g P o l i c y I d == n u l l ) {
 2         throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g P o l i c y I d E l e m e n t
 3         is required ! " );
 4     }
 5
 6    i f ( S i g P o l i c y H a s h == n u l l ) {
 7        throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g P o l i c y H a s h E l e m e n t
 8        is required ! " );
 9    }




                                                                                       28
Refers to the negative JUnit tests testNeg_SigPolicyId_Element_required and
     testNeg_SigPolicyHash_Element_required in org.apache.xml.security.xades.tests.JUtests.
        The SigPolicyQualifiers element is added as a child-element of the SignaturePolicyId,
     using a set-Method. Because of its specific type this element is defined as
     SigPolicyQualifiersListType. The following conditions is necessary to be defined:

         1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode"
            ((this._state == MODE_SIGN));

         2. And also, whether the XML-element (SigPolicyQualifiers) is not an empty one
            ((SigPolicyQualifiers != null));

       If any one of these both statements is not fulfilled, no SigPolicyQualifierselement would be
     created.

 1   /∗∗
 2     ∗ Method s e t S i g P o l i c y Q u a l i f i e r
 3     ∗
 4     ∗ @param S i g P o l i c y Q u a l i f i e r
 5     ∗/
 6        public void s e t S i g P o l i c y Q u a l i f i e r ( S t r i n g S i g P o l i c y Q u a l i f i e r ){
 7            i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g P o l i c y Q u a l i f i e r ! = n u l l ) ) {
 8              this . addStringElement ( SigPolicyQualifier ,
 9               C o n s t a n t s . _TAG_SIGPOLICYQUALIFIER ) ;
10              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
11            }
12        }



                                                  Figure 3.25: Method setSigPolicyQualifiers



       The child-element, which defines the format SigPolicyQualifiersListType -
     SigPolicyQualifier is created using set-Method. Because of its occurrence, it is necessary to define
     the following conditions:

         1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode"
            ((this._state == MODE_SIGN));

         2. And also, whether the XML-element (SigPolicyQualifier) is not an empty one
            ((SigPolicyQualifier != null));

       If any one of these both statements is not fulfilled, no child-element of
     SigPolicyQualifiersListType would be created.




                                                                                29
3.11 The SignatureProductionPlace element
     The SignatureProductionPlace is a sub-element of SignedSignatureProperties just like
     SigningTime, SigningCertificate and SignaturePolicyIdentifier, but its use is op-
     tional. This element specifies the exact place where the signature is created, through its four "children" -
     City, StateOrProvince, PostalCode, CountryName. Within the SignedSignature-
     Properties can occur only one SignatureProductionPlace element.
        The schema definition of this element, as it follows:

     < x s d : e l e m e n t name= " S i g n a t u r e P r o d u c t i o n P l a c e "
     type =" S i g n a t u r e P r o d u c t i o n P l a c e T y p e " / >
     < x s d : c o m p l e x T y p e name= " S i g n a t u r e P r o d u c t i o n P l a c e T y p e " >
         <xsd:sequence>
             < x s d : e l e m e n t name= " C i t y " t y p e = " x s d : s t r i n g " m i n O c c u r s = " 0 " / >
             < x s d : e l e m e n t name= " S t a t e O r P r o v i n c e " t y p e = " x s d : s t r i n g " m i n O c c u r s = " 0 " / >
             < x s d : e l e m e n t name= " P o s t a l C o d e " t y p e = " x s d : s t r i n g " m i n O c c u r s = " 0 " / >
             < x s d : e l e m e n t name= " CountryName " t y p e = " x s d : s t r i n g " m i n O c c u r s = " 0 " / >
         </ xsd:sequence>
     < / xsd:complexType>


                                                            Figure 3.26: SignatureProductionPlace




 1   /∗∗
 2     ∗ Method s e t C i t y
 3     ∗ @param C i t y
 4     ∗/
 5        public void s e t C i t y ( S t r i n g City ) {
 6            i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( C i t y ! = n u l l ) ) {
 7              t h i s . a d d S t r i n g E l e m e n t ( C i t y , C o n s t a n t s . _TAG_CITY ) ;
 8              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
 9            }
10        }
11
12   /∗∗
13     ∗ Method s e t S t a t e O r P r o v i n c e
14     ∗ @param S t a t e O r P r o v i n c e
15     ∗/
16        public void s e t S t a t e O r P r o v i n c e ( S t r i n g S t a t e O r P r o v i n c e ) {
17            i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S t a t e O r P r o v i n c e ! = n u l l ) ) {
18              t h i s . a d d S t r i n g E l e m e n t ( S t a t e O r P r o v i n c e , C o n s t a n t s . _TAG_STATEORPROVINCE ) ;
19              XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ;
20            }
21        }



                                                  Figure 3.27: Methods: setStateOrProvince, setCity




                                                                                         30
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project
XAdES Specification based on the Apache XMLSec Project

Weitere ähnliche Inhalte

Was ist angesagt?

Syllabic structure of English words.pptx
Syllabic structure of English words.pptxSyllabic structure of English words.pptx
Syllabic structure of English words.pptxssuseref3e74
 
HP Pile Data sheet.pdf
HP Pile Data sheet.pdfHP Pile Data sheet.pdf
HP Pile Data sheet.pdfManoharanR11
 
IECEx and ATEX (and other regional systems)
IECEx and ATEX (and other regional systems)IECEx and ATEX (and other regional systems)
IECEx and ATEX (and other regional systems)Statybos Akademija
 
Engineering & piping design
Engineering & piping designEngineering & piping design
Engineering & piping designjisothomas
 
6 inflectional vs derivational
6 inflectional vs derivational6 inflectional vs derivational
6 inflectional vs derivationalThennarasu Sakkan
 
QuíMica Explosivos Apostila
QuíMica   Explosivos   ApostilaQuíMica   Explosivos   Apostila
QuíMica Explosivos ApostilaSanquimica
 
what is the consonant cluster
what is  the consonant cluster  what is  the consonant cluster
what is the consonant cluster Moza AE
 
UNIDAD DE VERFICACION PARA GASOLINERAS Y ESTACIONES DE SERVICIO
UNIDAD DE VERFICACION PARA GASOLINERAS Y ESTACIONES DE SERVICIOUNIDAD DE VERFICACION PARA GASOLINERAS Y ESTACIONES DE SERVICIO
UNIDAD DE VERFICACION PARA GASOLINERAS Y ESTACIONES DE SERVICIOblockbase48
 
Twi cswip welding inspection notes and questions
Twi cswip welding inspection notes and questionsTwi cswip welding inspection notes and questions
Twi cswip welding inspection notes and questionsThang Do Minh
 
Tuboscope DPs Troubleshooting & Failures
Tuboscope DPs Troubleshooting & FailuresTuboscope DPs Troubleshooting & Failures
Tuboscope DPs Troubleshooting & FailuresHamidreza Shobeyri
 
The patterns of sounds
The patterns of soundsThe patterns of sounds
The patterns of soundsMUHAMMAD SAEED
 
Prosodic Morphology.pptx
Prosodic Morphology.pptxProsodic Morphology.pptx
Prosodic Morphology.pptxKaylaAgiesta
 

Was ist angesagt? (20)

03 word stress
03 word stress03 word stress
03 word stress
 
Syllabic structure of English words.pptx
Syllabic structure of English words.pptxSyllabic structure of English words.pptx
Syllabic structure of English words.pptx
 
Prosodic Morphology
Prosodic MorphologyProsodic Morphology
Prosodic Morphology
 
HP Pile Data sheet.pdf
HP Pile Data sheet.pdfHP Pile Data sheet.pdf
HP Pile Data sheet.pdf
 
IECEx and ATEX (and other regional systems)
IECEx and ATEX (and other regional systems)IECEx and ATEX (and other regional systems)
IECEx and ATEX (and other regional systems)
 
Engineering & piping design
Engineering & piping designEngineering & piping design
Engineering & piping design
 
OISD STD 114.pptx
OISD STD 114.pptxOISD STD 114.pptx
OISD STD 114.pptx
 
6 inflectional vs derivational
6 inflectional vs derivational6 inflectional vs derivational
6 inflectional vs derivational
 
QuíMica Explosivos Apostila
QuíMica   Explosivos   ApostilaQuíMica   Explosivos   Apostila
QuíMica Explosivos Apostila
 
4880 4
4880 44880 4
4880 4
 
what is the consonant cluster
what is  the consonant cluster  what is  the consonant cluster
what is the consonant cluster
 
R.P. vowels
R.P. vowelsR.P. vowels
R.P. vowels
 
UNIDAD DE VERFICACION PARA GASOLINERAS Y ESTACIONES DE SERVICIO
UNIDAD DE VERFICACION PARA GASOLINERAS Y ESTACIONES DE SERVICIOUNIDAD DE VERFICACION PARA GASOLINERAS Y ESTACIONES DE SERVICIO
UNIDAD DE VERFICACION PARA GASOLINERAS Y ESTACIONES DE SERVICIO
 
Twi cswip welding inspection notes and questions
Twi cswip welding inspection notes and questionsTwi cswip welding inspection notes and questions
Twi cswip welding inspection notes and questions
 
Tuboscope DPs Troubleshooting & Failures
Tuboscope DPs Troubleshooting & FailuresTuboscope DPs Troubleshooting & Failures
Tuboscope DPs Troubleshooting & Failures
 
The patterns of sounds
The patterns of soundsThe patterns of sounds
The patterns of sounds
 
Api 510 study plan
Api 510 study planApi 510 study plan
Api 510 study plan
 
PSC Lecture PPT.pdf
PSC  Lecture PPT.pdfPSC  Lecture PPT.pdf
PSC Lecture PPT.pdf
 
Api 510
Api 510Api 510
Api 510
 
Prosodic Morphology.pptx
Prosodic Morphology.pptxProsodic Morphology.pptx
Prosodic Morphology.pptx
 

Ähnlich wie XAdES Specification based on the Apache XMLSec Project

Information extraction systems aspects and characteristics
Information extraction systems  aspects and characteristicsInformation extraction systems  aspects and characteristics
Information extraction systems aspects and characteristicsGeorge Ang
 
Perl &lt;b>5 Tutorial&lt;/b>, First Edition
Perl &lt;b>5 Tutorial&lt;/b>, First EditionPerl &lt;b>5 Tutorial&lt;/b>, First Edition
Perl &lt;b>5 Tutorial&lt;/b>, First Editiontutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Ibm tivoli usage accounting manager v7.1 handbook sg247404
Ibm tivoli usage accounting manager v7.1 handbook sg247404Ibm tivoli usage accounting manager v7.1 handbook sg247404
Ibm tivoli usage accounting manager v7.1 handbook sg247404Banking at Ho Chi Minh city
 
ID3 Algorithm - Reference Manual
ID3 Algorithm - Reference ManualID3 Algorithm - Reference Manual
ID3 Algorithm - Reference ManualMichel Alves
 
Specification of the Linked Media Layer
Specification of the Linked Media LayerSpecification of the Linked Media Layer
Specification of the Linked Media LayerLinkedTV
 
Ibm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job designIbm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job designdivjeev
 
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...Banking at Ho Chi Minh city
 
Robust data synchronization with ibm tivoli directory integrator sg246164
Robust data synchronization with ibm tivoli directory integrator sg246164Robust data synchronization with ibm tivoli directory integrator sg246164
Robust data synchronization with ibm tivoli directory integrator sg246164Banking at Ho Chi Minh city
 
Robust data synchronization with ibm tivoli directory integrator sg246164
Robust data synchronization with ibm tivoli directory integrator sg246164Robust data synchronization with ibm tivoli directory integrator sg246164
Robust data synchronization with ibm tivoli directory integrator sg246164Banking at Ho Chi Minh city
 
Migrating to netcool precision for ip networks --best practices for migrating...
Migrating to netcool precision for ip networks --best practices for migrating...Migrating to netcool precision for ip networks --best practices for migrating...
Migrating to netcool precision for ip networks --best practices for migrating...Banking at Ho Chi Minh city
 
title
titletitle
titlecprox
 
Png 1.2
Png 1.2Png 1.2
Png 1.2cprox
 

Ähnlich wie XAdES Specification based on the Apache XMLSec Project (20)

Information extraction systems aspects and characteristics
Information extraction systems  aspects and characteristicsInformation extraction systems  aspects and characteristics
Information extraction systems aspects and characteristics
 
Perl &lt;b>5 Tutorial&lt;/b>, First Edition
Perl &lt;b>5 Tutorial&lt;/b>, First EditionPerl &lt;b>5 Tutorial&lt;/b>, First Edition
Perl &lt;b>5 Tutorial&lt;/b>, First Edition
 
perltut
perltutperltut
perltut
 
Perl tut
Perl tutPerl tut
Perl tut
 
Perl 5 guide
Perl 5 guidePerl 5 guide
Perl 5 guide
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
perltut
perltutperltut
perltut
 
Ibm tivoli usage accounting manager v7.1 handbook sg247404
Ibm tivoli usage accounting manager v7.1 handbook sg247404Ibm tivoli usage accounting manager v7.1 handbook sg247404
Ibm tivoli usage accounting manager v7.1 handbook sg247404
 
ID3 Algorithm - Reference Manual
ID3 Algorithm - Reference ManualID3 Algorithm - Reference Manual
ID3 Algorithm - Reference Manual
 
Specification of the Linked Media Layer
Specification of the Linked Media LayerSpecification of the Linked Media Layer
Specification of the Linked Media Layer
 
EFSL
EFSLEFSL
EFSL
 
Ibm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job designIbm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job design
 
Flask docs
Flask docsFlask docs
Flask docs
 
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...
 
Robust data synchronization with ibm tivoli directory integrator sg246164
Robust data synchronization with ibm tivoli directory integrator sg246164Robust data synchronization with ibm tivoli directory integrator sg246164
Robust data synchronization with ibm tivoli directory integrator sg246164
 
Robust data synchronization with ibm tivoli directory integrator sg246164
Robust data synchronization with ibm tivoli directory integrator sg246164Robust data synchronization with ibm tivoli directory integrator sg246164
Robust data synchronization with ibm tivoli directory integrator sg246164
 
Migrating to netcool precision for ip networks --best practices for migrating...
Migrating to netcool precision for ip networks --best practices for migrating...Migrating to netcool precision for ip networks --best practices for migrating...
Migrating to netcool precision for ip networks --best practices for migrating...
 
title
titletitle
title
 
dsadadsa
dsadadsadsadadsa
dsadadsa
 
Png 1.2
Png 1.2Png 1.2
Png 1.2
 

Mehr von Krassen Deltchev

Automated Validation of Internet Security Protocols and Applications (AVISPA)...
Automated Validation of Internet Security Protocols and Applications (AVISPA)...Automated Validation of Internet Security Protocols and Applications (AVISPA)...
Automated Validation of Internet Security Protocols and Applications (AVISPA)...Krassen Deltchev
 
Automated Validation of Internet Security Protocols and Applications (AVISPA)
Automated Validation of Internet Security Protocols and Applications (AVISPA) Automated Validation of Internet Security Protocols and Applications (AVISPA)
Automated Validation of Internet Security Protocols and Applications (AVISPA) Krassen Deltchev
 
Performance of Group Key Agreement Protocols( Theory)
Performance of Group Key Agreement Protocols( Theory) Performance of Group Key Agreement Protocols( Theory)
Performance of Group Key Agreement Protocols( Theory) Krassen Deltchev
 
Sqlia classification v1, till 2010
Sqlia classification v1, till 2010Sqlia classification v1, till 2010
Sqlia classification v1, till 2010Krassen Deltchev
 
New Web 2.0 Attacks, B.Sc. Thesis
New Web 2.0 Attacks, B.Sc. ThesisNew Web 2.0 Attacks, B.Sc. Thesis
New Web 2.0 Attacks, B.Sc. ThesisKrassen Deltchev
 
Web Application Forensics: Taxonomy and Trends
Web Application Forensics: Taxonomy and TrendsWeb Application Forensics: Taxonomy and Trends
Web Application Forensics: Taxonomy and TrendsKrassen Deltchev
 

Mehr von Krassen Deltchev (8)

DOM-based XSS
DOM-based XSSDOM-based XSS
DOM-based XSS
 
Automated Validation of Internet Security Protocols and Applications (AVISPA)...
Automated Validation of Internet Security Protocols and Applications (AVISPA)...Automated Validation of Internet Security Protocols and Applications (AVISPA)...
Automated Validation of Internet Security Protocols and Applications (AVISPA)...
 
Automated Validation of Internet Security Protocols and Applications (AVISPA)
Automated Validation of Internet Security Protocols and Applications (AVISPA) Automated Validation of Internet Security Protocols and Applications (AVISPA)
Automated Validation of Internet Security Protocols and Applications (AVISPA)
 
Performance of Group Key Agreement Protocols( Theory)
Performance of Group Key Agreement Protocols( Theory) Performance of Group Key Agreement Protocols( Theory)
Performance of Group Key Agreement Protocols( Theory)
 
Sqlia classification v1, till 2010
Sqlia classification v1, till 2010Sqlia classification v1, till 2010
Sqlia classification v1, till 2010
 
New Web 2.0 Attacks, B.Sc. Thesis
New Web 2.0 Attacks, B.Sc. ThesisNew Web 2.0 Attacks, B.Sc. Thesis
New Web 2.0 Attacks, B.Sc. Thesis
 
Web Application Forensics: Taxonomy and Trends
Web Application Forensics: Taxonomy and TrendsWeb Application Forensics: Taxonomy and Trends
Web Application Forensics: Taxonomy and Trends
 
DOM-based XSS
DOM-based XSSDOM-based XSS
DOM-based XSS
 

Kürzlich hochgeladen

Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 

Kürzlich hochgeladen (20)

Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 

XAdES Specification based on the Apache XMLSec Project

  • 1. XAdES Specification based on the Apache XMLSec Project Zdravko Danailov Krassen Deltchev Email: nqkoi_ot_bg@yahoo.com Email: Krassen.Deltchev@rub.de Project thesis at Chair for Network and Data Security Prof. Dr. Jörg Schwenk advised through Dipl.Ing. Lijun Liao 22.05.2007 Horst-Görtz Institute Ruhr-University of Bochum
  • 2. Abstract XML Advanced Electronic Signature (XAdES) provides basic authentication and integrity protection, and satisfies the legal requirements for advanced electronic signatures.There are several implementations of XAdES, but most of them are not OpenSource, or are partialy proprietary software. Great project concerned with Digital Electronic Signatures is the OpenSource Apache XML Security Project. For the developer and common user there is an implementation for the XMLDSIG specification, but still no one for XAdES. The free source code implemetations of XAdES threat this project as a separate one and there is no interface, which can explicit assemble them into the Apache XML Sec. That’s why, the scope of our project is to create a library, that implements XAdES into the OpenSource Apache XML Security- to extend its functionality and level of security, so using the Apache XML Sec, gives the opportunity to handle Advanced Electronic Signatures, which is a standard of security nowadays. The library is developed in Java, because shouldn’t be any kind of OS platform - dependencies, using it as a plug-in to the Security Project of Apache. More detailed, to validate the signing and verifying of signatures, and also test our code, we use the text- based test suite of JUnit. i
  • 3. Acknowledgements We want to express our gratitude to our families and friends, who gave their moral support all the time and contributed for the better working atmosphere. To Dipl.Ing. Lijun Liao, we want to thank for the technical input and support. ii
  • 4. Contents 1 Introduction 1 1.1 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Related works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Background 4 2.1 Definitions and Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2 XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3 XML Advanced Electronic Signature Data Structures . . . . . . . . . . . . . . . . . . . . . 6 2.3.1 XML Signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3.2 XAdES- XML Advanced Electronic Signature . . . . . . . . . . . . . . . . . . . . 8 3 XAdES Elements 10 3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.2 QualifyingProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.3 SignedProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.4 UnsignedProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.5 SignedSignatureProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.6 SignedDataObjectProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.7 UnsignedSignatureProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.8 The SigningTime element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.9 The SigningCertificate element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.10 The SignaturePolicyIdentifier element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.11 The SignatureProductionPlace element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.12 The SignerRole element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 3.13 The DataObjectFormat element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.14 The CommitmentTypeIndication element . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.15 The AllDataObjectsTimeStamp element . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.16 The IndividualDataObjectsTimeStamp element . . . . . . . . . . . . . . . . . . . . . . . . 40 3.17 The CounterSignature element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4 Datatypes 42 4.1 The ObjectIdentifierType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.2 The EncapsulatedPKIDataType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 4.3 The TimeStampType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 5 Conclusion 47 6 Author’s addresses 48 7 Bibliography 49 A Appendix - XAdES i iii
  • 5. B Appendix - XAdES-BES iv C Appendix - XAdES-More then one Element vi D Appendix - Screenshots xi iv
  • 6. List of Figures 2.1 XMLDSIG Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2 XMLDSIG example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3 Advanced Electronic Signature(XAdES) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4 XAdES Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.1 QualifyingProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2 Method setSignedProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.3 Method setUnsignedProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.4 Method setTarget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.5 SignedProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.6 Methods setSignedSignatureProperties, setSignedDataObjectProperties . . . . . . . . . . . 15 3.7 UnsignedProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.8 Method setUnsignedSignatureProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.9 Method setUnsignedDataObjectProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.10 SignedSignatureProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.11 Contructor SignedSignatureProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.12 SignedDataObjectProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.13 Methods setCommitmentTypeIndication, setDataObjectFormat . . . . . . . . . . . . . . . . 20 3.14 Methods setAllDataObjectsTimeStamp, setIndividualDataObjectsTimeStamp . . . . . . . . 21 3.15 UnsignedSignatureProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.16 Method setCounterSignature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.17 SigningTime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.18 Constructor SigningTime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.19 SigningCertificate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.20 Method setSigningCertificate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.21 SignaturePolicyIdentifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.22 Method setSignaturePolicyId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.23 Methods setSigPolicyId, setSigPolicyHash . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.24 Methods setTransforms1, setSigPolicyQualifiers . . . . . . . . . . . . . . . . . . . . . . . . 28 3.25 Method setSigPolicyQualifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.26 SignatureProductionPlace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.27 Methods: setStateOrProvince, setCity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.28 Methods: setPostalCode, setCountryName . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 3.29 SignerRole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 3.30 Methods: setClaimedRoles, setCertifiedRoles . . . . . . . . . . . . . . . . . . . . . . . . . 32 3.31 Constructor CertifiedRolesList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.32 Constructor ClaimedRolesList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.33 DataObjectFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.34 Method setDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.35 Method setObjectIdentifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.36 Method setMimeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 v
  • 7. 3.37 Method setEncoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.38 Method setObjectReference attribite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.39 CommitmentTypeIndication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.40 Constructor CommitmentTypeIndication . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.41 Method setCommitmentTypeQualifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.42 AllDataObjectsTimeStamp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.43 Method setAllDataObjectsTimeStamp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.44 IndividualDataObjectsTimeStamp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.45 Method setIndividualDataObjectsTimeStamp . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.46 CounterSignature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.1 ObjectIdentifierType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.2 IdentifierType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.3 DocumentationReferencesType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.4 Methods setIdentifier, setDescription, setDocumentationReferences . . . . . . . . . . . . . 43 4.5 EncapsulatedPKIDataType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 4.6 Method setID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4.7 TimeStampType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 4.8 Method setHashDataInfo, setEncapsulatedTimeStamp, setXMLTimeStamp . . . . . . . . . 46 D.1 Screenshot - Eclipse IDE JUnit plug-in console output . . . . . . . . . . . . . . . . . . . . xii D.2 Screenshot - Eclipse IDE console output . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii vi
  • 8. List of Tables 2.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2 Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3 XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 A.1 XAdES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii B.1 XAdES-BES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v C.1 XAdES-More then one Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x vii
  • 9. 1 Introduction The XML Signature is a method of associating a key with referenced data (octets); it does not normatively specify how keys are associated with persons or institutions, nor the meaning of the data, being referenced and signed. The main goal of our project is to build a library, which extends the Apache XML Security Project, to meet the XAdES specification, so that the user shall be able to create advanced electronic signatures and be able to validate them. The XAdES (XML Advanced Electronic Signature) specification is sophisticated and there are strong hierarchies among the different XML elements. Every one of them is discussed in separated sections of this thesis(in chapter 3 and chapter 4), where the reader gets an overview on the XML notation, regarding every specific XAdES element, associated with Java code samples: important constructors, variables, constants; and at last, but not at least a pointer to the JUnit test, which verifies the right execution of the code in the library, regarding this particular XAdES element. The XAdES specification is extended by the: XAdES-T, XAdES-C, XAdES-X, XAdES-X-L, XAdES-A; we describe in this thesis only the implemented specifications in our project library of XAdES and XAdES- BES (Basic Electronic Signature). We concentrate only on the creation and verification of electronic signatures, which are valid, requiring only one signer party; therefore, neither independent (parallel signers, without ordering requirement), nor embedded (multiple party signers with signer ordering requirement) digital signatures (such as: contracts, signed between two parties) are described in this work, or find implementation in this version of our project. 1.1 Tools In this section we will specify the necessary tools and mention some requirements, which are obligatory for the use, execution and further development of this project. 1. Tools for development: - Java Development Kit (at least version 1.5)1 - IBM Eclipse IDE2 - JUnit 3.8.1(Plug-In for Eclipse)3 2. Tools for the common user: - Java Runtime Environment (at least version 1.5)4 NOTE: We cannot test the functionality of this project and especially of our library with a lower version of JUnit, because there are no such ones available. 1 http://java.sun.com/ 2 http://www.eclipse.org/ NOTE: you can use also the Apache Ant toolkit, instead of Eclipse- http://ant.apache.org/ 3 http://www.junit.org/index.htm 4 http://java.sun.com/ 1
  • 10. 1.2 Related works At this moment, there are two projects (JDigiDoc and DContract), which are concerned with XAdES. On one side, JDigiDoc is a framework and implementation of digital signatures. It validates the private keys of Estonian ID Cards and Mobile ID Cards for mobile PC devices. JDigiDoc is contrived as an OpenSource. The java project can be obtained from the website and tested with the Apache XML toolkit, but it is not designed explicit as a library for the Apache XML Project. • JDigiDoc Veiko Sinivee Veiko.Sinivee@seb.se openxades@openxades.org http://www.openxades.org/ On another side, DContract provides a toolbox for the management of digital contracts within Java.It supports all XML Advanced Electronic Signature types (XAdES v1.3.2 2006-03): XAdES-BES, XAdES- EPES, XAdES-T, XAdES-C, XAdES-X, XAdES-X-L. It uses PKCS12 key repository management and can generate RSA key pairs up to 2048 bit. The DContract project is not an OpenSource. • DContract Frank Cornelis http://www.frankcornelis.be info@frankcornelis.be Other contributions to XAdES shall be listed as follows: • Baltimore Technologies Vivekanand Sakaram (vsakaram@baltimore.com) Project information: Language: Java probably only commercial license (code source can be negotiated only on individual basis) • Institute for Applied Information Processing and Communications (IAIK), Graz University of Technology Martin Centner (mcentner@iaik.tugraz.at) Peter Lipp (plipp@iaik.tugraz.at) Project information: Language: Java free for educational use and research (code for commercial license only) 2
  • 11. • Kopint-Datorg Rt. (Kopdat) Balazs Andras Dohanyos (balazs.dohanyos@kopdat.hu) Project information: Language: C++ (compiled in VC6.0) contact sales( no source availability) • Microsoft Eddy Rubens (eddyrube@microsoft.com) Stefan Santesson (stefans@microsoft.com) Project information: Language: C# free library( code availability - yes) • Universitat Politecnica de Catalunya (UPC) Joan Arnedo (joanar@ac.upc.es) Juan Carlos Cruellas (cruellas@ac.upc.es) Project information: Language: Java probably commercial licence( no source availability) • Agencia Catalana de Certificacio [CATCert] Marta Cruellas (mcruellas@catcert.net) Project information: no furthur information 3
  • 12. 2 Background For the better understanding of this thesis and the goal of our library, we shall specify some basic terms and expound the essence of the main ‘Building Blocks’. 2.1 Definitions and Abbreviations For the purposes of the current work, the following terms and definitions apply: Term Definition Arbitrator entity that arbitrates in disputes between a signer and a verifier Attributes Authorities provide users with attributes linked to public key certifi- cates Certification Authorities provide users with public key certificates Registration Authorities allow the identification and registration of entities before a CA generates certificates Repository Authorities publish CRLs issued by CAs, signature policies issued by signature policy issuers and optionally public key certifi- cates Signature Policy Issuers define the technical and procedural requirements for elec- tronic signature creation and validation, in order to meet a particular business need Signer entity that creates the electronic signature Time-Stamping Authorities attest that some data object was formed before a given trusted time Time-Marking Authorities record that some data was formed before a given trusted time Trusted Service Providers one or more entities that help to build trust relationships between the signer and verifier Verifier entity that verifies the electronic signature Table 2.1: Definitions 4
  • 13. Term Abbreviation Attribute Certificate AC Certification Authority CA Cryptographic Message Syntax CMS Certificate Revocation List CRL Document Type Definition DTD Electronic Signature ES Hyper Text Transfer Protocol HTTP Online Certificate Status Protocol OCSP Object IDentifier OID Public Key Certificate PKC Time-Stamping Authorities TSA Trusted Service Providers TSP Time Stamping Unit TSU Uniform Resource Identifier URI Uniform Resource Name URN XML Advanced Electronic Signature XAdES XAdES Archiving validation data XAdES-A XAdES Basic Electronic Signature XAdES-BES XAdES Complete validation data XAdES-C XAdES Explicit Policy based Elec- XAdES-EPES tronic Signature XAdES with Time-stamp XAdES-T XAdES eXtended validation data XAdES-X eXtensible Markup Language XML eXtensible Markup Language Digital XMLDSIG SIGnature eXtensible Stylesheet Language XSL eXtensible Stylesheet Language XSLT Transformations Table 2.2: Abbreviations 2.2 XML As mentioned above XML [XML][XML-schema-part-1][XML-schema-part-2] is the abbreviation for eX- tensible Markup Language. Its main purpose is to facilitate the sharing of data across different informa- tion systems, particularly via the Internet. By adding semantic constraints, application languages such as XHTML, RSS, MathML, GraphML, Scalable Vector Graphics, can be implemented in XML. Moreover, XML is sometimes used as the specification language for such application languages. XML is recommended by the World Wide Web Consortium (W3C). It is a fee-free open standard. The W3C recommendation specifies both the lexical grammar, and the requirements for parsing. 5
  • 14. eXtensible Markup Language File extension .xml Uniform Type public.xml MIME type application/xml, text/xml (deprecated) Developed by World Wide Web Consortium Type of format Markup language Extended from SGML Extended to XHTML, RSS, Atom, ... Standard(s) 1.0 (Fourth Edition) 1.1 (Second Edition) Table 2.3: XML 2.3 XML Advanced Electronic Signature Data Structures 2.3.1 XML Signature This section provides an overview and examples of XML digital signature syntax. An informal representa- tion and examples are used to describe the structure of the XML signature syntax. This representation and examples may omit attributes, details and potential features that are explained later. XML Signatures are applied to arbitrary digital content (data objects) via an indirection. Data objects are digested, the resulting value is placed in an element with other information and that element is then digested and cryptographically signed. XML digital signatures are represented by the Signature element which has the following structure: XMLDSIG < d s : S i g n a t u r e ID ? >− − − − − − − − −+− − − − −+ <ds:SignedInfo> | | <ds:CanonicalizationMethod /> | | <ds:SignatureMethod / > | | ( < d s : R e f e r e n c e URI? > | | (<ds:Transforms>)? | | <ds:DigestMethod> | | <ds:DigestValue> | | < / d s : R e f e r e n c e >)+ | | </ ds:SignedInfo> | | <ds:SignatureValue> | | ( < d s : K e y I n f o >)?− − − − − − − − − + | <ds:Object> | < d s : S i g n a t u r e >− − − − − − − − − − − − − − − −+ Figure 2.1: XMLDSIG Specification 6
  • 15. Signatures are related to data objects via URIs. Within an XML document, signatures are related to local data objects via fragment identifiers. Such local data can be included within an enveloping signature or can enclose an enveloped signature. Detached signatures are over external network resources or local data objects that reside within the same XML document as sibling elements; in this case, the signature is neither enveloping (signature is parent) nor enveloped attribute (signature is child). Since a Signature element (and its Id value/name) may co-exist or be combined with other elements (and their IDs) within a single XML document, care should be taken in choosing names such that there are no subsequent collisions that violate the ID uniqueness validity constraint. The following example is a detached signature of the content of the HTML4.01 in XML specification. < n d s : R o o t E l e m e n t x m l n s : n d s = " h t t p : / / www. n d s . r u b . de / x a d e s " > < n d s : A I −NDS−HGI I d = " AI−NDS−HGI−18378667 " >Some s i m p l e t e x t < / n d s : A I −NDS−HGI> < S i g n a t u r e xmlns = " h t t p : / / www. w3 . o r g / 2 0 0 0 / 0 9 / x m l d s i g # " I d = " S i g n a t u r e I d " > <SignedInfo> <CanonicalizationMethod A l g o r i t h m = " h t t p : / / www. w3 . o r g / TR / 2 0 0 1 / REC−xml−c14n −20010315 " / > < S i g n a t u r e M e t h o d A l g o r i t h m = " h t t p : / / www. w3 . o r g / 2 0 0 0 / 0 9 / x m l d s i g # dsa−s h a 1 " / > < R e f e r e n c e URI= " #AI−NDS−HGI−18378667 " > <Transforms> < T r a n s f o r m A l g o r i t h m = " h t t p : / / www. w3 . o r g / 2 0 0 1 / 1 0 / xml−exc−c14n # " / > < / Transforms> < D i g e s t M e t h o d A l g o r i t h m = " h t t p : / / www. w3 . o r g / 2 0 0 0 / 0 9 / x m l d s i g # s h a 1 " / > < D i g e s t V a l u e >+e0UhqPaZkX7+5 x V r b g 5 0 I T c h 2 I =< / D i g e s t V a l u e > </ Reference> +< R e f e r e n c e URI= " # S i g n e d P r o p e r t i e s −11626165 " >< / R e f e r e n c e > +< R e f e r e n c e URI= " # U n s i g n e d P r o p e r t i e s −25392791 " >< / R e f e r e n c e > </ SignedInfo> < S i g n a t u r e V a l u e >SVlS9m97Q0t12pi . . . . . < / S i g n a t u r e V a l u e > <KeyInfo> <X509Data > < X 5 0 9 C e r t i f i c a t e >MIIC3DCCApoCBEY1 . . . . . < / X 5 0 9 C e r t i f i c a t e > < / X509Data > <KeyValue > <DSAKeyValue> <P> / X9TgR11EilS30qcLuz . . . . . < / P> <Q>l2BQjxUjC8yykrmCouuEC /BYHPU=< / Q> <G>9+ GghdabPd7LvKtc . . . . . < / G> <Y>OglcRuqvCSTioZQ . . . . . < / Y> < / DSAKeyValue> < / KeyValue > < / KeyInfo> +< O b j e c t >< / O b j e c t > </ Signature> < / nds:RootElement> Figure 2.2: XMLDSIG example The required SignedInfo element is the information that is actually signed. Core validation of SignedInfo consists of two mandatory processes: validation of the signature over SignedInfo and validation of each 7
  • 16. Reference digest within SignedInfo. Note that the algorithms used in calculating the SignatureValue are also included in the signed information while the SignatureValue element is outside SignedInfo. The CanonicalizationMethod is the algorithm that is used to canonicalize the SignedInfo element before it is digested as part of the signature operation. Note that the example in Figure 2.2 , as well as all examples in this specification, are not in canonical form. 2.3.2 XAdES- XML Advanced Electronic Signature An XML Advanced Electronic Signature [XAdES][ESI-XAdES] is illustrated in Figure 2.3 . Figure 2.3: Advanced Electronic Signature(XAdES) The XML Advanced Electronic Signature (XAdES)- its format is the one defined in [XMLDSIG] with the addition of signed properties (SigningTime, SigningCertificate, SignaturePolicyIdentifier, SignaturePro- ductionPlace, SignerRole, AllDataObjectsTimeStamp, IndividualDataObjectsTimeStamp, DataObjectFor- mat and CommitmentTypeIndication) and unsigned properties (CounterSignature) (where "?" denotes zero or one occurrence; "+" denotes one or more occurrences; and "*" denotes zero or more occurrences): 8
  • 17. XMLDSIG | < d s : S i g n a t u r e ID ? >− − − − − − − − −+− − − − −+ <ds:SignedInfo> | | <ds:CanonicalizationMethod /> | | <ds:SignatureMethod / > | | ( < d s : R e f e r e n c e URI? > | | (<ds:Transforms>)? | | <ds:DigestMethod> | | <ds:DigestValue> | | < / d s : R e f e r e n c e >)+ | | </ ds:SignedInfo> | | <ds:SignatureValue> | | ( < d s : K e y I n f o >)?− − − − − − − − − + | | <ds:Object> | | <QualifyingProperties> | | <SignedProperties> | | <SignedSignatureProperties> | ( SigningTime ) | ( SigningCertificate ) | ( SignaturePolicyIdentifier ) | ( SignatureProductionPlace )? | ( SignerRole )? | </ SignedSignatureProperties> | | <SignedDataObjectProperties> | ( DataObjectFormat )∗ | ( CommitmentTypeIndication )∗ | ( AllDataObjectsTimeStamp )∗ | ( IndividualDataObjectsTimeStamp )∗ | </ SignedDataObjectProperties> | | </ SignedProperties> | | <UnsignedProperties> | | <UnsignedSignatureProperties> | ( CounterSignature )∗ | </ UnsignedSignatureProperties> | | </ UnsignedProperties> | | </ QualifyingProperties> | | </ ds:Object> | | < / d s : S i g n a t u r e >− − − − − − − − − − − − − − − + | XAdES Figure 2.4: XAdES Specification 9
  • 18. 3 XAdES Elements 3.1 Overview The reader shall understand that, there are several requirements for the sake of the proper run of the project library. The original OpenSource Apache XML Security Project can be found at: http://santuario.apache.org/Java/index.html , where the developer can find the source and binary packages ( http://xml.apache.org/security/dist/ ) and important installation notes( http://santuario.apache.org/Java/installation.html) Our project library is tested on the former version of the Apache XMLSec Project- v1.3.0. Furthermore, the Apache Project is created as an ’Eclipse Java Project’ and we use Sun JDK 1.5.0_11. For the reader concerned, regarding the implementation of the Project, using JDK 1.4.x (only Windows NT 4.0 and old Unix-based distributions with kernel 2.4.x) please refer to the installation site of the project. The developer must be aware of the following facts: • Copy all files from ’xml-security-bin-1_3_0/xml-security-1_3_0/libs’ to the ’xml-security-src-1_3_0/ xml-security-1_3_0/libs’, so the Apache XMLSec Project( xml-security-src-1_3_0) can be loaded as a standard Eclipse Java Project and properly run, • In the new Eclipse Java Project load the JUnit 3.8.1 library, so the XAdES JUnit tests can be executed. We didn’t test our project library with the current version of JUnit namely version 4.1. We decided to separate the XAdES library package (.../xml-security-src-1_3_0/xml-security-src-1_3_0/ xml-security-1_3_0/src-xades/ ) in the following sub-packages: • ’.../input/ ’- where the Java Keystore data is specified; • ’.../doc/’- where the JavaDoc shall be found, • ’.../org/apache/xml/security/xades/ ’- where the user can find the source code of our XAdES library; the following Java classes are important for the discussion in this introduction to the thesis: – QualifyingProperties- the fundamental XAdES element, which embeds all qualifying properties of an Advanced XML Signature; The QualifyingProperties is a child element of Object (one of the four base XAdES elements-’SignedInfo’, ’SignatureValue’, ’KeyInfo’ and ’Object’); if we regret the use of the Object element, then an Advanced Electronic Signature cannot be built, because the other sub-elements: ’SignedInfo’, ’SignatureValue’, ’KeyInfo’ in their selves do not fulfill completely the XAdES specifi- cation , – Constants- all used constants for the different types of elements/attributes, namespaces, al- gorithms’ descriptions are defined, • ’.../org/apache/xml/security/xades/sp’- the SignedProperties XAdES element and its sub- elements ( conform to the XMLDSIG notation) are specified, • ’.../org/apache/xml/security/xades/up’- the user shall find all the classes, which describe the basic child-element UnsignedProperties( of the QualifyingProperties) and its sub-elements, which are optional( see further) 10
  • 19. • ’.../org/apache/xml/security/xades/tests’- where we have specified all Signature-creation tests and the JUnit tests: – The class CreateSignatureSDOPalland- every single element of the XAdES notation is created, so the XML notation of XAdES is fully described. The output is can be found in : /xml- security-src-1_3_0/xml-security-1_3_0/signature.xml (see Appendix A - XAdES specification) – The class CreateSignatureSignedSignatureProperties- where the XAdES-BES specification is implemented: the basic child-element of QualifyingProperties- SignedProperties, with its sub- element: SignedSignatureProperties, further its child-elements: SigningTime, SigningCertificate, SignaturePolicyIdentifier, which are all required elements in the XAdES notation. The output is illustrated in : /xml-security-src- 1_3_0/xml-security-1_3_0/signature1.xml (see Appendix B- XAdES-BES) – The class CreateSignatureMoreThanOneElements- according to the XAdES specifi- cation, XML elements, which can occur min. ’0’ and max. ’unbounded’, e.g. more than one el- ements from the same type are allowed to exist, are demonstrated for their multiple use. The out- put for this case is represented due : /xml-security-src-1_3_0/xml-security-1_3_0/signature2.xml (see Appendix C- XAdES More than one element) – The class JUtests- where we specify the different JUnit tests on our library, separated in two general sections: • positive tests- which illustrate the verification of the first three classes( CreateSignatureSDOPalland,CreateSignatureSignedSignatureProper- ties, CreateSignatureMoreThanOneElements) • negative tests- which verify the right implementation of all required elements of the XAdES notation in the project library (refer to the separate explanation on every test in the further sections of the thesis); if the library is able to create the signature without using a required element, nor giving an IllegalArgumentException the particular negative test shall fail. Now let’s concentrate more detailed on every one XML element of the XAdES notation with its specific use, structure and its implementation in the project library. 11
  • 20. 3.2 QualifyingProperties The basic element of Object is the QualifyingProperties element, which contains the whole qual- ifying information for the Advanced Electronic Signature. This element has the following structure: < x s d : e l e m e n t name= " Q u a l i f y i n g P r o p e r t i e s " type =" Q u a l i f y i n g P r o p e r t i e s T y p e " / > < x s d : c o m p l e x T y p e name= " Q u a l i f y i n g P r o p e r t i e s T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " S i g n e d P r o p e r t i e s " t y p e = " S i g n e d P r o p e r t i e s T y p e " minOccurs=" 0 " / > < x s d : e l e m e n t name= " U n s i g n e d P r o p e r t i e s " t y p e = " U n s i g n e d P r o p e r t i e s T y p e " minOccurs=" 0 " / > </ xsd:sequence> < x s d : a t t r i b u t e name= " T a r g e t " t y p e = " x s d : a n y U R I " u s e = " r e q u i r e d " / > < x s d : a t t r i b u t e name= " I d " t y p e = " x s d : I D " u s e = " o p t i o n a l " / > < / xsd:complexType> Figure 3.1: QualifyingProperties The QualifyingProperties element is extended by its two general sub-elements - the SignedProperties and the UnsignedProperties. The main function of the SignedProperties is to contribute to the cryptographic justification of the XML signature, while the UnsignedProperties is required, generally for an embracement of all variations of the XAdES nota- tion (XAdES, XAdES-T, XAdES-C, XAdES-X, XAdES-A1 and to illustrate all kind of different cases by creating Advanced Electronic signature: single signer - one signature; parallel signer without requirement of ordering for signing the sensitive data, multiple signer with ordering by signing the electronic document . The SignedProperties must be protected by a Reference element in SignedInfo and must ap- pear only once within the QualifyingProperties.The Target attribute is required and it’s used as a reference to the XML signature, and the optional Id attribute references to the container of the QualifyingProperties element. 1 /∗∗ 2 ∗ Method s e t S i g n e d P r o p e r t i e s 3 ∗ 4 ∗ @param s p 5 ∗/ 6 public void s e t S i g n e d P r o p e r t i e s ( S i g n e d P r o p e r t i e s sp ) { 7 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( s p ! = n u l l ) ) 8 { 9 t h i s . _ c o n s t r u c t i o n E l e m e n t . appendChild ( sp . getElement ( ) ) ; 10 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 11 } 12 } Figure 3.2: Method setSignedProperties 1 http://www.w3.org/TR/XAdES/ 12
  • 21. 1 /∗∗ 2 ∗ 3 ∗ Method s e t U n s i g n e d P r o p e r t i e s 4 ∗ 5 ∗ @param u s p 6 ∗/ 7 publ ic void s e t U n s i g n e d P r o p e r t i e s ( U n s i g n e d P r o p e r t i e s usp ) 8 { if 9 ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( u s p ! = n u l l ) ) 10 { 11 t h i s . _ c o n s t r u c t i o n E l e m e n t . appendChild ( usp . getElement ( ) ) ; 12 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 13 } 14 } Figure 3.3: Method setUnsignedProperties The two child-elements - SignedProperties and UnsignedProperties, are created using a set-Method. Because of their occurrence, it is necessary to define the conditions: 1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)); 2. And also, whether the XML-element (SignedProperties,UnsignedProperties) is not an empty one((sp != null)or (usp != null)); If any one of these both statements is not fulfilled, no child-element of QualifyingProperties would be created. 1 2 /∗∗ 3 ∗ S e t s t h e <code >T a r g e t </ code > a t t r i b u t e 4 ∗ 5 ∗ @param T a r g e t ( anyURI ) 6 ∗ @throws I l l e g a l A r g u m e n t E x c e p t i o n ∗∗∗∗ b e c a u s e o f " u s e= r e q u i r e d " ∗∗∗∗ 7 ∗/ 8 public void s e t T a r g e t ( S t r i n g Target ) { 9 i f ( T a r g e t == n u l l ) { throw new 10 IllegalArgumentException ( " Target Attibute is required ! " ) ; 11 } 12 e l s e i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( T a r g e t ! = n u l l ) ) { 13 this . _constructionElement . setAttributeNS 14 ( n u l l , C o n s t a n t s . _ATT_TARGET , T a r g e t ) ; 15 } 16 } Figure 3.4: Method setTarget 13
  • 22. The Target Attribute, as we already mentioned above, is a required one. Within a set-Method two general cases are tested: 1. First of all, whether this attribute is an empty one (which is forbidden), so an IllegalArgumentExcep- tion should be executed with the relevant message. 1 i f ( T a r g e t == n u l l } ) { 2 throw b f new I l l e g a l A r g u m e n t E x c e p t i o n ( " T a r g e t A t t i b u t e i s 3 required ! " ); 4 } 2. Second of all, whether the present state of the signature-creation is -"Signing Mode"((this._state == MODE_SIGN)), and whether the attribute is not an empty one((Target != null)); At the end, we shall mention this requirement of the Target attribute, as a test-case (JUnit test), which is implemented in our project library as a JUnit negative test ("testNeg_QP_Target_required"), refers to class JUtests in the package org.apache.xml.security.xades.tests. 3.3 SignedProperties The SignedProperties has two elements - SignedSignatureProperties and SignedDataObjectProperties. The SignedSignatureProperties element is required and must occur only once within the SignedProperties. The other sub-element of the SignedProperties, SignedDataObjectProperties, is optional and contains elements that can appear one or more than once in the XML signature, which is good illustrated in our JUnit tests. The schema definition of SignedProperties element as it follows: < x s d : e l e m e n t name= " S i g n e d P r o p e r t i e s " t y p e = " S i g n e d P r o p e r t i e s T y p e " / > < x s d : c o m p l e x T y p e name= " S i g n e d P r o p e r t i e s T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " S i g n e d S i g n a t u r e P r o p e r t i e s " type =" S i g n e d S i g n a t u r e P r o p e r t i e s T y p e " / > < x s d : e l e m e n t name= " S i g n e d D a t a O b j e c t P r o p e r t i e s " t y p e =" S i g n e d D a t a O b j e c t P r o p e r t i e s T y p e " minOccurs=" 0 " / > </ xsd:sequence> < x s d : a t t r i b u t e name= " I d " t y p e = " x s d : I D " u s e = " o p t i o n a l " / > < / xsd:complexType> Figure 3.5: SignedProperties 14
  • 23. 1 /∗∗ 2 ∗ Method s e t S i g n e d S i g n a t u r e P r o p e r t i e s 3 ∗ 4 ∗ @param s s p 5 ∗/ 6 public void s e t S i g n e d S i g n a t u r e P r o p e r t i e s ( S i g n e d S i g n a t u r e P r o p e r t i e s ssp ) { 7 i f ( s s p == n u l l ) { 8 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( 9 " S i g n e d S i g n a t u r e P r o p e r t i e s Element i s r e q u i r e d ! " ) ; 10 } 11 e l s e i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( s s p ! = n u l l ) ) { 12 t h i s . _constructionElement . appendChild ( ssp . getElement ( ) ) ; 13 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 14 } 15 } 16 17 /∗∗ 18 ∗ Method s e t S i g n e d D a t a O b j e c t P r o p e r t i e s 19 ∗ 20 ∗ @param s d o p 21 ∗/ 22 p u b l i c void s e t S i g n e d D a t a O b j e c t P r o p e r t i e s ( S i g n e d D a t a O b j e c t P r o p e r t i e s sdop ) { 23 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( s d o p ! = n u l l ) ) { 24 t h i s . _ c o n s t r u c t i o n E l e m e n t . appendChild ( sdop . getElement ( ) ) ; 25 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 26 } 27 } Figure 3.6: Methods setSignedSignatureProperties, setSignedDataObjectProperties The two child-elements - SignedSignatureProperties and SignedDataObjectProperties, are created using a set-Method. Because of their different way of occurrence, it is necessary to define the following conditions: 1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)); 2. And also, whether the XML-element (SignedSignatureProperties, SignedDataObjectProperties) is not an empty one((ssp != null)or (sdop != null)); If any one of these both statements is not fulfilled, no child-element of SignedProperties would be created. By the SignedSignatureProperties element we use the JUnit test to demonstrate the obligatorily occurrence, with other words: if this element is an empty one, an IllegalArgumentException should be executed with the relevant message. 1 i f ( s s p == n u l l } { 2 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g n e d S i g n a t u r e P r o p e r t i e s E l e m e n t i s 3 required ! " ); 4 } Refers to the negative JUnit test testNeg_SignedSignatureProperties in org.apache.xml.security.xades.tests.JUtests. 15
  • 24. 3.4 UnsignedProperties The UnsignedProperties element and its sub-elements are not signed by the [XMLDSIG] signature. They are divided on *SignatureProperties and *DataObjectProperties just like the SignedProperties. < x s d : e l e m e n t name= " U n s i g n e d P r o p e r t i e s " t y p e = " U n s i g n e d P r o p e r t i e s T y p e " / > < x s d : c o m p l e x T y p e name= " U n s i g n e d P r o p e r t i e s T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " U n s i g n e d S i g n a t u r e P r o p e r t i e s " t y p e =" U n s i g n e d S i g n a t u r e P r o p e r t i e s T y p e " minOccurs=" 0 " / > < x s d : e l e m e n t name= " U n s i g n e d D a t a O b j e c t P r o p e r t i e s " t y p e =" U n s i g n e d D a t a O b j e c t P r o p e r t i e s T y p e " minOccurs=" 0 " / > </ xsd:sequence> < x s d : a t t r i b u t e name= " I d " t y p e = " x s d : I D " u s e = " o p t i o n a l " / > < / xsd:complexType> Figure 3.7: UnsignedProperties In this case we can make a reference to the UnsignedProperties element using the optional Id attribute. The two child-elements - UnsignedSignatureProperties and UnsignedDataObjectProperties, are created using a set-Method. Because of their occurrence, it is necessary to define the following conditions: 1. It should not be proved, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)), because the UnsignedProperties element consists of "chil- dren", that are not signed by the XMLDSIG signature; 2. So it appears only one condition to be proved, whether the XML-element (UnsignedSignatureProperties, UnsignedDataObjectProperties) is not an empty one((ussp != null)or (usdop != null)); 1 /∗∗ 2 ∗ Method s e t U n s i g n e d S i g n a t u r e P r o p e r t i e s 3 ∗ 4 ∗ @param u s s p 5 ∗/ 6 public void s e t U n s i g n e d S i g n a t u r e P r o p e r t i e s ( U n s i g n e d S i g n a t u r e P r o p e r t i e s ussp ) { 7 i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( u s s p ! = n u l l ) ) { 8 t h i s . _constructionElement . appendChild ( ussp . getElement ( ) ) ; 9 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 10 } 11 } Figure 3.8: Method setUnsignedSignatureProperties 16
  • 25. 1 /∗∗ 2 ∗ Method s e t U n s i g n e d D a t a O b j e c t P r o p e r t i e s 3 ∗ 4 ∗ @param u s d o p 5 ∗/ 6 p u b l i c void s e t U n s i g n e d D a t a O b j e c t P r o p e r t i e s ( U n s i g n e d D a t a O b j e c t P r o p e r t i e s usdop ) { 7 i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( u s s p ! = n u l l ) ) { 8 t h i s . _ c o n s t r u c t i o n E l e m e n t . appendChild ( usdop . get El eme nt ( ) ) ; 9 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 10 } 11 } Figure 3.9: Method setUnsignedDataObjectProperties If the statement mentioned above, is not fulfilled, no child-element of UnsignedProperties would be created. 3.5 SignedSignatureProperties The SignedSignatureProperties has three required Elements (SigningTime, SigningCertificate, SignaturePolicyIdentifier) and two optional ones (SignatureProductionPlace, SignerRole).The XAdES-BES specification is applied through the SigningTime, SigningCertificate, SignaturePolicyIdentifier elements. < x s d : e l e m e n t name= " S i g n e d S i g n a t u r e P r o p e r t i e s " type =" S i g n e d S i g n a t u r e P r o p e r t i e s T y p e " / > < x s d : c o m p l e x T y p e name= " S i g n e d S i g n a t u r e P r o p e r t i e s T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " S i g n i n g T i m e " t y p e = " x s d : d a t e T i m e " / > < x s d : e l e m e n t name= " S i g n i n g C e r t i f i c a t e " t y p e = " C e r t I D L i s t T y p e " / > < x s d : e l e m e n t name= " S i g n a t u r e P o l i c y I d e n t i f e r " type =" S i g n a t u r e P o l i c y I d e n t i f i e r T y p e " / > < x s d : e l e m e n t name= " S i g n a t u r e P r o d u c t i o n P l a c e " t y p e =" S i g n a t u r e P r o d u c t i o n P l a c e T y p e " minOccurs=" 0 " / > < x s d : e l e m e n t name= " S i g n e r R o l e " t y p e = " S i g n e r R o l e T y p e " m i n O c c u r s = " 0 " / > </ xsd:sequence> < / xsd:complexType> Figure 3.10: SignedSignatureProperties The child-elements of the SignedSignatureProperties are added, using a constructor. As men- tioned above, the SigningTime, SigningCertificate and SignaturePolicyIdentifier elements are required. Thorough, their occurrence is tested: if one of these obligatory elements is missing, an IllegalArgumentException should be executed with the relevant message: 17
  • 26. 1 i f ( s i g n i n g t i m e == n u l l } | | ( s i g n i n g c e r t i f i c a t e == n u l l } | | ( 2 s i g n a t u r e p o l i c y i d e n t i f i e r == n u l l ) 3 { 4 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " Wrong E l e m e n t V a l u e ! " ) ; 5 } Refers to the negative JUnit tests testNeg_SigningTime, testNeg_SigningCertificate and testNeg_SignaturePolicyIdentifier and to the positive JUnit test testPositive_SignedSignatureProperties_Elements_required in org.apache.xml.security.xades.tests.JUtests. The same statements are used to prove that the present phase of signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)), and the XML-element (SigningTime, SigningCertificate and SignaturePolicyIdentifier) is not an empty one((signingtime!= null)or (signingcertificate!= null)) or ((signaturepolicyidentifier!= null)).Likewise, for the other two elements the tested conditions are, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)), and also whether the XML-element ( SignatureProductionPlace, SignerRole) is not an empty one ((signatureproductionplace! = null) or (signerrole! = null)); 18
  • 27. 1 /∗∗ 2 ∗ Constructor SignedSignatureProperties 3 ∗ 4 ∗ @param doc 5 ∗ @param s i g n i n g t i m e S i g n i n g T i m e 6 ∗ @param s i g n i n g c e r t i f i c a t e S i g n i n g C e r t i f i c a t e 7 ∗ @param s i g n a t u r e p o l i c y i d e n t i f i e r S i g n a t u r e P o l i c y I d e n t i f i e r 8 ∗ @param s i g n a t u r e p r o d u c t i o n p l a c e S i g n a t u r e P r o d u c t i o n P l a c e 9 ∗ @param s i g n e r r o l e S i g n e r R o l e 10 ∗/ 11 p u b l i c S i g n e d S i g n a t u r e P r o p e r t i e s ( Document doc , S i g n i n g T i m e s i g n i n g t i m e , 12 SigningCertificate signingcertificate , SignaturePolicyIdentifier 13 signaturepolicyidentifier , SignatureProductionPlace 14 signatureproductionplace , SignerRole s i g n e r r o l e ) { 15 s u p e r ( doc ) ; 16 i f ( s i g n i n g t i m e == n u l l | | s i g n i n g c e r t i f i c a t e == n u l l | | 17 s i g n a t u r e p o l i c y i d e n t i f i e r == n u l l ) 18 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " Wrong E l e m e n t V a l u e ! " ) ; 19 20 t h i s . _constructionElement . appendChild ( signingtime . getElement ( ) ) ; 21 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 22 23 t h i s . _constructionElement . appendChild ( s i g n i n g c e r t i f i c a t e . getElement ( ) ) ; 24 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 25 26 t h i s . _constructionElement . appendChild ( s i g n a t u r e p o l i c y i d e n t i f i e r . getElement ( ) ) ; 27 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 28 29 i f ( ( s i g n a t u r e p r o d u c t i o n p l a c e != n u l l ) { 30 t h i s . _constructionElement . appendChild ( s i g n a t u r e p r o d u c t i o n p l a c e . getElement ( ) ) ; 31 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 32 } 33 i f ( s i g n e r r o l e != n u l l ) { 34 t h i s . _constructionElement . appendChild ( s i g n e r r o l e . getElement ( ) ) ; 35 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 36 } 37 } Figure 3.11: Contructor SignedSignatureProperties 3.6 SignedDataObjectProperties SignedDataObjectProperties contains sub- elements that qualify some of the signed data objects. DataObjectFormat, CommitmentTypeIndication, AllDataObjectsTimeStamp, IndividualDataObjectsTimeStamp can occur more than once within the SignedDataObjectProperties elements. All these properties qualify the signed data object after all the required transforms have been made. 19
  • 28. < x s d : e l e m e n t name= " S i g n e d D a t a O b j e c t P r o p e r t i e s " type =" SignedDataObjectPropertiesType " / > < x s d : c o m p l e x T y p e name= " S i g n e d D a t a O b j e c t P r o p e r t i e s T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " D a t a O b j e c t F o r m a t " t y p e = " D a t a O b j e c t F o r m a t T y p e " m i n O c c u r s = " 0 " maxOccurs = " unbounded " / > < x s d : e l e m e n t name= " C o m m i t m e n t T y p e I n d i c a t i o n " t y p e =" CommitmentTypeIndicationType " minOccurs=" 0 " maxOccurs = " unbounded " / > < x s d : e l e m e n t name= " A l l D a t a O b j e c t s T i m e S t a m p " t y p e = " TimeStampType " m i n O c c u r s = " 0 " maxOccurs = " unbounded " / > < x s d : e l e m e n t name= " I n d i v i d u a l D a t a O b j e c t s T i m e S t a m p " t y p e = " TimeStampType " m i n O c c u r s = " 0 " maxOccurs = " unbounded " / > </ xsd:sequence> < / xsd:complexType> Figure 3.12: SignedDataObjectProperties 1 /∗∗ 2 ∗ Method s e t D a t a O b j e c t F o r m a t 3 ∗ 4 ∗ @param d a t a o b j e c t f o r m a t 5 ∗/ 6 public void setDataObjectFormat ( DataObjectFormat d a t a o b j e c t f o r m a t ) { 7 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( d a t a o b j e c t f o r m a t ! = n u l l ) ) { 8 t h i s . _constructionElement . appendChild ( d a t a o b j e c t f o r m a t . getElement ( ) ) ; 9 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 10 } 11 } 12 /∗∗ 13 ∗ Method s e t C o m m i t m e n t T y p e I n d i c a t i o n 14 ∗ 15 ∗ @param c o m m i t m e n t t y p e i n d i c a t i o n 16 ∗/ 17 public void setCommitmentTypeIndication ( CommitmentTypeIndication 18 commitmenttypeindication ) { 19 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( c o m m i t m e n t t y p e i n d i c a t i o n ! = n u l l ) ) { 20 t h i s . _constructionElement . appendChild ( commitmenttypeindication . getElement ( ) ) ; 21 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 22 } 23 } Figure 3.13: Methods setCommitmentTypeIndication, setDataObjectFormat 20
  • 29. 1 /∗∗ 2 ∗ Method s e t A l l D a t a O b j e c t s T i m e S t a m p 3 ∗ 4 ∗ @param a l l d a t a o b j e c t s t i m e s t a m p 5 ∗/ 6 public void setAllDataObjectsTimeStamp ( AllDataObjectsTimeStamp 7 alldataobjectstimestamp ) { 8 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&&( a l l d a t a o b j e c t s t i m e s t a m p ! = n u l l ) ) 9 { t h i s . _constructionElement . appendChild ( a l l d a t a o b j e c t s t i m e s t a m p . getElement ( ) ) ; 10 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 11 } 12 } 13 14 /∗∗ 15 ∗ Method s e t I n d i v i d u a l D a t a O b j e c t s T i m e S t a m p 16 ∗ 17 ∗ @param i n d i v i d u a l d a t a o b j e c t s t i m e s t a m p 18 ∗/ 19 public void setIn dividual DataObje ctsTimeS tamp ( IndividualDataObjectsTimeStamp 20 individualdataobjectstimestamp ) { 21 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( i n d i v i d u a l d a t a o b j e c t s t i m e s t a m p ! = 22 null )){ 23 t h i s . _constructionElement . appendChild 24 ( ind ivid uald ata obje ctst imes tamp . getElement ( ) ) ; 25 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 26 } 27 } Figure 3.14: Methods setAllDataObjectsTimeStamp, setIndividualDataObjectsTimeStamp The child-elements - DataObjectFormat, CommitmentTypeIndicationType, AllDataObjectsTimeStamp and IndividualDataObjectsTimeStamp, are created using a set- Method. Because of their occurrence, it is necessary to define the following conditions: 1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)); 2. And also, whether the XML-element (DataObjectFormat, CommitmentTypeIndicationType, AllDataObjectsTimeStamp and IndividualDataObjectsTimeStamp) is not an empty one((dataobjectformat!= null), (commitmenttypeindication!= null), (alldataobjectstimestamp != null), (individualdataobjectstimestamp != null)); If any one of these both statements is not fulfilled, no child-element of SignedDataObjectProperties would be created. 3.7 UnsignedSignatureProperties The UnsignedSignatureProperties element contains CounterSignature, SignatureTimeStamp, CompleteCertificateRefs, CompleteCertificateRefs, SigAndRefsTimeStamp, RefsOnlyTimeStamp, CertificateValues, RevocationValues, ArchiveTimeStamp. In our Project we will pay attention only to the CounterSignature element, because of the structure of XAdES. This will be discussed more detailed in section 3.17. 21
  • 30. < x s d : e l e m e n t name= " U n s i g n e d S i g n a t u r e P r o p e r t i e s " type =" U n s i g n e d S i g n a t u r e P r o p e r t i e s T y p e " / > < x s d : c o m p l e x T y p e name= " U n s i g n e d S i g n a t u r e P r o p e r t i e s T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " C o u n t e r S i g n a t u r e " t y p e = " C o u n t e r S i g n a t u r e T y p e " m i n O c c u r s = " 0 " maxOccurs = " unbounded " / > < x s d : e l e m e n t name= " S i g n a t u r e T i m e S t a m p " t y p e = " TimeStampType " m i n O c c u r s = " 0 " maxOccurs = " unbounded " / > < x s d : e l e m e n t name= " C o m p l e t e C e r t i f i c a t e R e f s " t y p e =" C o m p l e t e C e r t i f i c a t e R e f s T y p e " minOccurs=" 0 " / > < x s d : e l e m e n t name= " C o m p l e t e R e v o c a t i o n R e f s " t y p e =" CompleteRevocationRefsType " minOccurs=" 0 " / > <xsd:choice> < x s d : e l e m e n t name= " SigAndRefsTimeStamp " t y p e = " TimeStampType " m i n O c c u r s = " 0 " maxOccurs = " unbounded " / > < x s d : e l e m e n t name= " RefsOnlyTimeStamp " t y p e = " TimeStampType " m i n O c c u r s = " 0 " maxOccurs = " unbounded " / > </ xsd:choice> < x s d : e l e m e n t name= " C e r t i f i c a t e V a l u e s " t y p e = " C e r t i f i c a t e V a l u e s T y p e " minOccurs=" 0 " / > < x s d : e l e m e n t name= " R e v o c a t i o n V a l u e s " t y p e = " R e v o c a t i o n V a l u e s T y p e " minOccurs=" 0 " / > < x s d : e l e m e n t name= " A r c h i v e T i m e S t a m p " t y p e = " TimeStampType " m i n O c c u r s = " 0 " maxOccurs = " unbounded " / > </ xsd:sequence> < / xsd:complexType> Figure 3.15: UnsignedSignatureProperties Only the CounterSignature element, using a set-Method, is specified, because the other sub-elements of the UnsignedSignatureProperties are not included in the XAdES XML structure. Note, that only the value of the element is tested, because the "children" of UnsignedProperties element, are not signed by the XMLDSIG signature. 1 /∗∗ 2 ∗ Method s e t C o u n t e r S i g n a t u r e 3 ∗ @param s i g n a t u r e 4 ∗/ 5 public void s e t C o u n t e r S i g n a t u r e ( C o u n t e r S i g n a t u r e signature ) { 6 i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( s i g n a t u r e ! = n u l l ) ) { 7 t h i s . _constructionElement . appendChild ( s i g n a t u r e . getElement ( ) ) ; 8 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 9 } 10 } Figure 3.16: Method setCounterSignature 22
  • 31. 3.8 The SigningTime element The SigningTime element is meant for showing the date and time at which the signer has created the signed XML signature. It is a sub-element of SignedSignatureProperties and in view of that contributes for the cryptographic justification of the XML signature. This element must occur exactly once within the signature. However the SigningTime can take only the local time of the computer on which the signature is created. The definition of this element, as it follows: < x s d : e l e m e n t name= " S i g n i n g T i m e " t y p e = " x s d : d a t e T i m e " / > Figure 3.17: SigningTime 1 /∗∗ 2 ∗ Constructor SigningTime 3 ∗ 4 ∗ @param doc 5 ∗ @param d a t e T i m e 6 ∗/ 7 p u b l i c S i g n i n g T i m e ( Document doc , D a t e d a t e T i m e ) { 8 s u p e r ( doc ) ; 9 t h i s . a d d T e x t ( toXMLDate ( d a t e T i m e ) . t o S t r i n g ( ) ) ; 10 } Figure 3.18: Constructor SigningTime The SigningTime is created using a specific constructor, with two variables doc and dateTime. For this function we use the javax.xml.datatype.XMLGregorianCalendar and java.util.GregorianCalendar libraries. 23
  • 32. 3.9 The SigningCertificate element Using the SigningCertificate element could be avoided a simple substitution of the certificate. As sub-elements, it has the CertDigest and IssuerSerial elements, which consist of references to the DigestMethod URI and DigestValue, as well as a reference to the X509IssuerSerial (X509IssuerName, X509SerialNumber).Just like the SigningTime element, SigningCertificate is sub-element of the SignedSignatureProperties, its use is required and must appear only once. Below follows the schema definition: < x s d : e l e m e n t name= " S i g n i n g C e r t i f i c a t e " t y p e = " C e r t I D L i s t T y p e " / > < x s d : c o m p l e x T y p e name= " C e r t I D L i s t T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " C e r t " t y p e = " C e r t I D T y p e " maxOccurs = " unbounded " / > </ xsd:sequence> < / xsd:complexType> < x s d : c o m p l e x T y p e name= " C e r t I D T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " C e r t D i g e s t " t y p e = " D i g e s t A l g A n d V a l u e T y p e " / > < x s d : e l e m e n t name= " I s s u e r S e r i a l " t y p e = " d s : X 5 0 9 I s s u e r S e r i a l T y p e " / > </ xsd:sequence> < / xsd:complexType> < x s d : c o m p l e x T y p e name= " D i g e s t A l g A n d V a l u e T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " D i g e s t M e t h o d " t y p e = " d s : D i g e s t M e t h o d T y p e " / > < x s d : e l e m e n t name= " D i g e s t V a l u e " t y p e = " d s : D i g e s t V a l u e T y p e " / > </ xsd:sequence> < / xsd:complexType> Figure 3.19: SigningCertificate The SigningCertificate element is created using a set-Method, and because of its type is specified as CertIDList ("(CertIDList SigningCertificate)").Again it is necessary to define the following condi- tions: 1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)); 2. And also, whether the XML-element (SigningCertificate) is not an empty one ((SigningCertificate!= null); If any one of these both statements is not fulfilled, no SigningCertificate element would be cre- ated. This shall be illustrated in the next table: 24
  • 33. 1 /∗∗ 2 ∗ Method s e t S i g n i n g C e r t i f i c a t e 3 ∗ 4 ∗ @param S i g n i n g C e r t i f i c a t e 5 ∗/ 6 public void s e t S i g n i n g C e r t i f i c a t e ( C e r t I D L i s t S i g n i n g C e r t i f i c a t e ) { 7 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g n i n g C e r t i f i c a t e ! = n u l l ) ) { 8 t h i s . _constructionElement . appendChild ( S i g n i n g C e r t i f i c a t e . getElement ( ) ) ; 9 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 10 } 11 } Figure 3.20: Method setSigningCertificate 3.10 The SignaturePolicyIdentifier element The SignaturePolicyIdentifier is a combination of norms for the build up and validation of a sig- nature, so the validity of the signature can be confirmed. The uniqueness of the signer is protected, through a hash value of the signature policy. Moreover the implementation of the SignaturePolicyIdentifier element prevents the hash value and the identifier to be faked, thus it proves the globally unique reference of the signature policy to the XML signature and the signer as a part of the signature computation. With the SigningTime and the SigningCertificate elements it defines the XAdES-BES format. Only one SignaturePolicyIdentifier element must occur within the SignedSignatureProperties.On the next page follows the schema definition for this type, see Fig- ure 3.22 . There are two options for using the elements of the SignaturePolicyIdentifier: 1. SignaturePolicyId has four sub-elements- SigPolicyId, Transforms, SigPolicyHash, SigPolicyQualifiers. • SigPolicyId is required and it specifies the Identifier, Description and the DocumentationReferences elements, which uniquely designates the specific version of the signature policy. • The Transforms element references to the Transforms in the SignedInfo. • SigPolicyHash consists of two sub-elements- DigestMethod Algorithm, identifier of the hash algorithm, and the DigestValue - hash value of the signature policy. • Within the SigPolicyQualifiers extra information, qualifying the policy identifier can appear. 2. SignaturePolicyImplied Alternatively, an empty SignaturePolicyImplied element confirms that the data object(s) be- ing signed and other external data designate the signature policy. The SignaturePolicyId element is added as a child-element of the SignaturePolicyIdentifier, using a set-Method. Because of its specific type this element is de- fined as SignaturePolicyIdType. Like the other SignedProperties is necessary to define the following conditions: 25
  • 34. < x s d : e l e m e n t name= " S i g n a t u r e P o l i c y I d e n t i f i e r " type =" S i g n a t u r e P o l i c y I d e n t i f i e r T y p e " / > <xsd:complexType name= " S i g n a t u r e P o l i c y I d e n t i f i e r T y p e " > <xsd:choice> < x s d : e l e m e n t name= " S i g n a t u r e P o l i c y I d " t y p e = " S i g n a t u r e P o l i c y I d T y p e " / > < x s d : e l e m e n t name= " S i g n a t u r e P o l i c y I m p l i e d " / > </ xsd:choice> < / x s d : c o m p l e x T y p e > < x s d : c o m p l e x T y p e name= " S i g n a t u r e P o l i c y I d T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " S i g P o l i c y I d " t y p e = " O b j e c t I d e n t i f i e r T y p e " / > < x s d : e l e m e n t r e f =" d s : T r a n s f o r m s " minOccurs=" 0 " / > < x s d : e l e m e n t name= " S i g P o l i c y H a s h " t y p e = " D i g e s t A l g A n d V a l u e T y p e " / > < x s d : e l e m e n t name= " S i g P o l i c y Q u a l i f i e r s " t y p e =" S i g P o l i c y Q u a l i f i e r s L i s t T y p e " minOccurs=" 0 " / > </ xsd:sequence> < / xsd:complexType> <xsd:complexType name= " S i g P o l i c y Q u a l i f i e r s L i s t T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " S i g P o l i c y Q u a l i f i e r " t y p e = " AnyType " maxOccurs = " unbounded " / > </ xsd:sequence> < / xsd:complexType> Figure 3.21: SignaturePolicyIdentifier 1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)); 2. And also, whether the XML-element (SignaturePolicyId) is not an empty one ((SignaturePolicyId!= null)); If any one of these both statements is not fulfilled, no SignaturePolicyIdelement would be created. By the SignaturePolicyId element we use the JUnit test to demonstrate the obligatorily occurrence, with other words: if this element is an empty one, an IllegalArgumentException should be executed with the relevant message: 1 i f ( S i g n a t u r e P o l i c y I d == n u l l ) { 2 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g n a t u r e P o l i c y I d E l e m e n t 3 is required ! " ); 4 } 26
  • 35. 1 /∗∗ 2 ∗ Method s e t S i g n a t u r e P o l i c y I d 3 ∗ 4 ∗ @param S i g n a t u r e P o l i c y I d 5 ∗/ 6 public void s e t S i g n a t u r e P o l i c y I d ( S i g n a t u r e P o l i c y I d T y p e S i g n a t u r e P o l i c y I d ){ 7 i f ( S i g n a t u r e P o l i c y I d == n u l l ) { 8 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g n a t u r e P o l i c y I d E l e m e n t 9 is required ! " ); 10 } 11 e l s e i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g n a t u r e P o l i c y I d ! = n u l l ) ) { 12 t h i s . _constructionElement . appendChild ( S i g n a t u r e P o l i c y I d . getElement ( ) ) ; 13 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 14 } 15 } Figure 3.22: Method setSignaturePolicyId Refers to the negative JUnit test testNeg_SignaturePolicyId_Element_required in org.apache.xml.security.xades.tests.JUtests. The following codesamples can illustrate all this ( refer to the class:SignaturePolicyIdType). 1 /∗∗ 2 ∗ Method s e t S i g P o l i c y I d 3 ∗ @param S i g P o l i c y I d 4 ∗/ 5 public void s e t S i g P o l i c y I d ( O b j e c t I d e n t i f i e r S i g P o l i c y I d ){ 6 i f ( S i g P o l i c y I d == n u l l ) { 7 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g P o l i c y I d E l e m e n t i s r e q u i r e d ! " ) ; 8 } 9 e l s e i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g P o l i c y I d ! = n u l l ) ) { 10 t h i s . _constructionElement . appendChild ( SigPolicyId . getElement ( ) ) ; 11 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 12 } 13 } 14 15 /∗∗ 16 ∗ Method s e t S i g P o l i c y H a s h 17 ∗ @param S i g P o l i c y H a s h 18 ∗/ 19 public void s e t S i g P o l i c y H a s h ( DigestAlgAndValue SigPolicyHash ){ 20 i f ( S i g P o l i c y H a s h == n u l l ) { 21 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g P o l i c y H a s h E l e m e n t i s r e q u i r e d ! " ) ; 22 } 23 else i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g P o l i c y H a s h ! = n u l l ) ) { 24 t h i s . _constructionElement . appendChild ( SigPolicyHash . getElement ( ) ) ; 25 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 26 } 27 } Figure 3.23: Methods setSigPolicyId, setSigPolicyHash The child-elements, which define the format SignaturePolicyIdType - SigPolicyId, SigPolicyHash, Transforms, and SigPolicyQualifiers, are all created using set-Methods. Because of their occurrence, it is necessary to define the following conditions: 27
  • 36. 1 /∗∗ 2 ∗ Method s e t T r a n s f o r m s 1 3 ∗ @param t r a n s f o r m s 1 4 ∗/ 5 public void setTransforms1 ( Transforms1 t r a n s f o r m s 1 ){ 6 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( t r a n s f o r m s 1 ! = n u l l ) ) { 7 t h i s . _constructionElement . appendChild ( transforms1 . getElement ( ) ) ; 8 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 9 } 10 } 11 12 /∗∗ 13 ∗ Method s e t S i g P o l i c y Q u a l i f i e r s 14 ∗ 15 ∗ @param S i g P o l i c y Q u a l i f i e r s 16 ∗/ 17 public void s e t S i g P o l i c y Q u a l i f i e r s ( S i g P o l i c y Q u a l i f i e r s L i s t T y p e 18 S i g P o l i c y Q u a l i f i e r s ){ 19 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g P o l i c y Q u a l i f i e r s ! = n u l l ) ) { 20 t h i s . _constructionElement . appendChild ( S i g P o l i c y Q u a l i f i e r s . getElement ( ) ) ; 21 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 22 } 23 } Figure 3.24: Methods setTransforms1, setSigPolicyQualifiers 1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)); 2. And also, whether the XML-element (SigPolicyId, SigPolicyHash, Transforms, and SigPolicyQualifiers) is not an empty one((SigPolicyId != null), (SigPolicyHash != null), (transforms1 != null), (SigPolicyQualifiers != null)); If any one of these both statements is not fulfilled, no child-element of SignaturePolicyIdType would be created. By the SigPolicyId and SigPolicyHash elements we use the JUnit tests to demonstrate the obligatorily occurrence, with other words: if this element is an empty one, an IllegalArgumentException should be executed with the relevant message: 1 i f ( S i g P o l i c y I d == n u l l ) { 2 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g P o l i c y I d E l e m e n t 3 is required ! " ); 4 } 5 6 i f ( S i g P o l i c y H a s h == n u l l ) { 7 throw new I l l e g a l A r g u m e n t E x c e p t i o n ( " S i g P o l i c y H a s h E l e m e n t 8 is required ! " ); 9 } 28
  • 37. Refers to the negative JUnit tests testNeg_SigPolicyId_Element_required and testNeg_SigPolicyHash_Element_required in org.apache.xml.security.xades.tests.JUtests. The SigPolicyQualifiers element is added as a child-element of the SignaturePolicyId, using a set-Method. Because of its specific type this element is defined as SigPolicyQualifiersListType. The following conditions is necessary to be defined: 1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)); 2. And also, whether the XML-element (SigPolicyQualifiers) is not an empty one ((SigPolicyQualifiers != null)); If any one of these both statements is not fulfilled, no SigPolicyQualifierselement would be created. 1 /∗∗ 2 ∗ Method s e t S i g P o l i c y Q u a l i f i e r 3 ∗ 4 ∗ @param S i g P o l i c y Q u a l i f i e r 5 ∗/ 6 public void s e t S i g P o l i c y Q u a l i f i e r ( S t r i n g S i g P o l i c y Q u a l i f i e r ){ 7 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S i g P o l i c y Q u a l i f i e r ! = n u l l ) ) { 8 this . addStringElement ( SigPolicyQualifier , 9 C o n s t a n t s . _TAG_SIGPOLICYQUALIFIER ) ; 10 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 11 } 12 } Figure 3.25: Method setSigPolicyQualifiers The child-element, which defines the format SigPolicyQualifiersListType - SigPolicyQualifier is created using set-Method. Because of its occurrence, it is necessary to define the following conditions: 1. It should be proved, whether the present state of the signature’ creation is -"Signing Mode" ((this._state == MODE_SIGN)); 2. And also, whether the XML-element (SigPolicyQualifier) is not an empty one ((SigPolicyQualifier != null)); If any one of these both statements is not fulfilled, no child-element of SigPolicyQualifiersListType would be created. 29
  • 38. 3.11 The SignatureProductionPlace element The SignatureProductionPlace is a sub-element of SignedSignatureProperties just like SigningTime, SigningCertificate and SignaturePolicyIdentifier, but its use is op- tional. This element specifies the exact place where the signature is created, through its four "children" - City, StateOrProvince, PostalCode, CountryName. Within the SignedSignature- Properties can occur only one SignatureProductionPlace element. The schema definition of this element, as it follows: < x s d : e l e m e n t name= " S i g n a t u r e P r o d u c t i o n P l a c e " type =" S i g n a t u r e P r o d u c t i o n P l a c e T y p e " / > < x s d : c o m p l e x T y p e name= " S i g n a t u r e P r o d u c t i o n P l a c e T y p e " > <xsd:sequence> < x s d : e l e m e n t name= " C i t y " t y p e = " x s d : s t r i n g " m i n O c c u r s = " 0 " / > < x s d : e l e m e n t name= " S t a t e O r P r o v i n c e " t y p e = " x s d : s t r i n g " m i n O c c u r s = " 0 " / > < x s d : e l e m e n t name= " P o s t a l C o d e " t y p e = " x s d : s t r i n g " m i n O c c u r s = " 0 " / > < x s d : e l e m e n t name= " CountryName " t y p e = " x s d : s t r i n g " m i n O c c u r s = " 0 " / > </ xsd:sequence> < / xsd:complexType> Figure 3.26: SignatureProductionPlace 1 /∗∗ 2 ∗ Method s e t C i t y 3 ∗ @param C i t y 4 ∗/ 5 public void s e t C i t y ( S t r i n g City ) { 6 i f ( ( t h i s . _ s t a t e == MODE_SIGN) && ( C i t y ! = n u l l ) ) { 7 t h i s . a d d S t r i n g E l e m e n t ( C i t y , C o n s t a n t s . _TAG_CITY ) ; 8 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 9 } 10 } 11 12 /∗∗ 13 ∗ Method s e t S t a t e O r P r o v i n c e 14 ∗ @param S t a t e O r P r o v i n c e 15 ∗/ 16 public void s e t S t a t e O r P r o v i n c e ( S t r i n g S t a t e O r P r o v i n c e ) { 17 i f ( ( t h i s . _ s t a t e == MODE_SIGN)&& ( S t a t e O r P r o v i n c e ! = n u l l ) ) { 18 t h i s . a d d S t r i n g E l e m e n t ( S t a t e O r P r o v i n c e , C o n s t a n t s . _TAG_STATEORPROVINCE ) ; 19 XMLUtils . a d d R e t u r n T o E l e m e n t ( t h i s . _ c o n s t r u c t i o n E l e m e n t ) ; 20 } 21 } Figure 3.27: Methods: setStateOrProvince, setCity 30