import java.io.IOException;\r
import java.io.InputStream;\r
import java.io.OutputStream;\r
-import java.net.ConnectException;\r
-import java.net.HttpURLConnection;\r
-import java.net.MalformedURLException;\r
-import java.net.URL;\r
+import java.net.*;\r
import java.security.Key;\r
import java.security.KeyPair;\r
import java.security.KeyStore;\r
import org.bouncycastle.asn1.x509.KeyUsage;\r
import org.bouncycastle.cert.ocsp.OCSPResp;\r
import org.etsi.uri.x01903.v13.DigestAlgAndValueType;\r
-import org.etsi.uri.x01903.v13.QualifyingPropertiesType;
-import org.junit.Assume;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.w3.x2000.x09.xmldsig.ReferenceType;
-import org.w3.x2000.x09.xmldsig.SignatureDocument;
+import org.etsi.uri.x01903.v13.QualifyingPropertiesType;\r
+import org.junit.Assume;\r
+import org.junit.BeforeClass;\r
+import org.junit.Ignore;\r
+import org.junit.Test;\r
+import org.w3.x2000.x09.xmldsig.ReferenceType;\r
+import org.w3.x2000.x09.xmldsig.SignatureDocument;\r
import org.w3c.dom.Document;\r
\r
public class TestSignatureInfo {\r
\r
/*** TODO : set cal to now ... only set to fixed date for debugging ... */ \r
cal = LocaleUtil.getLocaleCalendar(LocaleUtil.TIMEZONE_UTC);\r
+ assertNotNull(cal);\r
// cal.set(2014, 7, 6, 21, 42, 12);\r
// cal.clear(Calendar.MILLISECOND);\r
\r
if(e.getCause() == null) {\r
throw e;\r
}\r
- if(!(e.getCause() instanceof ConnectException)) {\r
+ if(!(e.getCause() instanceof ConnectException) && !(e.getCause() instanceof SocketTimeoutException)) {\r
throw e;\r
}\r
- assertTrue("Only allowing ConnectException with 'timed out' as message here, but had: " + e, e.getCause().getMessage().contains("timed out"));\r
+ assertTrue("Only allowing ConnectException with 'timed out' as message here, but had: " + e,\r
+ e.getCause().getMessage().contains("timed out"));\r
}\r
\r
// verify\r
si.confirmSignature();\r
assertTrue("invalid signature", si.verifySignature());\r
\r
- pkg.close();
- }
-
- @Test
- @Ignore
- public void testMultiSign() throws Exception {
- initKeyPair("KeyA", "CN=KeyA");
- KeyPair keyPairA = keyPair;
- X509Certificate x509A = x509;
- initKeyPair("KeyB", "CN=KeyB");
- KeyPair keyPairB = keyPair;
- X509Certificate x509B = x509;
-
- File tpl = copy(testdata.getFile("bug58630.xlsx"));
- OPCPackage pkg = OPCPackage.open(tpl);
- SignatureConfig signatureConfig = new SignatureConfig();
-
-
- }
-
- private void sign(OPCPackage pkgCopy, String alias, String signerDn, int signerCount) throws Exception {
- initKeyPair(alias, signerDn);
+ pkg.close();\r
+ }\r
+ \r
+ @Test\r
+ @Ignore\r
+ public void testMultiSign() throws Exception {\r
+ initKeyPair("KeyA", "CN=KeyA");\r
+ //KeyPair keyPairA = keyPair;\r
+ //X509Certificate x509A = x509;\r
+ initKeyPair("KeyB", "CN=KeyB");\r
+ //KeyPair keyPairB = keyPair;\r
+ //X509Certificate x509B = x509;\r
+ \r
+ File tpl = copy(testdata.getFile("bug58630.xlsx"));\r
+ OPCPackage pkg = OPCPackage.open(tpl);\r
+ try {\r
+ //SignatureConfig signatureConfig = new SignatureConfig();\r
+ assertNotNull(pkg);\r
+ } finally {\r
+ pkg.close();\r
+ }\r
+ }\r
+ \r
+ private void sign(OPCPackage pkgCopy, String alias, String signerDn, int signerCount) throws Exception {\r
+ initKeyPair(alias, signerDn);\r
\r
SignatureConfig signatureConfig = new SignatureConfig();\r
signatureConfig.setKey(keyPair.getPrivate());\r