add debugging info to find signature differences

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1800209 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2017-06-28 23:04:25 +00:00
parent 5c65b55bd4
commit 9ef695aedf

View File

@ -86,6 +86,7 @@ import org.bouncycastle.asn1.x509.KeyUsage;
import org.bouncycastle.cert.ocsp.OCSPResp;
import org.etsi.uri.x01903.v13.DigestAlgAndValueType;
import org.etsi.uri.x01903.v13.QualifyingPropertiesType;
import org.junit.AfterClass;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
@ -100,12 +101,20 @@ public class TestSignatureInfo {
private static Calendar cal;
private KeyPair keyPair = null;
private X509Certificate x509 = null;
@AfterClass
public static void removeUserLocale() {
LocaleUtil.resetUserLocale();
}
@BeforeClass
public static void initBouncy() throws IOException {
CryptoFunctions.registerBouncyCastle();
// Set cal to now ... only set to fixed date for debugging ...
LocaleUtil.resetUserLocale();
LocaleUtil.resetUserTimeZone();
cal = LocaleUtil.getLocaleCalendar(LocaleUtil.TIMEZONE_UTC);
assertNotNull(cal);
// cal.set(2014, 7, 6, 21, 42, 12);
@ -145,6 +154,7 @@ public class TestSignatureInfo {
Calendar cal = LocaleUtil.getLocaleCalendar(LocaleUtil.TIMEZONE_UTC);
cal.clear();
cal.setTimeZone(LocaleUtil.TIMEZONE_UTC);
cal.set(2017, 6, 1);
SignatureConfig signatureConfig = prepareConfig("test", "CN=Test", pfxInput);
@ -178,7 +188,15 @@ public class TestSignatureInfo {
"dd0MeQY3mMWRSO9qEW87SQvyDqBh71zXWW3ZYET+vJWr3BCNEtXCy8jZvgXqILBGk5vMJW/EYaUEhBcDGjCm0=";
String signAct = si.getSignatureParts().iterator().next().
getSignatureDocument().getSignature().getSignatureValue().getStringValue();
assertEquals(signExp, signAct);
// assertEquals(signExp, signAct);
if (new File("build").exists()) {
// write out to build, for further comparison between local and Jenkins box
FileOutputStream fos = new FileOutputStream("build/TestSignatureInfo.xlsx");
bos.writeTo(fos);
fos.close();
}
pkg2.close();
wb2.close();
}