aboutsummaryrefslogtreecommitdiff
path: root/spss/server/tools/src/main/java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2017-03-02 10:43:59 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2017-03-02 10:43:59 +0100
commit30db55cc7a7a9bfa67b321e66bb8d1b1abf7afc9 (patch)
tree9ab8760bdfffab275b98d4e89fe5244c3d1d8809 /spss/server/tools/src/main/java
parentc3a7ea3758c23d0d1f147aa29c13d09fd0334f35 (diff)
downloadmoa-id-spss-30db55cc7a7a9bfa67b321e66bb8d1b1abf7afc9.tar.gz
moa-id-spss-30db55cc7a7a9bfa67b321e66bb8d1b1abf7afc9.tar.bz2
moa-id-spss-30db55cc7a7a9bfa67b321e66bb8d1b1abf7afc9.zip
remove MOA-SPSS source code from MOA-ID repository. The MOA-SPSS source is already moved to a new repository.
Diffstat (limited to 'spss/server/tools/src/main/java')
-rw-r--r--spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java266
-rw-r--r--spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java83
2 files changed, 0 insertions, 349 deletions
diff --git a/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java b/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java
deleted file mode 100644
index d334501d2..000000000
--- a/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright 2003 Federal Chancellery Austria
- * MOA-SPSS has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-
-
-package at.gv.egovernment.moa.spss.server.tools;
-
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.security.cert.CertificateException;
-
-import iaik.asn1.structures.Name;
-import iaik.pki.store.certstore.CertStoreException;
-import iaik.pki.store.certstore.CertStoreTypes;
-import iaik.pki.store.certstore.directory.DirectoryCertStore;
-import iaik.pki.store.certstore.directory.DirectoryCertStoreParameters;
-import iaik.pki.store.certstore.directory.DirectoryStoreException;
-import iaik.security.ecc.provider.ECCProvider;
-import iaik.security.provider.IAIK;
-import iaik.utils.RFC2253NameParserException;
-import iaik.x509.X509Certificate;
-
-/**
- * A tool to support X509 certificate handling for configuring the MOA SP/SS
- * service.
- *
- * This class provides functions for:
- * <ul>
- * <li>printing certificate information</li>
- * <li>adding certificates to the cert store</li>
- * </ul>
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class CertTool {
-
- /** Error message if the DN cannot be parsed according to RFC2253. */
- private static final String ILLEGAL_RFC2253_NAME =
- "Kein gültiger RFC2253-Name";
-
- /**
- * Main entry point of the tool.
- *
- * @param args The command line arguments. A single argument is expected,
- * which is the file name of the X509 certificate to inspect.
- */
- public static void main(String args[]) {
- CertTool certTool = new CertTool();
-
- if (args.length == 2 && "-info".equals(args[0])) {
- initProviders();
- certTool.printCertInfo(args[1], System.out);
- } else if (args.length == 3 && "-add".equals(args[0])) {
- initProviders();
- certTool.addCertToCertStore(args[1], args[2]);
- } else {
- certTool.printUsage(System.err);
- }
- }
-
- /**
- * Init the JCE providers, depending on the JDK used.
- *
- * Adds the IAIK JCE and IAIK ECC providers.
- */
- private static void initProviders() {
- if (System.getProperty("java.version").startsWith("1.3")) {
- IAIK.addAsProvider();
- } else {
- IAIK.addAsJDK14Provider();
- }
- ECCProvider.addAsProvider();
- }
-
- /**
- * Print the information about the certificate.
- *
- * This method will output information about the Subject DN, the Issuer DN and
- * the serial number of the certificate.
- *
- * @param certFile The name of the certificate file to inspect.
- * @param out The stream to print the information to.
- */
- public void printCertInfo(String certFile, PrintStream out) {
- try {
- InputStream is = new BufferedInputStream(new FileInputStream(certFile));
- X509Certificate cert = new X509Certificate(is);
- String issuerDN;
- String serial;
- String subjectDN;
-
- try {
- subjectDN = ((Name) (cert.getSubjectDN())).getRFC2253String();
- } catch (RFC2253NameParserException e) {
- subjectDN = ILLEGAL_RFC2253_NAME;
- }
-
- try {
- issuerDN = ((Name) (cert.getIssuerDN())).getRFC2253String();
- } catch (RFC2253NameParserException e) {
- issuerDN = ILLEGAL_RFC2253_NAME;
- }
-
- serial = cert.getSerialNumber().toString();
-
- out.println("SubjectDN (RFC2253): " + subjectDN);
- out.println("IssuerDN (RFC2253) : " + issuerDN);
- out.println("Serial Number : " + serial);
- } catch (FileNotFoundException e) {
- System.err.println("Zertifikat nicht gefunden: " + certFile);
- } catch (IOException e) {
- System.err.println(
- "I/O Fehler beim Lesen des Zertifikats: " + e.getMessage());
- } catch (CertificateException e) {
- System.err.println(
- "Fehler beim Lesen des Zertifikats: " + e.getMessage());
- } catch (Throwable t) {
- System.err.println("Allgemeiner Fehler: " + t.getMessage());
- }
- }
-
- /**
- * Add a certificate to a directory certificate store.
- *
- * @param certFile The certificate to add.
- * @param certStoreRoot The root directory of the certificate store.
- */
- public void addCertToCertStore(String certFile, String certStoreRoot) {
- try {
- // read the certificate
- InputStream is = new BufferedInputStream(new FileInputStream(certFile));
- X509Certificate cert = new X509Certificate(is);
-
- // initialize the DirectoryCertStore
- DirectoryCertStore certStore =
- new DirectoryCertStore(
- new SimpleDirectoryCertStoreParameters(certStoreRoot),
- null);
-
- certStore.storeCertificate(cert, null);
-
- System.out.println("\nDas Zertifikat wurde erfolreich hinzugef�gt.\n");
-
- } catch (FileNotFoundException e) {
- System.err.println("Zertifikat nicht gefunden: " + certFile);
- } catch (IOException e) {
- System.err.println(
- "I/O Fehler beim Lesen des Zertifikats: " + e.getMessage());
- } catch (CertificateException e) {
- System.err.println(
- "Fehler beim Lesen des Zertifikats: " + e.getMessage());
- } catch (DirectoryStoreException e) {
- System.err.println(
- "Fehler beim Öffnen des Zertifikatsspeichers: " + e.getMessage());
- } catch (CertStoreException e) {
- System.err.println(
- "Fehler beim Hinzufügen des Zertifikats: " + e.getMessage());
- } catch (Throwable t) {
- System.err.println("Allgemeiner Fehler: " + t.getMessage());
- t.printStackTrace();
- }
- }
-
- /**
- * Print tool usage.
- *
- * @param out The <code>PrintStream</code> to print to.
- */
- private void printUsage(PrintStream out) {
- out.println("\nCerttool-Syntax:\n");
- out.println("-info <X509 Zertifikatsdatei");
- out.println();
- out.println("-add <X509 Zertifikatsdatei> <Zertifikatsspeicher>");
- out.println("\n");
- }
-
-}
-
-/**
- * Simple implementation of the <code>DirectoryCertStoreParameters</code>
- * interface intelligent enough for setting up a simple
- * <code>DirectoryCertStore</code> in the <code>CertTool</code>.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-class SimpleDirectoryCertStoreParameters
- implements DirectoryCertStoreParameters {
-
- /** The cert store root directory. */
- private String rootDirectory;
-
- /**
- * Create a new <code>SimpleDirectoryCertStoreParameters</code> object.
- *
- * @param rootDirectory The root directory of the cert store.
- */
- public SimpleDirectoryCertStoreParameters(String rootDirectory) {
- this.rootDirectory = rootDirectory;
- }
-
- /**
- * @return <code>&quot;MOA Directory CertStore&quot;</code>
- * @see iaik.pki.store.certstore.CertStoreParameters#getId()
- */
- public String getId() {
- return "MOA Directory CertStore";
- }
-
- /**
- * @return CertStoreTypes.DIRECTORY
- * @see iaik.pki.store.certstore.CertStoreParameters#getType()
- */
- public String getType() {
- return CertStoreTypes.DIRECTORY;
- }
-
- /**
- * @return <code>false</code>
- * @see iaik.pki.store.certstore.CertStoreParameters#isReadOnly()
- */
- public boolean isReadOnly() {
- return false;
- }
-
- /**
- * @return <code>false</code>
- * @see iaik.pki.store.certstore.directory.DirectoryCertStoreParameters#createNew()
- */
- public boolean createNew() {
- return false;
- }
-
- /**
- * @return The root directory given at construction time.
- * @see iaik.pki.store.certstore.directory.DirectoryCertStoreParameters#getRootDirectory()
- */
- public String getRootDirectory() {
- return rootDirectory;
- }
-
-} \ No newline at end of file
diff --git a/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java b/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java
deleted file mode 100644
index d4393b342..000000000
--- a/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2003 Federal Chancellery Austria
- * MOA-SPSS has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-
-
-package at.gv.egovernment.moa.spss.server.tools;
-
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-/**
- * A tool for converting a MOA SPSS Version 1.0 configuration file into
- * a Version 1.3 configuration file.
- *
- * @author Gregor Karlinger
- * @version $Id$
- */
-public class ConfigTool
-{
- public static void main(String[] args)
- {
- if (args == null || args.length != 2)
- {
- System.out.println("Usage: ConfigTool <MOA.SPSS.1-0.ConfigFile.xml> <MOA.SPSS.1-4.5.ConfigFile.xml>");
- System.out.println(" <MOA.SPSS.1-0.ConfigFile.xml> ... Old config file to be transformed");
- System.out.println(" <MOA.SPSS.1-4.5.ConfigFile.xml> ... New config file resulting from the transform");
- System.exit(-1);
- }
-
- try
- {
- TransformerFactory tFactory = TransformerFactory.newInstance();
- Transformer transformer = tFactory.newTransformer(new StreamSource(
- ConfigTool.class.getResourceAsStream("/resources/tools/ConfigurationMapper.xsl")));
- transformer.transform(new StreamSource(args[0]), new StreamResult(new FileOutputStream(args[1])));
-
- System.out.println("Successfully mapped configuration file.");
- }
- catch (TransformerConfigurationException e)
- {
- System.err.println("An error occurred during mapping the configuration file:");
- System.err.println(" Cannot initialize XSLT transform.");
- System.err.println(" " + e.getMessage());
- }
- catch (FileNotFoundException e)
- {
- System.err.println("An error occurred during mapping the configuration file:");
- System.err.println(" There is a problem with the filename for the new configuration file.");
- System.err.println(" " + e.getMessage());
- }
- catch (TransformerException e)
- {
- System.err.println("An error occurred during mapping the configuration file:");
- System.err.println(" " + e.getMessage());
- }
- }
-}