LIBRARY LOCATION
======= ========
- junit(3.8+) http://www.junit.org
+ junit(4.11+) http://www.junit.org
To build the documentation you will need to install forrest and set
the FORREST_HOME environment variable. Forrest 0.5.1 required.
<pathelement location="${main.output.dir}"/>
<pathelement location="${scratchpad.output.dir}"/>
<pathelement location="${ooxml.encryption.jar}"/>
- <path refid="ooxml.xmlsec.classpath"/>
+ <!-- classes are omitted on test cases outside the xml-dsign area to avoid classpath poisioning -->
+ <!--path refid="ooxml.xmlsec.classpath"/-->
</path>
<path id="test.classpath">
encoding="${java.source.encoding}"
fork="yes"
includeantruntime="false">
- <classpath refid="ooxml.classpath"/>
+ <classpath>
+ <path refid="ooxml.classpath"/>
+ <path refid="ooxml.xmlsec.classpath"/>
+ </classpath>
</javac>
<javac target="${jdk.version.class}"
source="${jdk.version.source}"
includeantruntime="false">
<classpath>
<path refid="ooxml.classpath"/>
+ <path refid="ooxml.xmlsec.classpath"/>
<path refid="test.ooxml.classpath"/>
<pathelement path="${ooxml.output.dir}"/>
<pathelement path="${main.output.test.dir}"/>
<include name="**/${testpattern}.java"/>
<exclude name="**/TestUnfixedBugs.java"/>
<exclude name="**/All*Tests.java"/>
+ <exclude name="**/TestSignatureInfo.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </jacoco:coverage>
+ <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-@{type}-xmlsec.exec">
+ <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
+ failureproperty="ooxml.xmlsec.test.failed">
+ <classpath>
+ <path refid="@{classpath}"/>
+ <path refid="ooxml.xmlsec.classpath"/>
+ </classpath>
+ <syspropertyset refid="junit.properties"/>
+ <jvmarg value="${poi.test.locale}"/>
+ <jvmarg value="-ea"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <batchtest todir="${ooxml.reports.test}">
+ <fileset dir="${ooxml.src.test}">
+ <include name="**/TestSignatureInfo.java"/>
</fileset>
</batchtest>
</junit>
huc.setRequestProperty("Authorization", "Basic " + encoding);\r
}\r
\r
+ huc.setRequestMethod("POST");\r
+ huc.setConnectTimeout(20000);\r
+ huc.setReadTimeout(20000);\r
huc.setDoOutput(true); // also sets method to POST.\r
huc.setRequestProperty("User-Agent", signatureConfig.getUserAgent());\r
huc.setRequestProperty("Content-Type", signatureConfig.isTspOldProtocol()\r
? "application/timestamp-request"\r
- : "application/timestamp-query;charset=ISO-8859-1");\r
+ : "application/timestamp-query"); // "; charset=ISO-8859-1");\r
\r
OutputStream hucOut = huc.getOutputStream();\r
hucOut.write(encodedRequest);\r
================================================================= */ \r
package org.apache.poi.poifs.crypt;\r
\r
-import static org.junit.Assert.*;\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertFalse;\r
+import static org.junit.Assert.assertNotNull;\r
+import static org.junit.Assert.assertTrue;\r
\r
import java.io.File;\r
import java.io.FileInputStream;\r
import java.io.InputStream;\r
import java.lang.reflect.Method;\r
import java.net.ConnectException;\r
-import java.net.URL;\r
-import java.net.URLClassLoader;\r
import java.security.Key;\r
import java.security.KeyPair;\r
import java.security.KeyStore;\r
private KeyPair keyPair = null;\r
private X509Certificate x509 = null;\r
\r
-\r
- \r
@BeforeClass\r
public static void initBouncy() throws IOException {\r
- File bcProvJar = new File("lib/bcprov-ext-jdk15on-1.51.jar");\r
- File bcPkixJar = new File("lib/bcpkix-jdk15on-151.jar");\r
- ClassLoader cl = Thread.currentThread().getContextClassLoader();\r
- URLClassLoader ucl = new URLClassLoader(new URL[]{bcProvJar.toURI().toURL(),bcPkixJar.toURI().toURL()}, cl);\r
- try {\r
- Thread.currentThread().setContextClassLoader(ucl);\r
- CryptoFunctions.registerBouncyCastle();\r
- \r
- /*** TODO : set cal to now ... only set to fixed date for debugging ... */ \r
- cal = Calendar.getInstance();\r
- cal.clear();\r
- cal.setTimeZone(TimeZone.getTimeZone("UTC"));\r
- cal.set(2014, 7, 6, 21, 42, 12);\r
- } finally {\r
- ucl.close();\r
- }\r
- }\r
+ CryptoFunctions.registerBouncyCastle();\r
\r
+ /*** TODO : set cal to now ... only set to fixed date for debugging ... */ \r
+ cal = Calendar.getInstance();\r
+ cal.clear();\r
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));\r
+ cal.set(2014, 7, 6, 21, 42, 12);\r
+ }\r
+ \r
@Test\r
public void getSignerUnsigned() throws Exception {\r
String testFiles[] = { \r
boolean mockTsp = false;\r
// http://timestamping.edelweb.fr/service/tsp\r
// http://tsa.belgium.be/connect\r
- signatureConfig.setTspUrl("http://timestamping.edelweb.fr/service/tsp");\r
- signatureConfig.setTspOldProtocol(true);\r
+ // http://timestamp.comodoca.com/authenticode\r
+ // http://timestamp.comodoca.com/rfc3161\r
+ // http://services.globaltrustfinder.com/adss/tsa\r
+ signatureConfig.setTspUrl("http://timestamp.comodoca.com/rfc3161");\r
+ signatureConfig.setTspRequestPolicy(null); // comodoca request fails, if default policy is set ...\r
+ signatureConfig.setTspOldProtocol(false);\r
\r
if (mockTsp) {\r
TimeStampService tspService = new TimeStampService(){\r