diff options
| author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2025-08-06 12:06:46 +0200 |
|---|---|---|
| committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2025-08-06 12:06:46 +0200 |
| commit | 52075630df265b3a867801b58d8f80170d0dcdd0 (patch) | |
| tree | 76550b4f237162c326cea8ef35cde5612db9df1c /moaSig/moa-sig/src | |
| parent | 773535ab90950460f468d2edfc5be396f2776d25 (diff) | |
| download | moa-sig-52075630df265b3a867801b58d8f80170d0dcdd0.tar.gz moa-sig-52075630df265b3a867801b58d8f80170d0dcdd0.tar.bz2 moa-sig-52075630df265b3a867801b58d8f80170d0dcdd0.zip | |
chore(core): update IAIK libs and clean-up old
Diffstat (limited to 'moaSig/moa-sig/src')
| -rw-r--r-- | moaSig/moa-sig/src/test/java/at/gv/egovernment/moa/spss/test/integration/PadesIntegrationTest.java | 80 |
1 files changed, 38 insertions, 42 deletions
diff --git a/moaSig/moa-sig/src/test/java/at/gv/egovernment/moa/spss/test/integration/PadesIntegrationTest.java b/moaSig/moa-sig/src/test/java/at/gv/egovernment/moa/spss/test/integration/PadesIntegrationTest.java index 9cee722..0c7bb63 100644 --- a/moaSig/moa-sig/src/test/java/at/gv/egovernment/moa/spss/test/integration/PadesIntegrationTest.java +++ b/moaSig/moa-sig/src/test/java/at/gv/egovernment/moa/spss/test/integration/PadesIntegrationTest.java @@ -9,9 +9,6 @@ import static org.junit.Assert.assertTrue; import java.io.FileInputStream; import java.io.IOException; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.util.Base64; import java.util.Date; import org.apache.commons.io.IOUtils; @@ -31,19 +28,14 @@ import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElemen import at.gv.egovernment.moa.spss.api.xmlverify.AdESFormResults; import at.gv.egovernment.moa.spss.server.config.ConfigurationException; import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; -import at.gv.egovernment.moa.spss.server.iaik.cmsverify.PDFSignatureVerificationProfileImpl; import at.gv.egovernment.moa.spss.server.iaik.pki.PKIProfileImpl; import at.gv.egovernment.moa.spss.server.init.SystemInitializer; import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; import at.gv.egovernment.moa.spss.server.logging.TransactionId; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; +import at.gv.egovernment.moa.spss.test.integration.utils.CertificateReader; import iaik.pki.PKIFactory; import iaik.pki.PKIModule; -import iaik.pki.PKIResult; -import iaik.server.cmspdfverify.CMSVerifyUtils; import iaik.x509.X509Certificate; -import at.gv.egovernment.moa.spss.test.integration.utils.CertificateReader; @RunWith(BlockJUnit4ClassRunner.class) public class PadesIntegrationTest extends AbstractIntegrationTest { @@ -51,16 +43,16 @@ public class PadesIntegrationTest extends AbstractIntegrationTest { CMSSignatureVerificationInvoker cadesInvoker; @BeforeClass - public static void classInitializer() throws IOException, ConfigurationException, + public static void classInitializer() throws IOException, ConfigurationException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { jvmStateReset(); - + final String current = new java.io.File(".").getCanonicalPath(); System.setProperty("moa.spss.server.configuration", current + "/src/test/resources/moaspss_config/MOASPSSConfiguration.xml"); System.setProperty("iaik.esi.sva.configuration.location", current + "/src/test/resources/moaspss_config/svaconfig.example"); - + moaSpssCore = SystemInitializer.init(); } @@ -162,7 +154,7 @@ public class PadesIntegrationTest extends AbstractIntegrationTest { assertNotNull("extended val. result", cmsResult.getExtendedCertificateCheck()); assertEquals("ext. val major", 1, cmsResult.getExtendedCertificateCheck().getMajorCode()); - + // because was signed by using SHA1 after xxxx assertEquals("ext. val major", 2, cmsResult.getExtendedCertificateCheck().getMinorCode()); @@ -170,9 +162,9 @@ public class PadesIntegrationTest extends AbstractIntegrationTest { assertEquals("used sig alg", "SHA1withRSA", cmsResult.getSignatureAlgorithm()); } - - - + + + @Ignore @Test public void padesLteTest() throws MOAException, IOException { @@ -188,10 +180,10 @@ public class PadesIntegrationTest extends AbstractIntegrationTest { // verify result assertNotNull("verification result", result); - + } - + @Test public void padesAmtssignatur() throws MOAException, IOException { final VerifyCMSSignatureRequest request = buildVerfifyCmsRequest( @@ -203,7 +195,7 @@ public class PadesIntegrationTest extends AbstractIntegrationTest { // perform test final VerifyCMSSignatureResponse result = cadesInvoker.verifyCMSSignature(request); - + // verify result assertNotNull("verification result", result); @@ -211,21 +203,21 @@ public class PadesIntegrationTest extends AbstractIntegrationTest { .getResponseElements().get(0); assertEquals("sigCode", 0, cmsResult.getSignatureCheck().getCode()); assertEquals("certCode", 0, cmsResult.getCertificateCheck().getCode()); - + assertTrue("Amtssignatur", cmsResult.getSignerInfo().isPublicAuthority()); assertEquals("Amtssignatur", "L4AL", cmsResult.getSignerInfo().getPublicAuhtorityID()); - + assertFalse("QC", cmsResult.getSignerInfo().isQualifiedCertificate()); assertFalse("SSCD", cmsResult.getSignerInfo().isSSCD()); - + assertEquals("CountryCode", "AT", cmsResult.getSignerInfo().getIssuerCountryCode()); - + assertNotNull("extended val. result", cmsResult.getExtendedCertificateCheck()); assertEquals("ext. val major", 2, cmsResult.getExtendedCertificateCheck().getMajorCode()); - - // it's no valid CAdES signature because it does not include SignatureCertificateInfo extension + + // it's no valid CAdES signature because it does not include SignatureCertificateInfo extension assertEquals("ext. val major", 13, cmsResult.getExtendedCertificateCheck().getMinorCode()); - + assertNotNull("form val. result", cmsResult.getAdESFormResults()); assertEquals("form val. result size", 4, cmsResult.getAdESFormResults().size()); @@ -234,9 +226,9 @@ public class PadesIntegrationTest extends AbstractIntegrationTest { assertEquals("Find wrong form val status", 2, ((AdESFormResults) el).getCode().longValue()); } - + } - + @Ignore @Test public void padesOwnTest() throws Exception { @@ -257,26 +249,30 @@ public class PadesIntegrationTest extends AbstractIntegrationTest { assertEquals("sigCode", 0, cmsResult.getSignatureCheck().getCode()); assertEquals("certCode", 0, cmsResult.getCertificateCheck().getCode()); assertEquals("Amtssignatur", "", cmsResult.getSignerInfo().getPublicAuhtorityID()); - + } - + @Ignore @Test public void pkixTest() throws Exception { - final String current = new java.io.File(".").getCanonicalPath(); - X509Certificate[] chain = CertificateReader.readCertificatesIntoArray(current + "/src/test/resources/testdata/pkix/chain/"); - + final String current = new java.io.File(".").getCanonicalPath(); + X509Certificate[] chain = CertificateReader.readCertificatesIntoArray(current + "/src/test/resources/testdata/pkix/chain/"); + PKIModule pkiModule = PKIFactory.getInstance().getPKIModule( new PKIProfileImpl(ConfigurationProvider.getInstance(), "MOAIDBuergerkarteAuthentisierungsDaten")); - PKIResult pkiResult = pkiModule.validateCertificate( - new Date(), - (X509Certificate) chain[0], - (X509Certificate[]) ArrayUtils.subarray(chain, 1, chain.length), - (boolean[])null, - new TransactionId("aabbccdd")); - + + //KeyUsageParams keyUsage = new KeyUsageParams(); + //keyUsage.addParam(new KeyUsageParam((boolean[]) null, KeyUsageParam.STRICT)); + + pkiModule.validateCertificate( + new Date(), + chain[0], + ArrayUtils.subarray(chain, 1, chain.length), + (boolean[]) null, + new TransactionId("aabbccdd")); + System.out.print("Finished"); - + } - + } |
