mirror of https://github.com/apache/poi.git
Fix deprecate warnings on X509 api calls
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
474576677b
commit
007a6f6160
|
@ -214,7 +214,7 @@ public class XAdESXLSignatureFacet implements SignatureFacet {
|
|||
}
|
||||
|
||||
CRLIdentifierType crlIdentifier = crlRef.addNewCRLIdentifier();
|
||||
String issuerName = crl.getIssuerDN().getName().replace(",", ", ");
|
||||
String issuerName = crl.getIssuerX500Principal().getName().replace(",", ", ");
|
||||
crlIdentifier.setIssuer(issuerName);
|
||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Z"), Locale.ROOT);
|
||||
cal.setTime(crl.getThisUpdate());
|
||||
|
|
|
@ -172,7 +172,7 @@ public class DummyKeystore {
|
|||
throw new IOException("Please add private key and certificate in the PEM file.");
|
||||
}
|
||||
|
||||
String alias = x509.getSubjectDN().getName();
|
||||
String alias = x509.getSubjectX500Principal().getName();
|
||||
keystore.setKeyEntry(alias, key, keyPass.toCharArray(), new Certificate[]{x509});
|
||||
|
||||
return new KeyCertPair(key, new Certificate[]{x509});
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
================================================================= */
|
||||
package org.apache.poi.poifs.crypt.dsig;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
@ -52,6 +53,7 @@ import java.util.List;
|
|||
import java.util.function.BiFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import javax.xml.crypto.MarshalException;
|
||||
import javax.xml.crypto.dsig.CanonicalizationMethod;
|
||||
import javax.xml.crypto.dsig.XMLSignatureException;
|
||||
|
@ -807,14 +809,9 @@ class TestSignatureInfo {
|
|||
|
||||
assertNotNull(result);
|
||||
|
||||
if (multi) {
|
||||
assertEquals(2, result.size());
|
||||
assertEquals("CN=Muj Klic", result.get(0).getSubjectDN().toString());
|
||||
assertEquals("CN=My Second key", result.get(1).getSubjectDN().toString());
|
||||
} else {
|
||||
assertEquals(1, result.size());
|
||||
assertEquals("CN=My Second key", result.get(0).getSubjectDN().toString());
|
||||
}
|
||||
String[] act = result.stream().map(X509Certificate::getSubjectX500Principal).map(X500Principal::getName).toArray(String[]::new);
|
||||
String[] exp = multi ? new String[]{ "CN=Muj Klic", "CN=My Second key" } : new String[]{ "CN=My Second key" };
|
||||
assertArrayEquals(exp, act);
|
||||
|
||||
assertTrue(si.verifySignature());
|
||||
pkg.revert();
|
||||
|
@ -859,7 +856,7 @@ class TestSignatureInfo {
|
|||
|
||||
final List<X509Certificate> certs = sic.getSigningCertificateChain();
|
||||
assertEquals(1, certs.size());
|
||||
assertEquals("CN=Test", certs.get(0).getSubjectDN().getName());
|
||||
assertEquals("CN=Test", certs.get(0).getSubjectX500Principal().getName());
|
||||
assertEquals("SuperDuper-Reviewer", sic.getXadesRole());
|
||||
assertEquals("Purpose for signing", sic.getSignatureDescription());
|
||||
assertEquals("2018-06-10T09:00:54Z", sic.formatExecutionTime());
|
||||
|
|
Loading…
Reference in New Issue