/* ====================================================================
This product contains an ASLv2 licensed version of the OOXML signer
package from the eID Applet project
- http://code.google.com/p/eid-applet/source/browse/trunk/README.txt
+ http://code.google.com/p/eid-applet/source/browse/trunk/README.txt
Copyright (C) 2008-2014 FedICT.
- ================================================================= */
+ ================================================================= */
package org.apache.poi.poifs.crypt.dsig;
private static final POILogger LOG = POILogFactory.getLogger(KeyInfoKeySelector.class);
- private List<X509Certificate> certChain = new ArrayList<>();
+ private final List<X509Certificate> certChain = new ArrayList<>();
@SuppressWarnings("unchecked")
@Override
/**
* Gives back the X509 certificate used during the last signature
* verification operation.
- *
+ *
* @return the certificate which was used to sign the xml content
*/
public X509Certificate getSigner() {
// The first certificate is presumably the signer.
return certChain.isEmpty() ? null : certChain.get(0);
}
-
+
public List<X509Certificate> getCertChain() {
return certChain;
}
@Test
public void testCertChain() throws Exception {
+ final boolean isIBM = System.getProperty("java.vendor").contains("IBM");
+
KeyStore keystore = KeyStore.getInstance("PKCS12");
String password = "test";
try (InputStream is = testdata.openResourceAsStream("chaintest.pfx")) {
X509Certificate signer = sp.getSigner();
assertNotNull("signer undefined?!", signer);
List<X509Certificate> certChainRes = sp.getCertChain();
- assertEquals(3, certChainRes.size());
+
+ // IBM JDK is still buggy, even after fix for APAR IJ21985
+ int exp = isIBM ? 1 : 3;
+ assertEquals(exp, certChainRes.size());
}
}