From a020e34129ea9c4c6942345bdc66956235278786 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d> Date: Wed, 30 Nov 2005 15:23:57 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'Build_ID-1_3_0'. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/Build_ID-1_3_0@598 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../commons-discovery-0.2/commons-discovery.jar | Bin 71442 -> 0 bytes .../commons-logging-1.0.2/commons-logging-api.jar | Bin 18404 -> 0 bytes .../lib/commons-logging-1.0.2/commons-logging.jar | Bin 26388 -> 0 bytes .../lib/iaik-moa-20051107/iaik_Pkcs11Provider.jar | Bin 300017 -> 0 bytes .../lib/iaik-moa-20051107/iaik_Pkcs11Wrapper.jar | Bin 257497 -> 0 bytes .../clients/api/lib/iaik-moa-20051107/iaik_cms.jar | Bin 285185 -> 0 bytes .../clients/api/lib/iaik-moa-20051107/iaik_ecc.jar | Bin 85648 -> 0 bytes .../api/lib/iaik-moa-20051107/iaik_ixsil.jar | Bin 197591 -> 0 bytes .../api/lib/iaik-moa-20051107/iaik_jce_full.jar | Bin 709964 -> 0 bytes .../api/lib/iaik-moa-20051107/iaik_moa_full.jar | Bin 689512 -> 0 bytes .../signed/iaik_Pkcs11Provider.jar | Bin 315242 -> 0 bytes .../api/lib/iaik-moa-20051107/signed/iaik_ecc.jar | Bin 92898 -> 0 bytes .../lib/iaik-moa-20051107/signed/iaik_jce_full.jar | Bin 713956 -> 0 bytes .../lib/iaik-moa-20051107/win32/pkcs11wrapper.dll | Bin 94208 -> 0 bytes .../clients/api/lib/jaxen-1.0/jaxen-core.jar | Bin 160967 -> 0 bytes .../clients/api/lib/jaxen-1.0/jaxen-dom.jar | Bin 13707 -> 0 bytes .../clients/api/lib/jaxen-1.0/saxpath.jar | Bin 23563 -> 0 bytes spss.handbook/clients/api/lib/jaxp-1.2_01/dom.jar | Bin 26710 -> 0 bytes .../clients/api/lib/jaxp-1.2_01/jaxp-api.jar | Bin 27052 -> 0 bytes spss.handbook/clients/api/lib/jaxp-1.2_01/sax.jar | Bin 26206 -> 0 bytes .../clients/api/lib/log4j-1.2.7/log4j-1.2.7.jar | Bin 350677 -> 0 bytes .../api/lib/postgres-jdbc2-7.3/pg73jdbc2.jar | Bin 163980 -> 0 bytes .../clients/api/lib/xalan-j-2.5.1/xalan.jar | Bin 2907319 -> 0 bytes .../clients/api/signatures/SimpleSignature.xml | 23 ---- .../handbook/clients/api/CreateXMLSignature.java | 130 ------------------ .../handbook/clients/api/VerifyXMLSignature.java | 147 --------------------- 26 files changed, 300 deletions(-) delete mode 100644 spss.handbook/clients/api/lib/commons-discovery-0.2/commons-discovery.jar delete mode 100644 spss.handbook/clients/api/lib/commons-logging-1.0.2/commons-logging-api.jar delete mode 100644 spss.handbook/clients/api/lib/commons-logging-1.0.2/commons-logging.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_Pkcs11Provider.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_Pkcs11Wrapper.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_cms.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_ecc.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_ixsil.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_jce_full.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_moa_full.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_Pkcs11Provider.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_ecc.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_jce_full.jar delete mode 100644 spss.handbook/clients/api/lib/iaik-moa-20051107/win32/pkcs11wrapper.dll delete mode 100644 spss.handbook/clients/api/lib/jaxen-1.0/jaxen-core.jar delete mode 100644 spss.handbook/clients/api/lib/jaxen-1.0/jaxen-dom.jar delete mode 100644 spss.handbook/clients/api/lib/jaxen-1.0/saxpath.jar delete mode 100644 spss.handbook/clients/api/lib/jaxp-1.2_01/dom.jar delete mode 100644 spss.handbook/clients/api/lib/jaxp-1.2_01/jaxp-api.jar delete mode 100644 spss.handbook/clients/api/lib/jaxp-1.2_01/sax.jar delete mode 100644 spss.handbook/clients/api/lib/log4j-1.2.7/log4j-1.2.7.jar delete mode 100644 spss.handbook/clients/api/lib/postgres-jdbc2-7.3/pg73jdbc2.jar delete mode 100644 spss.handbook/clients/api/lib/xalan-j-2.5.1/xalan.jar delete mode 100644 spss.handbook/clients/api/signatures/SimpleSignature.xml delete mode 100644 spss.handbook/clients/api/src/at/gv/egovernment/moa/spss/handbook/clients/api/CreateXMLSignature.java delete mode 100644 spss.handbook/clients/api/src/at/gv/egovernment/moa/spss/handbook/clients/api/VerifyXMLSignature.java (limited to 'spss.handbook/clients/api') diff --git a/spss.handbook/clients/api/lib/commons-discovery-0.2/commons-discovery.jar b/spss.handbook/clients/api/lib/commons-discovery-0.2/commons-discovery.jar deleted file mode 100644 index b88554847..000000000 Binary files a/spss.handbook/clients/api/lib/commons-discovery-0.2/commons-discovery.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/commons-logging-1.0.2/commons-logging-api.jar b/spss.handbook/clients/api/lib/commons-logging-1.0.2/commons-logging-api.jar deleted file mode 100644 index d6ad90330..000000000 Binary files a/spss.handbook/clients/api/lib/commons-logging-1.0.2/commons-logging-api.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/commons-logging-1.0.2/commons-logging.jar b/spss.handbook/clients/api/lib/commons-logging-1.0.2/commons-logging.jar deleted file mode 100644 index aca1e4132..000000000 Binary files a/spss.handbook/clients/api/lib/commons-logging-1.0.2/commons-logging.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_Pkcs11Provider.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_Pkcs11Provider.jar deleted file mode 100644 index b317a39dd..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_Pkcs11Provider.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_Pkcs11Wrapper.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_Pkcs11Wrapper.jar deleted file mode 100644 index 0ee74172b..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_Pkcs11Wrapper.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_cms.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_cms.jar deleted file mode 100644 index 7264a68f3..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_cms.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_ecc.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_ecc.jar deleted file mode 100644 index d927d52e7..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_ecc.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_ixsil.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_ixsil.jar deleted file mode 100644 index 0f1027c15..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_ixsil.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_jce_full.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_jce_full.jar deleted file mode 100644 index fb5c5a9f4..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_jce_full.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_moa_full.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_moa_full.jar deleted file mode 100644 index e6117d5e7..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/iaik_moa_full.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_Pkcs11Provider.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_Pkcs11Provider.jar deleted file mode 100644 index 20ccd0d2d..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_Pkcs11Provider.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_ecc.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_ecc.jar deleted file mode 100644 index 3dd52d3dd..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_ecc.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_jce_full.jar b/spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_jce_full.jar deleted file mode 100644 index e98886c44..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/signed/iaik_jce_full.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/iaik-moa-20051107/win32/pkcs11wrapper.dll b/spss.handbook/clients/api/lib/iaik-moa-20051107/win32/pkcs11wrapper.dll deleted file mode 100644 index da6bcf963..000000000 Binary files a/spss.handbook/clients/api/lib/iaik-moa-20051107/win32/pkcs11wrapper.dll and /dev/null differ diff --git a/spss.handbook/clients/api/lib/jaxen-1.0/jaxen-core.jar b/spss.handbook/clients/api/lib/jaxen-1.0/jaxen-core.jar deleted file mode 100644 index e52bf679c..000000000 Binary files a/spss.handbook/clients/api/lib/jaxen-1.0/jaxen-core.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/jaxen-1.0/jaxen-dom.jar b/spss.handbook/clients/api/lib/jaxen-1.0/jaxen-dom.jar deleted file mode 100644 index 1a9926357..000000000 Binary files a/spss.handbook/clients/api/lib/jaxen-1.0/jaxen-dom.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/jaxen-1.0/saxpath.jar b/spss.handbook/clients/api/lib/jaxen-1.0/saxpath.jar deleted file mode 100644 index 2b43955ba..000000000 Binary files a/spss.handbook/clients/api/lib/jaxen-1.0/saxpath.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/jaxp-1.2_01/dom.jar b/spss.handbook/clients/api/lib/jaxp-1.2_01/dom.jar deleted file mode 100644 index f91f80a8b..000000000 Binary files a/spss.handbook/clients/api/lib/jaxp-1.2_01/dom.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/jaxp-1.2_01/jaxp-api.jar b/spss.handbook/clients/api/lib/jaxp-1.2_01/jaxp-api.jar deleted file mode 100644 index 7a3295ee6..000000000 Binary files a/spss.handbook/clients/api/lib/jaxp-1.2_01/jaxp-api.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/jaxp-1.2_01/sax.jar b/spss.handbook/clients/api/lib/jaxp-1.2_01/sax.jar deleted file mode 100644 index 9ffb844e5..000000000 Binary files a/spss.handbook/clients/api/lib/jaxp-1.2_01/sax.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/log4j-1.2.7/log4j-1.2.7.jar b/spss.handbook/clients/api/lib/log4j-1.2.7/log4j-1.2.7.jar deleted file mode 100644 index 1595a56ef..000000000 Binary files a/spss.handbook/clients/api/lib/log4j-1.2.7/log4j-1.2.7.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/postgres-jdbc2-7.3/pg73jdbc2.jar b/spss.handbook/clients/api/lib/postgres-jdbc2-7.3/pg73jdbc2.jar deleted file mode 100644 index 8bf46dd8e..000000000 Binary files a/spss.handbook/clients/api/lib/postgres-jdbc2-7.3/pg73jdbc2.jar and /dev/null differ diff --git a/spss.handbook/clients/api/lib/xalan-j-2.5.1/xalan.jar b/spss.handbook/clients/api/lib/xalan-j-2.5.1/xalan.jar deleted file mode 100644 index 44d4d094d..000000000 Binary files a/spss.handbook/clients/api/lib/xalan-j-2.5.1/xalan.jar and /dev/null differ diff --git a/spss.handbook/clients/api/signatures/SimpleSignature.xml b/spss.handbook/clients/api/signatures/SimpleSignature.xml deleted file mode 100644 index 9ecd215c1..000000000 --- a/spss.handbook/clients/api/signatures/SimpleSignature.xml +++ /dev/null @@ -1,23 +0,0 @@ - -tLODyeiWFbAkQKwhrR23jtcgu4k=VEjXB6+geUL16oTPDVx5lcQliGl/oyVobug3BVxVwhu8CU7WK65moTcTuo/CL2hQMIID+DCCA2WgAwIBAgIBCTAJBgUrDgMCHQUAMH8xCzAJBgNVBAYTAkFUMSwwKgYD -VQQKEyNTdGFic3RlbGxlIElLVC1TdHJhdGVnaWUgZGVzIEJ1bmRlczEeMBwGA1UE -CxMVVGVjaG5payB1bmQgU3RhbmRhcmRzMSIwIAYDVQQDExlUZXN0IENBIC0gU2ln -bmF0dXJkaWVuc3RlMB4XDTA0MDgwNDA4MjM0OFoXDTA3MDgwNDA4MjM0OFowgZgx -CzAJBgNVBAYTAkFUMS0wKwYDVQQKEyRTdGFic3N0ZWxsZSBJS1QtU3RyYXRlZ2ll -IGRlcyBCdW5kZXMxHjAcBgNVBAsTFVRlY2huaWsgdW5kIFN0YW5kYXJkczE6MDgG -A1UEAxMxVGVzdDogU2lnbmF0dXJkaWVuc3QgYWxsZXIgS3VuZGVuOiBFQ0RTQSAo -UDE5MnYxKTCB8zCBvAYHKoZIzj0CATCBsAIBATAkBgcqhkjOPQEBAhkA//////// -/////////////v//////////MDQEGP////////////////////7//////////AQY -ZCEFGeWcgOcPp+mrciQwSf643uzBRrmxBDEEGI2oDrAwkPZ8vyDrQ6GIAPT/Cv2C -/xASBxkrlf/I2nhjEBHtayTN1XP5d6EeeUgRAhkA////////////////md74NhRr -ybG00igxAgEBAzIABNHWY9lQOE1zgmpcpjTg2WIg6qgEsGhpXELPinJoMPDVheTv -2BZPG42YJsNfvWgC06OCARwwggEYMA4GA1UdDwEB/wQEAwIGwDAMBgNVHRMBAf8E -AjAAMB0GA1UdDgQWBBRHH5EXnrWosCmIa+JyEM5seMxFVzBdBgNVHSAEVjBUMFIG -DCsGAQQBlRIBAgMBATBCMEAGCCsGAQUFBwICMDQaMkRpZXNlcyBaZXJ0aWZpa2F0 -IGlzdCBudXIgZvxyIFRlc3R6d2Vja2UgZ2VlaWduZXQuMEMGA1UdHwQ8MDowOKA2 -oDSGMmh0dHA6Ly9sYWJzLmNpby5ndi5hdC90ZW1wL2NybHMvc2lnbmF0dXJkaWVu -c3QuY3JsMBQGByooAAoBAQEECQwHQktBLUlLVDAfBgNVHSMEGDAWgBRAl0P5fWaw -vf59+uxGcYY9wffZPTAJBgUrDgMCHQUAA4GBAIMKUsnajgfBtpHeDdMdQMLA8fdt -lluezDOM78WYYSFURP04QZk5iHkShzptgZCF5Y/T4an3dC3SnytL67LJvEoKUyja -iTMLo7650xRTvAjTaMJ+nly/wTRYJKplOLXKWj3WwfObMHXdsDE8NJmpJSRE7Sw7 -+tj+UiTiNNSaXirqDiese Daten werden signiert. \ No newline at end of file diff --git a/spss.handbook/clients/api/src/at/gv/egovernment/moa/spss/handbook/clients/api/CreateXMLSignature.java b/spss.handbook/clients/api/src/at/gv/egovernment/moa/spss/handbook/clients/api/CreateXMLSignature.java deleted file mode 100644 index 2534e4913..000000000 --- a/spss.handbook/clients/api/src/at/gv/egovernment/moa/spss/handbook/clients/api/CreateXMLSignature.java +++ /dev/null @@ -1,130 +0,0 @@ -package at.gv.egovernment.moa.spss.handbook.clients.api; - -import java.io.ByteArrayInputStream; -import java.util.ArrayList; -import java.util.List; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.spss.api.SPSSFactory; -import at.gv.egovernment.moa.spss.api.SignatureCreationService; -import at.gv.egovernment.moa.spss.api.common.Content; -import at.gv.egovernment.moa.spss.api.common.MetaInfo; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfo; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfile; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; -import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo; -import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse; -import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; -import at.gv.egovernment.moa.util.DOMUtils; - -/** - * Dieses einfache Beispiel demonstriert grundlegend den Gebrauch der API von MOA SP/SS. Es wird damit eine - * einfach aufgebaute XML-Signatur erzeugt. - */ -public class CreateXMLSignature -{ - /** - * Methode main. - * - * Enthält beispielhaften Code zum grundlegenden Gebrauch der API von MOA SP/SS. Es wird damit eine - * einfach aufgebaute XML-Signatur erzeugt. - * - * ACHTUNG: Stellen Sie bei Verwendung von J2SE 1.4.x bzw. 5.x sicher, dass Sie die System-Property - * java.endorsed.dirs auf jenes Verzeichnis gesetzt haben, in dem sich die XPath- - * und XSLT-Bibliothek Xalan-J befindet. - * - * @param args - * - * @throws Exception Sollten Fehler auftreten werden die Fehler an die Java-VM weitergeleitet. - */ - public static void main(String[] args) throws Exception - { - // Setzen der System-Properties - init(args); - - // Serverfunktionshandler instanzieren - SPSSFactory spf = SPSSFactory.getInstance(); - - // Zu signierende Daten in ein Contentobjekt einbinden (die Daten werden hier explizit angegeben, - // sollen aber in der Signatur mittels URL "http://uri.data.org" referenziert werden - byte[] data = "Diese Daten werden signiert.".getBytes("UTF-8"); - ByteArrayInputStream bis = new ByteArrayInputStream(data); - Content cont = spf.createContent(bis, null); - - // Metainformationen zu den zu signierenden Daten erstellen - MetaInfo mi = spf.createMetaInfo("text/plain", null, null, null); - - // Transformationen erstellen (hier werden keine Transformationen angewandt) - CreateTransformsInfo cti = spf.createCreateTransformsInfo(null, mi); - CreateTransformsInfoProfile ct = spf.createCreateTransformsInfoProfile(cti, null); - - // Datenobjekt aufbauen - DataObjectInfo doi = spf.createDataObjectInfo(DataObjectInfo.STRUCTURE_ENVELOPING, false, cont, ct); - - // Erstellen eines SingleSignatureInfo-Containers - // Enthält alle Angaben zur Erstellung *einer* Signatur - List dataobjectinfolist = new ArrayList(); - dataobjectinfolist.add(doi); - SingleSignatureInfo ssi = spf.createSingleSignatureInfo(dataobjectinfolist, null, false); - - // Erstellen des Request-Objekts (Schlüsselbezeichner, Liste von SingleSignatureInfo-Containern) - List singlesignatureinfolist = new ArrayList(); - singlesignatureinfolist.add(ssi); - CreateXMLSignatureRequest cxsreq = spf.createCreateXMLSignatureRequest("KG_allgemein", - singlesignatureinfolist); - - // Signatureerstellungsservice instanzieren und aufrufen - SignatureCreationService scs = SignatureCreationService.getInstance(); - CreateXMLSignatureResponse cxsres = scs.createXMLSignature(cxsreq); - - // Response auswerten - List elements = cxsres.getResponseElements(); - SignatureEnvironmentResponse ser = (SignatureEnvironmentResponse) elements.get(0); - - // Auswertung des ersten (und einzigen) SignatureEnvironmentResponse-Containers - int response_type = ser.getResponseType(); - - if (response_type == SignatureEnvironmentResponse.ERROR_RESPONSE) - { - // Fehlerfall - System.out.println("Bei der Erstellung der Signatur ist ein Fehler aufgetreten."); - } - else - { - // Signaturerstellung erfolgreich - System.out.println("Signaturerstellung erfolgreich:"); - - Element se = ser.getSignatureEnvironment(); - System.out.println(DOMUtils.serializeNode(se)); - } - } - - /** - * Setzt die notwendigen System-Properties für die Konfiguration der MOA SP/SS API. - * - * @param args Siehe @link CreateXMLSignature#main(String[]). - */ - private static void init(String[] args) - { - if (args == null || args.length != 2) - { - System.out.println("Verwendung: CreateXMLSignature "); - } - System.setProperty("moa.spss.server.configuration", args[0]); - System.setProperty("log4j.configuration", "file:" + args[1]); - } -} \ No newline at end of file diff --git a/spss.handbook/clients/api/src/at/gv/egovernment/moa/spss/handbook/clients/api/VerifyXMLSignature.java b/spss.handbook/clients/api/src/at/gv/egovernment/moa/spss/handbook/clients/api/VerifyXMLSignature.java deleted file mode 100644 index fed8ba9f2..000000000 --- a/spss.handbook/clients/api/src/at/gv/egovernment/moa/spss/handbook/clients/api/VerifyXMLSignature.java +++ /dev/null @@ -1,147 +0,0 @@ -package at.gv.egovernment.moa.spss.handbook.clients.api; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.HashMap; - -import at.gv.egovernment.moa.spss.MOAException; -import at.gv.egovernment.moa.spss.api.SPSSFactory; -import at.gv.egovernment.moa.spss.api.SignatureVerificationService; -import at.gv.egovernment.moa.spss.api.common.Content; -import at.gv.egovernment.moa.spss.api.common.SignerInfo; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureInfo; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureLocation; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; - -/** - * Dieses einfache Beispiel demonstriert grundlegend den Gebrauch der API von MOA SP/SS. - * Es wird damit eine einfach aufgebaute XML-Signatur geprüft. - */ - -public class VerifyXMLSignature -{ - /** - * Methode main. - * - * Enthält beispielhaften Code zum grundlegenden Gebrauch der API von MOA SP/SS. - * Es wird damit eine einfach aufgebaute XML-Signatur geprüft. - * - * ACHTUNG: Stellen Sie bei Verwendung von J2SE 1.4.x bzw. 5.x sicher, dass Sie die System-Property - * java.endorsed.dirs auf jenes Verzeichnis gesetzt haben, in dem sich die XPath- - * und XSLT-Bibliothek Xalan-J befindet. - * - * @param args - */ - public static void main(String[] args) - { - // Setzen der System-Properties - init(args); - - // Factory und Service instanzieren - SPSSFactory spssFac = SPSSFactory.getInstance(); - SignatureVerificationService sigVerifyService = SignatureVerificationService.getInstance(); - - // Content aus Dokument mit zu prüfender Signatur erstellen - FileInputStream sigDocFIS = null; - try - { - sigDocFIS = new FileInputStream(args[2]); - } - catch (FileNotFoundException e1) - { - System.err.println("XML-Dokument mit zu prüfender Signatur nicht gefunden: " + args[2]); - System.exit(-1); - } - Content sigDocContent = spssFac.createContent(sigDocFIS, null); - - // Position der zu prüfenden Signatur im Dokument angeben - // (Nachdem im XPath-Ausdruck ein NS-Präfix verwendet wird, muss in einer Lookup-Tabelle - // der damit bezeichnete Namenraum mitgegeben werden) - HashMap nSMap = new HashMap(); - nSMap.put("dsig", "http://www.w3.org/2000/09/xmldsig#"); - VerifySignatureLocation sigLocation = spssFac.createVerifySignatureLocation("//dsig:Signature", nSMap); - - // Zu prüfendes Dokument und Signaturposition zusammenfassen - VerifySignatureInfo sigInfo = spssFac.createVerifySignatureInfo(sigDocContent, sigLocation); - - // Prüfrequest zusammenstellen - VerifyXMLSignatureRequest verifyRequest = spssFac.createVerifyXMLSignatureRequest( - null, // Wird Prüfzeit nicht angegeben, wird aktuelle Zeit verwendet - sigInfo, - null, // Keine Ergänzungsobjekte notwendig - null, // Signaturmanifest-Prüfung soll nicht durchgeführt werden - false, // Hash-Inputdaten, d.h. tatsächlich signierte Daten werden nicht zurückgeliefert - "Test-Signaturdienste"); // ID des verwendeten Vertrauensprofils - - VerifyXMLSignatureResponse verifyResponse = null; - try - { - // Aufruf der Signaturprüfung - verifyResponse = sigVerifyService.verifyXMLSignature(verifyRequest); - } - catch (MOAException e) - { - // Service liefert Fehler - System.err.println("Die Signaturprüfung hat folgenden Fehler geliefert:"); - System.err.println("Fehlercode: " + e.getMessageId()); - System.err.println("Fehlernachricht: " + e.getMessage()); - System.exit(-1); - } - - // Auswertung der Response - System.out.println(); - System.out.println("Ergebnisse der Signaturprüfung:"); - System.out.println(); - - // Besondere Eigenschaften des Signatorzertifikats - SignerInfo signerInfo = verifyResponse.getSignerInfo(); - System.out.println("*** Ist Zertifikat des Signators qualifiziert? " + ((signerInfo.isQualifiedCertificate()) ? "ja" : "nein")); - System.out.println("*** Ist Zertifikat des Signators von einer Behörde? " + ((signerInfo.isPublicAuthority()) ? "ja" : "nein")); - - // Ergebnisse von Signatur- und Zertifikatsprüfung - System.out.println(); - System.out.println("Ergebniscode der Signaturprüfung: " + verifyResponse.getSignatureCheck().getCode()); - System.out.println("Ergebniscode der Zertifikatsprüfung: " + verifyResponse.getCertificateCheck().getCode()); - - // Signatorzertifikat - System.out.println(); - System.out.println("*** Zertifikat des Signators:"); - System.out.println("Aussteller: " + signerInfo.getSignerCertificate().getIssuerDN()); - System.out.println("Subject: " + signerInfo.getSignerCertificate().getSubjectDN()); - System.out.println("Seriennummer: " + signerInfo.getSignerCertificate().getSerialNumber()); - } - - /** - * Setzt die notwendigen System-Properties für die Konfiguration der MOA SP/SS API. - * - * @param args Siehe @link VerifyXMLSignature#main(String[]). - */ - private static void init(String[] args) - { - if (args == null || args.length != 3) - { - System.out.println("Verwendung: VerifyXMLSignature "); - System.exit(-1); - } - System.setProperty("moa.spss.server.configuration", args[0]); - System.setProperty("log4j.configuration", "file:" + args[1]); - } -} \ No newline at end of file -- cgit v1.2.3