poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1628348 - in /poi/trunk: ./ compile-lib/ ooxml-lib/ src/java/org/apache/poi/poifs/crypt/ src/ooxml/java/org/apache/poi/openxml4j/opc/ src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ src/ooxml/java/org/apache/poi/poifs/crypt/dsig/ src...
Date Tue, 30 Sep 2014 01:23:17 GMT
Author: kiwiwings
Date: Tue Sep 30 01:23:17 2014
New Revision: 1628348

URL: http://svn.apache.org/r1628348
Log:
Bug 56836 - XML signature support

Added:
    poi/trunk/compile-lib/
      - copied from r1628347, poi/branches/xml_signature/compile-lib/
    poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/
      - copied from r1628347, poi/branches/xml_signature/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/
    poi/trunk/src/ooxml/java/org/apache/poi/util/MethodUtils.java
      - copied unchanged from r1628347, poi/branches/xml_signature/src/ooxml/java/org/apache/poi/util/MethodUtils.java
    poi/trunk/src/ooxml/java/org/apache/poi/util/XmlSort.java
      - copied unchanged from r1628347, poi/branches/xml_signature/src/ooxml/java/org/apache/poi/util/XmlSort.java
    poi/trunk/src/ooxml/resources/org/apache/poi/poifs/crypt/signatureInfo.xsd
      - copied unchanged from r1628347, poi/branches/xml_signature/src/ooxml/resources/org/apache/poi/poifs/crypt/signatureInfo.xsd
    poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/PkiTestUtils.java
      - copied unchanged from r1628347, poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/poifs/crypt/PkiTestUtils.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java
      - copied unchanged from r1628347, poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java
    poi/trunk/test-data/xmldsign/
      - copied from r1628347, poi/branches/xml_signature/test-data/xmldsign/
Modified:
    poi/trunk/   (props changed)
    poi/trunk/.classpath
    poi/trunk/build.xml
    poi/trunk/ooxml-lib/   (props changed)
    poi/trunk/src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
    poi/trunk/src/testcases/org/apache/poi/POIDataSamples.java

Propchange: poi/trunk/
------------------------------------------------------------------------------
  Merged /poi/branches/xml_signature:r1617139-1628347

Modified: poi/trunk/.classpath
URL: http://svn.apache.org/viewvc/poi/trunk/.classpath?rev=1628348&r1=1628347&r2=1628348&view=diff
==============================================================================
--- poi/trunk/.classpath (original)
+++ poi/trunk/.classpath Tue Sep 30 01:23:17 2014
@@ -1,29 +1,33 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src/java"/>
-	<classpathentry kind="src" path="src/testcases"/>
-	<classpathentry kind="src" path="src/resources/main"/>
-	<classpathentry kind="src" path="src/ooxml/java"/>
-	<classpathentry kind="src" path="src/ooxml/testcases"/>
-	<classpathentry kind="src" path="src/resources/ooxml"/>
-	<classpathentry kind="src" path="src/scratchpad/src"/>
-	<classpathentry kind="src" path="src/scratchpad/testcases"/>
-	<classpathentry kind="src" path="src/resources/scratchpad"/>
-	<classpathentry kind="src" path="src/contrib/poi-ruby/java"/>
-	<classpathentry kind="src" path="src/examples/src"/>
-	<classpathentry kind="src" path="src/excelant/java"/>
-	<classpathentry kind="src" path="src/excelant/testcases"/>
-	<classpathentry kind="src" path="src/excelant/resources"/>
-	<classpathentry kind="lib" path="lib/ant-1.9.4.jar"/>
-	<classpathentry kind="lib" path="lib/ant-launcher-1.9.4.jar"/>
-	<classpathentry kind="lib" path="lib/commons-codec-1.9.jar"/>
-	<classpathentry kind="lib" path="lib/commons-logging-1.1.3.jar"/>
-	<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
-	<classpathentry kind="lib" path="ooxml-lib/xmlbeans-2.6.0.jar"/>
-	<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
-	<classpathentry kind="lib" path="lib/junit-4.11.jar"/>
-	<classpathentry kind="lib" path="ooxml-lib/ooxml-schemas-1.1.jar" sourcepath="ooxml-lib/ooxml-schemas-src-1.1.jar"/>
-	<classpathentry kind="lib" path="ooxml-lib/ooxml-encryption-1.1.jar" sourcepath="ooxml-lib/ooxml-encryption-src-1.1.jar"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="output" path="build/eclipse"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/java"/>
+	<classpathentry kind="src" path="src/testcases"/>
+	<classpathentry kind="src" path="src/resources/main"/>
+	<classpathentry kind="src" path="src/ooxml/java"/>
+	<classpathentry kind="src" path="src/ooxml/testcases"/>
+	<classpathentry kind="src" path="src/resources/ooxml"/>
+	<classpathentry kind="src" path="src/scratchpad/src"/>
+	<classpathentry kind="src" path="src/scratchpad/testcases"/>
+	<classpathentry kind="src" path="src/resources/scratchpad"/>
+	<classpathentry kind="src" path="src/contrib/poi-ruby/java"/>
+	<classpathentry kind="src" path="src/examples/src"/>
+	<classpathentry kind="src" path="src/excelant/java"/>
+	<classpathentry kind="src" path="src/excelant/testcases"/>
+	<classpathentry kind="src" path="src/excelant/resources"/>
+	<classpathentry kind="lib" path="lib/ant-1.9.4.jar"/>
+	<classpathentry kind="lib" path="lib/ant-launcher-1.9.4.jar"/>
+	<classpathentry kind="lib" path="lib/commons-codec-1.9.jar"/>
+	<classpathentry kind="lib" path="lib/commons-logging-1.1.3.jar"/>
+	<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
+	<classpathentry kind="lib" path="ooxml-lib/xmlbeans-2.6.0.jar"/>
+	<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
+	<classpathentry kind="lib" path="lib/junit-4.11.jar"/>
+	<classpathentry kind="lib" path="ooxml-lib/ooxml-schemas-1.1.jar" sourcepath="ooxml-lib/ooxml-schemas-src-1.1.jar"/>
+	<classpathentry kind="lib" path="ooxml-lib/ooxml-encryption-1.2.jar" sourcepath="ooxml-lib/ooxml-encryption-src-1.2.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="compile-lib/slf4j-api-1.7.7.jar"/>
+	<classpathentry kind="lib" path="compile-lib/bcpkix-jdk15on-1.51.jar"/>
+	<classpathentry kind="lib" path="compile-lib/bcprov-ext-jdk15on-1.51.jar"/>
+	<classpathentry kind="lib" path="compile-lib/xmlsec-2.0.1.jar"/>
+	<classpathentry kind="output" path="build/eclipse"/>
+</classpath>

Modified: poi/trunk/build.xml
URL: http://svn.apache.org/viewvc/poi/trunk/build.xml?rev=1628348&r1=1628347&r2=1628348&view=diff
==============================================================================
--- poi/trunk/build.xml (original)
+++ poi/trunk/build.xml Tue Sep 30 01:23:17 2014
@@ -61,6 +61,7 @@ under the License.
 
     <property name="main.lib" location="lib"/>
     <property name="ooxml.lib" location="ooxml-lib"/>
+	<property name="compile.lib" location="compile-lib"/>
     <property name="forrest.home" value="${env.FORREST_HOME}"/>
 
     <!-- compiler options options -->
@@ -118,7 +119,6 @@ under the License.
     <property name="ooxml.output.test.dir" location="build/ooxml-test-classes"/>
     <property name="ooxml.testokfile" location="build/ooxml-testokfile.txt"/>
     <property name="ooxml.lite.output.dir" location="build/ooxml-lite-classes"/>
-    <property name="ooxml.encryption.xsd.dir" location="src/ooxml/resources/org/apache/poi/poifs/crypt"/>
 
     <!-- Excelant: -->
     <property name="excelant.resource.dir" value="src/excelant/resources"/>
@@ -147,7 +147,17 @@ under the License.
     <property name="main.antlauncher.jar" location="${main.lib}/ant-launcher-1.9.4.jar"/>
     <property name="main.antlauncher.url" value="${repository.m2}/maven2/org/apache/ant/ant-launcher/1.9.4/ant-launcher-1.9.4.jar"/>
 
-    <!-- jars in the lib-ooxml directory, see the fetch-ooxml-jars target-->
+	<!-- xml signature libs -->
+	<property name="dsig.xmlsec.jar" location="${compile.lib}/xmlsec-2.0.1.jar"/>
+	<property name="dsig.xmlsec.url" value="${repository.m2}/maven2/org/apache/santuario/xmlsec/2.0.1/xmlsec-2.0.1.jar"/>
+	<property name="dsig.bouncycastle-prov.jar" location="${compile.lib}/bcprov-ext-jdk15on-1.51.jar"/>
+	<property name="dsig.bouncycastle-prov.url" value="${repository.m2}/maven2/org/bouncycastle/bcprov-ext-jdk15on/1.51/bcprov-ext-jdk15on-1.51.jar"/>
+	<property name="dsig.bouncycastle-pkix.jar" location="${compile.lib}/bcpkix-jdk15on-1.51.jar"/>
+	<property name="dsig.bouncycastle-pkix.url" value="${repository.m2}/maven2/org/bouncycastle/bcpkix-jdk15on/1.51/bcpkix-jdk15on-1.51.jar"/>
+	<property name="dsig.sl4j-api.jar" location="${compile.lib}/slf4j-api-1.7.7.jar"/>
+	<property name="dsig.sl4j-api.url" value="${repository.m2}/maven2/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar"/>
+
+	<!-- jars in the lib-ooxml directory, see the fetch-ooxml-jars target-->
     <property name="ooxml.xmlbeans23.jar" location="${ooxml.lib}/xmlbeans-2.3.0.jar"/>
     <property name="ooxml.xmlbeans23.url"
               value="${repository.m2}/maven2/org/apache/xmlbeans/xmlbeans/2.3.0/xmlbeans-2.3.0.jar"/>
@@ -160,7 +170,7 @@ under the License.
     <property name="jacoco.url" value="${repository.m2}/maven2/org/jacoco/jacoco/0.7.1.201405082137/jacoco-0.7.1.201405082137.zip"/>
     <property name="asm.jar" location="${main.lib}/asm-all-5.0.3.jar"/>
     <property name="asm.url" value="${repository.m2}/maven2/org/ow2/asm/asm-all/5.0.3/asm-all-5.0.3.jar"/>
-
+	
 	<!-- for testing with older Xerces implementation -->
     <property name="xerces.jar" location="${main.lib}/xercesImpl-2.6.1.jar"/>
     <property name="xerces.url" value="${repository.m2}/maven2/xerces/xercesImpl/2.6.1//xercesImpl-2.6.1.jar"/>
@@ -171,17 +181,30 @@ under the License.
 
     <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
     <!-- "Copy these file(s), free of charge" -->
-    <property name="ooxml.xsds.ozip" location="${ooxml.lib}/OfficeOpenXML-Part4.zip"/>
-    <property name="ooxml.xsds.izip" location="${ooxml.lib}/OfficeOpenXML-XMLSchema.zip"/>
-    <property name="ooxml.xsds.url"
+    <property name="ooxml.xsds.ozip.1" value="OfficeOpenXML-Part4.zip"/>
+    <property name="ooxml.xsds.izip.1" value="OfficeOpenXML-XMLSchema.zip"/>
+    <property name="ooxml.xsds.url.1"
               value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%204%20(PDF).zip"/>
     <property name="ooxml.xsds.src.dir" location="build/ooxml-xsds-src"/>
     <property name="ooxml.xsds.src.jar" location="${ooxml.lib}/ooxml-schemas-src-1.1.jar"/>
     <property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas-1.1.jar"/>
 
+	<!-- additional schemas are packed into the poi schemas jar, -->
+	<!-- so we don't have to care about a seperate versioning of the original ooxml schemas
-->
+	<property name="ooxml.xsds.dc.1" value="http://dublincore.org/schemas/xmls/qdc/2003/04/02/dc.xsd"/>
+	<property name="ooxml.xsds.dc.2" value="http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcterms.xsd"/>
+	<property name="ooxml.xsds.dc.3" value="http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcmitype.xsd"/>
+	<property name="ooxml.xsds.dsig.1" value="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"/>
+	<property name="ooxml.xsds.dsig.2" value="http://uri.etsi.org/01903/v1.3.2/XAdES.xsd"/>
+	<property name="ooxml.xsds.dsig.3" value="http://uri.etsi.org/01903/v1.4.1/XAdESv141.xsd"/>
+    <property name="ooxml.xsds.ozip.2" value="OfficeOpenXML-Part2.zip"/>
+    <property name="ooxml.xsds.izip.2" value="OpenPackagingConventions-XMLSchema.zip"/>
+    <property name="ooxml.xsds.url.2"
+              value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%202%20(PDF).zip"/>
     <property name="ooxml.encryption.src.dir" location="build/ooxml-encryption-src"/>
-    <property name="ooxml.encryption.src.jar" location="${ooxml.lib}/ooxml-encryption-src-1.1.jar"/>
-    <property name="ooxml.encryption.jar" location="${ooxml.lib}/ooxml-encryption-1.1.jar"/>
+    <property name="ooxml.encryption.src.jar" location="${ooxml.lib}/ooxml-encryption-src-1.2.jar"/>
+    <property name="ooxml.encryption.jar" location="${ooxml.lib}/ooxml-encryption-1.2.jar"/>
+    <property name="ooxml.encryption.xsd.dir" location="src/ooxml/resources/org/apache/poi/poifs/crypt"/>
 
     <property name="maven.ooxml.xsds.version.id" value="1.0"/>
     <property name="maven.ooxml.xsds.jar" value="ooxml-schemas-${maven.ooxml.xsds.version.id}.jar"/>
@@ -222,6 +245,13 @@ under the License.
         <pathelement location="${main.output.dir}"/>
     </path>
 
+    <path id="ooxml.xmlsec.classpath">
+        <pathelement location="${dsig.xmlsec.jar}"/>
+        <pathelement location="${dsig.bouncycastle-prov.jar}"/>
+        <pathelement location="${dsig.bouncycastle-pkix.jar}"/>
+        <pathelement location="${dsig.sl4j-api.jar}"/>
+    </path>
+
     <path id="ooxml.classpath">
         <pathelement location="${ooxml.xmlbeans26.jar}"/>
         <pathelement location="${ooxml.xsds.jar}"/>
@@ -229,6 +259,7 @@ under the License.
         <pathelement location="${main.output.dir}"/>
         <pathelement location="${scratchpad.output.dir}"/>
         <pathelement location="${ooxml.encryption.jar}"/>
+        <path refid="ooxml.xmlsec.classpath"/>
     </path>
 
     <path id="test.classpath">
@@ -361,7 +392,7 @@ under the License.
 			</fileset>
 		</delete>
 
-		<condition property="jars.present">
+        <condition property="jars.present">
             <or>
                 <and>
                     <available file="${main.commons-logging.jar}"/>
@@ -375,6 +406,10 @@ under the License.
                     <available file="${jacoco.zip}"/>
                     <available file="${rat.jar}"/>
                     <available file="${xerces.jar}"/>
+                    <available file="${dsig.bouncycastle-prov.jar}"/>
+                    <available file="${dsig.bouncycastle-pkix.jar}"/>
+                    <available file="${dsig.xmlsec.jar}"/>
+                    <available file="${dsig.sl4j-api.jar}"/>
                 </and>
                 <isset property="disconnected"/>
             </or>
@@ -433,6 +468,22 @@ under the License.
             <param name="sourcefile" value="${rat.url}"/>
             <param name="destfile" value="${rat.jar}"/>
         </antcall>
+        <antcall target="downloadfile">
+            <param name="sourcefile" value="${dsig.bouncycastle-prov.url}"/>
+            <param name="destfile" value="${dsig.bouncycastle-prov.jar}"/>
+        </antcall>
+        <antcall target="downloadfile">
+            <param name="sourcefile" value="${dsig.bouncycastle-pkix.url}"/>
+            <param name="destfile" value="${dsig.bouncycastle-pkix.jar}"/>
+        </antcall>
+        <antcall target="downloadfile">
+            <param name="sourcefile" value="${dsig.xmlsec.url}"/>
+            <param name="destfile" value="${dsig.xmlsec.jar}"/>
+        </antcall>
+        <antcall target="downloadfile">
+            <param name="sourcefile" value="${dsig.sl4j-api.url}"/>
+            <param name="destfile" value="${dsig.sl4j-api.jar}"/>
+        </antcall>
     </target>
 
     <target name="check-ooxml-jars">
@@ -463,19 +514,37 @@ under the License.
         <condition property="ooxml-xsds.present">
             <or>
                 <and>
-                    <available file="${ooxml.xsds.izip}"/>
+                    <available file="${ooxml.lib}/${ooxml.xsds.izip.1}"/>
                 </and>
                 <isset property="disconnected"/>
             </or>
         </condition>
     </target>
     <target name="fetch-ooxml-xsds" unless="ooxml-xsds.present"
-            depends="check-ooxml-xsds"
+        depends="check-ooxml-xsds"
             description="Fetches needed OOXML xsd files from the Internet">
-        <get src="${ooxml.xsds.url}" dest="${ooxml.xsds.ozip}"/>
-        <unzip src="${ooxml.xsds.ozip}" dest="${ooxml.lib}">
+        <get dest="${ooxml.lib}" skipexisting="true">
+        	<url url="${ooxml.xsds.url.1}"/>
+        	<url url="${ooxml.xsds.url.2}"/>
+        	<url url="${ooxml.xsds.dc.1}"/>
+        	<url url="${ooxml.xsds.dc.2}"/>
+        	<url url="${ooxml.xsds.dc.3}"/>
+        	<url url="${ooxml.xsds.dsig.1}"/>
+        	<url url="${ooxml.xsds.dsig.2}"/>
+        	<url url="${ooxml.xsds.dsig.3}"/>
+        	<chainedmapper>
+        		<flattenmapper/>
+	        	<firstmatchmapper>
+	        		<globmapper from="Office%20Open%20XML%201st%20edition%20Part%20*%20(PDF).zip"
to="OfficeOpenXML-Part*.zip"/>
+	        		<identitymapper/>
+	    		</firstmatchmapper>
+    		</chainedmapper>
+    	</get>
+        <unzip src="${ooxml.lib}/${ooxml.xsds.ozip.1}" dest="${ooxml.lib}">
+        	<fileset dir="${ooxml.lib}" includes="OfficeOpenXML-Part*.zip"/>
             <patternset>
-                <include name="OfficeOpenXML-XMLSchema.zip"/>
+                <include name="${ooxml.xsds.izip.1}"/>
+            	<include name="${ooxml.xsds.izip.2}"/>
             </patternset>
         </unzip>
     </target>
@@ -486,19 +555,10 @@ under the License.
                 <isset property="disconnected"/>
             </or>
         </condition>
-        <condition property="ooxml-compiled-encryption-xsds.present">
-            <or>
-                <available file="${ooxml.encryption.jar}"/>
-                <isset property="disconnected"/>
-            </or>
-        </condition>
     </target>
     <target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
-            depends="check-jars,fetch-jars,check-compiled-ooxml-xsds"
-            description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
-        <property name="ooxml.xsds.tmp.dir" location="build/ooxml-xsds"/>
-        <mkdir dir="${ooxml.xsds.tmp.dir}"/>
-
+        depends="check-jars,fetch-jars,check-compiled-ooxml-xsds"
+        description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
         <taskdef name="xmlbean"
                  classname="org.apache.xmlbeans.impl.tool.XMLBean"
                  classpath="${ooxml.xmlbeans23.jar}"/>
@@ -510,11 +570,9 @@ under the License.
            <equals arg1="${sun.arch.data.model}" arg2="64" />
         </condition>
 
-        <unzip src="${ooxml.xsds.izip}" dest="${ooxml.xsds.tmp.dir}"/>
-        <!--
-              schema="build/ooxml-xsds/"
-              schema="build/ooxml-xsds/sml-workbook.xsd"
-          -->
+    	<property name="ooxml.xsds.tmp.dir" location="build/ooxml-xsds"/>
+        <mkdir dir="${ooxml.xsds.tmp.dir}"/>
+        <unzip src="${ooxml.lib}/${ooxml.xsds.izip.1}" dest="${ooxml.xsds.tmp.dir}"/>
         <xmlbean
                 schema="${ooxml.xsds.tmp.dir}"
                 srcgendir="${ooxml.xsds.src.dir}"
@@ -528,41 +586,40 @@ under the License.
             <classpath refid="ooxml.classpath"/>
         </xmlbean>
 
-        <!-- Now make a jar of the schema sources -->
-        <jar
+    	<!-- Now make a jar of the schema sources -->
+    	<jar
                 basedir="${ooxml.xsds.src.dir}"
                 destfile="${ooxml.xsds.src.jar}"
                 />
-    </target>
-
-    <target name="compile-ooxml-encryption-xsds" unless="ooxml-compiled-encryption-xsds.present"
-            depends="check-jars,fetch-jars,check-compiled-ooxml-xsds"
-            description="Compiles the OOXML encryption xsd files into XmlBeans">
-        <taskdef name="xmlbean"
-                 classname="org.apache.xmlbeans.impl.tool.XMLBean"
-                 classpath="${ooxml.xmlbeans23.jar}"/>
-
-        <!-- We need a fair amount of memory to compile the xml schema, -->
-        <!--  but limit it in case it goes wrong! -->
-        <!-- Pick the right amount based on 32 vs 64 bit jvm -->
-        <condition property="ooxml.memory" value="768m" else="512m">
-           <equals arg1="${sun.arch.data.model}" arg2="64" />
-        </condition>
 
+		<!-- Now do the same for the encryption and supporting schemas -->
+    	<property name="ooxml.enc.xsds.tmp.dir" location="build/ooxml-encryption-xsds"/>
+        <mkdir dir="${ooxml.enc.xsds.tmp.dir}"/>
+        <unzip src="${ooxml.lib}/${ooxml.xsds.izip.2}" dest="${ooxml.enc.xsds.tmp.dir}"/>
+    	
+    	<copy todir="${ooxml.enc.xsds.tmp.dir}">
+    		<fileset dir="${ooxml.lib}" includes="dc*.xsd,xmldsig*.xsd,XAdES*.xsd"/>
+    		<fileset dir="${ooxml.encryption.xsd.dir}"/>
+    	</copy>
+
+    	<!-- noupa/nopvr is set because of the dublincore schemas -->
+    	<!-- https://issues.apache.org/jira/browse/XMLBEANS-340 -->
+    	<!-- javasource > 1.5 will not generate all array accessor -->
         <xmlbean
-                schema="${ooxml.encryption.xsd.dir}"
+                schema="${ooxml.enc.xsds.tmp.dir}"
                 srcgendir="${ooxml.encryption.src.dir}"
                 optimize="yes"
                 destfile="${ooxml.encryption.jar}"
-                javasource="1.5"
+                javasource="1.5" 
                 failonerror="true"
                 fork="true"
                 memoryMaximumSize="${ooxml.memory}"
+	    		noupa="true"
+	    		nopvr="true"
                 >
             <classpath refid="ooxml.classpath"/>
         </xmlbean>
 
-        <!-- Now make a jar of the schema sources -->
         <jar
                 basedir="${ooxml.encryption.src.dir}"
                 destfile="${ooxml.encryption.src.jar}"
@@ -655,7 +712,7 @@ under the License.
         </copy>
     </target>
 
-    <target name="compile-ooxml" depends="compile-main,compile-scratchpad,compile-ooxml-xsds,compile-ooxml-encryption-xsds">
+    <target name="compile-ooxml" depends="compile-main,compile-scratchpad,compile-ooxml-xsds">
         <javac target="${jdk.version.class}"
                source="${jdk.version.source}"
                destdir="${ooxml.output.dir}"
@@ -676,6 +733,7 @@ under the License.
                includeantruntime="false">
             <classpath>
                 <path refid="ooxml.classpath"/>
+            	<path refid="test.ooxml.classpath"/>
                 <pathelement path="${ooxml.output.dir}"/>
                 <pathelement path="${main.output.test.dir}"/>
             </classpath>
@@ -1354,7 +1412,7 @@ under the License.
 
     <target name="gump" depends="compile-all, test-all, jar"/>
     <target name="jenkins" depends="compile-all, test-all, jar, javadocs, assemble, findbugs,
release-notes, rat-check"/>
-	
+
     <available property="maven.ant.tasks.present" classname="org.apache.maven.artifact.ant.Pom"/>
     <target name="maven.ant.tasks-check">
       <fail unless="maven.ant.tasks.present">
@@ -1450,7 +1508,7 @@ under the License.
 				<exclude name="poi-*${version.id}-sources-*.jar"/>
 			</fileset>
 			<auxClasspath path="ooxml-lib/ooxml-schemas-1.1.jar" />
-			<auxClasspath path="ooxml-lib/ooxml-encryption-1.1.jar" />
+			<auxClasspath path="ooxml-lib/ooxml-encryption-1.2.jar" />
 			<auxClasspath path="ooxml-lib/xmlbeans-2.6.0.jar" />
 			<auxClasspath path="lib/commons-codec-1.9.jar" />
 			<auxClasspath path="lib/commons-logging-1.1.3.jar" />

Propchange: poi/trunk/ooxml-lib/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Sep 30 01:23:17 2014
@@ -1,3 +1,3 @@
 *.jar
-*.xsd
 *.zip
+*.xsd

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java?rev=1628348&r1=1628347&r2=1628348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java Tue Sep 30 01:23:17
2014
@@ -34,6 +34,8 @@ public enum CipherAlgorithm {
     // need bouncycastle provider for this one ...
     // see http://stackoverflow.com/questions/4436397/3des-des-encryption-using-the-jce-generating-an-acceptable-key
     des3_112(null, "DESede", -1, 128, new int[]{128}, 8, 32, "3DES_112", true),
+    // only for digital signatures
+    rsa(null, "RSA", -1, 1024, new int[]{1024, 2048, 3072, 4096}, -1, -1, "", false);
     ;
     
     public final CipherProvider provider;

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java?rev=1628348&r1=1628347&r2=1628348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java Tue Sep 30 01:23:17
2014
@@ -19,6 +19,7 @@ package org.apache.poi.poifs.crypt;
 import java.nio.charset.Charset;
 import java.security.DigestException;
 import java.security.GeneralSecurityException;
+import java.security.Key;
 import java.security.MessageDigest;
 import java.security.Provider;
 import java.security.Security;
@@ -195,7 +196,7 @@ public class CryptoFunctions {
      * @throws EncryptedDocumentException if the initialization failed or if an algorithm
was specified,
      *   which depends on a missing bouncy castle provider 
      */
-    public static Cipher getCipher(SecretKey key, CipherAlgorithm cipherAlgorithm, ChainingMode
chain, byte[] vec, int cipherMode, String padding) {
+    public static Cipher getCipher(Key key, CipherAlgorithm cipherAlgorithm, ChainingMode
chain, byte[] vec, int cipherMode, String padding) {
         int keySizeInBytes = key.getEncoded().length;
         if (padding == null) padding = "NoPadding";
         
@@ -296,10 +297,12 @@ public class CryptoFunctions {
     }
 
     @SuppressWarnings("unchecked")
-    private static void registerBouncyCastle() {
+    public static void registerBouncyCastle() {
         if (Security.getProvider("BC") != null) return;
         try {
-            Class<Provider> clazz = (Class<Provider>)Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            String bcProviderName = "org.bouncycastle.jce.provider.BouncyCastleProvider";
+            Class<Provider> clazz = (Class<Provider>)cl.loadClass(bcProviderName);
             Security.addProvider(clazz.newInstance());
         } catch (Exception e) {
             throw new EncryptedDocumentException("Only the BouncyCastle provider supports
your encryption settings - please add it to the classpath.");

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java?rev=1628348&r1=1628347&r2=1628348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java Tue Sep 30 01:23:17 2014
@@ -33,6 +33,8 @@ public enum HashAlgorithm {
     ripemd128("RipeMD128",     -1, "RIPEMD-128", 16, "HMac-RipeMD128", true),
     ripemd160("RipeMD160",     -1, "RIPEMD-160", 20, "HMac-RipeMD160", true),
     whirlpool("Whirlpool",     -1,  "WHIRLPOOL", 64, "HMac-Whirlpool", true),
+    // only for xml signing
+    sha224   (  "SHA-224",     -1,     "SHA224", 28,     "HmacSHA224", true);
     ;
 
     public final String jceId;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java?rev=1628348&r1=1628347&r2=1628348&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java Tue Sep
30 01:23:17 2014
@@ -182,8 +182,6 @@ public final class PackageRelationship {
 	}
 
 	/**
-	 * public URI getSourceUri(){ }
-	 *
 	 * @return the targetMode
 	 */
 	public TargetMode getTargetMode() {

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java?rev=1628348&r1=1628347&r2=1628348&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
Tue Sep 30 01:23:17 2014
@@ -307,7 +307,7 @@ public final class PackageRelationshipCo
      * @throws InvalidFormatException
      *             Throws if the relationship part is invalid.
      */
-    private void parseRelationshipsPart(PackagePart relPart)
+    public void parseRelationshipsPart(PackagePart relPart)
             throws InvalidFormatException {
         try {
             logger.log(POILogger.DEBUG, "Parsing relationship: " + relPart.getPartName());

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java?rev=1628348&r1=1628347&r2=1628348&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
Tue Sep 30 01:23:17 2014
@@ -145,11 +145,10 @@ public abstract class ContentTypeManager
 	 * </p>
 	 */
 	public void addContentType(PackagePartName partName, String contentType) {
-		boolean defaultCTExists = false;
+		boolean defaultCTExists = this.defaultContentType.containsValue(contentType);
 		String extension = partName.getExtension().toLowerCase();
 		if ((extension.length() == 0)
-				|| (this.defaultContentType.containsKey(extension) && !(defaultCTExists = this.defaultContentType
-						.containsValue(contentType))))
+				|| (this.defaultContentType.containsKey(extension) && !defaultCTExists))
 			this.addOverrideContentType(partName, contentType);
 		else if (!defaultCTExists)
 			this.addDefaultContentType(extension, contentType);
@@ -452,7 +451,7 @@ public abstract class ContentTypeManager
 	}
 
 	/**
-	 * Use to append default types XML elements, use by the save() metid.
+	 * Use to append default types XML elements, use by the save() method.
 	 *
 	 * @param root
 	 *            XML parent element use to append this default type element.

Modified: poi/trunk/src/testcases/org/apache/poi/POIDataSamples.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/POIDataSamples.java?rev=1628348&r1=1628347&r2=1628348&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/POIDataSamples.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/POIDataSamples.java Tue Sep 30 01:23:17 2014
@@ -44,6 +44,7 @@ public final class POIDataSamples {
     private static POIDataSamples _instHPSF;
     private static POIDataSamples _instHPBF;
     private static POIDataSamples _instHSMF;
+    private static POIDataSamples _instXmlDSign;
 
     private File _resolvedDataDir;
     /** <code>true</code> if standard system propery is not set,
@@ -114,6 +115,12 @@ public final class POIDataSamples {
         if(_instHSMF == null) _instHSMF = new POIDataSamples("hsmf");
         return _instHSMF;
     }
+
+    public static POIDataSamples getXmlDSignInstance(){
+        if(_instXmlDSign == null) _instXmlDSign = new POIDataSamples("xmldsign");
+        return _instXmlDSign;
+    }
+    
     /**
      * Opens a sample file from the test data directory
      *



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message