diff --git a/.gitignore b/.gitignore index 9b83d6e6b4..432d6ffbb2 100755 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,6 @@ -dss-demo-webapp/etc/ -pom.xml.versionsBackup -dependency-reduced-pom.xml -.* *.iml .idea .svn target -dss-demo-webapp/dss-debug.log -dss-demo-webapp/log.out log.out pom.xml.asc diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..4362b49151 --- /dev/null +++ b/LICENSE @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/README.md b/README.md index 256119f3f9..ee766b0c77 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,8 @@ This is a Digital Signature Service project used by DigiDoc4j. This fork contains mainly BDoc-TM specific changes. -DigiDoc4j is locaded at https://github.com/open-eid/digidoc4j - This is a forked repository from the original DSS project located at https://github.com/esig/dss and https://joinup.ec.europa.eu/asset/sd-dss/description. # Issue Tracker Please, use Pivotal on https://www.pivotaltracker.com/n/projects/1110130 - -# Maven repository - -The modules needed by DigiDoc4j are published to the Maven Central (http://mvnrepository.com/artifact/org.digidoc4j.dss) diff --git a/dss-asic-cades/pom.xml b/dss-asic-cades/pom.xml new file mode 100644 index 0000000000..ca883eace8 --- /dev/null +++ b/dss-asic-cades/pom.xml @@ -0,0 +1,35 @@ + + 4.0.0 + + org.digidoc4j.dss + sd-dss + 5.0.d4j.1 + + + dss-asic-cades + DSS ASiC with CAdES signature(s) + DSS ASiC with CAdES contains the code for the creation and validation of ASiC containers with CAdES signature(s). + + + + ${project.groupId} + dss-asic-common + + + ${project.groupId} + dss-cades + + + + ${project.groupId} + dss-test + test + + + ${project.groupId} + dss-document + test-jar + test + + + \ No newline at end of file diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/ASiCWithCAdESContainerExtractor.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/ASiCWithCAdESContainerExtractor.java new file mode 100644 index 0000000000..862266c324 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/ASiCWithCAdESContainerExtractor.java @@ -0,0 +1,21 @@ +package eu.europa.esig.dss.asic; + +import eu.europa.esig.dss.DSSDocument; + +public class ASiCWithCAdESContainerExtractor extends AbstractASiCContainerExtractor { + + public ASiCWithCAdESContainerExtractor(DSSDocument archive) { + super(archive); + } + + @Override + boolean isAllowedManifest(String entryName) { + return entryName.startsWith(META_INF_FOLDER + "ASiCManifest") && entryName.endsWith(".xml"); + } + + @Override + boolean isAllowedSignature(String entryName) { + return ASiCUtils.isCAdES(entryName); + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/ASiCWithCAdESSignatureParameters.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/ASiCWithCAdESSignatureParameters.java new file mode 100644 index 0000000000..580cf08687 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/ASiCWithCAdESSignatureParameters.java @@ -0,0 +1,28 @@ +package eu.europa.esig.dss.asic; + +import eu.europa.esig.dss.SignatureForm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.cades.CAdESSignatureParameters; + +public class ASiCWithCAdESSignatureParameters extends CAdESSignatureParameters { + + private static final long serialVersionUID = -830012801924753709L; + + /** + * The object representing the parameters related to ASiC from of the signature. + */ + private ASiCParameters aSiCParams = new ASiCParameters(); + + public ASiCParameters aSiC() { + return aSiCParams; + } + + @Override + public void setSignatureLevel(SignatureLevel signatureLevel) { + if (signatureLevel == null || SignatureForm.CAdES != signatureLevel.getSignatureForm()) { + throw new IllegalArgumentException("Only CAdES form is allowed !"); + } + super.setSignatureLevel(signatureLevel); + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithCAdESDataToSignHelperBuilder.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithCAdESDataToSignHelperBuilder.java new file mode 100644 index 0000000000..6417fd3b4c --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithCAdESDataToSignHelperBuilder.java @@ -0,0 +1,50 @@ +package eu.europa.esig.dss.asic.signature; + +import java.util.List; + +import eu.europa.esig.dss.BLevelParameters; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCUtils; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.asice.DataToSignASiCEWithCAdESFromArchive; +import eu.europa.esig.dss.asic.signature.asice.DataToSignASiCEWithCAdESFromFiles; +import eu.europa.esig.dss.asic.signature.asics.DataToSignASiCSWithCAdESFromArchive; +import eu.europa.esig.dss.asic.signature.asics.DataToSignASiCSWithCAdESFromFiles; + +public class ASiCWithCAdESDataToSignHelperBuilder { + + private ASiCWithCAdESDataToSignHelperBuilder() { + } + + public static GetDataToSignASiCWithCAdESHelper getGetDataToSignHelper(List documents, ASiCWithCAdESSignatureParameters parameters) { + + BLevelParameters bLevel = parameters.bLevel(); + boolean asice = ASiCUtils.isASiCE(parameters.aSiC()); + boolean archive = ASiCUtils.isArchive(documents); + + if (archive) { + DSSDocument archiveDoc = documents.get(0); + if (!ASiCUtils.isArchiveContainsCorrectSignatureExtension(archiveDoc, ".p7s")) { + throw new UnsupportedOperationException("Container type doesn't match"); + } + + ASiCWithCAdESContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(archiveDoc); + ASiCExtractResult extract = extractor.extract(); + if (asice) { + return new DataToSignASiCEWithCAdESFromArchive(extract.getSignedDocuments(), extract.getSignatureDocuments(), extract.getManifestDocuments(), + parameters); + } else { + return new DataToSignASiCSWithCAdESFromArchive(extract.getSignatureDocuments(), extract.getSignedDocuments(), parameters.aSiC()); + } + } else { + if (asice) { + return new DataToSignASiCEWithCAdESFromFiles(documents, parameters); + } else { + return new DataToSignASiCSWithCAdESFromFiles(documents, bLevel.getSigningDate(), parameters.aSiC()); + } + } + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithCAdESService.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithCAdESService.java new file mode 100644 index 0000000000..6fff4c594a --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithCAdESService.java @@ -0,0 +1,204 @@ +package eu.europa.esig.dss.asic.signature; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.SignaturePackaging; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.SigningOperation; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.ASiCUtils; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.validation.ASiCEWithCAdESManifestValidator; +import eu.europa.esig.dss.cades.CAdESSignatureParameters; +import eu.europa.esig.dss.cades.signature.CAdESService; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.CertificateVerifier; + +public class ASiCWithCAdESService extends AbstractASiCSignatureService { + + private static final Logger LOG = LoggerFactory.getLogger(ASiCWithCAdESService.class); + + public ASiCWithCAdESService(CertificateVerifier certificateVerifier) { + super(certificateVerifier); + LOG.debug("+ ASiCService with CAdES created"); + } + + @Override + public ToBeSigned getDataToSign(List toSignDocuments, ASiCWithCAdESSignatureParameters parameters) throws DSSException { + final ASiCParameters asicParameters = parameters.aSiC(); + assertCanBeSign(toSignDocuments, asicParameters); + + GetDataToSignASiCWithCAdESHelper dataToSignHelper = ASiCWithCAdESDataToSignHelperBuilder.getGetDataToSignHelper(toSignDocuments, parameters); + + CAdESSignatureParameters cadesParameters = getCAdESParameters(parameters); + cadesParameters.setDetachedContents(dataToSignHelper.getDetachedContents()); + return getCAdESService().getDataToSign(dataToSignHelper.getToBeSigned(), cadesParameters); + } + + @Override + public DSSDocument signDocument(List toSignDocuments, ASiCWithCAdESSignatureParameters parameters, SignatureValue signatureValue) + throws DSSException { + + final ASiCParameters asicParameters = parameters.aSiC(); + assertCanBeSign(toSignDocuments, asicParameters); + assertSigningDateInCertificateValidityRange(parameters); + + GetDataToSignASiCWithCAdESHelper dataToSignHelper = ASiCWithCAdESDataToSignHelperBuilder.getGetDataToSignHelper(toSignDocuments, parameters); + + List signatures = dataToSignHelper.getSignatures(); + List manifests = dataToSignHelper.getManifestFiles(); + + CAdESSignatureParameters cadesParameters = getCAdESParameters(parameters); + cadesParameters.setDetachedContents(dataToSignHelper.getDetachedContents()); + final DSSDocument signature = getCAdESService().signDocument(dataToSignHelper.getToBeSigned(), cadesParameters, signatureValue); + String newSignatureFileName = dataToSignHelper.getSignatureFilename(); + signature.setName(dataToSignHelper.getSignatureFilename()); + + if (ASiCUtils.isASiCS(asicParameters)) { + Iterator iterator = signatures.iterator(); + while (iterator.hasNext()) { + if (Utils.areStringsEqual(newSignatureFileName, iterator.next().getName())) { + // remove existing file to be replaced + iterator.remove(); + } + } + } + signatures.add(signature); + + final DSSDocument asicSignature = buildASiCContainer(dataToSignHelper.getSignedDocuments(), signatures, manifests, asicParameters); + asicSignature + .setName(DSSUtils.getFinalFileName(asicSignature, SigningOperation.SIGN, parameters.getSignatureLevel(), parameters.aSiC().getContainerType())); + parameters.reinitDeterministicId(); + return asicSignature; + } + + @Override + public DSSDocument extendDocument(DSSDocument toExtendDocument, ASiCWithCAdESSignatureParameters parameters) throws DSSException { + if (!ASiCUtils.isASiCContainer(toExtendDocument) || !ASiCUtils.isArchiveContainsCorrectSignatureExtension(toExtendDocument, ".p7s")) { + throw new DSSException("Unsupported file type"); + } + + extractCurrentArchive(toExtendDocument); + List signatureDocuments = getEmbeddedSignatures(); + List manifests = getEmbeddedManifests(); + List signedDocuments = getEmbeddedSignedDocuments(); + DSSDocument mimetype = getEmbeddedMimetype(); + + ASiCContainerType containerType = ASiCUtils.getContainerType(toExtendDocument, mimetype, null, signedDocuments); + if (containerType == null) { + throw new DSSException("Unable to determine container type"); + } + + List extendedDocuments = new ArrayList(); + + for (DSSDocument signature : signatureDocuments) { + + if (ASiCContainerType.ASiC_E == containerType) { + + ASiCEWithCAdESManifestValidator manifestValidator = new ASiCEWithCAdESManifestValidator(signature, manifests, signedDocuments); + DSSDocument linkedManifest = manifestValidator.getLinkedManifest(); + + if (linkedManifest != null) { + String originalName = signature.getName(); + CAdESSignatureParameters cadesParameters = getCAdESParameters(parameters); + cadesParameters.setDetachedContents(Arrays.asList(linkedManifest)); + + DSSDocument extendDocument = getCAdESService().extendDocument(signature, cadesParameters); + extendDocument.setName(originalName); + extendedDocuments.add(extendDocument); + } else { + LOG.warn("Manifest not found for signature file '{}' -> NOT EXTENDED !!!", signature.getName()); + extendedDocuments.add(signature); + } + } else { + String originalName = signature.getName(); + CAdESSignatureParameters cadesParameters = getCAdESParameters(parameters); + cadesParameters.setDetachedContents(signedDocuments); + + DSSDocument extendDocument = getCAdESService().extendDocument(signature, cadesParameters); + extendDocument.setName(originalName); + extendedDocuments.add(extendDocument); + } + } + + ByteArrayOutputStream baos = null; + try { + baos = new ByteArrayOutputStream(); + copyExistingArchiveWithSignatureList(toExtendDocument, extendedDocuments, baos); + } finally { + Utils.closeQuietly(baos); + } + + DSSDocument asicSignature = new InMemoryDocument(baos.toByteArray(), null, toExtendDocument.getMimeType()); + asicSignature.setName( + DSSUtils.getFinalFileName(toExtendDocument, SigningOperation.EXTEND, parameters.getSignatureLevel(), parameters.aSiC().getContainerType())); + return asicSignature; + } + + @Override + void storeSignatures(List signatures, ZipOutputStream zos) throws IOException { + for (DSSDocument signature : signatures) { + final ZipEntry entrySignature = new ZipEntry(signature.getName()); + zos.putNextEntry(entrySignature); + signature.writeTo(zos); + } + } + + @Override + boolean isSignatureFilename(String name) { + return ASiCUtils.isCAdES(name); + } + + @Override + AbstractASiCContainerExtractor getArchiveExtractor(DSSDocument archive) { + return new ASiCWithCAdESContainerExtractor(archive); + } + + private CAdESService getCAdESService() { + CAdESService cadesService = new CAdESService(certificateVerifier); + cadesService.setTspSource(tspSource); + return cadesService; + } + + private CAdESSignatureParameters getCAdESParameters(ASiCWithCAdESSignatureParameters parameters) { + CAdESSignatureParameters cadesParameters = parameters; + cadesParameters.setSignaturePackaging(SignaturePackaging.DETACHED); + cadesParameters.setDetachedContents(null); + return cadesParameters; + } + + @Override + boolean canBeSigned(List toSignDocuments, ASiCParameters asicParameters) { + boolean isMimetypeCorrect = true; + boolean isSignatureTypeCorrect = true; + if (ASiCUtils.isArchive(toSignDocuments)) { + DSSDocument archiveDoc = toSignDocuments.get(0); + String expectedMimeType = archiveDoc.getMimeType().getMimeTypeString(); + String mimeTypeFromParameter = ASiCUtils.getMimeTypeString(asicParameters); + isMimetypeCorrect = Utils.areStringsEqualIgnoreCase(expectedMimeType, mimeTypeFromParameter); + if (isMimetypeCorrect) { + isSignatureTypeCorrect = ASiCUtils.isArchiveContainsCorrectSignatureExtension(archiveDoc, ".p7s"); + } + } + return isMimetypeCorrect && isSignatureTypeCorrect; + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/GetDataToSignASiCWithCAdESHelper.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/GetDataToSignASiCWithCAdESHelper.java new file mode 100644 index 0000000000..aebcde7dc9 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/GetDataToSignASiCWithCAdESHelper.java @@ -0,0 +1,15 @@ +package eu.europa.esig.dss.asic.signature; + +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; + +public interface GetDataToSignASiCWithCAdESHelper extends GetDataToSignHelper { + + /* In CMS/CAdES, we only can sign on file */ + DSSDocument getToBeSigned(); + + /* In case of parallel ASiC-S signature, we need the detached content */ + List getDetachedContents(); + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/ASiCEWithCAdESManifestBuilder.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/ASiCEWithCAdESManifestBuilder.java new file mode 100644 index 0000000000..90f178210f --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/ASiCEWithCAdESManifestBuilder.java @@ -0,0 +1,71 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import java.util.List; + +import javax.xml.crypto.dsig.XMLSignature; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DigestAlgorithm; +import eu.europa.esig.dss.DomUtils; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.asic.ASiCNamespace; + +/** + * This class is used to generate the ASiCManifest.xml content (ASiC-E) + * + * Sample: + * + *
+ * 
+ * 		
+ *			
+ *				
+ *					
+ *					OuL0HMJE899y+uJtyNnTt5B/gFrrw8adNczI+9w9GDQ=
+ *				
+ *			
+ *		
+ * 
+ * 
+ */ +public class ASiCEWithCAdESManifestBuilder { + + private final List documents; + private final DigestAlgorithm digestAlgorithm; + private final String signatureUri; + + public ASiCEWithCAdESManifestBuilder(List documents, DigestAlgorithm digestAlgorithm, String signatureUri) { + this.documents = documents; + this.digestAlgorithm = digestAlgorithm; + this.signatureUri = signatureUri; + } + + public Document build() { + final Document documentDom = DomUtils.buildDOM(); + final Element asicManifestDom = documentDom.createElementNS(ASiCNamespace.NS, ASiCNamespace.ASIC_MANIFEST); + documentDom.appendChild(asicManifestDom); + + final Element sigReferenceDom = DomUtils.addElement(documentDom, asicManifestDom, ASiCNamespace.NS, ASiCNamespace.SIG_REFERENCE); + sigReferenceDom.setAttribute("URI", signatureUri); + sigReferenceDom.setAttribute("MimeType", MimeType.PKCS7.getMimeTypeString()); + + for (DSSDocument document : documents) { + final String detachedDocumentName = document.getName(); + final Element dataObjectReferenceDom = DomUtils.addElement(documentDom, asicManifestDom, ASiCNamespace.NS, ASiCNamespace.DATA_OBJECT_REFERENCE); + dataObjectReferenceDom.setAttribute("URI", detachedDocumentName); + + final Element digestMethodDom = DomUtils.addElement(documentDom, dataObjectReferenceDom, XMLSignature.XMLNS, "DigestMethod"); + digestMethodDom.setAttribute("Algorithm", digestAlgorithm.getXmlId()); + + final Element digestValueDom = DomUtils.addElement(documentDom, dataObjectReferenceDom, XMLSignature.XMLNS, "DigestValue"); + final Text textNode = documentDom.createTextNode(document.getDigest(digestAlgorithm)); + digestValueDom.appendChild(textNode); + } + + return documentDom; + } +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/AbstractDataToSignASiCEWithCAdES.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/AbstractDataToSignASiCEWithCAdES.java new file mode 100644 index 0000000000..d8de73fcc8 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/AbstractDataToSignASiCEWithCAdES.java @@ -0,0 +1,60 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import java.io.ByteArrayOutputStream; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DomUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.utils.Utils; + +public abstract class AbstractDataToSignASiCEWithCAdES { + + private static final String META_INF = "META-INF/"; + private static final String ZIP_ENTRY_ASICE_METAINF_CADES_SIGNATURE = META_INF + "signature001.p7s"; + + protected DSSDocument getASiCManifest(List documents, List signatures, List manifests, + ASiCWithCAdESSignatureParameters parameters) { + ASiCEWithCAdESManifestBuilder manifestBuilder = new ASiCEWithCAdESManifestBuilder(documents, parameters.getDigestAlgorithm(), + getSignatureFileName(parameters.aSiC(), signatures)); + + DSSDocument manifest = null; + ByteArrayOutputStream baos = null; + try { + baos = new ByteArrayOutputStream(); + DomUtils.writeDocumentTo(manifestBuilder.build(), baos); + String name = getASiCManifestFilename(manifests); + manifest = new InMemoryDocument(baos.toByteArray(), name, MimeType.XML); + } finally { + Utils.closeQuietly(baos); + } + return manifest; + } + + protected String getSignatureFileName(final ASiCParameters asicParameters, List existingSignatures) { + if (Utils.isStringNotBlank(asicParameters.getSignatureFileName())) { + return META_INF + asicParameters.getSignatureFileName(); + } + if (Utils.isCollectionNotEmpty(existingSignatures)) { + return ZIP_ENTRY_ASICE_METAINF_CADES_SIGNATURE.replace("001", getSignatureNumber(existingSignatures)); + } else { + return ZIP_ENTRY_ASICE_METAINF_CADES_SIGNATURE; + } + } + + private String getSignatureNumber(List existingSignatures) { + int signatureNumbre = existingSignatures.size() + 1; + String sigNumberStr = String.valueOf(signatureNumbre); + String zeroPad = "000"; + return zeroPad.substring(sigNumberStr.length()) + sigNumberStr; // 2 -> 002 + } + + private String getASiCManifestFilename(List existingManifests) { + String suffix = Utils.isCollectionEmpty(existingManifests) ? Utils.EMPTY_STRING : String.valueOf(existingManifests.size()); + return META_INF + "ASiCManifest" + suffix + ".xml"; + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithCAdESFromArchive.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithCAdESFromArchive.java new file mode 100644 index 0000000000..88abe96c53 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithCAdESFromArchive.java @@ -0,0 +1,63 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.GetDataToSignASiCWithCAdESHelper; + +public class DataToSignASiCEWithCAdESFromArchive extends AbstractDataToSignASiCEWithCAdES implements GetDataToSignASiCWithCAdESHelper { + + private final List signedDocuments; + private final List existingSignatures; + private final List existingManifests; + private final ASiCWithCAdESSignatureParameters parameters; + + private DSSDocument toBeSigned; + + public DataToSignASiCEWithCAdESFromArchive(List signedDocuments, List existingSignatures, List existingManifests, + ASiCWithCAdESSignatureParameters parameters) { + this.signedDocuments = signedDocuments; + this.existingSignatures = existingSignatures; + this.existingManifests = existingManifests; + this.parameters = parameters; + } + + @Override + public String getSignatureFilename() { + return getSignatureFileName(parameters.aSiC(), existingSignatures); + } + + @Override + public DSSDocument getToBeSigned() { + if (toBeSigned == null) { + toBeSigned = getASiCManifest(signedDocuments, existingSignatures, existingManifests, parameters); + } + return toBeSigned; + } + + @Override + public List getDetachedContents() { + return Collections.emptyList(); + } + + @Override + public List getSignedDocuments() { + return signedDocuments; + } + + @Override + public List getManifestFiles() { + List manifests = new ArrayList(existingManifests); + manifests.add(getToBeSigned()); + return manifests; + } + + @Override + public List getSignatures() { + return existingSignatures; + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithCAdESFromFiles.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithCAdESFromFiles.java new file mode 100644 index 0000000000..eca4afb87d --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithCAdESFromFiles.java @@ -0,0 +1,57 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.GetDataToSignASiCWithCAdESHelper; + +public class DataToSignASiCEWithCAdESFromFiles extends AbstractDataToSignASiCEWithCAdES implements GetDataToSignASiCWithCAdESHelper { + + private final List filesToBeSigned; + private final ASiCWithCAdESSignatureParameters parameters; + + private DSSDocument toBeSigned; + + public DataToSignASiCEWithCAdESFromFiles(List filesToBeSigned, ASiCWithCAdESSignatureParameters parameters) { + this.filesToBeSigned = filesToBeSigned; + this.parameters = parameters; + } + + @Override + public DSSDocument getToBeSigned() { + if (toBeSigned == null) { + toBeSigned = getASiCManifest(filesToBeSigned, Collections. emptyList(), Collections. emptyList(), parameters); + } + return toBeSigned; + } + + @Override + public List getDetachedContents() { + return Collections.emptyList(); + } + + @Override + public String getSignatureFilename() { + return getSignatureFileName(parameters.aSiC(), Collections. emptyList()); + } + + @Override + public List getSignedDocuments() { + return filesToBeSigned; + } + + @Override + public List getManifestFiles() { + return Arrays.asList(getToBeSigned()); + } + + @Override + public List getSignatures() { + return new ArrayList(); + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asics/AbstractGetDataToSignASiCSWithCAdES.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asics/AbstractGetDataToSignASiCSWithCAdES.java new file mode 100644 index 0000000000..0f682dfd73 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asics/AbstractGetDataToSignASiCSWithCAdES.java @@ -0,0 +1,15 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.utils.Utils; + +public abstract class AbstractGetDataToSignASiCSWithCAdES extends AbstractGetDataToSignASiCS { + + protected String getSignatureFileName(final ASiCParameters asicParameters) { + if (Utils.isStringNotBlank(asicParameters.getSignatureFileName())) { + return "META-INF/" + asicParameters.getSignatureFileName(); + } + return "META-INF/signature.p7s"; + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithCAdESFromArchive.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithCAdESFromArchive.java new file mode 100644 index 0000000000..054abc2e1b --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithCAdESFromArchive.java @@ -0,0 +1,63 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import java.util.Collections; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.signature.GetDataToSignASiCWithCAdESHelper; +import eu.europa.esig.dss.utils.Utils; + +public class DataToSignASiCSWithCAdESFromArchive extends AbstractGetDataToSignASiCSWithCAdES implements GetDataToSignASiCWithCAdESHelper { + + private final List embeddedSignatures; + private final List embeddedSignedFiles; + private final ASiCParameters asicParameters; + + public DataToSignASiCSWithCAdESFromArchive(List embeddedSignatures, List embeddedSignedFiles, ASiCParameters asicParameters) { + this.embeddedSignatures = embeddedSignatures; + this.embeddedSignedFiles = embeddedSignedFiles; + this.asicParameters = asicParameters; + } + + @Override + public String getSignatureFilename() { + return getSignatureFileName(asicParameters); + } + + @Override + public DSSDocument getToBeSigned() { + int nbEmbeddedSignatures = Utils.collectionSize(embeddedSignatures); + if (nbEmbeddedSignatures != 1) { + throw new DSSException("Unable to select the embedded signature (nb found:" + nbEmbeddedSignatures + ")"); + } + return embeddedSignatures.get(0); + } + + @Override + public List getDetachedContents() { + return getSignedDocuments(); + } + + @Override + public List getSignedDocuments() { + int nbSignedFiles = Utils.collectionSize(embeddedSignedFiles); + if (nbSignedFiles != 1) { + throw new DSSException("Unable to select the document to be signed (nb found:" + nbSignedFiles + ")"); + } + return embeddedSignedFiles; + } + + @Override + public List getManifestFiles() { + // No manifest file in ASiC-S + return Collections.emptyList(); + } + + @Override + public List getSignatures() { + return embeddedSignatures; + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithCAdESFromFiles.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithCAdESFromFiles.java new file mode 100644 index 0000000000..3e8bbe6470 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithCAdESFromFiles.java @@ -0,0 +1,67 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.signature.GetDataToSignASiCWithCAdESHelper; +import eu.europa.esig.dss.utils.Utils; + +public class DataToSignASiCSWithCAdESFromFiles extends AbstractGetDataToSignASiCSWithCAdES implements GetDataToSignASiCWithCAdESHelper { + + private final List filesToBeSigned; + private final Date signingDate; + private final ASiCParameters asicParameters; + + private List signedDocuments; + + public DataToSignASiCSWithCAdESFromFiles(List filesToBeSigned, Date signingDate, ASiCParameters asicParameters) { + this.filesToBeSigned = filesToBeSigned; + this.signingDate = signingDate; + this.asicParameters = asicParameters; + } + + @Override + public String getSignatureFilename() { + return getSignatureFileName(asicParameters); + } + + @Override + public DSSDocument getToBeSigned() { + return getSignedDocuments().get(0); + } + + @Override + public List getDetachedContents() { + return Collections.emptyList(); + } + + @Override + public List getSignedDocuments() { + if (signedDocuments == null) { + if (Utils.collectionSize(filesToBeSigned) > 1) { + signedDocuments = Arrays.asList(createPackageZip(filesToBeSigned, signingDate)); + } else { + signedDocuments = new ArrayList(filesToBeSigned); + } + } + return signedDocuments; + } + + @Override + public List getManifestFiles() { + // No manifest file in ASiC-S + return Collections.emptyList(); + } + + @Override + public List getSignatures() { + // new container + return new ArrayList(); + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCContainerWithCAdESValidator.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCContainerWithCAdESValidator.java new file mode 100644 index 0000000000..8e3594ffbc --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCContainerWithCAdESValidator.java @@ -0,0 +1,95 @@ +package eu.europa.esig.dss.asic.validation; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCUtils; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.validation.DocumentValidator; +import eu.europa.esig.dss.validation.ManifestFile; + +/** + * This class is an implementation to validate ASiC containers with CAdES signature(s) + * + */ +public class ASiCContainerWithCAdESValidator extends AbstractASiCContainerValidator { + + private static final Logger LOG = LoggerFactory.getLogger(ASiCContainerWithCAdESValidator.class); + + private ASiCContainerWithCAdESValidator() { + super(null); + } + + public ASiCContainerWithCAdESValidator(final DSSDocument asicContainer) { + super(asicContainer); + analyseEntries(); + } + + @Override + public boolean isSupported(DSSDocument dssDocument) { + return ASiCUtils.isASiCContainer(dssDocument) && ASiCUtils.isArchiveContainsCorrectSignatureExtension(dssDocument, ".p7s"); + } + + @Override + AbstractASiCContainerExtractor getArchiveExtractor() { + return new ASiCWithCAdESContainerExtractor(document); + } + + @Override + List getValidators() { + if (validators == null) { + validators = new ArrayList(); + for (final DSSDocument signature : getSignatureDocuments()) { + CMSDocumentForASiCValidator cadesValidator = new CMSDocumentForASiCValidator(signature); + cadesValidator.setCertificateVerifier(certificateVerifier); + cadesValidator.setProcessExecutor(processExecutor); + cadesValidator.setSignaturePolicyProvider(signaturePolicyProvider); + cadesValidator.setValidationCertPool(validationCertPool); + cadesValidator.setDetachedContents(getSignedDocuments(signature)); + validators.add(cadesValidator); + } + } + return validators; + } + + private List getSignedDocuments(DSSDocument signature) { + ASiCContainerType type = getContainerType(); + if (ASiCContainerType.ASiC_S == type) { + return getSignedDocuments(); // Collection size should be equals 1 + } else if (ASiCContainerType.ASiC_E == type) { + // the manifest file is signed + // we need first to check the manifest file and its digests + ASiCEWithCAdESManifestValidator manifestValidator = new ASiCEWithCAdESManifestValidator(signature, getManifestDocuments(), getSignedDocuments()); + DSSDocument linkedManifest = manifestValidator.getLinkedManifest(); + if (linkedManifest != null) { + return Arrays.asList(linkedManifest); + } else { + return Collections.emptyList(); + } + } else { + LOG.warn("Unknown asic container type (returns all signed documents)"); + return getSignedDocuments(); + } + } + + @Override + protected List getManifestFilesDecriptions() { + List descriptions = new ArrayList(); + List manifestDocuments = getManifestDocuments(); + for (DSSDocument manifestDocument : manifestDocuments) { + ASiCEWithCAdESManifestParser parser = new ASiCEWithCAdESManifestParser(manifestDocument); + descriptions.add(parser.getDescription()); + } + + return descriptions; + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCEWithCAdESManifestParser.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCEWithCAdESManifestParser.java new file mode 100644 index 0000000000..08fa8f6ed9 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCEWithCAdESManifestParser.java @@ -0,0 +1,60 @@ +package eu.europa.esig.dss.asic.validation; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DomUtils; +import eu.europa.esig.dss.asic.ASiCNamespace; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.ManifestFile; + +public class ASiCEWithCAdESManifestParser { + + private static final Logger LOG = LoggerFactory.getLogger(ASiCEWithCAdESManifestParser.class); + + private final DSSDocument manifestDocument; + + public ASiCEWithCAdESManifestParser(DSSDocument manifestDocument) { + this.manifestDocument = manifestDocument; + } + + public ManifestFile getDescription() { + ManifestFile description = new ManifestFile(); + description.setFilename(manifestDocument.getName()); + + InputStream is = null; + try { + is = manifestDocument.openStream(); + Document manifestDom = DomUtils.buildDOM(is); + description.setSignatureFilename(DomUtils.getValue(manifestDom, ASiCNamespace.XPATH_ASIC_SIGREF_URL)); + + List entries = new ArrayList(); + NodeList dataObjectReferences = DomUtils.getNodeList(manifestDom, ASiCNamespace.XPATH_ASIC_DATA_OBJECT_REFERENCE); + if (dataObjectReferences == null || dataObjectReferences.getLength() == 0) { + LOG.warn("No DataObjectReference found in manifest file"); + } else { + for (int i = 0; i < dataObjectReferences.getLength(); i++) { + Element dataObjectReference = (Element) dataObjectReferences.item(i); + entries.add(dataObjectReference.getAttribute("URI")); + } + } + description.setEntries(entries); + + } catch (Exception e) { + LOG.warn("Unable to analyze manifest file '" + manifestDocument.getName() + "' : " + e.getMessage()); + } finally { + Utils.closeQuietly(is); + } + + return description; + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCEWithCAdESManifestValidator.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCEWithCAdESManifestValidator.java new file mode 100644 index 0000000000..e40d28b396 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCEWithCAdESManifestValidator.java @@ -0,0 +1,116 @@ +package eu.europa.esig.dss.asic.validation; + +import java.io.InputStream; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DigestAlgorithm; +import eu.europa.esig.dss.DomUtils; +import eu.europa.esig.dss.asic.ASiCNamespace; +import eu.europa.esig.dss.utils.Utils; + +public class ASiCEWithCAdESManifestValidator { + + private static final Logger LOG = LoggerFactory.getLogger(ASiCEWithCAdESManifestValidator.class); + + static { + DomUtils.registerNamespace("asic", ASiCNamespace.NS); + } + + private final DSSDocument signature; + private final List manifestDocuments; + private final List signedDocuments; + + public ASiCEWithCAdESManifestValidator(DSSDocument signature, List manifestDocuments, List signedDocuments) { + this.signature = signature; + this.manifestDocuments = manifestDocuments; + this.signedDocuments = signedDocuments; + } + + public DSSDocument getLinkedManifest() { + String expectedSignatureURI = signature.getName(); + for (DSSDocument manifestDocument : manifestDocuments) { + InputStream is = null; + try { + is = manifestDocument.openStream(); + Document manifestDom = DomUtils.buildDOM(is); + String signatureURI = DomUtils.getValue(manifestDom, ASiCNamespace.XPATH_ASIC_SIGREF_URL); + if (Utils.areStringsEqual(expectedSignatureURI, signatureURI) && checkManifestDigests(manifestDom)) { + return manifestDocument; + } + } catch (Exception e) { + LOG.warn("Unable to analyze manifest file '" + manifestDocument.getName() + "' : " + e.getMessage()); + } finally { + Utils.closeQuietly(is); + } + } + return null; + } + + private boolean checkManifestDigests(Document manifestDom) { + NodeList dataObjectReferences = DomUtils.getNodeList(manifestDom, ASiCNamespace.XPATH_ASIC_DATA_OBJECT_REFERENCE); + if (dataObjectReferences == null || dataObjectReferences.getLength() == 0) { + LOG.warn("No DataObjectReference found in manifest file"); + return false; + } else { + for (int i = 0; i < dataObjectReferences.getLength(); i++) { + Element dataObjectReference = (Element) dataObjectReferences.item(i); + + String filename = dataObjectReference.getAttribute("URI"); + + DSSDocument signedFile = getSignedFileByName(filename); + if (signedFile == null) { + LOG.warn("Signed data with name '{}' not found", filename); + return false; + } + + DigestAlgorithm digestAlgo = getDigestAlgorithm(dataObjectReference); + if (digestAlgo == null) { + LOG.warn("Digest algo is not defined for signed data with name '{}'", filename); + return false; + } + + String expectedDigestB64 = getDigestValue(dataObjectReference); + String computedDigestB64 = signedFile.getDigest(digestAlgo); + if (!Utils.areStringsEqual(expectedDigestB64, computedDigestB64)) { + LOG.warn("Digest value doesn't match for signed data with name '{}'", filename); + LOG.warn("Expected : '{}'", expectedDigestB64); + LOG.warn("Computed : '{}'", computedDigestB64); + return false; + } + + } + } + + return true; + } + + private DSSDocument getSignedFileByName(String filename) { + for (DSSDocument signedDocument : signedDocuments) { + if (Utils.areStringsEqual(filename, signedDocument.getName())) { + return signedDocument; + } + } + return null; + } + + private DigestAlgorithm getDigestAlgorithm(Element element) { + final String xmlName = DomUtils.getElement(element, "ds:DigestMethod").getAttribute("Algorithm"); + return DigestAlgorithm.forXML(xmlName, null); + } + + private String getDigestValue(Element element) { + Element digestValueElement = DomUtils.getElement(element, "ds:DigestValue"); + if (digestValueElement != null) { + return digestValueElement.getTextContent(); + } + return Utils.EMPTY_STRING; + } + +} diff --git a/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/CMSDocumentForASiCValidator.java b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/CMSDocumentForASiCValidator.java new file mode 100644 index 0000000000..cb9030ed98 --- /dev/null +++ b/dss-asic-cades/src/main/java/eu/europa/esig/dss/asic/validation/CMSDocumentForASiCValidator.java @@ -0,0 +1,17 @@ +package eu.europa.esig.dss.asic.validation; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.cades.validation.CMSDocumentValidator; +import eu.europa.esig.dss.x509.CertificatePool; + +public class CMSDocumentForASiCValidator extends CMSDocumentValidator implements ASiCSignatureValidator { + + public CMSDocumentForASiCValidator(DSSDocument signature) { + super(signature); + } + + public void setValidationCertPool(CertificatePool validationCertPool) { + this.validationCertPool = validationCertPool; + } + +} diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/ASiCWithCAdESSignatureParametersTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/ASiCWithCAdESSignatureParametersTest.java new file mode 100644 index 0000000000..af459298af --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/ASiCWithCAdESSignatureParametersTest.java @@ -0,0 +1,15 @@ +package eu.europa.esig.dss.asic; + +import org.junit.Test; + +import eu.europa.esig.dss.SignatureLevel; + +public class ASiCWithCAdESSignatureParametersTest { + + @Test(expected = IllegalArgumentException.class) + public void testIllegal() { + ASiCWithCAdESSignatureParameters params = new ASiCWithCAdESSignatureParameters(); + params.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + } + +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithCAdESExtension.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithCAdESExtension.java similarity index 75% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithCAdESExtension.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithCAdESExtension.java index 0c1debbf76..56b191a5f5 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithCAdESExtension.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithCAdESExtension.java @@ -20,15 +20,14 @@ */ package eu.europa.esig.dss.asic.extension; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; import eu.europa.esig.dss.extension.AbstractTestExtension; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; @@ -37,7 +36,7 @@ import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -public abstract class AbstractTestASiCwithCAdESExtension extends AbstractTestExtension { +public abstract class AbstractTestASiCwithCAdESExtension extends AbstractTestExtension { @Override protected DSSDocument getSignedDocument() throws Exception { @@ -47,15 +46,14 @@ protected DSSDocument getSignedDocument() throws Exception { DSSDocument document = new InMemoryDocument("Hello world!".getBytes(), "test.bin"); // Sign - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.setSigningCertificate(entryUserA.getCertificate()); signatureParameters.setCertificateChain(entryUserA.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); signatureParameters.setSignatureLevel(getOriginalSignatureLevel()); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.aSiC().setContainerType(getContainerType()); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); ToBeSigned dataToSign = service.getDataToSign(document, signatureParameters); @@ -65,16 +63,18 @@ protected DSSDocument getSignedDocument() throws Exception { } @Override - protected ASiCSignatureParameters getExtensionParameters() { - ASiCSignatureParameters extensionParameters = new ASiCSignatureParameters(); + protected ASiCWithCAdESSignatureParameters getExtensionParameters() { + ASiCWithCAdESSignatureParameters extensionParameters = new ASiCWithCAdESSignatureParameters(); extensionParameters.setSignatureLevel(getFinalSignatureLevel()); - extensionParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + extensionParameters.aSiC().setContainerType(getContainerType()); return extensionParameters; } + protected abstract ASiCContainerType getContainerType(); + @Override - protected DocumentSignatureService getSignatureServiceToExtend() throws Exception { - ASiCService service = new ASiCService(new CommonCertificateVerifier()); + protected DocumentSignatureService getSignatureServiceToExtend() throws Exception { + ASiCWithCAdESService service = new ASiCWithCAdESService(new CommonCertificateVerifier()); CertificateService certificateService = new CertificateService(); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); return service; diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithCAdESBToTTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithCAdESBToTTest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithCAdESBToTTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithCAdESBToTTest.java index eecb75bd0a..05709ac81c 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithCAdESBToTTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithCAdESBToTTest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asice; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithCAdESExtension; @@ -27,21 +28,16 @@ public class ASiCeExtensionWithCAdESBToTTest extends AbstractTestASiCwithCAdESEx @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.CAdES_BASELINE_B; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_T; + return SignatureLevel.CAdES_BASELINE_T; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_T; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_E; } } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithCAdESBToTTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithCAdESBToTTest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithCAdESBToTTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithCAdESBToTTest.java index a98e077a08..bf53014c48 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithCAdESBToTTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithCAdESBToTTest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asics; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithCAdESExtension; @@ -27,21 +28,16 @@ public class ASiCsExtensionWithCAdESBToTTest extends AbstractTestASiCwithCAdESEx @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.CAdES_BASELINE_B; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_T; + return SignatureLevel.CAdES_BASELINE_T; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_T; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_S; } } diff --git a/dss-asic/src/test/java/plugtests/ETSISamplesValidationTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/plugtests/ETSISamplesValidationTest.java similarity index 93% rename from dss-asic/src/test/java/plugtests/ETSISamplesValidationTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/plugtests/ETSISamplesValidationTest.java index 65827a6195..b223781006 100644 --- a/dss-asic/src/test/java/plugtests/ETSISamplesValidationTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/plugtests/ETSISamplesValidationTest.java @@ -1,4 +1,4 @@ -package plugtests; +package eu.europa.esig.dss.asic.plugtests; import static org.junit.Assert.assertNotNull; @@ -6,13 +6,13 @@ import java.util.ArrayList; import java.util.Collection; -import org.apache.commons.io.FileUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CommonCertificateVerifier; import eu.europa.esig.dss.validation.SignedDocumentValidator; import eu.europa.esig.dss.validation.reports.DetailedReport; @@ -29,7 +29,7 @@ public class ETSISamplesValidationTest { @Parameters(name = "Validation {index} : {0}") public static Collection data() { File folder = new File("src/test/resources/plugtest"); - Collection listFiles = FileUtils.listFiles(folder, + Collection listFiles = Utils.listFiles(folder, new String[] { "p7", "p7b", "p7m", "p7s", "asice", "asics", "pdf", "xml", "bdoc", "csig", "xsig", "es3" }, true); Collection dataToRun = new ArrayList(); for (File file : listFiles) { diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesParallelTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesParallelTest.java new file mode 100644 index 0000000000..45075de7fc --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesParallelTest.java @@ -0,0 +1,121 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.test.TestUtils; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.policy.rules.Indication; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; + +public class ASiCECAdESLevelBMultiFilesParallelTest { + + @Test + public void test() throws Exception { + List documentToSigns = new ArrayList(); + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier); + + ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters); + SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue); + + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + + certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithCAdESService(certificateVerifier); + + dataToSign = service.getDataToSign(signedDocument, signatureParameters); + signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + + Reports reports = validator.validateDocument(); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(2, signatureIdList.size()); + for (String sigId : signatureIdList) { + assertTrue(diagnosticData.isBLevelTechnicallyValid(sigId)); + assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId)); + } + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(resignedDocument); + ASiCExtractResult result = extractor.extract(); + + assertEquals(0, result.getUnsupportedDocuments().size()); + + List signatureDocuments = result.getSignatureDocuments(); + assertEquals(2, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".p7s")); + + List manifestDocuments = result.getManifestDocuments(); + assertEquals(2, manifestDocuments.size()); + String manifestFilename = manifestDocuments.get(0).getName(); + assertTrue(manifestFilename.startsWith("META-INF/ASiCManifest")); + assertTrue(manifestFilename.endsWith(".xml")); + + List signedDocuments = result.getSignedDocuments(); + assertEquals(2, signedDocuments.size()); + + DSSDocument mimeTypeDocument = result.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICE.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + } +} diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesTest.java new file mode 100644 index 0000000000..ee4931d5e7 --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBMultiFilesTest.java @@ -0,0 +1,162 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asice; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestMultipleDocumentsSignatureService; +import eu.europa.esig.dss.signature.MultipleDocumentsSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; + +public class ASiCECAdESLevelBMultiFilesTest extends AbstractTestMultipleDocumentsSignatureService { + + private MultipleDocumentsSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; + private List documentToSigns = new ArrayList(); + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithCAdESService(certificateVerifier); + } + + @Override + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + + assertEquals(0, extract.getUnsupportedDocuments().size()); + + List signatureDocuments = extract.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".p7s")); + + List manifestDocuments = extract.getManifestDocuments(); + assertEquals(1, manifestDocuments.size()); + String manifestFilename = manifestDocuments.get(0).getName(); + assertTrue(manifestFilename.startsWith("META-INF/ASiCManifest")); + assertTrue(manifestFilename.endsWith(".xml")); + + List signedDocuments = extract.getSignedDocuments(); + assertEquals(2, signedDocuments.size()); + + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICE.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + } + + @Override + protected void checkSignatureScopes(DiagnosticData diagnosticData) { + // List signatureIdList = diagnosticData.getSignatureIdList(); + // assertEquals(2, Utils.collectionSize(signatureIdList)); + // + // for (String signatureId : signatureIdList) { + // SignatureWrapper signature = diagnosticData.getSignatureById(signatureId); + // List signatureScopes = signature.getSignatureScopes(); + // assertEquals(1, Utils.collectionSize(signatureScopes)); + // } + // TODO + } + + @Override + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICE; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + + @Override + protected List getDocumentsToSign() { + return documentToSigns; + } + + @Override + protected MultipleDocumentsSignatureService getService() { + return service; + } + +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCAdESTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSHA512Test.java similarity index 68% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCAdESTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSHA512Test.java index 92800e77b9..9cda0f843f 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCAdESTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSHA512Test.java @@ -20,71 +20,65 @@ */ package eu.europa.esig.dss.asic.signature.asice; -import static org.junit.Assert.assertEquals; - import java.util.Date; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DigestAlgorithm; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCELevelBCAdESTest extends AbstractTestSignature { +public class ASiCECAdESLevelBSHA512Test extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setDigestAlgorithm(DigestAlgorithm.SHA512); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.CAdES_BASELINE_B.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + service = new ASiCWithCAdESService(certificateVerifier); } @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { return signatureParameters; } @Override protected MimeType getExpectedMime() { - return MimeType.ASICE; + return MimeType.ASICS; } @Override diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCAdESSignFourTimeTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSignFourTimeTest.java similarity index 65% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCAdESSignFourTimeTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSignFourTimeTest.java index 94cdc910f1..d9163add9d 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCAdESSignFourTimeTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSignFourTimeTest.java @@ -1,22 +1,23 @@ package eu.europa.esig.dss.asic.signature.asice; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import java.util.Date; +import java.util.List; -import org.junit.Assert; import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -27,29 +28,24 @@ import eu.europa.esig.dss.validation.reports.Reports; import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -/** - * @author axel.abinet - * - */ -public class ASiCELevelBCAdESSignFourTimeTest { +public class ASiCECAdESLevelBSignFourTimeTest { @Test public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier); ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -59,13 +55,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithCAdESService(certificateVerifier); dataToSign = service.getDataToSign(signedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -75,13 +69,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithCAdESService(certificateVerifier); dataToSign = service.getDataToSign(resignedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -91,30 +83,30 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithCAdESService(certificateVerifier); dataToSign = service.getDataToSign(resignedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); resignedDocument = service.signDocument(resignedDocument, signatureParameters, signatureValue); + resignedDocument.save("target/resigned.asice"); + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); validator.setCertificateVerifier(new CommonCertificateVerifier()); Reports reports = validator.validateDocument(); - // reports.print(); - - while (reports != null) { - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - Assert.assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(diagnosticData.getFirstSignatureId())); - reports = reports.getNextReports(); + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(4, signatureIdList.size()); + for (String sigId : signatureIdList) { + assertTrue(diagnosticData.isBLevelTechnicallyValid(sigId)); + assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId)); } + } } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBSpecialCharInFilenameTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSpecialCharInFilenameTest.java similarity index 71% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBSpecialCharInFilenameTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSpecialCharInFilenameTest.java index b9c12b039f..f988420c3b 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBSpecialCharInFilenameTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBSpecialCharInFilenameTest.java @@ -20,63 +20,57 @@ */ package eu.europa.esig.dss.asic.signature.asice; -import static org.junit.Assert.assertEquals; - import java.util.Date; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCELevelBSpecialCharInFilenameTest extends AbstractTestSignature { +public class ASiCECAdESLevelBSpecialCharInFilenameTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "012éù*34ä5µ£6789~#%&()+=`@{[]}'.txt"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "012éù*34ä5µ£6789~#%&()+=`@{[]}'.txt"); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_B.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + service = new ASiCWithCAdESService(certificateVerifier); } @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBTest.java new file mode 100644 index 0000000000..64c41e3198 --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelBTest.java @@ -0,0 +1,147 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asice; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.util.List; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; +import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; + +public class ASiCECAdESLevelBTest extends AbstractTestDocumentSignatureService { + + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; + private DSSDocument documentToSign; + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithCAdESService(certificateVerifier); + } + + @Override + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + + assertEquals(0, extract.getUnsupportedDocuments().size()); + + List signatureDocuments = extract.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".p7s")); + + List manifestDocuments = extract.getManifestDocuments(); + assertEquals(1, manifestDocuments.size()); + String manifestFilename = manifestDocuments.get(0).getName(); + assertTrue(manifestFilename.startsWith("META-INF/ASiCManifest")); + assertTrue(manifestFilename.endsWith(".xml")); + + List signedDocuments = extract.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); + assertEquals("test.text", signedDocuments.get(0).getName()); + + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICE.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + } + + @Override + protected DocumentSignatureService getService() { + return service; + } + + @Override + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICE; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected DSSDocument getDocumentToSign() { + return documentToSign; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelTTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelTTest.java similarity index 70% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelTTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelTTest.java index 759cd53caf..0479c2d32b 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelTTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESLevelTTest.java @@ -20,67 +20,59 @@ */ package eu.europa.esig.dss.asic.signature.asice; -import static org.junit.Assert.assertEquals; - import java.util.Date; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.test.mock.MockTSPSource; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCELevelTTest extends AbstractTestSignature { +public class ASiCECAdESLevelTTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_T); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_T); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithCAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); } @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_T.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); - } - - @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESMultipleTimestampsTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESMultipleTimestampsTest.java new file mode 100644 index 0000000000..54dcc22b9c --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCECAdESMultipleTimestampsTest.java @@ -0,0 +1,119 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.test.TestUtils; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.test.mock.MockTSPSource; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; +import eu.europa.esig.dss.validation.reports.wrapper.SignatureWrapper; +import eu.europa.esig.dss.validation.reports.wrapper.TimestampWrapper; + +public class ASiCECAdESMultipleTimestampsTest { + + @Test + public void test() throws Exception { + List documentToSigns = new ArrayList(); + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_T); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier); + service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); + + ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters); + SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue); + + ASiCWithCAdESSignatureParameters extendParameters = new ASiCWithCAdESSignatureParameters(); + extendParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_T); + extendParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + DSSDocument extendDocument = service.extendDocument(signedDocument, extendParameters); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(extendDocument); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + + Reports reports = validator.validateDocument(); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(1, signatureIdList.size()); + assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); + + SignatureWrapper signatureWrapper = diagnosticData.getSignatureById(diagnosticData.getFirstSignatureId()); + List timestampList = signatureWrapper.getTimestampList(); + assertEquals(2, timestampList.size()); + + for (TimestampWrapper timestampWrapper : timestampList) { + assertTrue(timestampWrapper.isSignatureValid()); + } + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(extendDocument); + ASiCExtractResult result = extractor.extract(); + + assertEquals(0, result.getUnsupportedDocuments().size()); + + List signatureDocuments = result.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".p7s")); + + List manifestDocuments = result.getManifestDocuments(); + assertEquals(1, manifestDocuments.size()); + String manifestFilename = manifestDocuments.get(0).getName(); + assertTrue(manifestFilename.startsWith("META-INF/ASiCManifest")); + assertTrue(manifestFilename.endsWith(".xml")); + + List signedDocuments = result.getSignedDocuments(); + assertEquals(2, signedDocuments.size()); + + DSSDocument mimeTypeDocument = result.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICE.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + } +} diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesParallelTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesParallelTest.java new file mode 100644 index 0000000000..f8dd31fc2e --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesParallelTest.java @@ -0,0 +1,119 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.test.TestUtils; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.policy.rules.Indication; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; + +public class ASiCSCAdESLevelBMultiFilesParallelTest { + + @Test + public void test() throws Exception { + List documentToSigns = new ArrayList(); + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier); + + ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters); + SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue); + + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithCAdESService(certificateVerifier); + + dataToSign = service.getDataToSign(signedDocument, signatureParameters); + signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + + Reports reports = validator.validateDocument(); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(2, signatureIdList.size()); + for (String sigId : signatureIdList) { + assertTrue(diagnosticData.isBLevelTechnicallyValid(sigId)); + assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId)); + } + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(resignedDocument); + ASiCExtractResult result = extractor.extract(); + + assertEquals(0, result.getUnsupportedDocuments().size()); + + List signatureDocuments = result.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".p7s")); + + List manifestDocuments = result.getManifestDocuments(); + assertEquals(0, manifestDocuments.size()); + + List signedDocuments = result.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); + assertEquals("package.zip", signedDocuments.get(0).getName()); + + DSSDocument mimeTypeDocument = result.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICS.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + } +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBCAdESTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesTest.java similarity index 57% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBCAdESTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesTest.java index c478447fa8..e001ccf5c2 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBCAdESTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBMultiFilesTest.java @@ -22,65 +22,66 @@ import static org.junit.Assert.assertEquals; +import java.util.ArrayList; import java.util.Date; +import java.util.List; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; -import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.jaxb.diagnostic.XmlSignatureScope; +import eu.europa.esig.dss.signature.AbstractTestMultipleDocumentsSignatureService; +import eu.europa.esig.dss.signature.MultipleDocumentsSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; +import eu.europa.esig.dss.validation.reports.wrapper.SignatureWrapper; -public class ASiCSLevelBCAdESTest extends AbstractTestSignature { +public class ASiCSCAdESLevelBMultiFilesTest extends AbstractTestMultipleDocumentsSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; - private DSSDocument documentToSign; + private MultipleDocumentsSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; + private List documentToSigns = new ArrayList(); private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithCAdESService(certificateVerifier); } @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.CAdES_BASELINE_B.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + protected void checkSignatureScopes(DiagnosticData diagnosticData) { + SignatureWrapper signature = diagnosticData.getSignatureById(diagnosticData.getFirstSignatureId()); + List signatureScopes = signature.getSignatureScopes(); + assertEquals(1, Utils.collectionSize(signatureScopes)); // package.zip } @Override - protected DocumentSignatureService getService() { - return service; - } - - @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { return signatureParameters; } @@ -100,13 +101,18 @@ protected boolean isBaselineLTA() { } @Override - protected DSSDocument getDocumentToSign() { - return documentToSign; + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + + @Override + protected List getDocumentsToSign() { + return documentToSigns; } @Override - protected MockPrivateKeyEntry getPrivateKeyEntry() { - return privateKeyEntry; + protected MultipleDocumentsSignatureService getService() { + return service; } } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSHA512Test.java similarity index 68% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSHA512Test.java index 8afe235add..9eba3bfde9 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSHA512Test.java @@ -20,65 +20,59 @@ */ package eu.europa.esig.dss.asic.signature.asics; -import static org.junit.Assert.assertEquals; - import java.util.Date; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DigestAlgorithm; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCSLevelBTest extends AbstractTestSignature { +public class ASiCSCAdESLevelBSHA512Test extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); + signatureParameters.setDigestAlgorithm(DigestAlgorithm.SHA512); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_B.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + service = new ASiCWithCAdESService(certificateVerifier); } @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBCAdESSignFourTimeTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSignFourTimeTest.java similarity index 65% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBCAdESSignFourTimeTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSignFourTimeTest.java index 8abaadf332..9fc9839aba 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBCAdESSignFourTimeTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSignFourTimeTest.java @@ -1,22 +1,23 @@ package eu.europa.esig.dss.asic.signature.asics; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import java.util.Date; +import java.util.List; -import org.junit.Assert; import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -27,29 +28,24 @@ import eu.europa.esig.dss.validation.reports.Reports; import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -/** - * @author axel.abinet - * - */ -public class ASiCSLevelBCAdESSignFourTimeTest { +public class ASiCSCAdESLevelBSignFourTimeTest { @Test public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier); ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -59,13 +55,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithCAdESService(certificateVerifier); dataToSign = service.getDataToSign(signedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -75,13 +69,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithCAdESService(certificateVerifier); dataToSign = service.getDataToSign(resignedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -91,13 +83,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithCAdESService(certificateVerifier); dataToSign = service.getDataToSign(resignedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -108,13 +98,12 @@ public void test() throws Exception { Reports reports = validator.validateDocument(); - // reports.print(); - - while (reports != null) { - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - Assert.assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(diagnosticData.getFirstSignatureId())); - reports = reports.getNextReports(); + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(4, signatureIdList.size()); + for (String sigId : signatureIdList) { + assertTrue(diagnosticData.isBLevelTechnicallyValid(sigId)); + assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId)); } } } diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSpecialCharInFilenameTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSpecialCharInFilenameTest.java new file mode 100644 index 0000000000..7c415a4235 --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBSpecialCharInFilenameTest.java @@ -0,0 +1,102 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asics; + +import java.util.Date; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; +import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; + +public class ASiCSCAdESLevelBSpecialCharInFilenameTest extends AbstractTestDocumentSignatureService { + + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; + private DSSDocument documentToSign; + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "012éù*34ä5µ£6789~#%&()+=`@{[]}'.txt"); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithCAdESService(certificateVerifier); + } + + @Override + protected DocumentSignatureService getService() { + return service; + } + + @Override + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICS; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected DSSDocument getDocumentToSign() { + return documentToSign; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + +} diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBTest.java new file mode 100644 index 0000000000..0ded46ca40 --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBTest.java @@ -0,0 +1,144 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.util.List; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; +import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; + +public class ASiCSCAdESLevelBTest extends AbstractTestDocumentSignatureService { + + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; + private DSSDocument documentToSign; + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithCAdESService(certificateVerifier); + } + + @Override + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + + assertEquals(0, extract.getUnsupportedDocuments().size()); + + List signatureDocuments = extract.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".p7s")); + + List manifestDocuments = extract.getManifestDocuments(); + assertEquals(0, manifestDocuments.size()); + + List signedDocuments = extract.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); + assertEquals("test.text", signedDocuments.get(0).getName()); + + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICS.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + } + + @Override + protected DocumentSignatureService getService() { + return service; + } + + @Override + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICS; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected DSSDocument getDocumentToSign() { + return documentToSign; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + +} diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBWithMimeTypeTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBWithMimeTypeTest.java new file mode 100644 index 0000000000..d8f28b29fb --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBWithMimeTypeTest.java @@ -0,0 +1,127 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.Date; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; +import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; + +public class ASiCSCAdESLevelBWithMimeTypeTest extends AbstractTestDocumentSignatureService { + + private static final String APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT = "application/vnd.oasis.opendocument.text"; + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; + private DSSDocument documentToSign; + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + signatureParameters.aSiC().setMimeType(APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithCAdESService(certificateVerifier); + } + + @Override + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT, new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + } + + @Override + protected DocumentSignatureService getService() { + return service; + } + + @Override + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICS; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected DSSDocument getDocumentToSign() { + return documentToSign; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + +} diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBWithSignatureNameTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBWithSignatureNameTest.java new file mode 100644 index 0000000000..d9e65fee37 --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBWithSignatureNameTest.java @@ -0,0 +1,148 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.util.List; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; +import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; + +public class ASiCSCAdESLevelBWithSignatureNameTest extends AbstractTestDocumentSignatureService { + + private static final String SIGNATURE_FILENAME = "signature-toto.p7s"; + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; + private DSSDocument documentToSign; + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + signatureParameters.aSiC().setSignatureFileName(SIGNATURE_FILENAME); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithCAdESService(certificateVerifier); + } + + @Override + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + + assertEquals(0, extract.getUnsupportedDocuments().size()); + + List signatureDocuments = extract.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + assertEquals("META-INF/" + SIGNATURE_FILENAME, signatureDocuments.get(0).getName()); + + List manifestDocuments = extract.getManifestDocuments(); + assertEquals(0, manifestDocuments.size()); + + List signedDocuments = extract.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); + assertEquals("test.text", signedDocuments.get(0).getName()); + + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICS.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + assertTrue(Utils.isStringEmpty(extract.getZipComment())); + + } + + @Override + protected DocumentSignatureService getService() { + return service; + } + + @Override + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICS; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected DSSDocument getDocumentToSign() { + return documentToSign; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + +} diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBWithZipCommentTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBWithZipCommentTest.java new file mode 100644 index 0000000000..8b66218460 --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelBWithZipCommentTest.java @@ -0,0 +1,144 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.util.List; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCUtils; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; +import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; + +public class ASiCSCAdESLevelBWithZipCommentTest extends AbstractTestDocumentSignatureService { + + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; + private DSSDocument documentToSign; + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + signatureParameters.aSiC().setZipComment(true); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithCAdESService(certificateVerifier); + } + + @Override + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + + assertEquals(0, extract.getUnsupportedDocuments().size()); + + List signatureDocuments = extract.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + + List manifestDocuments = extract.getManifestDocuments(); + assertEquals(0, manifestDocuments.size()); + + List signedDocuments = extract.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); + assertEquals("test.text", signedDocuments.get(0).getName()); + + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICS.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + assertEquals(ASiCUtils.MIME_TYPE_COMMENT + MimeType.ASICS.getMimeTypeString(), extract.getZipComment()); + } + + @Override + protected DocumentSignatureService getService() { + return service; + } + + @Override + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICS; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected DSSDocument getDocumentToSign() { + return documentToSign; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelTTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelTTest.java similarity index 70% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelTTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelTTest.java index 6acadca48e..1b2e9b8d05 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelTTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESLevelTTest.java @@ -20,67 +20,59 @@ */ package eu.europa.esig.dss.asic.signature.asics; -import static org.junit.Assert.assertEquals; - import java.util.Date; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.test.mock.MockTSPSource; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCSLevelTTest extends AbstractTestSignature { +public class ASiCSCAdESLevelTTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithCAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_T); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_T); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithCAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); } @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_T.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); - } - - @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithCAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESMultipleTimestampsTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESMultipleTimestampsTest.java new file mode 100644 index 0000000000..5bbf97bd0e --- /dev/null +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSCAdESMultipleTimestampsTest.java @@ -0,0 +1,116 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithCAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; +import eu.europa.esig.dss.test.TestUtils; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.test.mock.MockTSPSource; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; +import eu.europa.esig.dss.validation.reports.wrapper.SignatureWrapper; +import eu.europa.esig.dss.validation.reports.wrapper.TimestampWrapper; + +public class ASiCSCAdESMultipleTimestampsTest { + + @Test + public void test() throws Exception { + List documentToSigns = new ArrayList(); + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_T); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier); + service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); + + ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters); + SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue); + + ASiCWithCAdESSignatureParameters extendParameters = new ASiCWithCAdESSignatureParameters(); + extendParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_T); + extendParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + DSSDocument extendDocument = service.extendDocument(signedDocument, extendParameters); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(extendDocument); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + + Reports reports = validator.validateDocument(); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(1, signatureIdList.size()); + assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); + + SignatureWrapper signatureWrapper = diagnosticData.getSignatureById(diagnosticData.getFirstSignatureId()); + List timestampList = signatureWrapper.getTimestampList(); + assertEquals(2, timestampList.size()); + + for (TimestampWrapper timestampWrapper : timestampList) { + assertTrue(timestampWrapper.isSignatureValid()); + } + + AbstractASiCContainerExtractor extractor = new ASiCWithCAdESContainerExtractor(extendDocument); + ASiCExtractResult result = extractor.extract(); + + assertEquals(0, result.getUnsupportedDocuments().size()); + + List signatureDocuments = result.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".p7s")); + + List manifestDocuments = result.getManifestDocuments(); + assertEquals(0, manifestDocuments.size()); + + List signedDocuments = result.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); + + DSSDocument mimeTypeDocument = result.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICS.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + } +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_CAdESLTACheckTimeStampIDTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_CAdESLTACheckTimeStampIDTest.java similarity index 80% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_CAdESLTACheckTimeStampIDTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_CAdESLTACheckTimeStampIDTest.java index da61c87eb7..d4a2627b4a 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_CAdESLTACheckTimeStampIDTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_CAdESLTACheckTimeStampIDTest.java @@ -5,16 +5,15 @@ import org.junit.Assert; import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -30,21 +29,20 @@ public class ASiCE_CAdESLTACheckTimeStampIDTest { @Test public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_LTA); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_LTA); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); ToBeSigned toBeSigned = service.getDataToSign(documentToSign, signatureParameters); diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_CAdESLTACheckTimeStampIDTest.java b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_CAdESLTACheckTimeStampIDTest.java similarity index 80% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_CAdESLTACheckTimeStampIDTest.java rename to dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_CAdESLTACheckTimeStampIDTest.java index 0de6e0d953..fe7b152e41 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_CAdESLTACheckTimeStampIDTest.java +++ b/dss-asic-cades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_CAdESLTACheckTimeStampIDTest.java @@ -5,16 +5,15 @@ import org.junit.Assert; import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -30,21 +29,20 @@ public class ASiCS_CAdESLTACheckTimeStampIDTest { @Test public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithCAdESSignatureParameters signatureParameters = new ASiCWithCAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_LTA); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_LTA); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithCAdESService service = new ASiCWithCAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); ToBeSigned toBeSigned = service.getDataToSign(documentToSign, signatureParameters); diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-1.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-1.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-1.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-1.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-2.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-2.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-2.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-2.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-3.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-3.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-3.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-3.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-7.asics b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-7.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-7.asics rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-7.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-8.asics b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-8.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-8.asics rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-8.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-9.asics b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-9.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-9.asics rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-9.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-10.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-10.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-10.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-10.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-11.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-11.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-11.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-11.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-12.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-12.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-12.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-12.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-7.asics b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-7.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-7.asics rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-7.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-8.asics b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-8.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-8.asics rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-8.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-9.asics b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-9.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-9.asics rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-9.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-1.asics b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-1.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-1.asics rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-1.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-2.asics b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-2.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-2.asics rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-2.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-4.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-4.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-4.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-4.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-5.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-5.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-5.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-5.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-6.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-6.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-6.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-6.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-7.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-7.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-7.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-7.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-8.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-8.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-8.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-8.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-9.asice b/dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-9.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-9.asice rename to dss-asic-cades/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-9.asice diff --git a/dss-asic-common/pom.xml b/dss-asic-common/pom.xml new file mode 100644 index 0000000000..6953adee08 --- /dev/null +++ b/dss-asic-common/pom.xml @@ -0,0 +1,24 @@ + + 4.0.0 + + org.digidoc4j.dss + sd-dss + 5.0.d4j.1 + + + dss-asic-common + DSS ASiC Common + DSS ASiC-common contains common classes between ASiC C/XAdES. + + + + ${project.groupId} + dss-document + + + + ${project.groupId} + dss-utils + + + \ No newline at end of file diff --git a/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCExtractResult.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCExtractResult.java new file mode 100644 index 0000000000..cd22c3ce22 --- /dev/null +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCExtractResult.java @@ -0,0 +1,65 @@ +package eu.europa.esig.dss.asic; + +import java.util.ArrayList; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; + +public class ASiCExtractResult { + + private String zipComment; + private DSSDocument mimeTypeDocument; + private List signatureDocuments = new ArrayList(); + private List manifestDocuments = new ArrayList(); + private List signedDocuments = new ArrayList(); + private List unsupportedDocuments = new ArrayList(); + + public String getZipComment() { + return zipComment; + } + + public void setZipComment(String zipComment) { + this.zipComment = zipComment; + } + + public DSSDocument getMimeTypeDocument() { + return mimeTypeDocument; + } + + public void setMimeTypeDocument(DSSDocument mimeTypeDocument) { + this.mimeTypeDocument = mimeTypeDocument; + } + + public List getSignatureDocuments() { + return signatureDocuments; + } + + public void setSignatureDocuments(List signatureDocuments) { + this.signatureDocuments = signatureDocuments; + } + + public List getManifestDocuments() { + return manifestDocuments; + } + + public void setManifestDocuments(List manifestDocuments) { + this.manifestDocuments = manifestDocuments; + } + + public List getSignedDocuments() { + return signedDocuments; + } + + public void setSignedDocuments(List signedDocuments) { + this.signedDocuments = signedDocuments; + } + + public List getUnsupportedDocuments() { + return unsupportedDocuments; + } + + public void setUnsupportedDocuments(List unsupportedDocuments) { + this.unsupportedDocuments = unsupportedDocuments; + } + +} diff --git a/dss-tsl-validation/src/main/java/eu/europa/esig/dss/tsl/TSLServiceExtension.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCNamespace.java similarity index 57% rename from dss-tsl-validation/src/main/java/eu/europa/esig/dss/tsl/TSLServiceExtension.java rename to dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCNamespace.java index 1b8fea3c30..1df045c2ca 100644 --- a/dss-tsl-validation/src/main/java/eu/europa/esig/dss/tsl/TSLServiceExtension.java +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCNamespace.java @@ -18,33 +18,23 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package eu.europa.esig.dss.tsl; - -import java.util.List; +package eu.europa.esig.dss.asic; /** - * This class is a DTO representation for an extension of a TSL service. + * This class contains constants for ASiC and its namespace. * */ -public class TSLServiceExtension { - - private boolean critical; - private List conditionsForQualifiers; +public final class ASiCNamespace { - public boolean isCritical() { - return critical; - } + public static final String NS = "http://uri.etsi.org/02918/v1.2.1#"; + public static final String XADES_SIGNATURES = "asic:XAdESSignatures"; + public static final String ASIC_MANIFEST = "asic:ASiCManifest"; + public static final String SIG_REFERENCE = "asic:SigReference"; + public static final String DATA_OBJECT_REFERENCE = "asic:DataObjectReference"; - public void setCritical(boolean critical) { - this.critical = critical; - } + public static final String XPATH_ASIC_SIGREF_URL = "/asic:ASiCManifest/asic:SigReference/@URI"; + public static final String XPATH_ASIC_DATA_OBJECT_REFERENCE = "/asic:ASiCManifest/asic:DataObjectReference"; - public List getConditionsForQualifiers() { - return conditionsForQualifiers; + private ASiCNamespace() { } - - public void setConditionsForQualifiers(List conditionsForQualifiers) { - this.conditionsForQualifiers = conditionsForQualifiers; - } - } diff --git a/dss-asic/src/main/java/eu/europa/esig/dss/asic/ASiCParameters.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCParameters.java similarity index 53% rename from dss-asic/src/main/java/eu/europa/esig/dss/asic/ASiCParameters.java rename to dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCParameters.java index 6cc976fa7c..684bc02991 100644 --- a/dss-asic/src/main/java/eu/europa/esig/dss/asic/ASiCParameters.java +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCParameters.java @@ -22,8 +22,7 @@ import java.io.Serializable; -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.SignatureForm; +import eu.europa.esig.dss.ASiCContainerType; /** * This class regroups the signature parameters related to ASiC form. @@ -36,27 +35,16 @@ public class ASiCParameters implements Serializable { */ private boolean zipComment = false; - private String zipCommentValue; //BDoc specific functionality - /** - * Indicates the mime-type to be set within the mimetype file. If null the stored mime-type is that of the signed content. + * Indicates the mime-type to be set within the mimetype file. If null the stored mime-type is that of the signed + * content. */ private String mimeType = null; - /** - * The default signature form to use within the ASiC containers. - */ - private SignatureForm underlyingForm = SignatureForm.XAdES; - /** * The form of the container -S or -E. */ - SignatureForm containerForm; - - /** - * This variable contains already enclosed signature(s) when appending a new one. - */ - private DSSDocument enclosedSignature; + private ASiCContainerType containerType; /** * This property allows to provide a specific signature file name in the case of an ASiC-E container. @@ -69,22 +57,6 @@ public class ASiCParameters implements Serializable { public ASiCParameters() { } - /** - * A copy constructor. - * - * @param source {@code ASiCParameters} - */ - public ASiCParameters(final ASiCParameters source) { - - zipComment = source.zipComment; - zipCommentValue = source.zipCommentValue; //BDoc specific functionality - mimeType = source.mimeType; - underlyingForm = source.underlyingForm; - containerForm = source.containerForm; - enclosedSignature = source.enclosedSignature; - signatureFileName = source.signatureFileName; - } - /** * Indicates if the ZIP comment must include the mime-type. * @@ -103,16 +75,6 @@ public void setZipComment(final boolean zipComment) { this.zipComment = zipComment; } - //BDoc specific functionality - public String getZipCommentValue() { - return zipCommentValue; - } - - public void setZipCommentValue(String zipCommentValue) { - this.zipCommentValue = zipCommentValue; - } - //End of BDoc specific functionality - public String getMimeType() { return mimeType; } @@ -120,48 +82,22 @@ public String getMimeType() { /** * This method allows to set the mime-type within the mimetype file. * - * @param mimeType the mimetype to store + * @param mimeType + * the mimetype to store */ public void setMimeType(final String mimeType) { this.mimeType = mimeType; } - public SignatureForm getUnderlyingForm() { - return underlyingForm; - } - - /** - * Sets the signature form associated with an ASiC container. Only two forms are acceptable: XAdES and CAdES. - * - * @param underlyingForm signature form to associate with the ASiC container. - */ - public void setUnderlyingForm(final SignatureForm underlyingForm) { - this.underlyingForm = underlyingForm; - } - - /** - * @return the {@code SignatureForm} of the ASiC container - */ - public SignatureForm getContainerForm() { - return containerForm; - } - /** - * This method allows to set the already existing signature. It is used when re-sign the ASIC-S container. - * - * @param signature extracted from the already existing container. + * @return the {@code ASiCContainerType} of the ASiC container */ - public void setEnclosedSignature(final DSSDocument signature) { - this.enclosedSignature = signature; + public ASiCContainerType getContainerType() { + return containerType; } - /** - * This method returns the already existing signature within a container. - * - * @return {@code DSSDocument} representing a signature - */ - public DSSDocument getEnclosedSignature() { - return enclosedSignature; + public void setContainerType(ASiCContainerType containerType) { + this.containerType = containerType; } /** @@ -176,9 +112,11 @@ public String getSignatureFileName() { /** * This method allows to set the signature file name to use with ASiC-E container. * - * @param signatureFileName signature file name + * @param signatureFileName + * signature file name */ public void setSignatureFileName(final String signatureFileName) { this.signatureFileName = signatureFileName; } + } diff --git a/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCUtils.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCUtils.java new file mode 100644 index 0000000000..8f007b7832 --- /dev/null +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/ASiCUtils.java @@ -0,0 +1,192 @@ +package eu.europa.esig.dss.asic; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.utils.Utils; + +public final class ASiCUtils { + + private static final Logger LOG = LoggerFactory.getLogger(ASiCUtils.class); + + private static final String MIME_TYPE = "mimetype"; + public static final String MIME_TYPE_COMMENT = MIME_TYPE + "="; + private static final String META_INF_FOLDER = "META-INF/"; + + private ASiCUtils() { + } + + public static boolean isSignature(final String entryName) { + return entryName.startsWith(META_INF_FOLDER) && entryName.contains("signature") && !entryName.contains("Manifest"); + } + + public static String getMimeTypeString(final ASiCParameters asicParameters) { + final String asicParameterMimeType = asicParameters.getMimeType(); + String mimeTypeString; + if (Utils.isStringBlank(asicParameterMimeType)) { + if (isASiCE(asicParameters)) { + mimeTypeString = MimeType.ASICE.getMimeTypeString(); + } else { + mimeTypeString = MimeType.ASICS.getMimeTypeString(); + } + } else { + mimeTypeString = asicParameterMimeType; + } + return mimeTypeString; + } + + public static boolean isASiCMimeType(final MimeType asicMimeType) { + return MimeType.ASICS.equals(asicMimeType) || MimeType.ASICE.equals(asicMimeType) || MimeType.ODT.equals(asicMimeType) + || MimeType.ODS.equals(asicMimeType); + } + + public static ASiCContainerType getASiCContainerType(final MimeType asicMimeType) { + if (MimeType.ASICS == asicMimeType) { + return ASiCContainerType.ASiC_S; + } else if (MimeType.ASICE == asicMimeType || MimeType.ODT == asicMimeType || MimeType.ODS.equals(asicMimeType)) { + return ASiCContainerType.ASiC_E; + } else { + throw new IllegalArgumentException("Not allowed mimetype " + asicMimeType); + } + } + + public static boolean isASiCE(final ASiCParameters asicParameters) { + return ASiCContainerType.ASiC_E.equals(asicParameters.getContainerType()); + } + + public static boolean isASiCS(final ASiCParameters asicParameters) { + return ASiCContainerType.ASiC_S.equals(asicParameters.getContainerType()); + } + + public static MimeType getMimeType(ASiCParameters asicParameters) { + return isASiCE(asicParameters) ? MimeType.ASICE : MimeType.ASICS; + } + + public static boolean isArchiveContainsCorrectSignatureExtension(DSSDocument toSignDocument, String extension) { + boolean isSignatureTypeCorrect = true; + InputStream is = null; + ZipInputStream zis = null; + try { + is = toSignDocument.openStream(); + zis = new ZipInputStream(is); + ZipEntry entry; + while ((entry = zis.getNextEntry()) != null) { + if (isSignature(entry.getName())) { + isSignatureTypeCorrect &= entry.getName().endsWith(extension); + } + } + } catch (IOException e) { + throw new DSSException("Unable to analyze the archive content", e); + } finally { + Utils.closeQuietly(zis); + Utils.closeQuietly(is); + } + return isSignatureTypeCorrect; + } + + public static boolean isArchive(List docs) { + if (Utils.collectionSize(docs) == 1) { + return isASiCContainer(docs.get(0)); + } + return false; + } + + public static boolean isASiCContainer(DSSDocument dssDocument) { + byte[] preamble = new byte[2]; + InputStream is = null; + try { + is = dssDocument.openStream(); + int r = is.read(preamble, 0, 2); + if (r != 2) { + return false; + } + } catch (IOException e) { + throw new DSSException("Unable to read the 2 first bytes", e); + } finally { + Utils.closeQuietly(is); + } + + return (preamble[0] == 'P') && (preamble[1] == 'K'); + } + + public static boolean isXAdES(final String entryName) { + return isSignature(entryName) && entryName.endsWith(".xml"); + } + + public static boolean isCAdES(final String entryName) { + return isSignature(entryName) && (entryName.endsWith(".p7s")); + } + + public static MimeType getMimeType(final DSSDocument mimeTypeDocument) throws DSSException { + InputStream is = null; + try { + is = mimeTypeDocument.openStream(); + byte[] byteArray = Utils.toByteArray(is); + final String mimeTypeString = new String(byteArray, "UTF-8"); + return MimeType.fromMimeTypeString(mimeTypeString); + } catch (IOException e) { + throw new DSSException(e); + } finally { + Utils.closeQuietly(is); + } + } + + public static ASiCContainerType getContainerType(DSSDocument archive, DSSDocument mimetype, String zipComment, List signedDocuments) { + ASiCContainerType containerType = getContainerTypeFromMimeType(archive.getMimeType()); + if (containerType == null) { + containerType = getContainerTypeFromMimeTypeDocument(mimetype); + if (containerType == null) { + containerType = getContainerTypeFromZipComment(zipComment); + } + } + + if (containerType == null) { + LOG.warn("Unable to define the ASiC Container type with its properties"); + if (Utils.collectionSize(signedDocuments) <= 1) { + containerType = ASiCContainerType.ASiC_S; + } else { + containerType = ASiCContainerType.ASiC_E; + } + } + + return containerType; + } + + private static ASiCContainerType getContainerTypeFromZipComment(String zipComment) { + if (Utils.isStringNotBlank(zipComment)) { + int indexOf = zipComment.indexOf(MIME_TYPE_COMMENT); + if (indexOf > -1) { + String asicCommentMimeTypeString = zipComment.substring(MIME_TYPE_COMMENT.length() + indexOf); + MimeType mimeTypeFromZipComment = MimeType.fromMimeTypeString(asicCommentMimeTypeString); + return getContainerTypeFromMimeType(mimeTypeFromZipComment); + } + } + return null; + } + + private static ASiCContainerType getContainerTypeFromMimeTypeDocument(DSSDocument mimetype) { + if (mimetype != null) { + MimeType mimeTypeFromEmbeddedFile = ASiCUtils.getMimeType(mimetype); + return getContainerTypeFromMimeType(mimeTypeFromEmbeddedFile); + } + return null; + } + + private static ASiCContainerType getContainerTypeFromMimeType(MimeType mimeType) { + if (ASiCUtils.isASiCMimeType(mimeType)) { + return ASiCUtils.getASiCContainerType(mimeType); + } + return null; + } + +} diff --git a/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/AbstractASiCContainerExtractor.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/AbstractASiCContainerExtractor.java new file mode 100644 index 0000000000..7a4a878795 --- /dev/null +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/AbstractASiCContainerExtractor.java @@ -0,0 +1,138 @@ +package eu.europa.esig.dss.asic; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.utils.Utils; + +/** + * This class is used to read an ASiC Container and to retrieve its content files + */ +public abstract class AbstractASiCContainerExtractor { + + private static final Logger LOG = LoggerFactory.getLogger(AbstractASiCContainerExtractor.class); + + private static final String MIME_TYPE = "mimetype"; + protected static final String META_INF_FOLDER = "META-INF/"; + + private final DSSDocument asicContainer; + + protected AbstractASiCContainerExtractor(DSSDocument asicContainer) { + this.asicContainer = asicContainer; + } + + public ASiCExtractResult extract() { + ASiCExtractResult result = new ASiCExtractResult(); + + ZipInputStream asicsInputStream = null; + try { + asicsInputStream = new ZipInputStream(asicContainer.openStream()); + ZipEntry entry; + while ((entry = asicsInputStream.getNextEntry()) != null) { + String entryName = entry.getName(); + if (isMetaInfFolder(entryName)) { + if (isAllowedSignature(entryName)) { + result.getSignatureDocuments().add(getCurrentDocument(entryName, asicsInputStream)); + } else if (isAllowedManifest(entryName)) { + result.getManifestDocuments().add(getCurrentDocument(entryName, asicsInputStream)); + } else if (!isFolder(entryName)) { + result.getUnsupportedDocuments().add(getCurrentDocument(entryName, asicsInputStream)); + } + } else if (!isFolder(entryName)) { + if (isMimetype(entryName)) { + result.setMimeTypeDocument(getCurrentDocument(entryName, asicsInputStream)); + } else { + result.getSignedDocuments().add(getCurrentDocument(entryName, asicsInputStream)); + } + } else { + result.getUnsupportedDocuments().add(getCurrentDocument(entryName, asicsInputStream)); + } + } + + if (Utils.isCollectionNotEmpty(result.getUnsupportedDocuments())) { + LOG.warn("Unsupported files : " + result.getUnsupportedDocuments()); + } + + } catch (IOException e) { + LOG.warn("Unable to parse the container " + e.getMessage()); + } finally { + Utils.closeQuietly(asicsInputStream); + } + + result.setZipComment(getZipComment()); + + return result; + } + + public String getZipComment() { + InputStream is = null; + try { + is = asicContainer.openStream(); + byte[] buffer = Utils.toByteArray(is); + final int len = buffer.length; + final byte[] magicDirEnd = { 0x50, 0x4b, 0x05, 0x06 }; + + // Check the buffer from the end + for (int ii = len - magicDirEnd.length - 22; ii >= 0; ii--) { + boolean isMagicStart = true; + for (int jj = 0; jj < magicDirEnd.length; jj++) { + if (buffer[ii + jj] != magicDirEnd[jj]) { + isMagicStart = false; + break; + } + } + if (isMagicStart) { + // Magic Start found! + int commentLen = buffer[ii + 20] + buffer[ii + 21] * 256; + int realLen = len - ii - 22; + if (commentLen != realLen) { + LOG.warn("WARNING! ZIP comment size mismatch: directory says len is " + commentLen + ", but file ends after " + realLen + " bytes!"); + } + return new String(buffer, ii + 22, realLen); + + } + } + } catch (Exception e) { + LOG.warn("Unable to extract the ZIP comment : " + e.getMessage()); + } finally { + Utils.closeQuietly(is); + } + return null; + } + + private boolean isMimetype(String entryName) { + return MIME_TYPE.equals(entryName); + } + + private boolean isMetaInfFolder(String entryName) { + return entryName.startsWith(META_INF_FOLDER); + } + + private boolean isFolder(String entryName) { + return entryName.endsWith("/"); + } + + abstract boolean isAllowedManifest(String entryName); + + abstract boolean isAllowedSignature(String entryName); + + private DSSDocument getCurrentDocument(String filepath, ZipInputStream zis) throws IOException { + ByteArrayOutputStream baos = null; + try { + baos = new ByteArrayOutputStream(); + Utils.copy(zis, baos); + return new InMemoryDocument(baos.toByteArray(), filepath); + } finally { + Utils.closeQuietly(baos); + } + } + +} diff --git a/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/signature/AbstractASiCSignatureService.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/signature/AbstractASiCSignatureService.java new file mode 100644 index 0000000000..9eed384d70 --- /dev/null +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/signature/AbstractASiCSignatureService.java @@ -0,0 +1,197 @@ +package eu.europa.esig.dss.asic.signature; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.List; +import java.util.zip.CRC32; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import eu.europa.esig.dss.AbstractSignatureParameters; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.DSSUnsupportedOperationException; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.ASiCUtils; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.signature.AbstractSignatureService; +import eu.europa.esig.dss.signature.MultipleDocumentsSignatureService; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.CertificateVerifier; + +public abstract class AbstractASiCSignatureService extends AbstractSignatureService + implements MultipleDocumentsSignatureService { + + private static final long serialVersionUID = 243114076381526665L; + + private static final String ZIP_ENTRY_DETACHED_FILE = "detached-file"; + private static final String ZIP_ENTRY_MIMETYPE = "mimetype"; + + private ASiCExtractResult archiveContent = new ASiCExtractResult(); + + protected AbstractASiCSignatureService(CertificateVerifier certificateVerifier) { + super(certificateVerifier); + } + + protected void assertCanBeSign(List documents, final ASiCParameters asicParameters) { + if (!canBeSigned(documents, asicParameters)) { // First verify if the file can be signed + throw new DSSUnsupportedOperationException("You only can sign an ASiC container by using the same type of container and of signature"); + } + } + + abstract boolean canBeSigned(List documents, ASiCParameters asicParameters); + + @Override + public ToBeSigned getDataToSign(DSSDocument toSignDocument, SP parameters) throws DSSException { + return getDataToSign(Arrays.asList(toSignDocument), parameters); + } + + @Override + public DSSDocument signDocument(DSSDocument toSignDocument, SP parameters, SignatureValue signatureValue) throws DSSException { + return signDocument(Arrays.asList(toSignDocument), parameters, signatureValue); + } + + protected void extractCurrentArchive(DSSDocument archive) { + AbstractASiCContainerExtractor extractor = getArchiveExtractor(archive); + archiveContent = extractor.extract(); + } + + abstract AbstractASiCContainerExtractor getArchiveExtractor(DSSDocument archive); + + protected List getEmbeddedSignatures() { + return archiveContent.getSignatureDocuments(); + } + + protected List getEmbeddedManifests() { + return archiveContent.getManifestDocuments(); + } + + protected List getEmbeddedSignedDocuments() { + return archiveContent.getSignedDocuments(); + } + + protected DSSDocument getEmbeddedMimetype() { + return archiveContent.getMimeTypeDocument(); + } + + protected void copyExistingArchiveWithSignatureList(DSSDocument archiveDocument, List signaturesToAdd, ByteArrayOutputStream baos) { + ZipOutputStream zos = null; + try { + zos = new ZipOutputStream(baos); + copyArchiveContentWithoutSignatures(archiveDocument, zos); + storeSignatures(signaturesToAdd, zos); + } catch (IOException e) { + throw new DSSException("Unable to extend the ASiC container", e); + } finally { + Utils.closeQuietly(zos); + } + } + + private void copyArchiveContentWithoutSignatures(DSSDocument archiveDocument, ZipOutputStream zos) throws IOException { + ZipInputStream zis = null; + try { + zis = new ZipInputStream(archiveDocument.openStream()); + ZipEntry entry; + while ((entry = zis.getNextEntry()) != null) { + final String name = entry.getName(); + final ZipEntry newEntry = new ZipEntry(name); + if (!isSignatureFilename(name)) { + zos.putNextEntry(newEntry); + Utils.copy(zis, zos); + } + } + } finally { + Utils.closeQuietly(zis); + } + } + + abstract boolean isSignatureFilename(String name); + + protected DSSDocument buildASiCContainer(List documentsToBeSigned, List signatures, List manifestDocuments, + ASiCParameters asicParameters) { + + ByteArrayOutputStream baos = null; + ZipOutputStream zos = null; + try { + baos = new ByteArrayOutputStream(); + zos = new ZipOutputStream(baos); + + if (ASiCUtils.isASiCE(asicParameters)) { + storeASICEManifest(manifestDocuments, zos); + } + + storeSignatures(signatures, zos); + storeSignedFiles(documentsToBeSigned, zos); + storeMimetype(asicParameters, zos); + storeZipComment(asicParameters, zos); + + } catch (IOException e) { + throw new DSSException("Unable to build the ASiC Container", e); + } finally { + Utils.closeQuietly(zos); + Utils.closeQuietly(baos); + } + + return new InMemoryDocument(baos.toByteArray(), null, ASiCUtils.getMimeType(asicParameters)); + } + + private void storeASICEManifest(List manifestDocuments, ZipOutputStream zos) throws IOException { + for (DSSDocument manifestDocument : manifestDocuments) { + final ZipEntry entrySignature = new ZipEntry(manifestDocument.getName()); + zos.putNextEntry(entrySignature); + manifestDocument.writeTo(zos); + } + } + + abstract void storeSignatures(List signaturesToAdd, ZipOutputStream zos) throws IOException; + + private void storeSignedFiles(final List detachedDocuments, final ZipOutputStream zos) throws IOException { + for (DSSDocument detachedDocument : detachedDocuments) { + InputStream is = null; + try { + final String detachedDocumentName = detachedDocument.getName(); + final String name = detachedDocumentName != null ? detachedDocumentName : ZIP_ENTRY_DETACHED_FILE; + final ZipEntry entryDocument = new ZipEntry(name); + zos.setLevel(ZipEntry.DEFLATED); + + zos.putNextEntry(entryDocument); + is = detachedDocument.openStream(); + Utils.copy(is, zos); + } finally { + Utils.closeQuietly(is); + } + } + } + + private void storeMimetype(final ASiCParameters asicParameters, final ZipOutputStream zos) throws IOException { + final byte[] mimeTypeBytes = ASiCUtils.getMimeTypeString(asicParameters).getBytes("UTF-8"); + final ZipEntry entryMimetype = getZipEntryMimeType(mimeTypeBytes); + zos.putNextEntry(entryMimetype); + Utils.write(mimeTypeBytes, zos); + } + + private ZipEntry getZipEntryMimeType(final byte[] mimeTypeBytes) { + final ZipEntry entryMimetype = new ZipEntry(ZIP_ENTRY_MIMETYPE); + entryMimetype.setMethod(ZipEntry.STORED); + entryMimetype.setSize(mimeTypeBytes.length); + entryMimetype.setCompressedSize(mimeTypeBytes.length); + final CRC32 crc = new CRC32(); + crc.update(mimeTypeBytes); + entryMimetype.setCrc(crc.getValue()); + return entryMimetype; + } + + protected void storeZipComment(final ASiCParameters asicParameters, final ZipOutputStream zos) { + if (asicParameters.isZipComment()) { + zos.setComment(ASiCUtils.MIME_TYPE_COMMENT + ASiCUtils.getMimeTypeString(asicParameters)); + } + } + +} diff --git a/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/signature/GetDataToSignHelper.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/signature/GetDataToSignHelper.java new file mode 100644 index 0000000000..6ee68c3072 --- /dev/null +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/signature/GetDataToSignHelper.java @@ -0,0 +1,17 @@ +package eu.europa.esig.dss.asic.signature; + +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; + +public interface GetDataToSignHelper { + + String getSignatureFilename(); + + List getSignedDocuments(); + + List getSignatures(); + + List getManifestFiles(); + +} diff --git a/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/signature/asics/AbstractGetDataToSignASiCS.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/signature/asics/AbstractGetDataToSignASiCS.java new file mode 100644 index 0000000000..d0bd70851a --- /dev/null +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/signature/asics/AbstractGetDataToSignASiCS.java @@ -0,0 +1,54 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Date; +import java.util.List; +import java.util.zip.CRC32; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.utils.Utils; + +public abstract class AbstractGetDataToSignASiCS { + + private static final String ZIP_ENTRY_DETACHED_FILE = "detached-file"; + + /* In case of multi-files and ASiC-S, we need to create a zip with all files to be signed */ + protected DSSDocument createPackageZip(List documents, Date signingDate) { + ByteArrayOutputStream baos = null; + ZipOutputStream zos = null; + try { + baos = new ByteArrayOutputStream(); + zos = new ZipOutputStream(baos); + + for (DSSDocument document : documents) { + final String documentName = document.getName(); + final String name = documentName != null ? documentName : ZIP_ENTRY_DETACHED_FILE; + final ZipEntry entryDocument = new ZipEntry(name); + entryDocument.setTime(signingDate.getTime()); + entryDocument.setMethod(ZipEntry.STORED); + byte[] byteArray = DSSUtils.toByteArray(document); + entryDocument.setSize(byteArray.length); + entryDocument.setCompressedSize(byteArray.length); + final CRC32 crc = new CRC32(); + crc.update(byteArray); + entryDocument.setCrc(crc.getValue()); + zos.putNextEntry(entryDocument); + Utils.write(byteArray, zos); + } + + } catch (IOException e) { + throw new DSSException("Unable to create package.zip file", e); + } finally { + Utils.closeQuietly(zos); + Utils.closeQuietly(baos); + } + return new InMemoryDocument(baos.toByteArray(), "package.zip"); + } + +} diff --git a/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/validation/ASiCSignatureValidator.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/validation/ASiCSignatureValidator.java new file mode 100644 index 0000000000..7068be54ef --- /dev/null +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/validation/ASiCSignatureValidator.java @@ -0,0 +1,16 @@ +package eu.europa.esig.dss.asic.validation; + +import eu.europa.esig.dss.validation.DocumentValidator; +import eu.europa.esig.dss.x509.CertificatePool; + +public interface ASiCSignatureValidator extends DocumentValidator { + + /** + * This method allows to share the certificate pool between signature validations + * + * @param validationCertPool + * the certificate pool + */ + void setValidationCertPool(CertificatePool validationCertPool); + +} diff --git a/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/validation/AbstractASiCContainerValidator.java b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/validation/AbstractASiCContainerValidator.java new file mode 100644 index 0000000000..862d4f5919 --- /dev/null +++ b/dss-asic-common/src/main/java/eu/europa/esig/dss/asic/validation/AbstractASiCContainerValidator.java @@ -0,0 +1,133 @@ +package eu.europa.esig.dss.asic.validation; + +import java.util.ArrayList; +import java.util.List; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.DSSUnsupportedOperationException; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCUtils; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.AdvancedSignature; +import eu.europa.esig.dss.validation.ContainerInfo; +import eu.europa.esig.dss.validation.DocumentValidator; +import eu.europa.esig.dss.validation.ManifestFile; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.ValidationContext; + +public abstract class AbstractASiCContainerValidator extends SignedDocumentValidator { + + protected List validators; + + private ASiCExtractResult extractResult; + + private ASiCContainerType containerType; + + /** + * Default constructor used with reflexion (see SignedDocumentValidator) + */ + private AbstractASiCContainerValidator() { + super(null); + this.document = null; + } + + protected AbstractASiCContainerValidator(final DSSDocument document) { + super(null); + this.document = document; + } + + protected void analyseEntries() { + AbstractASiCContainerExtractor extractor = getArchiveExtractor(); + extractResult = extractor.extract(); + + containerType = ASiCUtils.getContainerType(document, extractResult.getMimeTypeDocument(), extractResult.getZipComment(), + extractResult.getSignedDocuments()); + } + + abstract AbstractASiCContainerExtractor getArchiveExtractor(); + + public ASiCContainerType getContainerType() { + return containerType; + } + + @Override + public List processSignaturesValidation(final ValidationContext validationContext, boolean structuralValidation) { + List allSignatures = new ArrayList(); + List currentValidators = getValidators(); + for (DocumentValidator documentValidator : currentValidators) { // CAdES / XAdES + allSignatures.addAll(documentValidator.processSignaturesValidation(validationContext, structuralValidation)); + } + return allSignatures; + } + + /** + * This method allows to retrieve the container information (ASiC Container) + * + * @return + */ + @Override + protected ContainerInfo getContainerInfo() { + ContainerInfo containerInfo = new ContainerInfo(); + containerInfo.setContainerType(containerType); + containerInfo.setZipComment(extractResult.getZipComment()); + + DSSDocument mimeTypeDocument = extractResult.getMimeTypeDocument(); + if (mimeTypeDocument != null) { + String mimeTypeContent = DSSUtils.toString(DSSUtils.toByteArray(mimeTypeDocument)); + containerInfo.setMimeTypeFilePresent(true); + containerInfo.setMimeTypeContent(mimeTypeContent); + } else { + containerInfo.setMimeTypeFilePresent(false); + } + + List signedDocuments = extractResult.getSignedDocuments(); + if (Utils.isCollectionNotEmpty(signedDocuments)) { + List signedDocumentFilenames = new ArrayList(); + for (DSSDocument dssDocument : signedDocuments) { + signedDocumentFilenames.add(dssDocument.getName()); + } + containerInfo.setSignedDocumentFilenames(signedDocumentFilenames); + } + + containerInfo.setManifestFiles(getManifestFilesDecriptions()); + + return containerInfo; + } + + protected abstract List getManifestFilesDecriptions(); + + @Override + public List getSignatures() { + List allSignatures = new ArrayList(); + List currentValidators = getValidators(); + for (DocumentValidator documentValidator : currentValidators) { + allSignatures.addAll(documentValidator.getSignatures()); + } + return allSignatures; + } + + abstract List getValidators(); + + protected List getSignatureDocuments() { + return extractResult.getSignatureDocuments(); + } + + protected List getSignedDocuments() { + return extractResult.getSignedDocuments(); + } + + protected List getManifestDocuments() { + return extractResult.getManifestDocuments(); + } + + @Override + public List getOriginalDocuments(String signatureId) throws DSSException { + // TODO + throw new DSSUnsupportedOperationException("This method is not applicable for this kind of file!"); + } + +} diff --git a/dss-asic-xades/pom.xml b/dss-asic-xades/pom.xml new file mode 100644 index 0000000000..4312b8ec02 --- /dev/null +++ b/dss-asic-xades/pom.xml @@ -0,0 +1,36 @@ + + 4.0.0 + + org.digidoc4j.dss + sd-dss + 5.0.d4j.1 + + + dss-asic-xades + DSS ASiC with XAdES signature(s) + DSS ASiC with XAdES contains the code for the creation and validation of ASiC containers with XAdES signature(s). + + + + ${project.groupId} + dss-asic-common + + + ${project.groupId} + dss-xades + + + + + ${project.groupId} + dss-test + test + + + ${project.groupId} + dss-document + test-jar + test + + + \ No newline at end of file diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/ASiCWithXAdESContainerExtractor.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/ASiCWithXAdESContainerExtractor.java new file mode 100644 index 0000000000..394c0261ea --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/ASiCWithXAdESContainerExtractor.java @@ -0,0 +1,21 @@ +package eu.europa.esig.dss.asic; + +import eu.europa.esig.dss.DSSDocument; + +public class ASiCWithXAdESContainerExtractor extends AbstractASiCContainerExtractor { + + public ASiCWithXAdESContainerExtractor(DSSDocument archive) { + super(archive); + } + + @Override + boolean isAllowedManifest(String entryName) { + return entryName.equals(META_INF_FOLDER + "manifest.xml"); + } + + @Override + boolean isAllowedSignature(String entryName) { + return ASiCUtils.isXAdES(entryName); + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/ASiCWithXAdESSignatureParameters.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/ASiCWithXAdESSignatureParameters.java new file mode 100644 index 0000000000..8757f1ac4c --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/ASiCWithXAdESSignatureParameters.java @@ -0,0 +1,28 @@ +package eu.europa.esig.dss.asic; + +import eu.europa.esig.dss.SignatureForm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.xades.XAdESSignatureParameters; + +public class ASiCWithXAdESSignatureParameters extends XAdESSignatureParameters { + + private static final long serialVersionUID = 5004478692506008320L; + + /** + * The object representing the parameters related to ASiC from of the signature. + */ + private ASiCParameters aSiCParams = new ASiCParameters(); + + public ASiCParameters aSiC() { + return aSiCParams; + } + + @Override + public void setSignatureLevel(SignatureLevel signatureLevel) { + if (signatureLevel == null || SignatureForm.XAdES != signatureLevel.getSignatureForm()) { + throw new IllegalArgumentException("Only XAdES form is allowed !"); + } + super.setSignatureLevel(signatureLevel); + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/ManifestNamespace.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/ManifestNamespace.java new file mode 100644 index 0000000000..a473c2474d --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/ManifestNamespace.java @@ -0,0 +1,21 @@ +package eu.europa.esig.dss.asic; + +/** + * This class contains constants for Manifest and its namespace. + * + * @see Open Document Format for Office + * Applications (OpenDocument) Version 1.2; + * Part 3: Packages + */ +public final class ManifestNamespace { + + public static final String NS = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"; + public static final String MANIFEST = "manifest:manifest"; + public static final String VERSION = "manifest:version"; + public static final String FILE_ENTRY = "manifest:file-entry"; + public static final String FULL_PATH = "manifest:full-path"; + public static final String MEDIA_TYPE = "manifest:media-type"; + + private ManifestNamespace() { + } +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithXAdESDataToSignHelperBuilder.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithXAdESDataToSignHelperBuilder.java new file mode 100644 index 0000000000..0bf65e9995 --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithXAdESDataToSignHelperBuilder.java @@ -0,0 +1,49 @@ +package eu.europa.esig.dss.asic.signature; + +import java.util.List; + +import eu.europa.esig.dss.BLevelParameters; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCUtils; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.asice.DataToSignASiCEWithXAdESFromArchive; +import eu.europa.esig.dss.asic.signature.asice.DataToSignASiCEWithXAdESFromFiles; +import eu.europa.esig.dss.asic.signature.asics.DataToSignASiCSWithXAdESFromArchive; +import eu.europa.esig.dss.asic.signature.asics.DataToSignASiCSWithXAdESFromFiles; + +public class ASiCWithXAdESDataToSignHelperBuilder { + + private ASiCWithXAdESDataToSignHelperBuilder() { + } + + public static GetDataToSignASiCWithXAdESHelper getGetDataToSignHelper(List documents, ASiCWithXAdESSignatureParameters parameters) { + + BLevelParameters bLevel = parameters.bLevel(); + boolean asice = ASiCUtils.isASiCE(parameters.aSiC()); + boolean archive = ASiCUtils.isArchive(documents); + + if (archive) { + DSSDocument archiveDoc = documents.get(0); + if (!ASiCUtils.isArchiveContainsCorrectSignatureExtension(archiveDoc, ".xml")) { + throw new UnsupportedOperationException("Container type doesn't match"); + } + + ASiCWithXAdESContainerExtractor extractor = new ASiCWithXAdESContainerExtractor(archiveDoc); + ASiCExtractResult extract = extractor.extract(); + if (asice) { + return new DataToSignASiCEWithXAdESFromArchive(extract.getSignedDocuments(), extract.getSignatureDocuments(), extract.getManifestDocuments(), + parameters.aSiC()); + } else { + return new DataToSignASiCSWithXAdESFromArchive(extract.getSignatureDocuments(), extract.getSignedDocuments(), parameters.aSiC()); + } + } else { + if (asice) { + return new DataToSignASiCEWithXAdESFromFiles(documents, parameters.aSiC()); + } else { + return new DataToSignASiCSWithXAdESFromFiles(documents, bLevel.getSigningDate(), parameters.aSiC()); + } + } + } +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithXAdESService.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithXAdESService.java new file mode 100644 index 0000000000..2e139827fb --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/ASiCWithXAdESService.java @@ -0,0 +1,183 @@ +package eu.europa.esig.dss.asic.signature; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.DomUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.SignaturePackaging; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.SigningOperation; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCNamespace; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.ASiCUtils; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.xades.XAdESSignatureParameters; +import eu.europa.esig.dss.xades.signature.XAdESService; + +public class ASiCWithXAdESService extends AbstractASiCSignatureService { + + private static final Logger LOG = LoggerFactory.getLogger(ASiCWithXAdESService.class); + + static { + DomUtils.registerNamespace("asic", ASiCNamespace.NS); + } + + public ASiCWithXAdESService(CertificateVerifier certificateVerifier) { + super(certificateVerifier); + LOG.debug("+ ASiCService with XAdES created"); + } + + @Override + public ToBeSigned getDataToSign(List toSignDocuments, ASiCWithXAdESSignatureParameters parameters) throws DSSException { + final ASiCParameters asicParameters = parameters.aSiC(); + assertCanBeSign(toSignDocuments, asicParameters); + + GetDataToSignASiCWithXAdESHelper dataToSignHelper = ASiCWithXAdESDataToSignHelperBuilder.getGetDataToSignHelper(toSignDocuments, parameters); + + XAdESSignatureParameters xadesParameters = getXAdESParameters(parameters, dataToSignHelper.getExistingSignature()); + return getXAdESService().getDataToSign(dataToSignHelper.getToBeSigned(), xadesParameters); + } + + @Override + public DSSDocument signDocument(List toSignDocuments, ASiCWithXAdESSignatureParameters parameters, SignatureValue signatureValue) + throws DSSException { + final ASiCParameters asicParameters = parameters.aSiC(); + assertCanBeSign(toSignDocuments, asicParameters); + assertSigningDateInCertificateValidityRange(parameters); + + GetDataToSignASiCWithXAdESHelper dataToSignHelper = ASiCWithXAdESDataToSignHelperBuilder.getGetDataToSignHelper(toSignDocuments, parameters); + + List signatures = dataToSignHelper.getSignatures(); + List manifestFiles = dataToSignHelper.getManifestFiles(); + List signedDocuments = dataToSignHelper.getSignedDocuments(); + + XAdESSignatureParameters xadesParameters = getXAdESParameters(parameters, dataToSignHelper.getExistingSignature()); + final DSSDocument newSignature = getXAdESService().signDocument(dataToSignHelper.getToBeSigned(), xadesParameters, signatureValue); + String newSignatureFilename = dataToSignHelper.getSignatureFilename(); + newSignature.setName(newSignatureFilename); + + if (ASiCUtils.isASiCS(asicParameters)) { + Iterator iterator = signatures.iterator(); + while (iterator.hasNext()) { + if (Utils.areStringsEqual(newSignatureFilename, iterator.next().getName())) { + iterator.remove(); // remove existing file to be replaced + } + } + } + signatures.add(newSignature); + + final DSSDocument asicSignature = buildASiCContainer(signedDocuments, signatures, manifestFiles, asicParameters); + asicSignature + .setName(DSSUtils.getFinalFileName(asicSignature, SigningOperation.SIGN, parameters.getSignatureLevel(), parameters.aSiC().getContainerType())); + parameters.reinitDeterministicId(); + return asicSignature; + } + + @Override + public DSSDocument extendDocument(DSSDocument toExtendDocument, ASiCWithXAdESSignatureParameters parameters) throws DSSException { + if (!ASiCUtils.isASiCContainer(toExtendDocument) || !ASiCUtils.isArchiveContainsCorrectSignatureExtension(toExtendDocument, ".xml")) { + throw new DSSException("Unsupported file type"); + } + + extractCurrentArchive(toExtendDocument); + List signedDocuments = getEmbeddedSignedDocuments(); + List signatureDocuments = getEmbeddedSignatures(); + + List extendedDocuments = new ArrayList(); + + for (DSSDocument signature : signatureDocuments) { + XAdESSignatureParameters xadesParameters = getXAdESParameters(parameters, null); + xadesParameters.setDetachedContents(signedDocuments); + DSSDocument extendDocument = getXAdESService().extendDocument(signature, xadesParameters); + extendedDocuments.add(extendDocument); + } + + ByteArrayOutputStream baos = null; + try { + baos = new ByteArrayOutputStream(); + copyExistingArchiveWithSignatureList(toExtendDocument, extendedDocuments, baos); + } finally { + Utils.closeQuietly(baos); + } + + DSSDocument asicSignature = new InMemoryDocument(baos.toByteArray(), null, toExtendDocument.getMimeType()); + asicSignature.setName( + DSSUtils.getFinalFileName(toExtendDocument, SigningOperation.EXTEND, parameters.getSignatureLevel(), parameters.aSiC().getContainerType())); + return asicSignature; + } + + @Override + void storeSignatures(List signatures, ZipOutputStream zos) throws IOException { + for (DSSDocument dssDocument : signatures) { + ZipEntry entrySignature = new ZipEntry(dssDocument.getName()); + zos.putNextEntry(entrySignature); + Document xmlSignatureDoc = DomUtils.buildDOM(dssDocument); + DomUtils.writeDocumentTo(xmlSignatureDoc, zos); + } + } + + @Override + boolean isSignatureFilename(String name) { + return ASiCUtils.isXAdES(name); + } + + private XAdESService getXAdESService() { + XAdESService xadesService = new XAdESService(certificateVerifier); + xadesService.setTspSource(tspSource); + return xadesService; + } + + private XAdESSignatureParameters getXAdESParameters(ASiCWithXAdESSignatureParameters parameters, DSSDocument existingXAdESSignatureASiCS) { + XAdESSignatureParameters xadesParameters = parameters; + xadesParameters.setSignaturePackaging(SignaturePackaging.DETACHED); + Document rootDocument = null; + // If ASiC-S + already existing signature file, we re-use the same signature file + if (existingXAdESSignatureASiCS != null) { + rootDocument = DomUtils.buildDOM(existingXAdESSignatureASiCS); + } else { + rootDocument = DomUtils.createDocument(ASiCNamespace.NS, ASiCNamespace.XADES_SIGNATURES); + } + xadesParameters.setRootDocument(rootDocument); + return xadesParameters; + } + + @Override + AbstractASiCContainerExtractor getArchiveExtractor(DSSDocument archive) { + return new ASiCWithXAdESContainerExtractor(archive); + } + + @Override + boolean canBeSigned(List documents, ASiCParameters asicParameters) { + boolean isMimetypeCorrect = true; + boolean isSignatureTypeCorrect = true; + if (ASiCUtils.isArchive(documents)) { + DSSDocument archive = documents.get(0); + String expectedMimeType = archive.getMimeType().getMimeTypeString(); + String mimeTypeFromParameter = ASiCUtils.getMimeTypeString(asicParameters); + isMimetypeCorrect = Utils.areStringsEqualIgnoreCase(expectedMimeType, mimeTypeFromParameter); + if (isMimetypeCorrect) { + isSignatureTypeCorrect = ASiCUtils.isArchiveContainsCorrectSignatureExtension(archive, ".xml"); + } + } + return isMimetypeCorrect && isSignatureTypeCorrect; + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/GetDataToSignASiCWithXAdESHelper.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/GetDataToSignASiCWithXAdESHelper.java new file mode 100644 index 0000000000..f37b55e8f6 --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/GetDataToSignASiCWithXAdESHelper.java @@ -0,0 +1,15 @@ +package eu.europa.esig.dss.asic.signature; + +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; + +public interface GetDataToSignASiCWithXAdESHelper extends GetDataToSignHelper { + + /* XAdES allows to sign more than one file */ + List getToBeSigned(); + + /* For parallel signature in ASiC-S */ + DSSDocument getExistingSignature(); + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/ASiCEWithXAdESManifestBuilder.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/ASiCEWithXAdESManifestBuilder.java new file mode 100644 index 0000000000..aac0f09c0f --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/ASiCEWithXAdESManifestBuilder.java @@ -0,0 +1,56 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import java.util.List; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DomUtils; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.asic.ManifestNamespace; + +/** + * This class is used to build the manifest.xml file (ASiC-E). + * + * Sample: + * + *
+ * 
+ * 		
+ * 			
+ * 			
+ * 			
+ * 		
+ * 
+ * + * + */ +public class ASiCEWithXAdESManifestBuilder { + + private final List documents; + + public ASiCEWithXAdESManifestBuilder(List documents) { + this.documents = documents; + } + + public Document build() { + final Document documentDom = DomUtils.buildDOM(); + final Element manifestDom = documentDom.createElementNS(ManifestNamespace.NS, ManifestNamespace.MANIFEST); + manifestDom.setAttribute(ManifestNamespace.VERSION, "1.2"); + documentDom.appendChild(manifestDom); + + final Element rootDom = DomUtils.addElement(documentDom, manifestDom, ManifestNamespace.NS, ManifestNamespace.FILE_ENTRY); + rootDom.setAttribute(ManifestNamespace.FULL_PATH, "/"); + rootDom.setAttribute(ManifestNamespace.MEDIA_TYPE, MimeType.ASICE.getMimeTypeString()); + + for (DSSDocument document : documents) { + Element fileDom = DomUtils.addElement(documentDom, manifestDom, ManifestNamespace.NS, ManifestNamespace.FILE_ENTRY); + fileDom.setAttribute(ManifestNamespace.FULL_PATH, document.getName()); + fileDom.setAttribute(ManifestNamespace.MEDIA_TYPE, document.getMimeType().getMimeTypeString()); + } + + return documentDom; + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/AbstractDataToSignASiCEWithXAdES.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/AbstractDataToSignASiCEWithXAdES.java new file mode 100644 index 0000000000..2426510b01 --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/AbstractDataToSignASiCEWithXAdES.java @@ -0,0 +1,51 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import java.io.ByteArrayOutputStream; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DomUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.utils.Utils; + +public abstract class AbstractDataToSignASiCEWithXAdES { + + private static final String META_INF = "META-INF/"; + private static final String ZIP_ENTRY_ASICE_METAINF_XADES_SIGNATURE = META_INF + "signatures001.xml"; + + protected DSSDocument getASiCManifest(List documents) { + ASiCEWithXAdESManifestBuilder manifestBuilder = new ASiCEWithXAdESManifestBuilder(documents); + + DSSDocument manifest = null; + ByteArrayOutputStream baos = null; + try { + baos = new ByteArrayOutputStream(); + DomUtils.writeDocumentTo(manifestBuilder.build(), baos); + manifest = new InMemoryDocument(baos.toByteArray(), META_INF + "manifest.xml", MimeType.XML); + } finally { + Utils.closeQuietly(baos); + } + return manifest; + } + + protected String getSignatureFileName(final ASiCParameters asicParameters, List existingSignatures) { + if (Utils.isStringNotBlank(asicParameters.getSignatureFileName())) { + return META_INF + asicParameters.getSignatureFileName(); + } + if (Utils.isCollectionNotEmpty(existingSignatures)) { + return ZIP_ENTRY_ASICE_METAINF_XADES_SIGNATURE.replace("001", getSignatureNumber(existingSignatures)); + } else { + return ZIP_ENTRY_ASICE_METAINF_XADES_SIGNATURE; + } + } + + private String getSignatureNumber(List existingSignatures) { + int signatureNumbre = existingSignatures.size() + 1; + String sigNumberStr = String.valueOf(signatureNumbre); + String zeroPad = "000"; + return zeroPad.substring(sigNumberStr.length()) + sigNumberStr; // 2 -> 002 + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithXAdESFromArchive.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithXAdESFromArchive.java new file mode 100644 index 0000000000..d72f7592c4 --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithXAdESFromArchive.java @@ -0,0 +1,54 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.signature.GetDataToSignASiCWithXAdESHelper; + +public class DataToSignASiCEWithXAdESFromArchive extends AbstractDataToSignASiCEWithXAdES implements GetDataToSignASiCWithXAdESHelper { + + private final List signedDocuments; + private final List existingSignatures; + private final List existingManifests; + private final ASiCParameters asicParameters; + + public DataToSignASiCEWithXAdESFromArchive(List signedDocuments, List existingSignatures, List existingManifests, + ASiCParameters asicParameters) { + this.signedDocuments = signedDocuments; + this.existingSignatures = existingSignatures; + this.existingManifests = existingManifests; + this.asicParameters = asicParameters; + } + + @Override + public String getSignatureFilename() { + return getSignatureFileName(asicParameters, existingSignatures); + } + + @Override + public List getToBeSigned() { + return signedDocuments; + } + + @Override + public DSSDocument getExistingSignature() { + return null; + } + + @Override + public List getSignedDocuments() { + return signedDocuments; + } + + @Override + public List getManifestFiles() { + return existingManifests; + } + + @Override + public List getSignatures() { + return existingSignatures; + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithXAdESFromFiles.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithXAdESFromFiles.java new file mode 100644 index 0000000000..8e26778b0a --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asice/DataToSignASiCEWithXAdESFromFiles.java @@ -0,0 +1,53 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.signature.GetDataToSignASiCWithXAdESHelper; + +public class DataToSignASiCEWithXAdESFromFiles extends AbstractDataToSignASiCEWithXAdES implements GetDataToSignASiCWithXAdESHelper { + + private final List filesToBeSigned; + private final ASiCParameters asicParameters; + + public DataToSignASiCEWithXAdESFromFiles(List filesToBeSigned, ASiCParameters asicParameters) { + this.filesToBeSigned = filesToBeSigned; + this.asicParameters = asicParameters; + } + + @Override + public List getToBeSigned() { + return filesToBeSigned; + } + + @Override + public String getSignatureFilename() { + return getSignatureFileName(asicParameters, Collections. emptyList()); + } + + @Override + public List getSignedDocuments() { + return filesToBeSigned; + } + + @Override + public DSSDocument getExistingSignature() { + return null; + } + + @Override + public List getManifestFiles() { + return Arrays.asList(getASiCManifest(filesToBeSigned)); + } + + @Override + public List getSignatures() { + // new container + return new ArrayList(); + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asics/AbstractGetDataToSignASiCSWithXAdES.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asics/AbstractGetDataToSignASiCSWithXAdES.java new file mode 100644 index 0000000000..9e6c82c9d4 --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asics/AbstractGetDataToSignASiCSWithXAdES.java @@ -0,0 +1,15 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.utils.Utils; + +public abstract class AbstractGetDataToSignASiCSWithXAdES extends AbstractGetDataToSignASiCS { + + protected String getSignatureFileName(final ASiCParameters asicParameters) { + if (Utils.isStringNotBlank(asicParameters.getSignatureFileName())) { + return "META-INF/" + asicParameters.getSignatureFileName(); + } + return "META-INF/signatures.xml"; + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithXAdESFromArchive.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithXAdESFromArchive.java new file mode 100644 index 0000000000..b7b635a2d9 --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithXAdESFromArchive.java @@ -0,0 +1,64 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import java.util.Collections; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.signature.GetDataToSignASiCWithXAdESHelper; +import eu.europa.esig.dss.utils.Utils; + +public class DataToSignASiCSWithXAdESFromArchive extends AbstractGetDataToSignASiCSWithXAdES implements GetDataToSignASiCWithXAdESHelper { + + private final List embeddedSignatures; + private final List embeddedSignedFiles; + private final ASiCParameters asicParameters; + + public DataToSignASiCSWithXAdESFromArchive(List embeddedSignatures, List embeddedSignedFiles, ASiCParameters asicParameters) { + this.embeddedSignatures = embeddedSignatures; + this.embeddedSignedFiles = embeddedSignedFiles; + this.asicParameters = asicParameters; + } + + @Override + public String getSignatureFilename() { + return getSignatureFileName(asicParameters); + } + + @Override + public List getToBeSigned() { + return embeddedSignedFiles; + } + + @Override + public DSSDocument getExistingSignature() { + // The new signature is added in the existing file + int nbEmbeddedSignatures = Utils.collectionSize(embeddedSignatures); + if (nbEmbeddedSignatures != 1) { + throw new DSSException("Unable to select the embedded signature (nb found:" + nbEmbeddedSignatures + ")"); + } + return embeddedSignatures.get(0); + } + + @Override + public List getSignedDocuments() { + int nbSignedFiles = Utils.collectionSize(embeddedSignedFiles); + if (nbSignedFiles != 1) { + throw new DSSException("Unable to select the document to be signed (nb found:" + nbSignedFiles + ")"); + } + return embeddedSignedFiles; + } + + @Override + public List getManifestFiles() { + // No manifest file in ASiC-S + return Collections.emptyList(); + } + + @Override + public List getSignatures() { + return embeddedSignatures; + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithXAdESFromFiles.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithXAdESFromFiles.java new file mode 100644 index 0000000000..8198786c94 --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithXAdESFromFiles.java @@ -0,0 +1,67 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.asic.signature.GetDataToSignASiCWithXAdESHelper; +import eu.europa.esig.dss.utils.Utils; + +public class DataToSignASiCSWithXAdESFromFiles extends AbstractGetDataToSignASiCSWithXAdES implements GetDataToSignASiCWithXAdESHelper { + + private final List filesToBeSigned; + private final Date signingDate; + private final ASiCParameters asicParameters; + + private List signedDocuments; + + public DataToSignASiCSWithXAdESFromFiles(List filesToBeSigned, Date signingDate, ASiCParameters asicParameters) { + this.filesToBeSigned = filesToBeSigned; + this.signingDate = signingDate; + this.asicParameters = asicParameters; + } + + @Override + public String getSignatureFilename() { + return getSignatureFileName(asicParameters); + } + + @Override + public List getToBeSigned() { + return getSignedDocuments(); + } + + @Override + public DSSDocument getExistingSignature() { + return null; + } + + @Override + public List getSignedDocuments() { + if (signedDocuments == null) { + if (Utils.collectionSize(filesToBeSigned) > 1) { + signedDocuments = Arrays.asList(createPackageZip(filesToBeSigned, signingDate)); + } else { + signedDocuments = new ArrayList(filesToBeSigned); + } + } + return signedDocuments; + } + + @Override + public List getManifestFiles() { + // No manifest file in ASiC-S + return Collections.emptyList(); + } + + @Override + public List getSignatures() { + // new container + return new ArrayList(); + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCContainerWithXAdESValidator.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCContainerWithXAdESValidator.java new file mode 100644 index 0000000000..41549f9d24 --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCContainerWithXAdESValidator.java @@ -0,0 +1,70 @@ +package eu.europa.esig.dss.asic.validation; + +import java.util.ArrayList; +import java.util.List; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.asic.ASiCUtils; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.validation.DocumentValidator; +import eu.europa.esig.dss.validation.ManifestFile; + +/** + * This class is an implementation to validate ASiC containers with XAdES signature(s) + * + */ +public class ASiCContainerWithXAdESValidator extends AbstractASiCContainerValidator { + + private ASiCContainerWithXAdESValidator() { + super(null); + } + + public ASiCContainerWithXAdESValidator(final DSSDocument asicContainer) { + super(asicContainer); + analyseEntries(); + } + + @Override + public boolean isSupported(DSSDocument dssDocument) { + return ASiCUtils.isASiCContainer(dssDocument) && ASiCUtils.isArchiveContainsCorrectSignatureExtension(dssDocument, ".xml"); + } + + @Override + AbstractASiCContainerExtractor getArchiveExtractor() { + return new ASiCWithXAdESContainerExtractor(document); + } + + @Override + List getValidators() { + if (validators == null) { + validators = new ArrayList(); + for (final DSSDocument signature : getSignatureDocuments()) { + XMLDocumentForASiCValidator xadesValidator = new XMLDocumentForASiCValidator(signature); + xadesValidator.setCertificateVerifier(certificateVerifier); + xadesValidator.setProcessExecutor(processExecutor); + xadesValidator.setValidationCertPool(validationCertPool); + xadesValidator.setSignaturePolicyProvider(signaturePolicyProvider); + xadesValidator.setDetachedContents(getSignedDocuments()); + validators.add(xadesValidator); + } + } + return validators; + } + + @Override + protected List getManifestFilesDecriptions() { + List descriptions = new ArrayList(); + List signatureDocuments = getSignatureDocuments(); + List manifestDocuments = getManifestDocuments(); + // All signatures uses the same file : manifest.xml + for (DSSDocument signatureDoc : signatureDocuments) { + for (DSSDocument manifestDoc : manifestDocuments) { + ASiCEWithXAdESManifestParser manifestParser = new ASiCEWithXAdESManifestParser(signatureDoc, manifestDoc); + descriptions.add(manifestParser.getDescription()); + } + } + return descriptions; + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCEWithXAdESManifestParser.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCEWithXAdESManifestParser.java new file mode 100644 index 0000000000..df86154e73 --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/validation/ASiCEWithXAdESManifestParser.java @@ -0,0 +1,71 @@ +package eu.europa.esig.dss.asic.validation; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DomUtils; +import eu.europa.esig.dss.asic.ManifestNamespace; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.ManifestFile; + +public class ASiCEWithXAdESManifestParser { + + private static final Logger LOG = LoggerFactory.getLogger(ASiCEWithXAdESManifestParser.class); + + static { + DomUtils.registerNamespace("manifest", ManifestNamespace.NS); + } + + private final DSSDocument signatureDocument; + private final DSSDocument manifestDocument; + + public ASiCEWithXAdESManifestParser(DSSDocument signatureDocument, DSSDocument manifestDocument) { + this.signatureDocument = signatureDocument; + this.manifestDocument = manifestDocument; + } + + public ManifestFile getDescription() { + ManifestFile description = new ManifestFile(); + description.setSignatureFilename(signatureDocument.getName()); + description.setFilename(manifestDocument.getName()); + description.setEntries(getEntries()); + return description; + } + + private List getEntries() { + List result = new ArrayList(); + InputStream is = null; + try { + is = manifestDocument.openStream(); + Document manifestDom = DomUtils.buildDOM(is); + NodeList nodeList = DomUtils.getNodeList(manifestDom, "/manifest:manifest/manifest:file-entry"); + if (nodeList != null && nodeList.getLength() > 0) { + for (int i = 0; i < nodeList.getLength(); i++) { + Element fileEntryElement = (Element) nodeList.item(i); + String fullpathValue = fileEntryElement.getAttribute(ManifestNamespace.FULL_PATH); + if (!isFolder(fullpathValue)) { + result.add(fullpathValue); + } + } + } + } catch (Exception e) { + LOG.error("Unable to parse manifest file " + manifestDocument.getName(), e); + } finally { + Utils.closeQuietly(is); + } + return result; + } + + private boolean isFolder(String fullpathValue) { + return fullpathValue.endsWith("/"); + } + +} diff --git a/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/validation/XMLDocumentForASiCValidator.java b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/validation/XMLDocumentForASiCValidator.java new file mode 100644 index 0000000000..63fb8802bc --- /dev/null +++ b/dss-asic-xades/src/main/java/eu/europa/esig/dss/asic/validation/XMLDocumentForASiCValidator.java @@ -0,0 +1,18 @@ +package eu.europa.esig.dss.asic.validation; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.x509.CertificatePool; +import eu.europa.esig.dss.xades.validation.XMLDocumentValidator; + +public class XMLDocumentForASiCValidator extends XMLDocumentValidator implements ASiCSignatureValidator { + + public XMLDocumentForASiCValidator(DSSDocument signature) throws DSSException { + super(signature); + } + + public void setValidationCertPool(CertificatePool validationCertPool) { + this.validationCertPool = validationCertPool; + } + +} diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/ASiCWithXAdESSignatureParametersTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/ASiCWithXAdESSignatureParametersTest.java new file mode 100644 index 0000000000..39c32a53f6 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/ASiCWithXAdESSignatureParametersTest.java @@ -0,0 +1,15 @@ +package eu.europa.esig.dss.asic; + +import org.junit.Test; + +import eu.europa.esig.dss.SignatureLevel; + +public class ASiCWithXAdESSignatureParametersTest { + + @Test(expected = IllegalArgumentException.class) + public void test() { + ASiCWithXAdESSignatureParameters params = new ASiCWithXAdESSignatureParameters(); + params.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + } + +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithXAdESExtension.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithXAdESExtension.java similarity index 75% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithXAdESExtension.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithXAdESExtension.java index a006be92d0..acde413e2d 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithXAdESExtension.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/AbstractTestASiCwithXAdESExtension.java @@ -20,15 +20,14 @@ */ package eu.europa.esig.dss.asic.extension; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; import eu.europa.esig.dss.extension.AbstractTestExtension; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; @@ -37,7 +36,7 @@ import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -public abstract class AbstractTestASiCwithXAdESExtension extends AbstractTestExtension { +public abstract class AbstractTestASiCwithXAdESExtension extends AbstractTestExtension { @Override protected DSSDocument getSignedDocument() throws Exception { @@ -47,15 +46,14 @@ protected DSSDocument getSignedDocument() throws Exception { DSSDocument document = new InMemoryDocument("Hello world!".getBytes(), "test.bin"); // Sign - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.setSigningCertificate(entryUserA.getCertificate()); signatureParameters.setCertificateChain(entryUserA.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); signatureParameters.setSignatureLevel(getOriginalSignatureLevel()); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); + signatureParameters.aSiC().setContainerType(getContainerType()); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); ToBeSigned dataToSign = service.getDataToSign(document, signatureParameters); @@ -65,16 +63,18 @@ protected DSSDocument getSignedDocument() throws Exception { } @Override - protected ASiCSignatureParameters getExtensionParameters() { - ASiCSignatureParameters extensionParameters = new ASiCSignatureParameters(); + protected ASiCWithXAdESSignatureParameters getExtensionParameters() { + ASiCWithXAdESSignatureParameters extensionParameters = new ASiCWithXAdESSignatureParameters(); extensionParameters.setSignatureLevel(getFinalSignatureLevel()); - extensionParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); + extensionParameters.aSiC().setContainerType(getContainerType()); return extensionParameters; } + protected abstract ASiCContainerType getContainerType(); + @Override - protected DocumentSignatureService getSignatureServiceToExtend() throws Exception { - ASiCService service = new ASiCService(new CommonCertificateVerifier()); + protected DocumentSignatureService getSignatureServiceToExtend() throws Exception { + ASiCWithXAdESService service = new ASiCWithXAdESService(new CommonCertificateVerifier()); CertificateService certificateService = new CertificateService(); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); return service; diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTATest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTATest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTATest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTATest.java index 8d7a71d027..f5b782a155 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTATest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTATest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asice; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCeExtensionWithXAdESBToLTATest extends AbstractTestASiCwithXAdES @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_B; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_LTA; + return SignatureLevel.XAdES_BASELINE_LTA; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_LTA; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_E; } + } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTTest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTTest.java index 40a57330c3..1fd59c713b 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToLTTest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asice; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCeExtensionWithXAdESBToLTTest extends AbstractTestASiCwithXAdESE @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_B; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_LT; + return SignatureLevel.XAdES_BASELINE_LT; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_LT; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_E; } + } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToTTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToTTest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToTTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToTTest.java index 93100e15dd..13b147a466 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToTTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESBToTTest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asice; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,16 @@ public class ASiCeExtensionWithXAdESBToTTest extends AbstractTestASiCwithXAdESEx @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_B; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_T; + return SignatureLevel.XAdES_BASELINE_T; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_T; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_E; } } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESLTToLTATest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESLTToLTATest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESLTToLTATest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESLTToLTATest.java index 93f1e79d7d..91e7d04006 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESLTToLTATest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESLTToLTATest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asice; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCeExtensionWithXAdESLTToLTATest extends AbstractTestASiCwithXAdE @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_LT; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_LT; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_LTA; + return SignatureLevel.XAdES_BASELINE_LTA; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_LTA; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_E; } + } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTATest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTATest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTATest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTATest.java index 573a5b5f04..b798dd344f 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTATest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTATest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asice; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCeExtensionWithXAdESTToLTATest extends AbstractTestASiCwithXAdES @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_T; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_T; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_LTA; + return SignatureLevel.XAdES_BASELINE_LTA; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_LTA; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_E; } + } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTTest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTTest.java index d08bddeb7d..d5e0c63911 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeExtensionWithXAdESTToLTTest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asice; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCeExtensionWithXAdESTToLTTest extends AbstractTestASiCwithXAdESE @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_T; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_T; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_LT; + return SignatureLevel.XAdES_BASELINE_LT; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_LT; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_E; } + } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTATest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTATest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTATest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTATest.java index 8cff3f4292..08858ca3cf 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTATest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTATest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asics; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCsExtensionWithXAdESBToLTATest extends AbstractTestASiCwithXAdES @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_B; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LTA; + return SignatureLevel.XAdES_BASELINE_LTA; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_LTA; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_S; } + } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTTest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTTest.java index 33d7fe1908..f6355ba04b 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToLTTest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asics; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCsExtensionWithXAdESBToLTTest extends AbstractTestASiCwithXAdESE @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_B; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LT; + return SignatureLevel.XAdES_BASELINE_LT; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_LT; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_S; } + } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToTTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToTTest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToTTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToTTest.java index 843a8c86df..c366e3ef94 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToTTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESBToTTest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asics; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCsExtensionWithXAdESBToTTest extends AbstractTestASiCwithXAdESEx @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_B; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_T; + return SignatureLevel.XAdES_BASELINE_T; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_T; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_S; } + } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESLTToLTATest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESLTToLTATest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESLTToLTATest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESLTToLTATest.java index 3490e5eabb..99e36678e7 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESLTToLTATest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESLTToLTATest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asics; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCsExtensionWithXAdESLTToLTATest extends AbstractTestASiCwithXAdE @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LT; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_LT; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LTA; + return SignatureLevel.XAdES_BASELINE_LTA; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_LTA; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_S; } + } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESTToLTTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESTToLTTest.java similarity index 86% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESTToLTTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESTToLTTest.java index 6375b07dbe..a925db8e04 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESTToLTTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/extension/asics/ASiCsExtensionWithXAdESTToLTTest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.asic.extension.asics; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithXAdESExtension; @@ -27,21 +28,17 @@ public class ASiCsExtensionWithXAdESTToLTTest extends AbstractTestASiCwithXAdESE @Override protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_T; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { return SignatureLevel.XAdES_BASELINE_T; } @Override protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LT; + return SignatureLevel.XAdES_BASELINE_LT; } @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.XAdES_BASELINE_LT; + protected ASiCContainerType getContainerType() { + return ASiCContainerType.ASiC_S; } + } diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/plugtests/ETSISamplesValidationTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/plugtests/ETSISamplesValidationTest.java new file mode 100644 index 0000000000..0e56a6bf1b --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/plugtests/ETSISamplesValidationTest.java @@ -0,0 +1,76 @@ +package eu.europa.esig.dss.asic.plugtests; + +import static org.junit.Assert.assertNotNull; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignaturePolicyProvider; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.reports.DetailedReport; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.SimpleReport; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; + +/** + * This test is only to ensure that we don't have exception with valid? files + */ +@RunWith(Parameterized.class) +public class ETSISamplesValidationTest { + + @Parameters(name = "Validation {index} : {0}") + public static Collection data() { + File folder = new File("src/test/resources/plugtest"); + Collection listFiles = Utils.listFiles(folder, + new String[] { "p7", "p7b", "p7m", "p7s", "asice", "asics", "pdf", "xml", "bdoc", "csig", "xsig", "es3" }, true); + Collection dataToRun = new ArrayList(); + for (File file : listFiles) { + dataToRun.add(new Object[] { file }); + } + return dataToRun; + } + + private File fileToTest; + + public ETSISamplesValidationTest(File fileToTest) { + this.fileToTest = fileToTest; + } + + @Test + public void testValidate() { + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(new FileDocument(fileToTest)); + + SignaturePolicyProvider signaturePolicyProvider = new SignaturePolicyProvider(); + Map signaturePoliciesByUrl = new HashMap(); + signaturePoliciesByUrl.put("https://www.sk.ee/repository/bdoc-spec21.pdf", new FileDocument(new File("src/test/resources/bdoc-spec21.pdf"))); + signaturePolicyProvider.setSignaturePoliciesByUrl(signaturePoliciesByUrl); + validator.setSignaturePolicyProvider(signaturePolicyProvider); + + validator.setCertificateVerifier(new CommonCertificateVerifier()); + + Reports validateDocument = validator.validateDocument(); + assertNotNull(validateDocument); + + DiagnosticData diagnosticData = validateDocument.getDiagnosticData(); + assertNotNull(diagnosticData); + + SimpleReport simpleReport = validateDocument.getSimpleReport(); + assertNotNull(simpleReport); + + DetailedReport detailedReport = validateDocument.getDetailedReport(); + assertNotNull(detailedReport); + } + +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/CertificatePoolSharingTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/CertificatePoolSharingTest.java similarity index 72% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/CertificatePoolSharingTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/CertificatePoolSharingTest.java index 5efe0b78bd..0f3c53016b 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/CertificatePoolSharingTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/CertificatePoolSharingTest.java @@ -1,4 +1,4 @@ -package eu.europa.esig.dss.asic.signature.asice; +package eu.europa.esig.dss.asic.signature; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -6,22 +6,20 @@ import java.util.Date; import java.util.List; -import org.apache.commons.collections.CollectionUtils; import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.AdvancedSignature; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; @@ -32,21 +30,20 @@ public class CertificatePoolSharingTest { @Test public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign); @@ -56,7 +53,7 @@ public void test() throws Exception { validator.setCertificateVerifier(new CommonCertificateVerifier()); List signatures = validator.getSignatures(); - assertTrue(CollectionUtils.isNotEmpty(signatures)); + assertTrue(Utils.isCollectionNotEmpty(signatures)); Reports reports = validator.validateDocument(); assertNotNull(reports); diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBInclusiveCanonicalizationTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBInclusiveCanonicalizationTest.java similarity index 70% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBInclusiveCanonicalizationTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBInclusiveCanonicalizationTest.java index 8c5eec27b4..6ae451b4e2 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBInclusiveCanonicalizationTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBInclusiveCanonicalizationTest.java @@ -20,69 +20,61 @@ */ package eu.europa.esig.dss.asic.signature.asice; -import static org.junit.Assert.assertEquals; - import java.util.Date; import javax.xml.crypto.dsig.CanonicalizationMethod; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCELevelBInclusiveCanonicalizationTest extends AbstractTestSignature { +public class ASiCEXAdESLevelBInclusiveCanonicalizationTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); signatureParameters.setSignedInfoCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE); signatureParameters.setSignedPropertiesCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_B.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + service = new ASiCWithXAdESService(certificateVerifier); } @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBMultiFilesParallelTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBMultiFilesParallelTest.java new file mode 100644 index 0000000000..ee8d3bc087 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBMultiFilesParallelTest.java @@ -0,0 +1,119 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.test.TestUtils; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.policy.rules.Indication; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; + +public class ASiCEXAdESLevelBMultiFilesParallelTest { + + @Test + public void test() throws Exception { + List documentToSigns = new ArrayList(); + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); + + ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters); + SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue); + + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + + certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithXAdESService(certificateVerifier); + + dataToSign = service.getDataToSign(signedDocument, signatureParameters); + signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + + Reports reports = validator.validateDocument(); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(2, signatureIdList.size()); + for (String sigId : signatureIdList) { + assertTrue(diagnosticData.isBLevelTechnicallyValid(sigId)); + assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId)); + } + + AbstractASiCContainerExtractor extractor = new ASiCWithXAdESContainerExtractor(resignedDocument); + ASiCExtractResult result = extractor.extract(); + + assertEquals(0, result.getUnsupportedDocuments().size()); + + List signatureDocuments = result.getSignatureDocuments(); + assertEquals(2, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".xml")); + + List manifestDocuments = result.getManifestDocuments(); + assertEquals(1, manifestDocuments.size()); + assertEquals("META-INF/manifest.xml", manifestDocuments.get(0).getName()); + + List signedDocuments = result.getSignedDocuments(); + assertEquals(2, signedDocuments.size()); + + DSSDocument mimeTypeDocument = result.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICE.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + } +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCAdESSHA384Test.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBPolicyIdTest.java similarity index 56% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCAdESSHA384Test.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBPolicyIdTest.java index c7732f5ba6..154858538e 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCAdESSHA384Test.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBPolicyIdTest.java @@ -20,69 +20,81 @@ */ package eu.europa.esig.dss.asic.signature.asice; -import static org.junit.Assert.assertEquals; - +import java.io.File; import java.util.Date; +import java.util.HashMap; +import java.util.Map; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.DigestAlgorithm; +import eu.europa.esig.dss.FileDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.Policy; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; +import eu.europa.esig.dss.validation.SignaturePolicyProvider; -public class ASiCELevelBCAdESSHA384Test extends AbstractTestSignature { +public class ASiCEXAdESLevelBPolicyIdTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA384); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.setDigestAlgorithm(DigestAlgorithm.SHA384); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + Policy policy = new Policy(); + policy.setId("urn:oid:1.3.6.1.4.1.10015.1000.3.2.1"); + policy.setQualifier("OIDAsURN"); + policy.setDigestAlgorithm(DigestAlgorithm.SHA1); + policy.setDigestValue(Utils.fromBase64("gIHiaetEE94gbkCRygQ9WspxUdw=")); + policy.setSpuri("https://www.sk.ee/repository/bdoc-spec21.pdf"); + signatureParameters.bLevel().setSignaturePolicy(policy); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithXAdESService(certificateVerifier); } @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.CAdES_BASELINE_B.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + protected SignaturePolicyProvider getSignaturePolicyProvider() { + SignaturePolicyProvider spp = new SignaturePolicyProvider(); + Map signaturePoliciesByUrl = new HashMap(); + signaturePoliciesByUrl.put("https://www.sk.ee/repository/bdoc-spec21.pdf", new FileDocument(new File("src/test/resources/bdoc-spec21.pdf"))); + spp.setSignaturePoliciesByUrl(signaturePoliciesByUrl); + return spp; } @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBSHA512Test.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSHA512Test.java similarity index 69% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBSHA512Test.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSHA512Test.java index 9ba2bb3504..86bcbad595 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBSHA512Test.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSHA512Test.java @@ -20,67 +20,59 @@ */ package eu.europa.esig.dss.asic.signature.asice; -import static org.junit.Assert.assertEquals; - import java.util.Date; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.DigestAlgorithm; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCELevelBSHA512Test extends AbstractTestSignature { +public class ASiCEXAdESLevelBSHA512Test extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA512); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); signatureParameters.setDigestAlgorithm(DigestAlgorithm.SHA512); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_B.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + service = new ASiCWithXAdESService(certificateVerifier); } @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBXAdESSignFourTimeTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSignFourTimeTest.java similarity index 67% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBXAdESSignFourTimeTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSignFourTimeTest.java index 3e8055a34d..a94b34f491 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBXAdESSignFourTimeTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSignFourTimeTest.java @@ -1,22 +1,23 @@ package eu.europa.esig.dss.asic.signature.asice; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import java.util.Date; +import java.util.List; -import org.junit.Assert; import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -31,7 +32,7 @@ * @author axel.abinet * */ -public class ASiCELevelBXAdESSignFourTimeTest { +public class ASiCEXAdESLevelBSignFourTimeTest { @Test public void test() throws Exception { @@ -40,16 +41,15 @@ public void test() throws Exception { CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -59,13 +59,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithXAdESService(certificateVerifier); dataToSign = service.getDataToSign(signedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -75,13 +73,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithXAdESService(certificateVerifier); dataToSign = service.getDataToSign(resignedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -91,13 +87,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithXAdESService(certificateVerifier); dataToSign = service.getDataToSign(resignedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -108,11 +102,12 @@ public void test() throws Exception { Reports reports = validator.validateDocument(); - while (reports != null) { - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - Assert.assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(diagnosticData.getFirstSignatureId())); - reports = reports.getNextReports(); + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(4, signatureIdList.size()); + for (String sigId : signatureIdList) { + assertTrue(diagnosticData.isBLevelTechnicallyValid(sigId)); + assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId)); } } } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSpecialCharInFilenameTest.java similarity index 70% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSpecialCharInFilenameTest.java index 1cb7aae075..d6f6026b89 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBSpecialCharInFilenameTest.java @@ -20,63 +20,57 @@ */ package eu.europa.esig.dss.asic.signature.asice; -import static org.junit.Assert.assertEquals; - import java.util.Date; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCELevelBTest extends AbstractTestSignature { +public class ASiCEXAdESLevelBSpecialCharInFilenameTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text", MimeType.TEXT); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "012éù*34ä5µ£6789~#%&()+=`@{[]}'.txt"); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_B.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + service = new ASiCWithXAdESService(certificateVerifier); } @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelTCAdESTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBTest.java similarity index 50% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelTCAdESTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBTest.java index f56fe7e5fd..4255bbf1c9 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelTCAdESTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelBTest.java @@ -21,66 +21,99 @@ package eu.europa.esig.dss.asic.signature.asice; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import java.io.UnsupportedEncodingException; import java.util.Date; +import java.util.List; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.test.mock.MockTSPSource; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCELevelTCAdESTest extends AbstractTestSignature { +public class ASiCEXAdESLevelBTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_T); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); + service = new ASiCWithXAdESService(certificateVerifier); } @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_T.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithXAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + + assertEquals(0, extract.getUnsupportedDocuments().size()); + + List signatureDocuments = extract.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".xml")); + + List manifestDocuments = extract.getManifestDocuments(); + assertEquals(1, manifestDocuments.size()); + assertEquals("META-INF/manifest.xml", manifestDocuments.get(0).getName()); + + List signedDocuments = extract.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); + assertEquals("test.text", signedDocuments.get(0).getName()); + + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICE.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } } @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { return signatureParameters; } @@ -91,7 +124,7 @@ protected MimeType getExpectedMime() { @Override protected boolean isBaselineT() { - return true; + return false; } @Override diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelLTTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelTTest.java similarity index 70% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelLTTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelTTest.java index 4a18c52dab..8b81c132fe 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelLTTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESLevelTTest.java @@ -20,67 +20,59 @@ */ package eu.europa.esig.dss.asic.signature.asice; -import static org.junit.Assert.assertEquals; - import java.util.Date; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.test.mock.MockTSPSource; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCELevelLTTest extends AbstractTestSignature { +public class ASiCEXAdESLevelTTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_LT); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_T); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithXAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); } @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_LT.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); - } - - @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESMultiFilesLevelBTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESMultiFilesLevelBTest.java new file mode 100644 index 0000000000..2ac93b3952 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESMultiFilesLevelBTest.java @@ -0,0 +1,168 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asice; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.asic.validation.ASiCEWithXAdESManifestParser; +import eu.europa.esig.dss.jaxb.diagnostic.XmlSignatureScope; +import eu.europa.esig.dss.signature.AbstractTestMultipleDocumentsSignatureService; +import eu.europa.esig.dss.signature.MultipleDocumentsSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.ManifestFile; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; +import eu.europa.esig.dss.validation.reports.wrapper.SignatureWrapper; + +public class ASiCEXAdESMultiFilesLevelBTest extends AbstractTestMultipleDocumentsSignatureService { + + private MultipleDocumentsSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; + private List documentToSigns = new ArrayList(); + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithXAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithXAdESService(certificateVerifier); + } + + @Override + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithXAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + + assertEquals(0, extract.getUnsupportedDocuments().size()); + + List signatureDocuments = extract.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".xml")); + + List manifestDocuments = extract.getManifestDocuments(); + assertEquals(1, manifestDocuments.size()); + String manifestFilename = manifestDocuments.get(0).getName(); + assertEquals("META-INF/manifest.xml", manifestFilename); + + ASiCEWithXAdESManifestParser parse = new ASiCEWithXAdESManifestParser(signatureDocuments.get(0), manifestDocuments.get(0)); + ManifestFile description = parse.getDescription(); + assertNotNull(description); + assertNotNull(description.getFilename()); + assertNotNull(description.getSignatureFilename()); + assertTrue(Utils.isCollectionNotEmpty(description.getEntries())); + + List signedDocuments = extract.getSignedDocuments(); + assertEquals(2, signedDocuments.size()); + + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICE.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + } + + @Override + protected void checkSignatureScopes(DiagnosticData diagnosticData) { + SignatureWrapper signature = diagnosticData.getSignatureById(diagnosticData.getFirstSignatureId()); + List signatureScopes = signature.getSignatureScopes(); + assertEquals(2, Utils.collectionSize(signatureScopes)); + } + + @Override + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICE; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + + @Override + protected List getDocumentsToSign() { + return documentToSigns; + } + + @Override + protected MultipleDocumentsSignatureService getService() { + return service; + } + +} diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESMultipleTimestampsTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESMultipleTimestampsTest.java new file mode 100644 index 0000000000..9cde01edd5 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESMultipleTimestampsTest.java @@ -0,0 +1,119 @@ +package eu.europa.esig.dss.asic.signature.asice; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.test.TestUtils; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.test.mock.MockTSPSource; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; +import eu.europa.esig.dss.validation.reports.wrapper.SignatureWrapper; +import eu.europa.esig.dss.validation.reports.wrapper.TimestampWrapper; + +public class ASiCEXAdESMultipleTimestampsTest { + + @Test + public void test() throws Exception { + List documentToSigns = new ArrayList(); + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_T); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); + service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); + + ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters); + SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue); + + ASiCWithXAdESSignatureParameters extendParameters = new ASiCWithXAdESSignatureParameters(); + extendParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_T); + extendParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + DSSDocument extendDocument = service.extendDocument(signedDocument, extendParameters); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(extendDocument); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + + Reports reports = validator.validateDocument(); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(1, signatureIdList.size()); + assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); + + SignatureWrapper signatureWrapper = diagnosticData.getSignatureById(diagnosticData.getFirstSignatureId()); + List timestampList = signatureWrapper.getTimestampList(); + assertEquals(2, timestampList.size()); + + for (TimestampWrapper timestampWrapper : timestampList) { + assertTrue(timestampWrapper.isSignatureValid()); + } + + AbstractASiCContainerExtractor extractor = new ASiCWithXAdESContainerExtractor(extendDocument); + ASiCExtractResult result = extractor.extract(); + + assertEquals(0, result.getUnsupportedDocuments().size()); + + List signatureDocuments = result.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".xml")); + + List manifestDocuments = result.getManifestDocuments(); + assertEquals(1, manifestDocuments.size()); + String manifestFilename = manifestDocuments.get(0).getName(); + assertTrue(manifestFilename.startsWith("META-INF/manifest")); + assertTrue(manifestFilename.endsWith(".xml")); + + List signedDocuments = result.getSignedDocuments(); + assertEquals(2, signedDocuments.size()); + + DSSDocument mimeTypeDocument = result.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICE.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + } +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCESignatureFilenameTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESSignatureFilenameTest.java similarity index 90% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCESignatureFilenameTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESSignatureFilenameTest.java index 1f197e449e..3708038b09 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCESignatureFilenameTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCEXAdESSignatureFilenameTest.java @@ -25,15 +25,15 @@ import java.io.IOException; import java.util.zip.ZipFile; -import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Rule; import org.junit.rules.TemporaryFolder; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.utils.Utils; -public class ASiCESignatureFilenameTest extends ASiCELevelBTest { +public class ASiCEXAdESSignatureFilenameTest extends ASiCEXAdESLevelBTest { private DSSDocument documentToSign; @@ -42,7 +42,7 @@ public class ASiCESignatureFilenameTest extends ASiCELevelBTest { @Before public void setUp() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); } @Override @@ -53,7 +53,7 @@ public void signAndVerify() throws IOException { documentToSign.save(containerTemporaryPath); ZipFile zip = new ZipFile(containerTemporaryPath); assertNotNull("Signature file name is not correct", zip.getEntry("META-INF/signatures2047.xml")); - IOUtils.closeQuietly(zip); + Utils.closeQuietly(zip); } @Override diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBInclusiveCanonicalizationTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBInclusiveCanonicalizationTest.java similarity index 70% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBInclusiveCanonicalizationTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBInclusiveCanonicalizationTest.java index 0484ed0dc8..aa40f34b7a 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBInclusiveCanonicalizationTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBInclusiveCanonicalizationTest.java @@ -20,75 +20,67 @@ */ package eu.europa.esig.dss.asic.signature.asics; -import static org.junit.Assert.assertEquals; - import java.util.Date; import javax.xml.crypto.dsig.CanonicalizationMethod; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCSLevelBInclusiveCanonicalizationTest extends AbstractTestSignature { +public class ASiCSXAdESLevelBInclusiveCanonicalizationTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); signatureParameters.setSignedInfoCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE); signatureParameters.setSignedPropertiesCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_B.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + service = new ASiCWithXAdESService(certificateVerifier); } @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { return signatureParameters; } @Override protected MimeType getExpectedMime() { - return MimeType.ASICS; + return MimeType.ASICE; } @Override diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBMultiFilesParallelTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBMultiFilesParallelTest.java new file mode 100644 index 0000000000..8cdff9b0ed --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBMultiFilesParallelTest.java @@ -0,0 +1,127 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.test.TestUtils; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.policy.rules.Indication; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; + +public class ASiCSXAdESLevelBMultiFilesParallelTest { + + @Test + public void test() throws Exception { + List documentToSigns = new ArrayList(); + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); + + ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters); + SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue); + + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithXAdESService(certificateVerifier); + + dataToSign = service.getDataToSign(signedDocument, signatureParameters); + signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); + + resignedDocument.writeTo(new FileOutputStream(new File("target/resigned.asics"))); + + DSSDocument docToCheck = new FileDocument(new File("target/resigned.asics")); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(docToCheck); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + + Reports reports = validator.validateDocument(); + + // reports.print(); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(2, signatureIdList.size()); + for (String sigId : signatureIdList) { + assertTrue(diagnosticData.isBLevelTechnicallyValid(sigId)); + assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId)); + } + + AbstractASiCContainerExtractor extractor = new ASiCWithXAdESContainerExtractor(docToCheck); + ASiCExtractResult result = extractor.extract(); + + assertEquals(0, result.getUnsupportedDocuments().size()); + + List signatureDocuments = result.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".xml")); + + List manifestDocuments = result.getManifestDocuments(); + assertEquals(0, manifestDocuments.size()); + + List signedDocuments = result.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); // package.Zip + + DSSDocument mimeTypeDocument = result.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICS.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + } +} diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSHA512Test.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSHA512Test.java new file mode 100644 index 0000000000..1414aa047a --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSHA512Test.java @@ -0,0 +1,104 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asics; + +import java.util.Date; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DigestAlgorithm; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; +import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; + +public class ASiCSXAdESLevelBSHA512Test extends AbstractTestDocumentSignatureService { + + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; + private DSSDocument documentToSign; + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA512); + + signatureParameters = new ASiCWithXAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.setDigestAlgorithm(DigestAlgorithm.SHA512); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithXAdESService(certificateVerifier); + } + + @Override + protected DocumentSignatureService getService() { + return service; + } + + @Override + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICS; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected DSSDocument getDocumentToSign() { + return documentToSign; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBXAdESSignFourTimeTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSignFourTimeTest.java similarity index 66% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBXAdESSignFourTimeTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSignFourTimeTest.java index fba28d186f..4ecf95c418 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBXAdESSignFourTimeTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSignFourTimeTest.java @@ -1,22 +1,23 @@ package eu.europa.esig.dss.asic.signature.asics; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import java.util.Date; +import java.util.List; -import org.junit.Assert; import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -31,25 +32,24 @@ * @author axel.abinet * */ -public class ASiCSLevelBXAdESSignFourTimeTest { +public class ASiCSXAdESLevelBSignFourTimeTest { @Test public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -59,13 +59,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithXAdESService(certificateVerifier); dataToSign = service.getDataToSign(signedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -75,13 +73,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithXAdESService(certificateVerifier); dataToSign = service.getDataToSign(resignedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -91,13 +87,11 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - signatureParameters.setDetachedContent(documentToSign); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithXAdESService(certificateVerifier); dataToSign = service.getDataToSign(resignedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -107,14 +101,14 @@ public void test() throws Exception { validator.setCertificateVerifier(new CommonCertificateVerifier()); Reports reports = validator.validateDocument(); - // reports.print(); - while (reports != null) { - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - Assert.assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(diagnosticData.getFirstSignatureId())); - reports = reports.getNextReports(); + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(4, signatureIdList.size()); + for (String sigId : signatureIdList) { + assertTrue(diagnosticData.isBLevelTechnicallyValid(sigId)); + assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(sigId)); } } } diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSpecialCharInFilenameTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSpecialCharInFilenameTest.java new file mode 100644 index 0000000000..4722b0b53e --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBSpecialCharInFilenameTest.java @@ -0,0 +1,102 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asics; + +import java.util.Date; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; +import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; + +public class ASiCSXAdESLevelBSpecialCharInFilenameTest extends AbstractTestDocumentSignatureService { + + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; + private DSSDocument documentToSign; + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "012éù*34ä5µ£6789~#%&()+=`@{[]}'.txt"); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithXAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithXAdESService(certificateVerifier); + } + + @Override + protected DocumentSignatureService getService() { + return service; + } + + @Override + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICS; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected DSSDocument getDocumentToSign() { + return documentToSign; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + +} diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBTest.java new file mode 100644 index 0000000000..c6996d6307 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelBTest.java @@ -0,0 +1,144 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.util.List; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; +import eu.europa.esig.dss.signature.DocumentSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; + +public class ASiCSXAdESLevelBTest extends AbstractTestDocumentSignatureService { + + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; + private DSSDocument documentToSign; + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithXAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithXAdESService(certificateVerifier); + } + + @Override + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithXAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + + assertEquals(0, extract.getUnsupportedDocuments().size()); + + List signatureDocuments = extract.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".xml")); + + List manifestDocuments = extract.getManifestDocuments(); + assertEquals(0, manifestDocuments.size()); + + List signedDocuments = extract.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); + assertEquals("test.text", signedDocuments.get(0).getName()); + + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICS.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + } + + @Override + protected DocumentSignatureService getService() { + return service; + } + + @Override + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICS; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected DSSDocument getDocumentToSign() { + return documentToSign; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelLTTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelTTest.java similarity index 70% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelLTTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelTTest.java index 42d303b846..e9b9f665b2 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelLTTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESLevelTTest.java @@ -20,67 +20,59 @@ */ package eu.europa.esig.dss.asic.signature.asics; -import static org.junit.Assert.assertEquals; - import java.util.Date; import org.junit.Before; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.MimeType; import eu.europa.esig.dss.SignatureAlgorithm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; import eu.europa.esig.dss.test.mock.MockTSPSource; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCSLevelLTTest extends AbstractTestSignature { +public class ASiCSXAdESLevelTTest extends AbstractTestDocumentSignatureService { - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; + private DocumentSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; private DSSDocument documentToSign; private MockPrivateKeyEntry privateKeyEntry; @Before public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters = new ASiCSignatureParameters(); + signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_LT); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_T); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new ASiCWithXAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); } @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_LT.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); - } - - @Override - protected DocumentSignatureService getService() { + protected DocumentSignatureService getService() { return service; } @Override - protected ASiCSignatureParameters getSignatureParameters() { + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { return signatureParameters; } diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESMultiFilesLevelBTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESMultiFilesLevelBTest.java new file mode 100644 index 0000000000..4841d31a22 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESMultiFilesLevelBTest.java @@ -0,0 +1,156 @@ +/** + * DSS - Digital Signature Services + * Copyright (C) 2015 European Commission, provided under the CEF programme + * + * This file is part of the "DSS - Digital Signature Services" project. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Before; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.jaxb.diagnostic.XmlSignatureScope; +import eu.europa.esig.dss.signature.AbstractTestMultipleDocumentsSignatureService; +import eu.europa.esig.dss.signature.MultipleDocumentsSignatureService; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; +import eu.europa.esig.dss.validation.reports.wrapper.SignatureWrapper; + +public class ASiCSXAdESMultiFilesLevelBTest extends AbstractTestMultipleDocumentsSignatureService { + + private MultipleDocumentsSignatureService service; + private ASiCWithXAdESSignatureParameters signatureParameters; + private List documentToSigns = new ArrayList(); + private MockPrivateKeyEntry privateKeyEntry; + + @Before + public void init() throws Exception { + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + signatureParameters = new ASiCWithXAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + service = new ASiCWithXAdESService(certificateVerifier); + } + + @Override + protected void onDocumentSigned(byte[] byteArray) { + InMemoryDocument doc = new InMemoryDocument(byteArray); + + AbstractASiCContainerExtractor extractor = new ASiCWithXAdESContainerExtractor(doc); + ASiCExtractResult extract = extractor.extract(); + + assertEquals(0, extract.getUnsupportedDocuments().size()); + + List signatureDocuments = extract.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".xml")); + + List manifestDocuments = extract.getManifestDocuments(); + assertEquals(0, manifestDocuments.size()); + + List signedDocuments = extract.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); // package.zip + + DSSDocument mimeTypeDocument = extract.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICS.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + } + + @Override + protected void checkSignatureScopes(DiagnosticData diagnosticData) { + SignatureWrapper signature = diagnosticData.getSignatureById(diagnosticData.getFirstSignatureId()); + List signatureScopes = signature.getSignatureScopes(); + assertEquals(1, Utils.collectionSize(signatureScopes)); // package.zip + } + + @Override + protected ASiCWithXAdESSignatureParameters getSignatureParameters() { + return signatureParameters; + } + + @Override + protected MimeType getExpectedMime() { + return MimeType.ASICS; + } + + @Override + protected boolean isBaselineT() { + return false; + } + + @Override + protected boolean isBaselineLTA() { + return false; + } + + @Override + protected MockPrivateKeyEntry getPrivateKeyEntry() { + return privateKeyEntry; + } + + @Override + protected List getDocumentsToSign() { + return documentToSigns; + } + + @Override + protected MultipleDocumentsSignatureService getService() { + return service; + } + +} diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESMultipleTimestampsTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESMultipleTimestampsTest.java new file mode 100644 index 0000000000..c629aafb68 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSXAdESMultipleTimestampsTest.java @@ -0,0 +1,116 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; + +import eu.europa.esig.dss.ASiCContainerType; +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureLevel; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; +import eu.europa.esig.dss.asic.ASiCExtractResult; +import eu.europa.esig.dss.asic.ASiCWithXAdESContainerExtractor; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.AbstractASiCContainerExtractor; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; +import eu.europa.esig.dss.test.TestUtils; +import eu.europa.esig.dss.test.gen.CertificateService; +import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.test.mock.MockTSPSource; +import eu.europa.esig.dss.validation.CertificateVerifier; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; +import eu.europa.esig.dss.validation.reports.wrapper.SignatureWrapper; +import eu.europa.esig.dss.validation.reports.wrapper.TimestampWrapper; + +public class ASiCSXAdESMultipleTimestampsTest { + + @Test + public void test() throws Exception { + List documentToSigns = new ArrayList(); + documentToSigns.add(new InMemoryDocument("Hello World !".getBytes(), "test.text", MimeType.TEXT)); + documentToSigns.add(new InMemoryDocument("Bye World !".getBytes(), "test2.text", MimeType.TEXT)); + + CertificateService certificateService = new CertificateService(); + MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); + + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); + signatureParameters.bLevel().setSigningDate(new Date()); + signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); + signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_T); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + + CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); + service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); + + ToBeSigned dataToSign = service.getDataToSign(documentToSigns, signatureParameters); + SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); + DSSDocument signedDocument = service.signDocument(documentToSigns, signatureParameters, signatureValue); + + ASiCWithXAdESSignatureParameters extendParameters = new ASiCWithXAdESSignatureParameters(); + extendParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_T); + extendParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); + DSSDocument extendDocument = service.extendDocument(signedDocument, extendParameters); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(extendDocument); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + + Reports reports = validator.validateDocument(); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + List signatureIdList = diagnosticData.getSignatureIdList(); + assertEquals(1, signatureIdList.size()); + assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); + + SignatureWrapper signatureWrapper = diagnosticData.getSignatureById(diagnosticData.getFirstSignatureId()); + List timestampList = signatureWrapper.getTimestampList(); + assertEquals(2, timestampList.size()); + + for (TimestampWrapper timestampWrapper : timestampList) { + assertTrue(timestampWrapper.isSignatureValid()); + } + + AbstractASiCContainerExtractor extractor = new ASiCWithXAdESContainerExtractor(extendDocument); + ASiCExtractResult result = extractor.extract(); + + assertEquals(0, result.getUnsupportedDocuments().size()); + + List signatureDocuments = result.getSignatureDocuments(); + assertEquals(1, signatureDocuments.size()); + String signatureFilename = signatureDocuments.get(0).getName(); + assertTrue(signatureFilename.startsWith("META-INF/signature")); + assertTrue(signatureFilename.endsWith(".xml")); + + List manifestDocuments = result.getManifestDocuments(); + assertEquals(0, manifestDocuments.size()); + + List signedDocuments = result.getSignedDocuments(); + assertEquals(1, signedDocuments.size()); + + DSSDocument mimeTypeDocument = result.getMimeTypeDocument(); + + byte[] mimeTypeContent = DSSUtils.toByteArray(mimeTypeDocument); + try { + assertEquals(MimeType.ASICS.getMimeTypeString(), new String(mimeTypeContent, "UTF-8")); + } catch (UnsupportedEncodingException e) { + fail(e.getMessage()); + } + + } +} diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithXAdESFromFilesTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithXAdESFromFilesTest.java new file mode 100644 index 0000000000..19e4f6af73 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/signature/asics/DataToSignASiCSWithXAdESFromFilesTest.java @@ -0,0 +1,65 @@ +package eu.europa.esig.dss.asic.signature.asics; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.DSSUtils; +import eu.europa.esig.dss.DigestAlgorithm; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.asic.ASiCParameters; +import eu.europa.esig.dss.utils.Utils; + +public class DataToSignASiCSWithXAdESFromFilesTest { + + private static final Logger LOG = LoggerFactory.getLogger(DataToSignASiCSWithXAdESFromFilesTest.class); + + @Test + public void zipContentEquals() throws Exception { + Date now = new Date(); + ASiCParameters asicParameters = new ASiCParameters(); + List filesToBeSigned = new ArrayList(); + filesToBeSigned.add(new InMemoryDocument("Hello".getBytes(), "test.xml")); + filesToBeSigned.add(new InMemoryDocument("Bye".getBytes(), "test2.xml")); + DataToSignASiCSWithXAdESFromFiles dataToSign = new DataToSignASiCSWithXAdESFromFiles(filesToBeSigned, now, asicParameters); + assertNotNull(dataToSign); + + List toBeSigned = dataToSign.getToBeSigned(); + assertEquals(1, toBeSigned.size()); + DSSDocument dssDocument = toBeSigned.get(0); + assertEquals("package.zip", dssDocument.getName()); + + byte[] byteArray = DSSUtils.toByteArray(dssDocument); + LOG.info(new String(byteArray)); + String base64 = Utils.toBase64(byteArray); + LOG.info(base64); + + String digest = dssDocument.getDigest(DigestAlgorithm.SHA256); + + LOG.info(digest); + + Thread.sleep(2000); + + DataToSignASiCSWithXAdESFromFiles dataToSign2 = new DataToSignASiCSWithXAdESFromFiles(filesToBeSigned, now, asicParameters); + DSSDocument twice = dataToSign2.getToBeSigned().get(0); + + String digestTwice = twice.getDigest(DigestAlgorithm.SHA256); + + String base64twice = Utils.toBase64(DSSUtils.toByteArray(twice)); + LOG.info(base64twice); + LOG.info(digestTwice); + + assertEquals(base64, base64twice); + assertTrue(Utils.areStringsEqual(digest, digestTwice)); + + } +} diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWith2SignaturesTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWith2SignaturesTest.java new file mode 100644 index 0000000000..150cbb887f --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWith2SignaturesTest.java @@ -0,0 +1,39 @@ +package eu.europa.esig.dss.asic.validation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignaturePolicyProvider; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; + +public class ASiCEWith2SignaturesTest { + + @Test + public void test() { + DSSDocument asicContainer = new FileDocument("src/test/resources/ASiCEWith2Signatures.bdoc"); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(asicContainer); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + SignaturePolicyProvider signaturePolicyProvider = new SignaturePolicyProvider(); + Map signaturePoliciesByUrl = new HashMap(); + signaturePoliciesByUrl.put("https://www.sk.ee/repository/bdoc-spec21.pdf", new FileDocument(new File("src/test/resources/bdoc-spec21.pdf"))); + signaturePolicyProvider.setSignaturePoliciesByUrl(signaturePoliciesByUrl); + validator.setSignaturePolicyProvider(signaturePolicyProvider); + Reports reports = validator.validateDocument(); + assertNotNull(reports); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + assertEquals(2, diagnosticData.getSignatureIdList().size()); + } +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithMalformedOCSPTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithMalformedOCSPTest.java similarity index 100% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithMalformedOCSPTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithMalformedOCSPTest.java diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithXAdESManifestParserTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithXAdESManifestParserTest.java new file mode 100644 index 0000000000..e33308f800 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithXAdESManifestParserTest.java @@ -0,0 +1,35 @@ +package eu.europa.esig.dss.asic.validation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.List; + +import org.junit.Test; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.InMemoryDocument; +import eu.europa.esig.dss.validation.ManifestFile; + +public class ASiCEWithXAdESManifestParserTest { + + @Test + public void test() { + DSSDocument signatureDoc = new InMemoryDocument("Hello".getBytes(), "test"); + DSSDocument manifestDoc = new FileDocument(new File("src/test/resources/manifest-sample.xml")); + ASiCEWithXAdESManifestParser parser = new ASiCEWithXAdESManifestParser(signatureDoc, manifestDoc); + + ManifestFile description = parser.getDescription(); + assertNotNull(description); + assertEquals("manifest-sample.xml", description.getFilename()); + assertEquals("test", description.getSignatureFilename()); + List entries = description.getEntries(); + assertEquals(2, entries.size()); + assertTrue(entries.contains("test.txt")); + assertTrue(entries.contains("test-data-file.bin")); + } + +} diff --git a/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithZipCommentTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithZipCommentTest.java new file mode 100644 index 0000000000..97508681b9 --- /dev/null +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWithZipCommentTest.java @@ -0,0 +1,34 @@ +package eu.europa.esig.dss.asic.validation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; + +public class ASiCEWithZipCommentTest { + + @Test + public void test() { + DSSDocument asicContainer = new FileDocument("src/test/resources/validation/test-zip-comment.asice"); + + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(asicContainer); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + Reports reports = validator.validateDocument(); + assertNotNull(reports); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + + assertEquals(1, diagnosticData.getSignatureIdList().size()); + assertEquals( + "LIB DigiDoc4j/DEV format: application/vnd.etsi.asic-e+zip signatureProfile: ASiC_E_BASELINE_LT Java: 1.8.0_111/Oracle Corporation OS: Linux/amd64/3.10.0-514.el7.x86_64 JVM: OpenJDK 64-Bit Server VM/Oracle Corporation/25.111-b15", + diagnosticData.getZipComment()); + } + +} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java similarity index 80% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java index 9fe0b80885..2389be6be9 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCE_XAdESLTACheckTimeStampIDTest.java @@ -5,16 +5,15 @@ import org.junit.Assert; import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -30,21 +29,20 @@ public class ASiCE_XAdESLTACheckTimeStampIDTest { @Test public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_LTA); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_LTA); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); ToBeSigned toBeSigned = service.getDataToSign(documentToSign, signatureParameters); diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_XAdESLTACheckTimeStampIDTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_XAdESLTACheckTimeStampIDTest.java similarity index 82% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_XAdESLTACheckTimeStampIDTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_XAdESLTACheckTimeStampIDTest.java index e8bd0d368b..3c5f9d0645 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_XAdESLTACheckTimeStampIDTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCS_XAdESLTACheckTimeStampIDTest.java @@ -5,16 +5,15 @@ import org.junit.Assert; import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -35,16 +34,15 @@ public void test() throws Exception { CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + ASiCWithXAdESSignatureParameters signatureParameters = new ASiCWithXAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_LTA); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); + signatureParameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_LTA); + signatureParameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + ASiCWithXAdESService service = new ASiCWithXAdESService(certificateVerifier); service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); ToBeSigned toBeSigned = service.getDataToSign(documentToSign, signatureParameters); diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCWithModifiedCertValuesTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCWithModifiedCertValuesTest.java similarity index 71% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCWithModifiedCertValuesTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCWithModifiedCertValuesTest.java index ccd7643af7..0295bea31b 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCWithModifiedCertValuesTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/ASiCWithModifiedCertValuesTest.java @@ -16,11 +16,12 @@ public class ASiCWithModifiedCertValuesTest { /* File contains empty tags or blank lines for level LT */ @Test public void test() { - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(new FileDocument("src/test/resources/validation/Signature-ASiC_LT_modified_cert_values.asice")); + SignedDocumentValidator validator = SignedDocumentValidator + .fromDocument(new FileDocument("src/test/resources/validation/Signature-ASiC_LT_modified_cert_values.asice")); validator.setCertificateVerifier(new CommonCertificateVerifier()); Reports reports = validator.validateDocument(); DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertEquals(SignatureLevel.XAdES_BASELINE_T.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); + assertEquals(SignatureLevel.XAdES_BASELINE_T.toString(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); } } diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/SignedPropertiesNotCheckedTest.java b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/SignedPropertiesNotCheckedTest.java similarity index 97% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/SignedPropertiesNotCheckedTest.java rename to dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/SignedPropertiesNotCheckedTest.java index 9b8ee78091..82042361f0 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/SignedPropertiesNotCheckedTest.java +++ b/dss-asic-xades/src/test/java/eu/europa/esig/dss/asic/validation/SignedPropertiesNotCheckedTest.java @@ -47,7 +47,7 @@ public class SignedPropertiesNotCheckedTest { @Test public void testNoSignedProperties() { - DSSDocument dssDocument = new FileDocument("src/test/resources/validation/join-up/xades_no-signedpropref.asice_.zip"); + DSSDocument dssDocument = new FileDocument("src/test/resources/validation/xades_no-signedpropref.asice_.zip"); SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(dssDocument); validator.setCertificateVerifier(new CommonCertificateVerifier()); Reports reports = validator.validateDocument(); diff --git a/dss-asic/src/test/resources/ASiCEWith2Signatures.bdoc b/dss-asic-xades/src/test/resources/ASiCEWith2Signatures.bdoc similarity index 100% rename from dss-asic/src/test/resources/ASiCEWith2Signatures.bdoc rename to dss-asic-xades/src/test/resources/ASiCEWith2Signatures.bdoc diff --git a/dss-asic-xades/src/test/resources/bdoc-spec21.pdf b/dss-asic-xades/src/test/resources/bdoc-spec21.pdf new file mode 100644 index 0000000000..b019b2d952 Binary files /dev/null and b/dss-asic-xades/src/test/resources/bdoc-spec21.pdf differ diff --git a/dss-asic-xades/src/test/resources/manifest-sample.xml b/dss-asic-xades/src/test/resources/manifest-sample.xml new file mode 100644 index 0000000000..63d6c3d2eb --- /dev/null +++ b/dss-asic-xades/src/test/resources/manifest-sample.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-1.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-1.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-1.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-1.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-10.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-10.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-10.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-10.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-11.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-11.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-11.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-11.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-12.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-12.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-12.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-12.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-13.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-13.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-13.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-13.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-14.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-14.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-14.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-14.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-15.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-15.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-15.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-15.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-16.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-16.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-16.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-16.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-17.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-17.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-17.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-17.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-18.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-18.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-18.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-18.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-2.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-2.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-2.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-2.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-3.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-3.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-3.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-3.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-4.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-4.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-4.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-4.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-5.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-5.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-5.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-5.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-6.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-6.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-6.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-6.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-7.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-7.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-7.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-7.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-8.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-8.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-8.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-8.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-9.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-9.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-9.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-A-EE-9.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-C-EE-1.bdoc b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-C-EE-1.bdoc similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-C-EE-1.bdoc rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-C-EE-1.bdoc diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-C-EE-2.bdoc b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-C-EE-2.bdoc similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-C-EE-2.bdoc rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE/Signature-C-EE-2.bdoc diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-1.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-1.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-1.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-1.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-10.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-10.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-10.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-10.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-11.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-11.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-11.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-11.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-12.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-12.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-12.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-12.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-13.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-13.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-13.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-13.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-14.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-14.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-14.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-14.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-15.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-15.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-15.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-15.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-16.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-16.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-16.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-16.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-17.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-17.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-17.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-17.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-18.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-18.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-18.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-18.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-19.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-19.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-19.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-19.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-2.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-2.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-2.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-2.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-20.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-20.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-20.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-20.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-21.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-21.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-21.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-21.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-22.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-22.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-22.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-22.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-23.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-23.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-23.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-23.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-24.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-24.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-24.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-24.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-25.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-25.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-25.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-25.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-26.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-26.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-26.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-26.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-27.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-27.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-27.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-27.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-28.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-28.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-28.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-28.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-3.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-3.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-3.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-3.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-4.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-4.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-4.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-4.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-5.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-5.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-5.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-5.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-6.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-6.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-6.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-6.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-7.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-7.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-7.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-7.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-8.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-8.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-8.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-8.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-9.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-9.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-9.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_AS/Signature-A-EE_AS-9.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-1.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-1.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-1.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-1.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-2.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-2.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-2.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-2.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-3.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-3.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-3.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/EE_CBTS/Signature-A-EE_CBTS-3.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-10.asics b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-10.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-10.asics rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-10.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-11.asics b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-11.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-11.asics rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-11.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-12.asics b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-12.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-12.asics rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-12.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-4.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-4.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-4.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-4.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-5.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-5.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-5.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-5.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-6.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-6.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-6.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_MIC/Signature-A-HU_MIC-6.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-1.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-1.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-1.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-1.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-2.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-2.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-2.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-2.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-3.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-3.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-3.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-3.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-4.asics b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-4.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-4.asics rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-4.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-5.asics b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-5.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-5.asics rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-5.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-6.asics b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-6.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-6.asics rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_POL/Signature-A-HU_POL-6.asics diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_SZA/Signature-A-HU_SZA-1.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_SZA/Signature-A-HU_SZA-1.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_SZA/Signature-A-HU_SZA-1.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_SZA/Signature-A-HU_SZA-1.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_SZA/Signature-A-HU_SZA-2.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_SZA/Signature-A-HU_SZA-2.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_SZA/Signature-A-HU_SZA-2.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/HU_SZA/Signature-A-HU_SZA-2.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-1.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-1.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-1.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-1.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-2.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-2.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-2.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-2.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-3.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-3.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-3.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-3.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-4.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-4.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-4.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LT_MIT/Signature-A-LT_MIT-4.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-1.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-1.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-1.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-1.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-2.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-2.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-2.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-2.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-3.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-3.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-3.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-3.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-4.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-4.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-4.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-4.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-5.asice b/dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-5.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-5.asice rename to dss-asic-xades/src/test/resources/plugtest/esig2014/ESIG-ASiC/LV_EU/Signature-A-LV_EU-5.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-10.asice b/dss-asic-xades/src/test/resources/tst/Signature-A-SK_DIT-10.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-10.asice rename to dss-asic-xades/src/test/resources/tst/Signature-A-SK_DIT-10.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-11.asice b/dss-asic-xades/src/test/resources/tst/Signature-A-SK_DIT-11.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-11.asice rename to dss-asic-xades/src/test/resources/tst/Signature-A-SK_DIT-11.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-12.asice b/dss-asic-xades/src/test/resources/tst/Signature-A-SK_DIT-12.asice similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-12.asice rename to dss-asic-xades/src/test/resources/tst/Signature-A-SK_DIT-12.asice diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-3.asics b/dss-asic-xades/src/test/resources/tst/Signature-A-SK_DIT-3.asics similarity index 100% rename from dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-3.asics rename to dss-asic-xades/src/test/resources/tst/Signature-A-SK_DIT-3.asics diff --git a/dss-asic/src/test/resources/validation/Signature-ASiC_LT_modified_cert_values.asice b/dss-asic-xades/src/test/resources/validation/Signature-ASiC_LT_modified_cert_values.asice similarity index 100% rename from dss-asic/src/test/resources/validation/Signature-ASiC_LT_modified_cert_values.asice rename to dss-asic-xades/src/test/resources/validation/Signature-ASiC_LT_modified_cert_values.asice diff --git a/dss-asic-xades/src/test/resources/validation/test-zip-comment.asice b/dss-asic-xades/src/test/resources/validation/test-zip-comment.asice new file mode 100644 index 0000000000..c126974041 Binary files /dev/null and b/dss-asic-xades/src/test/resources/validation/test-zip-comment.asice differ diff --git a/dss-asic/src/test/resources/validation/join-up/xades_no-signedpropref.asice_.zip b/dss-asic-xades/src/test/resources/validation/xades_no-signedpropref.asice_.zip similarity index 100% rename from dss-asic/src/test/resources/validation/join-up/xades_no-signedpropref.asice_.zip rename to dss-asic-xades/src/test/resources/validation/xades_no-signedpropref.asice_.zip diff --git a/dss-asic/pom.xml b/dss-asic/pom.xml deleted file mode 100644 index d400e88a28..0000000000 --- a/dss-asic/pom.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - 4.0.0 - - - org.digidoc4j.dss - sd-dss - 4.7.RC2.d4j.1 - - - dss-asic - DSS ASiC - DSS ASiC contains the code for the creation and validation of ASiC signatures. - - https://github.com/open-eid/sd-dss - - - GNU Lesser General Public License, Version 2.1 - http://www.gnu.org/licenses/lgpl-2.1.html - - - - - naramski - David Naramski - - developer - - - - vandenbroucke - Pierrick Vandenbroucke - - developer - - - - pirard - Nicolas Pirard - - developer - - - - abinet - Axel Abinet - - developer - - - - Rainer Villido - Nortal - http://www.nortal.com - - - Aho Augasmägi - Codeborne - http://www.codeborne.com - - - Allan Juhanson - Nortal - http://www.nortal.com - - - - scm:git:git@github.com:open-eid/sd-dss.git - scm:git:git@github.com:open-eid/sd-dss.git - https://github.com/open-eid/sd-dss.git - - - - - org.digidoc4j.dss - dss-document - - - org.digidoc4j.dss - dss-xades - - - org.digidoc4j.dss - dss-cades - - - org.digidoc4j.dss - dss-spi - - - - - junit - junit - test - - - org.digidoc4j.dss - dss-test - test - - - org.digidoc4j.dss - dss-document - test-jar - test - - - ch.qos.logback - logback-classic - test - - - - \ No newline at end of file diff --git a/dss-asic/src/main/java/eu/europa/esig/dss/asic/ASiCSignatureParameters.java b/dss-asic/src/main/java/eu/europa/esig/dss/asic/ASiCSignatureParameters.java deleted file mode 100644 index 83b0e2f1dd..0000000000 --- a/dss-asic/src/main/java/eu/europa/esig/dss/asic/ASiCSignatureParameters.java +++ /dev/null @@ -1,53 +0,0 @@ -package eu.europa.esig.dss.asic; - -import eu.europa.esig.dss.AbstractSignatureParameters; -import eu.europa.esig.dss.SignatureLevel; - -public class ASiCSignatureParameters extends AbstractSignatureParameters { - - /** - * The object representing the parameters related to ASiC from of the signature. - */ - private ASiCParameters aSiCParams = new ASiCParameters(); - - /** - * ds:CanonicalizationMethod indicates the canonicalization algorithm: Algorithm="..." for SignedInfo. - */ - private String signedInfoCanonicalizationMethod; - - /** - * ds:CanonicalizationMethod indicates the canonicalization algorithm: Algorithm="..." for SignedProperties. - */ - private String signedPropertiesCanonicalizationMethod; - - public ASiCParameters aSiC() { - if (aSiCParams == null) { - aSiCParams = new ASiCParameters(); - } - return aSiCParams; - } - - @Override - public void setSignatureLevel(SignatureLevel signatureLevel) { - super.setSignatureLevel(signatureLevel); - ASiCParameters aSiC = aSiC(); - aSiC.containerForm = signatureLevel.getSignatureForm(); - } - - public String getSignedInfoCanonicalizationMethod() { - return signedInfoCanonicalizationMethod; - } - - public void setSignedInfoCanonicalizationMethod(String signedInfoCanonicalizationMethod) { - this.signedInfoCanonicalizationMethod = signedInfoCanonicalizationMethod; - } - - public String getSignedPropertiesCanonicalizationMethod() { - return signedPropertiesCanonicalizationMethod; - } - - public void setSignedPropertiesCanonicalizationMethod(String signedPropertiesCanonicalizationMethod) { - this.signedPropertiesCanonicalizationMethod = signedPropertiesCanonicalizationMethod; - } - -} diff --git a/dss-asic/src/main/java/eu/europa/esig/dss/asic/AsicManifestDocument.java b/dss-asic/src/main/java/eu/europa/esig/dss/asic/AsicManifestDocument.java deleted file mode 100644 index 74d0d3a3d3..0000000000 --- a/dss-asic/src/main/java/eu/europa/esig/dss/asic/AsicManifestDocument.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.asic; - -import java.io.ByteArrayInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.lang.StringUtils; -import org.w3c.dom.Document; - -import eu.europa.esig.dss.CommonDocument; -import eu.europa.esig.dss.DSSException; -import eu.europa.esig.dss.DSSUtils; -import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.MimeType; -import eu.europa.esig.dss.xades.DSSXMLUtils; - -/** - * AsicManifest file representation - * - */ -public class AsicManifestDocument extends CommonDocument { - - private byte[] bytes; - - private String absolutePath; - - private String signatureUri; - - /** - * Creates dss document that retains the data in memory - * - * @param bytes - * array of bytes representing the document - * @param name - * the file name if the data originates from a file - */ - public AsicManifestDocument(final byte[] bytes, final String name) { - - this.bytes = bytes; - this.name = name; - this.mimeType = MimeType.XML; - final Document document = DSSXMLUtils.buildDOM(bytes); - signatureUri = DSSXMLUtils.getValue(document, "/asic:ASiCManifest/asic:SigReference/@URI"); - if (StringUtils.isBlank(signatureUri)) { - throw new DSSException("The AsicManifest file must contains the URI of the related signature."); - } - } - - @Override - public InputStream openStream() throws DSSException { - final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); - return byteArrayInputStream; - } - - public byte[] getBytes() throws DSSException { - return bytes; - } - - @Override - public void setAbsolutePath(final String absolutePath) { - this.absolutePath = absolutePath; - } - - @Override - public void save(final String filePath) { - try { - final FileOutputStream fos = new FileOutputStream(filePath); - DSSUtils.write(getBytes(), fos); - fos.close(); - } catch (FileNotFoundException e) { - throw new DSSException(e); - } catch (IOException e) { - throw new DSSException(e); - } - } - - @Override - public String getAbsolutePath() { - - return absolutePath; - } - - @Override - public String getDigest(final DigestAlgorithm digestAlgorithm) { - final byte[] digestBytes = DSSUtils.digest(digestAlgorithm, bytes); - final String base64Encode = Base64.encodeBase64String(digestBytes); - return base64Encode; - } - - public String getBase64Encoded() { - return Base64.encodeBase64String(bytes); - } - - public String getSignatureUri() { - return signatureUri; - } -} \ No newline at end of file diff --git a/dss-asic/src/main/java/eu/europa/esig/dss/asic/signature/ASiCService.java b/dss-asic/src/main/java/eu/europa/esig/dss/asic/signature/ASiCService.java deleted file mode 100644 index 0078bbcad5..0000000000 --- a/dss-asic/src/main/java/eu/europa/esig/dss/asic/signature/ASiCService.java +++ /dev/null @@ -1,908 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.asic.signature; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.zip.CRC32; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; - -import javax.xml.crypto.dsig.XMLSignature; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -import eu.europa.esig.dss.AbstractSignatureParameters; -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSException; -import eu.europa.esig.dss.DSSUnsupportedOperationException; -import eu.europa.esig.dss.DSSUtils; -import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.MimeType; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.SigningOperation; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCParameters; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.validation.ASiCContainerValidator; -import eu.europa.esig.dss.cades.CAdESSignatureParameters; -import eu.europa.esig.dss.cades.signature.CAdESService; -import eu.europa.esig.dss.signature.AbstractSignatureService; -import eu.europa.esig.dss.signature.DocumentSignatureService; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.DocumentValidator; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.xades.ASiCNamespaces; -import eu.europa.esig.dss.xades.DSSXMLUtils; -import eu.europa.esig.dss.xades.XAdESSignatureParameters; -import eu.europa.esig.dss.xades.signature.XAdESService; - -/** - * Implementation of {@code DocumentSignatureService} for ASiC-S and -E containers. It allows the creation of containers - * based on XAdES or CAdES standard. - * - */ -public class ASiCService extends AbstractSignatureService { - - private static final Logger LOG = LoggerFactory.getLogger(ASiCService.class); - - private final static String ZIP_ENTRY_DETACHED_FILE = "detached-file"; - private final static String ZIP_ENTRY_MIMETYPE = "mimetype"; - private final static String META_INF = "META-INF/"; - private final static String ZIP_ENTRY_ASICS_METAINF_XADES_SIGNATURE = META_INF + "signatures.xml"; - private final static String ZIP_ENTRY_ASICE_METAINF_XADES_SIGNATURE = META_INF + "signatures001.xml"; - private final static String ZIP_ENTRY_ASICS_METAINF_CADES_SIGNATURE = META_INF + "signature.p7s"; - private final static String ZIP_ENTRY_ASICE_METAINF_CADES_SIGNATURE = META_INF + "signature001.p7s"; - - public final static String ASICS_NS = "asic:XAdESSignatures"; - - /** - * This is the constructor to create an instance of the {@code ASiCService}. A certificate verifier must be - * provided. - * - * @param certificateVerifier - * {@code CertificateVerifier} provides information on the sources to be used in the validation process - * in the context of a signature. - */ - public ASiCService(final CertificateVerifier certificateVerifier) { - - super(certificateVerifier); - LOG.debug("+ ASiCService created"); - } - - @Override - public ToBeSigned getDataToSign(final DSSDocument toSignDocument, final ASiCSignatureParameters parameters) throws DSSException { - try { - if (!canBeSigned(toSignDocument, parameters)) { // First verify if the file can be signed - throw new DSSUnsupportedOperationException("You can only sign an ASiC container by using the same type of container and of signature"); - } - } catch (IOException e) { - throw new DSSException(e); - } - - final ASiCParameters asicParameters = parameters.aSiC(); - - // toSignDocument can be a simple file or an ASiC container - final DSSDocument contextToSignDocument = prepare(toSignDocument, parameters); - parameters.aSiC().setEnclosedSignature(asicParameters.getEnclosedSignature()); - - final AbstractSignatureParameters underlyingParameters = getParameters(parameters); - if (isAsice(asicParameters) && isCAdESForm(asicParameters)) { - underlyingParameters.setDetachedContent(null); - } - final DocumentSignatureService underlyingService = getSpecificService(parameters.aSiC().getUnderlyingForm()); - return underlyingService.getDataToSign(contextToSignDocument, underlyingParameters); - } - - /** - * ETSI TS 102 918 v1.2.1 (2012-02)
- * - * Contents of Container ( 6.2.2 ) - *

- *
    - *
  • The file extension ".asics" should be used .
  • - *
  • The root element of each signature content shall be either <asic:XadESSignatures> as specified in - * clause - * A.5. Its the recommended format
  • - *
  • The comment field in the ZIP header may be used to identify the type of the data object within the container. - *
    - * If this field is present, it should be set with "mimetype=" followed by the mime type of the data object held in - * the signed data object
  • - *
  • The mimetype file can be used to support operating systems that rely on some content in specific positions in - * a file.
    - *
      - *
    • It has to be the first entry in the archive.
    • - *
    • It cannot contain "Extra fields".
    • - *
    • It cannot be compressed or encrypted inside the ZIP file
    • - *
    - *
  • - *
- */ - @Override - public DSSDocument signDocument(final DSSDocument toSignDocument, final ASiCSignatureParameters parameters, SignatureValue signatureValue) - throws DSSException { - try { - - if (!canBeSigned(toSignDocument, parameters)) { - throw new DSSUnsupportedOperationException("You can only sign an ASiC container by using the same type of container and of signature"); - } - assertSigningDateInCertificateValidityRange(parameters); - - // Signs the toSignDocument first - final ASiCParameters asicParameters = parameters.aSiC(); - - DSSDocument contextToSignDocument = prepare(toSignDocument, parameters); - parameters.aSiC().setEnclosedSignature(asicParameters.getEnclosedSignature()); - - AbstractSignatureParameters underlyingParameters = getParameters(parameters); - if (isAsice(asicParameters) && isCAdESForm(asicParameters)) { - underlyingParameters.setDetachedContent(null); - } - final DocumentSignatureService underlyingService = getSpecificService(parameters.aSiC().getUnderlyingForm()); - final DSSDocument signature = underlyingService.signDocument(contextToSignDocument, underlyingParameters, signatureValue); - - underlyingParameters = getParameters(parameters); - DSSDocument asicContainer = null; - final boolean signingContainer = asicParameters.getEnclosedSignature() != null; - if (signingContainer) { - asicContainer = toSignDocument; - } - if (isAsice(asicParameters) && isCAdESForm(asicParameters)) { - if (!signingContainer) { - contextToSignDocument = toSignDocument; - } else { - contextToSignDocument = parameters.getDetachedContent(); - } - } - final InMemoryDocument asicSignature = buildASiCContainer(contextToSignDocument, asicContainer, parameters, signature); - asicSignature.setName(DSSUtils.getFinalFileName(toSignDocument, SigningOperation.SIGN, parameters.getSignatureLevel())); - parameters.reinitDeterministicId(); - return asicSignature; - - } catch (IOException e) { - throw new DSSException(e); - } - - } - - @Override - public DSSDocument extendDocument(final DSSDocument toExtendDocument, final ASiCSignatureParameters parameters) throws DSSException { - try { - final DocumentValidator validator = SignedDocumentValidator.fromDocument(toExtendDocument); - final DocumentValidator subordinatedValidator = validator.getSubordinatedValidator(); - final DocumentSignatureService specificService = getSpecificService(parameters.aSiC().getUnderlyingForm()); - specificService.setTspSource(tspSource); - - final AbstractSignatureParameters underlyingParameters = getParameters(parameters); - final DSSDocument detachedContent = parameters.getDetachedContent(); - final DSSDocument detachedContents = getDetachedContents(subordinatedValidator, detachedContent); - underlyingParameters.setDetachedContent(detachedContents); - final DSSDocument signature = subordinatedValidator.getDocument(); - final DSSDocument signedDocument = specificService.extendDocument(signature, underlyingParameters); - - final ByteArrayOutputStream output = new ByteArrayOutputStream(); - final ZipOutputStream zipOutputStream = new ZipOutputStream(output); - final ZipInputStream zipInputStream = new ZipInputStream(toExtendDocument.openStream()); - ZipEntry entry; - while ((entry = getNextZipEntry(zipInputStream)) != null) { - - final String name = entry.getName(); - final ZipEntry newEntry = new ZipEntry(name); - if (ASiCContainerValidator.isMimetype(name)) { - - storeMimetype(parameters.aSiC(), zipOutputStream); - } else if (ASiCContainerValidator.isXAdES(name) || ASiCContainerValidator.isCAdES(name)) { - - createZipEntry(zipOutputStream, newEntry); - final InputStream inputStream = signedDocument.openStream(); - IOUtils.copy(inputStream, zipOutputStream); - IOUtils.closeQuietly(inputStream); - } else { - - createZipEntry(zipOutputStream, newEntry); - IOUtils.copy(zipInputStream, zipOutputStream); - } - } - IOUtils.closeQuietly(zipInputStream); - IOUtils.closeQuietly(zipOutputStream); - DSSDocument asicSignature = new InMemoryDocument(output.toByteArray(), null, getMimeType(parameters.aSiC().getContainerForm())); - asicSignature.setName(DSSUtils.getFinalFileName(toExtendDocument, SigningOperation.EXTEND, parameters.getSignatureLevel())); - return asicSignature; - } catch (IOException e) { - throw new DSSException(e); - } - } - - private DSSDocument copyDetachedContent(final AbstractSignatureParameters underlyingParameters, final DocumentValidator subordinatedValidator) { - - DSSDocument contextToSignDocument = null; - DSSDocument currentDetachedDocument = null; - final List detachedContents = subordinatedValidator.getDetachedContents(); - for (final DSSDocument detachedDocument : detachedContents) { - - if (contextToSignDocument == null) { - contextToSignDocument = detachedDocument; - } else { - currentDetachedDocument.setNextDocument(detachedDocument); - } - currentDetachedDocument = detachedDocument; - } - underlyingParameters.setDetachedContent(contextToSignDocument); - return contextToSignDocument; - } - - private DocumentValidator getAsicValidator(final DSSDocument toSignDocument) { - - // Check if this is an existing container - try { - - final DocumentValidator validator = SignedDocumentValidator.fromDocument(toSignDocument); - if (isAsicValidator(validator)) { - - return validator; - } - } catch (Exception e) { - // do nothing - } - return null; - } - - public InMemoryDocument buildASiCContainer(final DSSDocument toSignDocument, DSSDocument signDocument, final ASiCSignatureParameters parameters, - final DSSDocument signature) throws IOException { - - ASiCParameters asicParameters = parameters.aSiC(); - - final boolean asice = isAsice(asicParameters); - final boolean cadesForm = isCAdESForm(asicParameters); - final boolean xadesForm = isXAdESForm(asicParameters); - - final String toSignDocumentName = toSignDocument.getName(); - - final ByteArrayOutputStream outBytes = new ByteArrayOutputStream(); - ZipOutputStream zipOutputStream = new ZipOutputStream(outBytes); - if (asice && (signDocument != null)) { - - copyZipContent(signDocument, zipOutputStream); - } else { - if (signDocument != null && isCAdESForm(asicParameters)) { - copyMETAINFContent(signDocument, zipOutputStream); - } - storeZipComment(asicParameters, zipOutputStream, toSignDocumentName); - - storeMimetype(asicParameters, zipOutputStream); - } - storeSignedFiles(toSignDocument, zipOutputStream); - - storesSignature(asicParameters, signature, zipOutputStream); - - if (asice) { - if (cadesForm) { - storeAsicManifestCAdES(parameters, toSignDocument, zipOutputStream); - } else if (signDocument == null && xadesForm) { // only one manifest file / zip - storeManifestXAdES(parameters, toSignDocument, zipOutputStream); - } - } - DSSUtils.close(zipOutputStream); - - final InMemoryDocument asicContainer = createASiCContainer(asicParameters, outBytes); - return asicContainer; - } - - private void copyZipContent(DSSDocument toSignAsicContainer, ZipOutputStream zipOutputStream) throws IOException { - - final InputStream inputStream = toSignAsicContainer.openStream(); - final ZipInputStream zipInputStream = new ZipInputStream(inputStream); - for (ZipEntry entry = getNextZipEntry(zipInputStream); entry != null; entry = getNextZipEntry(zipInputStream)) { - - createZipEntry(zipOutputStream, entry); - IOUtils.copy(zipInputStream, zipOutputStream); - } - IOUtils.closeQuietly(zipInputStream); - } - - private void copyMETAINFContent(DSSDocument toSignAsicContainer, ZipOutputStream zipOutputStream) throws IOException { - final InputStream inputStream = toSignAsicContainer.openStream(); - final ZipInputStream zipInputStream = new ZipInputStream(inputStream); - for (ZipEntry entry = getNextZipEntry(zipInputStream); entry != null; entry = getNextZipEntry(zipInputStream)) { - if (entry.getName().contains("META-INF/")) { - createZipEntry(zipOutputStream, entry); - IOUtils.copy(zipInputStream, zipOutputStream); - } - } - IOUtils.closeQuietly(zipInputStream); - } - - private void storeAsicManifestCAdES(ASiCSignatureParameters parameters, final DSSDocument detachedDocument, final ZipOutputStream outZip) { - - ASiCParameters asicParameters = parameters.aSiC(); - - final String signatureName = getSignatureFileName(asicParameters); - final int indexOfSignature = signatureName.indexOf("signature"); - String suffix = signatureName.substring(indexOfSignature); - final int lastIndexOf = suffix.lastIndexOf("."); - suffix = suffix.substring(0, lastIndexOf); - final String asicManifestZipEntryName = META_INF + "ASiCManifest" + suffix + ".xml"; - final ZipEntry entrySignature = new ZipEntry(asicManifestZipEntryName); - createZipEntry(outZip, entrySignature); - - buildAsicManifestCAdES(parameters, detachedDocument, outZip); - } - - private void buildAsicManifestCAdES(final ASiCSignatureParameters underlyingParameters, final DSSDocument detachedDocument, - final OutputStream outputStream) { - - ASiCParameters asicParameters = underlyingParameters.aSiC(); - - final Document documentDom = DSSXMLUtils.buildDOM(); - final Element asicManifestDom = documentDom.createElementNS(ASiCNamespaces.ASiC, "asic:ASiCManifest"); - documentDom.appendChild(asicManifestDom); - - final Element sigReferenceDom = DSSXMLUtils.addElement(documentDom, asicManifestDom, ASiCNamespaces.ASiC, "asic:SigReference"); - final String signatureName = getSignatureFileName(asicParameters); - sigReferenceDom.setAttribute("URI", signatureName); - sigReferenceDom.setAttribute("MimeType", MimeType.PKCS7.getMimeTypeString()); // only CAdES form - - DSSDocument currentDetachedDocument = detachedDocument; - do { - - final String detachedDocumentName = currentDetachedDocument.getName(); - final Element dataObjectReferenceDom = DSSXMLUtils.addElement(documentDom, sigReferenceDom, ASiCNamespaces.ASiC, "asic:DataObjectReference"); - dataObjectReferenceDom.setAttribute("URI", detachedDocumentName); - - final Element digestMethodDom = DSSXMLUtils.addElement(documentDom, dataObjectReferenceDom, XMLSignature.XMLNS, "DigestMethod"); - final DigestAlgorithm digestAlgorithm = underlyingParameters.getDigestAlgorithm(); - digestMethodDom.setAttribute("Algorithm", digestAlgorithm.getXmlId()); - - final Element digestValueDom = DSSXMLUtils.addElement(documentDom, dataObjectReferenceDom, XMLSignature.XMLNS, "DigestValue"); - final byte[] digest = DSSUtils.digest(digestAlgorithm, currentDetachedDocument); - final String base64Encoded = Base64.encodeBase64String(digest); - final Text textNode = documentDom.createTextNode(base64Encoded); - digestValueDom.appendChild(textNode); - - currentDetachedDocument = currentDetachedDocument.getNextDocument(); - } while (currentDetachedDocument != null); - - storeXmlDom(outputStream, documentDom); - } - - private void storeManifestXAdES(ASiCSignatureParameters parameters, final DSSDocument detachedDocument, final ZipOutputStream outZip) { - final String asicManifestZipEntryName = META_INF + "manifest.xml"; - final ZipEntry entrySignature = new ZipEntry(asicManifestZipEntryName); - createZipEntry(outZip, entrySignature); - - buildAsicManifestXAdES(parameters, detachedDocument, outZip); - } - - // - // > - // - // - // - // - private void buildAsicManifestXAdES(ASiCSignatureParameters parameters, DSSDocument detachedDocument, OutputStream outputStream) { - final Document documentDom = DSSXMLUtils.buildDOM(); - final Element manifestDom = documentDom.createElementNS(ASiCNamespaces.MANIFEST_NS, "manifest:manifest"); - documentDom.appendChild(manifestDom); - - final Element rootDom = DSSXMLUtils.addElement(documentDom, manifestDom, ASiCNamespaces.MANIFEST_NS, "manifest:file-entry"); - rootDom.setAttribute("manifest:full-path", "/"); - rootDom.setAttribute("manifest:media-type", MimeType.ASICE.getMimeTypeString()); - - DSSDocument currentDetachedDocument = detachedDocument; - do { - Element fileDom = DSSXMLUtils.addElement(documentDom, manifestDom, ASiCNamespaces.MANIFEST_NS, "manifest:file-entry"); - fileDom.setAttribute("manifest:full-path", currentDetachedDocument.getName()); - fileDom.setAttribute("manifest:media-type", currentDetachedDocument.getMimeType().getMimeTypeString()); - - currentDetachedDocument = currentDetachedDocument.getNextDocument(); - } while (currentDetachedDocument != null); - - storeXmlDom(outputStream, documentDom); - } - - private void createZipEntry(final ZipOutputStream outZip, final ZipEntry entrySignature) throws DSSException { - try { - outZip.putNextEntry(entrySignature); - } catch (IOException e) { - throw new DSSException(e); - } - } - - private InMemoryDocument createASiCContainer(final ASiCParameters asicParameters, final ByteArrayOutputStream outBytes) { - SignatureForm containerForm = asicParameters.getContainerForm(); - return new InMemoryDocument(outBytes.toByteArray(), null, getMimeType(containerForm)); - } - - private MimeType getMimeType(SignatureForm containerForm) { - boolean asics = SignatureForm.ASiC_S.equals(containerForm); - return asics ? MimeType.ASICS : MimeType.ASICE; - } - - private void storesSignature(final ASiCParameters asicParameters, final DSSDocument signature, final ZipOutputStream outZip) { - if (isXAdESForm(asicParameters)) { - buildXAdES(asicParameters, signature, outZip); - } else if (isCAdESForm(asicParameters)) { - buildCAdES(asicParameters, signature, outZip); - } else { - throw new DSSException("ASiC signature form must be XAdES or CAdES!"); - } - } - - private boolean isCAdESForm(final ASiCParameters asicParameters) { - final SignatureForm underlyingForm = asicParameters.getUnderlyingForm(); - return SignatureForm.CAdES.equals(underlyingForm); - } - - private boolean isXAdESForm(final ASiCParameters asicParameters) { - final SignatureForm underlyingForm = asicParameters.getUnderlyingForm(); - return SignatureForm.XAdES.equals(underlyingForm); - } - - private void storeZipComment(final ASiCParameters asicParameters, final ZipOutputStream outZip, final String toSignDocumentName) { - if (asicParameters.isZipComment() && StringUtils.isNotEmpty(toSignDocumentName)) { - //outZip.setComment("mimetype=" + getMimeTypeBytes(asicParameters)); - outZip.setComment(asicParameters.getZipCommentValue()); //BDoc specific functionality - } - } - - private DSSDocument prepare(final DSSDocument detachedDocument, final ASiCSignatureParameters underlyingParameter) { - - // detachedDocument can be a simple file or an ASiC container - DSSDocument contextToSignDocument = detachedDocument; - ASiCParameters asicParameters = underlyingParameter.aSiC(); - final boolean asice = isAsice(asicParameters); - final boolean cadesForm = isCAdESForm(asicParameters); - final DocumentValidator validator = getAsicValidator(detachedDocument); - if (isAsicValidator(validator)) { - - // This is already an existing ASiC container; a new signature should be added. - final DocumentValidator subordinatedValidator = validator.getSubordinatedValidator(); - final DSSDocument contextSignature = subordinatedValidator.getDocument(); - DSSDocument signature = contextSignature; - DocumentValidator documentValidator = subordinatedValidator; - while (documentValidator.getNextValidator() != null) { - documentValidator = documentValidator.getNextValidator(); - signature.setNextDocument(documentValidator.getDocument()); - signature = signature.getNextDocument(); - } - - asicParameters.setEnclosedSignature(contextSignature); - if (asice) { - if (cadesForm) { - final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - buildAsicManifestCAdES(underlyingParameter, underlyingParameter.getDetachedContent(), outputStream); - contextToSignDocument = new InMemoryDocument(outputStream.toByteArray(), "AsicManifestXXX.xml", MimeType.XML); - // underlyingParameter.setDetachedContent(null); - } else { - contextToSignDocument = underlyingParameter.getDetachedContent(); - } - } else { - contextToSignDocument = copyDetachedContent(underlyingParameter, subordinatedValidator); - } - /* - * if (!asice && (subordinatedValidator instanceof ASiCCMSDocumentValidator)) { - * contextToSignDocument = contextSignature; - * } - */ - } else { - if (asice && cadesForm) { - final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - buildAsicManifestCAdES(underlyingParameter, detachedDocument, outputStream); - contextToSignDocument = new InMemoryDocument(outputStream.toByteArray(), "AsicManifestXXX.xml", MimeType.XML); - } else { - underlyingParameter.setDetachedContent(contextToSignDocument); - } - } - return contextToSignDocument; - } - - private boolean isAsicValidator(final DocumentValidator documentValidator) { - final boolean result = (documentValidator != null) && (documentValidator instanceof ASiCContainerValidator); - return result; - } - - private ZipEntry getNextZipEntry(final ZipInputStream zipInputStream) throws DSSException { - try { - return zipInputStream.getNextEntry(); - } catch (IOException e) { - throw new DSSException(e); - } - } - - private DSSDocument getDetachedContents(final DocumentValidator subordinatedValidator, DSSDocument originalDocument) { - - final List detachedContents = subordinatedValidator.getDetachedContents(); - if ((detachedContents == null) || (detachedContents.size() == 0)) { - - final List detachedContentsList = new ArrayList(); - DSSDocument currentDocument = originalDocument; - do { - detachedContentsList.add(currentDocument); - subordinatedValidator.setDetachedContents(detachedContentsList); - currentDocument = currentDocument.getNextDocument(); - } while (currentDocument != null); - } else { - originalDocument = null; - DSSDocument lastDocument = null; - for (final DSSDocument currentDocument : detachedContents) { - if (ASiCContainerValidator.isASiCManifest(currentDocument.getName())) { - originalDocument = currentDocument; - lastDocument = currentDocument; - } - } - if (originalDocument != null) { - detachedContents.remove(originalDocument); - } - for (final DSSDocument currentDocument : detachedContents) { - if (originalDocument == null) { - originalDocument = currentDocument; - } else { - lastDocument.setNextDocument(currentDocument); - } - lastDocument = currentDocument; - } - - } - return originalDocument; - } - - /** - * Creates a specific XAdES/CAdES signature parameters on the base of the provided parameters. Forces the signature - * packaging to - * DETACHED - * - * @param parameters - * must provide signingToken, PrivateKeyEntry and date - * @return new specific instance for XAdES or CAdES - */ - private AbstractSignatureParameters getParameters(final ASiCSignatureParameters parameters) { - SignatureForm asicSignatureForm = parameters.aSiC().getUnderlyingForm(); - if (SignatureForm.CAdES == asicSignatureForm) { - return initCAdESSignatureParameters(parameters); - } else if (SignatureForm.XAdES == asicSignatureForm) { - return initXAdESSignatureParameters(parameters); - } else { - throw new DSSException("Unsupported form : " + asicSignatureForm); - } - } - - private XAdESSignatureParameters initXAdESSignatureParameters(ASiCSignatureParameters parameters) { - XAdESSignatureParameters xadesParameters = new XAdESSignatureParameters(); - initCommonFields(parameters, xadesParameters); - initXAdESDocumentRoot(xadesParameters, parameters.aSiC()); - SignatureLevel asicProfile = parameters.getSignatureLevel(); - SignatureLevel underlyingLevel; - switch (asicProfile) { - case ASiC_S_BASELINE_B: - case ASiC_E_BASELINE_B: - underlyingLevel = SignatureLevel.XAdES_BASELINE_B; - break; - case ASiC_S_BASELINE_T: - case ASiC_E_BASELINE_T: - underlyingLevel = SignatureLevel.XAdES_BASELINE_T; - break; - case ASiC_S_BASELINE_LT: - case ASiC_E_BASELINE_LT: - underlyingLevel = SignatureLevel.XAdES_BASELINE_LT; - break; - case ASiC_S_BASELINE_LTA: - case ASiC_E_BASELINE_LTA: - underlyingLevel = SignatureLevel.XAdES_BASELINE_LTA; - break; - default: - throw new DSSException("Unsupported format: " + asicProfile.name()); - } - xadesParameters.setSignatureLevel(underlyingLevel); - xadesParameters.setSignaturePackaging(SignaturePackaging.DETACHED); - xadesParameters.setSignedInfoCanonicalizationMethod(parameters.getSignedInfoCanonicalizationMethod()); - xadesParameters.setSignedPropertiesCanonicalizationMethod(parameters.getSignedPropertiesCanonicalizationMethod()); - xadesParameters.setDeterministicId(parameters.getDeterministicId()); - return xadesParameters; - } - - private CAdESSignatureParameters initCAdESSignatureParameters(ASiCSignatureParameters parameters) { - CAdESSignatureParameters cadesParameters = new CAdESSignatureParameters(); - initCommonFields(parameters, cadesParameters); - SignatureLevel asicProfile = parameters.getSignatureLevel(); - SignatureLevel underlyingLevel; - switch (asicProfile) { - case ASiC_S_BASELINE_B: - case ASiC_E_BASELINE_B: - underlyingLevel = SignatureLevel.CAdES_BASELINE_B; - break; - case ASiC_S_BASELINE_T: - case ASiC_E_BASELINE_T: - underlyingLevel = SignatureLevel.CAdES_BASELINE_T; - break; - case ASiC_S_BASELINE_LT: - case ASiC_E_BASELINE_LT: - underlyingLevel = SignatureLevel.CAdES_BASELINE_LT; - break; - case ASiC_S_BASELINE_LTA: - case ASiC_E_BASELINE_LTA: - underlyingLevel = SignatureLevel.CAdES_BASELINE_LTA; - break; - default: - throw new DSSException("Unsupported format: " + asicProfile.name()); - } - cadesParameters.setSignatureLevel(underlyingLevel); - cadesParameters.setSignaturePackaging(SignaturePackaging.DETACHED); - cadesParameters.setDeterministicId(parameters.getDeterministicId()); - return cadesParameters; - } - - private void initCommonFields(AbstractSignatureParameters originalParameters, AbstractSignatureParameters parameters) { - if (originalParameters.getSigningCertificate() != null) { // extends no need certificate - parameters.setSigningCertificate(originalParameters.getSigningCertificate()); - parameters.setCertificateChain(originalParameters.getCertificateChain()); - } - parameters.setSignWithExpiredCertificate(originalParameters.isSignWithExpiredCertificate()); - parameters.setDetachedContent(originalParameters.getDetachedContent()); - parameters.setBLevelParams(originalParameters.bLevel()); - parameters.setDigestAlgorithm(originalParameters.getDigestAlgorithm()); - parameters.setEncryptionAlgorithm(originalParameters.getEncryptionAlgorithm()); - parameters.setContentTimestampParameters(originalParameters.getContentTimestampParameters()); - parameters.setContentTimestamps(originalParameters.getContentTimestamps()); - parameters.setSignatureTimestampParameters(originalParameters.getSignatureTimestampParameters()); - parameters.setArchiveTimestampParameters(originalParameters.getArchiveTimestampParameters()); - } - - private void buildCAdES(final ASiCParameters asicParameters, final DSSDocument signature, final ZipOutputStream outZip) throws DSSException { - final String signatureZipEntryName = getSignatureFileName(asicParameters); - final ZipEntry entrySignature = new ZipEntry(signatureZipEntryName); - createZipEntry(outZip, entrySignature); - zipWriteBytes(outZip, signature); - } - - private void zipWriteBytes(final ZipOutputStream outZip, final DSSDocument document) throws DSSException { - try { - document.writeTo(outZip); - } catch (IOException e) { - throw new DSSException(e); - } - } - - private void zipWriteBytes(final ZipOutputStream outZip, final byte[] bytes) throws DSSException { - try { - outZip.write(bytes); - } catch (IOException e) { - throw new DSSException(e); - } - } - - private String getSignatureFileName(final ASiCParameters asicParameters) { - if (StringUtils.isNotBlank(asicParameters.getSignatureFileName())) { - return META_INF + asicParameters.getSignatureFileName(); - } - final boolean asice = isAsice(asicParameters); - if (isXAdESForm(asicParameters)) { - if (asice) { - if (asicParameters.getEnclosedSignature() != null) { - return ZIP_ENTRY_ASICE_METAINF_XADES_SIGNATURE.replace('1', getSignatureNumber(asicParameters.getEnclosedSignature())); - } else { - return ZIP_ENTRY_ASICE_METAINF_XADES_SIGNATURE; - } - } else { - return ZIP_ENTRY_ASICS_METAINF_XADES_SIGNATURE; - } - } else if (isCAdESForm(asicParameters)) { - if (asice || asicParameters.getEnclosedSignature() != null) { - if (asicParameters.getEnclosedSignature() != null) { - return ZIP_ENTRY_ASICE_METAINF_CADES_SIGNATURE.replace('1', getSignatureNumber(asicParameters.getEnclosedSignature())); - } else { - return ZIP_ENTRY_ASICE_METAINF_CADES_SIGNATURE; - } - } else { - return ZIP_ENTRY_ASICS_METAINF_CADES_SIGNATURE; - } - } else { - throw new DSSException("ASiC signature form must be XAdES or CAdES!"); - } - } - - private char getSignatureNumber(DSSDocument enclosedSignature) { - int signatureNumbre = '1'; - while (enclosedSignature != null) { - signatureNumbre++; - enclosedSignature = enclosedSignature.getNextDocument(); - } - return (char) signatureNumbre; - } - - private void storeMimetype(final ASiCParameters asicParameters, final ZipOutputStream outZip) throws DSSException { - final byte[] mimeTypeBytes = getMimeTypeBytes(asicParameters).getBytes(); - final ZipEntry entryMimetype = getZipEntryMimeType(mimeTypeBytes); - - writeZipEntry(outZip, mimeTypeBytes, entryMimetype); - } - - private void writeZipEntry(final ZipOutputStream outZip, final byte[] mimeTypeBytes, final ZipEntry entryMimetype) throws DSSException { - createZipEntry(outZip, entryMimetype); - zipWriteBytes(outZip, mimeTypeBytes); - } - - private void storeSignedFiles(final DSSDocument detachedDocument, final ZipOutputStream outZip) throws IOException { - DSSDocument currentDetachedDocument = detachedDocument; - do { - - final String detachedDocumentName = currentDetachedDocument.getName(); - final String name = detachedDocumentName != null ? detachedDocumentName : ZIP_ENTRY_DETACHED_FILE; - final ZipEntry entryDocument = new ZipEntry(name); - outZip.setLevel(ZipEntry.DEFLATED); - try { - createZipEntry(outZip, entryDocument); - final InputStream inputStream = currentDetachedDocument.openStream(); - IOUtils.copy(inputStream, outZip); - IOUtils.closeQuietly(inputStream); - } catch (DSSException e) { - if (!((e.getCause() instanceof ZipException) && e.getCause().getMessage().startsWith("duplicate entry:"))) { - throw e; - } - } - currentDetachedDocument = currentDetachedDocument.getNextDocument(); - } while (currentDetachedDocument != null); - } - - private String getMimeTypeBytes(final ASiCParameters asicParameters) { - final String asicParameterMimeType = asicParameters.getMimeType(); - String mimeTypeBytes; - if (StringUtils.isBlank(asicParameterMimeType)) { - - if (isAsice(asicParameters)) { - mimeTypeBytes = MimeType.ASICE.getMimeTypeString(); - } else { - mimeTypeBytes = MimeType.ASICS.getMimeTypeString(); - } - } else { - mimeTypeBytes = asicParameterMimeType; - } - return mimeTypeBytes; - } - - private ZipEntry getZipEntryMimeType(final byte[] mimeTypeBytes) { - - final ZipEntry entryMimetype = new ZipEntry(ZIP_ENTRY_MIMETYPE); - entryMimetype.setMethod(ZipEntry.STORED); - entryMimetype.setSize(mimeTypeBytes.length); - entryMimetype.setCompressedSize(mimeTypeBytes.length); - final CRC32 crc = new CRC32(); - crc.update(mimeTypeBytes); - entryMimetype.setCrc(crc.getValue()); - return entryMimetype; - } - - private void initXAdESDocumentRoot(XAdESSignatureParameters xadesParameters, ASiCParameters asicParameters) { - DSSDocument enclosedSignature = asicParameters.getEnclosedSignature(); - Document rootDocument; - if ((enclosedSignature != null) && isAsics(asicParameters)) { - rootDocument = DSSXMLUtils.buildDOM(enclosedSignature); - } else { - rootDocument = DSSXMLUtils.createDocument(ASiCNamespaces.ASiC, ASICS_NS); - } - xadesParameters.setRootDocument(rootDocument); - } - - /** - * This method creates a XAdES signature. When adding a new signature, this one is appended to the already present - * signatures. - * - * @param asicParameters - * ASiC parameters - * @param signature - * signature being created - * @param outZip - * destination {@code ZipOutputStream} - * @throws eu.europa.esig.dss.DSSException - */ - private void buildXAdES(final ASiCParameters asicParameters, final DSSDocument signature, final ZipOutputStream outZip) throws DSSException { - final String signatureZipEntryName = getSignatureFileName(asicParameters); - final ZipEntry entrySignature = new ZipEntry(signatureZipEntryName); - createZipEntry(outZip, entrySignature); - Document xmlSignatureDoc = DSSXMLUtils.buildDOM(signature); - storeXmlDom(outZip, xmlSignatureDoc); - } - - private void storeXmlDom(final OutputStream outZip, final Document xml) throws DSSException { - try { - final DOMSource xmlSource = new DOMSource(xml); - final StreamResult outputTarget = new StreamResult(outZip); - TransformerFactory transformerFactory = DSSXMLUtils.getSecureTransformerFactory(); - transformerFactory.newTransformer().transform(xmlSource, outputTarget); - } catch (Exception e) { - throw new DSSException(e); - } - } - - private boolean isAsics(final ASiCParameters asicParameters) { - return SignatureForm.ASiC_S.equals(asicParameters.getContainerForm()); - } - - private boolean isAsice(final ASiCParameters asicParameters) { - return SignatureForm.ASiC_E.equals(asicParameters.getContainerForm()); - } - - /** - * This method returns the specific service associated with the container: XAdES or CAdES. - * - * @param specificParameters - * {@code DocumentSignatureService} - * @return - */ - protected DocumentSignatureService getSpecificService(SignatureForm signatureForm) { - DocumentSignatureService underlyingASiCService; - if (signatureForm == SignatureForm.XAdES) { - underlyingASiCService = new XAdESService(certificateVerifier); - } else if (signatureForm == SignatureForm.CAdES) { - underlyingASiCService = new CAdESService(certificateVerifier); - } else { - throw new DSSException("Unsupported parameter value: only XAdES and CAdES forms are acceptable!"); - } - underlyingASiCService.setTspSource(tspSource); - return underlyingASiCService; - } - - private boolean canBeSigned(DSSDocument toSignDocument, ASiCSignatureParameters parameters) throws IOException { - boolean isMimetypeCorrect = true; - boolean isSignatureTypeCorrect = true; - if (isArchive(toSignDocument)) { - isMimetypeCorrect = toSignDocument.getMimeType().getMimeTypeString().equals(getMimeTypeBytes(parameters.aSiC())); - InputStream stream = toSignDocument.openStream(); - ZipInputStream zip = new ZipInputStream(stream); - ZipEntry entry = zip.getNextEntry(); - while (entry != null) { - if (entry.getName().startsWith("META-INF") && entry.getName().contains("signature") && !entry.getName().contains("Manifest")) { - if (isCAdESForm(parameters.aSiC())) { - isSignatureTypeCorrect = (entry.getName().endsWith(".p7m") || entry.getName().endsWith(".p7s")); - } else { - isSignatureTypeCorrect = entry.getName().endsWith(".xml"); - } - } - entry = zip.getNextEntry(); - } - zip.close(); - } - return (isMimetypeCorrect && isSignatureTypeCorrect); - } - - private boolean isArchive(DSSDocument doc) { - return (doc.getName().endsWith(".zip") || doc.getName().endsWith(".bdoc") || doc.getName().endsWith(".asice") || doc.getName().endsWith(".asics")); - } -} diff --git a/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCCMSDocumentValidator.java b/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCCMSDocumentValidator.java deleted file mode 100644 index 41bc0aedf0..0000000000 --- a/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCCMSDocumentValidator.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.asic.validation; - -import java.util.List; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSException; -import eu.europa.esig.dss.cades.validation.CMSDocumentValidator; -import eu.europa.esig.dss.validation.DocumentValidator; - -/** - * Validator for ASiC signature - * - * - * - * - * - * - */ -public class ASiCCMSDocumentValidator extends CMSDocumentValidator { - - - /** - * This variable defines the sequence of the validator related to a document to validate. It's only used with ASiC-E container - */ - private DocumentValidator nextValidator; - - /** - * The default constructor for ASiCXMLDocumentValidator. - * - * @param signature {@code DSSDocument} representing the signature to validate - * @param detachedContents the {@code List} containing the potential signed documents - * @throws DSSException - */ - public ASiCCMSDocumentValidator(final DSSDocument signature, final List detachedContents) throws DSSException { - - super(signature); - this.detachedContents = detachedContents; - } - - @Override - public void setNextValidator(final DocumentValidator validator) { - - nextValidator = validator; - } - - @Override - public DocumentValidator getNextValidator() { - return nextValidator; - } -} diff --git a/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCContainerValidator.java b/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCContainerValidator.java deleted file mode 100644 index 49b254694f..0000000000 --- a/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCContainerValidator.java +++ /dev/null @@ -1,562 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.asic.validation; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSException; -import eu.europa.esig.dss.DSSNotETSICompliantException; -import eu.europa.esig.dss.DSSUnsupportedOperationException; -import eu.europa.esig.dss.DSSUtils; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.MimeType; -import eu.europa.esig.dss.asic.AsicManifestDocument; -import eu.europa.esig.dss.validation.AdvancedSignature; -import eu.europa.esig.dss.validation.DocumentValidator; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.policy.ValidationPolicy; -import eu.europa.esig.dss.validation.reports.Reports; - -/** - * This class is the base class for ASiC containers. - * - * Mime-type handling: FROM: ETSI TS 102 918 V1.2.1 - * A.1 Mimetype - * The "mimetype" object, when stored in a ZIP, file can be used to support operating systems that rely on some content - * in - * specific positions in a file (the so called "magic number" as described in RFC 4288 [11] in order to select the - * specific - * application that can load and elaborate the file content. The following restrictions apply to the mimetype to support - * this - * feature: - * • it has to be the first in the archive; - * • it cannot contain "Extra fields" (i.e. extra field length at offset 28 shall be zero); - * • it cannot be compressed (i.e. compression method at offset 8 shall be zero); - * • the first 4 octets shall have the hex values: "50 4B 03 04". - * An application can ascertain if this feature is used by checking if the string "mimetype" is found starting at offset - * 30. In - * this case it can be assumed that a string representing the container mime type is present starting at offset 38; the - * length - * of this string is contained in the 4 octets starting at offset 18. - * All multi-octets values are little-endian. - * The "mimetype" shall NOT be compressed or encrypted inside the ZIP file. - * - * --> The use of two first bytes is not standard conforming. - * - * 5.2.1 Media type identification - * 1) File extension: ".asics"|".asice" should be used (".scs"|".sce" is allowed for operating systems and/or file - * systems not - * allowing more than 3 characters file extensions). In the case where the container content is to be handled - * manually, the ".zip" extension may be used. - * - */ -public class ASiCContainerValidator extends SignedDocumentValidator { - - private static final Logger LOG = LoggerFactory.getLogger(ASiCContainerValidator.class); - - private static final String MIME_TYPE = "mimetype"; - private static final String MIME_TYPE_COMMENT = MIME_TYPE + "="; - private static final String META_INF_FOLDER = "META-INF/"; - - private final DSSDocument asicContainer; - - /** - * This is the subordinated validator: can be XML or CMS - */ - private SignedDocumentValidator subordinatedValidator; - - /** - * The list of the signatures contained within the container. - */ - private final List signatures = new ArrayList(); - - /** - * This list caches the validated signatures. - */ - private List validatedSignatures; - - /** - * This mime-type comes from the container file name: (zip, asic...). - */ - // private MimeType asicContainerMimeType; - - /** - * This mime-type comes from the 'mimetype' file included within the container. - */ - private MimeType asicMimeType; - - /** - * This mime-type comes from the ZIP comment:
- * The comment field in the ZIP header may be used to identify the type of the data object within the container. - * If this field is present, it should be set with "mimetype=" followed by the mime type of the data object held in - * the signed data object. - */ - // protected MimeType asicCommentMimeType; - - private boolean cadesSigned = false; - private boolean xadesSigned = false; - private boolean timestamped = false; - - /** - * Default constructor used with reflexion (see SignedDocumentValidator) - */ - private ASiCContainerValidator() { - super(null); - this.asicContainer = null; - } - - public ASiCContainerValidator(final DSSDocument asicContainer) { - super(null); - this.asicContainer = asicContainer; - analyseEntries(); - - // ASiC-S: - // - throw new DSSException("ASiC-S profile support only one data file"); - // - DSSNotETSICompliantException.MSG.MORE_THAN_ONE_SIGNATURE - - createSubordinatedContainerValidators(); - } - - @Override - public boolean isSupported(DSSDocument dssDocument) { - int headerLength = 500; - byte[] preamble = new byte[headerLength]; - DSSUtils.readToArray(dssDocument, headerLength, preamble); - if ((preamble[0] == 'P') && (preamble[1] == 'K')) { - return true; - } - return false; - } - - private MimeType determinateAsicMimeType(final MimeType asicContainerMimetype, final MimeType asicEntryMimetype) { - - if (isASiCMimeType(asicContainerMimetype)) { - - return asicContainerMimetype; - } - if (isASiCMimeType(asicEntryMimetype)) { - - return asicEntryMimetype; - } - final MimeType asicCommentString = getZipComment(asicContainer); - if (isASiCMimeType(asicCommentString)) { - - return asicCommentString; - } - return null; - } - - private static boolean isASiCMimeType(final MimeType asicMimeType) { - return MimeType.ASICS.equals(asicMimeType) || MimeType.ASICE.equals(asicMimeType); - } - - private AsicManifestDocument getRelatedAsicManifest(final DSSDocument signature) { - - for (final DSSDocument detachedContent : detachedContents) { - - if (!(detachedContent instanceof AsicManifestDocument)) { - - continue; - } - final AsicManifestDocument asicManifestDocument = (AsicManifestDocument) detachedContent; - final String signatureUri = asicManifestDocument.getSignatureUri(); - if (signatureUri.equals(signature.getName())) { - - return asicManifestDocument; - } - } - return null; - } - - /** - * @return - */ - @Override - public SignedDocumentValidator getSubordinatedValidator() { - return subordinatedValidator; - } - - private void createSubordinatedContainerValidators() { - - SignedDocumentValidator previousValidator = null; - for (final DSSDocument signature : signatures) { - - final SignedDocumentValidator currentSubordinatedValidator; - if (xadesSigned) { - currentSubordinatedValidator = new ASiCXMLDocumentValidator(signature, detachedContents); - } else if (cadesSigned) { - currentSubordinatedValidator = new ASiCCMSDocumentValidator(signature, detachedContents); - } else if (timestamped) { - currentSubordinatedValidator = new ASiCTimestampDocumentValidator(signature, detachedContents); - } else { - throw new DSSException("The format of the signature is unknown! It is neither XAdES nor CAdES, nor timestamp signature!"); - } - - if (previousValidator != null) { - previousValidator.setNextValidator(currentSubordinatedValidator); - } else { - subordinatedValidator = currentSubordinatedValidator; - } - previousValidator = currentSubordinatedValidator; - } - if (subordinatedValidator == null) { - throw new DSSException("This is not an ASiC container. The signature cannot be found!"); - } - } - - private void analyseEntries() throws DSSException { - - ZipInputStream asicsInputStream = null; - try { - - MimeType asicEntryMimeType = null; - asicsInputStream = new ZipInputStream(asicContainer.openStream()); // The underlying stream is closed by the - // parent (asicsInputStream). - - for (ZipEntry entry = asicsInputStream.getNextEntry(); entry != null; entry = asicsInputStream.getNextEntry()) { - - String entryName = entry.getName(); - if (isCAdES(entryName)) { - - if (xadesSigned) { - throw new DSSNotETSICompliantException(DSSNotETSICompliantException.MSG.DIFFERENT_SIGNATURE_FORMATS); - } - addEntryElement(entryName, signatures, asicsInputStream); - cadesSigned = true; - } else if (isXAdES(entryName)) { - - if (cadesSigned) { - throw new DSSNotETSICompliantException(DSSNotETSICompliantException.MSG.DIFFERENT_SIGNATURE_FORMATS); - } - addEntryElement(entryName, signatures, asicsInputStream); - xadesSigned = true; - } else if (isTimestamp(entryName)) { - - addEntryElement(entryName, signatures, asicsInputStream); - timestamped = true; - } else if (isASiCManifest(entryName)) { - - addAsicManifestEntryElement(entryName, detachedContents, asicsInputStream); - } else if (isManifest(entryName)) { - - addEntryElement(entryName, detachedContents, asicsInputStream); - } else if (isContainer(entryName)) { - - addEntryElement(entryName, detachedContents, asicsInputStream); - } else if (isMetadata(entryName)) { - - addEntryElement(entryName, detachedContents, asicsInputStream); - } else if (isMimetype(entryName)) { - - final DSSDocument mimeType = addEntryElement(entryName, detachedContents, asicsInputStream); - asicEntryMimeType = getMimeType(mimeType); - } else if (entryName.indexOf("/") == -1) { - - addEntryElement(entryName, detachedContents, asicsInputStream); - } else if (entryName.endsWith("/")) { // Folder - continue; - } else { - - addEntryElement(entryName, detachedContents, asicsInputStream); - } - } - asicMimeType = determinateAsicMimeType(asicContainer.getMimeType(), asicEntryMimeType); - if (MimeType.ASICS == asicMimeType) { - - final ListIterator dssDocumentListIterator = detachedContents.listIterator(); - while (dssDocumentListIterator.hasNext()) { - - final DSSDocument dssDocument = dssDocumentListIterator.next(); - final String detachedContentName = dssDocument.getName(); - if ("mimetype".equals(detachedContentName)) { - dssDocumentListIterator.remove(); - } else if (detachedContentName.indexOf('/') != -1) { - dssDocumentListIterator.remove(); - } - } - } - } catch (Exception e) { - if (e instanceof DSSException) { - throw (DSSException) e; - } - throw new DSSException(e); - } finally { - IOUtils.closeQuietly(asicsInputStream); - } - } - - public MimeType getAsicMimeType() { - return asicMimeType; - } - - public void setAsicMimeType(final MimeType asicMimeType) { - this.asicMimeType = asicMimeType; - } - - private static MimeType getMimeType(final DSSDocument mimeType) throws DSSException { - - try { - final InputStream inputStream = mimeType.openStream(); - final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - IOUtils.copy(inputStream, byteArrayOutputStream); - final String mimeTypeString = StringUtils.trim(byteArrayOutputStream.toString("UTF-8")); - final MimeType asicMimeType = MimeType.fromMimeTypeString(mimeTypeString); - return asicMimeType; - } catch (IOException e) { - throw new DSSException(e); - } - } - - private static DSSDocument addEntryElement(final String entryName, final List list, final ZipInputStream asicsInputStream) throws IOException { - - final ByteArrayOutputStream signature = new ByteArrayOutputStream(); - IOUtils.copy(asicsInputStream, signature); - final InMemoryDocument inMemoryDocument = new InMemoryDocument(signature.toByteArray(), entryName); - list.add(inMemoryDocument); - return inMemoryDocument; - } - - private static void addAsicManifestEntryElement(final String entryName, final List list, final ZipInputStream asicsInputStream) - throws IOException { - - final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - IOUtils.copy(asicsInputStream, byteArrayOutputStream); - final AsicManifestDocument inMemoryDocument = new AsicManifestDocument(byteArrayOutputStream.toByteArray(), entryName); - list.add(inMemoryDocument); - } - - /** - * 6.2.2 Contents of Container - * 4) Other application specific information may be added in further files contained within the META-INF directory, - * such as: - * c) "META-INF/metadata.xml" has a user defined content. If present, its content shall be well formed XML - * conformant to OEBPS Container Format (OCF) [4] specifications. - * - * @param entryName - * @return - */ - private static boolean isMetadata(final String entryName) { - - final boolean manifest = entryName.equals(META_INF_FOLDER + "metadata.xml"); - return manifest; - } - - /** - * 6.2.2 Contents of Container - * 4) Other application specific information may be added in further files contained within the META-INF directory, - * such as: - * a) "META-INF/container.xml" if present shall be well formed XML conformant to OEBPS Container Format (OCF) [4] - * specifications. It shall identify the MIME type and full path - * of all the root data objects in the container, as specified in OCF. - * - * @param entryName - * @return - */ - private static boolean isContainer(final String entryName) { - - final boolean manifest = entryName.equals(META_INF_FOLDER + "container.xml"); - return manifest; - } - - /** - * 6.2.2 Contents of Container - * 4) Other application specific information may be added in further files contained within the META-INF directory, - * such as: - * b) "META-INF/manifest.xml" if present shall be well formed XML conformant to OASIS Open Document Format [6] - * specifications. - * NOTE 4: according to ODF [6] specifications, inclusion of reference to other META-INF information, such as - * *signatures*.xml, in manifest.xml is optional. In this way it is - * possible to protect the container's content signing manifest.xml while allowing to add later signatures. - * - * @param entryName - * @return - */ - private static boolean isManifest(final String entryName) { - - final boolean manifest = entryName.equals(META_INF_FOLDER + "manifest.xml"); - return manifest; - } - - public static boolean isASiCManifest(String entryName) { - - final boolean manifest = entryName.endsWith(".xml") && entryName.startsWith(META_INF_FOLDER + "ASiCManifest"); - return manifest; - } - - public static boolean isMimetype(String entryName) { - return MIME_TYPE.equalsIgnoreCase(entryName); - } - - public static boolean isTimestamp(String entryName) { - - final boolean timestamp = entryName.endsWith(".tst") && entryName.startsWith(META_INF_FOLDER) && entryName.contains("timestamp"); - return timestamp; - } - - public static boolean isXAdES(final String entryName) { - - final boolean signature = entryName.endsWith(".xml") && entryName.startsWith(META_INF_FOLDER) && entryName.contains("signature") - && !entryName.contains("Manifest"); - return signature; - } - - public static boolean isCAdES(final String entryName) { - - final boolean signature = entryName.endsWith(".p7s") && entryName.startsWith(META_INF_FOLDER) && entryName.contains("signature"); - return signature; - } - - private static MimeType getZipComment(final DSSDocument document) { - try { - byte[] buffer = IOUtils.toByteArray(document.openStream()); - - final int len = buffer.length; - final byte[] magicDirEnd = { 0x50, 0x4b, 0x05, 0x06 }; - final int buffLen = Math.min(buffer.length, len); - // Check the buffer from the end - for (int ii = buffLen - magicDirEnd.length - 22; ii >= 0; ii--) { - - boolean isMagicStart = true; - for (int jj = 0; jj < magicDirEnd.length; jj++) { - - if (buffer[ii + jj] != magicDirEnd[jj]) { - - isMagicStart = false; - break; - } - } - if (isMagicStart) { - - // Magic Start found! - int commentLen = buffer[ii + 20] + buffer[ii + 21] * 256; - int realLen = buffLen - ii - 22; - if (commentLen != realLen) { - LOG.warn("WARNING! ZIP comment size mismatch: directory says len is " + commentLen + ", but file ends after " + realLen + " bytes!"); - } - final String comment = new String(buffer, ii + 22, Math.min(commentLen, realLen)); - - final int indexOf = comment.indexOf(MIME_TYPE_COMMENT); - if (indexOf > -1) { - - final String asicCommentMimeTypeString = comment.substring(MIME_TYPE_COMMENT.length() + indexOf); - final MimeType mimeType = MimeType.fromMimeTypeString(asicCommentMimeTypeString); - return mimeType; - } - } - } - LOG.warn("ZIP comment NOT found!"); - return null; - - } catch (IOException e) { - throw new DSSException(e); - } - } - - /** - * Validates the document and all its signatures. The {@code validationPolicyDom} contains the constraint file. If - * null or empty the default file is used. - * - * @param validationPolicy - * {@code ValidationPolicy} - * @return - */ - @Override - public Reports validateDocument(final ValidationPolicy validationPolicy) { - - ensureCertificatePoolInitialized(); - - Reports lastReports = null; - Reports firstReport = null; - DocumentValidator currentSubordinatedValidator = subordinatedValidator; - do { - currentSubordinatedValidator.setCertificateVerifier(certificateVerifier); - currentSubordinatedValidator.setProcessExecutor(processExecutor); - if (MimeType.ASICE.equals(asicMimeType) && currentSubordinatedValidator instanceof ASiCCMSDocumentValidator) { - - final DSSDocument signature = currentSubordinatedValidator.getDocument(); - final AsicManifestDocument relatedAsicManifest = getRelatedAsicManifest(signature); - final ArrayList relatedAsicManifests = new ArrayList(); - relatedAsicManifests.add(relatedAsicManifest); - currentSubordinatedValidator.setDetachedContents(relatedAsicManifests); - } else { - currentSubordinatedValidator.setDetachedContents(detachedContents); - } - final Reports currentReports = currentSubordinatedValidator.validateDocument(validationPolicy); - if (lastReports == null) { - firstReport = currentReports; - } else { - lastReports.setNextReport(currentReports); - } - lastReports = currentReports; - currentSubordinatedValidator = currentSubordinatedValidator.getNextValidator(); - } while (currentSubordinatedValidator != null); - return firstReport; - } - - /** - * This is an experimental implementation for Aho's contribution. It is likely to be changed. - * - * @return {@code List} of {@code AdvancedSignature} within the container - */ - @Override - public List getSignatures() { - - if (signatures == null) { - return null; - } - if (validatedSignatures != null) { - return validatedSignatures; - } - - ensureCertificatePoolInitialized(); - - validatedSignatures = new ArrayList(); - DocumentValidator currentSubordinatedValidator = subordinatedValidator; - do { - currentSubordinatedValidator.setCertificateVerifier(certificateVerifier); - final List signatures = currentSubordinatedValidator.getSignatures(); - for (final AdvancedSignature signature : signatures) { - - validatedSignatures.add(signature); - } - currentSubordinatedValidator = currentSubordinatedValidator.getNextValidator(); - } while (currentSubordinatedValidator != null); - return validatedSignatures; - } - - @Override - public DSSDocument getOriginalDocument(final String signatureId) throws DSSException { - throw new DSSUnsupportedOperationException("This method is not applicable for this kind of signatures!"); - } -} diff --git a/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCTimestampDocumentValidator.java b/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCTimestampDocumentValidator.java deleted file mode 100644 index c5124f823e..0000000000 --- a/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCTimestampDocumentValidator.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.asic.validation; - -import java.io.IOException; -import java.util.List; - -import org.bouncycastle.tsp.TSPException; -import org.bouncycastle.tsp.TimeStampToken; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSException; -import eu.europa.esig.dss.cades.validation.CMSDocumentValidator; -import eu.europa.esig.dss.validation.DocumentValidator; - -/** - * Validator for ASiC timeStampToken - */ -public class ASiCTimestampDocumentValidator extends CMSDocumentValidator { - - private DocumentValidator nextValidator; - - /** - * This variable defines the sequence of the validator related to a document to validate. It's only used with ASiC-E container - */ - private TimeStampToken timeStampToken; - - /** - * In case of a detached signature this is the signed document. - */ - protected List timestampExternalContents; - - /** - * The default constructor for ASiCXMLDocumentValidator. - * - * @param timestamp {@code DSSDocument} representing the timestamp to validate - * @param detachedContents the {@code List} containing the potential signed documents - * @throws eu.europa.esig.dss.DSSException - */ - public ASiCTimestampDocumentValidator(final DSSDocument timestamp, final List detachedContents) throws DSSException { - - super(timestamp); - - try { - timeStampToken = new TimeStampToken(cmsSignedData); - } catch (TSPException e) { - throw new DSSException(e); - } catch (IOException e) { - throw new DSSException(e); - } - if (detachedContents == null || detachedContents.size() == 0) { - throw new NullPointerException("detachedContents"); - } - timestampExternalContents = detachedContents; - } - - @Override - public void setNextValidator(final DocumentValidator validator) { - - nextValidator = validator; - } - - @Override - public DocumentValidator getNextValidator() { - return nextValidator; - } -} diff --git a/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCXMLDocumentValidator.java b/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCXMLDocumentValidator.java deleted file mode 100644 index dade53c616..0000000000 --- a/dss-asic/src/main/java/eu/europa/esig/dss/asic/validation/ASiCXMLDocumentValidator.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.asic.validation; - -import java.util.List; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSException; -import eu.europa.esig.dss.validation.DocumentValidator; -import eu.europa.esig.dss.xades.validation.XMLDocumentValidator; - -/** - * Validator for ASiC signature - * - * - * - * - * - * - */ -public class ASiCXMLDocumentValidator extends XMLDocumentValidator { - - /** - * This variable defines the sequence of the validator related to a document to validate. It's only used with ASiC-E container - */ - private DocumentValidator nextValidator; - - /** - * The default constructor for ASiCXMLDocumentValidator. - * - * @param signature {@code DSSDocument} representing the signature to validate - * @param detachedContents the {@code List} containing the potential signed documents - * @throws DSSException - */ - public ASiCXMLDocumentValidator(final DSSDocument signature, final List detachedContents) throws DSSException { - - super(signature); - this.detachedContents = detachedContents; - } - - @Override - public void setNextValidator(final DocumentValidator validator) { - - nextValidator = validator; - } - - @Override - public DocumentValidator getNextValidator() { - return nextValidator; - } -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeSignAndExtendTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeSignAndExtendTest.java deleted file mode 100644 index d3d8f8d08b..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/extension/asice/ASiCeSignAndExtendTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package eu.europa.esig.dss.asic.extension.asice; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.test.mock.MockTSPSource; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; - -public class ASiCeSignAndExtendTest { - - @Test - public void sign() throws Exception { - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry entry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCService service = new ASiCService(new CommonCertificateVerifier()); - - DSSDocument toSignDocument = new InMemoryDocument("HELLO".getBytes(), "hello.bin"); - ASiCSignatureParameters parameters = new ASiCSignatureParameters(); - parameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - parameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - parameters.setSigningCertificate(entry.getCertificate()); - - ToBeSigned dataToSign = service.getDataToSign(toSignDocument, parameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, entry, dataToSign); - DSSDocument signDocument = service.signDocument(toSignDocument, parameters, signatureValue); - - signDocument.save("target/asic-e-cades-b.asice"); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - Reports reports = validator.validateDocument(); - assertNotNull(reports); - - // reports.print(); - extend(signDocument); - } - - public void extend(DSSDocument docToExtend) throws Exception { - // DSSDocument docToExtend = new FileDocument(new File("target/asic-e-cades-b.asice")); - - ASiCService service = new ASiCService(new CommonCertificateVerifier()); - CertificateService certificateService = new CertificateService(); - service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); - - ASiCSignatureParameters parameters = new ASiCSignatureParameters(); - parameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_LT); - parameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - DSSDocument extendDocument = service.extendDocument(docToExtend, parameters); - extendDocument.save("target/extend-asic-e.asice"); - - } -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCadesToASiCELevelBCadesTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCadesToASiCELevelBCadesTest.java deleted file mode 100644 index b0d93afb96..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBCadesToASiCELevelBCadesTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package eu.europa.esig.dss.asic.signature.asice; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Assert; -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.policy.rules.Indication; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCELevelBCadesToASiCELevelBCadesTest { - - @Test - public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); - - ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue); - - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.setDetachedContent(documentToSign); - signatureParameters.setDigestAlgorithm(DigestAlgorithm.SHA256); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - - certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - - dataToSign = service.getDataToSign(signedDocument, signatureParameters); - signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - - Reports reports = validator.validateDocument(); - - // reports.print(); - - while (reports != null) { - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - Assert.assertNotEquals(Indication.FAILED, reports.getSimpleReport().getIndication(diagnosticData.getFirstSignatureId())); - reports = reports.getNextReports(); - } - } -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBXadesToASiCELevelBXadesTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBXadesToASiCELevelBXadesTest.java deleted file mode 100644 index 77f0cb0a8b..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelBXadesToASiCELevelBXadesTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.europa.esig.dss.asic.signature.asice; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCELevelBXadesToASiCELevelBXadesTest { - - @Test - public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); - - ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue); - - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - - certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - - dataToSign = service.getDataToSign(signedDocument, signatureParameters); - signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - - Reports reports = validator.validateDocument(); - - // reports.print(); - DiagnosticData diagnosticData = reports.getDiagnosticData(); - - for (String id : diagnosticData.getSignatureIdList()) { - assertTrue(diagnosticData.isBLevelTechnicallyValid(id)); - } - } -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelLTATest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelLTATest.java deleted file mode 100644 index fc5db4307e..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asice/ASiCELevelLTATest.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.asic.signature.asice; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Before; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.MimeType; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; -import eu.europa.esig.dss.signature.DocumentSignatureService; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.test.mock.MockTSPSource; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCELevelLTATest extends AbstractTestSignature { - - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; - private DSSDocument documentToSign; - private MockPrivateKeyEntry privateKeyEntry; - - @Before - public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_LTA); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_LTA.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); - } - - @Override - protected DocumentSignatureService getService() { - return service; - } - - @Override - protected ASiCSignatureParameters getSignatureParameters() { - return signatureParameters; - } - - @Override - protected MimeType getExpectedMime() { - return MimeType.ASICE; - } - - @Override - protected boolean isBaselineT() { - return true; - } - - @Override - protected boolean isBaselineLTA() { - return true; - } - - @Override - protected DSSDocument getDocumentToSign() { - return documentToSign; - } - - @Override - protected MockPrivateKeyEntry getPrivateKeyEntry() { - return privateKeyEntry; - } - -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBXadesToASiCSLevelBXadesTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBXadesToASiCSLevelBXadesTest.java deleted file mode 100644 index 1e871a8c5d..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBXadesToASiCSLevelBXadesTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.europa.esig.dss.asic.signature.asics; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCSLevelBXadesToASiCSLevelBXadesTest { - - @Test - public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); - - ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue); - - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - - certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - - dataToSign = service.getDataToSign(signedDocument, signatureParameters); - signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - - Reports reports = validator.validateDocument(); - - // reports.print(); - DiagnosticData diagnosticData = reports.getDiagnosticData(); - - for (String id : diagnosticData.getSignatureIdList()) { - assertTrue(diagnosticData.isBLevelTechnicallyValid(id)); - } - } -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelLTATest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelLTATest.java deleted file mode 100644 index 23cc645f3d..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelLTATest.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.asic.signature.asics; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Before; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.MimeType; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; -import eu.europa.esig.dss.signature.DocumentSignatureService; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.test.mock.MockTSPSource; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCSLevelLTATest extends AbstractTestSignature { - - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; - private DSSDocument documentToSign; - private MockPrivateKeyEntry privateKeyEntry; - - @Before - public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_LTA); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_LTA.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); - } - - @Override - protected DocumentSignatureService getService() { - return service; - } - - @Override - protected ASiCSignatureParameters getSignatureParameters() { - return signatureParameters; - } - - @Override - protected MimeType getExpectedMime() { - return MimeType.ASICS; - } - - @Override - protected boolean isBaselineT() { - return true; - } - - @Override - protected boolean isBaselineLTA() { - return true; - } - - @Override - protected DSSDocument getDocumentToSign() { - return documentToSign; - } - - @Override - protected MockPrivateKeyEntry getPrivateKeyEntry() { - return privateKeyEntry; - } - -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelTSHA384Test.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelTSHA384Test.java deleted file mode 100644 index 3973f9b2e1..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelTSHA384Test.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.asic.signature.asics; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Before; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.MimeType; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.signature.AbstractTestSignature; -import eu.europa.esig.dss.signature.DocumentSignatureService; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.test.mock.MockTSPSource; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCSLevelTSHA384Test extends AbstractTestSignature { - - private DocumentSignatureService service; - private ASiCSignatureParameters signatureParameters; - private DSSDocument documentToSign; - private MockPrivateKeyEntry privateKeyEntry; - - @Before - public void init() throws Exception { - documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA384); - - signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setDigestAlgorithm(DigestAlgorithm.SHA384); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_T); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - service.setTspSource(new MockTSPSource(certificateService.generateTspCertificate(SignatureAlgorithm.RSA_SHA1))); - } - - @Override - protected void checkSignatureLevel(DiagnosticData diagnosticData) { - assertEquals(SignatureLevel.XAdES_BASELINE_T.name(), diagnosticData.getSignatureFormat(diagnosticData.getFirstSignatureId())); - } - - @Override - protected DocumentSignatureService getService() { - return service; - } - - @Override - protected ASiCSignatureParameters getSignatureParameters() { - return signatureParameters; - } - - @Override - protected MimeType getExpectedMime() { - return MimeType.ASICS; - } - - @Override - protected boolean isBaselineT() { - return true; - } - - @Override - protected boolean isBaselineLTA() { - return false; - } - - @Override - protected DSSDocument getDocumentToSign() { - return documentToSign; - } - - @Override - protected MockPrivateKeyEntry getPrivateKeyEntry() { - return privateKeyEntry; - } - -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCECmsToASiCEXmlTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCECmsToASiCEXmlTest.java deleted file mode 100644 index a9d5827c5c..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCECmsToASiCEXmlTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.europa.esig.dss.asic.signature.invalid; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSUnsupportedOperationException; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCECmsToASiCEXmlTest { - - @Test(expected = DSSUnsupportedOperationException.class) - public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); - - ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue); - - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - - certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - - dataToSign = service.getDataToSign(signedDocument, signatureParameters); - signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - - Reports reports = validator.validateDocument(); - - // reports.print(); - - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - - } -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCEXmlToASiCECmsTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCEXmlToASiCECmsTest.java deleted file mode 100644 index 2fc6c02227..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCEXmlToASiCECmsTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.europa.esig.dss.asic.signature.invalid; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSUnsupportedOperationException; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCEXmlToASiCECmsTest { - - @Test(expected = DSSUnsupportedOperationException.class) - public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); - - ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue); - - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - - certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - - dataToSign = service.getDataToSign(signedDocument, signatureParameters); - signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - - Reports reports = validator.validateDocument(); - - // reports.print(); - - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - - } -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCEtoASiCSTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCEtoASiCSTest.java deleted file mode 100644 index 5bd1ca6752..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCEtoASiCSTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package eu.europa.esig.dss.asic.signature.invalid; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSUnsupportedOperationException; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCEtoASiCSTest { - - @Test(expected = DSSUnsupportedOperationException.class) - public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); - - ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue); - - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - - certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - - dataToSign = service.getDataToSign(signedDocument, signatureParameters); - signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - - Reports reports = validator.validateDocument(); - - // reports.print(); - - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - - } - -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCSCmsToASiCSXmlTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCSCmsToASiCSXmlTest.java deleted file mode 100644 index 2870541e25..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCSCmsToASiCSXmlTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.europa.esig.dss.asic.signature.invalid; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSUnsupportedOperationException; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCSCmsToASiCSXmlTest { - - @Test(expected = DSSUnsupportedOperationException.class) - public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); - - ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue); - - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - - certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - - dataToSign = service.getDataToSign(signedDocument, signatureParameters); - signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - - Reports reports = validator.validateDocument(); - - // reports.print(); - - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - - } -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCSXmlToASiCSCmsTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCSXmlToASiCSCmsTest.java deleted file mode 100644 index 5822922a73..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCSXmlToASiCSCmsTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.europa.esig.dss.asic.signature.invalid; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSUnsupportedOperationException; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCSXmlToASiCSCmsTest { - - @Test(expected = DSSUnsupportedOperationException.class) - public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); - - ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue); - - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - - certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - - dataToSign = service.getDataToSign(signedDocument, signatureParameters); - signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - - Reports reports = validator.validateDocument(); - - // reports.print(); - - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - - } -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCStoASiCETest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCStoASiCETest.java deleted file mode 100644 index 9aa1e2b519..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/invalid/ASiCStoASiCETest.java +++ /dev/null @@ -1,77 +0,0 @@ -package eu.europa.esig.dss.asic.signature.invalid; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSUnsupportedOperationException; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.test.TestUtils; -import eu.europa.esig.dss.test.gen.CertificateService; -import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; - -public class ASiCStoASiCETest { - - @Test(expected = DSSUnsupportedOperationException.class) - public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); - - CertificateService certificateService = new CertificateService(); - MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - - CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); - - ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); - SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument signedDocument = service.signDocument(documentToSign, signatureParameters, signatureValue); - - privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - signatureParameters.bLevel().setSigningDate(new Date()); - signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); - signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - - certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); - - dataToSign = service.getDataToSign(signedDocument, signatureParameters); - signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); - DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - - Reports reports = validator.validateDocument(); - - // reports.print(); - - DiagnosticData diagnosticData = reports.getDiagnosticData(); - assertTrue(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); - - } - -} diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWith2SignaturesTest.java b/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWith2SignaturesTest.java deleted file mode 100644 index cacd2333df..0000000000 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/validation/ASiCEWith2SignaturesTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package eu.europa.esig.dss.asic.validation; - -import org.junit.Assert; -import org.junit.Test; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.FileDocument; -import eu.europa.esig.dss.validation.CommonCertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.reports.Reports; - -public class ASiCEWith2SignaturesTest { - - @Test - public void test() { - DSSDocument asicContainer = new FileDocument("src/test/resources/ASiCEWith2Signatures.bdoc"); - - SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(asicContainer); - validator.setCertificateVerifier(new CommonCertificateVerifier()); - Reports reports = validator.validateDocument(); - Assert.assertNotNull(reports); - // reports.print(); - reports = reports.getNextReports(); - Assert.assertNotNull(reports); - // reports.print(); - } -} diff --git a/dss-asic/src/test/java/known/issues/DSS631/ASiCeExtensionWithCAdESBToLTATest.java b/dss-asic/src/test/java/known/issues/DSS631/ASiCeExtensionWithCAdESBToLTATest.java deleted file mode 100644 index ea32c49b55..0000000000 --- a/dss-asic/src/test/java/known/issues/DSS631/ASiCeExtensionWithCAdESBToLTATest.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package known.issues.DSS631; - -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithCAdESExtension; - -public class ASiCeExtensionWithCAdESBToLTATest extends AbstractTestASiCwithCAdESExtension { - - @Override - protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_B; - } - - @Override - protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_LTA; - } - - @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_LTA; - } -} diff --git a/dss-asic/src/test/java/known/issues/DSS631/ASiCeExtensionWithCAdESBToLTTest.java b/dss-asic/src/test/java/known/issues/DSS631/ASiCeExtensionWithCAdESBToLTTest.java deleted file mode 100644 index cb645f5fd7..0000000000 --- a/dss-asic/src/test/java/known/issues/DSS631/ASiCeExtensionWithCAdESBToLTTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package known.issues.DSS631; - -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithCAdESExtension; - -public class ASiCeExtensionWithCAdESBToLTTest extends AbstractTestASiCwithCAdESExtension { - - @Override - protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_B; - } - - @Override - protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_E_BASELINE_LT; - } - - @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_LT; - } -} diff --git a/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESBToLTATest.java b/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESBToLTATest.java deleted file mode 100644 index 70665d80dd..0000000000 --- a/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESBToLTATest.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package known.issues.DSS631; - -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithCAdESExtension; - -public class ASiCsExtensionWithCAdESBToLTATest extends AbstractTestASiCwithCAdESExtension { - - @Override - protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_B; - } - - @Override - protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LTA; - } - - @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_LTA; - } -} diff --git a/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESBToLTTest.java b/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESBToLTTest.java deleted file mode 100644 index d6b5f24b32..0000000000 --- a/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESBToLTTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package known.issues.DSS631; - -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithCAdESExtension; - -public class ASiCsExtensionWithCAdESBToLTTest extends AbstractTestASiCwithCAdESExtension { - - @Override - protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_B; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_B; - } - - @Override - protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LT; - } - - @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_LT; - } -} diff --git a/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESLTToLTATest.java b/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESLTToLTATest.java deleted file mode 100644 index 8150740076..0000000000 --- a/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESLTToLTATest.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package known.issues.DSS631; - -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithCAdESExtension; - -public class ASiCsExtensionWithCAdESLTToLTATest extends AbstractTestASiCwithCAdESExtension { - - @Override - protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LT; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_LT; - } - - @Override - protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LTA; - } - - @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_LTA; - } -} diff --git a/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESTToLTTest.java b/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESTToLTTest.java deleted file mode 100644 index ce6849e939..0000000000 --- a/dss-asic/src/test/java/known/issues/DSS631/ASiCsExtensionWithCAdESTToLTTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package known.issues.DSS631; - -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.asic.extension.AbstractTestASiCwithCAdESExtension; - -public class ASiCsExtensionWithCAdESTToLTTest extends AbstractTestASiCwithCAdESExtension { - - @Override - protected SignatureLevel getOriginalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_T; - } - - @Override - protected SignatureLevel getOriginalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_T; - } - - @Override - protected SignatureLevel getFinalSignatureLevel() { - return SignatureLevel.ASiC_S_BASELINE_LT; - } - - @Override - protected SignatureLevel getFinalUnderlyingSignatureLevel() { - return SignatureLevel.CAdES_BASELINE_LT; - } -} diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-13.asice b/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-13.asice deleted file mode 100644 index fd3cdfd464..0000000000 Binary files a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-13.asice and /dev/null differ diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-14.asice b/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-14.asice deleted file mode 100644 index 6d32d165b4..0000000000 Binary files a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-14.asice and /dev/null differ diff --git a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-15.asics b/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-15.asics deleted file mode 100644 index 5bed4e82ef..0000000000 Binary files a/dss-asic/src/test/resources/plugtest/esig2014/ESIG-ASiC/SK_DIT/Signature-A-SK_DIT-15.asics and /dev/null differ diff --git a/dss-cades/pom.xml b/dss-cades/pom.xml index 9888196909..73859a8a23 100644 --- a/dss-cades/pom.xml +++ b/dss-cades/pom.xml @@ -1,94 +1,40 @@ - + 4.0.0 org.digidoc4j.dss sd-dss - 4.7.RC2.d4j.1 + 5.0.d4j.1 dss-cades DSS CAdES DSS CAdES contains the code for the creation and validation of CAdES signatures. - - https://github.com/open-eid/sd-dss - - - GNU Lesser General Public License, Version 2.1 - http://www.gnu.org/licenses/lgpl-2.1.html - - - - - naramski - David Naramski - - developer - - - - vandenbroucke - Pierrick Vandenbroucke - - developer - - - - pirard - Nicolas Pirard - - developer - - - - abinet - Axel Abinet - - developer - - - - - scm:git:git@github.com:open-eid/sd-dss.git - scm:git:git@github.com:open-eid/sd-dss.git - https://github.com/open-eid/sd-dss.git - - org.digidoc4j.dss + ${project.groupId} dss-document - junit - junit - test - - - org.digidoc4j.dss + ${project.groupId} dss-test test - org.digidoc4j.dss + ${project.groupId} dss-service test - org.digidoc4j.dss + ${project.groupId} dss-document test-jar test - - ch.qos.logback - logback-classic - test - \ No newline at end of file diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/CAdESSignatureParameters.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/CAdESSignatureParameters.java index 4ad2e43beb..8f347732df 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/CAdESSignatureParameters.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/CAdESSignatureParameters.java @@ -33,7 +33,8 @@ public void setContentHintsDescription(String contentHintsDescription) { * * 5.10.2 content-identifier Attribute * The content-identifier attribute provides an identifier for the signed content, for use when a reference may be - * later required to that content; for example, in the content-reference attribute in other signed data sent later. The + * later required to that content; for example, in the content-reference attribute in other signed data sent later. + * The * content-identifier shall be a signed attribute. * content-identifier attribute type values for the ES have an ASN.1 type ContentIdentifier, as defined in * ESS (RFC 2634 [5]). @@ -61,7 +62,8 @@ public void setContentIdentifierSuffix(String contentIdentifierSuffix) { * * 5.10.2 content-identifier Attribute * The content-identifier attribute provides an identifier for the signed content, for use when a reference may be - * later required to that content; for example, in the content-reference attribute in other signed data sent later. The + * later required to that content; for example, in the content-reference attribute in other signed data sent later. + * The * content-identifier shall be a signed attribute. * content-identifier attribute type values for the ES have an ASN.1 type ContentIdentifier, as defined in * ESS (RFC 2634 [5]). diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineB.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineB.java index 2faf979c93..9af1a843e6 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineB.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineB.java @@ -37,9 +37,6 @@ import java.util.List; import java.util.Random; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang.StringUtils; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1GeneralizedTime; @@ -75,15 +72,16 @@ import eu.europa.esig.dss.BLevelParameters; import eu.europa.esig.dss.DSSASN1Utils; import eu.europa.esig.dss.DSSException; -import eu.europa.esig.dss.DSSUtils; import eu.europa.esig.dss.DigestAlgorithm; import eu.europa.esig.dss.Policy; import eu.europa.esig.dss.cades.CAdESSignatureParameters; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.TimestampToken; +import eu.europa.esig.dss.x509.CertificateToken; /** - * This class holds the CAdES-B signature profile; it supports the inclusion of the mandatory signed - * id_aa_ets_sigPolicyId attribute as specified in ETSI TS 101 733 V1.8.1, clause 5.8.1. + * This class holds the CAdES-B signature profile; it supports the inclusion of the mandatory signed id_aa_ets_sigPolicyId attribute as specified in ETSI TS 101 + * 733 V1.8.1, clause 5.8.1. * * * @@ -255,7 +253,7 @@ private void addCommitmentType(final CAdESSignatureParameters parameters, final final BLevelParameters bLevelParameters = parameters.bLevel(); final List commitmentTypeIndications = bLevelParameters.getCommitmentTypeIndications(); - if (CollectionUtils.isNotEmpty(commitmentTypeIndications)) { + if (Utils.isCollectionNotEmpty(commitmentTypeIndications)) { final int size = commitmentTypeIndications.size(); ASN1Encodable[] asn1Encodables = new ASN1Encodable[size]; @@ -345,11 +343,11 @@ private void addContentTimestamps(final CAdESSignatureParameters parameters, fin * @return */ private void addContentHints(final CAdESSignatureParameters parameters, final ASN1EncodableVector signedAttributes) { - if (StringUtils.isNotBlank(parameters.getContentHintsType())) { + if (Utils.isStringNotBlank(parameters.getContentHintsType())) { final ASN1ObjectIdentifier contentHintsType = new ASN1ObjectIdentifier(parameters.getContentHintsType()); final String contentHintsDescriptionString = parameters.getContentHintsDescription(); - final DERUTF8String contentHintsDescription = StringUtils.isBlank(contentHintsDescriptionString) ? null + final DERUTF8String contentHintsDescription = Utils.isStringBlank(contentHintsDescriptionString) ? null : new DERUTF8String(contentHintsDescriptionString); // "text/plain"; // "1.2.840.113549.1.7.1"; @@ -386,10 +384,10 @@ private void addContentIdentifier(final CAdESSignatureParameters parameters, fin final BLevelParameters bLevelParameters = parameters.bLevel(); final String contentIdentifierPrefix = parameters.getContentIdentifierPrefix(); - if (StringUtils.isNotBlank(contentIdentifierPrefix)) { + if (Utils.isStringNotBlank(contentIdentifierPrefix)) { final String contentIdentifierSuffix; - if (StringUtils.isBlank(parameters.getContentIdentifierSuffix())) { + if (Utils.isStringBlank(parameters.getContentIdentifierSuffix())) { final Date now = new Date(); final String asn1GeneralizedTimeString = new ASN1GeneralizedTime(now).getTimeString(); @@ -416,7 +414,7 @@ private void addSignaturePolicyId(final CAdESSignatureParameters parameters, fin final String policyId = policy.getId(); SignaturePolicyIdentifier sigPolicy = null; - if (StringUtils.isEmpty(policyId)) {// implicit + if (Utils.isStringEmpty(policyId)) {// implicit sigPolicy = new SignaturePolicyIdentifier(); } else { // explicit final ASN1ObjectIdentifier derOIPolicyId = new ASN1ObjectIdentifier(policyId); @@ -424,7 +422,7 @@ private void addSignaturePolicyId(final CAdESSignatureParameters parameters, fin final AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(oid); OtherHashAlgAndValue otherHashAlgAndValue = new OtherHashAlgAndValue(algorithmIdentifier, new DEROctetString(policy.getDigestValue())); - if (StringUtils.isNotEmpty(policy.getSpuri())) { + if (Utils.isStringNotEmpty(policy.getSpuri())) { SigPolicyQualifierInfo policyQualifierInfo = new SigPolicyQualifierInfo(PKCSObjectIdentifiers.id_spq_ets_uri, new DERUTF8String(policy.getSpuri())); SigPolicyQualifierInfo[] qualifierInfos = new SigPolicyQualifierInfo[] { policyQualifierInfo }; @@ -444,10 +442,10 @@ private void addSignaturePolicyId(final CAdESSignatureParameters parameters, fin private void addSigningCertificateAttribute(final CAdESSignatureParameters parameters, final ASN1EncodableVector signedAttributes) throws DSSException { final DigestAlgorithm digestAlgorithm = parameters.getDigestAlgorithm(); - final byte[] encoded = parameters.getSigningCertificate().getEncoded(); - final byte[] certHash = DSSUtils.digest(digestAlgorithm, encoded); + CertificateToken signingToken = parameters.getSigningCertificate(); + final byte[] certHash = signingToken.getDigest(digestAlgorithm); if (LOG.isDebugEnabled()) { - LOG.debug("Adding Certificate Hash {} with algorithm {}", Hex.encodeHexString(certHash), digestAlgorithm.getName()); + LOG.debug("Adding Certificate Hash {} with algorithm {}", Utils.toHex(certHash), digestAlgorithm.getName()); } final IssuerSerial issuerSerial = DSSASN1Utils.getIssuerSerial(parameters.getSigningCertificate()); diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineLT.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineLT.java index 7358b11da5..6cff03e12a 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineLT.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineLT.java @@ -75,11 +75,12 @@ public CAdESLevelBaselineLT(TSPSource signatureTsa, CertificateVerifier certific } @Override - protected SignerInformation extendCMSSignature(CMSSignedData cmsSignedData, SignerInformation signerInformation, CAdESSignatureParameters parameters) throws DSSException { + protected SignerInformation extendCMSSignature(CMSSignedData cmsSignedData, SignerInformation signerInformation, CAdESSignatureParameters parameters) + throws DSSException { // add a LT level or replace an existing LT level CAdESSignature cadesSignature = new CAdESSignature(cmsSignedData, signerInformation); - cadesSignature.setDetachedContents(parameters.getDetachedContent()); + cadesSignature.setDetachedContents(parameters.getDetachedContents()); if (!cadesSignature.isDataForSignatureLevelPresent(SignatureLevel.CAdES_BASELINE_T)) { signerInformation = cadesProfileT.extendCMSSignature(cmsSignedData, signerInformation, parameters); } @@ -90,7 +91,7 @@ protected SignerInformation extendCMSSignature(CMSSignedData cmsSignedData, Sign @Override protected CMSSignedData postExtendCMSSignedData(CMSSignedData cmsSignedData, SignerInformation signerInformation, CAdESSignatureParameters parameters) { CAdESSignature cadesSignature = new CAdESSignature(cmsSignedData, signerInformation); - cadesSignature.setDetachedContents(parameters.getDetachedContent()); + cadesSignature.setDetachedContents(parameters.getDetachedContents()); final ValidationContext validationContext = cadesSignature.getSignatureValidationContext(certificateVerifier); Store certificatesStore = cmsSignedData.getCertificates(); @@ -115,7 +116,9 @@ protected CMSSignedData postExtendCMSSignedData(CMSSignedData cmsSignedData, Sig final Collection newOtherRevocationInfoFormatStore = new HashSet(otherRevocationInfoFormatStoreBasic.getMatches(null)); for (final OCSPToken ocspToken : revocationDataForInclusion.ocspTokens) { final BasicOCSPResp basicOCSPResp = ocspToken.getBasicOCSPResp(); - newOtherRevocationInfoFormatStore.add(DSSASN1Utils.toASN1Primitive(DSSASN1Utils.getEncoded(basicOCSPResp))); + if (basicOCSPResp != null) { + newOtherRevocationInfoFormatStore.add(DSSASN1Utils.toASN1Primitive(DSSASN1Utils.getEncoded(basicOCSPResp))); + } } otherRevocationInfoFormatStoreBasic = new CollectionStore(newOtherRevocationInfoFormatStore); @@ -123,9 +126,8 @@ protected CMSSignedData postExtendCMSSignedData(CMSSignedData cmsSignedData, Sig Store otherRevocationInfoFormatStoreOcsp = cmsSignedData.getOtherRevocationInfo(CMSObjectIdentifiers.id_ri_ocsp_response); final CMSSignedDataBuilder cmsSignedDataBuilder = new CMSSignedDataBuilder(certificateVerifier); - cmsSignedData = cmsSignedDataBuilder - .regenerateCMSSignedData(cmsSignedData, parameters, certificatesStore, attributeCertificatesStore, crlsStore, otherRevocationInfoFormatStoreBasic, - otherRevocationInfoFormatStoreOcsp); + cmsSignedData = cmsSignedDataBuilder.regenerateCMSSignedData(cmsSignedData, parameters, certificatesStore, attributeCertificatesStore, crlsStore, + otherRevocationInfoFormatStoreBasic, otherRevocationInfoFormatStoreOcsp); return cmsSignedData; } diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineLTA.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineLTA.java index c206aeccc0..9bd67fdbb7 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineLTA.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineLTA.java @@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; +import java.util.List; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.cms.Attribute; @@ -76,7 +77,7 @@ protected SignerInformation extendCMSSignature(final CMSSignedData cmsSignedData final CAdESSignatureParameters parameters) throws DSSException { CAdESSignature cadesSignature = new CAdESSignature(cmsSignedData, signerInformation); - cadesSignature.setDetachedContents(parameters.getDetachedContent()); + cadesSignature.setDetachedContents(parameters.getDetachedContents()); AttributeTable unsignedAttributes = CMSUtils.getUnsignedAttributes(signerInformation); unsignedAttributes = addArchiveTimestampV3Attribute(cadesSignature, cmsSignedData, signerInformation, parameters, unsignedAttributes); SignerInformation newSignerInformation = SignerInformation.replaceUnsignedAttributes(signerInformation, unsignedAttributes); @@ -85,7 +86,8 @@ protected SignerInformation extendCMSSignature(final CMSSignedData cmsSignedData /** * The input for the archive-time-stamp-v3’s message imprint computation shall be the concatenation (in the - * order shown by the list below) of the signed data hash (see bullet 2 below) and certain fields in their binary encoded + * order shown by the list below) of the signed data hash (see bullet 2 below) and certain fields in their binary + * encoded * form without any modification and including the tag, length and value octets: *
    *
  1. The SignedData.encapContentInfo.eContentType. @@ -116,16 +118,19 @@ private AttributeTable addArchiveTimestampV3Attribute(CAdESSignature cadesSignat final InputStream originalDocumentBytes = getOriginalDocumentBytes(cmsSignedData, parameters); - final byte[] encodedToTimestamp = timestampExtractor.getArchiveTimestampDataV3(signerInformation, atsHashIndexAttribute, originalDocumentBytes, timestampDigestAlgorithm); + final byte[] encodedToTimestamp = timestampExtractor.getArchiveTimestampDataV3(signerInformation, atsHashIndexAttribute, originalDocumentBytes, + timestampDigestAlgorithm); - final ASN1Object timeStampAttributeValue = getTimeStampAttributeValue(signatureTsa, encodedToTimestamp, timestampDigestAlgorithm, atsHashIndexAttribute); + final ASN1Object timeStampAttributeValue = getTimeStampAttributeValue(signatureTsa, encodedToTimestamp, timestampDigestAlgorithm, + atsHashIndexAttribute); final AttributeTable newUnsignedAttributes = unsignedAttributes.add(OID.id_aa_ets_archiveTimestampV3, timeStampAttributeValue); return newUnsignedAttributes; } /** - * Returns the original document which is signed, either from cmsSignedData if possible, or from {@code parameters.getDetachedContent()} + * Returns the original document which is signed, either from cmsSignedData if possible, or from + * {@code parameters.getDetachedContent()} * * @param cmsSignedData * @param parameters @@ -138,10 +143,10 @@ private InputStream getOriginalDocumentBytes(CMSSignedData cmsSignedData, CAdESS if (signedContent != null) { return new ByteArrayInputStream(CMSUtils.getSignedContent(signedContent)); } - final DSSDocument detachedContent = parameters.getDetachedContent(); - if (detachedContent == null) { + final List detachedContents = parameters.getDetachedContents(); + if (detachedContents == null) { throw new DSSException("In the case of detached signature the detached content must be set!"); } - return detachedContent.openStream(); + return detachedContents.get(0).openStream(); // TODO improve } } diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineT.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineT.java index a8ac536b50..26993dfa06 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineT.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESLevelBaselineT.java @@ -47,9 +47,10 @@ public CAdESLevelBaselineT(TSPSource signatureTsa, boolean onlyLastCMSSignature) } @Override - protected SignerInformation extendCMSSignature(CMSSignedData signedData, SignerInformation signerInformation, CAdESSignatureParameters parameters) throws DSSException { + protected SignerInformation extendCMSSignature(CMSSignedData signedData, SignerInformation signerInformation, CAdESSignatureParameters parameters) + throws DSSException { final CAdESSignature cadesSignature = new CAdESSignature(signedData, signerInformation); - cadesSignature.setDetachedContents(parameters.getDetachedContent()); + cadesSignature.setDetachedContents(parameters.getDetachedContents()); assertExtendSignaturePossible(cadesSignature); AttributeTable unsignedAttributes = CMSUtils.getUnsignedAttributes(signerInformation); @@ -72,10 +73,10 @@ protected void assertExtendSignaturePossible(CAdESSignature cadesSignature) thro } } - private AttributeTable addSignatureTimestampAttribute(SignerInformation signerInformation, AttributeTable unsignedAttributes, CAdESSignatureParameters parameters) { + private AttributeTable addSignatureTimestampAttribute(SignerInformation signerInformation, AttributeTable unsignedAttributes, + CAdESSignatureParameters parameters) { ASN1Object signatureTimeStamp = getTimeStampAttributeValue(signatureTsa, signerInformation.getSignature(), parameters); return unsignedAttributes.add(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, signatureTimeStamp); } - } diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESService.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESService.java index b79c5b0833..5c0af95aab 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESService.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESService.java @@ -20,6 +20,9 @@ */ package eu.europa.esig.dss.cades.signature; +import java.util.Arrays; +import java.util.List; + import org.bouncycastle.cms.CMSProcessableByteArray; import org.bouncycastle.cms.CMSSignedData; import org.bouncycastle.cms.CMSSignedDataGenerator; @@ -42,6 +45,7 @@ import eu.europa.esig.dss.cades.CMSUtils; import eu.europa.esig.dss.signature.AbstractSignatureService; import eu.europa.esig.dss.signature.SignatureExtension; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CertificateVerifier; /** @@ -54,10 +58,12 @@ public class CAdESService extends AbstractSignatureService detachedContents = parameters.getDetachedContents(); + if (Utils.isCollectionNotEmpty(detachedContents)) { + // CAdES only can sign one document + // (ASiC-S -> the document to sign / + // ASiC-E -> ASiCManifest) + return detachedContents.get(0); } else { if (originalCmsSignedData == null) { return toSignDocument; @@ -184,14 +193,14 @@ private DSSDocument getSignedContent(final CMSSignedData cmsSignedData) { private SignatureExtension getExtensionProfile(final CAdESSignatureParameters parameters, final boolean onlyLastCMSSignature) { final SignatureLevel signatureLevel = parameters.getSignatureLevel(); switch (signatureLevel) { - case CAdES_BASELINE_T: - return new CAdESLevelBaselineT(tspSource, onlyLastCMSSignature); - case CAdES_BASELINE_LT: - return new CAdESLevelBaselineLT(tspSource, certificateVerifier, onlyLastCMSSignature); - case CAdES_BASELINE_LTA: - return new CAdESLevelBaselineLTA(tspSource, certificateVerifier, onlyLastCMSSignature); - default: - throw new DSSException("Unsupported signature format " + signatureLevel); + case CAdES_BASELINE_T: + return new CAdESLevelBaselineT(tspSource, onlyLastCMSSignature); + case CAdES_BASELINE_LT: + return new CAdESLevelBaselineLT(tspSource, certificateVerifier, onlyLastCMSSignature); + case CAdES_BASELINE_LTA: + return new CAdESLevelBaselineLTA(tspSource, certificateVerifier, onlyLastCMSSignature); + default: + throw new DSSException("Unsupported signature format " + signatureLevel); } } diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESSignatureExtension.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESSignatureExtension.java index 21b9566a64..b51371124e 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESSignatureExtension.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CAdESSignatureExtension.java @@ -26,8 +26,6 @@ import java.util.Collection; import java.util.List; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.io.IOUtils; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1ObjectIdentifier; @@ -52,6 +50,7 @@ import eu.europa.esig.dss.cades.CMSUtils; import eu.europa.esig.dss.cades.validation.CAdESSignature; import eu.europa.esig.dss.signature.SignatureExtension; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.SignatureCryptographicVerification; import eu.europa.esig.dss.x509.tsp.TSPSource; @@ -107,7 +106,7 @@ public CMSSignedDocument extendSignatures(final DSSDocument signatureToExtend, f try { final InputStream inputStream = signatureToExtend.openStream(); final CMSSignedData cmsSignedData = new CMSSignedData(inputStream); - IOUtils.closeQuietly(inputStream); + Utils.closeQuietly(inputStream); final CMSSignedData extendCMSSignedData = extendCMSSignatures(cmsSignedData, parameters); final CMSSignedDocument cmsSignedDocument = new CMSSignedDocument(extendCMSSignedData); return cmsSignedDocument; @@ -142,7 +141,7 @@ private CMSSignedData extendAllCMSSignatures(CMSSignedData cmsSignedData, CAdESS for (SignerInformation signerInformation : signerInformationCollection) { final CAdESSignature cadesSignature = new CAdESSignature(cmsSignedData, signerInformation); - cadesSignature.setDetachedContents(parameters.getDetachedContent()); + cadesSignature.setDetachedContents(parameters.getDetachedContents()); assertSignatureValid(cadesSignature, parameters); final SignerInformation newSignerInformation = extendCMSSignature(cmsSignedData, signerInformation, parameters); newSignerInformationList.add(newSignerInformation); @@ -176,7 +175,7 @@ private CMSSignedData extendLastCMSSignature(CMSSignedData cmsSignedData, CAdESS if (lastSignerInformation == signerInformation) { final CAdESSignature cadesSignature = new CAdESSignature(cmsSignedData, signerInformation); - cadesSignature.setDetachedContents(parameters.getDetachedContent()); + cadesSignature.setDetachedContents(parameters.getDetachedContents()); assertSignatureValid(cadesSignature, parameters); final SignerInformation newSignerInformation = extendCMSSignature(cmsSignedData, signerInformation, parameters); newSignerInformationList.add(newSignerInformation); @@ -208,7 +207,7 @@ private void assertSignatureValid(final CAdESSignature cadesSignature, final CAd if (!SignatureForm.PAdES.equals(parameters.getSignatureLevel().getSignatureForm())) { - final SignatureCryptographicVerification signatureCryptographicVerification = cadesSignature.checkSignatureIntegrity(); + final SignatureCryptographicVerification signatureCryptographicVerification = cadesSignature.getSignatureCryptographicVerification(); if (!signatureCryptographicVerification.isSignatureIntact()) { final String errorMessage = signatureCryptographicVerification.getErrorMessage(); @@ -226,7 +225,8 @@ private void assertSignatureValid(final CAdESSignature cadesSignature, final CAd * @return * @throws java.io.IOException */ - abstract protected SignerInformation extendCMSSignature(CMSSignedData signedData, SignerInformation signerInformation, CAdESSignatureParameters parameters) throws DSSException; + abstract protected SignerInformation extendCMSSignature(CMSSignedData signedData, SignerInformation signerInformation, CAdESSignatureParameters parameters) + throws DSSException; /** * Extends the root Signed Data. Nothing to do by default. @@ -258,16 +258,16 @@ protected ASN1Object getTimeStampAttributeValue(TSPSource tspSource, byte[] mess return signatureTimeStampValue; } - public static ASN1Object getTimeStampAttributeValue(final TSPSource tspSource, final byte[] messageToTimestamp, final DigestAlgorithm timestampDigestAlgorithm, - final Attribute... attributesForTimestampToken) { + public static ASN1Object getTimeStampAttributeValue(final TSPSource tspSource, final byte[] messageToTimestamp, + final DigestAlgorithm timestampDigestAlgorithm, final Attribute... attributesForTimestampToken) { try { if (LOG.isDebugEnabled()) { - LOG.debug("Message to timestamp is: " + Hex.encodeHexString(messageToTimestamp)); + LOG.debug("Message to timestamp is: " + Utils.toHex(messageToTimestamp)); } byte[] timestampDigest = DSSUtils.digest(timestampDigestAlgorithm, messageToTimestamp); if (LOG.isDebugEnabled()) { - LOG.debug("Digested ({}) message to timestamp is {}", new Object[] { timestampDigestAlgorithm, Hex.encodeHexString(timestampDigest)}); + LOG.debug("Digested ({}) message to timestamp is {}", new Object[] { timestampDigestAlgorithm, Utils.toHex(timestampDigest) }); } final TimeStampToken timeStampToken = tspSource.getTimeStampResponse(timestampDigestAlgorithm, timestampDigest); @@ -278,7 +278,7 @@ public static ASN1Object getTimeStampAttributeValue(final TSPSource tspSource, f if (LOG.isDebugEnabled()) { final byte[] messageImprintDigest = timeStampToken.getTimeStampInfo().getMessageImprintDigest(); - LOG.debug("Digested ({}) message in timestamp is {}", new Object[] { timestampDigestAlgorithm, Hex.encodeHexString(messageImprintDigest)}); + LOG.debug("Digested ({}) message in timestamp is {}", new Object[] { timestampDigestAlgorithm, Utils.toHex(messageImprintDigest) }); } CMSSignedData cmsSignedDataTimeStampToken = new CMSSignedData(timeStampToken.getEncoded()); @@ -293,6 +293,10 @@ public static ASN1Object getTimeStampAttributeValue(final TSPSource tspSource, f final ASN1Encodable objectAt = attributeToAdd.getAttrValues().getObjectAt(0); unsignedAttributes = unsignedAttributes.add(attrType, objectAt); } + // Unsigned attributes cannot be empty (RFC 5652 5.3) + if (unsignedAttributes.size() == 0) { + unsignedAttributes = null; + } final SignerInformation newSignerInformation = SignerInformation.replaceUnsignedAttributes(signerInformation, unsignedAttributes); final List signerInformationList = new ArrayList(); signerInformationList.add(newSignerInformation); diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CMSSignedDataBuilder.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CMSSignedDataBuilder.java index e40173ee7a..9ed3d242fc 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CMSSignedDataBuilder.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CMSSignedDataBuilder.java @@ -34,7 +34,6 @@ import javax.security.auth.x500.X500Principal; -import org.apache.commons.io.IOUtils; import org.bouncycastle.asn1.cms.AttributeTable; import org.bouncycastle.cert.X509CertificateHolder; import org.bouncycastle.cert.jcajce.JcaCertStore; @@ -53,9 +52,11 @@ import org.bouncycastle.util.Store; import eu.europa.esig.dss.DSSASN1Utils; +import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.DSSException; import eu.europa.esig.dss.DSSUtils; import eu.europa.esig.dss.cades.CAdESSignatureParameters; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.x509.CertificateSource; import eu.europa.esig.dss.x509.CertificateToken; @@ -73,9 +74,12 @@ public class CMSSignedDataBuilder { private CertificateVerifier certificateVerifier; /** - * This is the default constructor for {@code CMSSignedDataGeneratorBuilder}. The {@code CertificateVerifier} is used to find the trusted certificates. + * This is the default constructor for {@code CMSSignedDataGeneratorBuilder}. The {@code CertificateVerifier} is + * used to find the trusted certificates. * - * @param certificateVerifier {@code CertificateVerifier} provides information on the sources to be used in the validation process in the context of a signature. + * @param certificateVerifier + * {@code CertificateVerifier} provides information on the sources to be used in the validation process + * in the context of a signature. */ public CMSSignedDataBuilder(final CertificateVerifier certificateVerifier) { @@ -90,16 +94,20 @@ public CMSSignedDataBuilder(final CertificateVerifier certificateVerifier) { * SignedData version is required to be set to 1. * ---> CMS SignedData Version is handled automatically by BouncyCastle. * - * @param parameters set of the driving signing parameters - * @param contentSigner the contentSigned to get the hash of the data to be signed - * @param signerInfoGeneratorBuilder true if the unsigned attributes must be included - * @param originalSignedData the original signed data if extending an existing signature. null otherwise. - * @return the bouncycastle signed data generator which signs the document and adds the required signed and unsigned CMS attributes + * @param parameters + * set of the driving signing parameters + * @param contentSigner + * the contentSigned to get the hash of the data to be signed + * @param signerInfoGeneratorBuilder + * true if the unsigned attributes must be included + * @param originalSignedData + * the original signed data if extending an existing signature. null otherwise. + * @return the bouncycastle signed data generator which signs the document and adds the required signed and unsigned + * CMS attributes * @throws eu.europa.esig.dss.DSSException */ protected CMSSignedDataGenerator createCMSSignedDataGenerator(final CAdESSignatureParameters parameters, final ContentSigner contentSigner, - final SignerInfoGeneratorBuilder signerInfoGeneratorBuilder, - final CMSSignedData originalSignedData) throws DSSException { + final SignerInfoGeneratorBuilder signerInfoGeneratorBuilder, final CMSSignedData originalSignedData) throws DSSException { try { final CertificateToken signingCertificate = parameters.getSigningCertificate(); @@ -144,9 +152,12 @@ protected CMSSignedDataGenerator createCMSSignedDataGenerator(final CAdESSignatu } /** - * @param parameters the parameters of the signature containing values for the attributes - * @param includeUnsignedAttributes true if the unsigned attributes must be included - * @return a SignerInfoGeneratorBuilder that generate the signed and unsigned attributes according to the CAdESLevelBaselineB + * @param parameters + * the parameters of the signature containing values for the attributes + * @param includeUnsignedAttributes + * true if the unsigned attributes must be included + * @return a SignerInfoGeneratorBuilder that generate the signed and unsigned attributes according to the + * CAdESLevelBaselineB */ SignerInfoGeneratorBuilder getSignerInfoGeneratorBuilder(final CAdESSignatureParameters parameters, final boolean includeUnsignedAttributes) { @@ -161,8 +172,10 @@ SignerInfoGeneratorBuilder getSignerInfoGeneratorBuilder(final CAdESSignaturePar } /** - * @param signedAttributes the signedAttributes - * @param unsignedAttributes the unsignedAttributes + * @param signedAttributes + * the signedAttributes + * @param unsignedAttributes + * the unsignedAttributes * @return a SignerInfoGeneratorBuilder that generate the signed and unsigned attributes according to the parameters */ private SignerInfoGeneratorBuilder getSignerInfoGeneratorBuilder(AttributeTable signedAttributes, AttributeTable unsignedAttributes) { @@ -180,8 +193,10 @@ private SignerInfoGeneratorBuilder getSignerInfoGeneratorBuilder(AttributeTable } /** - * @param signedAttributeGenerator the signedAttribute generator - * @param unsignedAttributeGenerator the unsignedAttribute generator + * @param signedAttributeGenerator + * the signedAttribute generator + * @param unsignedAttributeGenerator + * the unsignedAttribute generator * @return a SignerInfoGeneratorBuilder that generate the signed and unsigned attributes according to the parameters */ private SignerInfoGeneratorBuilder getSignerInfoGeneratorBuilder(DefaultSignedAttributeTableGenerator signedAttributeGenerator, @@ -226,8 +241,8 @@ private JcaCertStore getJcaCertStore(final Collection certific } } - protected CMSSignedData regenerateCMSSignedData(CMSSignedData cmsSignedData, CAdESSignatureParameters parameters, Store certificatesStore, Store attributeCertificatesStore, - Store crlsStore, Store otherRevocationInfoFormatStoreBasic, Store otherRevocationInfoFormatStoreOcsp) { + protected CMSSignedData regenerateCMSSignedData(CMSSignedData cmsSignedData, CAdESSignatureParameters parameters, Store certificatesStore, + Store attributeCertificatesStore, Store crlsStore, Store otherRevocationInfoFormatStoreBasic, Store otherRevocationInfoFormatStoreOcsp) { try { final CMSSignedDataGenerator cmsSignedDataGenerator = new CMSSignedDataGenerator(); @@ -239,9 +254,11 @@ protected CMSSignedData regenerateCMSSignedData(CMSSignedData cmsSignedData, CAd cmsSignedDataGenerator.addOtherRevocationInfo(id_ri_ocsp_response, otherRevocationInfoFormatStoreOcsp); final boolean encapsulate = cmsSignedData.getSignedContent() != null; if (!encapsulate) { - final InputStream inputStream = parameters.getDetachedContent().openStream(); + List detachedContents = parameters.getDetachedContents(); + // CAdES can only sign one document + final InputStream inputStream = detachedContents.get(0).openStream(); final CMSProcessableByteArray content = new CMSProcessableByteArray(DSSUtils.toByteArray(inputStream)); - IOUtils.closeQuietly(inputStream); + Utils.closeQuietly(inputStream); cmsSignedData = cmsSignedDataGenerator.generate(content, encapsulate); } else { cmsSignedData = cmsSignedDataGenerator.generate(cmsSignedData.getSignedContent(), encapsulate); @@ -252,5 +269,5 @@ protected CMSSignedData regenerateCMSSignedData(CMSSignedData cmsSignedData, CAd } } - //TODO Vincent: regeneration of SignedData -> Content-TS + // TODO Vincent: regeneration of SignedData -> Content-TS } diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CMSSignedDocument.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CMSSignedDocument.java index a62c38cbb9..d42f9b915f 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CMSSignedDocument.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CMSSignedDocument.java @@ -22,12 +22,10 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import org.apache.commons.codec.binary.Base64; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.DEROutputStream; import org.bouncycastle.cms.CMSSignedData; @@ -38,6 +36,7 @@ import eu.europa.esig.dss.DSSUtils; import eu.europa.esig.dss.DigestAlgorithm; import eu.europa.esig.dss.MimeType; +import eu.europa.esig.dss.utils.Utils; /** * A document composed by a CMSSignedData @@ -90,26 +89,26 @@ public byte[] getBytes() throws DSSException { @Override public void save(final String filePath) { + FileOutputStream fos = null; try { - final FileOutputStream fos = new FileOutputStream(filePath); - DSSUtils.write(getBytes(), fos); - fos.close(); - } catch (FileNotFoundException e) { - throw new DSSException(e); + fos = new FileOutputStream(filePath); + Utils.write(getBytes(), fos); } catch (IOException e) { throw new DSSException(e); + } finally { + Utils.closeQuietly(fos); } } @Override public String getDigest(final DigestAlgorithm digestAlgorithm) { final byte[] digestBytes = DSSUtils.digest(digestAlgorithm, getBytes()); - final String base64Encode = Base64.encodeBase64String(digestBytes); + final String base64Encode = Utils.toBase64(digestBytes); return base64Encode; } public String getBase64Encoded() { - return Base64.encodeBase64String(getBytes()); + return Utils.toBase64(getBytes()); } @Override diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CadesLevelBaselineLTATimestampExtractor.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CadesLevelBaselineLTATimestampExtractor.java index e9fb1954cb..7f49ce51ed 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CadesLevelBaselineLTATimestampExtractor.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/signature/CadesLevelBaselineLTATimestampExtractor.java @@ -32,8 +32,6 @@ import java.util.List; import java.util.Set; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Integer; @@ -63,6 +61,7 @@ import eu.europa.esig.dss.DigestAlgorithm; import eu.europa.esig.dss.cades.CMSUtils; import eu.europa.esig.dss.cades.validation.CAdESSignature; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.TimestampToken; import eu.europa.esig.dss.x509.CertificateToken; @@ -175,10 +174,9 @@ private ASN1Sequence getCertificatesHashIndex() throws DSSException { final List certificateTokens = cadesSignature.getCertificates(); for (final CertificateToken certificateToken : certificateTokens) { - final byte[] encodedCertificate = certificateToken.getEncoded(); - final byte[] digest = DSSUtils.digest(hashIndexDigestAlgorithm, encodedCertificate); + final byte[] digest = certificateToken.getDigest(hashIndexDigestAlgorithm); if (LOG.isDebugEnabled()) { - LOG.debug("Adding to CertificatesHashIndex DSS-Identifier: {} with hash {}", certificateToken.getDSSId(), Hex.encodeHexString(digest)); + LOG.debug("Adding to CertificatesHashIndex DSS-Identifier: {} with hash {}", certificateToken.getDSSId(), Utils.toHex(digest)); } final DEROctetString derOctetStringDigest = new DEROctetString(digest); certificatesHashIndexVector.add(derOctetStringDigest); @@ -206,9 +204,7 @@ private ASN1Sequence getVerifiedCertificatesHashIndex(TimestampToken timestampTo final List certificates = cadesSignature.getCertificatesWithinSignatureAndTimestamps(); for (final CertificateToken certificateToken : certificates) { - - final byte[] encodedCertificate = certificateToken.getEncoded(); - final byte[] digest = DSSUtils.digest(hashIndexDigestAlgorithm, encodedCertificate); + final byte[] digest = certificateToken.getDigest(hashIndexDigestAlgorithm); final DEROctetString derOctetStringDigest = new DEROctetString(digest); if (certHashesList.remove(derOctetStringDigest)) { // attribute present in signature and in timestamp @@ -257,7 +253,7 @@ private ASN1Sequence getCRLsHashIndex() throws DSSException { private void digestAndAddToList(ASN1EncodableVector crlsHashIndex, byte[] encoded) { final byte[] digest = DSSUtils.digest(hashIndexDigestAlgorithm, encoded); if (LOG.isDebugEnabled()) { - LOG.debug("Adding to crlsHashIndex with hash {}", Hex.encodeHexString(digest)); + LOG.debug("Adding to crlsHashIndex with hash {}", Utils.toHex(digest)); } final DEROctetString derOctetStringDigest = new DEROctetString(digest); crlsHashIndex.add(derOctetStringDigest); @@ -536,10 +532,10 @@ public byte[] getArchiveTimestampDataV3(SignerInformation signerInformation, Att */ final byte[] dataToTimestamp = DSSUtils.concatenate(encodedContentType, signedDataDigest, encodedFields, encodedAtsHashIndex); if (LOG.isDebugEnabled()) { - LOG.debug("eContentType={}", Hex.encodeHexString(encodedContentType)); - LOG.debug("signedDataDigest={}", Hex.encodeHexString(signedDataDigest)); + LOG.debug("eContentType={}", Utils.toHex(encodedContentType)); + LOG.debug("signedDataDigest={}", Utils.toHex(signedDataDigest)); LOG.debug("encodedFields=see above"); - LOG.debug("encodedAtsHashIndex={}", Hex.encodeHexString(encodedAtsHashIndex)); + LOG.debug("encodedAtsHashIndex={}", Utils.toHex(encodedAtsHashIndex)); // LOG.debug("Archive Timestamp Data v3 is: {}", Hex.encodeHexString(dataToTimestamp)); } return dataToTimestamp; @@ -583,12 +579,12 @@ private byte[] getSignedFields(final SignerInformation signerInformation) { final byte[] derEncodedEncryptedDigest = DSSASN1Utils.getDEREncoded(encryptedDigest); if (LOG.isDebugEnabled()) { - LOG.debug("getSignedFields Version={}", Base64.decodeBase64(derEncodedVersion)); - LOG.debug("getSignedFields Sid={}", Base64.decodeBase64(derEncodedSid)); - LOG.debug("getSignedFields DigestAlgorithm={}", Base64.decodeBase64(derEncodedDigestAlgorithm)); - LOG.debug("getSignedFields SignedAttributes={}", Hex.encodeHexString(derEncodedSignedAttributes)); - LOG.debug("getSignedFields DigestEncryptionAlgorithm={}", Base64.decodeBase64(derEncodedDigestEncryptionAlgorithm)); - LOG.debug("getSignedFields EncryptedDigest={}", Base64.decodeBase64(derEncodedEncryptedDigest)); + LOG.debug("getSignedFields Version={}", Utils.toBase64(derEncodedVersion)); + LOG.debug("getSignedFields Sid={}", Utils.toBase64(derEncodedSid)); + LOG.debug("getSignedFields DigestAlgorithm={}", Utils.toBase64(derEncodedDigestAlgorithm)); + LOG.debug("getSignedFields SignedAttributes={}", Utils.toBase64(derEncodedSignedAttributes)); + LOG.debug("getSignedFields DigestEncryptionAlgorithm={}", Utils.toBase64(derEncodedDigestEncryptionAlgorithm)); + LOG.debug("getSignedFields EncryptedDigest={}", Utils.toBase64(derEncodedEncryptedDigest)); } final byte[] concatenatedArrays = DSSUtils.concatenate(derEncodedVersion, derEncodedSid, derEncodedDigestAlgorithm, derEncodedSignedAttributes, derEncodedDigestEncryptionAlgorithm, derEncodedEncryptedDigest); diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/validation/CAdESSignature.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/validation/CAdESSignature.java index d3c7ff0b17..983480de3b 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/validation/CAdESSignature.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/validation/CAdESSignature.java @@ -51,10 +51,6 @@ import java.util.Date; import java.util.List; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.io.IOUtils; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1GeneralizedTime; @@ -132,6 +128,7 @@ import eu.europa.esig.dss.TokenIdentifier; import eu.europa.esig.dss.cades.CMSUtils; import eu.europa.esig.dss.cades.signature.CadesLevelBaselineLTATimestampExtractor; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.AdvancedSignature; import eu.europa.esig.dss.validation.CAdESCertificateSource; import eu.europa.esig.dss.validation.CRLRef; @@ -143,6 +140,7 @@ import eu.europa.esig.dss.validation.DefaultAdvancedSignature; import eu.europa.esig.dss.validation.OCSPRef; import eu.europa.esig.dss.validation.SignatureCryptographicVerification; +import eu.europa.esig.dss.validation.SignaturePolicyProvider; import eu.europa.esig.dss.validation.SignatureProductionPlace; import eu.europa.esig.dss.validation.TimestampReference; import eu.europa.esig.dss.validation.TimestampReferenceCategory; @@ -386,9 +384,9 @@ private void verifySigningCertificateV1(final BigInteger signingTokenSerialNumbe final Attribute signingCertificateAttributeV1) { final DigestAlgorithm digestAlgorithm = DigestAlgorithm.SHA1; - final byte[] signingTokenCertHash = DSSUtils.digest(digestAlgorithm, signingCertificateValidity.getCertificateToken().getEncoded()); + final byte[] signingTokenCertHash = signingCertificateValidity.getCertificateToken().getDigest(digestAlgorithm); if (LOG.isDebugEnabled()) { - LOG.debug("Candidate Certificate Hash {} with algorithm {}", Hex.encodeHexString(signingTokenCertHash), digestAlgorithm.getName()); + LOG.debug("Candidate Certificate Hash {} with algorithm {}", Utils.toHex(signingTokenCertHash), digestAlgorithm.getName()); } final ASN1Set attrValues = signingCertificateAttributeV1.getAttrValues(); @@ -402,8 +400,7 @@ private void verifySigningCertificateV1(final BigInteger signingTokenSerialNumbe final byte[] certHash = essCertID.getCertHash(); signingCertificateValidity.setDigestPresent(true); if (LOG.isDebugEnabled()) { - LOG.debug("Found Certificate Hash in signingCertificateAttributeV1 {} with algorithm {}", Hex.encodeHexString(certHash), - digestAlgorithm.getName()); + LOG.debug("Found Certificate Hash in signingCertificateAttributeV1 {} with algorithm {}", Utils.toHex(certHash), digestAlgorithm.getName()); } final IssuerSerial issuerSerial = essCertID.getIssuerSerial(); final boolean match = verifySigningCertificateReferences(signingTokenSerialNumber, signingTokenIssuerName, signingTokenCertHash, certHash, @@ -440,17 +437,16 @@ private void verifySigningCertificateV2(final BigInteger signingTokenSerialNumbe final DigestAlgorithm digestAlgorithm = DigestAlgorithm.forOID(algorithmId); signingCertificateValidity.setDigestAlgorithm(digestAlgorithm); if (digestAlgorithm != lastDigestAlgorithm) { - - signingTokenCertHash = DSSUtils.digest(digestAlgorithm, signingCertificateValidity.getCertificateToken().getEncoded()); + signingTokenCertHash = signingCertificateValidity.getCertificateToken().getDigest(digestAlgorithm); if (LOG.isDebugEnabled()) { - LOG.debug("Candidate Certificate Hash {} with algorithm {}", Hex.encodeHexString(signingTokenCertHash), digestAlgorithm.getName()); + LOG.debug("Candidate Certificate Hash {} with algorithm {}", Utils.toHex(signingTokenCertHash), digestAlgorithm.getName()); } lastDigestAlgorithm = digestAlgorithm; } final byte[] certHash = essCertIDv2.getCertHash(); signingCertificateValidity.setDigestPresent(true); if (LOG.isDebugEnabled()) { - LOG.debug("Found Certificate Hash in SigningCertificateV2 {} with algorithm {}", Hex.encodeHexString(certHash), digestAlgorithm.getName()); + LOG.debug("Found Certificate Hash in SigningCertificateV2 {} with algorithm {}", Utils.toHex(certHash), digestAlgorithm.getName()); } final IssuerSerial issuerSerial = essCertIDv2.getIssuerSerial(); final boolean match = verifySigningCertificateReferences(signingTokenSerialNumber, signingTokenIssuerName, signingTokenCertHash, certHash, @@ -467,7 +463,7 @@ private void verifySigningCertificateV2(final BigInteger signingTokenSerialNumbe private boolean verifySigningCertificateReferences(final BigInteger signingTokenSerialNumber, final GeneralNames signingTokenIssuerName, final byte[] signingTokenCertHash, final byte[] certHash, final IssuerSerial issuerSerial) { - signingCertificateValidity.setDigest(Base64.encodeBase64String(signingTokenCertHash)); + signingCertificateValidity.setDigest(Utils.toBase64(signingTokenCertHash)); final boolean hashEqual = Arrays.equals(certHash, signingTokenCertHash); signingCertificateValidity.setDigestEqual(hashEqual); @@ -495,57 +491,31 @@ public List getCertificates() { return getCertificateSource().getCertificates(); } - /** - * 31 ETSI TS 101 733 V2.2.1 (2013-04) - * 5.8.1 signature-policy-identifier The present document mandates that for - * CAdES-EPES, a reference to the signature policy is included in the - * signedData. This reference is explicitly identified. A signature policy - * defines the rules for creation and validation of an electronic signature, - * and is included as a signed attribute with every Explicit Policy-based - * Electronic Signature. The signature-policy-identifier shall be a signed - * attribute. - * The following object identifier identifies the - * signature-policy-identifier attribute: ... id-aa-ets-sigPolicyId OBJECT - * IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) - * pkcs9(9) smime(16) id-aa(2) 15 } signature-policy-identifier attribute - * values have ASN.1 type SignaturePolicyIdentifier: ... - * SignaturePolicyIdentifier ::=CHOICE{ ...... signaturePolicyId ......... - * SignaturePolicyId, ...... signaturePolicyImplied .... - * SignaturePolicyImplied -- not used in this version} - * ... SignaturePolicyId ::= SEQUENCE { ...... sigPolicyId ......... - * SigPolicyId, ...... sigPolicyHash ....... SigPolicyHash, ...... - * sigPolicyQualifiers . SEQUENCE SIZE (1..MAX) OF SigPolicyQualifierInfo - * OPTIONAL} - * ... SignaturePolicyImplied ::= NULL - * NOTE: {@code SignaturePolicyImplied} -- not used in this version - * - * @return - */ @Override - public SignaturePolicy getPolicyId() { - + public void checkSignaturePolicy(SignaturePolicyProvider signaturePolicyProvider) { final AttributeTable attributes = signerInformation.getSignedAttributes(); if (attributes == null) { - return null; + return; } final Attribute attribute = attributes.get(PKCSObjectIdentifiers.id_aa_ets_sigPolicyId); if (attribute == null) { - return null; + return; } final ASN1Encodable attrValue = attribute.getAttrValues().getObjectAt(0); if (attrValue instanceof DERNull) { - return null; + return; } final SignaturePolicyId sigPolicy = SignaturePolicyId.getInstance(attrValue); if (sigPolicy == null) { - return null; + return; } final String policyId = sigPolicy.getSigPolicyId().getId(); - final SignaturePolicy signaturePolicy = new SignaturePolicy(policyId); + + signaturePolicy = new SignaturePolicy(policyId); final OtherHashAlgAndValue hashAlgAndValue = sigPolicy.getSigPolicyHash(); @@ -556,29 +526,31 @@ public SignaturePolicy getPolicyId() { final ASN1OctetString digestValue = hashAlgAndValue.getHashValue(); final byte[] digestValueBytes = digestValue.getOctets(); - signaturePolicy.setDigestValue(digestValueBytes); + signaturePolicy.setDigestValue(Utils.toBase64(digestValueBytes)); final SigPolicyQualifiers sigPolicyQualifiers = sigPolicy.getSigPolicyQualifiers(); if (sigPolicyQualifiers == null) { - return signaturePolicy; - } - for (int ii = 0; ii < sigPolicyQualifiers.size(); ii++) { - - final SigPolicyQualifierInfo policyQualifierInfo = sigPolicyQualifiers.getInfoAt(ii); - final ASN1ObjectIdentifier policyQualifierInfoId = policyQualifierInfo.getSigPolicyQualifierId(); - final String policyQualifierInfoValue = policyQualifierInfo.getSigQualifier().toString(); - - if (PKCSObjectIdentifiers.id_spq_ets_unotice.equals(policyQualifierInfoId)) { - - signaturePolicy.setNotice(policyQualifierInfoValue); - } else if (PKCSObjectIdentifiers.id_spq_ets_uri.equals(policyQualifierInfoId)) { - - signaturePolicy.setUrl(policyQualifierInfoValue); - } else { - LOG.error("Unknown signature policy qualifier id: " + policyQualifierInfoId + " with value: " + policyQualifierInfoValue); + signaturePolicy.setPolicyContent(signaturePolicyProvider.getSignaturePolicyById(policyId)); + } else { + for (int ii = 0; ii < sigPolicyQualifiers.size(); ii++) { + try { + final SigPolicyQualifierInfo policyQualifierInfo = sigPolicyQualifiers.getInfoAt(ii); + final ASN1ObjectIdentifier policyQualifierInfoId = policyQualifierInfo.getSigPolicyQualifierId(); + final String policyQualifierInfoValue = policyQualifierInfo.getSigQualifier().toString(); + + if (PKCSObjectIdentifiers.id_spq_ets_unotice.equals(policyQualifierInfoId)) { + signaturePolicy.setNotice(policyQualifierInfoValue); + } else if (PKCSObjectIdentifiers.id_spq_ets_uri.equals(policyQualifierInfoId)) { + signaturePolicy.setUrl(policyQualifierInfoValue); + signaturePolicy.setPolicyContent(signaturePolicyProvider.getSignaturePolicyByUrl(policyQualifierInfoValue)); + } else { + LOG.error("Unknown signature policy qualifier id: " + policyQualifierInfoId + " with value: " + policyQualifierInfoValue); + } + } catch (Exception e) { + LOG.error("Unable to read SigPolicyQualifierInfo " + ii, e.getMessage()); + } } } - return signaturePolicy; } @Override @@ -781,8 +753,8 @@ public String[] getClaimedSignerRoles() { final String[] strings = claimedRoles.toArray(new String[claimedRoles.size()]); return strings; } catch (Exception e) { - - throw new DSSException("Error when dealing with claimed signer roles: [" + attrValue.toString() + "]", e); + LOG.error("Error when dealing with claimed signer roles: [" + attrValue.toString() + "]", e); + return null; } } @@ -837,8 +809,8 @@ public List getCertifiedSignerRoles() { } return roles; } catch (Exception e) { - - throw new DSSException("Error when dealing with certified signer roles: [" + asn1EncodableAttrValue.toString() + "]", e); + LOG.error("Error when dealing with certified signer roles: [" + asn1EncodableAttrValue.toString() + "]", e); + return null; } } @@ -855,7 +827,7 @@ public byte[] getContentTimestampData(final TimestampToken timestampToken) { // signedData, or it exists but has no eContent byte[] originalDocumentBytes; try { - originalDocumentBytes = IOUtils.toByteArray(getOriginalDocumentStream()); + originalDocumentBytes = Utils.toByteArray(getOriginalDocumentStream()); } catch (IOException e) { throw new DSSException(e); } @@ -957,7 +929,7 @@ private void makeTimestampTokens() { default: throw new DSSException("TimeStampType not supported : " + timestampType); } - timestampedTimestamps.add(timestampToken.getDSSId().asXmlId()); + timestampedTimestamps.add(timestampToken.getDSSIdAsString()); } } @@ -1074,7 +1046,7 @@ public List getSigningCertificateTimestampReferences() { } private TimestampReference createCertificateTimestampReference(final DigestAlgorithm digestAlgorithm, final byte[] certHash) { - final TimestampReference reference = new TimestampReference(digestAlgorithm, Base64.encodeBase64String(certHash)); + final TimestampReference reference = new TimestampReference(digestAlgorithm, Utils.toBase64(certHash)); return reference; } @@ -1102,31 +1074,25 @@ public DigestAlgorithm getDigestAlgorithm() { } @Override - public SignatureCryptographicVerification checkSignatureIntegrity() { - + public void checkSignatureIntegrity() { if (signatureCryptographicVerification != null) { - return signatureCryptographicVerification; + return; } signatureCryptographicVerification = new SignatureCryptographicVerification(); try { - final List certificateValidityList = getCertificateValidityList(); - if (certificateValidityList.size() == 0) { - + final CertificateValidity bestCandidate = getTheBestCandidate(); + if (bestCandidate == null) { signatureCryptographicVerification.setErrorMessage("There is no signing certificate within the signature."); - return signatureCryptographicVerification; + return; } boolean detachedSignature = isDetachedSignature(); final SignerInformation signerInformationToCheck; if (detachedSignature) { - - if (CollectionUtils.isEmpty(detachedContents)) { - - if (certificateValidityList.size() > 0) { - candidatesForSigningCertificate.setTheCertificateValidity(certificateValidityList.get(0)); - } + if (Utils.isCollectionEmpty(detachedContents)) { + candidatesForSigningCertificate.setTheCertificateValidity(bestCandidate); signatureCryptographicVerification.setErrorMessage("Detached file not found!"); - return signatureCryptographicVerification; + return; } signerInformationToCheck = recreateSignerInformation(); } else { @@ -1170,7 +1136,6 @@ public SignatureCryptographicVerification checkSignatureIntegrity() { signatureCryptographicVerification.setErrorMessage(e.getMessage()); } LOG.debug(" - RESULT: " + signatureCryptographicVerification.toString()); - return signatureCryptographicVerification; } /** @@ -1197,11 +1162,8 @@ private boolean isDetachedSignature() { return (cmsSignedData.getSignedContent() == null) || (cmsSignedData.getSignedContent().getContent() == null) ? true : false; } - private List getCertificateValidityList() { - - final List certificateValidityList; + private CertificateValidity getTheBestCandidate() { if (providedSigningCertificateToken == null) { - // To determine the signing certificate it is necessary to browse // through all candidates found before. candidatesForSigningCertificate = getCandidatesForSigningCertificate(); @@ -1211,8 +1173,7 @@ private List getCertificateValidityList() { final CertificateValidity certificateValidity = new CertificateValidity(providedSigningCertificateToken); candidatesForSigningCertificate.add(certificateValidity); } - certificateValidityList = candidatesForSigningCertificate.getCertificateValidityList(); - return certificateValidityList; + return candidatesForSigningCertificate.getTheBestCandidate(); } @Override @@ -1522,7 +1483,7 @@ private InputStream getOriginalDocumentStream() throws DSSException { if (signedContent != null) { return new ByteArrayInputStream(CMSUtils.getSignedContent(signedContent)); } else { - if (CollectionUtils.isNotEmpty(detachedContents)) { + if (Utils.isCollectionNotEmpty(detachedContents)) { return detachedContents.get(0).openStream(); } return new ByteArrayInputStream(DSSUtils.EMPTY_BYTE_ARRAY); @@ -1581,7 +1542,7 @@ private byte[] getArchiveTimestampDataV2(TimestampToken timestampToken) throws D */ if (getOriginalDocumentStream() != null) { data.write(content.toASN1Primitive().getEncoded()); - IOUtils.copy(getOriginalDocumentStream(), data); + Utils.copy(getOriginalDocumentStream(), data); } else { throw new DSSException("Signature is detached and no original data provided."); } @@ -1723,7 +1684,7 @@ public List getTimestampedReferences() { final List certRefs = getCertificateRefs(); for (final CertificateRef certificateRef : certRefs) { - final String digestValue = Base64.encodeBase64String(certificateRef.getDigestValue()); + final String digestValue = Utils.toBase64(certificateRef.getDigestValue()); final DigestAlgorithm digestAlgorithm = certificateRef.getDigestAlgorithm(); usedCertificatesDigestAlgorithms.add(digestAlgorithm); final TimestampReference reference = new TimestampReference(digestAlgorithm, digestValue); diff --git a/dss-cades/src/main/java/eu/europa/esig/dss/cades/validation/CMSDocumentValidator.java b/dss-cades/src/main/java/eu/europa/esig/dss/cades/validation/CMSDocumentValidator.java index 875ecde27f..b112d77cd9 100644 --- a/dss-cades/src/main/java/eu/europa/esig/dss/cades/validation/CMSDocumentValidator.java +++ b/dss-cades/src/main/java/eu/europa/esig/dss/cades/validation/CMSDocumentValidator.java @@ -26,8 +26,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; import org.bouncycastle.cms.CMSException; import org.bouncycastle.cms.CMSSignedData; import org.bouncycastle.cms.SignerInformation; @@ -38,6 +36,7 @@ import eu.europa.esig.dss.DSSUtils; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.cades.CMSUtils; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.AdvancedSignature; import eu.europa.esig.dss.validation.SignedDocumentValidator; @@ -90,7 +89,7 @@ public CMSDocumentValidator(final DSSDocument document) throws DSSException { } catch (CMSException e) { throw new DSSException("Not a valid CAdES file", e); } finally { - IOUtils.closeQuietly(inputStream); + Utils.closeQuietly(inputStream); } } @@ -110,13 +109,11 @@ public boolean isSupported(DSSDocument dssDocument) { public List getSignatures() { List signatures = new ArrayList(); if (cmsSignedData != null) { - - ensureCertificatePoolInitialized(); - for (final Object signerInformationObject : cmsSignedData.getSignerInfos().getSigners()) { final SignerInformation signerInformation = (SignerInformation) signerInformationObject; final CAdESSignature cadesSignature = new CAdESSignature(cmsSignedData, signerInformation, validationCertPool); + cadesSignature.setSignatureFilename(document.getName()); cadesSignature.setDetachedContents(detachedContents); cadesSignature.setProvidedSigningCertificateToken(providedSigningCertificateToken); signatures.add(cadesSignature); @@ -126,14 +123,17 @@ public List getSignatures() { } @Override - public DSSDocument getOriginalDocument(final String signatureId) throws DSSException { - if (StringUtils.isBlank(signatureId)) { + public List getOriginalDocuments(final String signatureId) throws DSSException { + if (Utils.isStringBlank(signatureId)) { throw new NullPointerException("signatureId"); } + List results = new ArrayList(); + for (final Object signerInformationObject : cmsSignedData.getSignerInfos().getSigners()) { final SignerInformation signerInformation = (SignerInformation) signerInformationObject; final CAdESSignature cadesSignature = new CAdESSignature(cmsSignedData, signerInformation, validationCertPool); + cadesSignature.setSignatureFilename(document.getName()); cadesSignature.setDetachedContents(detachedContents); cadesSignature.setProvidedSigningCertificateToken(providedSigningCertificateToken); if (cadesSignature.getId().equals(signatureId)) { @@ -142,10 +142,10 @@ public DSSDocument getOriginalDocument(final String signatureId) throws DSSExcep } byte[] content = CMSUtils.getSignedContent(cmsSignedData.getSignedContent()); content = isBase64Encoded(content) ? Base64.decode(content) : content; - return new InMemoryDocument(content); + results.add(new InMemoryDocument(content)); } } - throw new DSSException("The signature with the given id was not found!"); + return results; } private boolean isBase64Encoded(byte[] array) { @@ -157,4 +157,5 @@ private boolean isBase64Encoded(String text) { Matcher matcher = pattern.matcher(text); return matcher.matches(); } + } diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/extension/ExtendToCAdESLtaTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/extension/ExtendToCAdESLtaTest.java index 938f2a34fb..8e1eedd08c 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/extension/ExtendToCAdESLtaTest.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/extension/ExtendToCAdESLtaTest.java @@ -3,6 +3,7 @@ import static org.junit.Assert.assertFalse; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.junit.Test; @@ -57,7 +58,7 @@ public void testExtend() throws Exception { CAdESSignatureParameters parameters = new CAdESSignatureParameters(); parameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_LTA); DSSDocument detachedContent = new FileDocument(DETACHED_DOC_PATH); - parameters.setDetachedContent(detachedContent); + parameters.setDetachedContents(Arrays.asList(detachedContent)); DSSDocument extendDocument = service.extendDocument(new FileDocument(SIGNED_DOC_PATH), parameters); } diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/requirements/AbstractRequirementChecks.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/requirements/AbstractRequirementChecks.java index 74f00f2941..b530325719 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/requirements/AbstractRequirementChecks.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/requirements/AbstractRequirementChecks.java @@ -3,9 +3,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.security.cert.X509Certificate; - -import org.apache.commons.io.IOUtils; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; @@ -16,14 +13,15 @@ import org.bouncycastle.asn1.cms.SignerInfo; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.cert.X509CertificateHolder; -import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; -import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import eu.europa.esig.dss.DSSASN1Utils; import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.utils.Utils; +import eu.europa.esig.dss.x509.CertificateToken; public abstract class AbstractRequirementChecks { @@ -50,7 +48,7 @@ public void init() throws Exception { signerInfo = SignerInfo.getInstance(ASN1Sequence.getInstance(signerInfosAsn1.getObjectAt(0))); - IOUtils.closeQuietly(asn1sInput); + Utils.closeQuietly(asn1sInput); } protected abstract DSSDocument getSignedDocument() throws Exception; @@ -66,10 +64,8 @@ public void checkSignedDataCertificatesPresent() throws Exception { for (int i = 0; i < certificates.size(); i++) { ASN1Sequence seqCertif = ASN1Sequence.getInstance(certificates.getObjectAt(i)); X509CertificateHolder certificateHolder = new X509CertificateHolder(seqCertif.getEncoded()); - X509Certificate certificate = new JcaX509CertificateConverter().setProvider(BouncyCastleProvider.PROVIDER_NAME).getCertificate( - certificateHolder); - - certificate.checkValidity(); + CertificateToken certificate = DSSASN1Utils.getCertificate(certificateHolder); + certificate.getCertificate().checkValidity(); } } @@ -98,7 +94,7 @@ public void checkSigningTimePresent() { } /** - * signature-time-stamp shall be present in T/LT/LTA + * signature-time-stamp shall be present in T/LT/LTA */ @Test public void checkSignatureTimeStampPresent() { @@ -112,13 +108,13 @@ public void checkSignatureTimeStampPresent() { public abstract void checkCertificateValue(); /** - * complete-certificate-references shall not be present (B/T 1 or 0 ; LT/LTA 0) + * complete-certificate-references shall not be present (B/T 1 or 0 ; LT/LTA 0) */ @Test public abstract void checkCompleteCertificateReference(); /** - * revocation-values shall not be present (B/T 1 or 0 ; LT/LTA 0) + * revocation-values shall not be present (B/T 1 or 0 ; LT/LTA 0) */ @Test public abstract void checkRevocationValues(); @@ -130,13 +126,13 @@ public void checkSignatureTimeStampPresent() { public abstract void checkCompleteRevocationReferences(); /** - * CAdES-C-timestamp shall not be present (B/T >= 0 ; LT/LTA 0) + * CAdES-C-timestamp shall not be present (B/T >= 0 ; LT/LTA 0) */ @Test public abstract void checkCAdESCTimestamp(); /** - * time-stamped-certs-crls-references shall not be present (B/T >= 0 ; LT/LTA 0) + * time-stamped-certs-crls-references shall not be present (B/T >= 0 ; LT/LTA 0) */ @Test public abstract void checkTimestampedCertsCrlsReferences(); @@ -146,7 +142,7 @@ protected boolean isSignedAttributeFound(ASN1ObjectIdentifier oid) { } protected boolean isUnsignedAttributeFound(ASN1ObjectIdentifier oid) { - return countUnsignedAttribute(oid) >0; + return countUnsignedAttribute(oid) > 0; } protected int countSignedAttribute(ASN1ObjectIdentifier oid) { diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/AbstractCAdESTestSignature.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/AbstractCAdESTestSignature.java index a7f009fb88..b4d7c3bd60 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/AbstractCAdESTestSignature.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/AbstractCAdESTestSignature.java @@ -12,9 +12,9 @@ import org.bouncycastle.asn1.cms.SignedData; import org.bouncycastle.asn1.cms.SignerInfo; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; -public abstract class AbstractCAdESTestSignature extends AbstractTestSignature { +public abstract class AbstractCAdESTestSignature extends AbstractTestDocumentSignatureService { @Override protected void onDocumentSigned(byte[] byteArray) { diff --git a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBCadesToASiCSLevelBCadesTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureDetachedTest.java similarity index 71% rename from dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBCadesToASiCSLevelBCadesTest.java rename to dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureDetachedTest.java index 3a22a3ac57..53af19bb0e 100644 --- a/dss-asic/src/test/java/eu/europa/esig/dss/asic/signature/asics/ASiCSLevelBCadesToASiCSLevelBCadesTest.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureDetachedTest.java @@ -1,21 +1,22 @@ -package eu.europa.esig.dss.asic.signature.asics; +package eu.europa.esig.dss.cades.signature; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.util.ArrayList; import java.util.Date; +import java.util.List; import org.junit.Test; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.InMemoryDocument; import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.cades.CAdESSignatureParameters; import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -25,25 +26,24 @@ import eu.europa.esig.dss.validation.reports.Reports; import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -public class ASiCSLevelBCadesToASiCSLevelBCadesTest { +public class CAdESDoubleSignatureDetachedTest { @Test public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); - ASiCSignatureParameters signatureParameters = new ASiCSignatureParameters(); + CAdESSignatureParameters signatureParameters = new CAdESSignatureParameters(); signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setSignaturePackaging(SignaturePackaging.DETACHED); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); - ASiCService service = new ASiCService(certificateVerifier); + CAdESService service = new CAdESService(certificateVerifier); ToBeSigned dataToSign = service.getDataToSign(documentToSign, signatureParameters); SignatureValue signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); @@ -53,25 +53,29 @@ public void test() throws Exception { signatureParameters.bLevel().setSigningDate(new Date()); signatureParameters.setSigningCertificate(privateKeyEntry.getCertificate()); signatureParameters.setCertificateChain(privateKeyEntry.getCertificateChain()); - signatureParameters.setSignaturePackaging(SignaturePackaging.ENVELOPING); - signatureParameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - signatureParameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); + signatureParameters.setSignaturePackaging(SignaturePackaging.DETACHED); + signatureParameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + List detachedContents = new ArrayList(); + detachedContents.add(documentToSign); + signatureParameters.setDetachedContents(detachedContents); certificateVerifier = new CommonCertificateVerifier(); - service = new ASiCService(certificateVerifier); + service = new CAdESService(certificateVerifier); dataToSign = service.getDataToSign(signedDocument, signatureParameters); signatureValue = TestUtils.sign(SignatureAlgorithm.RSA_SHA256, privateKeyEntry, dataToSign); DSSDocument resignedDocument = service.signDocument(signedDocument, signatureParameters, signatureValue); SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(resignedDocument); + validator.setDetachedContents(detachedContents); validator.setCertificateVerifier(new CommonCertificateVerifier()); Reports reports = validator.validateDocument(); - // reports.print(); DiagnosticData diagnosticData = reports.getDiagnosticData(); + assertEquals(2, diagnosticData.getSignatureIdList().size()); + for (String id : diagnosticData.getSignatureIdList()) { assertTrue(diagnosticData.isBLevelTechnicallyValid(id)); } diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureTest.java index 60cf6d1884..f9639666f4 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureTest.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESDoubleSignatureTest.java @@ -1,5 +1,6 @@ package eu.europa.esig.dss.cades.signature; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.Date; @@ -31,7 +32,7 @@ public class CAdESDoubleSignatureTest { @Test public void test() throws Exception { - DSSDocument documentToSign = new InMemoryDocument("Hello Wolrd !".getBytes(), "test.text"); + DSSDocument documentToSign = new InMemoryDocument("Hello World !".getBytes(), "test.text"); CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); @@ -69,9 +70,10 @@ public void test() throws Exception { Reports reports = validator.validateDocument(); - // reports.print(); DiagnosticData diagnosticData = reports.getDiagnosticData(); + assertEquals(2, diagnosticData.getSignatureIdList().size()); + for (String id : diagnosticData.getSignatureIdList()) { assertTrue(diagnosticData.isBLevelTechnicallyValid(id)); } diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBTest.java index b771b54d99..703f5b6e8c 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBTest.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESLevelBTest.java @@ -33,9 +33,6 @@ import javax.crypto.Cipher; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; @@ -53,13 +50,12 @@ import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.asn1.x509.DigestInfo; import org.bouncycastle.cert.X509CertificateHolder; -import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; -import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.util.encoders.Hex; import org.junit.Before; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import eu.europa.esig.dss.DSSASN1Utils; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.DSSUtils; import eu.europa.esig.dss.DigestAlgorithm; @@ -70,14 +66,16 @@ import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.cades.CAdESSignatureParameters; import eu.europa.esig.dss.cades.validation.CAdESSignature; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.x509.CertificateToken; -public class CAdESLevelBTest extends AbstractTestSignature { +public class CAdESLevelBTest extends AbstractTestDocumentSignatureService { private static final String HELLO_WORLD = "Hello World"; @@ -107,6 +105,8 @@ public void init() throws Exception { } + // Annotation for error_probe + @SuppressWarnings("InsecureCryptoUsage") @Override protected void onDocumentSigned(byte[] byteArray) { try { @@ -150,14 +150,13 @@ protected void onDocumentSigned(byte[] byteArray) { logger.info("SEQ cert " + i + " : " + seqCertif); X509CertificateHolder certificateHolder = new X509CertificateHolder(seqCertif.getEncoded()); - X509Certificate certificate = new JcaX509CertificateConverter().setProvider(BouncyCastleProvider.PROVIDER_NAME) - .getCertificate(certificateHolder); - - certificate.checkValidity(); + CertificateToken certificate = DSSASN1Utils.getCertificate(certificateHolder); + X509Certificate x509Certificate = certificate.getCertificate(); + x509Certificate.checkValidity(); logger.info("Cert " + i + " : " + certificate); - foundCertificates.add(certificate); + foundCertificates.add(x509Certificate); } ASN1Set crLs = signedData.getCRLs(); @@ -231,7 +230,7 @@ protected void onDocumentSigned(byte[] byteArray) { logger.info("Nb Auth Attributes : " + authenticatedAttributes.size()); - String embeddedDigest = StringUtils.EMPTY; + String embeddedDigest = ""; for (int i = 0; i < authenticatedAttributes.size(); i++) { ASN1Sequence authAttrSeq = ASN1Sequence.getInstance(authenticatedAttributes.getObjectAt(i)); logger.info(authAttrSeq.toString()); @@ -261,20 +260,20 @@ protected void onDocumentSigned(byte[] byteArray) { DigestInfo digestInfo = new DigestInfo(seqDecrypt); assertEquals(oidDigestAlgo, digestInfo.getAlgorithmId().getAlgorithm()); - String decryptedDigestEncodeBase64 = Base64.encodeBase64String(digestInfo.getDigest()); + String decryptedDigestEncodeBase64 = Utils.toBase64(digestInfo.getDigest()); logger.info("Decrypted Base64 : " + decryptedDigestEncodeBase64); byte[] encoded = signedInfo.getAuthenticatedAttributes().getEncoded(); MessageDigest messageDigest = MessageDigest.getInstance(DigestAlgorithm.SHA256.getName()); byte[] digestOfAuthenticatedAttributes = messageDigest.digest(encoded); - String computedDigestEncodeBase64 = Base64.encodeBase64String(digestOfAuthenticatedAttributes); + String computedDigestEncodeBase64 = Utils.toBase64(digestOfAuthenticatedAttributes); logger.info("Computed Base64 : " + computedDigestEncodeBase64); assertEquals(decryptedDigestEncodeBase64, computedDigestEncodeBase64); - IOUtils.closeQuietly(asn1sInput); - IOUtils.closeQuietly(inputDecrypted); + Utils.closeQuietly(asn1sInput); + Utils.closeQuietly(inputDecrypted); } catch (Exception e) { logger.error(e.getMessage(), e); fail(e.getMessage()); diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESWithContentTimestampTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESWithContentTimestampTest.java index 1d981c14c8..98732f33df 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESWithContentTimestampTest.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/signature/CAdESWithContentTimestampTest.java @@ -7,8 +7,6 @@ import java.io.IOException; import java.util.List; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.io.IOUtils; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; @@ -22,6 +20,7 @@ import org.junit.Test; import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CommonCertificateVerifier; import eu.europa.esig.dss.validation.SignedDocumentValidator; import eu.europa.esig.dss.validation.reports.Reports; @@ -35,7 +34,7 @@ public void testContentTimeStamp() throws IOException { File file = new File("src/test/resources/plugtest/cades/CAdES-BES/Sample_Set_11/Signature-C-BES-4.p7m"); FileInputStream fis = new FileInputStream(file); - ASN1InputStream asn1sInput = new ASN1InputStream(IOUtils.toByteArray(fis)); + ASN1InputStream asn1sInput = new ASN1InputStream(Utils.toByteArray(fis)); ASN1Sequence asn1Seq = (ASN1Sequence) asn1sInput.readObject(); ASN1TaggedObject taggedObj = DERTaggedObject.getInstance(asn1Seq.getObjectAt(1)); @@ -66,7 +65,7 @@ public void testContentTimeStamp() throws IOException { DiagnosticData diagnosticData = reports.getDiagnosticData(); List timestampIdList = diagnosticData.getTimestampIdList(diagnosticData.getFirstSignatureId()); - assertTrue(CollectionUtils.isNotEmpty(timestampIdList)); + assertTrue(Utils.isCollectionNotEmpty(timestampIdList)); boolean foundContentTimestamp = false; for (String timestampId : timestampIdList) { @@ -77,8 +76,8 @@ public void testContentTimeStamp() throws IOException { } assertTrue(foundContentTimestamp); - IOUtils.closeQuietly(asn1sInput); - IOUtils.closeQuietly(fis); + Utils.closeQuietly(asn1sInput); + Utils.closeQuietly(fis); } } diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESWithDEREncodedTimestampTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESWithDEREncodedTimestampTest.java index 4b8c6fe144..3984e928c5 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESWithDEREncodedTimestampTest.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/CAdESWithDEREncodedTimestampTest.java @@ -26,8 +26,6 @@ import java.io.IOException; import java.util.List; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.io.IOUtils; import org.bouncycastle.cms.CMSException; import org.bouncycastle.cms.CMSSignedData; import org.junit.Test; @@ -35,6 +33,7 @@ import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.DSSException; import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CommonCertificateVerifier; import eu.europa.esig.dss.validation.SignedDocumentValidator; import eu.europa.esig.dss.validation.reports.Reports; @@ -59,7 +58,7 @@ public void testFile1() { assertNotNull(diagnosticData); List timestampIdList = diagnosticData.getTimestampIdList(diagnosticData.getFirstSignatureId()); - assertTrue(CollectionUtils.isEmpty(timestampIdList)); + assertTrue(Utils.isCollectionEmpty(timestampIdList)); } @Test @@ -75,14 +74,14 @@ public void testFile2() { assertNotNull(diagnosticData); List timestampIdList = diagnosticData.getTimestampIdList(diagnosticData.getFirstSignatureId()); - assertTrue(CollectionUtils.isEmpty(timestampIdList)); + assertTrue(Utils.isCollectionEmpty(timestampIdList)); } @Test public void testFile3() throws DSSException, CMSException, IOException { DSSDocument dssDocument = new FileDocument("src/test/resources/plugtest/esig2014/ESIG-CAdES/DE_CRY/Signature-C-DE_CRY-4.p7m"); - CAdESSignature signature = new CAdESSignature(IOUtils.toByteArray(dssDocument.openStream())); + CAdESSignature signature = new CAdESSignature(Utils.toByteArray(dssDocument.openStream())); CMSSignedData cmsSignedData = signature.getCmsSignedData(); assertNotNull(cmsSignedData); } diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/DSS951Test.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/DSS951Test.java new file mode 100644 index 0000000000..ecc9c911e5 --- /dev/null +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/DSS951Test.java @@ -0,0 +1,38 @@ +package eu.europa.esig.dss.cades.validation; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import eu.europa.esig.dss.DSSDocument; +import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignedDocumentValidator; +import eu.europa.esig.dss.validation.reports.Reports; +import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; +import eu.europa.esig.dss.validation.reports.wrapper.SignatureWrapper; + +public class DSS951Test { + + @Test + public void testFile1() { + DSSDocument dssDocument = new FileDocument("src/test/resources/validation/dss-951/NexU-CAdES-B-B-Detached-Sha512.p7m"); + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(dssDocument); + validator.setCertificateVerifier(new CommonCertificateVerifier()); + Reports reports = validator.validateDocument(); + + // reports.print(); + + DiagnosticData diagnosticData = reports.getDiagnosticData(); + + SignatureWrapper signature = diagnosticData.getSignatureById(diagnosticData.getFirstSignatureId()); + assertTrue(signature.isAttributePresent()); + assertTrue(signature.isDigestValuePresent()); + assertTrue(signature.isDigestValueMatch()); + assertTrue(signature.isIssuerSerialMatch()); + + assertFalse(diagnosticData.isBLevelTechnicallyValid(diagnosticData.getFirstSignatureId())); + } + +} diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/GetOriginalDocumentTest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/GetOriginalDocumentTest.java index fb4cb6471d..f72cf9cf1c 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/GetOriginalDocumentTest.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/GetOriginalDocumentTest.java @@ -1,8 +1,8 @@ package eu.europa.esig.dss.cades.validation; import java.util.Date; +import java.util.List; -import org.apache.commons.io.IOUtils; import org.bouncycastle.util.encoders.Base64; import org.junit.Assert; import org.junit.Test; @@ -20,19 +20,20 @@ import eu.europa.esig.dss.test.TestUtils; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; import eu.europa.esig.dss.validation.SignedDocumentValidator; import eu.europa.esig.dss.validation.reports.Reports; public class GetOriginalDocumentTest { - + private static String HELLO_WORLD = "HELLO WORLD !"; - + @Test public final void getOriginalDocumentFromEnvelopingSignature() throws Exception { DSSDocument document = new InMemoryDocument(HELLO_WORLD.getBytes()); - + CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); @@ -45,25 +46,27 @@ public final void getOriginalDocumentFromEnvelopingSignature() throws Exception CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); CAdESService service = new CAdESService(certificateVerifier); - + ToBeSigned dataToSign = service.getDataToSign(document, signatureParameters); SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign); final DSSDocument signedDocument = service.signDocument(document, signatureParameters, signatureValue); - + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument); validator.setCertificateVerifier(new CommonCertificateVerifier()); Reports reports = validator.validateDocument(); - - DSSDocument removeResult = validator.getOriginalDocument(reports.getDiagnosticData().getFirstSignatureId()); - String firstDocument = new String(IOUtils.toByteArray(document.openStream())); - String secondDocument = new String(IOUtils.toByteArray(removeResult.openStream())); + + List results = validator.getOriginalDocuments(reports.getDiagnosticData().getFirstSignatureId()); + Assert.assertEquals(1, results.size()); + + String firstDocument = new String(Utils.toByteArray(document.openStream())); + String secondDocument = new String(Utils.toByteArray(results.get(0).openStream())); Assert.assertEquals(firstDocument, secondDocument); } - + @Test public final void getOriginalDocumentFromEnvelopingSignatureWithBase64EncodedContent() throws Exception { DSSDocument document = new InMemoryDocument(Base64.encode(HELLO_WORLD.getBytes())); - + CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); @@ -76,25 +79,27 @@ public final void getOriginalDocumentFromEnvelopingSignatureWithBase64EncodedCon CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); CAdESService service = new CAdESService(certificateVerifier); - + ToBeSigned dataToSign = service.getDataToSign(document, signatureParameters); SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign); final DSSDocument signedDocument = service.signDocument(document, signatureParameters, signatureValue); - + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument); validator.setCertificateVerifier(new CommonCertificateVerifier()); Reports reports = validator.validateDocument(); - - DSSDocument removeResult = validator.getOriginalDocument(reports.getDiagnosticData().getFirstSignatureId()); + + List results = validator.getOriginalDocuments(reports.getDiagnosticData().getFirstSignatureId()); + Assert.assertEquals(1, results.size()); + String firstDocument = new String(HELLO_WORLD.getBytes()); - String secondDocument = new String(IOUtils.toByteArray(removeResult.openStream())); + String secondDocument = new String(Utils.toByteArray(results.get(0).openStream())); Assert.assertEquals(firstDocument, secondDocument); } - - @Test(expected=DSSException.class) + + @Test(expected = DSSException.class) public final void getOriginalDocumentFromDetachedSignature() throws Exception { DSSDocument document = new InMemoryDocument(HELLO_WORLD.getBytes()); - + CertificateService certificateService = new CertificateService(); MockPrivateKeyEntry privateKeyEntry = certificateService.generateCertificateChain(SignatureAlgorithm.RSA_SHA256); @@ -107,15 +112,15 @@ public final void getOriginalDocumentFromDetachedSignature() throws Exception { CertificateVerifier certificateVerifier = new CommonCertificateVerifier(); CAdESService service = new CAdESService(certificateVerifier); - + ToBeSigned dataToSign = service.getDataToSign(document, signatureParameters); SignatureValue signatureValue = TestUtils.sign(signatureParameters.getSignatureAlgorithm(), privateKeyEntry, dataToSign); final DSSDocument signedDocument = service.signDocument(document, signatureParameters, signatureValue); - + SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(signedDocument); validator.setCertificateVerifier(new CommonCertificateVerifier()); Reports reports = validator.validateDocument(); - - DSSDocument removeResult = validator.getOriginalDocument(reports.getDiagnosticData().getFirstSignatureId()); + + validator.getOriginalDocuments(reports.getDiagnosticData().getFirstSignatureId()); } } diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/MockDataLoader.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/MockDataLoader.java index 9fb8947f49..3bf42adcf8 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/MockDataLoader.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/MockDataLoader.java @@ -2,24 +2,23 @@ import java.io.IOException; -import org.apache.commons.io.IOUtils; - import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.DSSException; import eu.europa.esig.dss.FileDocument; import eu.europa.esig.dss.client.http.commons.CommonsDataLoader; +import eu.europa.esig.dss.utils.Utils; public class MockDataLoader extends CommonsDataLoader { - + public MockDataLoader() { } - + @Override public byte[] get(final String urlString) { - if(urlString.equals("https://sede.060.gob.es/politica_de_firma_anexo_1.pdf")) { + if (urlString.equals("https://sede.060.gob.es/politica_de_firma_anexo_1.pdf")) { DSSDocument document = new FileDocument("src/test/resources/validation/dss-728/politica_de_firma_anexo_1.pdf"); try { - return IOUtils.toByteArray(document.openStream()); + return Utils.toByteArray(document.openStream()); } catch (IOException e) { throw new DSSException(e); } diff --git a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/PolicySPURITest.java b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/PolicySPURITest.java index 7e62485688..4c4eb9f8a8 100644 --- a/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/PolicySPURITest.java +++ b/dss-cades/src/test/java/eu/europa/esig/dss/cades/validation/PolicySPURITest.java @@ -6,13 +6,16 @@ import java.io.File; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.junit.Test; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.FileDocument; import eu.europa.esig.dss.validation.CommonCertificateVerifier; +import eu.europa.esig.dss.validation.SignaturePolicyProvider; import eu.europa.esig.dss.validation.SignedDocumentValidator; import eu.europa.esig.dss.validation.reports.Reports; import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; @@ -40,7 +43,13 @@ public void test() { public void testWithFilePolicy() { DSSDocument dssDocument = new FileDocument("src/test/resources/validation/dss-728/CADES-B-DETACHED-withpolicy1586434883385020407.cades"); SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(dssDocument); - validator.setPolicyFile(new File("src/test/resources/validation/dss-728/politica_de_firma_anexo_1.pdf")); + + SignaturePolicyProvider signaturePolicyProvider = new SignaturePolicyProvider(); + Map signaturePoliciesByUrl = new HashMap(); + signaturePoliciesByUrl.put("https://sede.060.gob.es/politica_de_firma_anexo_1.pdf", + new FileDocument(new File("src/test/resources/validation/dss-728/politica_de_firma_anexo_1.pdf"))); + signaturePolicyProvider.setSignaturePoliciesByUrl(signaturePoliciesByUrl); + validator.setSignaturePolicyProvider(signaturePolicyProvider); validator.setCertificateVerifier(new CommonCertificateVerifier()); List detachedContents = new ArrayList(); detachedContents.add(new FileDocument("src/test/resources/validation/dss-728/InfoSelladoTiempo.pdf")); diff --git a/dss-cades/src/test/java/known/issues/DSS631/CAdESLevelLTATest.java b/dss-cades/src/test/java/known/issues/DSS631/CAdESLevelLTATest.java index 404cc73cb4..730758147a 100644 --- a/dss-cades/src/test/java/known/issues/DSS631/CAdESLevelLTATest.java +++ b/dss-cades/src/test/java/known/issues/DSS631/CAdESLevelLTATest.java @@ -32,7 +32,7 @@ import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.cades.CAdESSignatureParameters; import eu.europa.esig.dss.cades.signature.CAdESService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -40,7 +40,7 @@ import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -public class CAdESLevelLTATest extends AbstractTestSignature { +public class CAdESLevelLTATest extends AbstractTestDocumentSignatureService { private DocumentSignatureService service; private CAdESSignatureParameters signatureParameters; diff --git a/dss-cades/src/test/java/known/issues/DSS631/CAdESLevelLTTest.java b/dss-cades/src/test/java/known/issues/DSS631/CAdESLevelLTTest.java index ad382ee877..3502e3a905 100644 --- a/dss-cades/src/test/java/known/issues/DSS631/CAdESLevelLTTest.java +++ b/dss-cades/src/test/java/known/issues/DSS631/CAdESLevelLTTest.java @@ -32,7 +32,7 @@ import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.cades.CAdESSignatureParameters; import eu.europa.esig.dss.cades.signature.CAdESService; -import eu.europa.esig.dss.signature.AbstractTestSignature; +import eu.europa.esig.dss.signature.AbstractTestDocumentSignatureService; import eu.europa.esig.dss.signature.DocumentSignatureService; import eu.europa.esig.dss.test.gen.CertificateService; import eu.europa.esig.dss.test.mock.MockPrivateKeyEntry; @@ -40,7 +40,7 @@ import eu.europa.esig.dss.validation.CertificateVerifier; import eu.europa.esig.dss.validation.CommonCertificateVerifier; -public class CAdESLevelLTTest extends AbstractTestSignature { +public class CAdESLevelLTTest extends AbstractTestDocumentSignatureService { private DocumentSignatureService service; private CAdESSignatureParameters signatureParameters; diff --git a/dss-cades/src/test/java/plugtests/ETSISamplesValidationTest.java b/dss-cades/src/test/java/plugtests/ETSISamplesValidationTest.java index 76bec7881a..fd71164459 100644 --- a/dss-cades/src/test/java/plugtests/ETSISamplesValidationTest.java +++ b/dss-cades/src/test/java/plugtests/ETSISamplesValidationTest.java @@ -6,13 +6,13 @@ import java.util.ArrayList; import java.util.Collection; -import org.apache.commons.io.FileUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import eu.europa.esig.dss.FileDocument; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CommonCertificateVerifier; import eu.europa.esig.dss.validation.SignedDocumentValidator; import eu.europa.esig.dss.validation.reports.DetailedReport; @@ -29,7 +29,7 @@ public class ETSISamplesValidationTest { @Parameters(name = "Validation {index} : {0}") public static Collection data() { File folder = new File("src/test/resources/plugtest"); - Collection listFiles = FileUtils.listFiles(folder, new String[] { "p7", "p7b", "p7m", "p7s", "pkcs7", "csig", }, true); + Collection listFiles = Utils.listFiles(folder, new String[] { "p7", "p7b", "p7m", "p7s", "pkcs7", "csig", }, true); Collection dataToRun = new ArrayList(); for (File file : listFiles) { dataToRun.add(new Object[] { file }); diff --git a/dss-cades/src/test/resources/validation/dss-951/NexU-CAdES-B-B-Detached-Sha512.p7m b/dss-cades/src/test/resources/validation/dss-951/NexU-CAdES-B-B-Detached-Sha512.p7m new file mode 100644 index 0000000000..6a12bbee71 Binary files /dev/null and b/dss-cades/src/test/resources/validation/dss-951/NexU-CAdES-B-B-Detached-Sha512.p7m differ diff --git a/dss-common-validation-jaxb/pom.xml b/dss-common-validation-jaxb/pom.xml index 922908b71c..0bfa5779ea 100644 --- a/dss-common-validation-jaxb/pom.xml +++ b/dss-common-validation-jaxb/pom.xml @@ -3,7 +3,7 @@ org.digidoc4j.dss sd-dss - 4.7.RC2.d4j.1 + 5.0.d4j.1 dss-common-validation-jaxb diff --git a/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/jaxb/parsers/DateParser.java b/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/jaxb/parsers/DateParser.java index 7f85701d9b..46cb9d231a 100644 --- a/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/jaxb/parsers/DateParser.java +++ b/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/jaxb/parsers/DateParser.java @@ -2,6 +2,7 @@ import java.text.SimpleDateFormat; import java.util.Date; +import java.util.TimeZone; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -10,11 +11,14 @@ public class DateParser { private static final Logger logger = LoggerFactory.getLogger(DateParser.class); - private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";// "dd/MM/yyyy HH:mm:ss"; + private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; + + private static final TimeZone UTC = TimeZone.getTimeZone("UTC"); public static Date parse(String v) { try { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); + sdf.setTimeZone(UTC); sdf.setLenient(false); return sdf.parse(v); } catch (Exception e) { @@ -26,6 +30,7 @@ public static Date parse(String v) { public static String print(Date v) { if (v != null) { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); + sdf.setTimeZone(UTC); return sdf.format(v); } return null; diff --git a/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/jaxb/parsers/SignatureQualificationParser.java b/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/jaxb/parsers/SignatureQualificationParser.java new file mode 100644 index 0000000000..02bd73c01a --- /dev/null +++ b/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/jaxb/parsers/SignatureQualificationParser.java @@ -0,0 +1,17 @@ +package eu.europa.esig.dss.jaxb.parsers; + +import eu.europa.esig.dss.validation.SignatureQualification; + +public class SignatureQualificationParser { + + public static SignatureQualification parse(String v) { + return SignatureQualification.fromReadable(v); + } + + public static String print(SignatureQualification v) { + if (v != null) { + return v.getReadable(); + } + return null; + } +} diff --git a/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/validation/SignatureQualification.java b/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/validation/SignatureQualification.java new file mode 100644 index 0000000000..de4167f9d0 --- /dev/null +++ b/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/validation/SignatureQualification.java @@ -0,0 +1,167 @@ +package eu.europa.esig.dss.validation; + +import java.util.HashMap; +import java.util.Map; + +public enum SignatureQualification { + + /** + * Qualified Electronic Signature + */ + QESIG("QESig", "Qualified Electronic Signature"), + + /** + * Qualified Electronic Seal + */ + QESEAL("QESeal", "Qualified Electronic Seal"), + + /** + * Qualified Electronic Signature or Seal + */ + QES("QES?", "Qualified Electronic Signature or Seal"), + + /** + * Advanced Electronic Signature supported by a Qualified Certificate + */ + ADESIG_QC("AdESig-QC", "Advanced Electronic Signature supported by a Qualified Certificate"), + + /** + * Advanced Electronic Seal supported by a Qualified Certificate + */ + ADESEAL_QC("AdESeal-QC", "Advanced Electronic Seal supported by a Qualified Certificate"), + + /** + * Advanced Electronic Signature or Seal supported by a Qualified Certificate + */ + ADES_QC("AdES?-QC", "Advanced Electronic Signature or Seal supported by a Qualified Certificate"), + + /** + * Advanced Electronic Signature + */ + ADESIG("AdESig", "Advanced Electronic Signature"), + + /** + * Advanced Electronic Seal + */ + ADESEAL("AdESeal", "Advanced Electronic Seal"), + + /** + * Advanced Electronic Signature or Seal + */ + ADES("AdES?", "Advanced Electronic Signature or Seal"), + + /** + * Indeterminate Qualified Electronic Signature + */ + INDETERMINATE_QESIG("Indeterminate QESig", "Indeterminate Qualified Electronic Signature"), + + /** + * Indeterminate Qualified Electronic Seal + */ + INDETERMINATE_QESEAL("Indeterminate QESeal", "Indeterminate Qualified Electronic Seal"), + + /** + * Indeterminate Qualified Electronic Signature or Seal + */ + INDETERMINATE_QES("Indeterminate QES?", "Indeterminate Qualified Electronic Signature or Seal"), + + /** + * Indeterminate Advanced Electronic Signature supported by a Qualified Certificate + */ + INDETERMINATE_ADESIG_QC("Indeterminate AdESig-QC", "Indeterminate Advanced Electronic Signature supported by a Qualified Certificate"), + + /** + * Indeterminate Advanced Electronic Seal supported by a Qualified Certificate + */ + INDETERMINATE_ADESEAL_QC("Indeterminate AdESeal-QC", "Indeterminate Advanced Electronic Seal supported by a Qualified Certificate"), + + /** + * Indeterminate Advanced Electronic Signature or Seal supported by a Qualified Certificate + */ + INDETERMINATE_ADES_QC("Indeterminate AdES?-QC", "Indeterminate Advanced Electronic Signature or Seal supported by a Qualified Certificate"), + + /** + * Indeterminate Advanced Electronic Signature + */ + INDETERMINATE_ADESIG("Indeterminate AdESig", "Indeterminate Advanced Electronic Signature"), + + /** + * Indeterminate Advanced Electronic Seal + */ + INDETERMINATE_ADESEAL("Indeterminate AdESeal", "Indeterminate Advanced Electronic Seal"), + + /** + * Indeterminate Advanced Electronic Signature or Seal + */ + INDETERMINATE_ADES("Indeterminate AdES?", "Indeterminate Advanced Electronic Signature or Seal"), + + /** + * Not Advanced Electronic Signature but supported by a Qualified Certificate + */ + NOT_ADES_QC_QSCD("Not AdES but QC with QSCD", "Not Advanced Electronic Signature but supported by a Qualified Certificate"), + + /** + * Not Advanced Electronic Signature but supported by a Qualified Certificate + */ + NOT_ADES_QC("Not AdES but QC", "Not Advanced Electronic Signature but supported by a Qualified Certificate"), + + /** + * Not Advanced Electronic Signature + */ + NOT_ADES("Not AdES", "Not Advanced Electronic Signature"), + + /** + * Not Applicable + */ + NA("N/A", "Not applicable"); + + private static class Registry { + + private final static Map QUALIFS_BY_READABLE = registerByReadable(); + + private static Map registerByReadable() { + final Map map = new HashMap(); + for (final SignatureQualification qualification : values()) { + map.put(qualification.readable, qualification); + } + return map; + } + } + + private final String readable; + private final String label; + + private SignatureQualification(String readable, String label) { + this.readable = readable; + this.label = label; + } + + public String getReadable() { + return readable; + } + + public String getLabel() { + return label; + } + + /** + * SignatureQualification can be null + */ + public static SignatureQualification forName(String value) { + if ((value != null) && !value.isEmpty()) { + return SignatureQualification.valueOf(value); + } + return null; + } + + /** + * SignatureQualification can be null + */ + public static SignatureQualification fromReadable(String readable) { + if ((readable != null) && !readable.isEmpty()) { + return Registry.QUALIFS_BY_READABLE.get(readable); + } + return null; + } + +} diff --git a/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/validation/policy/rules/SubIndication.java b/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/validation/policy/rules/SubIndication.java index 701e7dab3b..ef1ac420e3 100644 --- a/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/validation/policy/rules/SubIndication.java +++ b/dss-common-validation-jaxb/src/main/java/eu/europa/esig/dss/validation/policy/rules/SubIndication.java @@ -43,6 +43,7 @@ public enum SubIndication { REVOKED, EXPIRED, NO_POE, + CERTIFICATE_CHAIN_GENERAL_FAILURE, /** * Added to handle any unexpected error encountered during the validation process. diff --git a/dss-cookbook/pom.xml b/dss-cookbook/pom.xml index 15edab9179..15f74c6ddf 100644 --- a/dss-cookbook/pom.xml +++ b/dss-cookbook/pom.xml @@ -5,7 +5,7 @@ org.digidoc4j.dss sd-dss - 4.7.RC2.d4j.1 + 5.0.d4j.1 CookBook @@ -21,46 +21,56 @@ - org.digidoc4j.dss + ${project.groupId} dss-document - org.digidoc4j.dss + ${project.groupId} dss-service - org.digidoc4j.dss + ${project.groupId} dss-tsl-validation - org.digidoc4j.dss + ${project.groupId} dss-test compile - org.digidoc4j.dss - dss-asic + ${project.groupId} + dss-asic-cades - org.digidoc4j.dss + ${project.groupId} + dss-asic-xades + + + ${project.groupId} dss-cades - org.digidoc4j.dss + ${project.groupId} dss-pades - org.digidoc4j.dss + ${project.groupId} dss-xades - org.digidoc4j.dss + ${project.groupId} dss-token be.fedict.eid-applet eid-applet-service 1.1.3 + + + commons-io + commons-io + + be.fedict.eid-applet @@ -73,11 +83,6 @@ 1.1.3 - - junit - junit - test - diff --git a/dss-cookbook/src/main/asciidoc/dss-documentation.adoc b/dss-cookbook/src/main/asciidoc/dss-documentation.adoc index 85f0daa9dc..f6489cbdcf 100644 --- a/dss-cookbook/src/main/asciidoc/dss-documentation.adoc +++ b/dss-cookbook/src/main/asciidoc/dss-documentation.adoc @@ -12,7 +12,7 @@ This document describes some examples of how to develop in Java using the DSS fr === Scope of the document -This document provides examples of code which allow easy handling of digital signatures. The examples are consistent with the Release {dssVersion} of DSS framework which can be downloaded via https://joinup.ec.europa.eu/software/sd-dss/release/all +This document provides examples of code which allow easy handling of digital signatures. The examples are consistent with the Release {dssVersion} of DSS framework which can be downloaded via https://ec.europa.eu/cefdigital/wiki/display/CEFDIGITAL/DSS+-+releases Three main features can be distinguished within the framework : @@ -139,9 +139,12 @@ Please note that the DSS framework is still under maintenance and new features w === Useful links - * https://joinup.ec.europa.eu/asset/sd-dss/description[Joinup] - * https://github.com/esig/dss[Source code] - * https://esig-dss.atlassian.net/projects/DSS[Report a bug] + * https://ec.europa.eu/cefdigital/wiki/display/CEFDIGITAL/eSignature[CEF Digital] + * https://github.com/esig/dss[Source code (GitHub)] + * https://ec.europa.eu/cefdigital/code/projects/ESIG/repos/dss/browse[Source code (EC Bitbucket)] + * https://ec.europa.eu/cefdigital/code/projects/ESIG/repos/dss-demos/browse[Source code demonstrations (EC Bitbucket)] + * https://ec.europa.eu/cefdigital/tracker/projects/DSS/issues[Report an issue (EC Jira)] + * https://esig-dss.atlassian.net/projects/DSS[Old Jira] == General framework structure @@ -151,7 +154,9 @@ DSS framework is a multi-modules project which can be builded with Maven. dss-model:: Data model used in almost every modules. dss-token:: Token definitions and implementations for MS CAPI, PKCS#11, PKCS#12. dss-document:: Common module to sign and validate document. This module doen't contain any implementation. -dss-asic:: Implementation of the ASiC-S and ASiC-E signature, extension and validation. +dss-asic-common:: Common code which is shared between dss-asic-xades and dss-asic-cades. +dss-asic-cades:: Implementation of the ASiC-S and ASiC-E signature, extension and validation based on CAdES signatures. +dss-asic-xades:: Implementation of the ASiC-S and ASiC-E signature, extension and validation based on XAdES signatures. dss-cades:: Implementation of the CAdES signature, extension and validation. dss-pades:: Implementation of the PAdES signature, extension and validation. dss-xades:: Implementation of the XAdES signature, extension and validation. @@ -569,7 +574,8 @@ Below is the simplest example of the validation of the signature of a document. * XMLDocumentValidator, * CMSDocumentValidator, * PDFDocumentValidator, - * ASiCXMLDocumentValidator. + * ASiCContainerWithXAdESValidator, + * ASiCContainerWithCAdESValidator. The next step is to create an object that will check the status of a certificate using the Trusted List model (see "Trusted Lists of Certification Service Provider" for more information). In our example, this object is instantiated from the TrustedListCertificateVerifier class. In turn, this object needs an OCSP and/or CRL source and a TSL source (which defines how the certificates are retrieved from the Trusted Lists). See chapter "Management of CRL and OCSP Sources" for more information concerning sources. @@ -824,7 +830,7 @@ include::{sourcetestdir}/eu/europa/esig/dss/cookbook/example/sign/SignPdfASiCSEW Please note that you need to pass only few parameters to the service. Other parameters, although are positioned, will be overwritten by the internal implementation of the service. Therefore, the obtained signature is always based on XAdES and of DETACHED packaging. -It is also possible with the framework DSS to make an extension of an ASICS signature to the level XAdES-BASELINE-T or -LT. +It is also possible with the framework DSS to make an extension of an ASiC container to the level XAdES-BASELINE-T or -LT. == Management of signature tokens diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/CreateKeyStoreApp.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/CreateKeyStoreApp.java index 355a2d6f3f..ba5d882e0a 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/CreateKeyStoreApp.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/CreateKeyStoreApp.java @@ -11,12 +11,10 @@ import java.util.Enumeration; import java.util.List; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.io.IOUtils; - +import eu.europa.esig.dss.DSSASN1Utils; import eu.europa.esig.dss.DSSUtils; import eu.europa.esig.dss.DigestAlgorithm; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.x509.CertificateToken; import eu.europa.esig.dss.x509.KeyStoreCertificateSource; @@ -38,7 +36,7 @@ public static void main(String[] args) throws Exception { OutputStream fos = new FileOutputStream(KEYSTORE_FILEPATH); store.store(fos, KEYSTORE_PASSWORD.toCharArray()); - IOUtils.closeQuietly(fos); + Utils.closeQuietly(fos); readKeyStore(); @@ -53,30 +51,30 @@ public static void main(String[] args) throws Exception { private static void addCertificate(KeyStore store, String filepath) throws Exception { InputStream fis = new FileInputStream(filepath); - CertificateToken europanCert = DSSUtils.loadCertificate(fis); - if (europanCert.isExpiredOn(new Date())) { - throw new RuntimeException("Certificate " + europanCert.getSubjectShortName() + " is expired"); + CertificateToken europeanCert = DSSUtils.loadCertificate(fis); + if (europeanCert.isExpiredOn(new Date())) { + throw new RuntimeException("Certificate " + DSSASN1Utils.getSubjectCommonName(europeanCert) + " is expired"); } System.out.println("Adding certificate " + filepath); - displayCertificateDigests(europanCert); + displayCertificateDigests(europeanCert); // DSSID as key (used in the administration screen) - store.setCertificateEntry(europanCert.getDSSIdAsString(), europanCert.getCertificate()); - IOUtils.closeQuietly(fis); + store.setCertificateEntry(europeanCert.getDSSIdAsString(), europeanCert.getCertificate()); + Utils.closeQuietly(fis); } - private static void displayCertificateDigests(CertificateToken europanCert) { - byte[] digestSHA256 = DSSUtils.digest(DigestAlgorithm.SHA256, europanCert.getEncoded()); - byte[] digestSHA1 = DSSUtils.digest(DigestAlgorithm.SHA1, europanCert.getEncoded()); - System.out.println(europanCert.getSubjectShortName()); + private static void displayCertificateDigests(CertificateToken europeanCert) { + byte[] digestSHA256 = DSSUtils.digest(DigestAlgorithm.SHA256, europeanCert.getEncoded()); + byte[] digestSHA1 = DSSUtils.digest(DigestAlgorithm.SHA1, europeanCert.getEncoded()); + System.out.println(DSSASN1Utils.getSubjectCommonName(europeanCert)); System.out.println("SHA256 digest (Hex) : " + getPrintableHex(digestSHA256)); System.out.println("SHA1 digest (Hex) : " + getPrintableHex(digestSHA1)); - System.out.println("SHA256 digest (Base64) : " + Base64.encodeBase64String(digestSHA256)); - System.out.println("SHA1 digest (Base64) : " + Base64.encodeBase64String(digestSHA1)); + System.out.println("SHA256 digest (Base64) : " + Utils.toBase64(digestSHA256)); + System.out.println("SHA1 digest (Base64) : " + Utils.toBase64(digestSHA1)); } private static String getPrintableHex(byte[] digest) { - String hexString = Hex.encodeHexString(digest); + String hexString = Utils.toHex(digest); // Add space every two characters return hexString.replaceAll("..", "$0 "); } @@ -97,7 +95,7 @@ private static void readKeyStore() throws Exception { } } - IOUtils.closeQuietly(fis); + Utils.closeQuietly(fis); } private static KeyStore createKeyStore() throws Exception { @@ -106,7 +104,7 @@ private static KeyStore createKeyStore() throws Exception { OutputStream fos = new FileOutputStream(KEYSTORE_FILEPATH); trustStore.store(fos, KEYSTORE_PASSWORD.toCharArray()); - IOUtils.closeQuietly(fos); + Utils.closeQuietly(fos); return trustStore; } diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/Cookbook.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/Cookbook.java index 7f5519250d..c357773164 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/Cookbook.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/Cookbook.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.cookbook.example; +import java.io.IOException; import java.net.URL; import eu.europa.esig.dss.DSSDocument; @@ -89,10 +90,12 @@ protected static void preparePdfDoc() { /** * This method sets the common parameters. + * + * @throws IOException */ - protected static void preparePKCS12TokenAndKey() { + protected static void preparePKCS12TokenAndKey() throws IOException { String pkcs12TokenFile = getPathFromResource("/user_a_rsa.p12"); - signingToken = new Pkcs12SignatureToken("password", pkcs12TokenFile); + signingToken = new Pkcs12SignatureToken(pkcs12TokenFile, "password"); privateKey = signingToken.getKeys().get(0); } diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/EidNativeSignatureTokenConnection.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/EidNativeSignatureTokenConnection.java index e348c31bfd..a08b0507fb 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/EidNativeSignatureTokenConnection.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/EidNativeSignatureTokenConnection.java @@ -20,7 +20,6 @@ */ package eu.europa.esig.dss.cookbook.example.sign; -import java.security.NoSuchAlgorithmException; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; @@ -32,14 +31,18 @@ import be.fedict.eid.applet.Messages; import be.fedict.eid.applet.sc.PcscEid; import eu.europa.esig.dss.DSSException; +import eu.europa.esig.dss.DSSUtils; import eu.europa.esig.dss.DigestAlgorithm; +import eu.europa.esig.dss.SignatureAlgorithm; +import eu.europa.esig.dss.SignatureValue; +import eu.europa.esig.dss.ToBeSigned; import eu.europa.esig.dss.cookbook.sources.AppletView; import eu.europa.esig.dss.cookbook.sources.EidPrivateKeyEntry; -import eu.europa.esig.dss.token.AbstractSignatureTokenConnection; import eu.europa.esig.dss.token.DSSPrivateKeyEntry; +import eu.europa.esig.dss.token.SignatureTokenConnection; import eu.europa.esig.dss.x509.CertificateToken; -public class EidNativeSignatureTokenConnection extends AbstractSignatureTokenConnection { +public class EidNativeSignatureTokenConnection implements SignatureTokenConnection { private static final Logger logger = LoggerFactory.getLogger(EidNativeSignatureTokenConnection.class); @@ -58,27 +61,38 @@ public void close() { } @Override - public List getKeys() { + public SignatureValue sign(ToBeSigned toBeSigned, DigestAlgorithm digestAlgorithm, DSSPrivateKeyEntry keyEntry) + throws DSSException { + + if (digestAlgorithm != DigestAlgorithm.SHA1) { + throw new RuntimeException("Only SH1 supported in cookbook"); + } + + byte[] digestValue = DSSUtils.digest(digestAlgorithm, toBeSigned.getBytes()); + try { eid.isEidPresent(); - - List signatureChain = eid.getSignCertificateChain(); - List entries = new ArrayList(); - entries.add(new EidPrivateKeyEntry(new CertificateToken(signatureChain.get(0)), signatureChain)); - return entries; + byte[] sig = this.eid.sign(digestValue, digestAlgorithm.getName()); + SignatureValue sigval = new SignatureValue(SignatureAlgorithm.RSA_SHA1, sig); + return sigval; } catch (Exception e) { - logger.error("An error occured while retrieving keys : " + e.getMessage(), e); + logger.error("An error occured while signing : " + e.getMessage(), e); throw new DSSException(e); } + } - // @Override - public byte[] encryptDigest(byte[] digestValue, DigestAlgorithm digestAlgo, DSSPrivateKeyEntry keyEntry) throws NoSuchAlgorithmException { + @Override + public List getKeys() { try { eid.isEidPresent(); - return eid.sign(digestValue, digestAlgo.getName()); + + List signatureChain = eid.getSignCertificateChain(); + List entries = new ArrayList(); + entries.add(new EidPrivateKeyEntry(new CertificateToken(signatureChain.get(0)), signatureChain)); + return entries; } catch (Exception e) { - logger.error("An error occured while encrypting digest : " + e.getMessage(), e); + logger.error("An error occured while retrieving keys : " + e.getMessage(), e); throw new DSSException(e); } } diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBAllDataObjectsTimestamp.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBAllDataObjectsTimestamp.java index 0da93bc033..04049bd087 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBAllDataObjectsTimestamp.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBAllDataObjectsTimestamp.java @@ -97,7 +97,7 @@ public static void main(String[] args) throws IOException { contentTimestamps.add(timestampToken); signatureParameters.setContentTimestamps(contentTimestamps); } catch (Exception e) { - new DSSException("Error during MockTspSource", e); + throw new DSSException("Error during MockTspSource", e); } // Create the signature, including the AllDataObjectsTimestamp CommonCertificateVerifier verifier = new CommonCertificateVerifier(); diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SigningApplication.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SigningApplication.java index e9916cabaa..c1ec435c4e 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SigningApplication.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/sign/SigningApplication.java @@ -23,8 +23,6 @@ import java.io.IOException; import java.util.Date; -import org.apache.commons.io.IOUtils; - import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.FileDocument; import eu.europa.esig.dss.SignatureLevel; @@ -32,6 +30,7 @@ import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; import eu.europa.esig.dss.cookbook.example.Cookbook; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.CommonCertificateVerifier; import eu.europa.esig.dss.xades.XAdESSignatureParameters; import eu.europa.esig.dss.xades.signature.XAdESService; @@ -57,6 +56,6 @@ public static void main(String[] args) throws IOException { ToBeSigned dataToSign = service.getDataToSign(toBeSigned, params); SignatureValue signatureValue = signingToken.sign(dataToSign, params.getDigestAlgorithm(), privateKey); DSSDocument signedDocument = service.signDocument(toBeSigned, params, signatureValue); - IOUtils.copy(signedDocument.openStream(), System.out); + Utils.copy(signedDocument.openStream(), System.out); } } diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBWithCustomPolicy.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBWithCustomPolicy.java index 96f3755b00..2fbb010dbf 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBWithCustomPolicy.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBWithCustomPolicy.java @@ -68,7 +68,7 @@ public static void main(String[] args) throws IOException { verifier.setTrustedCertSource(trustedCertSource); validator.setCertificateVerifier(verifier); - Reports reports = validator.validateDocument(getPathFromResource("/constraints.xml")); + Reports reports = validator.validateDocument(getPathFromResource("/constraint.xml")); InputStream is = new ByteArrayInputStream(reports.getXmlSimpleReport().getBytes("UTF-8")); DSSUtils.saveToFile(is, "target/validationXmlXadesBWithCustomPolicy_simpleReport.xml"); diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/AlwaysValidOCSPSource.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/AlwaysValidOCSPSource.java index b3083a6f0e..6bad637ded 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/AlwaysValidOCSPSource.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/AlwaysValidOCSPSource.java @@ -45,7 +45,6 @@ import org.bouncycastle.cert.ocsp.OCSPReqBuilder; import org.bouncycastle.cert.ocsp.Req; import org.bouncycastle.cert.ocsp.RevokedStatus; -import org.bouncycastle.cert.ocsp.SingleResp; import org.bouncycastle.cert.ocsp.UnknownStatus; import org.bouncycastle.cert.ocsp.jcajce.JcaBasicOCSPRespBuilder; import org.bouncycastle.jce.provider.BouncyCastleProvider; @@ -198,11 +197,10 @@ public OCSPToken getOCSPToken(CertificateToken certificateToken, CertificateToke final X509CertificateHolder x509CertificateHolder = new X509CertificateHolder(issuerCert.getEncoded()); final X509CertificateHolder[] chain = { x509CertificateHolder }; BasicOCSPResp basicResp = basicOCSPRespBuilder.build(contentSigner, chain, ocspDate); - final SingleResp[] responses = basicResp.getResponses(); - final OCSPToken ocspToken = new OCSPToken(); + CertificateID certId = DSSRevocationUtils.getOCSPCertificateID(certificateToken, issuerCertificateToken); + ocspToken.setCertId(certId); ocspToken.setBasicOCSPResp(basicResp); - ocspToken.setBestSingleResp(responses[0]); return ocspToken; } catch (OCSPException e) { throw new DSSException(e); diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/EidPrivateKeyEntry.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/EidPrivateKeyEntry.java index b88e59c3e2..a6fe3a4ac1 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/EidPrivateKeyEntry.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/EidPrivateKeyEntry.java @@ -42,7 +42,9 @@ public EidPrivateKeyEntry(CertificateToken certificate, List si this.certificate = certificate; certificateChain = new CertificateToken[signatureChain.size()]; - certificateChain = signatureChain.toArray(certificateChain); + for (int i = 0; i < signatureChain.size(); i++) { + certificateChain[i] = new CertificateToken(signatureChain.get(i)); + } } @Override diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/JavaKeyStoreTool.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/JavaKeyStoreTool.java index 7f7d963d55..e7825dddb3 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/JavaKeyStoreTool.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/JavaKeyStoreTool.java @@ -23,50 +23,46 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; +import java.security.GeneralSecurityException; import java.security.Key; import java.security.KeyStore; import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; -import java.security.UnrecoverableKeyException; import java.security.cert.Certificate; -import java.security.cert.CertificateException; import java.security.cert.X509Certificate; -import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import eu.europa.esig.dss.DSSException; import eu.europa.esig.dss.token.KSPrivateKeyEntry; +import eu.europa.esig.dss.utils.Utils; public class JavaKeyStoreTool { + private static final Logger logger = LoggerFactory.getLogger(JavaKeyStoreTool.class); + protected KeyStore ks = null; public JavaKeyStoreTool(final String ksUrlLocation, final String ksPassword) { - InputStream ksStream = null; try { final URL ksLocation = new URL(ksUrlLocation); ks = KeyStore.getInstance(KeyStore.getDefaultType()); ksStream = ksLocation.openStream(); ks.load(ksStream, (ksPassword == null) ? null : ksPassword.toCharArray()); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (CertificateException e) { - e.printStackTrace(); + } catch (GeneralSecurityException e) { + logger.error(e.getMessage(), e); } catch (IOException e) { - e.printStackTrace(); - } catch (KeyStoreException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); } finally { - IOUtils.closeQuietly(ksStream); + Utils.closeQuietly(ksStream); } } public X509Certificate getCertificate(String certAlias, String password) { try { - Certificate cert = ks.getCertificate(certAlias); if (cert == null) { return null; @@ -76,7 +72,6 @@ public X509Certificate getCertificate(String certAlias, String password) { } return (X509Certificate) cert; } catch (KeyStoreException e) { - throw new DSSException(e); } } @@ -94,13 +89,9 @@ public KSPrivateKeyEntry getPrivateKey(String certAlias, String password) { } final Certificate[] certificateChain = ks.getCertificateChain(certAlias); KeyStore.PrivateKeyEntry privateKey = new KeyStore.PrivateKeyEntry((PrivateKey) key, certificateChain); - KSPrivateKeyEntry ksPrivateKey = new KSPrivateKeyEntry(privateKey); + KSPrivateKeyEntry ksPrivateKey = new KSPrivateKeyEntry(certAlias, privateKey); return ksPrivateKey; - } catch (KeyStoreException e) { - throw new DSSException(e); - } catch (UnrecoverableKeyException e) { - throw new DSSException(e); - } catch (NoSuchAlgorithmException e) { + } catch (GeneralSecurityException e) { throw new DSSException(e); } } diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/JksCertificateInformation.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/JksCertificateInformation.java index 9f3d47192a..adc68f1c81 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/JksCertificateInformation.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/sources/JksCertificateInformation.java @@ -46,7 +46,7 @@ public static void main(final String[] args) throws IOException { try { url = new File(Cookbook.getPathFromResource("/myJks.jks")).toURI().toURL(); } catch (final MalformedURLException e) { - logger.equals(e); + logger.error(e.getMessage(),e); } System.out.println(url.toString()); JKSSignatureToken jksSignatureToken = new JKSSignatureToken(url.openStream(), "password"); diff --git a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/timestamp/TimestampService.java b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/timestamp/TimestampService.java index 0a229ca353..eaf82fb2af 100644 --- a/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/timestamp/TimestampService.java +++ b/dss-cookbook/src/main/java/eu/europa/esig/dss/cookbook/timestamp/TimestampService.java @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.codec.binary.Base64; import org.apache.xml.security.signature.Reference; import org.apache.xml.security.signature.XMLSignatureException; import org.bouncycastle.tsp.TimeStampToken; @@ -40,6 +39,7 @@ import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.SignaturePackaging; import eu.europa.esig.dss.TimestampParameters; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.validation.AdvancedSignature; import eu.europa.esig.dss.validation.CommonCertificateVerifier; import eu.europa.esig.dss.validation.SignedDocumentValidator; @@ -67,14 +67,14 @@ public class TimestampService { private final XPathQueryHolder xPathQueryHolder; private final CommonCertificateVerifier commonCertificateVerifier = new CommonCertificateVerifier(true); - // TODO (12/09/2014): To be replaced for the new release (4.2.0) private final String fakeSignatureValue = "kKk8sPvKC4RN1/W8Uqan2zgqNCH2Uh6I4/uQPha25W6Lz6poWuxmi9y8/iCR2anbFb1k4n3d0eJxzWzdD4ubz478it9J0jhFi/4ANFJG+FVrWqH9gw/nXnfy2nULQOY466HE172mIAjKjWdPrpo6z1IRWHYbzNbL4iSO8BxqMx0="; /** * Basic constructor, new CertificatePool created * - * @param tspSource The TSPSource to be used for the Timestamp generation + * @param tspSource + * The TSPSource to be used for the Timestamp generation */ public TimestampService(final TSPSource tspSource) { if (tspSource == null) { @@ -85,12 +85,13 @@ public TimestampService(final TSPSource tspSource) { xPathQueryHolder = new XPathQueryHolder(); } - /** * Alternative constructor * - * @param tspSource The TSPSource to be used for the Timestamp generation - * @param certificatePool The CertificatePool to be used for the TimestampToken + * @param tspSource + * The TSPSource to be used for the Timestamp generation + * @param certificatePool + * The CertificatePool to be used for the TimestampToken */ public TimestampService(final TSPSource tspSource, final CertificatePool certificatePool) { @@ -109,7 +110,8 @@ public TimestampService(final TSPSource tspSource, final CertificatePool certifi /** * Method that generates a ContentTimestamp as a DSSDocument * - * @param externalParameters the original signature parameters + * @param externalParameters + * the original signature parameters * @return contentTimestamp as an InMemoryDocument */ public DSSDocument generateCAdESContentTimestamp(final XAdESSignatureParameters externalParameters) { @@ -124,18 +126,19 @@ public DSSDocument generateCAdESContentTimestamp(final XAdESSignatureParameters * Method that generates a ContentTimestamp as a DSS TimestampToken * * * - * @param externalParameters the original signature parameters + * @param externalParameters + * the original signature parameters * @return the ContentTimestamp as a DSS TimestampToken */ public TimestampToken generateCAdESContentTimestampAsTimestampToken(final XAdESSignatureParameters externalParameters) { - - final byte[] bytes = DSSUtils.toByteArray(externalParameters.getDetachedContent()); + final byte[] bytes = DSSUtils.toByteArray(externalParameters.getDetachedContents().get(0)); final TimestampToken token = generateTimestampToken(TimestampType.CONTENT_TIMESTAMP, externalParameters, bytes); return token; } /** - * Method that generates a XAdES ContentTimestamp (either an ALL DATA OBJECTS TIMESTAMP or an INDIVIDUAL DATA OBJECTS TIMESTAMP) and returns + * Method that generates a XAdES ContentTimestamp (either an ALL DATA OBJECTS TIMESTAMP or an INDIVIDUAL DATA + * OBJECTS TIMESTAMP) and returns * it as a TimestampToken * * @param toSignDocument @@ -149,34 +152,35 @@ public TimestampToken generateXAdESContentTimestampAsTimestampToken(final DSSDoc if (externalParameters == null) { throw new NullPointerException(); } - //1. Set initial parameters + // 1. Set initial parameters final XAdESSignatureParameters signatureParameters = setSignatureParameters(externalParameters); - //2. Build temporary signature structure + // 2. Build temporary signature structure final XAdESLevelBaselineB levelBaselineB = new XAdESLevelBaselineB(commonCertificateVerifier); - byte[] signatureValueBytes = Base64.decodeBase64(fakeSignatureValue); + byte[] signatureValueBytes = Utils.fromBase64(fakeSignatureValue); final DSSDocument fullSignature = levelBaselineB.signDocument(toSignDocument, signatureParameters, signatureValueBytes); final List references = getReferencesFromValidatedSignature(toSignDocument, fullSignature); - //4. Concatenate byte value of references, excluding references of type SignedProperties + // 4. Concatenate byte value of references, excluding references of type SignedProperties byte[] concatenatedReferences = concatenateReferencesAsByteArray(references); - //5. Generate ContentTimestamp using the concatenated references + // 5. Generate ContentTimestamp using the concatenated references switch (timestampType) { - case ALL_DATA_OBJECTS_TIMESTAMP: - case INDIVIDUAL_DATA_OBJECTS_TIMESTAMP: - return generateTimestampToken(timestampType, externalParameters, concatenatedReferences); - default: - throw new DSSException("Incompatible timestamp type"); + case ALL_DATA_OBJECTS_TIMESTAMP: + case INDIVIDUAL_DATA_OBJECTS_TIMESTAMP: + return generateTimestampToken(timestampType, externalParameters, concatenatedReferences); + default: + throw new DSSException("Incompatible timestamp type"); } } /** * Concatenates a set of given {@code Reference} into a byte array * - * @param references the references to concatenate + * @param references + * the references to concatenate * @return the concatenated references as a byte array */ private byte[] concatenateReferencesAsByteArray(final List references) { @@ -185,7 +189,7 @@ private byte[] concatenateReferencesAsByteArray(final List references final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); for (final Reference reference : references) { - //References of type "SignedProperties" are excluded + // References of type "SignedProperties" are excluded if (!xPathQueryHolder.XADES_SIGNED_PROPERTIES.equals(reference.getType())) { try { final byte[] referencedBytes = reference.getReferencedBytes(); @@ -202,12 +206,16 @@ private byte[] concatenateReferencesAsByteArray(final List references } /** - * Method that generates a XAdES ContentTimestamp (either an ALL DATA OBJECTS TIMESTAMP or an INDIVIDUAL DATA OBJECTS TIMESTAMP) and returns + * Method that generates a XAdES ContentTimestamp (either an ALL DATA OBJECTS TIMESTAMP or an INDIVIDUAL DATA + * OBJECTS TIMESTAMP) and returns * it as a DSSDocument * - * @param toSignDocument the document for which a content timestamp must be generated - * @param externalParameters the original signature parameters - * @param timestampType the contentTimestamp type, either ALL_DATA_OBJECTS_TIMESTAMP or INDIVIDUAL_DATA_OBJECTS_TIMESTAMP + * @param toSignDocument + * the document for which a content timestamp must be generated + * @param externalParameters + * the original signature parameters + * @param timestampType + * the contentTimestamp type, either ALL_DATA_OBJECTS_TIMESTAMP or INDIVIDUAL_DATA_OBJECTS_TIMESTAMP * @return a ContentTimestamp as a DSSDocument */ public DSSDocument generateXAdESContentTimestampAsDSSDocument(final DSSDocument toSignDocument, final XAdESSignatureParameters externalParameters, @@ -217,14 +225,18 @@ public DSSDocument generateXAdESContentTimestampAsDSSDocument(final DSSDocument } /** - * Method that generates a TimestampToken given a TimestampType, a set of signature parameters and a byte array containing the concatenated references + * Method that generates a TimestampToken given a TimestampType, a set of signature parameters and a byte array + * containing the concatenated references * - * @param timestampType The TimestampType for the TimestampToken - * @param signatureParameters The signature parameters from which the contentTimestamp parameters must be retrieved + * @param timestampType + * The TimestampType for the TimestampToken + * @param signatureParameters + * The signature parameters from which the contentTimestamp parameters must be retrieved * @param references * @return */ - public TimestampToken generateTimestampToken(final TimestampType timestampType, final XAdESSignatureParameters signatureParameters, final byte[] references) { + public TimestampToken generateTimestampToken(final TimestampType timestampType, final XAdESSignatureParameters signatureParameters, + final byte[] references) { if (timestampType == null) { throw new NullPointerException(); @@ -246,14 +258,14 @@ public TimestampToken generateTimestampToken(final TimestampType timestampType, if (LOG.isTraceEnabled()) { LOG.trace("Bytes to digest : [" + new String(references) + "]"); - LOG.trace("Digest to timestamp: " + Base64.encodeBase64String(digest)); + LOG.trace("Digest to timestamp: " + Utils.toBase64(digest)); } final TimeStampToken timeStampResponse = tspSource.getTimeStampResponse(digestAlgorithm, digest); final TimestampToken token = new TimestampToken(timeStampResponse, timestampType, certificatePool); token.setCanonicalizationMethod(contentTimestampParameters.getCanonicalizationMethod()); - //Case of XAdES INDIVIDUAL DATA OBJECTS TIMESTAMP: Timestamp Includes must be generated for each reference + // Case of XAdES INDIVIDUAL DATA OBJECTS TIMESTAMP: Timestamp Includes must be generated for each reference if (TimestampType.INDIVIDUAL_DATA_OBJECTS_TIMESTAMP.equals(timestampType)) { addTimestampTokenIncludes(signatureParameters.getReferences(), token); } @@ -263,7 +275,8 @@ public TimestampToken generateTimestampToken(final TimestampType timestampType, /** * Method setting the signature parameters used to generate the intermediary signature (XAdES-specific) * - * @param externalParameters the original signature parameters + * @param externalParameters + * the original signature parameters * @return a set of signature parameters */ private XAdESSignatureParameters setSignatureParameters(final XAdESSignatureParameters externalParameters) { @@ -297,8 +310,10 @@ private SignedDocumentValidator validateTemporarySignature(final DSSDocument toS /** * Retrieves the references from a validated signature * - * @param toSignDocument the document for which a content timestamp must be generated - * @param signature the signature value + * @param toSignDocument + * the document for which a content timestamp must be generated + * @param signature + * the signature value * @return */ private List getReferencesFromValidatedSignature(final DSSDocument toSignDocument, final DSSDocument signature) { @@ -314,10 +329,13 @@ private List getReferencesFromValidatedSignature(final DSSDocument to } /** - * Adds a set of Timestamp Includes to a given Timestamp Token, based on the references that the Timestamp Token was built upon + * Adds a set of Timestamp Includes to a given Timestamp Token, based on the references that the Timestamp Token was + * built upon * - * @param references the references the timestamp token was built upon - * @param token the timestamp token to which the includes must be added + * @param references + * the references the timestamp token was built upon + * @param token + * the timestamp token to which the includes must be added * @return the updated Timestamp token, containing the set of Includes */ private TimestampToken addTimestampTokenIncludes(final List references, final TimestampToken token) { diff --git a/dss-validation-rest-client/src/test/resources/constraint.xml b/dss-cookbook/src/main/resources/constraint.xml similarity index 57% rename from dss-validation-rest-client/src/test/resources/constraint.xml rename to dss-cookbook/src/main/resources/constraint.xml index c425e21910..f4c3b00393 100644 --- a/dss-validation-rest-client/src/test/resources/constraint.xml +++ b/dss-cookbook/src/main/resources/constraint.xml @@ -1,40 +1,72 @@ - - Validate electronic signatures and indicates whether they are Advanced electronic Signatures (AdES), AdES supported by a Qualified Certificate (AdES/QC) or a Qualified electronic Signature (QES). All certificates and their related chains supporting the signatures are validated against the EU Member State Trusted Lists (this includes signer's certificate and certificates used to validate certificate validity status services - CRLs, OCSP, and time-stamps). + + Validate electronic signatures and indicates whether they are Advanced electronic Signatures (AdES), AdES supported by a Qualified Certificate (AdES/QC) or a + Qualified electronic Signature (QES). All certificates and their related chains supporting the signatures are validated against the EU Member State Trusted Lists (this includes + signer's certificate and certificates used to validate certificate validity status services - CRLs, OCSP, and time-stamps). + + + + ASiC-S + ASiC-E + + + + + + + + + application/vnd.etsi.asic-s+zip + application/vnd.etsi.asic-e+zip + + + + ANY_POLICY NO_POLICY + + + + * + + + + + + + + + + + + - - - - - - - - - + + + + + + - nonRepudiation - - - - - - - - - + + + + + + + + + RSA DSA @@ -56,13 +88,14 @@ - - - - + + + + - - + + + RSA DSA @@ -83,7 +116,7 @@ - + RSA DSA @@ -105,9 +138,14 @@ + + + + + - - + - + - + + + + + + + + + + - - - - - - + - + - - - nonRepudiation - - - - - - - - - + + RSA @@ -173,11 +205,12 @@ - - - + + + - + + RSA @@ -220,89 +253,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - RSA - DSA - ECDSA - - - DSA - RSA - ECDSA - - - SHA1 - SHA224 - SHA256 - SHA384 - SHA512 - RIPEMD160 - - - - - - - - - - - - - RSA - DSA - ECDSA - - - DSA - RSA - ECDSA - - - SHA1 - SHA224 - SHA256 - SHA384 - SHA512 - RIPEMD160 - - - - + + + + + - + - + - + + RSA @@ -326,11 +293,12 @@ - - - + + + - + + RSA @@ -352,24 +320,40 @@ + + + RSA + DSA + ECDSA + + + DSA + RSA + ECDSA + + + SHA1 + SHA224 + SHA256 + SHA384 + SHA512 + RIPEMD160 + + - - - SHA1 - SHA224 - SHA256 - SHA384 - SHA512 - RIPEMD160 - DSA128 - RSA1024 - RSA1536 - RSA2048 - RSA3072 - RSA4096 - ECDSA192 - ECDSA256 - - + + + + + + + + + + + diff --git a/dss-cookbook/src/main/resources/keystore/ec.europa.eu.5.cer b/dss-cookbook/src/main/resources/keystore/ec.europa.eu.5.cer new file mode 100644 index 0000000000..1cbe6fbfb8 --- /dev/null +++ b/dss-cookbook/src/main/resources/keystore/ec.europa.eu.5.cer @@ -0,0 +1,3 @@ +-----BEGIN CERTIFICATE----- +MIIHATCCBOmgAwIBAgIDGpmWMA0GCSqGSIb3DQEBCwUAME4xCzAJBgNVBAYTAkxVMRYwFAYDVQQKDA1MdXhUcnVzdCBTLkEuMScwJQYDVQQDDB5MdXhUcnVzdCBHbG9iYWwgUXVhbGlmaWVkIENBIDMwHhcNMTYwOTE1MDkwMDEyWhcNMTkwOTE1MDkwMDEyWjCB/TELMAkGA1UEBhMCQkUxCzAJBgNVBAcTAkJFMRwwGgYDVQQKExNFdXJvcGVhbiBDb21taXNzaW9uMRUwEwYDVQQLEwwwOTQ5LjM4My4zNDIxHDAaBgNVBAMTE01hYXJ0ZW4gSm9yaXMgT3R0b3kxDjAMBgNVBAQTBU90dG95MRYwFAYDVQQqEw1NYWFydGVuIEpvcmlzMR0wGwYDVQQFExQxMDMwNDQ0NDExMDA4MDgzNzU5MjEpMCcGCSqGSIb3DQEJARYabWFhcnRlbi5vdHRveUBlYy5ldXJvcGEuZXUxHDAaBgNVBAwTE1Byb2Zlc3Npb25hbCBQZXJzb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCyUn5NvdLXpWSAPF7S+tOy/M6uY8Un5sNt2cHIOs/OHvcfY+ghBXwz91EffNXku2RKqwgw3+dyRBI1eOq2l7r0z9dgNd40zB7a/p9M10SsDT41MJB5iQRYE4kQ73FGA61oXD530fYNzxCA9dWXzQ40L+wdpPbrVtfgi+pRTZSXocZF2VHpuiPEVexHPHt68rX/G8pYHg7zmYOEBPLsjjQAwbrVZIKb9Ypgkwb4ziaFg6UZemMfRtl7S08UWjjhOUUjZ+216ie9V6cMSXzg+5Co9HVSXPdqooNhMrOShTI7IzDja3rXAcw6TkvPDgZEpCJZ73HCxz+DWnW7D2JuXMelAgMBAAGjggI2MIICMjAMBgNVHRMBAf8EAjAAMGYGCCsGAQUFBwEBBFowWDAnBggrBgEFBQcwAYYbaHR0cDovL3FjYS5vY3NwLmx1eHRydXN0Lmx1MC0GCCsGAQUFBzAChiFodHRwOi8vY2EubHV4dHJ1c3QubHUvTFRHUUNBMy5jcnQwggEeBgNVHSAEggEVMIIBETCCAQMGCCuBKwEBCgMBMIH2MIHHBggrBgEFBQcCAjCBuhqBt0x1eFRydXN0IFF1YWxpZmllZCBDZXJ0aWZpY2F0ZSBvbiBTU0NEIGNvbXBsaWFudCB3aXRoIEVUU0kgVFMgMTAxIDQ1NiBRQ1ArIGNlcnRpZmljYXRlIHBvbGljeS4gS2V5IEdlbmVyYXRpb24gYnkgQ1NQLiBTb2xlIEF1dGhvcmlzZWQgVXNhZ2U6IFN1cHBvcnQgb2YgUXVhbGlmaWVkIEVsZWN0cm9uaWMgU2lnbmF0dXJlLjAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5Lmx1eHRydXN0Lmx1MAgGBgQAizABATAiBggrBgEFBQcBAwQWMBQwCAYGBACORgEBMAgGBgQAjkYBBDALBgNVHQ8EBAMCBkAwHwYDVR0jBBgwFoAUY4/CiwOxq47YU0eWHZmoffasqHUwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5sdXh0cnVzdC5sdS9MVEdRQ0EzLmNybDARBgNVHQ4ECgQIR8OxCQGxgiswDQYJKoZIhvcNAQELBQADggIBACWb5+Xt6sOaxE8bpakXFo2BoWYphyq5XAXRM6e7QDS57CaHW8Ly6ep0I23EZ3KcI3mpqg2UDaEZhGhvnE/SVEyh4go6E8Hljv9iyrdGccc+RgTM87rbkoUi6sZ+BcLlG7WNo2c5BqRyElch5o1/9AEnft3inLK4R47BHtbRkf/FkptiQWjSVzJ6LEHIi8EF215Qg5X/yaUQdxIfMPcQ580rGujGN/Dl2H9rxBUdPUCO0i7zbPeJtfah1zSXxYjy9V4x2Q+cVbcMpa5fSys9c/YQA6XAkA5oKrkSsjCGBULDi2APC3FMehp6BcI/5k202iwebq3xgDWFvuD+swgZ8P0YxS4dZMcjtseYvzGCArFEcoI7buZb30A/Z7K3qx3D895NHupfz20dskujjCV7PVgxx0PCXJPBquuPFV+aYgDCLr7XQMmU8wo0HGKZ/mXThY2F2POLF0uKgY6F5mZBIhRYU5IgybGrayqEpaEcr8LMBKzr2DRpLzDojU5k9apmVnoQJ2cSfTrQ87ZXOaG+6h/Md6cVaUI0J8iOpFLinKRGRBEkwE+pxFE2tOoyaK9iLKurRYdfd8WETatEsEyi4o4CFPD//bthgwvSl0Cfrkj8V5lIR13140D+NQtX0vSx/PHq5ySOKq9ZPUo42r8ihX/ZP0Z+Vrg5ATqpSCcqn01Z +-----END CERTIFICATE----- \ No newline at end of file diff --git a/dss-cookbook/src/main/resources/keystore/ec.europa.eu.6.cer b/dss-cookbook/src/main/resources/keystore/ec.europa.eu.6.cer new file mode 100644 index 0000000000..cd228d530a --- /dev/null +++ b/dss-cookbook/src/main/resources/keystore/ec.europa.eu.6.cer @@ -0,0 +1,3 @@ +-----BEGIN CERTIFICATE----- +MIIGZzCCBE+gAwIBAgIQEAAAAAAAH6yPXvnVxqcEcDANBgkqhkiG9w0BAQUFADAzMQswCQYDVQQGEwJCRTETMBEGA1UEAxMKQ2l0aXplbiBDQTEPMA0GA1UEBRMGMjAxNTA4MB4XDTE1MDUwMTE4NTQ1NFoXDTI1MDQyNTIzNTk1OVowczELMAkGA1UEBhMCQkUxJzAlBgNVBAMTHkplYW4tTWFyYyBWZXJiZXJndCAoU2lnbmF0dXJlKTERMA8GA1UEBBMIVmVyYmVyZ3QxEjAQBgNVBCoTCUplYW4tTWFyYzEUMBIGA1UEBRMLNjcwMjIzMzAzNDAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCwbnf998lxC5nc7YZUhnMIQ+n3VAjrFU2IOIzmHHSJ6aMASYOMYOlLx7XDrjbmh/MyhlpGYmNsF0iLwEYWXNwF4ChmfHqvoI/P29aqNkcojV2cFpZj+ocgnyf+f2cwn3z/kGh9kI6x4eS5IroFpABvzxWi0WD3W7wSJKyeRoMaGOtw07iA43S4fjDzjkKTYGor6PIOv6UtCfrZqPjTg+822kFhERz/3KiqSn2Hx324IIN/mZCSDd5ixKl0tdCsX+bPbXJI4tOyE0RDUl5/+iMAQWjli45opKj8eTMx2kmSycw9Du4zkFzgnp81XGDqEHZp53wSg8uZ5QR8EUjU3xNbAgMBAAGjggI1MIICMTAfBgNVHSMEGDAWgBRqb1HlzCddZQnuqBsSlAPwQKAI8jBwBggrBgEFBQcBAQRkMGIwNgYIKwYBBQUHMAKGKmh0dHA6Ly9jZXJ0cy5laWQuYmVsZ2l1bS5iZS9iZWxnaXVtcnMzLmNydDAoBggrBgEFBQcwAYYcaHR0cDovL29jc3AuZWlkLmJlbGdpdW0uYmUvMjCCARgGA1UdIASCAQ8wggELMIIBBwYHYDgKAQECATCB+zAsBggrBgEFBQcCARYgaHR0cDovL3JlcG9zaXRvcnkuZWlkLmJlbGdpdW0uYmUwgcoGCCsGAQUFBwICMIG9GoG6R2VicnVpayBvbmRlcndvcnBlbiBhYW4gYWFuc3ByYWtlbGlqa2hlaWRzYmVwZXJraW5nZW4sIHppZSBDUFMgLSBVc2FnZSBzb3VtaXMgw6AgZGVzIGxpbWl0YXRpb25zIGRlIHJlc3BvbnNhYmlsaXTDqSwgdm9pciBDUFMgLSBWZXJ3ZW5kdW5nIHVudGVybGllZ3QgSGFmdHVuZ3NiZXNjaHLDpG5rdW5nZW4sIGdlbcOkc3MgQ1BTMDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwuZWlkLmJlbGdpdW0uYmUvZWlkYzIwMTUwOC5jcmwwDgYDVR0PAQH/BAQDAgZAMBEGCWCGSAGG+EIBAQQEAwIFIDAiBggrBgEFBQcBAwQWMBQwCAYGBACORgEBMAgGBgQAjkYBBDANBgkqhkiG9w0BAQUFAAOCAgEAJ9OdfZ1C/G+mWS/MaTIK80oGEjapyYgZnXxJ5sFuUGv4oKev2Tq9FwzeKTpo+ufb6chMSWDguX+HkkwBlCj8Dt3ND4FFDzAsgoGnorKuWkO54Pa8KpXEb7OjsWvMnJhz2iG/rEnm7b2QjN/jxbS7ZzCJhW6mXuQ1K9FUnO6VzBV59N3KdoIUEEXZlPMVYhlQEJPG3PsmMXUwcQthDQgRpgbyiPPtzUJdS86dZu0eRds2xjAAzl7EVnHvSVcBFwaikB9YuECb7NfjD9yU+WshStCjvZb1aW9qGQXb5RrWP2kdKe6VMKsQh9dwpXPZ0cFABK9IJxAJB0vhV0JKD9FtcCJ4GA8oxX5Ul57oHGeFBVazT+OKaaNwNM/1zpowv6QwYowX4Y9NZJ/CYRkMNeNwCuB88mvDvIZY/a/IZTzVwqX2KuGZeFTJInN8esUu1uROd3jRkguSs93R/6Ch8xOS6uyeNY7IyrlW9IbSJ6Sza9viZRN8FhQARNa0sLPwXeX2zHUQ1xLSU2+E0E7ruBtMT0o5jTbViDmrmSb0PPmbSRnBlLsjf8PcgKkRzrGUDWfhoGnqu4dJs3uipwsPPVaoInZ26DIPgEDlneLmYi9Kt3T+yxG57lOq8E9Ip6HzBeiTXKGB+C5o484w32E97mtnP6dvMLL7VsoyegfJhO/3/lU= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/dss-cookbook/src/main/resources/user_a_rsa.p12 b/dss-cookbook/src/main/resources/user_a_rsa.p12 index a6ceed212b..9ff1a5816b 100644 Binary files a/dss-cookbook/src/main/resources/user_a_rsa.p12 and b/dss-cookbook/src/main/resources/user_a_rsa.p12 differ diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/CookbookTools.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/CookbookTools.java index c25f52d54e..8c66fea174 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/CookbookTools.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/CookbookTools.java @@ -4,9 +4,9 @@ import static org.junit.Assert.assertTrue; import java.io.File; +import java.io.IOException; import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSException; import eu.europa.esig.dss.DSSUtils; import eu.europa.esig.dss.FileDocument; import eu.europa.esig.dss.SignatureAlgorithm; @@ -60,13 +60,15 @@ protected static void preparePdfDoc() { /** * This method sets the common parameters. + * + * @throws IOException */ - protected static void preparePKCS12TokenAndKey() { - signingToken = new Pkcs12SignatureToken("password", "src/main/resources/user_a_rsa.p12"); + protected static void preparePKCS12TokenAndKey() throws IOException { + signingToken = new Pkcs12SignatureToken("src/main/resources/user_a_rsa.p12", "password"); privateKey = signingToken.getKeys().get(0); } - protected static MockTSPSource getMockTSPSource() throws DSSException, Exception { + protected static MockTSPSource getMockTSPSource() throws Exception { return new MockTSPSource(new CertificateService().generateTspCertificate(SignatureAlgorithm.RSA_SHA256)); } diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/keystore/PKCS12KeystoreWithKeyEntryGeneration.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/keystore/PKCS12KeystoreWithKeyEntryGeneration.java index 6f37127441..66d867edda 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/keystore/PKCS12KeystoreWithKeyEntryGeneration.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/keystore/PKCS12KeystoreWithKeyEntryGeneration.java @@ -6,7 +6,6 @@ import java.security.cert.Certificate; import java.util.Date; -import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Test; @@ -16,6 +15,7 @@ import eu.europa.esig.dss.token.AbstractSignatureTokenConnection; import eu.europa.esig.dss.token.DSSPrivateKeyEntry; import eu.europa.esig.dss.token.Pkcs12SignatureToken; +import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.x509.CertificateToken; public class PKCS12KeystoreWithKeyEntryGeneration { @@ -55,7 +55,7 @@ private KeyStore createKeyStore() throws Exception { keyStore.load(null, KEYSTORE_PASSWORD.toCharArray()); OutputStream fos = new FileOutputStream(KEYSTORE_FILEPATH); keyStore.store(fos, KEYSTORE_PASSWORD.toCharArray()); - IOUtils.closeQuietly(fos); + Utils.closeQuietly(fos); return keyStore; } } diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfASiCSBTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfASiCSBTest.java index e60cf24ec8..f5918aa8a4 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfASiCSBTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfASiCSBTest.java @@ -20,16 +20,18 @@ */ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; + import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithXAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithXAdESService; import eu.europa.esig.dss.cookbook.example.CookbookTools; import eu.europa.esig.dss.validation.CommonCertificateVerifier; @@ -39,7 +41,7 @@ public class SignPdfASiCSBTest extends CookbookTools { @Test - public void signASiCSBaselineB() { + public void signASiCSBaselineB() throws IOException { // GET document to be signed - // Return DSSDocument toSignDocument @@ -57,11 +59,11 @@ public void signASiCSBaselineB() { // tag::demo[] // Preparing parameters for the AsicS signature - ASiCSignatureParameters parameters = new ASiCSignatureParameters(); + ASiCWithXAdESSignatureParameters parameters = new ASiCWithXAdESSignatureParameters(); // We choose the level of the signature (-B, -T, -LT, LTA). - parameters.setSignatureLevel(SignatureLevel.ASiC_S_BASELINE_B); - // We choose the underlying format (XAdES or CAdES. XAdES is the default value) - parameters.aSiC().setUnderlyingForm(SignatureForm.XAdES); + parameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B); + // We choose the container type (ASiC-S or ASiC-E) + parameters.aSiC().setContainerType(ASiCContainerType.ASiC_S); // We set the digest algorithm to use with the signature algorithm. You must use the // same parameter when you invoke the method sign on the token. The default value is @@ -75,8 +77,8 @@ public void signASiCSBaselineB() { // Create common certificate verifier CommonCertificateVerifier commonCertificateVerifier = new CommonCertificateVerifier(); - // Create ASiCS service for signature - ASiCService service = new ASiCService(commonCertificateVerifier); + // Create ASiC service for signature + ASiCWithXAdESService service = new ASiCWithXAdESService(commonCertificateVerifier); // Get the SignedInfo segment that need to be signed. ToBeSigned dataToSign = service.getDataToSign(toSignDocument, parameters); diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfASiCSEWithCAdESTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfASiCSEWithCAdESTest.java index fc002a17c0..6e98bf02fd 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfASiCSEWithCAdESTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfASiCSEWithCAdESTest.java @@ -1,22 +1,24 @@ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; + import org.junit.Test; +import eu.europa.esig.dss.ASiCContainerType; import eu.europa.esig.dss.DSSDocument; import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.SignatureForm; import eu.europa.esig.dss.SignatureLevel; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; +import eu.europa.esig.dss.asic.ASiCWithCAdESSignatureParameters; +import eu.europa.esig.dss.asic.signature.ASiCWithCAdESService; import eu.europa.esig.dss.cookbook.example.CookbookTools; import eu.europa.esig.dss.validation.CommonCertificateVerifier; public class SignPdfASiCSEWithCAdESTest extends CookbookTools { @Test - public void signASiCSBaselineB() { + public void signASiCSBaselineB() throws IOException { // GET document to be signed - // Return DSSDocument toSignDocument @@ -36,13 +38,13 @@ public void signASiCSBaselineB() { // tag::demo[] // Preparing parameters for the AsicE signature - ASiCSignatureParameters parameters = new ASiCSignatureParameters(); - + ASiCWithCAdESSignatureParameters parameters = new ASiCWithCAdESSignatureParameters(); + // We choose the level of the signature (-B, -T, -LT or -LTA). - parameters.setSignatureLevel(SignatureLevel.ASiC_E_BASELINE_B); - // We choose CAdES as underlying form - parameters.aSiC().setUnderlyingForm(SignatureForm.CAdES); - + parameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B); + // We choose the container type (ASiC-S pr ASiC-E) + parameters.aSiC().setContainerType(ASiCContainerType.ASiC_E); + // We set the digest algorithm to use with the signature algorithm. You // must use the // same parameter when you invoke the method sign on the token. The @@ -57,8 +59,8 @@ public void signASiCSBaselineB() { // Create common certificate verifier CommonCertificateVerifier commonCertificateVerifier = new CommonCertificateVerifier(); - // Create ASiCS service for signature - ASiCService service = new ASiCService(commonCertificateVerifier); + // Create ASiC service for signature + ASiCWithCAdESService service = new ASiCWithCAdESService(commonCertificateVerifier); // Get the SignedInfo segment that need to be signed. ToBeSigned dataToSign = service.getDataToSign(toSignDocument, parameters); diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfPadesBTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfPadesBTest.java index 596cac5794..9fcbb7ca7b 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfPadesBTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfPadesBTest.java @@ -20,6 +20,8 @@ */ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; + import org.junit.Test; import eu.europa.esig.dss.DSSDocument; @@ -39,7 +41,7 @@ public class SignPdfPadesBTest extends CookbookTools { @Test - public void signPAdESBaselineB() { + public void signPAdESBaselineB() throws IOException { // GET document to be signed - // Return DSSDocument toSignDocument diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfPadesBVisibleTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfPadesBVisibleTest.java index 6fe23d09da..70efcea1db 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfPadesBVisibleTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignPdfPadesBVisibleTest.java @@ -22,6 +22,7 @@ import java.awt.Color; import java.awt.Font; +import java.io.IOException; import org.junit.Test; @@ -44,7 +45,7 @@ public class SignPdfPadesBVisibleTest extends CookbookTools { @Test - public void signPAdESBaselineBWithVisibleSignature() { + public void signPAdESBaselineBWithVisibleSignature() throws IOException { // GET document to be signed - // Return DSSDocument toSignDocument diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlCadesBTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlCadesBTest.java index cf760e4630..2452306118 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlCadesBTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlCadesBTest.java @@ -20,6 +20,8 @@ */ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; + import org.junit.Test; import eu.europa.esig.dss.DSSDocument; @@ -39,7 +41,7 @@ public class SignXmlCadesBTest extends CookbookTools { @Test - public void signCAdESBaselineB() { + public void signCAdESBaselineB() throws IOException { // GET document to be signed - // Return DSSDocument toSignDocument diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBExplicitPolicyTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBExplicitPolicyTest.java index 9962125a4a..af3dd6311c 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBExplicitPolicyTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBExplicitPolicyTest.java @@ -20,6 +20,8 @@ */ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; + import org.junit.Test; import eu.europa.esig.dss.BLevelParameters; @@ -42,7 +44,7 @@ public class SignXmlXadesBExplicitPolicyTest extends CookbookTools { @Test - public void testWithExplicitPolicy() { + public void testWithExplicitPolicy() throws IOException { prepareXmlDoc(); @@ -62,7 +64,7 @@ public void testWithExplicitPolicy() { BLevelParameters bLevelParameters = parameters.bLevel(); - //Get and use the explicit policy + // Get and use the explicit policy String signaturePolicyId = "http://www.example.com/policy.txt"; DigestAlgorithm signaturePolicyHashAlgo = DigestAlgorithm.SHA256; String signaturePolicyDescription = "Policy text to digest"; diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBImplicitPolicyTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBImplicitPolicyTest.java index c15f18cc74..0cd68547d8 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBImplicitPolicyTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBImplicitPolicyTest.java @@ -20,6 +20,8 @@ */ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; + import org.junit.Test; import eu.europa.esig.dss.BLevelParameters; @@ -41,7 +43,7 @@ public class SignXmlXadesBImplicitPolicyTest extends CookbookTools { @Test - public void testWithImplicitPolicy() { + public void testWithImplicitPolicy() throws IOException { prepareXmlDoc(); diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBPropertiesTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBPropertiesTest.java index 6e8ed43a7b..d7199085ad 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBPropertiesTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBPropertiesTest.java @@ -20,6 +20,7 @@ */ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -44,7 +45,7 @@ public class SignXmlXadesBPropertiesTest extends CookbookTools { @Test - public void testWithProperties() { + public void testWithProperties() throws IOException { prepareXmlDoc(); diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBTest.java index cb97ce00e8..fde5b89583 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesBTest.java @@ -20,6 +20,8 @@ */ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; + import org.junit.Test; import eu.europa.esig.dss.DSSDocument; @@ -39,7 +41,7 @@ public class SignXmlXadesBTest extends CookbookTools { @Test - public void signXAdESBaselineB() { + public void signXAdESBaselineB() throws IOException { // GET document to be signed - // Return DSSDocument toSignDocument @@ -89,11 +91,11 @@ public void signXAdESBaselineB() { // end::demo[] - // try { - // signedDocument.save("src/test/resources/signedXmlXadesB.xml"); - // } catch (IOException e) { - // e.printStackTrace(); - // } + // try { + // signedDocument.save("src/test/resources/signedXmlXadesB.xml"); + // } catch (IOException e) { + // e.printStackTrace(); + // } testFinalDocument(signedDocument); } diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesLTTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesLTTest.java index 8229357782..42dba1f6df 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesLTTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesLTTest.java @@ -21,6 +21,7 @@ package eu.europa.esig.dss.cookbook.example.sign; import java.io.File; +import java.io.IOException; import org.junit.Test; @@ -49,7 +50,7 @@ public class SignXmlXadesLTTest extends CookbookTools { @Test - public void signXAdESBaselineLT() { + public void signXAdESBaselineLT() throws IOException { // GET document to be signed - // Return DSSDocument toSignDocument @@ -97,6 +98,7 @@ public void signXAdESBaselineLT() { job.setDataLoader(commonsHttpDataLoader); job.setDssKeyStore(keyStoreCertificateSource); job.setLotlUrl("https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl-mp.xml"); + job.setOjUrl("http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=uriserv:OJ.C_.2016.233.01.0001.01.ENG"); job.setLotlCode("EU"); job.setRepository(tslRepository); job.refresh(); @@ -116,7 +118,7 @@ public void signXAdESBaselineLT() { try { service.setTspSource(getMockTSPSource()); } catch (Exception e) { - new DSSException("Error during MockTspSource", e); + throw new DSSException("Error during MockTspSource", e); } // Get the SignedInfo XML segment that need to be signed. diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTTest.java index 54bd79cd48..97a9906542 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTTest.java @@ -20,6 +20,8 @@ */ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; + import org.junit.Test; import eu.europa.esig.dss.DSSDocument; @@ -43,7 +45,7 @@ public class SignXmlXadesTTest extends CookbookTools { @Test - public void signXAdESBaselineT() { + public void signXAdESBaselineT() throws IOException { // GET document to be signed - // Return DSSDocument toSignDocument @@ -86,7 +88,7 @@ public void signXAdESBaselineT() { mockTSPSource = new MockTSPSource(new CertificateService().generateTspCertificate(SignatureAlgorithm.RSA_SHA256)); service.setTspSource(mockTSPSource); } catch (Exception e) { - new DSSException("Error during MockTspSource", e); + throw new DSSException("Error during MockTspSource", e); } // Get the SignedInfo XML segment that need to be signed. diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTWithOnlineSourceTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTWithOnlineSourceTest.java index 8460836ea2..07dc8ec719 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTWithOnlineSourceTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sign/SignXmlXadesTWithOnlineSourceTest.java @@ -20,6 +20,8 @@ */ package eu.europa.esig.dss.cookbook.example.sign; +import java.io.IOException; + import org.junit.Test; import eu.europa.esig.dss.DSSDocument; @@ -40,7 +42,7 @@ public class SignXmlXadesTWithOnlineSourceTest extends CookbookTools { @Test - public void signXAdESBaselineTWithOnlineTSP() { + public void signXAdESBaselineTWithOnlineTSP() throws IOException { // GET document to be signed - // Return DSSDocument toSignDocument diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/MSCAPISnippet.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/MSCAPISnippet.java index c3858cb166..7619c263e8 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/MSCAPISnippet.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/MSCAPISnippet.java @@ -2,18 +2,17 @@ import java.util.List; -import org.apache.commons.codec.binary.Base64; - import eu.europa.esig.dss.DigestAlgorithm; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; import eu.europa.esig.dss.token.DSSPrivateKeyEntry; import eu.europa.esig.dss.token.MSCAPISignatureToken; import eu.europa.esig.dss.token.SignatureTokenConnection; +import eu.europa.esig.dss.utils.Utils; public class MSCAPISnippet { - public static void main(String[] args){ + public static void main(String[] args) { // tag::demo[] @@ -27,7 +26,7 @@ public static void main(String[] args){ ToBeSigned toBeSigned = new ToBeSigned("Hello world".getBytes()); SignatureValue signatureValue = token.sign(toBeSigned, DigestAlgorithm.SHA256, keys.get(0)); - System.out.println("Signature value : " + Base64.encodeBase64String(signatureValue.getValue())); + System.out.println("Signature value : " + Utils.toBase64(signatureValue.getValue())); // end::demo[] } diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/PKCS11Snippet.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/PKCS11Snippet.java index 443012ea3c..7ace81d7d8 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/PKCS11Snippet.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/PKCS11Snippet.java @@ -2,18 +2,17 @@ import java.util.List; -import org.apache.commons.codec.binary.Base64; - import eu.europa.esig.dss.DigestAlgorithm; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; import eu.europa.esig.dss.token.DSSPrivateKeyEntry; import eu.europa.esig.dss.token.Pkcs11SignatureToken; import eu.europa.esig.dss.token.SignatureTokenConnection; +import eu.europa.esig.dss.utils.Utils; public class PKCS11Snippet { - public static void main(String[] args){ + public static void main(String[] args) { // tag::demo[] @@ -27,7 +26,7 @@ public static void main(String[] args){ ToBeSigned toBeSigned = new ToBeSigned("Hello world".getBytes()); SignatureValue signatureValue = token.sign(toBeSigned, DigestAlgorithm.SHA256, keys.get(0)); - System.out.println("Signature value : " + Base64.encodeBase64String(signatureValue.getValue())); + System.out.println("Signature value : " + Utils.toBase64(signatureValue.getValue())); // end::demo[] } diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/PKCS12Snippet.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/PKCS12Snippet.java index 957f951d8c..6e45d1798b 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/PKCS12Snippet.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/snippets/PKCS12Snippet.java @@ -1,23 +1,23 @@ package eu.europa.esig.dss.cookbook.example.snippets; +import java.io.IOException; import java.util.List; -import org.apache.commons.codec.binary.Base64; - import eu.europa.esig.dss.DigestAlgorithm; import eu.europa.esig.dss.SignatureValue; import eu.europa.esig.dss.ToBeSigned; import eu.europa.esig.dss.token.DSSPrivateKeyEntry; import eu.europa.esig.dss.token.Pkcs12SignatureToken; import eu.europa.esig.dss.token.SignatureTokenConnection; +import eu.europa.esig.dss.utils.Utils; public class PKCS12Snippet { - public static void main(String[] args){ + public static void main(String[] args) throws IOException { // tag::demo[] - SignatureTokenConnection token = new Pkcs12SignatureToken("password", "src/main/resources/user_a_rsa.p12"); + SignatureTokenConnection token = new Pkcs12SignatureToken("src/main/resources/user_a_rsa.p12", "password"); List keys = token.getKeys(); for (DSSPrivateKeyEntry entry : keys) { @@ -27,9 +27,10 @@ public static void main(String[] args){ ToBeSigned toBeSigned = new ToBeSigned("Hello world".getBytes()); SignatureValue signatureValue = token.sign(toBeSigned, DigestAlgorithm.SHA256, keys.get(0)); - System.out.println("Signature value : " + Base64.encodeBase64String(signatureValue.getValue())); + System.out.println("Signature value : " + Utils.toBase64(signatureValue.getValue())); // end::demo[] + } } diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sources/LOTLLoadingTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sources/LOTLLoadingTest.java index c51c4b0dd2..3d6e13a555 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sources/LOTLLoadingTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sources/LOTLLoadingTest.java @@ -30,6 +30,7 @@ public void loadLOTL() { job.setDataLoader(new CommonsDataLoader()); job.setDssKeyStore(keyStoreCertificateSource); job.setLotlUrl("https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl-mp.xml"); + job.setOjUrl("http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=uriserv:OJ.C_.2016.233.01.0001.01.ENG"); job.setLotlCode("EU"); job.setRepository(tslRepository); diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sources/OnlineTSPSourceTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sources/OnlineTSPSourceTest.java index 6f8d4c1742..7f26f95400 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sources/OnlineTSPSourceTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/sources/OnlineTSPSourceTest.java @@ -41,12 +41,11 @@ public void test() throws IOException { // tag::demo[] - final String tspServer = "http://services.globaltrustfinder.com/adss/tsa"; + final String tspServer = "http://tsa.belgium.be/connect"; OnlineTSPSource tspSource = new OnlineTSPSource(tspServer); - tspSource.setPolicyOid("1.2.3.4.5"); final DigestAlgorithm digestAlgorithm = DigestAlgorithm.SHA256; - final byte[] toDigest = "digest value".getBytes(); + final byte[] toDigest = "digest value".getBytes("UTF-8"); final byte[] digestValue = DSSUtils.digest(digestAlgorithm, toDigest); final TimeStampToken tsr = tspSource.getTimeStampResponse(digestAlgorithm, digestValue); diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBTest.java index 4335fdffac..598c112a00 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateSignedXmlXadesBTest.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull; import java.io.File; +import java.io.IOException; import org.junit.Test; @@ -45,7 +46,7 @@ public class ValidateSignedXmlXadesBTest extends CookbookTools { @Test - public void validateXAdESBaselineB() { + public void validateXAdESBaselineB() throws IOException { // tag::demo[] diff --git a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateXmlXadesLTWithOnlineSourcesTest.java b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateXmlXadesLTWithOnlineSourcesTest.java index 1df1f9d73a..3987c80bf3 100644 --- a/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateXmlXadesLTWithOnlineSourcesTest.java +++ b/dss-cookbook/src/test/java/eu/europa/esig/dss/cookbook/example/validate/ValidateXmlXadesLTWithOnlineSourcesTest.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull; import java.io.File; +import java.io.IOException; import org.junit.Test; @@ -51,7 +52,7 @@ public class ValidateXmlXadesLTWithOnlineSourcesTest extends CookbookTools { @Test - public void validateXAdESBaselineLTWithOnlineSources() { + public void validateXAdESBaselineLTWithOnlineSources() throws IOException { // tag::demo[] @@ -96,6 +97,7 @@ public void validateXAdESBaselineLTWithOnlineSources() { job.setDataLoader(new CommonsDataLoader()); job.setDssKeyStore(keyStoreCertificateSource); job.setLotlUrl("https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl-mp.xml"); + job.setOjUrl("http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=uriserv:OJ.C_.2016.233.01.0001.01.ENG"); job.setLotlCode("EU"); job.setRepository(tslRepository); diff --git a/dss-cookbook/src/test/resources/logback.xml b/dss-cookbook/src/test/resources/logback.xml deleted file mode 100644 index 7c18105a77..0000000000 --- a/dss-cookbook/src/test/resources/logback.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - \ No newline at end of file diff --git a/dss-demo-bundle/pom.xml b/dss-demo-bundle/pom.xml deleted file mode 100755 index 7ed4a9598b..0000000000 --- a/dss-demo-bundle/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - 4.0.0 - - - org.digidoc4j.dss - sd-dss - 4.7.RC2.d4j.1 - - - DSS Package: OOTB Web-Application - The out-of-the-box demo including history, licenses, sources and tomcat-based web-application (to manage digital signatures and Trusted Lists) - - dss-demo-bundle - pom - - - - org.digidoc4j.dss - dss-demo-webapp - war - - - org.digidoc4j.dss - sscd-mocca-adapter - - - com.oracle - jre-win32 - 8.0.45 - zip - - - org.apache - tomcat - 8.0.21 - zip - - - lu.nowina.apps - nexu-bundle - ${nexu.version} - pom - - - - - - - maven-assembly-plugin - - - generate-resources - - single - - - - - - src/main/assembly/assembly.xml - - false - - - - maven-install-plugin - - true - - - - maven-deploy-plugin - - true - - - - - - diff --git a/dss-demo-bundle/src/main/assembly/assembly.xml b/dss-demo-bundle/src/main/assembly/assembly.xml deleted file mode 100644 index 96cf3fa51c..0000000000 --- a/dss-demo-bundle/src/main/assembly/assembly.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - ootb-webapp - - - zip - tar.gz - - - - - src/main/resources - - - - - - - true - - com.oracle:jre-win32:zip - - java - 0644 - - - - org.apache:tomcat:zip - - 0644 - true - - - tomcat/conf/tomcat-users.xml - tomcat/webapps/**/* - - - - - - org.digidoc4j.dss:dss-demo-webapp:war - - tomcat/webapps - - ROOT.war - - - - lu.nowina.apps:nexu-app:jar - - - nexu.jar - - - diff --git a/dss-demo-bundle/src/main/resources/DSS-Web.URL b/dss-demo-bundle/src/main/resources/DSS-Web.URL deleted file mode 100644 index 63581982b7..0000000000 --- a/dss-demo-bundle/src/main/resources/DSS-Web.URL +++ /dev/null @@ -1,2 +0,0 @@ -[InternetShortcut] -URL=http://localhost:8080/ \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/NexU-Startup.bat b/dss-demo-bundle/src/main/resources/NexU-Startup.bat deleted file mode 100644 index 0f58275dad..0000000000 --- a/dss-demo-bundle/src/main/resources/NexU-Startup.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off - -set JRE_HOME=.\java -set CATALINA_HOME=.\tomcat - -start javaw -jar nexu.jar \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/Webapp-Shutdown.bat b/dss-demo-bundle/src/main/resources/Webapp-Shutdown.bat deleted file mode 100644 index 07b97ee195..0000000000 --- a/dss-demo-bundle/src/main/resources/Webapp-Shutdown.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off - -set JRE_HOME=.\java -set CATALINA_HOME=.\tomcat - -.\TOMCAT\BIN\SHUTDOWN.BAT \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/Webapp-Startup.bat b/dss-demo-bundle/src/main/resources/Webapp-Startup.bat deleted file mode 100644 index 84451afaa5..0000000000 --- a/dss-demo-bundle/src/main/resources/Webapp-Startup.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off - -set JRE_HOME=.\java -set CATALINA_HOME=.\tomcat - -.\TOMCAT\BIN\STARTUP.BAT \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/license/COPYING b/dss-demo-bundle/src/main/resources/license/COPYING deleted file mode 100644 index 94a9ed024d..0000000000 --- a/dss-demo-bundle/src/main/resources/license/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/dss-demo-bundle/src/main/resources/license/COPYING.LESSER b/dss-demo-bundle/src/main/resources/license/COPYING.LESSER deleted file mode 100644 index 65c5ca88a6..0000000000 --- a/dss-demo-bundle/src/main/resources/license/COPYING.LESSER +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/dss-demo-bundle/src/main/resources/license/libs_Apache-License-2.0.txt b/dss-demo-bundle/src/main/resources/license/libs_Apache-License-2.0.txt deleted file mode 100644 index cb8e109920..0000000000 --- a/dss-demo-bundle/src/main/resources/license/libs_Apache-License-2.0.txt +++ /dev/null @@ -1,52 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and - 2. You must cause any modified files to carry prominent notices stating that You changed the files; and - 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/license/libs_MIT-License-BouncyCastle.txt b/dss-demo-bundle/src/main/resources/license/libs_MIT-License-BouncyCastle.txt deleted file mode 100644 index 03467f7ffb..0000000000 --- a/dss-demo-bundle/src/main/resources/license/libs_MIT-License-BouncyCastle.txt +++ /dev/null @@ -1,9 +0,0 @@ -License - -Copyright (c) 2000 - 2011 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/license/libs_MIT-License.txt b/dss-demo-bundle/src/main/resources/license/libs_MIT-License.txt deleted file mode 100644 index e1dd696d3b..0000000000 --- a/dss-demo-bundle/src/main/resources/license/libs_MIT-License.txt +++ /dev/null @@ -1,9 +0,0 @@ -The MIT License (MIT) - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/license/libs_Mozilla-Public-License-1.1.txt b/dss-demo-bundle/src/main/resources/license/libs_Mozilla-Public-License-1.1.txt deleted file mode 100644 index 7714141d15..0000000000 --- a/dss-demo-bundle/src/main/resources/license/libs_Mozilla-Public-License-1.1.txt +++ /dev/null @@ -1,470 +0,0 @@ - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - diff --git a/dss-demo-bundle/src/main/resources/readme.txt b/dss-demo-bundle/src/main/resources/readme.txt deleted file mode 100644 index 99ffbb0ae6..0000000000 --- a/dss-demo-bundle/src/main/resources/readme.txt +++ /dev/null @@ -1,42 +0,0 @@ -The DSS-Web applications is built as demonstration for a Windows environment and all required elements (like the JRE 1.6) are provided. - -To start any application go to the folder: -- ./bin - -# For the web-application: -- Webapp-Startup.bat starts the Tomcat server -- Webapp-Shutdown.bat stops the Tomcat server - -# For NexU: -- Nexu-Startup.bat starts NexU - -The HTML page is available via - http://localhost:8080/ -Please make sure that your browser has the corresponding Java-plugin installed and activated. - -Required callback-service for the applet is configured on the following address: - http://localhost:8080/wservice - -The web-services (for e.g. integration in another application) are accessible via the following address - http://localhost:8080/wservice/ -There are two SOAP services available, that are described (WSDL) when accessing one of the aforementioned URLs: -1. SignatureService - http://localhost:8080/wservice/signatureService exposes three operations: - - signDocument - - extendSignature - - getDataToSign - WSDL information is given via: - - http://localhost:8080wservice/signatureService?wsdl - - and (with more details) http://localhost:8080/wservice/signatureService?wsdl=SignatureService.wsdl -2. ValidationService - http://localhost:8080/wservice/validationService exposes one operation: - - validateDocument - WSDL information is given via: - - http://localhost:8080/wservice/validationService?wsdl - - and (with more details) http://localhost:8080/wservice/validationService?wsdl=ValidationService.wsdl - -Note that the web-application connects to external internet addresses to fetch data (e.g. CRL/OCSP). -If you have a proxy, then you may use the proxy configuration page: -- http://localhost:8080/admin/proxy -When the application is started, the european LoTL and its contained TSLs are fetched immediately. -It is quite "normal" that a TSL URL may not be accessible; this error is logged on the console. diff --git a/dss-demo-bundle/src/main/resources/tomcat/bin/setenv.bat b/dss-demo-bundle/src/main/resources/tomcat/bin/setenv.bat deleted file mode 100644 index 7736f5069f..0000000000 --- a/dss-demo-bundle/src/main/resources/tomcat/bin/setenv.bat +++ /dev/null @@ -1,3 +0,0 @@ -rem Define the DSS data folder - -set "DSS_DATA_FOLDER=%CATALINA_HOME%\etc" \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/tomcat/bin/setenv.sh b/dss-demo-bundle/src/main/resources/tomcat/bin/setenv.sh deleted file mode 100644 index 25e3da85df..0000000000 --- a/dss-demo-bundle/src/main/resources/tomcat/bin/setenv.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# Define the DSS data folder - -export DSS_DATA_FOLDER="$CATALINA_HOME/etc" \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/tomcat/conf/tomcat-users.xml b/dss-demo-bundle/src/main/resources/tomcat/conf/tomcat-users.xml deleted file mode 100644 index 458fddd540..0000000000 --- a/dss-demo-bundle/src/main/resources/tomcat/conf/tomcat-users.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/dss-demo-bundle/src/main/resources/tomcat/etc/delete.me b/dss-demo-bundle/src/main/resources/tomcat/etc/delete.me deleted file mode 100644 index eaa3780e64..0000000000 --- a/dss-demo-bundle/src/main/resources/tomcat/etc/delete.me +++ /dev/null @@ -1 +0,0 @@ -for GIT \ No newline at end of file diff --git a/dss-demo-webapp/pom.xml b/dss-demo-webapp/pom.xml deleted file mode 100644 index 1203426d4c..0000000000 --- a/dss-demo-webapp/pom.xml +++ /dev/null @@ -1,379 +0,0 @@ - - - - 4.0.0 - - - org.digidoc4j.dss - sd-dss - 4.7.RC2.d4j.1 - - - dss-demo-webapp - war - DSS Demo: Web Application - DSS Demo: Web Application - - - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-standalone-zip - process-resources - - copy - - - - - org.digidoc4j.dss - dss-standalone-app-package - zip - ${project.build.directory}/${project.artifactId}-${project.version} - /downloads/dss-app.zip - - - - - - copy-standalone-tar-gz - process-resources - - copy - - - - - org.digidoc4j.dss - dss-standalone-app-package - tar.gz - ${project.build.directory}/${project.artifactId}-${project.version} - /downloads/dss-app.tar.gz - - - - - - - - maven-resources-plugin - - - copy-cookbook - process-resources - - copy-resources - - - ${project.build.directory}/${project.artifactId}-${project.version}/doc - true - - - ../dss-cookbook/target/generated-docs - - **/* - * - - - - - - - - - org.apache.tomcat.maven - tomcat6-maven-plugin - - / - - - - maven-deploy-plugin - - true - - - - - - - - org.springframework - spring-beans - - - org.springframework - spring-web - - - org.springframework - spring-webmvc - - - org.springframework - spring-context-support - - - org.springframework - spring-jdbc - - - org.springframework - spring-oxm - - - - org.digidoc4j.dss - dss-document - - - org.digidoc4j.dss - dss-service - - - org.digidoc4j.dss - dss-tsl-validation - - - org.digidoc4j.dss - dss-policy-jaxb - - - org.digidoc4j.dss - dss-standalone-app-package - provided - - - org.digidoc4j.dss - dss-cookbook - provided - - - - xalan - xalan - - - org.quartz-scheduler - quartz - - - org.hsqldb - hsqldb - - - - - org.digidoc4j.dss - dss-soap - compile - - - org.digidoc4j.dss - dss-validation-soap - compile - - - - - org.digidoc4j.dss - dss-rest - compile - - - org.digidoc4j.dss - dss-validation-rest - compile - - - - javax.servlet - jstl - 1.2 - - - org.apache.tiles - tiles-api - - - org.apache.tiles - tiles-core - - - org.apache.tiles - tiles-jsp - - - org.apache.tiles - tiles-servlet - - - org.apache.tiles - tiles-template - - - org.slf4j - slf4j-api - - - org.slf4j - jcl-over-slf4j - - - ch.qos.logback - logback-classic - - - - commons-dbcp - commons-dbcp - 1.4 - - - commons-fileupload - commons-fileupload - - - - org.apache.httpcomponents - httpclient - - - commons-logging - commons-logging - - - - - - org.freemarker - freemarker - 2.3.23 - - - - org.apache.xmlgraphics - fop - 2.0 - - - commons-logging - commons-logging - - - - - - javax.servlet - servlet-api - 2.5 - provided - - - org.hibernate - hibernate-validator - 4.3.1.Final - - - - com.fasterxml.jackson.core - jackson-databind - 2.2.3 - - - - junit - junit - test - - - org.springframework - spring-test - test - - - org.seleniumhq.selenium - selenium-java - 2.41.0 - test - - - commons-logging - commons-logging - - - - - - - - run-integration-test - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.12 - - - - integration-test - verify - - - - - - **/*IT.java - - - - - org.apache.tomcat.maven - tomcat6-maven-plugin - - / - 8765 - - ${project.build.directory}/src/test/resources - - - - - start-tomcat - pre-integration-test - - run - - - true - - - - stop-tomcat - post-integration-test - - shutdown - - - true - - - - - - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/DSSKeyStoreFactoryBean.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/DSSKeyStoreFactoryBean.java deleted file mode 100644 index 1d6cb0d404..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/DSSKeyStoreFactoryBean.java +++ /dev/null @@ -1,99 +0,0 @@ -package eu.europa.esig.dss.web; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.config.AbstractFactoryBean; - -import eu.europa.esig.dss.DSSException; -import eu.europa.esig.dss.x509.KeyStoreCertificateSource; - -public class DSSKeyStoreFactoryBean extends AbstractFactoryBean { - - private static final Logger logger = LoggerFactory.getLogger(DSSKeyStoreFactoryBean.class); - - private static final String ENVIRONMENT_VARIABLE_DSS_DATA_FOLDER = "DSS_DATA_FOLDER"; - - private String keyStoreType; - private String keyStoreFilename; - private String keyStorePassword; - - public void setKeyStoreType(String keyStoreType) { - this.keyStoreType = keyStoreType; - } - - public void setKeyStoreFilename(String keyStoreFilename) { - this.keyStoreFilename = keyStoreFilename; - } - - public void setKeyStorePassword(String keyStorePassword) { - this.keyStorePassword = keyStorePassword; - } - - @Override - protected KeyStoreCertificateSource createInstance() throws Exception { - File keystoreFile = getKeyStoreFile(); - if (keystoreFile.exists()) { - logger.info("Keystore file found (" + keystoreFile.getAbsolutePath() + ")"); - } else { - logger.info("Keystore file not found on server"); - logger.info("Copying keystore file from the war"); - - InputStream is = null; - OutputStream os = null; - try { - is = DSSKeyStoreFactoryBean.class.getResourceAsStream("/" + keyStoreFilename); - os = new FileOutputStream(keystoreFile); - IOUtils.copy(is, os); - } catch (Exception e) { - throw new DSSException("Unable to create the keystore on the server : " + e.getMessage(), e); - } finally { - IOUtils.closeQuietly(is); - IOUtils.closeQuietly(os); - } - } - return new KeyStoreCertificateSource(keystoreFile, keyStoreType, keyStorePassword); - } - - @Override - public Class getObjectType() { - return KeyStoreCertificateSource.class; - } - - private File getKeyStoreFile() { - String finalDataFolder = getDssDataFolder(); - - File folder = new File(finalDataFolder); - if (!folder.exists() || !folder.isDirectory()) { - folder.mkdir(); - } - - String finalAbsoluteKeystoreFilepath = finalDataFolder + File.separatorChar + keyStoreFilename; - File keystoreFile = new File(finalAbsoluteKeystoreFilepath); - return keystoreFile; - } - - private String getDssDataFolder() { - String dssDataFolder = System.getProperty(ENVIRONMENT_VARIABLE_DSS_DATA_FOLDER); - if (StringUtils.isNotEmpty(dssDataFolder)) { - logger.info(ENVIRONMENT_VARIABLE_DSS_DATA_FOLDER + " found as system property : " + dssDataFolder); - return dssDataFolder; - } - - dssDataFolder = System.getenv(ENVIRONMENT_VARIABLE_DSS_DATA_FOLDER); - if (StringUtils.isNotEmpty(dssDataFolder)) { - logger.info(ENVIRONMENT_VARIABLE_DSS_DATA_FOLDER + " found as environment variable : " + dssDataFolder); - return dssDataFolder; - } - - logger.warn(ENVIRONMENT_VARIABLE_DSS_DATA_FOLDER + " not defined (returns 'etc')"); - return "etc"; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/WebAppUtils.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/WebAppUtils.java deleted file mode 100644 index 9cb63d4a3d..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/WebAppUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.europa.esig.dss.web; - -import java.io.IOException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.multipart.MultipartFile; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.InMemoryDocument; - -public final class WebAppUtils { - - private static final Logger logger = LoggerFactory.getLogger(WebAppUtils.class); - - private WebAppUtils() { - } - - public static DSSDocument toDSSDocument(MultipartFile multipartFile) { - try { - if ((multipartFile != null) && !multipartFile.isEmpty()) { - DSSDocument document = new InMemoryDocument(multipartFile.getBytes(), multipartFile.getOriginalFilename()); - return document; - } - } catch (IOException e) { - logger.error("Cannot read file : " + e.getMessage(), e); - } - return null; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/DataController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/DataController.java deleted file mode 100644 index a768100301..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/DataController.java +++ /dev/null @@ -1,103 +0,0 @@ -package eu.europa.esig.dss.web.controller; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.BooleanUtils; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; - - -@Controller -@RequestMapping(value = "/data") -public class DataController { - - @RequestMapping(value = "/packagingsByForm", produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public List getAllowedPackagingsByForm(@RequestParam("form") SignatureForm signatureForm) { - List packagings = new ArrayList(); - if (signatureForm != null) { - switch (signatureForm) { - case CAdES: - packagings.add(SignaturePackaging.ENVELOPING); - packagings.add(SignaturePackaging.DETACHED); - break; - case PAdES: - packagings.add(SignaturePackaging.ENVELOPED); - break; - case XAdES: - packagings.add(SignaturePackaging.ENVELOPED); - packagings.add(SignaturePackaging.ENVELOPING); - packagings.add(SignaturePackaging.DETACHED); - break; - case ASiC_S: - case ASiC_E: - packagings.add(SignaturePackaging.DETACHED); - break; - default: - break; - } - } - return packagings; - } - - @RequestMapping(value = "/levelsByForm", produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public List getAllowedLevelsByForm(@RequestParam("form") SignatureForm signatureForm, @RequestParam("isSign") Boolean isSign) { - List levels = new ArrayList(); - if (signatureForm != null) { - switch (signatureForm) { - case CAdES: - if (BooleanUtils.isTrue(isSign)) { - levels.add(SignatureLevel.CAdES_BASELINE_B); - } - levels.add(SignatureLevel.CAdES_BASELINE_T); - levels.add(SignatureLevel.CAdES_BASELINE_LT); - levels.add(SignatureLevel.CAdES_BASELINE_LTA); - break; - case PAdES: - if (BooleanUtils.isTrue(isSign)) { - levels.add(SignatureLevel.PAdES_BASELINE_B); - } - levels.add(SignatureLevel.PAdES_BASELINE_T); - levels.add(SignatureLevel.PAdES_BASELINE_LT); - levels.add(SignatureLevel.PAdES_BASELINE_LTA); - break; - case XAdES: - if (BooleanUtils.isTrue(isSign)) { - levels.add(SignatureLevel.XAdES_BASELINE_B); - } - levels.add(SignatureLevel.XAdES_BASELINE_T); - levels.add(SignatureLevel.XAdES_BASELINE_LT); - levels.add(SignatureLevel.XAdES_BASELINE_LTA); - break; - case ASiC_S: - if (BooleanUtils.isTrue(isSign)) { - levels.add(SignatureLevel.ASiC_S_BASELINE_B); - } - levels.add(SignatureLevel.ASiC_S_BASELINE_T); - levels.add(SignatureLevel.ASiC_S_BASELINE_LT); - levels.add(SignatureLevel.ASiC_S_BASELINE_LTA); - break; - case ASiC_E: - if (BooleanUtils.isTrue(isSign)) { - levels.add(SignatureLevel.ASiC_E_BASELINE_B); - } - levels.add(SignatureLevel.ASiC_E_BASELINE_T); - levels.add(SignatureLevel.ASiC_E_BASELINE_LT); - levels.add(SignatureLevel.ASiC_E_BASELINE_LTA); - break; - default: - break; - } - } - return levels; - } -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/ExtensionController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/ExtensionController.java deleted file mode 100644 index 025bb7fe21..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/ExtensionController.java +++ /dev/null @@ -1,83 +0,0 @@ -package eu.europa.esig.dss.web.controller; - -import java.io.ByteArrayInputStream; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.web.editor.EnumPropertyEditor; -import eu.europa.esig.dss.web.model.ExtensionForm; -import eu.europa.esig.dss.web.service.SigningService; - -@Controller -@RequestMapping(value = "/extension") -public class ExtensionController { - - private static final Logger logger = LoggerFactory.getLogger(ExtensionController.class); - - private static final String EXTENSION_TILE = "extension"; - - @Autowired - private SigningService signingService; - - @InitBinder - public void initBinder(WebDataBinder binder) { - binder.registerCustomEditor(SignatureForm.class, new EnumPropertyEditor(SignatureForm.class)); - binder.registerCustomEditor(SignaturePackaging.class, new EnumPropertyEditor(SignaturePackaging.class)); - binder.registerCustomEditor(SignatureLevel.class, new EnumPropertyEditor(SignatureLevel.class)); - } - - @RequestMapping(method = RequestMethod.GET) - public String showExtension(Model model) { - model.addAttribute("extensionForm", new ExtensionForm()); - return EXTENSION_TILE; - } - - @RequestMapping(method = RequestMethod.POST) - public String extend(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("extensionForm") @Valid ExtensionForm extensionForm, BindingResult result) { - if (result.hasErrors()) { - return EXTENSION_TILE; - } - - DSSDocument extendedDocument = signingService.extend(extensionForm); - - response.setContentType(extendedDocument.getMimeType().getMimeTypeString()); - response.setHeader("Content-Disposition", "attachment; filename=\"" + extendedDocument.getName() + "\""); - try { - IOUtils.copy(extendedDocument.openStream(), response.getOutputStream()); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - - return null; - } - - @ModelAttribute("signatureForms") - public SignatureForm[] getSignatureForms() { - return SignatureForm.values(); - } - - @ModelAttribute("signaturePackagings") - public SignaturePackaging[] getSignaturePackagings() { - return SignaturePackaging.values(); - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/GlobalExceptionHandler.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/GlobalExceptionHandler.java deleted file mode 100644 index 6d7af0e335..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/GlobalExceptionHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -package eu.europa.esig.dss.web.controller; - -import javax.servlet.http.HttpServletRequest; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.core.annotation.AnnotationUtils; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.servlet.ModelAndView; - -@ControllerAdvice -public class GlobalExceptionHandler { - - private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class); - - public static final String DEFAULT_ERROR_VIEW = "error"; - - @ExceptionHandler(value = Exception.class) - public ModelAndView defaultErrorHandler(HttpServletRequest req, Exception e) throws Exception { - // If the exception is annotated with @ResponseStatus rethrow it and let - // the framework handle it (for personal and annotated Exception) - if (AnnotationUtils.findAnnotation(e.getClass(), ResponseStatus.class) != null) { - throw e; - } - - logger.error("Unhandle exception occured : " + e.getMessage(), e); - - ModelAndView mav = new ModelAndView(); - mav.addObject("exception", e); - mav.addObject("url", req.getRequestURL()); - mav.setViewName(DEFAULT_ERROR_VIEW); - return mav; - } - -} \ No newline at end of file diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/HomeController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/HomeController.java deleted file mode 100644 index a9233a8609..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/HomeController.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - * Home controller - */ -@Controller -public class HomeController { - /** - * - * @param model The model attributes - * @return The view name. - */ - @RequestMapping(value = "/home") - public final String showHome(final Model model) { - return "home"; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/LoginController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/LoginController.java deleted file mode 100644 index db831e8d4d..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/LoginController.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - * LoginController - * - * - * - * - * - */ -@Controller -public class LoginController { - /** - * - * @param model The model attributes - * @return The view name. - */ - @RequestMapping(value = "/login-error") - public final String showError(final Model model) { - return "login-error"; - } - - /** - * - * @param model The model attributes - * @return The view name. - */ - @RequestMapping(value = "/login") - public final String showLogin(final Model model) { - return "login"; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/NexuController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/NexuController.java deleted file mode 100644 index c8132dcbc7..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/NexuController.java +++ /dev/null @@ -1,158 +0,0 @@ -package eu.europa.esig.dss.web.controller; - -import java.io.ByteArrayInputStream; -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; -import javax.xml.bind.DatatypeConverter; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.validation.ObjectError; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.SessionAttributes; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSUtils; -import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.EncryptionAlgorithm; -import eu.europa.esig.dss.InMemoryDocument; -import eu.europa.esig.dss.MimeType; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.web.editor.EnumPropertyEditor; -import eu.europa.esig.dss.web.model.DataToSignParams; -import eu.europa.esig.dss.web.model.GetDataToSignResponse; -import eu.europa.esig.dss.web.model.NexuSignatureDocumentForm; -import eu.europa.esig.dss.web.model.SignDocumentResponse; -import eu.europa.esig.dss.web.model.SignatureValueAsString; -import eu.europa.esig.dss.web.service.SigningService; - -@Controller -@SessionAttributes(value = { "signatureDocumentForm", "signedDocument" }) -@RequestMapping(value = "/nexu") -public class NexuController { - - private static final Logger logger = LoggerFactory.getLogger(NexuController.class); - - private static final String SIGNATURE_PARAMETERS = "nexu-signature-parameters"; - private static final String SIGNATURE_PROCESS = "nexu-signature-process"; - - @Autowired - private SigningService signingService; - - @InitBinder - public void initBinder(WebDataBinder binder) { - binder.registerCustomEditor(SignatureForm.class, new EnumPropertyEditor(SignatureForm.class)); - binder.registerCustomEditor(SignaturePackaging.class, new EnumPropertyEditor(SignaturePackaging.class)); - binder.registerCustomEditor(SignatureLevel.class, new EnumPropertyEditor(SignatureLevel.class)); - binder.registerCustomEditor(DigestAlgorithm.class, new EnumPropertyEditor(DigestAlgorithm.class)); - binder.registerCustomEditor(EncryptionAlgorithm.class, new EnumPropertyEditor(EncryptionAlgorithm.class)); - } - - @RequestMapping(method = RequestMethod.GET) - public String showSignatureParameters(Model model, HttpServletRequest request) { - NexuSignatureDocumentForm signatureDocumentForm = new NexuSignatureDocumentForm(); - model.addAttribute("signatureDocumentForm", signatureDocumentForm); - return SIGNATURE_PARAMETERS; - } - - @RequestMapping(method = RequestMethod.POST) - public String sendSignatureParameters(Model model, HttpServletRequest response, - @ModelAttribute("signatureDocumentForm") @Valid NexuSignatureDocumentForm signatureDocumentForm, BindingResult result) { - if (result.hasErrors()) { - for (ObjectError error : result.getAllErrors()) { - logger.error(error.getDefaultMessage()); - } - return SIGNATURE_PARAMETERS; - } - model.addAttribute("signatureDocumentForm", signatureDocumentForm); - return SIGNATURE_PROCESS; - } - - @RequestMapping(value = "/get-data-to-sign", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public GetDataToSignResponse getDataToSign(Model model, @RequestBody @Valid DataToSignParams params, - @ModelAttribute("signatureDocumentForm") @Valid NexuSignatureDocumentForm signatureDocumentForm, BindingResult result) { - signatureDocumentForm.setBase64Certificate(params.getSigningCertificate()); - signatureDocumentForm.setBase64CertificateChain(params.getCertificateChain()); - signatureDocumentForm.setEncryptionAlgorithm(params.getEncryptionAlgorithm()); - signatureDocumentForm.setSigningDate(new Date()); - model.addAttribute("signatureDocumentForm", signatureDocumentForm); - - ToBeSigned dataToSign = signingService.getDataToSign(signatureDocumentForm); - if (dataToSign == null) { - return null; - } - - GetDataToSignResponse responseJson = new GetDataToSignResponse(); - responseJson.setDataToSign(DatatypeConverter.printBase64Binary(dataToSign.getBytes())); - return responseJson; - } - - @RequestMapping(value = "/sign-document", method = RequestMethod.POST) - @ResponseBody - public SignDocumentResponse signDocument(Model model, @RequestBody @Valid SignatureValueAsString signatureValue, - @ModelAttribute("signatureDocumentForm") @Valid NexuSignatureDocumentForm signatureDocumentForm, BindingResult result) { - - signatureDocumentForm.setBase64SignatureValue(signatureValue.getSignatureValue()); - - DSSDocument document = signingService.signDocument(signatureDocumentForm); - InMemoryDocument signedDocument = new InMemoryDocument(DSSUtils.toByteArray(document), document.getName(), document.getMimeType()); - model.addAttribute("signedDocument", signedDocument); - - SignDocumentResponse signedDocumentResponse = new SignDocumentResponse(); - signedDocumentResponse.setUrlToDownload("download"); - return signedDocumentResponse; - } - - @RequestMapping(value = "/download", method = RequestMethod.GET) - public String downloadSignedFile(@ModelAttribute("signedDocument") InMemoryDocument signedDocument, HttpServletResponse response) { - try { - MimeType mimeType = signedDocument.getMimeType(); - if (mimeType != null) { - response.setContentType(mimeType.getMimeTypeString()); - } - response.setHeader("Content-Transfer-Encoding", "binary"); - response.setHeader("Content-Disposition", "attachment; filename=\"" + signedDocument.getName() + "\""); - IOUtils.copy(new ByteArrayInputStream(signedDocument.getBytes()), response.getOutputStream()); - - } catch (Exception e) { - logger.error("An error occured while pushing file in response : " + e.getMessage(), e); - } - return null; - } - - @ModelAttribute("signatureForms") - public SignatureForm[] getSignatureForms() { - return SignatureForm.values(); - } - - @ModelAttribute("signaturePackagings") - public SignaturePackaging[] getSignaturePackagings() { - return SignaturePackaging.values(); - } - - @ModelAttribute("digestAlgos") - public DigestAlgorithm[] getDigestAlgorithms() { - DigestAlgorithm[] algos = new DigestAlgorithm[] { DigestAlgorithm.SHA1, DigestAlgorithm.SHA224, DigestAlgorithm.SHA256, DigestAlgorithm.SHA384, - DigestAlgorithm.SHA512 }; - return algos; - } -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/NexuDeployScriptController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/NexuDeployScriptController.java deleted file mode 100644 index 2066f0ccfd..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/NexuDeployScriptController.java +++ /dev/null @@ -1,57 +0,0 @@ -package eu.europa.esig.dss.web.controller; - -import java.io.IOException; -import java.io.StringWriter; -import java.util.HashMap; -import java.util.Map; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -import freemarker.template.Configuration; -import freemarker.template.Template; - -@Controller -public class NexuDeployScriptController { - - @Value("${baseUrl}") - private String baseUrl; - - @Value("${nexuUrl}") - private String nexuUrl = "http://localhost:9876/"; - - private Template template; - - public NexuDeployScriptController() { - try { - Configuration cfg = new Configuration(Configuration.VERSION_2_3_22); - cfg.setClassForTemplateLoading(getClass(), "/"); - this.template = cfg.getTemplate("nexu_deploy.ftl.js", "UTF-8"); - } catch (IOException e) { - throw new RuntimeException(); - } - } - - @RequestMapping("/js/nexu-deploy.js") - public ResponseEntity loadScript() throws Exception { - - StringWriter outWriter = new StringWriter(); - - Map model = new HashMap(); - - model.put("baseUrl", baseUrl); - model.put("nexuUrl", nexuUrl); - - template.process(model, outWriter); - - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.parseMediaType("text/javascript")); - - return new ResponseEntity(outWriter.toString(), headers, HttpStatus.ACCEPTED); - } -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/SignatureStandaloneController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/SignatureStandaloneController.java deleted file mode 100644 index 04755ef59a..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/SignatureStandaloneController.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.europa.esig.dss.web.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -@Controller -public class SignatureStandaloneController { - - @RequestMapping(value = "/signature-standalone", method = RequestMethod.GET) - public String getInfo() { - return "signature-standalone"; - } - - @RequestMapping(value = "/signature-rest", method = RequestMethod.GET) - public String getRestInfo() { - return "signature-rest"; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/TrustedListController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/TrustedListController.java deleted file mode 100644 index f56e991727..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/TrustedListController.java +++ /dev/null @@ -1,35 +0,0 @@ -package eu.europa.esig.dss.web.controller; - -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import eu.europa.esig.dss.tsl.service.TSLRepository; - -@Controller -@RequestMapping(value = "/tsl-info") -public class TrustedListController { - - @Autowired - private TSLRepository tslRepository; - - @RequestMapping(method = RequestMethod.GET) - public String getSummary(final Model model) { - model.addAttribute("summary", tslRepository.getSummary()); - return "tsl-info"; - } - - @RequestMapping(value = "/{country:[a-z][a-z]}", method = RequestMethod.GET) - public String getByCountry(@PathVariable String country, Model model) { - String countryUppercase = StringUtils.upperCase(country); - model.addAttribute("country", countryUppercase); - model.addAttribute("countries", tslRepository.getAllMapTSLValidationModels().keySet()); - model.addAttribute("model", tslRepository.getByCountry(countryUppercase)); - return "tsl-info-country"; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/ValidationController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/ValidationController.java deleted file mode 100644 index da8e59b102..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/ValidationController.java +++ /dev/null @@ -1,199 +0,0 @@ -package eu.europa.esig.dss.web.controller; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.validation.Valid; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.SessionAttributes; -import org.springframework.web.multipart.MultipartFile; - -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.MimeType; -import eu.europa.esig.dss.validation.CertificateVerifier; -import eu.europa.esig.dss.validation.SignedDocumentValidator; -import eu.europa.esig.dss.validation.executor.ValidationLevel; -import eu.europa.esig.dss.validation.reports.Reports; -import eu.europa.esig.dss.validation.reports.wrapper.DiagnosticData; -import eu.europa.esig.dss.web.WebAppUtils; -import eu.europa.esig.dss.web.editor.EnumPropertyEditor; -import eu.europa.esig.dss.web.model.ValidationForm; -import eu.europa.esig.dss.web.service.FOPService; -import eu.europa.esig.dss.web.service.XSLTService; - -@Controller -@SessionAttributes({ "simpleReportXml", "detailedReportXml", "reportsList" }) -@RequestMapping(value = "/validation") -public class ValidationController { - - private static final Logger logger = LoggerFactory.getLogger(ValidationController.class); - - private static final String VALIDATION_TILE = "validation"; - private static final String VALIDATION_RESULT_TILE = "validation_result"; - - private static final String SIMPLE_REPORT_ATTRIBUTE = "simpleReportXml"; - private static final String DETAILED_REPORT_ATTRIBUTE = "detailedReportXml"; - private static final String REPORTS_LIST = "reportsList"; - - @Autowired - private CertificateVerifier certificateVerifier; - - @Autowired - private XSLTService xsltService; - - @Autowired - private FOPService fopService; - - @InitBinder - public void initBinder(WebDataBinder binder) { - binder.registerCustomEditor(ValidationLevel.class, new EnumPropertyEditor(ValidationLevel.class)); - } - - @RequestMapping(method = RequestMethod.GET) - public String showValidationForm(Model model, HttpServletRequest request) { - ValidationForm validationForm = new ValidationForm(); - validationForm.setValidationLevel(ValidationLevel.ARCHIVAL_DATA); - validationForm.setDefaultPolicy(true); - model.addAttribute("validationForm", validationForm); - return VALIDATION_TILE; - } - - @RequestMapping(method = RequestMethod.POST) - public String validate(@ModelAttribute("validationForm") @Valid ValidationForm validationForm, BindingResult result, Model model) { - if (result.hasErrors()) { - return VALIDATION_TILE; - } - - SignedDocumentValidator documentValidator = SignedDocumentValidator.fromDocument(WebAppUtils.toDSSDocument(validationForm.getSignedFile())); - documentValidator.setCertificateVerifier(certificateVerifier); - - MultipartFile originalFile = validationForm.getOriginalFile(); - if ((originalFile != null) && !originalFile.isEmpty()) { - List detachedContents = new ArrayList(); - detachedContents.add(WebAppUtils.toDSSDocument(originalFile)); - documentValidator.setDetachedContents(detachedContents); - } - documentValidator.setValidationLevel(validationForm.getValidationLevel()); - - Reports reports = null; - - MultipartFile policyFile = validationForm.getPolicyFile(); - if (!validationForm.isDefaultPolicy() && (policyFile != null) && !policyFile.isEmpty()) { - try { - reports = documentValidator.validateDocument(policyFile.getInputStream()); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } else { - reports = documentValidator.validateDocument(); - } - - // reports.print(); - - String xmlSimpleReport = reports.getXmlSimpleReport(); - model.addAttribute(SIMPLE_REPORT_ATTRIBUTE, xmlSimpleReport); - model.addAttribute("simpleReport", xsltService.generateSimpleReport(xmlSimpleReport)); - - String xmlDetailedReport = reports.getXmlDetailedReport(); - model.addAttribute(DETAILED_REPORT_ATTRIBUTE, xmlDetailedReport); - model.addAttribute("detailedReport", xsltService.generateDetailedReport(xmlDetailedReport)); - - model.addAttribute("diagnosticTree", reports.getXmlDiagnosticData()); - - List reportsNameList = new ArrayList(); - List reportsList = new ArrayList(); - while (reports != null) { - reportsNameList.add(reports.getDiagnosticData().getDocumentName()); - reportsList.add(reports); - reports = reports.getNextReports(); - } - model.addAttribute(REPORTS_LIST, reportsList); - model.addAttribute("reports", reportsNameList); - - return VALIDATION_RESULT_TILE; - } - - @SuppressWarnings("unchecked") - @RequestMapping(value = "/report", method = RequestMethod.GET) - public String getReports(@RequestParam("name") String reportFileName, HttpSession session, Model model) { - Reports reports = null; - List reportsList = (List) session.getAttribute(REPORTS_LIST); - List reportsNameList = new ArrayList(); - for (Reports report : reportsList) { - DiagnosticData diagnosticData = report.getDiagnosticData(); - String name = diagnosticData.getDocumentName(); - if (name.equals(reportFileName)) { - model.addAttribute("selected", name); - reports = report; - } - } - - String xmlSimpleReport = reports.getXmlSimpleReport(); - model.addAttribute(SIMPLE_REPORT_ATTRIBUTE, xmlSimpleReport); - model.addAttribute("simpleReport", xsltService.generateSimpleReport(xmlSimpleReport)); - - String xmlDetailedReport = reports.getXmlDetailedReport(); - model.addAttribute(DETAILED_REPORT_ATTRIBUTE, xmlDetailedReport); - model.addAttribute("detailedReport", xsltService.generateDetailedReport(xmlDetailedReport)); - - model.addAttribute("diagnosticTree", reports.getXmlDiagnosticData()); - - for (Reports report : reportsList) { - DiagnosticData diagnosticData = report.getDiagnosticData(); - reportsNameList.add(diagnosticData.getDocumentName()); - } - model.addAttribute("reports", reportsNameList); - - return VALIDATION_RESULT_TILE; - } - - @RequestMapping(value = "/download-simple-report") - public void downloadSimpleReport(HttpSession session, HttpServletResponse response) { - try { - String simpleReport = (String) session.getAttribute(SIMPLE_REPORT_ATTRIBUTE); - - response.setContentType(MimeType.PDF.getMimeTypeString()); - response.setHeader("Content-Disposition", "attachment; filename=DSS-Simple-report.pdf"); - - fopService.generateSimpleReport(simpleReport, response.getOutputStream()); - } catch (Exception e) { - logger.error("An error occured while generating pdf for simple report : " + e.getMessage(), e); - } - } - - @RequestMapping(value = "/download-detailed-report") - public void downloadDetailedReport(HttpSession session, HttpServletResponse response) { - try { - String detailedReport = (String) session.getAttribute(DETAILED_REPORT_ATTRIBUTE); - - response.setContentType(MimeType.PDF.getMimeTypeString()); - response.setHeader("Content-Disposition", "attachment; filename=DSS-Detailed-report.pdf"); - - fopService.generateDetailedReport(detailedReport, response.getOutputStream()); - } catch (Exception e) { - logger.error("An error occured while generating pdf for detailed report : " + e.getMessage(), e); - } - } - - @ModelAttribute("validationLevels") - public ValidationLevel[] getValidationLevels() { - return new ValidationLevel[] { ValidationLevel.BASIC_SIGNATURES, ValidationLevel.LONG_TERM_DATA, ValidationLevel.ARCHIVAL_DATA }; - } - -} \ No newline at end of file diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/ValidationPolicyController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/ValidationPolicyController.java deleted file mode 100644 index 44429c7574..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/ValidationPolicyController.java +++ /dev/null @@ -1,99 +0,0 @@ -package eu.europa.esig.dss.web.controller; - -import java.io.ByteArrayInputStream; - -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.propertyeditors.StringTrimmerEditor; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.EncryptionAlgorithm; -import eu.europa.esig.dss.tsl.KeyUsageBit; -import eu.europa.esig.dss.validation.ValidationResourceManager; -import eu.europa.esig.dss.web.service.PolicyJaxbService; -import eu.europa.esig.jaxb.policy.ConstraintsParameters; -import eu.europa.esig.jaxb.policy.TimeUnit; - -@Controller -@RequestMapping(value = "/validation-policy") -public class ValidationPolicyController { - - private static final Logger logger = LoggerFactory.getLogger(ValidationPolicyController.class); - - private static final String VALIDATION_POLICY_TILE = "validation-policy"; - - @Autowired - private PolicyJaxbService policyJaxbService; - - @InitBinder - public void initBinder(WebDataBinder binder) { - binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); - } - - @ModelAttribute("supportedDigestAlgos") - public DigestAlgorithm[] getSupportedDigestAlgos() { - return DigestAlgorithm.values(); - } - - @ModelAttribute("supportedEncryptionAlgos") - public EncryptionAlgorithm[] getSupportedEncryptionAlgos() { - return EncryptionAlgorithm.values(); - } - - @ModelAttribute("supportedPolicies") - public String[] getSupportedPolicies() { - return new String[] { - "NO_POLICY", "ANY_POLICY", "IMPLICIT_POLICY" - }; - } - - @ModelAttribute("timeUnits") - public TimeUnit[] getTimeUnits() { - return TimeUnit.values(); - } - - @ModelAttribute("keyUsages") - public KeyUsageBit[] getKeyUsages() { - return KeyUsageBit.values(); - } - - @RequestMapping(method = RequestMethod.GET) - public String showValidationPolicy(Model model) { - - model.addAttribute("policy", policyJaxbService.unmarshall(ValidationResourceManager.defaultPolicyConstraintsLocation)); - - return VALIDATION_POLICY_TILE; - } - - @RequestMapping(method = RequestMethod.POST) - public String save(@ModelAttribute("policy") ConstraintsParameters policy, Model model, HttpServletResponse response) { - - model.addAttribute("policy", policy); - String xmlResult = policyJaxbService.marshall(policy); - model.addAttribute("xmlResult", xmlResult); - - try { - response.setContentType("application/force-download"); - response.setHeader("Content-Transfer-Encoding", "binary"); - response.setHeader("Content-Disposition", "attachment; filename=constraints.xml"); - IOUtils.copy(new ByteArrayInputStream(xmlResult.getBytes()), response.getOutputStream()); - - return null; - } catch (Exception e) { - logger.error("An error occured while pushing file in response : " + e.getMessage(), e); - } - - return VALIDATION_POLICY_TILE; - } -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/AdministrationController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/AdministrationController.java deleted file mode 100644 index 886ceee136..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/AdministrationController.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.controller.preferences; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import eu.europa.esig.dss.client.http.proxy.ProxyPreferenceManager; -import eu.europa.esig.dss.web.dao.PreferencesDao; - -/** - * Administration controller - */ -@Controller -@RequestMapping(value = "/admin") -public class AdministrationController { - - - /** - * @see ProxyPreferenceManager - */ - @Autowired - @Qualifier("proxyPreferenceManager") - private ProxyPreferenceManager proxyPreferenceManager; - - /** - * @see PreferencesDao - */ - @Autowired - @Qualifier("preferencesDao") - private PreferencesDao preferencesDao; - - /** - * @param model - * The model attributes - * @return a view name - */ - @RequestMapping(value = { "", "/", "/general"}, method = RequestMethod.GET) - public String showGlobal(final Model model) { - model.addAttribute("preferences", preferencesDao.getAll()); - return "admin-general-list"; - } - - /** - * @param model - * The model attributes - * @return a view name - */ - @RequestMapping(value = "/proxy", method = RequestMethod.GET) - public String showProxy(final Model model) { - model.addAttribute("preferences", proxyPreferenceManager.list()); - return "admin-proxy-list"; - } - - - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/CertificateController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/CertificateController.java deleted file mode 100644 index 63fdc66987..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/CertificateController.java +++ /dev/null @@ -1,74 +0,0 @@ -package eu.europa.esig.dss.web.controller.preferences; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.SessionAttributes; - -import eu.europa.esig.dss.DSSUtils; -import eu.europa.esig.dss.web.model.CertificateForm; -import eu.europa.esig.dss.web.service.KeystoreService; -import eu.europa.esig.dss.x509.CertificateToken; - -@Controller -@SessionAttributes(value = "certificateForm") -@RequestMapping(value = "/admin/certificates") -public class CertificateController { - - private static final Logger logger = LoggerFactory.getLogger(CertificateController.class); - - private static final String CERTIFICATE_TILE = "admin-select-certificate"; - - @Autowired - private KeystoreService keystoreService; - - @RequestMapping(method = RequestMethod.GET) - public String showCertificates(Model model, HttpServletRequest request) { - CertificateForm certificateForm = new CertificateForm(); - model.addAttribute("certificateForm", certificateForm); - model.addAttribute("keystoreCertificates", keystoreService.getCertificatesDTOFromKeyStore()); - return CERTIFICATE_TILE; - } - - @RequestMapping(method = RequestMethod.POST) - public String uploadCertificate(Model model, HttpServletRequest request, HttpServletResponse response, - @ModelAttribute("certificateForm") @Valid CertificateForm certificateForm, BindingResult result) { - - if (result.hasErrors()) { - model.addAttribute("keystoreCertificates", keystoreService.getCertificatesDTOFromKeyStore()); - return CERTIFICATE_TILE; - } - - try { - CertificateToken certificateToken = DSSUtils.loadCertificate(certificateForm.getCertificateFile().getBytes()); - model.addAttribute("certificateDTO", keystoreService.getCertificateDTO(certificateToken)); - if (certificateForm.isAddToKeystore()) { - keystoreService.addCertificateToKeyStore(certificateToken); - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - - model.addAttribute("keystoreCertificates", keystoreService.getCertificatesDTOFromKeyStore()); - return CERTIFICATE_TILE; - } - - @RequestMapping(method = RequestMethod.POST, params = "delete") - public String deleteCertificate(Model model, HttpServletRequest request, HttpServletResponse response) { - keystoreService.deleteCertificateFromKeyStore(request.getParameter("dssId")); - model.addAttribute("keystoreCertificates", keystoreService.getCertificatesDTOFromKeyStore()); - model.addAttribute("certificateForm", new CertificateForm()); - return CERTIFICATE_TILE; - } - -} \ No newline at end of file diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/GeneralEditController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/GeneralEditController.java deleted file mode 100644 index 1de833dfe1..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/GeneralEditController.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.controller.preferences; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.context.request.WebRequest; - -import eu.europa.esig.dss.web.dao.PreferencesDao; -import eu.europa.esig.dss.web.model.Preference; -import eu.europa.esig.dss.web.model.PreferenceForm; -import eu.europa.esig.dss.web.model.PreferenceKey; - -/** - * - * General edit controller - * - */ -@Controller -@RequestMapping(value = "/admin/general") -public class GeneralEditController { - - /** - * @see PreferencesDao - */ - @Autowired - private PreferencesDao preferencesDao; - - /** - * - * @param webRequest The web request - * @return a form bean - */ - @ModelAttribute("preferenceForm") - public final PreferenceForm setupForm(final WebRequest webRequest) { - - final String requestKey = webRequest.getParameter("key"); - final PreferenceForm form = new PreferenceForm(); - final Preference preference = preferencesDao.get(PreferenceKey.fromKey(requestKey)); - form.setKey(preference.getKey()); - form.setValue(preference.getValue()); - - return form; - } - - /** - * - * @param model The model attributes - * @return a view name - */ - @RequestMapping(value = "/edit", method = RequestMethod.GET) - public String showForm(final Model model) { - return "admin-general-edit"; - } - - @Autowired - private PreferenceFormValidator preferenceFormValidator; - - @InitBinder - protected void initBinder(WebDataBinder binder) { - binder.setValidator(preferenceFormValidator); - } - - /** - * - * @param form a form bean - * @return a view name - */ - @RequestMapping(value = "/edit", method = RequestMethod.POST) - public String updatePreferences(@ModelAttribute("preferenceForm") @Valid final PreferenceForm form, BindingResult bindingResult) { - if (bindingResult.hasErrors()) { - return "admin-general-edit"; - } - Preference preference = new Preference(); - preference.setKey(form.getKey()); - preference.setValue(form.getValue()); - - preferencesDao.update(preference); - - return "redirect:/admin/general"; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/PreferenceFormValidator.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/PreferenceFormValidator.java deleted file mode 100644 index 7b85b52487..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/PreferenceFormValidator.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.controller.preferences; - -import java.net.URL; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.springframework.stereotype.Component; -import org.springframework.validation.Errors; -import org.springframework.validation.Validator; - -import eu.europa.esig.dss.web.model.PreferenceForm; -import eu.europa.esig.dss.web.model.PreferenceKey; - -/** - * Validator for PreferenceForm - */ -@Component -public class PreferenceFormValidator implements Validator { - - @Override - public boolean supports(Class clazz) { - return clazz.equals(PreferenceForm.class); - } - - @Override - public void validate(Object target, Errors errors) { - PreferenceForm preferenceForm = (PreferenceForm) target; - if (preferenceForm.getKey().equals(PreferenceKey.DEFAULT_POLICY_URL.toString())) { - // check that the entered URL is loadable - final String value = preferenceForm.getValue(); - if (StringUtils.isNotBlank(value)) { - try { - IOUtils.toString(new URL(value).openStream()); - } catch (Exception e) { - errors.rejectValue("value", "url.error"); - } - } - } - } -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/ProxyEditController.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/ProxyEditController.java deleted file mode 100644 index 63a8364b80..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/controller/preferences/ProxyEditController.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.controller.preferences; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.context.request.WebRequest; - -import eu.europa.esig.dss.client.http.proxy.ProxyKey; -import eu.europa.esig.dss.client.http.proxy.ProxyPreference; -import eu.europa.esig.dss.client.http.proxy.ProxyPreferenceManager; -import eu.europa.esig.dss.web.model.PreferenceForm; - -/** - * Controller for proxi edition - */ -@Controller -@RequestMapping(value = "/admin/proxy") -public class ProxyEditController { - - private static final Logger logger = LoggerFactory.getLogger(ProxyEditController.class); - - @Autowired - private ProxyPreferenceManager proxyPreferenceManager; - - /** - * @param webRequest - * The web request - * @return a proxy form bean - */ - @ModelAttribute("preferenceForm") - public final PreferenceForm setupForm(final WebRequest webRequest) { - - final String requestKey = webRequest.getParameter("key"); - final PreferenceForm form = new PreferenceForm(); - final ProxyKey proxyKey = ProxyKey.fromKey(requestKey); - final ProxyPreference preference = proxyPreferenceManager.get(proxyKey); - - form.setKey(preference.getProxyKey().getKeyName()); - form.setValue(preference.getValue()); - - return form; - } - - /** - * @param model - * The view model - * @return a view name - */ - @RequestMapping(value = "/edit", method = RequestMethod.GET) - public String showForm(final Model model) { - return "admin-proxy-edit"; - } - - /** - * @param form - * The proxy form bean - * @return a view name - */ - @RequestMapping(value = "/edit", method = RequestMethod.POST) - public String updatePreferences(@ModelAttribute("preferenceForm") final PreferenceForm form) { - final String proxyKeyString = form.getKey(); - final String proxyValueString = form.getValue(); - proxyPreferenceManager.update(proxyKeyString, proxyValueString); - logger.trace(">>> Proxy preference updated: " + proxyKeyString + "(" + proxyValueString + ")/" + proxyPreferenceManager); - return "redirect:/admin/proxy"; - } -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/dao/PreferencesDao.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/dao/PreferencesDao.java deleted file mode 100644 index cab907aff3..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/dao/PreferencesDao.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.dao; - -import eu.europa.esig.dss.web.model.Preference; -import eu.europa.esig.dss.web.model.PreferenceKey; - -/** - * - * TODO - * - * - * - * - * - * - */ -public interface PreferencesDao extends GenericDao { - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/dao/PreferencesJdbcDao.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/dao/PreferencesJdbcDao.java deleted file mode 100644 index ebdaff934e..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/dao/PreferencesJdbcDao.java +++ /dev/null @@ -1,176 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Required; - -import eu.europa.esig.dss.client.http.proxy.ProxyDaoException; -import eu.europa.esig.dss.web.model.Preference; -import eu.europa.esig.dss.web.model.PreferenceKey; - -public class PreferencesJdbcDao implements PreferencesDao { - - private DataSource dataSource; - - /** - * Set the datasource - * - * @param dataSource The datasource - */ - @Required - public void setDataSource(DataSource dataSource) { - this.dataSource = dataSource; - } - - - /* - * (non-Javadoc) - * - * @see eu.europa.esig.dss.web.dao.GenericDao#get(java.lang.Object) - */ - @Override - public Preference get(PreferenceKey id) { - final String query = "select * from PREFERENCES where PREF_KEY = ?"; - Connection connection = null; - PreparedStatement preparedStatement = null; - ResultSet resultSet = null; - try { - - connection = dataSource.getConnection(); - preparedStatement = connection.prepareStatement(query); - preparedStatement.setString(1, id.toString()); - resultSet = preparedStatement.executeQuery(); - if (resultSet.next()) { - - final Preference pref = new Preference(); - pref.setKey(resultSet.getString("PREF_KEY")); - pref.setValue(resultSet.getString("PREF_VALUE")); - return pref; - } - return null; - } catch (SQLException e) { - throw new ProxyDaoException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - if (preparedStatement != null) { - preparedStatement.close(); - } - - if ((connection != null) && !connection.isClosed()) { - connection.close(); - } - } catch (SQLException e) { - - } - } - - } - - /* - * (non-Javadoc) - * - * @see eu.europa.esig.dss.web.dao.GenericDao#getAll() - */ - @Override - public List getAll() { - final String query = "select * from PREFERENCES"; - Connection connection = null; - PreparedStatement ps = null; - ResultSet rs = null; - List prefs = new ArrayList(); - try { - connection = dataSource.getConnection(); - ps = connection.prepareStatement(query); - rs = ps.executeQuery(); - while (rs.next()) { - Preference pp = new Preference(); - pp.setKey(rs.getString("PREF_KEY")); - pp.setValue(rs.getString("PREF_VALUE")); - prefs.add(pp); - } - } catch (SQLException e) { - throw new ProxyDaoException(e); - } finally { - try { - if (rs != null) { - rs.close(); - } - if (ps != null) { - ps.close(); - } - - if ((connection != null) && !connection.isClosed()) { - connection.close(); - } - } catch (SQLException e) { - - } - } - return prefs; - } - - - /* - * (non-Javadoc) - * - * @see eu.europa.esig.dss.web.dao.GenericDao#update(java.lang.Object) - */ - @Override - public void update(Preference entity) { - final String query = "update PREFERENCES set PREF_VALUE = ? where PREF_KEY = ?"; - - Connection connection = null; - PreparedStatement preparedStatement = null; - try { - connection = dataSource.getConnection(); - preparedStatement = connection.prepareStatement(query); - preparedStatement.setString(1, entity.getValue()); - preparedStatement.setString(2, entity.getKey()); - preparedStatement.executeUpdate(); - } catch (SQLException e) { - throw new ProxyDaoException(e); - } finally { - try { - if (preparedStatement != null) { - preparedStatement.close(); - } - - if ((connection != null) && !connection.isClosed()) { - connection.close(); - } - } catch (SQLException e) { - } - } - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/editor/EnumPropertyEditor.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/editor/EnumPropertyEditor.java deleted file mode 100644 index 3838cd03bb..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/editor/EnumPropertyEditor.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.europa.esig.dss.web.editor; - -import java.beans.PropertyEditorSupport; - -import org.apache.commons.lang.StringUtils; - -public class EnumPropertyEditor extends PropertyEditorSupport { - - @SuppressWarnings("rawtypes") - private Class clazzEnum; - - public EnumPropertyEditor(Class clazzEnum) { - this.clazzEnum = clazzEnum; - } - - @Override - @SuppressWarnings("rawtypes") - public String getAsText() { - return getValue() == null ? StringUtils.EMPTY : ((Enum) getValue()).name(); - } - - @Override - @SuppressWarnings("unchecked") - public void setAsText(String text) throws IllegalArgumentException { - try { - setValue(Enum.valueOf(clazzEnum, text)); - } catch (Exception e) { - setValue(null); - } - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/interceptor/WebappInterceptor.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/interceptor/WebappInterceptor.java deleted file mode 100644 index 95b430a17b..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/interceptor/WebappInterceptor.java +++ /dev/null @@ -1,24 +0,0 @@ -package eu.europa.esig.dss.web.interceptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; - -import eu.europa.esig.dss.tsl.service.TSLRepository; - -public class WebappInterceptor extends HandlerInterceptorAdapter { - - @Autowired - private TSLRepository tslRepository; - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - - request.setAttribute("lotlOK", tslRepository.isOk()); - - return true; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/CertificateDTO.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/CertificateDTO.java deleted file mode 100644 index 4cf45a92f9..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/CertificateDTO.java +++ /dev/null @@ -1,90 +0,0 @@ -package eu.europa.esig.dss.web.model; - -import java.util.Date; - -public class CertificateDTO { - - private String dssId; - private String subjetName; - private String issuerName; - private Date notBefore; - private Date notAfter; - - private String sha1Hex; - private String sha256Hex; - private String sha1Base64; - private String sha256Base64; - - public String getDssId() { - return dssId; - } - - public void setDssId(String dssId) { - this.dssId = dssId; - } - - public String getSubjetName() { - return subjetName; - } - - public void setSubjetName(String subjetName) { - this.subjetName = subjetName; - } - - public String getIssuerName() { - return issuerName; - } - - public void setIssuerName(String issuerName) { - this.issuerName = issuerName; - } - - public Date getNotBefore() { - return notBefore; - } - - public void setNotBefore(Date notBefore) { - this.notBefore = notBefore; - } - - public Date getNotAfter() { - return notAfter; - } - - public void setNotAfter(Date notAfter) { - this.notAfter = notAfter; - } - - public String getSha1Hex() { - return sha1Hex; - } - - public void setSha1Hex(String sha1Hex) { - this.sha1Hex = sha1Hex; - } - - public String getSha256Hex() { - return sha256Hex; - } - - public void setSha256Hex(String sha256Hex) { - this.sha256Hex = sha256Hex; - } - - public String getSha1Base64() { - return sha1Base64; - } - - public void setSha1Base64(String sha1Base64) { - this.sha1Base64 = sha1Base64; - } - - public String getSha256Base64() { - return sha256Base64; - } - - public void setSha256Base64(String sha256Base64) { - this.sha256Base64 = sha256Base64; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/CertificateForm.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/CertificateForm.java deleted file mode 100644 index 1991283dd6..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/CertificateForm.java +++ /dev/null @@ -1,34 +0,0 @@ -package eu.europa.esig.dss.web.model; - -import javax.validation.constraints.AssertTrue; - -import org.springframework.web.multipart.MultipartFile; - -public class CertificateForm { - - private MultipartFile certificateFile; - - private boolean addToKeystore; - - public MultipartFile getCertificateFile() { - return certificateFile; - } - - public void setCertificateFile(MultipartFile certificateFile) { - this.certificateFile = certificateFile; - } - - public boolean isAddToKeystore() { - return addToKeystore; - } - - public void setAddToKeystore(boolean addToKeystore) { - this.addToKeystore = addToKeystore; - } - - @AssertTrue(message = "{error.certificate.mandatory}") - public boolean isCertificateFile() { - return (certificateFile != null) && (!certificateFile.isEmpty()); - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/DataToSignParams.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/DataToSignParams.java deleted file mode 100644 index 56fc4d8738..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/DataToSignParams.java +++ /dev/null @@ -1,47 +0,0 @@ -package eu.europa.esig.dss.web.model; - -import java.io.Serializable; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import eu.europa.esig.dss.EncryptionAlgorithm; - -@SuppressWarnings("serial") -public class DataToSignParams implements Serializable { - - @NotNull - private String signingCertificate; - @NotNull - private List certificateChain; - @NotNull - private EncryptionAlgorithm encryptionAlgorithm; - - public DataToSignParams() { - } - - public String getSigningCertificate() { - return signingCertificate; - } - - public void setSigningCertificate(String signingCertificate) { - this.signingCertificate = signingCertificate; - } - - public List getCertificateChain() { - return certificateChain; - } - - public void setCertificateChain(List certificateChain) { - this.certificateChain = certificateChain; - } - - public EncryptionAlgorithm getEncryptionAlgorithm() { - return encryptionAlgorithm; - } - - public void setEncryptionAlgorithm(EncryptionAlgorithm encryptionAlgorithm) { - this.encryptionAlgorithm = encryptionAlgorithm; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/ExtensionForm.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/ExtensionForm.java deleted file mode 100644 index 8dcb5202e5..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/ExtensionForm.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.europa.esig.dss.web.model; - -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.NotNull; - -import org.springframework.web.multipart.MultipartFile; - -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; - -public class ExtensionForm { - - private MultipartFile signedFile; - - private MultipartFile originalFile; - - @NotNull(message = "{error.signature.form.mandatory}") - private SignatureForm signatureForm; - - private SignatureForm asicUnderlyingForm; - - @NotNull(message = "{error.signature.level.mandatory}") - private SignatureLevel signatureLevel; - - public MultipartFile getSignedFile() { - return signedFile; - } - - public void setSignedFile(MultipartFile signedFile) { - this.signedFile = signedFile; - } - - public MultipartFile getOriginalFile() { - return originalFile; - } - - public void setOriginalFile(MultipartFile originalFile) { - this.originalFile = originalFile; - } - - public SignatureForm getSignatureForm() { - return signatureForm; - } - - public void setSignatureForm(SignatureForm signatureForm) { - this.signatureForm = signatureForm; - } - - public SignatureForm getAsicUnderlyingForm() { - return asicUnderlyingForm; - } - - public void setAsicUnderlyingForm(SignatureForm asicUnderlyingForm) { - this.asicUnderlyingForm = asicUnderlyingForm; - } - - - public SignatureLevel getSignatureLevel() { - return signatureLevel; - } - - public void setSignatureLevel(SignatureLevel signatureLevel) { - this.signatureLevel = signatureLevel; - } - - @AssertTrue(message = "{error.signed.file.mandatory}") - public boolean isSignedFile() { - return (signedFile != null) && (!signedFile.isEmpty()); - } - - @AssertTrue(message = "{error.signature.underlying.form.mandatory}") - public boolean isAsicUnderlyingFormValid(){ - if (SignatureForm.ASiC_S.equals(signatureForm) || SignatureForm.ASiC_E.equals(signatureForm)){ - return SignatureForm.CAdES.equals(asicUnderlyingForm) || SignatureForm.XAdES.equals(asicUnderlyingForm); - } else{ - return true; - } - } -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/GetDataToSignResponse.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/GetDataToSignResponse.java deleted file mode 100644 index 813e07fd4e..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/GetDataToSignResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package eu.europa.esig.dss.web.model; - -public class GetDataToSignResponse { - - private String dataToSign; - - public String getDataToSign() { - return dataToSign; - } - - public void setDataToSign(String dataToSign) { - this.dataToSign = dataToSign; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/NexuSignatureDocumentForm.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/NexuSignatureDocumentForm.java deleted file mode 100644 index f107fdb070..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/NexuSignatureDocumentForm.java +++ /dev/null @@ -1,197 +0,0 @@ -package eu.europa.esig.dss.web.model; - -import java.util.Date; -import java.util.List; - -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.NotNull; - -import org.springframework.web.multipart.MultipartFile; - -import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.EncryptionAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; - -public class NexuSignatureDocumentForm { - - // @AssertTrue(message = "{error.nexu.not.found}") - private boolean nexuDetected; - - private Date signingDate; - - private boolean signWithExpiredCertificate; - - private MultipartFile documentToSign; - - @NotNull(message = "{error.signature.form.mandatory}") - private SignatureForm signatureForm; - - private SignatureForm asicUnderlyingForm; - - @NotNull(message = "{error.signature.packaging.mandatory}") - private SignaturePackaging signaturePackaging; - - @NotNull(message = "{error.signature.level.mandatory}") - private SignatureLevel signatureLevel; - - @NotNull(message = "{error.digest.algo.mandatory}") - private DigestAlgorithm digestAlgorithm; - - private String policyOid; - - private DigestAlgorithm policyDigestAlgorithm; - - private String policyBase64HashValue; - - private String base64Certificate; - - private List base64CertificateChain; - - private EncryptionAlgorithm encryptionAlgorithm; - - private String base64SignatureValue; - - public boolean isNexuDetected() { - return nexuDetected; - } - - public void setNexuDetected(boolean nexuDetected) { - this.nexuDetected = nexuDetected; - } - - public Date getSigningDate() { - return signingDate; - } - - public void setSigningDate(Date signingDate) { - this.signingDate = signingDate; - } - - public boolean isSignWithExpiredCertificate() { - return signWithExpiredCertificate; - } - - public void setSignWithExpiredCertificate(boolean signWithExpiredCertificate) { - this.signWithExpiredCertificate = signWithExpiredCertificate; - } - - public MultipartFile getDocumentToSign() { - return documentToSign; - } - - public void setDocumentToSign(MultipartFile documentToSign) { - this.documentToSign = documentToSign; - } - - public SignatureForm getSignatureForm() { - return signatureForm; - } - - public void setSignatureForm(SignatureForm signatureForm) { - this.signatureForm = signatureForm; - } - - public SignatureForm getAsicUnderlyingForm() { - return asicUnderlyingForm; - } - - public void setAsicUnderlyingForm(SignatureForm asicUnderlyingForm) { - this.asicUnderlyingForm = asicUnderlyingForm; - } - - public SignaturePackaging getSignaturePackaging() { - return signaturePackaging; - } - - public void setSignaturePackaging(SignaturePackaging signaturePackaging) { - this.signaturePackaging = signaturePackaging; - } - - public SignatureLevel getSignatureLevel() { - return signatureLevel; - } - - public void setSignatureLevel(SignatureLevel signatureLevel) { - this.signatureLevel = signatureLevel; - } - - public DigestAlgorithm getDigestAlgorithm() { - return digestAlgorithm; - } - - public void setDigestAlgorithm(DigestAlgorithm digestAlgorithm) { - this.digestAlgorithm = digestAlgorithm; - } - - public String getBase64Certificate() { - return base64Certificate; - } - - public void setBase64Certificate(String base64Certificate) { - this.base64Certificate = base64Certificate; - } - - public List getBase64CertificateChain() { - return base64CertificateChain; - } - - public void setBase64CertificateChain(List base64CertificateChain) { - this.base64CertificateChain = base64CertificateChain; - } - - public EncryptionAlgorithm getEncryptionAlgorithm() { - return encryptionAlgorithm; - } - - public void setEncryptionAlgorithm(EncryptionAlgorithm encryptionAlgorithm) { - this.encryptionAlgorithm = encryptionAlgorithm; - } - - public String getBase64SignatureValue() { - return base64SignatureValue; - } - - public void setBase64SignatureValue(String base64SignatureValue) { - this.base64SignatureValue = base64SignatureValue; - } - - public String getPolicyOid() { - return policyOid; - } - - public void setPolicyOid(String policyOid) { - this.policyOid = policyOid; - } - - public DigestAlgorithm getPolicyDigestAlgorithm() { - return policyDigestAlgorithm; - } - - public void setPolicyDigestAlgorithm(DigestAlgorithm policyDigestAlgorithm) { - this.policyDigestAlgorithm = policyDigestAlgorithm; - } - - public String getPolicyBase64HashValue() { - return policyBase64HashValue; - } - - public void setPolicyBase64HashValue(String policyBase64HashValue) { - this.policyBase64HashValue = policyBase64HashValue; - } - - @AssertTrue(message = "{error.to.sign.file.mandatory}") - public boolean isDocumentToSign() { - return (documentToSign != null) && (!documentToSign.isEmpty()); - } - - @AssertTrue(message = "{error.signature.underlying.form.mandatory}") - public boolean isAsicUnderlyingFormValid() { - if (SignatureForm.ASiC_S.equals(signatureForm) || SignatureForm.ASiC_E.equals(signatureForm)) { - return SignatureForm.CAdES.equals(asicUnderlyingForm) || SignatureForm.XAdES.equals(asicUnderlyingForm); - } else { - return true; - } - } -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/Preference.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/Preference.java deleted file mode 100644 index 59010d3f78..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/Preference.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.model; - -/** - * - * TODO - * - * - * - * - * - * - */ -public class Preference { - - /** - * The preferences key. - */ - private String key; - /** - * The preferences value. - */ - private String value; - - /** - * @return the key - */ - public String getKey() { - return key; - } - - /** - * @return the value - */ - public String getValue() { - return value; - } - - /** - * @param key the key to set - */ - public void setKey(String key) { - this.key = key; - } - - /** - * @param value the value to set - */ - public void setValue(String value) { - this.value = value; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/PreferenceForm.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/PreferenceForm.java deleted file mode 100644 index a140eed583..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/PreferenceForm.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.model; - -/** - * - * Preference form bean - * - * - * - * - * - * - */ -public class PreferenceForm { - - private String key; - - private String value; - - /** - * @return the key - */ - public String getKey() { - return key; - } - - /** - * @return the value - */ - public String getValue() { - return value; - } - - /** - * @param key the key to set - */ - public void setKey(String key) { - this.key = key; - } - - /** - * @param value the value to set - */ - public void setValue(String value) { - this.value = value; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/PreferenceKey.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/PreferenceKey.java deleted file mode 100644 index 6cac81d3ae..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/PreferenceKey.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * DSS - Digital Signature Services - * Copyright (C) 2015 European Commission, provided under the CEF programme - * - * This file is part of the "DSS - Digital Signature Services" project. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -package eu.europa.esig.dss.web.model; - -/** - * - * TODO - * - * - * - * - * - * - */ -public enum PreferenceKey { - /** - * The enum constant url service. - */ - SERVICE_URL("preference.url.service"), - - JAR_URL("preference.url.jar"), - - DEFAULT_POLICY_URL("preference.default.policy.url"); - - public static PreferenceKey fromKey(String key) { - for (final PreferenceKey preferenceKey : values()) { - if (preferenceKey.key.equals(key)) { - return preferenceKey; - } - } - return null; - } - - private final String key; - - /** - * - * The default constructor for PreferenceKey. - * - * @param key - */ - PreferenceKey(final String key) { - this.key = key; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Enum#toString() - */ - @Override - public String toString() { - return key; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/SignDocumentResponse.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/SignDocumentResponse.java deleted file mode 100644 index 7e2fb1004e..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/SignDocumentResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package eu.europa.esig.dss.web.model; - -public class SignDocumentResponse { - - private String urlToDownload; - - public String getUrlToDownload() { - return urlToDownload; - } - - public void setUrlToDownload(String urlToDownload) { - this.urlToDownload = urlToDownload; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/SignatureDocumentForm.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/SignatureDocumentForm.java deleted file mode 100644 index d3c5d0c0c6..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/SignatureDocumentForm.java +++ /dev/null @@ -1,259 +0,0 @@ -package eu.europa.esig.dss.web.model; - -import java.util.Date; -import java.util.List; - -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.NotNull; - -import org.apache.commons.lang.StringUtils; -import org.springframework.web.multipart.MultipartFile; - -import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.EncryptionAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureLevel; -import eu.europa.esig.dss.SignaturePackaging; -import eu.europa.esig.dss.SignatureTokenType; - -public class SignatureDocumentForm { - - private Date signingDate; - - private boolean signWithExpiredCertificate; - - private MultipartFile documentToSign; - - @NotNull(message = "{error.signature.form.mandatory}") - private SignatureForm signatureForm; - - private SignatureForm asicUnderlyingForm; - - @NotNull(message = "{error.signature.packaging.mandatory}") - private SignaturePackaging signaturePackaging; - - @NotNull(message = "{error.signature.level.mandatory}") - private SignatureLevel signatureLevel; - - @NotNull(message = "{error.digest.algo.mandatory}") - private DigestAlgorithm digestAlgorithm; - - @NotNull(message = "{error.token.type.mandatory}") - private SignatureTokenType token; - - private String policyOid; - - private DigestAlgorithm policyDigestAlgorithm; - - private String policyBase64HashValue; - - private String pkcsPath; - - private MultipartFile pkcsFile; - - private String pkcsPassword; - - private String base64Certificate; - - private List base64CertificateChain; - - private EncryptionAlgorithm encryptionAlgorithm; - - private String base64SignatureValue; - - // TODO claimedRoles, policy - - public Date getSigningDate() { - return signingDate; - } - - public void setSigningDate(Date signingDate) { - this.signingDate = signingDate; - } - - public boolean isSignWithExpiredCertificate() { - return signWithExpiredCertificate; - } - - public void setSignWithExpiredCertificate(boolean signWithExpiredCertificate) { - this.signWithExpiredCertificate = signWithExpiredCertificate; - } - - public MultipartFile getDocumentToSign() { - return documentToSign; - } - - public void setDocumentToSign(MultipartFile documentToSign) { - this.documentToSign = documentToSign; - } - - public SignatureForm getSignatureForm() { - return signatureForm; - } - - public void setSignatureForm(SignatureForm signatureForm) { - this.signatureForm = signatureForm; - } - - public SignatureForm getAsicUnderlyingForm() { - return asicUnderlyingForm; - } - - public void setAsicUnderlyingForm(SignatureForm asicUnderlyingForm) { - this.asicUnderlyingForm = asicUnderlyingForm; - } - - public SignaturePackaging getSignaturePackaging() { - return signaturePackaging; - } - - public void setSignaturePackaging(SignaturePackaging signaturePackaging) { - this.signaturePackaging = signaturePackaging; - } - - public SignatureLevel getSignatureLevel() { - return signatureLevel; - } - - public void setSignatureLevel(SignatureLevel signatureLevel) { - this.signatureLevel = signatureLevel; - } - - public DigestAlgorithm getDigestAlgorithm() { - return digestAlgorithm; - } - - public void setDigestAlgorithm(DigestAlgorithm digestAlgorithm) { - this.digestAlgorithm = digestAlgorithm; - } - - public SignatureTokenType getToken() { - return token; - } - - public void setToken(SignatureTokenType token) { - this.token = token; - } - - public String getPolicyOid() { - return policyOid; - } - - public void setPolicyOid(String policyOid) { - this.policyOid = policyOid; - } - - public DigestAlgorithm getPolicyDigestAlgorithm() { - return policyDigestAlgorithm; - } - - public void setPolicyDigestAlgorithm(DigestAlgorithm policyDigestAlgorithm) { - this.policyDigestAlgorithm = policyDigestAlgorithm; - } - - public String getPolicyBase64HashValue() { - return policyBase64HashValue; - } - - public void setPolicyBase64HashValue(String policyBase64HashValue) { - this.policyBase64HashValue = policyBase64HashValue; - } - - public String getBase64Certificate() { - return base64Certificate; - } - - public void setBase64Certificate(String base64Certificate) { - this.base64Certificate = base64Certificate; - } - - public List getBase64CertificateChain() { - return base64CertificateChain; - } - - public void setBase64CertificateChain(List base64CertificateChain) { - this.base64CertificateChain = base64CertificateChain; - } - - public EncryptionAlgorithm getEncryptionAlgorithm() { - return encryptionAlgorithm; - } - - public void setEncryptionAlgorithm(EncryptionAlgorithm encryptionAlgorithm) { - this.encryptionAlgorithm = encryptionAlgorithm; - } - - public String getBase64SignatureValue() { - return base64SignatureValue; - } - - public void setBase64SignatureValue(String base64SignatureValue) { - this.base64SignatureValue = base64SignatureValue; - } - - public String getPkcsPath() { - return pkcsPath; - } - - public void setPkcsPath(String pkcsPath) { - this.pkcsPath = pkcsPath; - } - - public MultipartFile getPkcsFile() { - return pkcsFile; - } - - public void setPkcsFile(MultipartFile pkcsFile) { - this.pkcsFile = pkcsFile; - } - - public String getPkcsPassword() { - return pkcsPassword; - } - - public void setPkcsPassword(String pkcsPassword) { - this.pkcsPassword = pkcsPassword; - } - - @AssertTrue(message = "{error.to.sign.file.mandatory}") - public boolean isDocumentToSign() { - return (documentToSign != null) && (!documentToSign.isEmpty()); - } - - @AssertTrue(message = "{error.file.mandatory}") - public boolean isPkcsFile() { - if (SignatureTokenType.PKCS12.equals(token)) { - return (pkcsFile != null) && (!pkcsFile.isEmpty()); - } else { - return true; - } - } - - @AssertTrue(message = "{error.path.mandatory}") - public boolean isPkcsPathValid() { - if (SignatureTokenType.PKCS11.equals(token)) { - return StringUtils.isNotEmpty(pkcsPath); - } else { - return true; - } - } - - @AssertTrue(message = "{error.password.mandatory}") - public boolean isPkcsPasswordValid() { - if (SignatureTokenType.PKCS11.equals(token) || SignatureTokenType.PKCS12.equals(token)) { - return StringUtils.isNotEmpty(pkcsPassword); - } else { - return true; - } - } - - @AssertTrue(message = "{error.signature.underlying.form.mandatory}") - public boolean isAsicUnderlyingFormValid(){ - if (SignatureForm.ASiC_S.equals(signatureForm) || SignatureForm.ASiC_E.equals(signatureForm)){ - return SignatureForm.CAdES.equals(asicUnderlyingForm) || SignatureForm.XAdES.equals(asicUnderlyingForm); - } else{ - return true; - } - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/SignatureValueAsString.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/SignatureValueAsString.java deleted file mode 100644 index b433bbae08..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/SignatureValueAsString.java +++ /dev/null @@ -1,24 +0,0 @@ -package eu.europa.esig.dss.web.model; - -import javax.validation.constraints.NotNull; - -public class SignatureValueAsString { - - @NotNull - private String signatureValue; - - public SignatureValueAsString() { - } - - public SignatureValueAsString(String signatureValue) { - this.signatureValue = signatureValue; - } - - public String getSignatureValue() { - return signatureValue; - } - - public void setSignatureValue(String signatureValue) { - this.signatureValue = signatureValue; - } -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/ValidationForm.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/ValidationForm.java deleted file mode 100644 index 87c40e9b57..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/model/ValidationForm.java +++ /dev/null @@ -1,66 +0,0 @@ -package eu.europa.esig.dss.web.model; - -import javax.validation.constraints.AssertTrue; - -import org.springframework.web.multipart.MultipartFile; - -import eu.europa.esig.dss.validation.executor.ValidationLevel; - -public class ValidationForm { - - private MultipartFile signedFile; - - private MultipartFile originalFile; - - private ValidationLevel validationLevel; - - private boolean defaultPolicy; - - private MultipartFile policyFile; - - public MultipartFile getSignedFile() { - return signedFile; - } - - public void setSignedFile(MultipartFile signedFile) { - this.signedFile = signedFile; - } - - public MultipartFile getOriginalFile() { - return originalFile; - } - - public void setOriginalFile(MultipartFile originalFile) { - this.originalFile = originalFile; - } - - public ValidationLevel getValidationLevel() { - return validationLevel; - } - - public void setValidationLevel(ValidationLevel validationLevel) { - this.validationLevel = validationLevel; - } - - public boolean isDefaultPolicy() { - return defaultPolicy; - } - - public void setDefaultPolicy(boolean defaultPolicy) { - this.defaultPolicy = defaultPolicy; - } - - public MultipartFile getPolicyFile() { - return policyFile; - } - - public void setPolicyFile(MultipartFile policyFile) { - this.policyFile = policyFile; - } - - @AssertTrue(message = "{error.signed.file.mandatory}") - public boolean isSignedFile() { - return (signedFile != null) && (!signedFile.isEmpty()); - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/FOPService.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/FOPService.java deleted file mode 100644 index 6a12ed2a1f..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/FOPService.java +++ /dev/null @@ -1,80 +0,0 @@ -package eu.europa.esig.dss.web.service; - -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.StringReader; - -import javax.annotation.PostConstruct; -import javax.xml.transform.Result; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.Fop; -import org.apache.fop.apps.FopFactory; -import org.apache.fop.apps.FopFactoryBuilder; -import org.apache.fop.apps.MimeConstants; -import org.apache.pdfbox.io.IOUtils; -import org.springframework.stereotype.Component; -import org.w3c.dom.Document; - -import eu.europa.esig.dss.xades.DSSXMLUtils; - -@Component -public class FOPService { - - private FopFactory fopFactory; - private FOUserAgent foUserAgent; - private Templates templateSimpleReport; - private Templates templateDetailedReport; - - @PostConstruct - public void init() throws Exception { - - FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI()); - builder.setAccessibility(true); - - fopFactory = builder.build(); - - foUserAgent = fopFactory.newFOUserAgent(); - foUserAgent.setCreator("DSS Webapp"); - foUserAgent.setAccessibility(true); - - TransformerFactory transformerFactory = DSSXMLUtils.getSecureTransformerFactory(); - - InputStream simpleIS = FOPService.class.getResourceAsStream("/xslt/simpleReportFop.xslt"); - templateSimpleReport = transformerFactory.newTemplates(new StreamSource(simpleIS)); - IOUtils.closeQuietly(simpleIS); - - InputStream detailedIS = FOPService.class.getResourceAsStream("/xslt/validationReportFop.xslt"); - templateDetailedReport = transformerFactory.newTemplates(new StreamSource(detailedIS)); - IOUtils.closeQuietly(detailedIS); - } - - public void generateSimpleReport(String simpleReport, OutputStream os) throws Exception { - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, os); - Result res = new SAXResult(fop.getDefaultHandler()); - Transformer transformer = templateSimpleReport.newTransformer(); - transformer.transform(new StreamSource(new StringReader(simpleReport)), res); - } - - public void generateSimpleReport(Document dom, OutputStream os) throws Exception { - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, os); - Result res = new SAXResult(fop.getDefaultHandler()); - Transformer transformer = templateSimpleReport.newTransformer(); - transformer.transform(new DOMSource(dom), res); - } - - public void generateDetailedReport(String detailedReport, OutputStream os) throws Exception { - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, os); - Result res = new SAXResult(fop.getDefaultHandler()); - Transformer transformer = templateDetailedReport.newTransformer(); - transformer.transform(new StreamSource(new StringReader(detailedReport)), res); - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/KeystoreService.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/KeystoreService.java deleted file mode 100644 index 9a325c23f0..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/KeystoreService.java +++ /dev/null @@ -1,71 +0,0 @@ -package eu.europa.esig.dss.web.service; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.DatatypeConverter; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import eu.europa.esig.dss.DSSUtils; -import eu.europa.esig.dss.DigestAlgorithm; -import eu.europa.esig.dss.web.model.CertificateDTO; -import eu.europa.esig.dss.x509.CertificateToken; -import eu.europa.esig.dss.x509.KeyStoreCertificateSource; - -@Component -public class KeystoreService { - - @Autowired - private KeyStoreCertificateSource keyStoreCertificateSource; - - public List getCertificatesDTOFromKeyStore() { - List list = new ArrayList(); - List certificatesFromKeyStore = keyStoreCertificateSource.getCertificatesFromKeyStore(); - for (CertificateToken certificateToken : certificatesFromKeyStore) { - list.add(getCertificateDTO(certificateToken)); - } - return list; - } - - public CertificateDTO getCertificateDTO(CertificateToken certificate) { - CertificateDTO dto = new CertificateDTO(); - - dto.setDssId(certificate.getDSSIdAsString()); - dto.setIssuerName(certificate.getIssuerX500Principal().getName()); - dto.setSubjetName(certificate.getSubjectX500Principal().getName()); - dto.setNotBefore(certificate.getNotBefore()); - dto.setNotAfter(certificate.getNotAfter()); - - byte[] digestSHA256 = DSSUtils.digest(DigestAlgorithm.SHA256, certificate.getEncoded()); - byte[] digestSHA1 = DSSUtils.digest(DigestAlgorithm.SHA1, certificate.getEncoded()); - - dto.setSha256Hex(getPrintableHex(digestSHA256)); - dto.setSha1Hex(getPrintableHex(digestSHA1)); - dto.setSha256Base64(DatatypeConverter.printBase64Binary(digestSHA256)); - dto.setSha1Base64(DatatypeConverter.printBase64Binary(digestSHA1)); - - return dto; - } - - /** - * This method adds space every two characters to the hexadecimal encoded digest - * - * @param digest - * @return - */ - private String getPrintableHex(byte[] digest) { - String hexString = DatatypeConverter.printHexBinary(digest); - return hexString.replaceAll("..", "$0 "); - } - - public void addCertificateToKeyStore(CertificateToken certificateToken) { - keyStoreCertificateSource.addCertificateToKeyStore(certificateToken); - } - - public void deleteCertificateFromKeyStore(String dssId) { - keyStoreCertificateSource.deleteCertificateFromKeyStore(dssId); - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/PolicyJaxbService.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/PolicyJaxbService.java deleted file mode 100644 index af38f5eaa9..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/PolicyJaxbService.java +++ /dev/null @@ -1,58 +0,0 @@ -package eu.europa.esig.dss.web.service; - -import java.io.InputStream; -import java.io.StringWriter; - -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.oxm.Marshaller; -import org.springframework.oxm.Unmarshaller; -import org.springframework.stereotype.Component; - -import eu.europa.esig.jaxb.policy.ConstraintsParameters; - -@Component -public class PolicyJaxbService { - - private static final Logger logger = LoggerFactory.getLogger(PolicyJaxbService.class); - - @Autowired - private Unmarshaller policyUnmarshaller; - - @Autowired - private Marshaller policyMarshaller; - - public ConstraintsParameters unmarshall(String filePath) { - InputStream is = null; - ConstraintsParameters policy = null; - try { - is = PolicyJaxbService.class.getResourceAsStream(filePath); - policy = (ConstraintsParameters) policyUnmarshaller.unmarshal(new StreamSource(is)); - } catch (Exception e) { - logger.error("Unable to parse '" + filePath+ "' : " + e.getMessage(), e); - } finally { - IOUtils.closeQuietly(is); - } - return policy; - } - - /** - * This method marshall ConstraintsParameters objects to String - * Empty LevelConstraints are disabled/removed with JS - */ - public String marshall(ConstraintsParameters constraintsParams) { - StringWriter writer = new StringWriter(); - try { - policyMarshaller.marshal(constraintsParams, new StreamResult(writer)); - } catch (Exception e) { - logger.error("Unable to parse JaxB object : " + e.getMessage(), e); - } - return writer.toString(); - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/SigningService.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/SigningService.java deleted file mode 100644 index e099b56598..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/SigningService.java +++ /dev/null @@ -1,202 +0,0 @@ -package eu.europa.esig.dss.web.service; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.bind.DatatypeConverter; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import eu.europa.esig.dss.AbstractSignatureParameters; -import eu.europa.esig.dss.DSSDocument; -import eu.europa.esig.dss.DSSUtils; -import eu.europa.esig.dss.Policy; -import eu.europa.esig.dss.SignatureAlgorithm; -import eu.europa.esig.dss.SignatureForm; -import eu.europa.esig.dss.SignatureValue; -import eu.europa.esig.dss.ToBeSigned; -import eu.europa.esig.dss.asic.ASiCSignatureParameters; -import eu.europa.esig.dss.asic.signature.ASiCService; -import eu.europa.esig.dss.cades.CAdESSignatureParameters; -import eu.europa.esig.dss.cades.signature.CAdESService; -import eu.europa.esig.dss.pades.PAdESSignatureParameters; -import eu.europa.esig.dss.pades.signature.PAdESService; -import eu.europa.esig.dss.signature.DocumentSignatureService; -import eu.europa.esig.dss.web.WebAppUtils; -import eu.europa.esig.dss.web.model.ExtensionForm; -import eu.europa.esig.dss.web.model.NexuSignatureDocumentForm; -import eu.europa.esig.dss.x509.CertificateToken; -import eu.europa.esig.dss.xades.XAdESSignatureParameters; -import eu.europa.esig.dss.xades.signature.XAdESService; - -@Component -public class SigningService { - - private static final Logger logger = LoggerFactory.getLogger(SigningService.class); - - @Autowired - private CAdESService cadesService; - - @Autowired - private PAdESService padesService; - - @Autowired - private XAdESService xadesService; - - @Autowired - private ASiCService asicService; - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public DSSDocument extend(ExtensionForm extensionForm) { - - SignatureForm signatureForm = extensionForm.getSignatureForm(); - SignatureForm asicUnderlyingForm = extensionForm.getAsicUnderlyingForm(); - - DSSDocument signedDocument = WebAppUtils.toDSSDocument(extensionForm.getSignedFile()); - DSSDocument originalDocument = WebAppUtils.toDSSDocument(extensionForm.getOriginalFile()); - - DocumentSignatureService service = getSignatureService(signatureForm); - - AbstractSignatureParameters parameters = getSignatureParameters(signatureForm, asicUnderlyingForm); - parameters.setSignatureLevel(extensionForm.getSignatureLevel()); - - if (originalDocument != null) { - parameters.setDetachedContent(originalDocument); - } - - DSSDocument extendedDoc = service.extendDocument(signedDocument, parameters); - return extendedDoc; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public ToBeSigned getDataToSign(NexuSignatureDocumentForm form) { - logger.info("Start getDataToSign"); - DocumentSignatureService service = getSignatureService(form.getSignatureForm()); - - AbstractSignatureParameters parameters = fillParameters(form); - - ToBeSigned toBeSigned = null; - try { - DSSDocument toSignDocument = WebAppUtils.toDSSDocument(form.getDocumentToSign()); - toBeSigned = service.getDataToSign(toSignDocument, parameters); - } catch (Exception e) { - logger.error("Unable to execute getDataToSign : " + e.getMessage(), e); - } - logger.info("End getDataToSign"); - return toBeSigned; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public DSSDocument signDocument(NexuSignatureDocumentForm form) { - logger.info("Start signDocument"); - DocumentSignatureService service = getSignatureService(form.getSignatureForm()); - - AbstractSignatureParameters parameters = fillParameters(form); - - DSSDocument signedDocument = null; - try { - DSSDocument toSignDocument = WebAppUtils.toDSSDocument(form.getDocumentToSign()); - SignatureAlgorithm sigAlgorithm = SignatureAlgorithm.getAlgorithm(form.getEncryptionAlgorithm(), form.getDigestAlgorithm()); - SignatureValue signatureValue = new SignatureValue(sigAlgorithm, DatatypeConverter.parseBase64Binary(form.getBase64SignatureValue())); - signedDocument = service.signDocument(toSignDocument, parameters, signatureValue); - } catch (Exception e) { - logger.error("Unable to execute signDocument : " + e.getMessage(), e); - } - logger.info("End signDocument"); - return signedDocument; - } - - private AbstractSignatureParameters fillParameters(NexuSignatureDocumentForm form) { - AbstractSignatureParameters parameters = getSignatureParameters(form.getSignatureForm(), form.getAsicUnderlyingForm()); - parameters.setSignaturePackaging(form.getSignaturePackaging()); - parameters.setSignatureLevel(form.getSignatureLevel()); - parameters.setDigestAlgorithm(form.getDigestAlgorithm()); - // parameters.setEncryptionAlgorithm(form.getEncryptionAlgorithm()); retrieved from certificate - parameters.bLevel().setSigningDate(form.getSigningDate()); - - if (StringUtils.isNotEmpty(form.getPolicyOid()) && StringUtils.isNotEmpty(form.getPolicyBase64HashValue()) - && (form.getPolicyDigestAlgorithm() != null)) { - Policy signaturePolicy = new Policy(); - signaturePolicy.setId(form.getPolicyOid()); - signaturePolicy.setDigestAlgorithm(form.getPolicyDigestAlgorithm()); - signaturePolicy.setDigestValue(Base64.decodeBase64(form.getPolicyBase64HashValue())); - parameters.bLevel().setSignaturePolicy(signaturePolicy); - } - - parameters.setSignWithExpiredCertificate(form.isSignWithExpiredCertificate()); - - CertificateToken signingCertificate = DSSUtils.loadCertificateFromBase64EncodedString(form.getBase64Certificate()); - parameters.setSigningCertificate(signingCertificate); - parameters.setEncryptionAlgorithm(signingCertificate.getEncryptionAlgorithm()); - - List base64CertificateChain = form.getBase64CertificateChain(); - if (CollectionUtils.isNotEmpty(base64CertificateChain)) { - Set certificateChain = new HashSet(); - for (String base64Certificate : base64CertificateChain) { - certificateChain.add(DSSUtils.loadCertificateFromBase64EncodedString(base64Certificate)); - } - parameters.setCertificateChain(certificateChain); - } - - return parameters; - } - - @SuppressWarnings("rawtypes") - private DocumentSignatureService getSignatureService(SignatureForm signatureForm) { - DocumentSignatureService service = null; - switch (signatureForm) { - case CAdES: - service = cadesService; - break; - case PAdES: - service = padesService; - break; - case XAdES: - service = xadesService; - break; - case ASiC_S: - case ASiC_E: - service = asicService; - break; - default: - logger.error("Unknow signature form : " + signatureForm); - } - return service; - } - - private AbstractSignatureParameters getSignatureParameters(SignatureForm signatureForm, SignatureForm underlyingForm) { - AbstractSignatureParameters parameters = null; - switch (signatureForm) { - case CAdES: - parameters = new CAdESSignatureParameters(); - break; - case PAdES: - PAdESSignatureParameters padesParams = new PAdESSignatureParameters(); - padesParams.setSignatureSize(9472 * 2); // double reserved space for signature - parameters = padesParams; - break; - case XAdES: - parameters = new XAdESSignatureParameters(); - break; - case ASiC_S: - case ASiC_E: - ASiCSignatureParameters asicParameters = new ASiCSignatureParameters(); - if (underlyingForm != null) { - asicParameters.aSiC().setUnderlyingForm(underlyingForm); - } - parameters = asicParameters; - break; - default: - logger.error("Unknow signature form : " + signatureForm); - } - return parameters; - } - -} diff --git a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/XSLTService.java b/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/XSLTService.java deleted file mode 100644 index e1253ecbc2..0000000000 --- a/dss-demo-webapp/src/main/java/eu/europa/esig/dss/web/service/XSLTService.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.europa.esig.dss.web.service; - -import java.io.InputStream; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; - -import javax.annotation.PostConstruct; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.pdfbox.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.w3c.dom.Document; - -import eu.europa.esig.dss.xades.DSSXMLUtils; - -@Component -public class XSLTService { - - private static final Logger logger = LoggerFactory.getLogger(XSLTService.class); - - private Templates templateSimpleReport; - private Templates templateDetailedReport; - - @PostConstruct - public void init() throws TransformerConfigurationException { - TransformerFactory transformerFactory = DSSXMLUtils.getSecureTransformerFactory(); - - InputStream simpleIS = XSLTService.class.getResourceAsStream("/xslt/simpleReport.xslt"); - templateSimpleReport = transformerFactory.newTemplates(new StreamSource(simpleIS)); - IOUtils.closeQuietly(simpleIS); - - InputStream detailedIS = XSLTService.class.getResourceAsStream("/xslt/validationReport.xslt"); - templateDetailedReport = transformerFactory.newTemplates(new StreamSource(detailedIS)); - IOUtils.closeQuietly(detailedIS); - } - - public String generateSimpleReport(String simpleReport) { - Writer writer = new StringWriter(); - try { - Transformer transformer = templateSimpleReport.newTransformer(); - transformer.transform(new StreamSource(new StringReader(simpleReport)), new StreamResult(writer)); - } catch (Exception e) { - logger.error("Error while generating simple report : " + e.getMessage(), e); - } - return writer.toString(); - } - - public String generateSimpleReport(Document dom) { - Writer writer = new StringWriter(); - try { - Transformer transformer = templateSimpleReport.newTransformer(); - transformer.transform(new DOMSource(dom), new StreamResult(writer)); - } catch (Exception e) { - logger.error("Error while generating simple report : " + e.getMessage(), e); - } - return writer.toString(); - } - - public String generateDetailedReport(String detailedReport) { - Writer writer = new StringWriter(); - try { - Transformer transformer = templateDetailedReport.newTransformer(); - transformer.transform(new StreamSource(new StringReader(detailedReport)), new StreamResult(writer)); - } catch (Exception e) { - logger.error("Error while generating detailed report : " + e.getMessage(), e); - } - return writer.toString(); - } - -} \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/ValidationMessages.properties b/dss-demo-webapp/src/main/resources/ValidationMessages.properties deleted file mode 100644 index 93d24b873f..0000000000 --- a/dss-demo-webapp/src/main/resources/ValidationMessages.properties +++ /dev/null @@ -1,13 +0,0 @@ -error.signed.file.mandatory = Signed file is mandatory -error.signature.form.mandatory = Signature format is mandatory -error.signature.packaging.mandatory = Packaging is mandatory -error.signature.level.mandatory = Level is mandatory -error.to.sign.file.mandatory = File to sign is mandatory -error.digest.algo.mandatory = Digest algorithm is mandatory -error.token.type.mandatory = Token type is mandatory -error.file.mandatory = File is mandatory -error.password.mandatory = Password is mandatory -error.path.mandatory = Path is mandatory -error.signature.underlying.form.mandatory = Underlying format is mandatory -error.certificate.mandatory = Certificate file is mandatory -error.nexu.not.found = Nexu must be running \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/dss.properties b/dss-demo-webapp/src/main/resources/dss.properties deleted file mode 100644 index 53d40bb159..0000000000 --- a/dss-demo-webapp/src/main/resources/dss.properties +++ /dev/null @@ -1,13 +0,0 @@ -datasource.driver.class = org.hsqldb.jdbcDriver -datasource.url = jdbc:hsqldb:mem:testdb -datasource.username = sa -datasource.password = - -# keystore is / will be stored in etc folder of Tomcat. If not exists, DSS will copy the embedded keystore (dss-demo-webapp/src/main/resources/keystore.p12) -dss.keystore.type=PKCS12 -dss.keystore.filename=keystore.p12 -dss.keystore.password=dss-password -dss.oj.url=http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=uriserv:OJ.C_.2016.233.01.0001.01.ENG - -baseUrl=http://joinup.ec.europa.eu/site/sd-dss/maven2/lu/nowina/apps/nexu-bundle/1.3/nexu-bundle-1.3.zip -nexuUrl=http://localhost:9776 \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/i18n/application.properties b/dss-demo-webapp/src/main/resources/i18n/application.properties deleted file mode 100644 index 6a2a226deb..0000000000 --- a/dss-demo-webapp/src/main/resources/i18n/application.properties +++ /dev/null @@ -1,185 +0,0 @@ -application.title = DSS WebApp -application.version=${project.version} - -label.administration = Administration -label.browser = Browser -label.comment = Comment -label.edit = Edit -label.general = General -label.global = Global -label.home = Home -label.proxy = Proxy -label.info = Information -label.java.version = Java version -label.key = Key -label.preferences = Preferences -label.signature = Signature -label.signature.applet = Standalone signature -label.tlmanager = TL Manager -label.tlmanager.tl.eu = TL Manager -label.update = Update -label.value = Value -label.certificates = Certificates -label.tsl = Trusted List -label.tsls = Trusted Lists -label.service = Service -label.issuer = Issuer -label.validity_start = Start -label.validity_end = End -label.enabled = Enabled -label.level = Level -label.signADocument = Sign a document -label.extend = Extend a signature -label.signed.file = Signed file -label.original.file = Original file -label.to.sign.file = File to sign -label.original.file.extend.help = When extending a "detached" signature, the original file is needed. -label.original.file.validate.help = When validating a "detached" signature, the original file is needed. -label.clear = Clear -label.submit = Submit -label.signature.form = Signature format -label.signature.underlying.form = ASiC underlying format -label.signature.packaging = Packaging -label.signature.level = Level -label.validation-policy = Validation policy -label.allow.expired.certificate = Allow expired certificate -label.policy = Policy -label.policy.oid = OID -label.policy.hash.value = Hash value (base64) -label.certificate.file = Certificate -label.certificates = Certificates -label.add.to.keystore = Add to keystore -label.trusted.certificates.from.OJ = Trusted certificates from Official Journal (OJ) in the DSS keystore -label.add.a.certificate.in.keystore = Add a certificate in the DSS keystore - -label.validate = Validate a signature -label.validation.policy = Validation policy constrains -label.validation.default.policy.file = Validate signatures and whether they are : AdES, AdES/QC or QES. All certificates and their related chains are validated against the EU MS TSL. -label.validation.custom.policy.file = Custom validation constrains file -label.simple.report = Simple Report -label.detailed.report = Detailed Report -label.diagnostic.tree = Diagnostic tree - -label.CAdES = CAdES -label.PAdES = PAdES -label.XAdES = XAdES -label.ASiC_S = ASiC-S -label.ASiC_E = ASiC-E - -label.ENVELOPED = Enveloped -label.ENVELOPING = Enveloping -label.DETACHED = Detached - -preference.url.jar = Jar URL -preference.url.service = Service URL -preference.default.policy.url = Default Validation Policy URL - -proxy.http.host = Proxy HTTP host -proxy.http.port = Proxy HTTP port -proxy.http.user = Proxy HTTP user -proxy.http.password = Proxy HTTP password -proxy.http.enabled = Proxy HTTP enabled -proxy.http.exclude = Exclude HTTP host(s) - -proxy.https.host = Proxy HTTPS host -proxy.https.port = Proxy HTTPS port -proxy.https.user = Proxy HTTPS user -proxy.https.password = Proxy HTTPS password -proxy.https.enabled = Proxy HTTPS enabled -proxy.https.exclude = Exclude HTTPS host(s) - -url.error = URL cannot be loaded. Please check your URL and your proxy settings. - -label.policy.addValue = Add value -label.policy.removeValue = Remove last value -label.policy.name = Policy name -label.policy.title.signature = Signature -label.policy.description = Description -label.policy.structuralValidation = Structural validation ? -label.policy.acceptablePolicies = Acceptable policies -label.policy.acceptableFormats = Acceptable formats -label.policy.referenceDataExistence = Reference data exist ? -label.policy.referenceDataIntact = Reference data intact ? -label.policy.signatureIntact = Signature intact ? -label.policy.signatureValid = Signature valid ? -label.policy.signingCertificate = Signing certificate -label.policy.recognition = Recognition ? -label.policy.attributePresent = Attribute present ? -label.policy.digestValuePresent = Digest value present ? -label.policy.signingCertificatePresent = Signing certificate present ? -label.policy.signingCertificateSigned = Signing certificate signed ? -label.policy.digestValueMatch = Digest value match ? -label.policy.issuerSerialMatch = Issuer serial match ? -label.policy.signed = Signed ? -label.policy.signature = Signature ? -label.policy.expiration = Expired ? -label.policy.revocationDataAvailable = Revocation data available ? -label.policy.revocationDataIsTrusted = Revocation data trusted ? -label.policy.revocationDataFreshness = Revocation data freshness ? -label.policy.prospectiveCertificateChain = Prospective certificate chain ? -label.policy.keyUsage = Key usage ? -label.policy.revoked = Revoked ? -label.policy.onHold = On hold ? -label.policy.tslValidity = TSL validity ? -label.policy.tslStatus = TSL status ? -label.policy.tslStatusAndValidity = TSL status and validity ? -label.policy.qualification = Qualification ? -label.policy.supportedBySSCD = Supported by SSCD ? -label.policy.issuedToLegalPerson = Issued to legal person ? -label.policy.caCertificate = Certification authority (CA) certificate -label.policy.title.basicSignatureConstraint = Basic Signature Constraints - -label.policy.timestamp = Timestamp -label.policy.timestampDelay = Timestamp delay ? -label.policy.messageImprintDataFound = Message imprint data found ? -label.policy.messageImprintDataIntact = Message imprint data intact ? -label.policy.revocationTimeAgainstBestSignatureTime = Revocation time against best signature time ? -label.policy.bestSignatureTimeBeforeIssuanceDateOfSigningCertificate = Best signature time before issuance date of signing certificate ? -label.policy.signingCertificateValidityAtBestSignatureTime = Signing certificate validity at best signature time ? -label.policy.algorithmReliableAtBestSignatureTime = Algorithm reliable at best signature time ? -label.policy.coherence = Coherence ? - -label.policy.revocation = Revocation -label.policy.revocationFreshness = Revocation freshness ? - -label.policy.signedAttributes = Signed attributes -label.policy.unsignedAttributes = Unsigned attributes -label.policy.signingTime = Signing time ? -label.policy.contentType = Content type ? -label.policy.contentHints = Content Hints ? -label.policy.contentIdentifier = Content Identifier ? -label.policy.signerLocation = Signed location ? -label.policy.claimedRoles = Claimed roles ? -label.policy.commitmentTypeIndication = Commitment Type Indication ? -label.policy.certifiedRoles = Certified roles ? -label.policy.content.timestamp = Content timestamp ? -label.policy.countersignature = Countersignature -label.policy.cryptographic = Cryptographic -label.policy.acceptableEncryptionAlgo = Acceptable encryption algorithms ? -label.policy.acceptableDigestAlgo = Acceptable digest algorithms ? -label.policy.miniPublicKeySize = Minimum public key size ? -label.policy.revocationNextUpdatePresent = Next update present ? - -label.tokenType = Token type -label.PKCS11 = PKCS11 -label.PKCS12 = PKCS12 -label.MSCAPI = MSCAPI -label.MOCCA = MOCCA - -label.digest.algorithm = Digest algorithm - -label.select.certificate = Certificate -label.signature.done = Signature is done ! -label.download.will.start = The download of the signed document will start soon... -label.config.pkcs11 = PKCS11 configuration -label.config.pkcs12 = PKCS12 configuration -label.pkcs11.file = PKCS11 library (dll) -label.pkcs12.file = Keystore file -label.pkcs11.password = Password -label.pkcs12.password = Password - -label.validation.level = Validation level -label.validation.level.ARCHIVAL_DATA = Validation process for Signatures with Archival Data (recommended) -label.validation.level.LONG_TERM_DATA = Validation process for Signatures with Long-Term Validation Data -label.validation.level.TIMESTAMPS = Validation process for time-stamps -label.validation.level.BASIC_SIGNATURES = Validation process for Basic Signatures diff --git a/dss-demo-webapp/src/main/resources/keystore.p12 b/dss-demo-webapp/src/main/resources/keystore.p12 deleted file mode 100644 index 58df6e3b76..0000000000 Binary files a/dss-demo-webapp/src/main/resources/keystore.p12 and /dev/null differ diff --git a/dss-demo-webapp/src/main/resources/load.sql b/dss-demo-webapp/src/main/resources/load.sql deleted file mode 100644 index b31b4a1369..0000000000 --- a/dss-demo-webapp/src/main/resources/load.sql +++ /dev/null @@ -1,18 +0,0 @@ - -INSERT INTO PREFERENCES (PREF_KEY , PREF_VALUE) values ( 'preference.url.jar', 'http://localhost:8080/jar/signature-applet-r5.jar'); -INSERT INTO PREFERENCES (PREF_KEY , PREF_VALUE) values ( 'preference.url.service', 'http://localhost:8080/services/SignatureService?wsdl'); -INSERT INTO PREFERENCES (PREF_KEY , PREF_VALUE) values ( 'preference.default.policy.url', null); - -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.http.host', '127.0.0.1'); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.http.port', '8008'); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.http.user', ''); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.http.password', ''); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.http.enabled', 'false'); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.http.exclude', ''); - -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.https.host', '127.0.0.1'); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.https.port', '8008'); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.https.user', ''); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.https.password', ''); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.https.enabled', 'false'); -INSERT INTO PROXY_PREFERENCES (PROXY_KEY , PROXY_VALUE) values ( 'proxy.https.exclude', ''); \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/log4j.dtd b/dss-demo-webapp/src/main/resources/log4j.dtd deleted file mode 100644 index f8e433a50e..0000000000 --- a/dss-demo-webapp/src/main/resources/log4j.dtd +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dss-demo-webapp/src/main/resources/log4j.xml b/dss-demo-webapp/src/main/resources/log4j.xml deleted file mode 100644 index 6418576589..0000000000 --- a/dss-demo-webapp/src/main/resources/log4j.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/logback.xml b/dss-demo-webapp/src/main/resources/logback.xml deleted file mode 100644 index 2695adbc66..0000000000 --- a/dss-demo-webapp/src/main/resources/logback.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - INFO - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/nexu_deploy.ftl.js b/dss-demo-webapp/src/main/resources/nexu_deploy.ftl.js deleted file mode 100644 index ef08ee944f..0000000000 --- a/dss-demo-webapp/src/main/resources/nexu_deploy.ftl.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * © Nowina Solutions, 2015-2016 - * - * Concédée sous licence EUPL, version 1.1 ou – dès leur approbation par la Commission européenne - versions ultérieures de l’EUPL (la «Licence»). - * Vous ne pouvez utiliser la présente œuvre que conformément à la Licence. - * Vous pouvez obtenir une copie de la Licence à l’adresse suivante: - * - * http://ec.europa.eu/idabc/eupl5 - * - * Sauf obligation légale ou contractuelle écrite, le logiciel distribué sous la Licence est distribué «en l’état», - * SANS GARANTIES OU CONDITIONS QUELLES QU’ELLES SOIENT, expresses ou implicites. - * Consultez la Licence pour les autorisations et les restrictions linguistiques spécifiques relevant de la Licence. - */ - -var nexuVersion = "1.3"; - -$.get("${nexuUrl}/nexu-info", function(data) { - // something responded - if(data.version == nexuVersion) { - // valid version - // load nexu script - console.log("Loading script..."); - loadScript(); - } else { - // need update - $(".nexu-sign-button").html("Update NexU"); - $(".nexu-sign-button").on("click", function() { - console.log("Update NexU"); - return false; - }); - - } -}).fail(function() { - // no response, NexU not installed or not started - $("#submit-button").html("Install NexU"); - $("#submit-button").on("click", function() { - console.log("Install NexU"); - window.location = "${baseUrl}"; - return false; - }); -}); - -function loadScript() { - var xhrObj = new XMLHttpRequest(); - xhrObj.open('GET', "${nexuUrl}/nexu.js", false); - xhrObj.send(null); - var se = document.createElement('script'); - se.type = "text/javascript"; - se.text = xhrObj.responseText; - document.getElementsByTagName('head')[0].appendChild(se); - console.log("Nexuscript loaded"); -} diff --git a/dss-demo-webapp/src/main/resources/proxy.properties b/dss-demo-webapp/src/main/resources/proxy.properties deleted file mode 100644 index e55889ba7a..0000000000 --- a/dss-demo-webapp/src/main/resources/proxy.properties +++ /dev/null @@ -1,6 +0,0 @@ -proxy.http.host=xxx.ec.europa.eu -proxy.http.user=xxxx -proxy.http.password=xxx -proxy.http.port=8012 -proxy.http.enabled=true - diff --git a/dss-demo-webapp/src/main/resources/spring/applicationContext-core.xml b/dss-demo-webapp/src/main/resources/spring/applicationContext-core.xml deleted file mode 100644 index 2702f41ad8..0000000000 --- a/dss-demo-webapp/src/main/resources/spring/applicationContext-core.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/spring/applicationContext-dao.xml b/dss-demo-webapp/src/main/resources/spring/applicationContext-dao.xml deleted file mode 100644 index 571c23ab2f..0000000000 --- a/dss-demo-webapp/src/main/resources/spring/applicationContext-dao.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/spring/applicationContext-servlet.xml b/dss-demo-webapp/src/main/resources/spring/applicationContext-servlet.xml deleted file mode 100644 index 4835aadd67..0000000000 --- a/dss-demo-webapp/src/main/resources/spring/applicationContext-servlet.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - classpath*:tiles.xml - - - - - - - - classpath:dss.properties - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/spring/applicationContext.xml b/dss-demo-webapp/src/main/resources/spring/applicationContext.xml deleted file mode 100644 index 642eeaa694..0000000000 --- a/dss-demo-webapp/src/main/resources/spring/applicationContext.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - classpath:i18n/application - classpath:i18n/policy - - - - - - - - eu.europa.esig.jaxb.policy - - - - - - - - - - true - - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/structure.sql b/dss-demo-webapp/src/main/resources/structure.sql deleted file mode 100644 index bd6e83b6f2..0000000000 --- a/dss-demo-webapp/src/main/resources/structure.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TABLE PREFERENCES ( PREF_KEY VARCHAR(50) NOT NULL, PREF_VALUE VARCHAR(200), PRIMARY KEY (PREF_KEY)); -CREATE TABLE PROXY_PREFERENCES ( PROXY_KEY VARCHAR(50) NOT NULL, PROXY_VALUE VARCHAR(200), PRIMARY KEY (PROXY_KEY)); \ No newline at end of file diff --git a/dss-demo-webapp/src/main/resources/tiles.xml b/dss-demo-webapp/src/main/resources/tiles.xml deleted file mode 100644 index 92b88cc3dd..0000000000 --- a/dss-demo-webapp/src/main/resources/tiles.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/tomcatconf/tomcat-users.xml b/dss-demo-webapp/src/main/tomcatconf/tomcat-users.xml deleted file mode 100644 index 458fddd540..0000000000 --- a/dss-demo-webapp/src/main/tomcatconf/tomcat-users.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/META-INF/context.xml b/dss-demo-webapp/src/main/webapp/META-INF/context.xml deleted file mode 100644 index a5508fecaa..0000000000 --- a/dss-demo-webapp/src/main/webapp/META-INF/context.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/certificates/list.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/certificates/list.jsp deleted file mode 100644 index 9e3de6f5c4..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/certificates/list.jsp +++ /dev/null @@ -1,111 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> -<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> - -
    -
    - Cert(s) -

    - -

    -
    -
    - - -
    - " /> - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    SHA-256 (Hex)
    -
    -
    SHA-1 (Hex)
    -
    -
    SHA-256 (Base64)
    -
    -
    SHA-1 (Base64)
    -
    -
    -
    -
    -
    -
    - -
    -
    -

    - -

    -
    -
    - -
    - - : - -
    - -
    -
    - -
    -
    - -
    - - : - -
    - -
    -
    - - - -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    SHA-256 (Hex)
    -
    -
    SHA-1 (Hex)
    -
    -
    SHA-256 (Base64)
    -
    -
    SHA-1 (Base64)
    -
    -
    - -
    - -
    -
    - -
    -
    -
    -
    -
    - diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/form.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/form.jsp deleted file mode 100644 index 3270760ed7..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/form.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> - -

    - - -
    - - - -
    - -
    -
    -
    -
    - -
    -
    -
    diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/general/list.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/general/list.jsp deleted file mode 100644 index f3cd3ef219..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/general/list.jsp +++ /dev/null @@ -1,21 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -

    - - - - - - - - - - - - - - - -
    ">">
    diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/proxy/list.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/proxy/list.jsp deleted file mode 100644 index 54cadb569e..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/admin/proxy/list.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -

    - -

    - - - - - - - - - - - - - - - -
    ">">
    diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/diagnosticTree.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/diagnosticTree.jsp deleted file mode 100644 index 909ffff406..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/diagnosticTree.jsp +++ /dev/null @@ -1,4 +0,0 @@ -<%@page contentType="text/xml; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - -
    diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/error.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/error.jsp deleted file mode 100644 index b62f1c1251..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/error.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/extension.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/extension.jsp deleted file mode 100644 index 9eade8ebb7..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/extension.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> - -

    - - - - - - - - - - - - -
    -
    - - -
    -
    -
    - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/originalFileField.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/originalFileField.jsp deleted file mode 100644 index 6f57dac235..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/originalFileField.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> - -
    - - - -
    - -
    -
    \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signatureForm.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signatureForm.jsp deleted file mode 100644 index 0e8e717c63..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signatureForm.jsp +++ /dev/null @@ -1,37 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - -
    - - - -
    - - - -
    -
    - -
    -
    - -
    - - - -
    - - -
    -
    - -
    -
    \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signatureLevel.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signatureLevel.jsp deleted file mode 100644 index 13c01a9ac0..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signatureLevel.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - -
    - - - -
    - - -
    -
    - -
    -
    \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signaturePackaging.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signaturePackaging.jsp deleted file mode 100644 index 1b942bb968..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signaturePackaging.jsp +++ /dev/null @@ -1,20 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - -
    - - - -
    - - - -
    -
    - -
    -
    \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signedFileField.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signedFileField.jsp deleted file mode 100644 index 64f352d321..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/fields/signedFileField.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> - -
    - - - -
    - -
    -
    - -
    -
    \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/home.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/home.jsp deleted file mode 100644 index 69a9afbffd..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/home.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -

    - -

    -

    Please see the notes below for the features of the two applications:

    -

    - Signature -

    -
      -
    • XAdES detached and enveloping signatures can be used to sign any file.
    • -
    • XAdES enveloped signature can be used to sign an XML file.
    • -
    • PDF files can be signed with an enveloped PAdES signature.
    • -
    • CAdES enveloping or detached signatures can be used to sign any arbitrary files.
    • -
    • ASiC-S signature can be used to sign any type of files.
    • -
    • The multiple parallel signatures can be created.
    • -
    • A user can use PKCS#11-compliant SSCD, MS-CAPI, MOCCA and PKCS#12 to sign.
    • -
    • Any kind of signature: CAdES, PAdES, XAdES or ASiC-S can be validated.
    • -
    • A validation policy can be applied.
    • -
    • Two validation reports are available: Simple and Detailed.
    • -
    • The Diagnostic Data representing each static information used during the validation process is available.
    • -
    -

    - -

    -
      -
    • A Trusted List and List of the List can be created from scratch.
    • -
    • An existing TSL can be loaded, edited, signed and saved.
    • -
    • A basic validation is performed at the first step of creating a signature.
    • -
    diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/login-error.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/login-error.jsp deleted file mode 100644 index 15b9627c86..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/login-error.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/login.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/login.jsp deleted file mode 100644 index 01320d235b..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/login.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> - -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    -
    - - diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/nexu-signature-parameters.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/nexu-signature-parameters.jsp deleted file mode 100644 index 86ee2962aa..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/nexu-signature-parameters.jsp +++ /dev/null @@ -1,105 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -

    NexU

    - - - - -
    - - - -
    - -
    -
    - -
    -
    - - - - - - - -
    - - - -
    - - - -
    -
    - -
    -
    - -
    - - - -
    - -
    -
    - - -<%-- --%> - - -<%-- --%> - - -<%-- --%> - -
    -
    - -
    -
    -
    - - - -
    - -
    -
    -
    - - - -
    - - - -
    -
    -
    - - - -
    - -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/nexu-signature-process.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/nexu-signature-process.jsp deleted file mode 100644 index f0a02087e9..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/nexu-signature-process.jsp +++ /dev/null @@ -1,94 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -

    NexU signature process

    - -
    -
    - -
    -
    - - -<%-- --%> - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/basic-signature-constraint.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/basic-signature-constraint.jsp deleted file mode 100644 index 7117704e50..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/basic-signature-constraint.jsp +++ /dev/null @@ -1,93 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    - -
    "> -

    - -

    -
    -
    "> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/certificate-constraints.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/certificate-constraints.jsp deleted file mode 100644 index 227226bd3c..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/certificate-constraints.jsp +++ /dev/null @@ -1,121 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    -
    "> -

    - -

    -
    -
    "> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - -
    - -
    - - - - - - .KeyUsage.Id[${loop.index}]" value="${keyUsage}" checked="checked" />
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/cryptographic-constraints.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/cryptographic-constraints.jsp deleted file mode 100644 index f20bbf7a2e..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/cryptographic-constraints.jsp +++ /dev/null @@ -1,70 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    -
    "> -

    - -

    -
    -
    "> - - - - - - - - -
    - -
    - - - - - - - - -" class="encryptionAlgo" value="" checked="checked" />
    -
    -
    -
    - -
    - -
    "> - -
    -"> - -
    - -" name="" value="" class="form-control" /> -
    -
    -
    -
    -
    - -
    - -
    - - - - - - - - -" value="" checked="checked" />
    -
    -
    -
    - -
    "> - -
    - -
    -
    - diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/level-constraint.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/level-constraint.jsp deleted file mode 100644 index a10666e68b..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/level-constraint.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    - - -
    - -
    -
    \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/multi-value-constraints.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/multi-value-constraints.jsp deleted file mode 100644 index d845832434..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/multi-value-constraints.jsp +++ /dev/null @@ -1,34 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - -
    - - -
    - -
    - -
    "> - -
    - .Id[${loop.index}]" value="" /> -
    -
    -
    -
    - - - " type="button" onclick="addValue('')"/> - " type="button" onclick="removeLastValue('')"/> -
    - -
    - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/revocation-constraints.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/revocation-constraints.jsp deleted file mode 100644 index cfdaf005e9..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/revocation-constraints.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    -
    -

    - -

    -
    -
    - - - - - - - - -
    - - - - - -
    - -
    -
    - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/signature-constraints.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/signature-constraints.jsp deleted file mode 100644 index 0843128f18..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/signature-constraints.jsp +++ /dev/null @@ -1,100 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    -
    "> -

    - -

    -
    -
    "> - - - - - - - - - -
    - - -
    - -
    - -
    - - - - - - - - .AcceptablePolicies.Id[${loop.index}]" - value="" - checked="checked" /> - -
    -
    -
    -
    -
    - - - - - - - - - - - -
    - - - - - -
    - -
    - - - - - -
    -
    - - - - - -
    -
    -
    - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/signed-attributes-constraints.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/signed-attributes-constraints.jsp deleted file mode 100644 index 076ab21cb7..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/signed-attributes-constraints.jsp +++ /dev/null @@ -1,119 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    -
    "> -

    - -

    -
    -
    " > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/time-constraint.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/time-constraint.jsp deleted file mode 100644 index 6c4165e02a..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/time-constraint.jsp +++ /dev/null @@ -1,20 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    - - -
    - .value" value="" /> -
    -
    - -
    -
    - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/timestamp-constraints.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/timestamp-constraints.jsp deleted file mode 100644 index 137353482c..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/timestamp-constraints.jsp +++ /dev/null @@ -1,78 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    -
    "> -

    - -

    -
    -
    "> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - -
    -
    -
    - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/unsigned-attributes-constraints.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/unsigned-attributes-constraints.jsp deleted file mode 100644 index fa9939eb8b..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/unsigned-attributes-constraints.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    -
    "> -

    - -

    -
    -
    "> - - - - - - - - -
    -
    - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/value-constraint.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/value-constraint.jsp deleted file mode 100644 index cd13bb8366..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/policy/value-constraint.jsp +++ /dev/null @@ -1,20 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -
    - - -
    - " value="" /> -
    -
    - -
    -
    \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/signature-rest.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/signature-rest.jsp deleted file mode 100644 index 33dc239165..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/signature-rest.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -

    REST/SOAP WebServices

    - -

    DSS offers some " title="eSignature REST/SOAP WebServices">REST and SOAP WebServices which allows to execute the following operations :

    -
      -
    • Compute the digest to be signed (getDataToSign) ;
    • -
    • Incorporate the signature value in the final file (signDocument) ;
    • -
    • Extend an existing signature;
    • -
    • Validate a signature.
    • -
    - -

    These services hide the signature complexity (CAdES, PAdES, XAdES, ASiC) and made integration easier.

    diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/signature-standalone.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/signature-standalone.jsp deleted file mode 100644 index f7ba948c6f..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/signature-standalone.jsp +++ /dev/null @@ -1,29 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - -

    Standalone application

    - -

    - Download the standalone application (" title="e-signature standalone">zip) or (" title="e-signature standalone">tar.gz) -

    - -
    -
    -

    More info...

    -
    -
    -

    This demo is a standalone application which uses JavaFX (Java 8).

    -

    The application connects directly to the CA's infrastructure to retrieve information such as CRL, OCSP, certificates from AIA ...

    -

    All DSS business logic is embedded inside this application (CAdES, PAdES, XAdES, ASiC). This application doesn't requires a DSS server.

    - -
    -
    - - diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/tsl-info-country.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/tsl-info-country.jsp deleted file mode 100644 index 09f722006e..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/tsl-info-country.jsp +++ /dev/null @@ -1,199 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> -<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> - - -

    - -

    - - - - No info found for country "" - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - -
    -

    -
    -
    -
    -
    Url :
    -
    ">
    - - -
    Check date :
    -
    -
    - - -
    Indication :
    -
    - - - - - - - - - - - - -
    - -
    Sub indication :
    -
    -
    -
    - - -
    Sequence number :
    -
    -
    Issue date :
    -
    -
    Next update date :
    - -
    -
    - - -
    -
    - ${fn:length(model.parseResult.serviceProviders)} -

    Trust service providers

    -
    -
    - -
    -
    Name :
    -
    - -
    Trade name :
    -
    -
    -
    Postal address :
    -
    -
    Electronic address :
    -
    " title="">
    -
    - -
    -
    - ${fn:length(serviceProvider.services)} -

    Trust services

    -
    -
    - -
    -
    Name :
    -
    -
    Type :
    -
    ">
    - - -
    -
    Status :
    -
    ">
    -
    Start date :
    -
    - -
    End date :
    -
    -
    -
    -
    - - -
    -
    - ${fn:length(service.certificates)} -

    Certificates

    -
    -
    - -
    -
    :
    -
    -
    :
    -
    -
    Serial number
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - -
    -
    - ${fn:length(model.parseResult.pointers)} -

    Machine processable pointers

    -
    -
    -
      - -
    • ">
    • -
      -
    -
    -
    -
    -
    -
    -
    -
    - - diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/tsl-info.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/tsl-info.jsp deleted file mode 100644 index 1d38edc891..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/tsl-info.jsp +++ /dev/null @@ -1,91 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> -<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> - -

    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SignatureCountrySeq N°Check dateIssue dateNext updateNb of TSPNb of TSNb of Certs
    - - - - - - - ">${item.country}${item.sequenceNumber} - - - - - - - - - - - - - - - - - - - ${item.nbServiceProviders}${item.nbServices}${item.nbCertificatesAndX500Principals}
    diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/validation-policy.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/validation-policy.jsp deleted file mode 100644 index 061ea956d7..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/validation-policy.jsp +++ /dev/null @@ -1,206 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> - -<%-- --%> -<%-- --%> -<%-- --%> - - - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/validation.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/validation.jsp deleted file mode 100644 index afff6239dd..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/validation.jsp +++ /dev/null @@ -1,61 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> - -

    - - - - - - -
    - - - -
    - - - - - -
    -
    - -
    -
    - -
    -
    - -
    -
    - : -
    - -
    - - - - - - - - -
    -
    - -
    -
    - - -
    -
    -
    - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/validation_result.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/validation_result.jsp deleted file mode 100644 index b4766461d3..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/jsp/validation_result.jsp +++ /dev/null @@ -1,88 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> - - -
    -
    -
    - - - - - -
    Report of - -
    -
    -
    -
    -
    - - - - -
    - -
    - - - -
    -
    - - - -
    -
    - -
    -
    - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/templates/mainTemplate.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/templates/mainTemplate.jsp deleted file mode 100644 index 4137d5ddae..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/templates/mainTemplate.jsp +++ /dev/null @@ -1,80 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - - - - - - - - - <spring:message code="application.title" /> - - - " rel="stylesheet" /> - " rel="stylesheet" /> - " rel="stylesheet" /> - " rel="stylesheet" /> - - - - - - - <%--Used in signature.jsp --%> - - - - - -
    -
    - - - -
    - -
    -
    - -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -

    -
    -
    -
    -
    - - diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/templates/menuLayout.jsp b/dss-demo-webapp/src/main/webapp/WEB-INF/templates/menuLayout.jsp deleted file mode 100644 index c66be1c0d8..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/templates/menuLayout.jsp +++ /dev/null @@ -1,60 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> -<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - - - - - <%-- ADMIN PART --%> - - - - <%-- NO ADMIN PART --%> - - - - - - - - -
    -
    Useful links
    - -
    \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/WEB-INF/web.xml b/dss-demo-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index a823acdd25..0000000000 --- a/dss-demo-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - contextConfigLocation - classpath:spring/applicationContext.xml - - - - org.springframework.web.context.ContextLoaderListener - - - - org.springframework.web.context.request.RequestContextListener - - - - characterEncodingFilter - org.springframework.web.filter.CharacterEncodingFilter - - encoding - UTF-8 - - - - - characterEncodingFilter - /* - - - - Dispatcher - org.springframework.web.servlet.DispatcherServlet - - contextConfigLocation - classpath:spring/applicationContext-servlet.xml - - - - - Dispatcher - / - - - - - CXFServlet - org.apache.cxf.transport.servlet.CXFServlet - 1 - - - CXFServlet - /services/* - - - - index.jsp - - - - admin - - - - Admin security constraint - - secured - /admin/* - - - admin - - - - - FORM - - /login - /login-error - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/css/bootstrap-theme.min.css b/dss-demo-webapp/src/main/webapp/css/bootstrap-theme.min.css deleted file mode 100644 index cefa3d1ae3..0000000000 --- a/dss-demo-webapp/src/main/webapp/css/bootstrap-theme.min.css +++ /dev/null @@ -1,5 +0,0 @@ -/*! - * Bootstrap v3.3.4 (http://getbootstrap.com) - * Copyright 2011-2015 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */.btn-danger,.btn-default,.btn-info,.btn-primary,.btn-success,.btn-warning{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-success.active,.btn-success:active,.btn-warning.active,.btn-warning:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-danger .badge,.btn-default .badge,.btn-info .badge,.btn-primary .badge,.btn-success .badge,.btn-warning .badge{text-shadow:none}.btn.active,.btn:active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default.disabled,.btn-default:disabled,.btn-default[disabled]{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:focus,.btn-primary:hover{background-color:#265a88;background-position:0 -15px}.btn-primary.active,.btn-primary:active{background-color:#265a88;border-color:#245580}.btn-primary.disabled,.btn-primary:disabled,.btn-primary[disabled]{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:focus,.btn-success:hover{background-color:#419641;background-position:0 -15px}.btn-success.active,.btn-success:active{background-color:#419641;border-color:#3e8f3e}.btn-success.disabled,.btn-success:disabled,.btn-success[disabled]{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:focus,.btn-info:hover{background-color:#2aabd2;background-position:0 -15px}.btn-info.active,.btn-info:active{background-color:#2aabd2;border-color:#28a4c9}.btn-info.disabled,.btn-info:disabled,.btn-info[disabled]{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:focus,.btn-warning:hover{background-color:#eb9316;background-position:0 -15px}.btn-warning.active,.btn-warning:active{background-color:#eb9316;border-color:#e38d13}.btn-warning.disabled,.btn-warning:disabled,.btn-warning[disabled]{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:focus,.btn-danger:hover{background-color:#c12e2a;background-position:0 -15px}.btn-danger.active,.btn-danger:active{background-color:#c12e2a;border-color:#b92c28}.btn-danger.disabled,.btn-danger:disabled,.btn-danger[disabled]{background-color:#c12e2a;background-image:none}.img-thumbnail,.thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)} \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/css/bootstrap.min.css b/dss-demo-webapp/src/main/webapp/css/bootstrap.min.css deleted file mode 100644 index cd1c616ad8..0000000000 --- a/dss-demo-webapp/src/main/webapp/css/bootstrap.min.css +++ /dev/null @@ -1,5 +0,0 @@ -/*! - * Bootstrap v3.3.4 (http://getbootstrap.com) - * Copyright 2011-2015 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - *//*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px \9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.form-group-sm .form-control{height:30px;line-height:30px}select[multiple].form-group-sm .form-control,textarea.form-group-sm .form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:5px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.form-group-lg .form-control{height:46px;line-height:46px}select[multiple].form-group-lg .form-control,textarea.form-group-lg .form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:10px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.33px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.active,.btn-default.focus,.btn-default:active,.btn-default:focus,.btn-default:hover,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.active,.btn-primary.focus,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.active,.btn-success.focus,.btn-success:active,.btn-success:focus,.btn-success:hover,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.active,.btn-info.focus,.btn-info:active,.btn-info:focus,.btn-info:hover,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.active,.btn-warning.focus,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.active,.btn-danger.focus,.btn-danger:active,.btn-danger:focus,.btn-danger:hover,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px solid}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px)and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:2;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px 15px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding:48px 0}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-weight:400;line-height:1.4;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-weight:400;line-height:1.42857143;text-align:left;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000;perspective:1000}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;margin-top:-10px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px)and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px)and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px)and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px)and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px)and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px)and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px)and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px)and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px)and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px)and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/css/dss.css b/dss-demo-webapp/src/main/webapp/css/dss.css deleted file mode 100644 index 3610e37b1d..0000000000 --- a/dss-demo-webapp/src/main/webapp/css/dss.css +++ /dev/null @@ -1,21 +0,0 @@ -.navbar { - min-height: 75px; -} - -.navbar-brand { - padding: 5px; -} - -.navbar-nav>li>a { - line-height: 44px; -} - -#reportSelectorPanel .panel-heading { - margin-left: 0px; - padding-left: 0px; -} - -.tooltip-inner { - max-width: none; - white-space: nowrap; -} \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/dss-demo-webapp/src/main/webapp/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png deleted file mode 100644 index 594c5639ac..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_diagonals-thick_20_666666_40x40.png b/dss-demo-webapp/src/main/webapp/css/images/ui-bg_diagonals-thick_20_666666_40x40.png deleted file mode 100644 index e3ee787b20..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_diagonals-thick_20_666666_40x40.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_flat_10_000000_40x100.png b/dss-demo-webapp/src/main/webapp/css/images/ui-bg_flat_10_000000_40x100.png deleted file mode 100644 index 7e80ad2f38..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_flat_10_000000_40x100.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_glass_100_f6f6f6_1x400.png b/dss-demo-webapp/src/main/webapp/css/images/ui-bg_glass_100_f6f6f6_1x400.png deleted file mode 100644 index 88a248419f..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_glass_100_f6f6f6_1x400.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_glass_100_fdf5ce_1x400.png b/dss-demo-webapp/src/main/webapp/css/images/ui-bg_glass_100_fdf5ce_1x400.png deleted file mode 100644 index 304723a778..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_glass_100_fdf5ce_1x400.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_glass_65_ffffff_1x400.png b/dss-demo-webapp/src/main/webapp/css/images/ui-bg_glass_65_ffffff_1x400.png deleted file mode 100644 index 7fbc0d98a0..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_glass_65_ffffff_1x400.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/dss-demo-webapp/src/main/webapp/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png deleted file mode 100644 index 00557a17a3..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/dss-demo-webapp/src/main/webapp/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png deleted file mode 100644 index 337bc92731..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/dss-demo-webapp/src/main/webapp/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png deleted file mode 100644 index fcab698c6e..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_222222_256x240.png b/dss-demo-webapp/src/main/webapp/css/images/ui-icons_222222_256x240.png deleted file mode 100644 index e9c8e16ac5..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_222222_256x240.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_228ef1_256x240.png b/dss-demo-webapp/src/main/webapp/css/images/ui-icons_228ef1_256x240.png deleted file mode 100644 index 8d68c543e0..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_228ef1_256x240.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_ef8c08_256x240.png b/dss-demo-webapp/src/main/webapp/css/images/ui-icons_ef8c08_256x240.png deleted file mode 100644 index 18bbfe8215..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_ef8c08_256x240.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_ffd27a_256x240.png b/dss-demo-webapp/src/main/webapp/css/images/ui-icons_ffd27a_256x240.png deleted file mode 100644 index 4435b497eb..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_ffd27a_256x240.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_ffffff_256x240.png b/dss-demo-webapp/src/main/webapp/css/images/ui-icons_ffffff_256x240.png deleted file mode 100644 index 4d66f596e5..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/css/images/ui-icons_ffffff_256x240.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/css/jquery-ui.min.css b/dss-demo-webapp/src/main/webapp/css/jquery-ui.min.css deleted file mode 100644 index 2357f46108..0000000000 --- a/dss-demo-webapp/src/main/webapp/css/jquery-ui.min.css +++ /dev/null @@ -1,7 +0,0 @@ -/*! jQuery UI - v1.11.4 - 2015-07-14 -* http://jqueryui.com -* Includes: core.css, draggable.css, resizable.css, selectable.css, sortable.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, menu.css, progressbar.css, selectmenu.css, slider.css, spinner.css, tabs.css, tooltip.css, theme.css -* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS%2CTahoma%2CVerdana%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=gloss_wave&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=highlight_soft&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=glass&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=glass&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=diagonals_thick&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=diagonals_thick&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=flat&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px -* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ - -.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;min-height:0;font-size:100%}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:none}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-button{display:inline-block;overflow:hidden;position:relative;text-decoration:none;cursor:pointer}.ui-selectmenu-button span.ui-icon{right:0.5em;left:auto;margin-top:-8px;position:absolute;top:50%}.ui-selectmenu-button span.ui-selectmenu-text{text-align:left;padding:0.4em 2.1em 0.4em 1em;display:block;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #ddd;background:#eee url("images/ui-bg_highlight-soft_100_eeeeee_1x100.png") 50% top repeat-x;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #e78f08;background:#f6a828 url("images/ui-bg_gloss-wave_35_f6a828_500x100.png") 50% 50% repeat-x;color:#fff;font-weight:bold}.ui-widget-header a{color:#fff}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #ccc;background:#f6f6f6 url("images/ui-bg_glass_100_f6f6f6_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#1c94c4}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#1c94c4;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #fbcb09;background:#fdf5ce url("images/ui-bg_glass_100_fdf5ce_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#c77405}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#c77405;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #fbd850;background:#fff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#eb8f00}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#eb8f00;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fed22f;background:#ffe45c url("images/ui-bg_highlight-soft_75_ffe45c_1x100.png") 50% top repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#b81900 url("images/ui-bg_diagonals-thick_18_b81900_40x40.png") 50% 50% repeat;color:#fff}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#fff}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#fff}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_228ef1_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_ffd27a_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#666 url("images/ui-bg_diagonals-thick_20_666666_40x40.png") 50% 50% repeat;opacity:.5;filter:Alpha(Opacity=50)}.ui-widget-shadow{margin:-5px 0 0 -5px;padding:5px;background:#000 url("images/ui-bg_flat_10_000000_40x100.png") 50% 50% repeat-x;opacity:.2;filter:Alpha(Opacity=20);border-radius:5px} \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.eot b/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.eot deleted file mode 100644 index b93a4953ff..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.eot and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.svg b/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.svg deleted file mode 100644 index 94fb5490a2..0000000000 --- a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.svg +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.ttf b/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index 1413fc609a..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.woff b/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index 9e612858f8..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.woff2 b/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.woff2 deleted file mode 100644 index 64539b54c3..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/fonts/glyphicons-halflings-regular.woff2 and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/images/68x63-dss-logo.png b/dss-demo-webapp/src/main/webapp/images/68x63-dss-logo.png deleted file mode 100644 index a3e4385db0..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/images/68x63-dss-logo.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/images/dss-logo.png b/dss-demo-webapp/src/main/webapp/images/dss-logo.png deleted file mode 100644 index 1c9553fffa..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/images/dss-logo.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/images/favicon.ico b/dss-demo-webapp/src/main/webapp/images/favicon.ico deleted file mode 100644 index 7a58bd11ff..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/images/favicon.ico and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/images/favicon_animated.gif b/dss-demo-webapp/src/main/webapp/images/favicon_animated.gif deleted file mode 100644 index 0f066a2648..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/images/favicon_animated.gif and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/images/jnlp-icon.png b/dss-demo-webapp/src/main/webapp/images/jnlp-icon.png deleted file mode 100644 index 67fe87e9e1..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/images/jnlp-icon.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/images/jnlp-webservices.png b/dss-demo-webapp/src/main/webapp/images/jnlp-webservices.png deleted file mode 100644 index a061eda1c5..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/images/jnlp-webservices.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/images/spring-mvc-light-applet.png b/dss-demo-webapp/src/main/webapp/images/spring-mvc-light-applet.png deleted file mode 100644 index 496c8def74..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/images/spring-mvc-light-applet.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/images/standalone-application.png b/dss-demo-webapp/src/main/webapp/images/standalone-application.png deleted file mode 100644 index ddf1c0d587..0000000000 Binary files a/dss-demo-webapp/src/main/webapp/images/standalone-application.png and /dev/null differ diff --git a/dss-demo-webapp/src/main/webapp/index.jsp b/dss-demo-webapp/src/main/webapp/index.jsp deleted file mode 100644 index 0bd3a46921..0000000000 --- a/dss-demo-webapp/src/main/webapp/index.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - diff --git a/dss-demo-webapp/src/main/webapp/jnlp/light-applet.jnlp b/dss-demo-webapp/src/main/webapp/jnlp/light-applet.jnlp deleted file mode 100644 index 7ac931465e..0000000000 --- a/dss-demo-webapp/src/main/webapp/jnlp/light-applet.jnlp +++ /dev/null @@ -1,17 +0,0 @@ - - - - DSS Light applet - Nowina Solutions - - - - - - - - - - - - \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/scripts/bootstrap.min.js b/dss-demo-webapp/src/main/webapp/scripts/bootstrap.min.js deleted file mode 100644 index c8f82e592a..0000000000 --- a/dss-demo-webapp/src/main/webapp/scripts/bootstrap.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Bootstrap v3.3.4 (http://getbootstrap.com) - * Copyright 2011-2015 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ -if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.4",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.4",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.4",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.4",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=c(d),f={relatedTarget:this};e.hasClass("open")&&(e.trigger(b=a.Event("hide.bs.dropdown",f)),b.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f)))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.4",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport),this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c&&c.$tip&&c.$tip.is(":visible")?void(c.hoverState="in"):(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.options.container?a(this.options.container):this.$element.parent(),p=this.getPosition(o);h="bottom"==h&&k.bottom+m>p.bottom?"top":"top"==h&&k.top-mp.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type)})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.4",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.4",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.4",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=a(document.body).height();"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); \ No newline at end of file diff --git a/dss-demo-webapp/src/main/webapp/scripts/detect_browser_version.js b/dss-demo-webapp/src/main/webapp/scripts/detect_browser_version.js deleted file mode 100644 index f3593ac7f1..0000000000 --- a/dss-demo-webapp/src/main/webapp/scripts/detect_browser_version.js +++ /dev/null @@ -1,54 +0,0 @@ -function detectBrowserVersion() { - var userAgent = navigator.userAgent.toLowerCase(); - jQuery.browser = {}; - jQuery.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); - jQuery.browser.mozilla = /mozilla/.test(navigator.userAgent.toLowerCase()) && !/webkit/.test(navigator.userAgent.toLowerCase()); - jQuery.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase()); - jQuery.browser.opera = /opera/.test(navigator.userAgent.toLowerCase()); - jQuery.browser.msie = /msie/.test(navigator.userAgent.toLowerCase()); - var version = 0; - - // Is this a version of IE? - if (jQuery.browser.msie) { - userAgent = jQuery.browser.version; - userAgent = userAgent.substring(0, userAgent.indexOf('.')); - version = userAgent; - } - - // Is this a version of Chrome? - if (jQuery.browser.chrome) { - userAgent = userAgent.substring(userAgent.indexOf('chrome/') + 7); - userAgent = userAgent.substring(0, userAgent.indexOf('.')); - version = userAgent; - // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't - jQuery.browser.safari = false; - } - - // Is this a version of Safari? - if (jQuery.browser.safari) { - userAgent = userAgent.substring(userAgent.indexOf('safari/') + 7); - userAgent = userAgent.substring(0, userAgent.indexOf('.')); - version = userAgent; - } - - // Is this a version of Mozilla? - if (jQuery.browser.mozilla) { - //Is it Firefox? - if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1) { - userAgent = userAgent.substring(userAgent.indexOf('firefox/') + 8); - userAgent = userAgent.substring(0, userAgent.indexOf('.')); - version = userAgent; - } - // If not then it must be another Mozilla - else { - } - } - - // Is this a version of Opera? - if (jQuery.browser.opera) { - userAgent = userAgent.substring(userAgent.indexOf('version/') + 8); - userAgent = userAgent.substring(0, userAgent.indexOf('.')); - version = userAgent; - } - return version; -} diff --git a/dss-demo-webapp/src/main/webapp/scripts/jquery-1.11.2.min.js b/dss-demo-webapp/src/main/webapp/scripts/jquery-1.11.2.min.js deleted file mode 100644 index e6a051d0d1..0000000000 --- a/dss-demo-webapp/src/main/webapp/scripts/jquery-1.11.2.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v1.11.2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.2",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; -return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
    a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/\s*$/g,rb={option:[1,""],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "],_default:k.htmlSerialize?[0,"",""]:[1,"X
    ","
    "]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?""!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("