From 43e57a42832ea8b4ceb0317f3c9028a4174ffa7b Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 8 Aug 2007 07:25:32 +0000 Subject: Adapted project directory structure to suit the new maven based build process. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@909 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../resources/data/deploy/tomcat/server.mod_jk.xml | 166 +++ .../resources/data/deploy/tomcat/server.xml | 169 +++ .../resources/data/deploy/tomcat/unix/moa-env.sh | 12 + .../data/deploy/tomcat/uriworkermap.properties | 4 + .../data/deploy/tomcat/win32/startTomcat.bat | 27 + .../data/deploy/tomcat/win32/stopTomcat.bat | 13 + .../data/deploy/tomcat/workers.properties | 6 + .../resources/data/deploy/tools/certtool.bat | 25 + .../resources/data/deploy/tools/certtool.sh | 20 + .../resources/data/deploy/tools/configtool.bat | 25 + .../resources/data/deploy/tools/configtool.sh | 20 + .../serverlib/resources/licenses/Apache-2.0.txt | 202 ++++ .../serverlib/resources/licenses/IAIK-License.txt | 13 + spss/server/serverlib/resources/licenses/Jaxen.txt | 40 + .../resources/licenses/PostgreSQL-JDBC.txt | 26 + .../moa/spss/MOAApplicationException.java | 41 + .../at/gv/egovernment/moa/spss/MOAException.java | 161 +++ .../egovernment/moa/spss/MOARuntimeException.java | 163 +++ .../egovernment/moa/spss/MOASystemException.java | 40 + .../gv/egovernment/moa/spss/api/Configurator.java | 60 + .../gv/egovernment/moa/spss/api/SPSSFactory.java | 1012 ++++++++++++++++ .../moa/spss/api/SignatureCreationService.java | 57 + .../moa/spss/api/SignatureVerificationService.java | 69 ++ .../moa/spss/api/cmsverify/CMSContent.java | 28 + .../spss/api/cmsverify/CMSContentExcplicit.java | 19 + .../spss/api/cmsverify/CMSContentReference.java | 17 + .../moa/spss/api/cmsverify/CMSDataObject.java | 25 + .../api/cmsverify/VerifyCMSSignatureRequest.java | 52 + .../api/cmsverify/VerifyCMSSignatureResponse.java | 21 + .../VerifyCMSSignatureResponseElement.java | 32 + .../moa/spss/api/common/Base64Transform.java | 13 + .../spss/api/common/CanonicalizationTransform.java | 17 + .../moa/spss/api/common/CheckResult.java | 25 + .../egovernment/moa/spss/api/common/Content.java | 47 + .../moa/spss/api/common/ContentBinary.java | 21 + .../moa/spss/api/common/ContentLocRef.java | 17 + .../moa/spss/api/common/ContentReference.java | 11 + .../moa/spss/api/common/ContentXML.java | 19 + .../moa/spss/api/common/ElementSelector.java | 28 + .../api/common/EnvelopedSignatureTransform.java | 15 + .../common/ExclusiveCanonicalizationTransform.java | 27 + .../egovernment/moa/spss/api/common/InputData.java | 47 + .../egovernment/moa/spss/api/common/MetaInfo.java | 37 + .../moa/spss/api/common/SignerInfo.java | 43 + .../egovernment/moa/spss/api/common/Transform.java | 16 + .../moa/spss/api/common/X509IssuerSerial.java | 25 + .../spss/api/common/XMLDataObjectAssociation.java | 25 + .../moa/spss/api/common/XPathFilter.java | 38 + .../moa/spss/api/common/XPathFilter2Transform.java | 25 + .../moa/spss/api/common/XPathTransform.java | 30 + .../moa/spss/api/common/XSLTTransform.java | 23 + .../moa/spss/api/impl/Base64TransformImpl.java | 22 + .../moa/spss/api/impl/CMSContentExplicitImpl.java | 40 + .../moa/spss/api/impl/CMSContentReferenceImpl.java | 38 + .../moa/spss/api/impl/CMSDataObjectImpl.java | 46 + .../api/impl/CanonicalizationTransformImpl.java | 25 + .../moa/spss/api/impl/CheckResultImpl.java | 52 + .../moa/spss/api/impl/ContentBinaryImpl.java | 40 + .../egovernment/moa/spss/api/impl/ContentImpl.java | 28 + .../moa/spss/api/impl/ContentLocRefImpl.java | 44 + .../moa/spss/api/impl/ContentReferenceImpl.java | 24 + .../moa/spss/api/impl/ContentXMLImpl.java | 40 + ...ateSignatureEnvironmentProfileExplicitImpl.java | 66 ++ .../CreateSignatureEnvironmentProfileIDImpl.java | 39 + .../moa/spss/api/impl/CreateSignatureInfoImpl.java | 50 + .../spss/api/impl/CreateSignatureLocationImpl.java | 31 + .../spss/api/impl/CreateTransformsInfoImpl.java | 51 + .../CreateTransformsInfoProfileExplicitImpl.java | 62 + .../impl/CreateTransformsInfoProfileIDImpl.java | 38 + .../api/impl/CreateXMLSignatureRequestImpl.java | 53 + .../api/impl/CreateXMLSignatureResponseImpl.java | 37 + .../moa/spss/api/impl/DataObjectInfoImpl.java | 79 ++ .../moa/spss/api/impl/ElementSelectorImpl.java | 47 + .../api/impl/EnvelopedSignatureTransformImpl.java | 22 + .../moa/spss/api/impl/ErrorResponseImpl.java | 52 + .../ExclusiveCanonicalizationTransformImpl.java | 48 + .../moa/spss/api/impl/InputDataBinaryImpl.java | 99 ++ .../moa/spss/api/impl/InputDataXMLImpl.java | 99 ++ .../spss/api/impl/ManifestRefsCheckResultImpl.java | 44 + .../api/impl/ManifestRefsCheckResultInfoImpl.java | 32 + .../moa/spss/api/impl/MetaInfoImpl.java | 75 ++ .../moa/spss/api/impl/ReferenceInfoImpl.java | 38 + .../spss/api/impl/ReferencesCheckResultImpl.java | 46 + .../api/impl/ReferencesCheckResultInfoImpl.java | 46 + .../moa/spss/api/impl/SPSSFactoryImpl.java | 568 +++++++++ .../api/impl/SignatureEnvironmentResponseImpl.java | 41 + .../api/impl/SignatureManifestCheckParamsImpl.java | 52 + .../moa/spss/api/impl/SignerInfoImpl.java | 81 ++ .../moa/spss/api/impl/SingleSignatureInfoImpl.java | 49 + .../api/impl/SupplementProfileExplicitImpl.java | 39 + .../moa/spss/api/impl/SupplementProfileIDImpl.java | 37 + .../moa/spss/api/impl/TransformImpl.java | 26 + .../api/impl/TransformParameterBinaryImpl.java | 42 + .../moa/spss/api/impl/TransformParameterImpl.java | 25 + .../spss/api/impl/TransformParameterURIImpl.java | 24 + .../spss/api/impl/TransformPatameterHashImpl.java | 54 + .../api/impl/VerifyCMSSignatureRequestImpl.java | 93 ++ .../VerifyCMSSignatureResponseElementImpl.java | 62 + .../api/impl/VerifyCMSSinatureResponseImpl.java | 37 + .../moa/spss/api/impl/VerifySignatureInfoImpl.java | 47 + .../spss/api/impl/VerifySignatureLocationImpl.java | 15 + .../spss/api/impl/VerifyTransformsDataImpl.java | 36 + .../VerifyTransformsInfoProfileExplicitImpl.java | 61 + .../impl/VerifyTransformsInfoProfileIDImpl.java | 38 + .../api/impl/VerifyXMLSignatureRequestImpl.java | 113 ++ .../api/impl/VerifyXMLSignatureResponseImpl.java | 141 +++ .../moa/spss/api/impl/X509IssuerSerialImpl.java | 45 + .../api/impl/XMLDataObjectAssociationImpl.java | 45 + .../spss/api/impl/XPathFilter2TransformImpl.java | 43 + .../moa/spss/api/impl/XPathFilterImpl.java | 64 + .../moa/spss/api/impl/XPathTransformImpl.java | 59 + .../moa/spss/api/impl/XSLTransformImpl.java | 37 + .../xmlbind/CreateXMLSignatureRequestParser.java | 288 +++++ .../xmlbind/CreateXMLSignatureResponseBuilder.java | 119 ++ .../moa/spss/api/xmlbind/ProfileParser.java | 285 +++++ .../moa/spss/api/xmlbind/RequestParserUtils.java | 157 +++ .../moa/spss/api/xmlbind/ResponseBuilderUtils.java | 206 ++++ .../moa/spss/api/xmlbind/TransformParser.java | 246 ++++ .../xmlbind/VerifyCMSSignatureRequestParser.java | 169 +++ .../xmlbind/VerifyCMSSignatureResponseBuilder.java | 101 ++ .../xmlbind/VerifyXMLSignatureRequestParser.java | 275 +++++ .../xmlbind/VerifyXMLSignatureResponseBuilder.java | 310 +++++ .../xmlsign/CreateSignatureEnvironmentProfile.java | 30 + .../CreateSignatureEnvironmentProfileExplicit.java | 30 + .../CreateSignatureEnvironmentProfileID.java | 20 + .../moa/spss/api/xmlsign/CreateSignatureInfo.java | 25 + .../spss/api/xmlsign/CreateSignatureLocation.java | 23 + .../moa/spss/api/xmlsign/CreateTransformsInfo.java | 27 + .../api/xmlsign/CreateTransformsInfoProfile.java | 28 + .../CreateTransformsInfoProfileExplicit.java | 26 + .../api/xmlsign/CreateTransformsInfoProfileID.java | 18 + .../api/xmlsign/CreateXMLSignatureRequest.java | 26 + .../api/xmlsign/CreateXMLSignatureResponse.java | 20 + .../xmlsign/CreateXMLSignatureResponseElement.java | 29 + .../moa/spss/api/xmlsign/DataObjectInfo.java | 48 + .../moa/spss/api/xmlsign/ErrorResponse.java | 24 + .../api/xmlsign/SignatureEnvironmentResponse.java | 20 + .../moa/spss/api/xmlsign/SingleSignatureInfo.java | 32 + .../api/xmlverify/ManifestRefsCheckResult.java | 24 + .../api/xmlverify/ManifestRefsCheckResultInfo.java | 19 + .../moa/spss/api/xmlverify/ReferenceInfo.java | 19 + .../spss/api/xmlverify/ReferencesCheckResult.java | 23 + .../api/xmlverify/ReferencesCheckResultInfo.java | 25 + .../xmlverify/SignatureManifestCheckParams.java | 26 + .../moa/spss/api/xmlverify/SupplementProfile.java | 28 + .../api/xmlverify/SupplementProfileExplicit.java | 19 + .../spss/api/xmlverify/SupplementProfileID.java | 18 + .../moa/spss/api/xmlverify/TransformParameter.java | 40 + .../api/xmlverify/TransformParameterBinary.java | 21 + .../spss/api/xmlverify/TransformParameterHash.java | 26 + .../spss/api/xmlverify/TransformParameterURI.java | 12 + .../spss/api/xmlverify/VerifySignatureInfo.java | 27 + .../api/xmlverify/VerifySignatureLocation.java | 13 + .../api/xmlverify/VerifyTransformsInfoProfile.java | 28 + .../VerifyTransformsInfoProfileExplicit.java | 25 + .../xmlverify/VerifyTransformsInfoProfileID.java | 18 + .../api/xmlverify/VerifyXMLSignatureRequest.java | 55 + .../api/xmlverify/VerifyXMLSignatureResponse.java | 60 + .../java/at/gv/egovernment/moa/spss/overview.htm | 155 +++ .../spss/server/config/CRLDistributionPoint.java | 165 +++ .../spss/server/config/ConfigurationException.java | 34 + .../server/config/ConfigurationPartsBuilder.java | 1239 ++++++++++++++++++++ .../spss/server/config/ConfigurationProvider.java | 689 +++++++++++ .../moa/spss/server/config/DistributionPoint.java | 38 + .../spss/server/config/HardwareCryptoModule.java | 60 + .../moa/spss/server/config/HardwareKeyModule.java | 59 + .../moa/spss/server/config/IssuerAndSerial.java | 125 ++ .../moa/spss/server/config/KeyGroup.java | 69 ++ .../moa/spss/server/config/KeyGroupEntry.java | 106 ++ .../moa/spss/server/config/KeyModule.java | 41 + .../spss/server/config/OCSPDistributionPoint.java | 33 + .../moa/spss/server/config/SoftwareKeyModule.java | 48 + .../moa/spss/server/config/TrustProfile.java | 58 + .../CMSSignatureVerificationProfileImpl.java | 37 + .../config/AbstractKeyModuleConfigurationImpl.java | 36 + .../config/AbstractObservableConfiguration.java | 48 + .../iaik/config/ArchiveConfigurationImpl.java | 97 ++ .../moa/spss/server/iaik/config/CRLRetriever.java | 69 ++ .../iaik/config/CertStoreConfigurationImpl.java | 50 + .../server/iaik/config/ConfigurationDataImpl.java | 121 ++ .../iaik/config/DataBaseArchiveParameterImpl.java | 33 + .../config/DirectoryCertStoreParametersImpl.java | 81 ++ .../HardwareCryptoModuleConfigurationImpl.java | 51 + .../config/HardwareKeyModuleConfigurationImpl.java | 55 + .../spss/server/iaik/config/IaikConfigurator.java | 173 +++ .../spss/server/iaik/config/LoggerConfigImpl.java | 34 + .../server/iaik/config/PKIConfigurationImpl.java | 80 ++ .../iaik/config/RevocationConfigurationImpl.java | 53 + .../config/SoftwareKeyModuleConfigurationImpl.java | 75 ++ .../iaik/config/ValidationConfigurationImpl.java | 56 + .../moa/spss/server/iaik/pki/PKIProfileImpl.java | 116 ++ .../pki/pathvalidation/ValidationProfileImpl.java | 107 ++ .../iaik/pki/revocation/RevocationProfileImpl.java | 64 + .../store/truststore/TrustStoreProfileImpl.java | 135 +++ .../server/iaik/xml/Base64TransformationImpl.java | 43 + .../server/iaik/xml/ByteArrayDataObjectImpl.java | 54 + .../server/iaik/xml/ByteStreamDataObjectImpl.java | 49 + .../spss/server/iaik/xml/CanonicalizationImpl.java | 43 + .../moa/spss/server/iaik/xml/DataObjectImpl.java | 87 ++ .../xml/EnvelopedSignatureTransformationImpl.java | 42 + .../iaik/xml/ExclusiveCanonicalizationImpl.java | 76 ++ .../moa/spss/server/iaik/xml/SigningTimeImpl.java | 34 + .../spss/server/iaik/xml/TransformationImpl.java | 43 + .../spss/server/iaik/xml/XMLDataObjectImpl.java | 46 + .../server/iaik/xml/XMLNodeListDataObjectImpl.java | 47 + .../moa/spss/server/iaik/xml/XMLSignatureImpl.java | 43 + .../moa/spss/server/iaik/xml/XPath2FilterImpl.java | 116 ++ .../server/iaik/xml/XPath2TransformationImpl.java | 82 ++ .../server/iaik/xml/XPathTransformationImpl.java | 98 ++ .../server/iaik/xml/XSLTTransformationImpl.java | 168 +++ .../iaik/xmlsign/DataObjectTreatmentImpl.java | 150 +++ .../xmlsign/XMLSignatureCreationProfileImpl.java | 279 +++++ .../xmlsign/XMLSignatureInsertionLocationImpl.java | 45 + .../XMLSignatureVerificationProfileImpl.java | 131 +++ .../moa/spss/server/init/ConfiguratorImpl.java | 42 + .../moa/spss/server/init/SystemInitializer.java | 129 ++ .../invoke/CMSSignatureVerificationInvoker.java | 221 ++++ .../CMSSignatureVerificationProfileFactory.java | 61 + .../invoke/CreateXMLSignatureResponseBuilder.java | 71 ++ .../moa/spss/server/invoke/DataObjectFactory.java | 892 ++++++++++++++ .../spss/server/invoke/ExternalURIResolver.java | 162 +++ .../spss/server/invoke/IaikExceptionMapper.java | 267 +++++ .../moa/spss/server/invoke/InvokerUtils.java | 63 + .../moa/spss/server/invoke/ProfileMapper.java | 249 ++++ .../spss/server/invoke/ServiceContextUtils.java | 51 + .../invoke/SignatureCreationServiceImpl.java | 45 + .../invoke/SignatureVerificationServiceImpl.java | 72 ++ .../spss/server/invoke/TransformationFactory.java | 258 ++++ .../invoke/VerifyCMSSignatureResponseBuilder.java | 86 ++ .../invoke/VerifyXMLSignatureResponseBuilder.java | 437 +++++++ .../server/invoke/XMLSignatureCreationInvoker.java | 545 +++++++++ .../invoke/XMLSignatureCreationProfileFactory.java | 455 +++++++ .../invoke/XMLSignatureVerificationInvoker.java | 675 +++++++++++ .../XMLSignatureVerificationProfileFactory.java | 144 +++ .../moa/spss/server/logging/IaikLog.java | 126 ++ .../moa/spss/server/logging/IaikLogFactory.java | 42 + .../moa/spss/server/logging/IaikLogMsg.java | 54 + .../moa/spss/server/logging/TransactionId.java | 38 + .../moa/spss/server/service/AxisHandler.java | 382 ++++++ .../spss/server/service/ConfigurationServlet.java | 120 ++ .../server/service/RevocationArchiveCleaner.java | 78 ++ .../moa/spss/server/service/ServiceUtils.java | 72 ++ .../server/service/SignatureCreationService.java | 104 ++ .../service/SignatureVerificationService.java | 151 +++ .../moa/spss/server/tools/CertTool.java | 242 ++++ .../moa/spss/server/tools/ConfigTool.java | 59 + .../server/transaction/TransactionContext.java | 264 +++++ .../transaction/TransactionContextManager.java | 62 + .../server/transaction/TransactionIDGenerator.java | 51 + .../moa/spss/server/util/IdGenerator.java | 61 + .../egovernment/moa/spss/util/MessageProvider.java | 65 + .../properties/spss_messages_de.properties | 151 +++ .../serverlib/src/main/resources/security/cacerts | Bin 0 -> 7365 bytes .../src/main/resources/wsdl/MOA-SPSS-1.3.wsdl | 105 ++ .../src/main/resources/wsdl/MOA-SPSS-1.3.xsd | 469 ++++++++ .../test/at/gv/egovernment/moa/spss/AllTests.java | 40 + .../at/gv/egovernment/moa/spss/SPSSTestCase.java | 82 ++ .../egovernment/moa/spss/api/xmlbind/AllTests.java | 24 + .../CreateXMLSignatureRequestParserTest.java | 71 ++ .../moa/spss/api/xmlbind/TransformParserTest.java | 113 ++ .../VerifyCMSSignatureRequestParserTest.java | 61 + .../VerifyXMLSignatureRequestParserTest.java | 81 ++ .../moa/spss/server/config/AllTests.java | 20 + .../server/config/ConfigurationProviderTest1.java | 377 ++++++ .../server/config/ConfigurationProviderTest2.java | 225 ++++ .../server/config/ConfigurationProviderTest3.java | 166 +++ .../iaik/config/ConfigurationDataImplTest.java | 149 +++ .../server/iaik/config/IaikConfiguratorTest.java | 36 + .../moa/spss/server/invoke/AllTests.java | 25 + .../CMSSignatureVerificationInvokerTest.java | 63 + .../spss/server/invoke/DataObjectFactoryTest.java | 180 +++ .../server/invoke/TransformationFactoryTest.java | 201 ++++ .../invoke/XMLSignatureCreationInvokerTest.java | 63 + .../XMLSignatureVerificationInvokerTest.java | 61 + .../moa/spss/server/tools/CertToolTest.java | 50 + 275 files changed, 25624 insertions(+) create mode 100644 spss/server/serverlib/resources/data/deploy/tomcat/server.mod_jk.xml create mode 100644 spss/server/serverlib/resources/data/deploy/tomcat/server.xml create mode 100644 spss/server/serverlib/resources/data/deploy/tomcat/unix/moa-env.sh create mode 100644 spss/server/serverlib/resources/data/deploy/tomcat/uriworkermap.properties create mode 100644 spss/server/serverlib/resources/data/deploy/tomcat/win32/startTomcat.bat create mode 100644 spss/server/serverlib/resources/data/deploy/tomcat/win32/stopTomcat.bat create mode 100644 spss/server/serverlib/resources/data/deploy/tomcat/workers.properties create mode 100644 spss/server/serverlib/resources/data/deploy/tools/certtool.bat create mode 100644 spss/server/serverlib/resources/data/deploy/tools/certtool.sh create mode 100644 spss/server/serverlib/resources/data/deploy/tools/configtool.bat create mode 100644 spss/server/serverlib/resources/data/deploy/tools/configtool.sh create mode 100644 spss/server/serverlib/resources/licenses/Apache-2.0.txt create mode 100644 spss/server/serverlib/resources/licenses/IAIK-License.txt create mode 100644 spss/server/serverlib/resources/licenses/Jaxen.txt create mode 100644 spss/server/serverlib/resources/licenses/PostgreSQL-JDBC.txt create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/overview.htm create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java create mode 100644 spss/server/serverlib/src/main/resources/properties/spss_messages_de.properties create mode 100644 spss/server/serverlib/src/main/resources/security/cacerts create mode 100644 spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.wsdl create mode 100644 spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.xsd create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/AllTests.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/SPSSTestCase.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java create mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/resources/data/deploy/tomcat/server.mod_jk.xml b/spss/server/serverlib/resources/data/deploy/tomcat/server.mod_jk.xml new file mode 100644 index 000000000..e6035b8be --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tomcat/server.mod_jk.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spss/server/serverlib/resources/data/deploy/tomcat/server.xml b/spss/server/serverlib/resources/data/deploy/tomcat/server.xml new file mode 100644 index 000000000..3e5966ca9 --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tomcat/server.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spss/server/serverlib/resources/data/deploy/tomcat/unix/moa-env.sh b/spss/server/serverlib/resources/data/deploy/tomcat/unix/moa-env.sh new file mode 100644 index 000000000..49d6723a3 --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tomcat/unix/moa-env.sh @@ -0,0 +1,12 @@ +MOA_START=`pwd` + +CONFIG_OPT=-Dmoa.spss.server.configuration=$MOA_START/conf/moa-spss/spss.config.xml +LOGGING_OPT=-Dlog4j.configuration=file:$MOA_START/conf/moa-spss/log4j.properties +# NODE_ID_OPT=-Dmoa.node-id=node1 +# TRUST_STORE_OPT=-Djavax.net.ssl.trustStore=truststore.jks +# TRUST_STORE_PASS_OPT=-Djavax.net.ssl.trustStorePassword=changeit +# TRUST_STORE_TYPE_OPT=-Djavax.net.ssl.trustStoreType=jks + +export CATALINA_OPTS="$CONFIG_OPT $LOGGING_OPT $NODE_ID_OPT $TRUST_STORE_OPT $TRUST_STORE_PASS_OPT $TRUST_STORE_TYPE_OPT" + +echo CATALINA_OPTS=$CATALINA_OPTS diff --git a/spss/server/serverlib/resources/data/deploy/tomcat/uriworkermap.properties b/spss/server/serverlib/resources/data/deploy/tomcat/uriworkermap.properties new file mode 100644 index 000000000..673acf65d --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tomcat/uriworkermap.properties @@ -0,0 +1,4 @@ +# a sample mod_jk uriworkermap.properties file for mapping +# MOA SP/SS web service requests to workers + +/moa-spss/*=moaworker \ No newline at end of file diff --git a/spss/server/serverlib/resources/data/deploy/tomcat/win32/startTomcat.bat b/spss/server/serverlib/resources/data/deploy/tomcat/win32/startTomcat.bat new file mode 100644 index 000000000..b7d740d12 --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tomcat/win32/startTomcat.bat @@ -0,0 +1,27 @@ +rem ---------------------------------------------------------------------------------------------- +rem Modify these entries according to your needs + +rem JDK home directory (no trailing path separator) +set JAVA_HOME= + +rem Tomcat 4.1.x home directory (no trailing path separator) +set CATALINA_HOME= + +rem ---------------------------------------------------------------------------------------------- + +set MOA_SPSS_CFG_HOME=%CATALINA_HOME%\conf\moa-spss + +set PARAM_SPSSCONFIG=-Dmoa.spss.server.configuration=%MOA_SPSS_CFG_HOME%\spss.config.xml +set PARAM_LOGGING=-Dlog4j.configuration=file:%MOA_SPSS_CFG_HOME%\log4j.properties +set PARAM_NODEID=-Dmoa.node-id=Node1 +set PARAMS_MOA=%PARAM_SPSSCONFIG% %PARAM_LOGGING% %PARAM_NODEID% + +rem set PARAM_TRUST_STORE=-Djavax.net.ssl.trustStore=truststore.jks +rem set PARAM_TRUST_STORE_PASS=-Djavax.net.ssl.trustStorePassword=changeit +rem set PARAM_TRUST_STORE_TYPE=-Djavax.net.ssl.trustStoreType=jks +rem set PARAMS_SSL=%PARAM_TRUST_STORE% %PARAM_TRUST_STORE_PASS% %PARAM_TRUST_STORE_TYPE% + +set CATALINA_OPTS=%PARAMS_MOA% %PARAMS_SSL% + +cd %CATALINA_HOME% +bin\catalina.bat start \ No newline at end of file diff --git a/spss/server/serverlib/resources/data/deploy/tomcat/win32/stopTomcat.bat b/spss/server/serverlib/resources/data/deploy/tomcat/win32/stopTomcat.bat new file mode 100644 index 000000000..09dd83f2d --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tomcat/win32/stopTomcat.bat @@ -0,0 +1,13 @@ +rem ---------------------------------------------------------------------------------------------- +rem Modify these entries according to your needs + +rem JDK home directory (no trailing path separator) +set JAVA_HOME= + +rem Tomcat 4.1.x home directory (no trailing path separator) +set CATALINA_HOME= + +rem ---------------------------------------------------------------------------------------------- + +cd %CATALINA_HOME% +bin\catalina.bat stop \ No newline at end of file diff --git a/spss/server/serverlib/resources/data/deploy/tomcat/workers.properties b/spss/server/serverlib/resources/data/deploy/tomcat/workers.properties new file mode 100644 index 000000000..9350ddc77 --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tomcat/workers.properties @@ -0,0 +1,6 @@ +# a sample workers.properties file defining a single mod_jk worker + +worker.list=moaworker +worker.moaworker.type=ajp13 +worker.moaworker.host=localhost +worker.moaworker.port=8009 diff --git a/spss/server/serverlib/resources/data/deploy/tools/certtool.bat b/spss/server/serverlib/resources/data/deploy/tools/certtool.bat new file mode 100644 index 000000000..0504211b8 --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tools/certtool.bat @@ -0,0 +1,25 @@ +@echo off + +rem +rem Script to invoke the CertTool class +rem +rem Author: Patrick Peck +rem Version: $Id: certtool.bat,v 1.6 2003/05/08 11:46:29 peck Exp $ +rem + + +if %OS%=="Windows_NT" @setlocal + +set CERTTOOL=at.gv.egovernment.moa.spss.server.tools.CertTool +set TOOLSPATH=%~p0 +set CLASSPATH=%TOOLSPATH%tools.jar;%TOOLSPATH%iaik_moa_full.jar;%TOOLSPATH%iaik_jce_full.jar;%TOOLSPATH%iaik_ecc.jar;%TOOLSPATH%log4j-1.2.7.jar + +if "%JAVA_HOME%"=="" goto noJavaHome +%JAVA_HOME%\bin\java.exe -classpath %CLASSPATH% %CERTTOOL% %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto end + +:noJavaHome +echo error: JAVA_HOME not defined + +:end +if %OS%=="Windows_NT" @endlocal \ No newline at end of file diff --git a/spss/server/serverlib/resources/data/deploy/tools/certtool.sh b/spss/server/serverlib/resources/data/deploy/tools/certtool.sh new file mode 100644 index 000000000..c7ff374f4 --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tools/certtool.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# +# Script to invoke the CertTool class +# +# Author:Patrick Peck +# Version: $Id: certtool.sh,v 1.9 2003/06/23 16:01:27 peck Exp $ +# + + +if [ -z "$JAVA_HOME" ]; then + echo "error: JAVA_HOME not defined"; + exit; +fi + +CERTOOL=at.gv.egovernment.moa.spss.server.tools.CertTool +TOOLSPATH=`dirname $PWD/$0` +CLASSPATH=$TOOLSPATH/tools.jar:$TOOLSPATH/iaik_moa_full.jar:$TOOLSPATH/iaik_jce_full.jar:$TOOLSPATH/iaik_ecc.jar:$TOOLSPATH/log4j-1.2.7.jar + +$JAVA_HOME/bin/java -classpath $CLASSPATH $CERTOOL $* diff --git a/spss/server/serverlib/resources/data/deploy/tools/configtool.bat b/spss/server/serverlib/resources/data/deploy/tools/configtool.bat new file mode 100644 index 000000000..868df11f0 --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tools/configtool.bat @@ -0,0 +1,25 @@ +@echo off + +rem +rem Script to invoke the ConfigTool class +rem +rem Author: Gregor Karlinger +rem Version: $Id: $ +rem + + +if %OS%=="Windows_NT" @setlocal + +set CONFIGTOOL=at.gv.egovernment.moa.spss.server.tools.ConfigTool +set TOOLSPATH=%~p0 +set CLASSPATH=%TOOLSPATH%tools.jar;%TOOLSPATH%xalan.jar; + +if "%JAVA_HOME%"=="" goto noJavaHome +%JAVA_HOME%\bin\java.exe -classpath %CLASSPATH% %CONFIGTOOL% %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto end + +:noJavaHome +echo error: JAVA_HOME not defined + +:end +if %OS%=="Windows_NT" @endlocal \ No newline at end of file diff --git a/spss/server/serverlib/resources/data/deploy/tools/configtool.sh b/spss/server/serverlib/resources/data/deploy/tools/configtool.sh new file mode 100644 index 000000000..f7f29bae1 --- /dev/null +++ b/spss/server/serverlib/resources/data/deploy/tools/configtool.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# +# Script to invoke the ConfigTool class +# +# Author: Gregor Karlinger +# Version: $Id: $ +# + + +if [ -z "$JAVA_HOME" ]; then + echo "error: JAVA_HOME not defined"; + exit; +fi + +CONFIGTOOL=at.gv.egovernment.moa.spss.server.tools.ConfigTool +TOOLSPATH=`dirname $PWD/$0` +CLASSPATH=$TOOLSPATH/tools.jar:$TOOLSPATH/xalan.jar + +$JAVA_HOME/bin/java -classpath $CLASSPATH $CONFIGTOOL $* diff --git a/spss/server/serverlib/resources/licenses/Apache-2.0.txt b/spss/server/serverlib/resources/licenses/Apache-2.0.txt new file mode 100644 index 000000000..57bc88a15 --- /dev/null +++ b/spss/server/serverlib/resources/licenses/Apache-2.0.txt @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/spss/server/serverlib/resources/licenses/IAIK-License.txt b/spss/server/serverlib/resources/licenses/IAIK-License.txt new file mode 100644 index 000000000..c0db63b22 --- /dev/null +++ b/spss/server/serverlib/resources/licenses/IAIK-License.txt @@ -0,0 +1,13 @@ +IAIK MOA Runtime Lizenz + +Stiftung SIC gewährt dem Lizenznehmer eine nicht-exklusive, nicht-übertragbare +Runtime Lizenz für die "IAIK MOA" Module im Kontext von MOA SP/SS und MOA ID. +Alle Versuche, Teile oder die kompletten IAIK Crypto Toolkits, die zusammen +mit dem MOA Produktbündel ausgeliefert werden, für andere Zwecke als jenem +für Applikationen im MOA Kontext zu verwenden, sind nicht erlaubt. Auch weitere +Versuche, die sich auf die Entwicklung von Anwendungen , oder aber darüber hinaus +auf die Schaffung eines eigenen Toolkits, oder die Aufnahme in ein weiters +weiteres Toolkit beziehen, sind nicht erlaubt. +Die hier beschriebene Runtime Lizenz ist nicht übertragbar auf weitere +Vertragspartner des Kunden, Personen, Organisationen oder Unternehmen +außerhalb der Organisation des Lizenznehmers. diff --git a/spss/server/serverlib/resources/licenses/Jaxen.txt b/spss/server/serverlib/resources/licenses/Jaxen.txt new file mode 100644 index 000000000..bef65a520 --- /dev/null +++ b/spss/server/serverlib/resources/licenses/Jaxen.txt @@ -0,0 +1,40 @@ +Copyright 2003 (C) The Werken Company. All Rights Reserved. + + Redistribution and use of this software and associated documentation + ("Software"), with or without modification, are permitted provided + that the following conditions are met: + + 1. Redistributions of source code must retain copyright + statements and notices. Redistributions must also contain a + copy of this document. + + 2. Redistributions in binary form must reproduce the + above copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + + 3. The name "jaxen" must not be used to endorse or promote + products derived from this Software without prior written + permission of The Werken Company. For written permission, + please contact bob@werken.com. + + 4. Products derived from this Software may not be called "jaxen" + nor may "jaxen" appear in their names without prior written + permission of The Werken Company. "jaxen" is a registered + trademark of The Werken Company. + + 5. Due credit should be given to The Werken Company. + (http://jaxen.werken.com/). + + THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/spss/server/serverlib/resources/licenses/PostgreSQL-JDBC.txt b/spss/server/serverlib/resources/licenses/PostgreSQL-JDBC.txt new file mode 100644 index 000000000..30d54d778 --- /dev/null +++ b/spss/server/serverlib/resources/licenses/PostgreSQL-JDBC.txt @@ -0,0 +1,26 @@ +Copyright (c) 1997-2005, PostgreSQL Global Development Group +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +3. Neither the name of the PostgreSQL Global Development Group nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java new file mode 100644 index 000000000..0d7abd1d3 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java @@ -0,0 +1,41 @@ +package at.gv.egovernment.moa.spss; +/** + * Base class of application specific MOA exceptions. + * + * Application exceptions are exceptions that originate from application + * code (e.g. inconsistent data provided by the user, no permission to access + * certain resources, etc.) + * + * @author Patrick Peck + * @version $Id$ + */ +public class MOAApplicationException extends MOAException { + + /** + * Create a new MOAApplicationException. + * + * @param messageId The identifier of the message associated with this + * exception. + * @param parameters Additional message parameters. + */ + public MOAApplicationException(String messageId, Object[] parameters) { + super(messageId, parameters); + } + + /** + * Create a new MOAApplicationException. + * + * @param messageId The identifier of the message associated with this + * MOAApplicationException. + * @param parameters Additional message parameters. + * @param wrapped The exception wrapped by this + * MOAApplicationException. + */ + public MOAApplicationException( + String messageId, + Object[] parameters, + Throwable wrapped) { + super(messageId, parameters, wrapped); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java new file mode 100644 index 000000000..f9eb12d63 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java @@ -0,0 +1,161 @@ +package at.gv.egovernment.moa.spss; +import java.io.PrintStream; +import java.io.PrintWriter; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.util.Constants; + +import at.gv.egovernment.moa.spss.util.MessageProvider; + +/** + * Base class of MOA specific exceptions. + * + * This class has the ability to wrap other exceptions which may be seen + * as the root cause for this exception. A similar mechanism is in place + * since JDK1.4 (see the getClause() method) but will not be used + * because of required compatibility with JDK1.3. + * + * @author Patrick Peck + * @version $Id$ + */ +public abstract class MOAException extends Exception { + /** The message ID. */ + private String messageId; + /** The wrapped Throwable. */ + private Throwable wrapped; + + /** + * Create a MOAException. + * + * @param messageId The message ID of the message contained in the created + * MOAException. + * @param parameters The parameters needed to fill in the message arguments. + */ + public MOAException(String messageId, Object[] parameters) { + super(MessageProvider.getInstance().getMessage(messageId, parameters)); + this.messageId = messageId; + } + + /** + * Create a MOAException. + * + * @param messageId The message ID of the message contained in the created + * MOAException. + * @param parameters The parameters needed to fill in the message arguments. + * @param wrapped The exception wrapped by the created + * MOAException. + */ + public MOAException(String messageId, Object[] parameters, Throwable wrapped) { + + super(MessageProvider.getInstance().getMessage(messageId, parameters)); + this.messageId = messageId; + this.wrapped = wrapped; + } + + /** + * Returns the message ID of this exception. + * + * @return The message ID as provided in the constructor. + */ + public String getMessageId() { + return messageId; + } + + /** + * Returns the exception wrapped by this MOAException. + * + * @return The exception wrapped by this exception. Possibly + * null, if none was provided at construction time. + */ + public Throwable getWrapped() { + return wrapped; + } + + /** + * Convert this MOAException to an ErrorResponse + * element from the MOA namespace. + * + * @return An ErrorResponse element, containing the subelements + * ErrorCode and Info required by the MOA schema. + */ + public Element toErrorResponse() { + DocumentBuilder builder; + DOMImplementation impl; + Document doc; + Element errorResponse; + Element errorCode; + Element info; + + // create a new document + try { + builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + impl = builder.getDOMImplementation(); + } catch (ParserConfigurationException e) { + return null; + } + + // build the ErrorResponse element + doc = impl.createDocument(Constants.MOA_NS_URI, "ErrorResponse", null); + errorResponse = doc.getDocumentElement(); + + // add MOA namespace declaration + errorResponse.setAttributeNS( + Constants.XMLNS_NS_URI, + "xmlns", + Constants.MOA_NS_URI); + + // build the child elements + errorCode = doc.createElementNS(Constants.MOA_NS_URI, "ErrorCode"); + errorCode.appendChild(doc.createTextNode(messageId)); + info = doc.createElementNS(Constants.MOA_NS_URI, "Info"); + info.appendChild(doc.createTextNode(getMessage())); + errorResponse.appendChild(errorCode); + errorResponse.appendChild(info); + return errorResponse; + } + + /** + * Print a stack trace of this exception to System.err. + * + * @see java.lang.Throwable#printStackTrace() + */ + public void printStackTrace() { + printStackTrace(System.err); + } + + /** + * Print a stack trace of this exception, including the wrapped exception. + * + * @param s The stream to write the stack trace to. + * @see java.lang.Throwable#printStackTrace(java.io.PrintStream) + */ + public void printStackTrace(PrintStream s) { + super.printStackTrace(s); + if (getWrapped() != null) { + s.print("Caused by: "); + getWrapped().printStackTrace(s); + } + } + + /** + * Print a stack trace of this exception, including the wrapped exception. + * + * @param s The stream to write the stacktrace to. + * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter) + */ + public void printStackTrace(PrintWriter s) { + super.printStackTrace(s); + if (getWrapped() != null) { + s.print("Caused by: "); + getWrapped().printStackTrace(s); + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java new file mode 100644 index 000000000..0ff175b50 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java @@ -0,0 +1,163 @@ +package at.gv.egovernment.moa.spss; +import java.io.PrintStream; +import java.io.PrintWriter; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.util.MessageProvider; +import at.gv.egovernment.moa.util.Constants; + +/** + * Base class of MOA specific runtime exceptions. + * + * This class has the ability to wrap other exceptions which may be seen + * as the root cause for this exception. A similar mechanism is in place + * since JDK1.4 (see the getClause() method) but will not be used + * because of required compatibility with JDK1.3. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MOARuntimeException extends RuntimeException { + /** The message ID. */ + private String messageId; + /** The wrapped Throwable. */ + private Throwable wrapped; + + /** + * Create a MOAException. + * + * @param messageId The message ID of the message contained in the created + * MOAException. + * @param parameters The parameters needed to fill in the message arguments. + */ + public MOARuntimeException(String messageId, Object[] parameters) { + super(MessageProvider.getInstance().getMessage(messageId, parameters)); + this.messageId = messageId; + } + + /** + * Create a MOAException. + * + * @param messageId The message ID of the message contained in the created + * MOAException. + * @param parameters The parameters needed to fill in the message arguments. + * @param wrapped The exception wrapped by the created + * MOAException. + */ + public MOARuntimeException( + String messageId, + Object[] parameters, + Throwable wrapped) { + + super(MessageProvider.getInstance().getMessage(messageId, parameters)); + this.messageId = messageId; + this.wrapped = wrapped; + } + + /** + * Returns the message ID of this exception. + * + * @return The message ID as provided in the constructor. + */ + public String getMessageId() { + return messageId; + } + + /** + * Returns the exception wrapped by this MOARuntimeException. + * + * @return The exception wrapped by this exception. Possibly + * null, if none was provided at construction time. + */ + public Throwable getWrapped() { + return wrapped; + } + + /** + * Convert this MOARuntimeException to an ErrorResponse + * element from the MOA namespace. + * + * @return An ErrorResponse element, containing the subelements + * ErrorCode and Info required by the MOA schema. + */ + public Element toErrorResponse() { + DocumentBuilder builder; + DOMImplementation impl; + Document doc; + Element errorResponse; + Element errorCode; + Element info; + + // create a new document + try { + builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + impl = builder.getDOMImplementation(); + } catch (ParserConfigurationException e) { + return null; + } + + // build the ErrorResponse element + doc = impl.createDocument(Constants.MOA_NS_URI, "ErrorResponse", null); + errorResponse = doc.getDocumentElement(); + + // add MOA namespace declaration + errorResponse.setAttributeNS( + Constants.XMLNS_NS_URI, + "xmlns", + Constants.MOA_NS_URI); + + // build the child elements + errorCode = doc.createElementNS(Constants.MOA_NS_URI, "ErrorCode"); + errorCode.appendChild(doc.createTextNode(messageId)); + info = doc.createElementNS(Constants.MOA_NS_URI, "Info"); + info.appendChild(doc.createTextNode(getMessage())); + errorResponse.appendChild(errorCode); + errorResponse.appendChild(info); + return errorResponse; + } + + /** + * Print a stack trace of this exception to System.err. + * + * @see java.lang.Throwable#printStackTrace() + */ + public void printStackTrace() { + printStackTrace(System.err); + } + + /** + * Print a stack trace of this exception, including the wrapped exception. + * + * @param s The stream to write the stack trace to. + * @see java.lang.Throwable#printStackTrace(java.io.PrintStream) + */ + public void printStackTrace(PrintStream s) { + super.printStackTrace(s); + if (getWrapped() != null) { + s.print("Caused by: "); + getWrapped().printStackTrace(s); + } + } + + /** + * Print a stack trace of this exception, including the wrapped exception. + * + * @param s The stream to write the stacktrace to. + * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter) + */ + public void printStackTrace(PrintWriter s) { + super.printStackTrace(s); + if (getWrapped() != null) { + s.print("Caused by: "); + getWrapped().printStackTrace(s); + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java new file mode 100644 index 000000000..5a49b6852 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java @@ -0,0 +1,40 @@ +package at.gv.egovernment.moa.spss; +/** + * Base class of technical MOA exceptions. + * + * Technical exceptions are exceptions that originate from system failure (e.g., + * a database connection fails, a component is not available, etc.) + * + * @author Patrick Peck + * @version $Id$ + */ +public class MOASystemException extends MOAException { + + /** + * Create a new MOASystemException. + * + * @param messageId The identifier of the message associated with this + * exception. + * @param parameters Additional message parameters. + */ + public MOASystemException(String messageId, Object[] parameters) { + super(messageId, parameters); + } + + /** + * Create a new MOASystemException. + * + * @param messageId The identifier of the message associated with this + * MOASystemException. + * @param parameters Additional message parameters. + * @param wrapped The exception wrapped by this + * MOASystemException. + */ + public MOASystemException( + String messageId, + Object[] parameters, + Throwable wrapped) { + super(messageId, parameters, wrapped); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java new file mode 100644 index 000000000..a0efa8924 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java @@ -0,0 +1,60 @@ +package at.gv.egovernment.moa.spss.api; + +import org.apache.commons.discovery.tools.DiscoverClass; + +import at.gv.egovernment.moa.spss.MOAException; + +/** + * Configures the SP/SS API. + * + * Also handles dynamic configuration updates. + * + * @author Patrick Peck + * @version $Id$ + */ +public abstract class Configurator { + + /** The default implementation class. */ + private static final String DEFAULT_IMPLEMENTATION = + "at.gv.egovernment.moa.spss.server.init.ConfiguratorImpl"; + + /** The single instance of this class. */ + private static Configurator instance = null; + + public static synchronized Configurator getInstance() { + if (instance == null) { + try { + DiscoverClass discover = new DiscoverClass(); + instance = + (Configurator) discover.newInstance( + Configurator.class, + DEFAULT_IMPLEMENTATION); + } catch (Exception e) { + // this can not happen since we provide a valid default + // implementation + } + } + return instance; + } + + /** + * Initialize the SP/SS configuration. + * + * Only a single call to this method will have an effect. Use + * update() for reflecting changes in the configuration instead. + * + * @throws MOAException An error occurred updating the SP/SS configuration. + */ + public abstract void init() throws MOAException; + + /** + * Update the SP/SS configuration. + * + * This will only have an effect after the system has been initialized once + * using init(). + * + * @throws MOAException An error occurred updating the SP/SS configuration. + */ + public abstract void update() throws MOAException; + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java new file mode 100644 index 000000000..e306127b3 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java @@ -0,0 +1,1012 @@ +package at.gv.egovernment.moa.spss.api; + +import java.io.InputStream; +import java.math.BigInteger; +import java.security.cert.X509Certificate; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import org.apache.commons.discovery.tools.DiscoverClass; + +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; +import at.gv.egovernment.moa.spss.api.common.CheckResult; +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.common.SignerInfo; +import at.gv.egovernment.moa.spss.api.common.Transform; +import at.gv.egovernment.moa.spss.api.common.X509IssuerSerial; +import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; +import at.gv.egovernment.moa.spss.api.common.XPathFilter; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfile; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation; +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.ErrorResponse; +import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse; +import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResultInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; +import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfile; +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter; +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.VerifyTransformsInfoProfile; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; + +/** + * An abstract factory for creating MOA SP/SS API objects. + * + * Use getInstance() to get a concrete factory instance. Using + * this instance, concrete MOA SP/SS API object can be created. + * + * @author Patrick Peck + * @author Gregor Karlinger + * @version $Id$ + */ +public abstract class SPSSFactory { + + /** The default implementation of this class. */ + private static final String DEFAULT_IMPLEMENTATION = + "at.gv.egovernment.moa.spss.api.impl.SPSSFactoryImpl"; + + /** The single instance of this class. */ + private static SPSSFactory instance = null; + + /** + * Returns the single instance of this class. + * + * @return The single instance of this class. + */ + public static synchronized SPSSFactory getInstance() { + if (instance == null) { + try { + DiscoverClass discover = new DiscoverClass(); + instance = + (SPSSFactory) discover.newInstance( + SPSSFactory.class, + DEFAULT_IMPLEMENTATION); + } catch (Exception e) { + // this can not happen since we provide a valid default + // implementation + } + } + return instance; + } + + // + // Factory methods for creating XML signatures + // + + /** + * Create a new CreateXMLSignatureRequest object. + * + * @param keyIdentifier The identifier for the key group to use for signing. + * @param singleSignatureInfos A List of + * SingleSignatureInfo objects containing information about a + * single signature to be created. + * @return The CreateXMLSignatureRequest containing the above + * data. + * + * @pre keyIdentifier != null && keyIdentifier.length() > 0 + * @pre singleSignatureInfos != null + * @pre forall Object o in singleSignatureInfos | + * o instanceof at.gv.egovernment.moa.spss.api.common.SingleSignatureInfo + * @post return != null + */ + public abstract CreateXMLSignatureRequest createCreateXMLSignatureRequest( + String keyIdentifier, + List singleSignatureInfos); + + /** + * Create a new SingleSignatureInfo object. + * + * @param dataObjectInfos The data objects that will be signed (including + * transformations). + * @param createSignatureInfo Information about the signature environment. May + * be null. + * @param securityLayerConform If true, a Security Layer conform + * signature manifest is created, otherwise not. + * @return The SingleSignatureInfo containing the above data. + * + * @pre dataObjectInfos != null && dataObjectInfos.size() > 0 + * @pre forall Object o in dataObjectInfos | + * o instanceof at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo + * @post return != null + */ + public abstract SingleSignatureInfo createSingleSignatureInfo( + List dataObjectInfos, + CreateSignatureInfo createSignatureInfo, boolean securityLayerConform); + + /** + * Create a new DataObjectInfo object. + * + * @param structure The type of signature to create. + * @param childOfManifest If true, references will be returned + * as children of an XMLDsig manifest. Otherwise, they will be returned as + * children of the signature itself. + * @param dataObject The data object that will be signed. + * @param createTransformsInfoProfile Additional transformations to apply + * to the data object. + * @return The DataObjectInfo containing the above data. + * + * @pre DataObjectInfo.STRUCTURE_DETACHED.equals(structure) || + * DataObjectInfo.STRUCTURE_ENVELOPING.equals(structure) + * @pre dataObject != null + * @pre createTransformsInfoProfile != null + * @post return != null + */ + public abstract DataObjectInfo createDataObjectInfo( + String structure, + boolean childOfManifest, + Content dataObject, + CreateTransformsInfoProfile createTransformsInfoProfile); + + /** + * Create a new CreateTransformsInfoProfile object containing a + * reference to a locally stored profile. + * + * @param profileID The profile ID to resolve during signature creation. + * @return The CreateTransformsInfoProfile containing the given + * profile ID. + * + * @pre profileID != null && profileID.length() > 0 + * @post return != null + */ + public abstract CreateTransformsInfoProfile createCreateTransformsInfoProfile(String profileID); + + /** + * Create a new CreateTransformsInfoProfile object by providing + * the profile data explicitly. + * + * @param transformsInfo The transformations to apply to the associated + * data object. + * @param supplements Supplemental information for the transformation. May be + * null. + * @return The CreateTransformsInfoProfile containing the above + * data. + * + * @pre transformsInfo != null + * @pre supplements != null implies + * forall Object o in supplements | + * o instanceof at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation + * @post return != null + */ + public abstract CreateTransformsInfoProfile createCreateTransformsInfoProfile( + CreateTransformsInfo transformsInfo, + List supplements); + + /** + * Create a new CreateTransformsInfo object. + * + * @param transforms The Transforms to apply to the associated + * data object. May be null. + * @param finalDataMetaInfo Information about the type of the transformed + * data. + * @return The CreateTransformsInfo containing the above data. + * + * @pre transforms != null implies transforms.size > 0 + * @pre transforms != null implies + * forall Object o in transforms | + * o instanceof at.gv.egovernment.moa.spss.api.common.Transform + * @pre finalDataMetaInfo != null + * @post return != null + */ + public abstract CreateTransformsInfo createCreateTransformsInfo( + List transforms, + MetaInfo finalDataMetaInfo); + + /** + * Create a new CreateSignatureInfo object. + * + * @param createSignatureEnvironment The signature environment that will + * contain the signature. + * @param createSignatureEnvironmentProfile Additional information about + * the signture environment. + * @return The CreateSignatureInfo containing the above data. + * + * @pre createSignatureEnvironment != null + * @pre createSignatureEnvironmentProfile != null + * @post return != null + */ + public abstract CreateSignatureInfo createCreateSignatureInfo( + Content createSignatureEnvironment, + CreateSignatureEnvironmentProfile createSignatureEnvironmentProfile); + + /** + * Create a new CreateSignatureEnvironmentProfile object + * containing a reference to a locally stored profile. + * + * @param profileID The profile ID to resolve during signature creation. + * @return The CreateSignatureEnvironmentProfile containing + * the given profile ID. + * + * @pre profileID != null && profileID.length() > 0 + * @post return != null + */ + public abstract CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile(String profileID); + + /** + * Create a new CreateSignatureEnvironmentProfile object by + * providing the profile data explicitly. + * + * @param createSignatureLocation The location where the signature will be + * inserted. + * @param supplements Additional information about the signature environment. + * @return The CreateSignatureEnvironmentProfile containing the + * above data. + * + * @pre createSignatureLocation != null + * @pre supplements != null + * @pre forall Object o in supplements | + * o instanceof at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation + * @post return != null + */ + public abstract CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile( + CreateSignatureLocation createSignatureLocation, + List supplements); + + /** + * Create a new CreateSignatureLocation object. + * + * @param xPathExpression The XPath expression to select the signature + * parent element within the signature environment. + * @param index The index of the node, after which the signature will be + * inserted. + * @param namespaceDeclarations The namespace prefix to URI mapping to apply + * while evaluating the XPath expression. + * @return The CreateSignatureLocation containing the above data. + * + * @pre xPathExpression != null + * @pre index >= 0 + * @pre namespaceDeclarations != null + */ + public abstract CreateSignatureLocation createCreateSignatureLocation( + String xPathExpression, + int index, + Map namespaceDeclarations); + + /** + * Create a new CreateXMLSignatureResponse object. + * + * @param responseElements The elements of the response, either + * SignatureEnvironmentResponse objects, or + * ErrorResponse objects. + * @return The new CreateXMLSignatureResponse containing the + * above data. + * + * @pre responseElements != null && responseElements.size() > 0 + * @pre forall Object o in responseElements | + * o instanceof at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureResponseElement + * @post return != null + */ + public abstract CreateXMLSignatureResponse createCreateXMLSignatureResponse(List responseElements); + + /** + * Create a new SignatureEnvironmentResponse object. + * + * @param signatureEnvironment The signature environment containing the + * signature. + * @return The SignatureEnvironmentResponse containing the + * signatureEnvironment. + * + * @pre signatureEnvironment != null + * @post return != null + */ + public abstract SignatureEnvironmentResponse createSignatureEnvironmentResponse(Element signatureEnvironment); + + /** + * Create a new ErrorResponse object. + * + * @param code The numerical error code. + * @param info Verbose error information. + * @return The new ErrorResponse containing the above data. + * + * @pre code > 0 + * @pre info != null + * @post return != null + */ + public abstract ErrorResponse createErrorResponse(int code, String info); + + // + // Factory methods for verifying CMS signatures + // + + /** + * Create a new VerifyCMSSignatureRequest object. + * + * @param signatories The indexes of the signatories whose signature is to + * be verified. + * @param dateTime The date for which the verification is to be performed. + * May be null. + * @param cmsSignature The CMS signature. + * @param dataObject The signed data. May be null. + * @param trustProfileID The ID of the trust profile containing the trusted + * root certificates. + * @return The VerifyCMSSignatureRequest containing the above + * data. + * + * @pre signatories != null && signatories.length > 0 + * @pre signaturies != VerifyCMSSignatureRequest.ALL_SIGNATORIES implies + * for (int i = 0; i < signatories.length; i++) + * signatories[i] >= 1 + * @pre cmsSignature != null + * @pre trustProfileID != null && trustProfileID.length() > 0 + * @post return != null + */ + public abstract VerifyCMSSignatureRequest createVerifyCMSSignatureRequest( + int[] signatories, + Date dateTime, + InputStream cmsSignature, + CMSDataObject dataObject, + String trustProfileID); + + /** + * Create a new CMSDataObject object from data at a given URI. + * + * @param metaInfo Type information about the CMSDataObject. + * May be null. + * @param content The CMS content containing the data. + * @return The new CMSDataObject containing the data. + * + * @pre referenceURI != null + * @pre content != null + * @post return != null + */ + public abstract CMSDataObject createCMSDataObject( + MetaInfo metaInfo, + CMSContent content); + + /** + * Create a new CMSContent object from the data contained at the + * given URI. + * + * @param referenceURI The URI identifying the data. Must be resolvable. + * @return The CMSContent containing a reference to the signed + * data. + * + * @pre referenceURI != null + * @post return != null + */ + public abstract CMSContent createCMSContent(String referenceURI); + + /** + * Create a new CMSContent object from a byte stream. + * + * @param binaryContent The byte stream containing the signed data. + * @return The new CMSContent containing the data from the + * byte stream. + * + * @pre binaryContent != null + * @post return != null + */ + public abstract CMSContent createCMSContent(InputStream binaryContent); + + /** + * Create a new VerifyCMSSignatureResponse object. + * + * @param responseElements Verification information about each signature. + * @return The new VerifyCMSSignatureResponse containing the + * status of signature verification for each signature contained in the + * request. + * + * @pre responseElements != null && responseElements.size() > 0 + * @pre forall Object o in responseElements | + * o instanceof at.gv.egovernment.moa.spss.api.cmssign.VerifyCMSSignatureResponseElement + * @post return != null + */ + public abstract VerifyCMSSignatureResponse createVerifyCMSSignatureResponse(List responseElements); + + /** + * Create a new VerifyCMSSignatureResponseElement object. + * + * @param signerInfo Information about the signer certificate. + * @param signatureCheck Result of the singature value check. + * @param certificateCheck Result of the certificate status check. + * @return The new VerifyCMSSignatureResponseElement containing + * the above data. + * + * @pre signerInfo != null && signatureCheck != null && + * certificateCheck != null + * @post return != null + */ + public abstract VerifyCMSSignatureResponseElement createVerifyCMSSignatureResponseElement( + SignerInfo signerInfo, + CheckResult signatureCheck, + CheckResult certificateCheck); + + // + // Factory methods for verifying XML signatures + // + + /** + * Create a new VerifyXMLSignatureRequest object. + * + * @param dateTime The date for which the verification is to be performed. + * May be null. + * @param verifySignatureInfo Information about the signature environment and + * the location of the signature. + * @param supplementProfiles Supplemental information for the signature + * environment. May be null. + * @param signatureManifestParams Additional information for checking the + * signature manifest. May be null. + * @param returnHashInputData If true, hash input data will + * be returned in the response, otherwise not. + * @param trustProfileID The ID of the trust profile containing the trusted + * root certificates. + * @return The new VerifyXMLSignatureRequest containing the + * above data. + * + * @pre verifySignatureInfo != null + * @pre supplementProfiles != null implies + * forall Object o in supplementProfiles | + * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfile + * @pre trustProfileID != null && trustProfileID.length() > 0 + * @post return != null + */ + public abstract VerifyXMLSignatureRequest createVerifyXMLSignatureRequest( + Date dateTime, + VerifySignatureInfo verifySignatureInfo, + List supplementProfiles, + SignatureManifestCheckParams signatureManifestParams, + boolean returnHashInputData, + String trustProfileID); + + /** + * Create a new VerifySignatureInfo object. + * + * @param verifySignatureEnvironment The signature environment containing + * the signature to be verified. + * @param verifySignatureLocation The location of the signature within the + * signature environment. + * @return The new VerifySignatureInfo containing the above data. + * + * @pre verifySignatureEnvironment != null + * @pre verifySignatureLocation != null + * @post return != null + */ + public abstract VerifySignatureInfo createVerifySignatureInfo( + Content verifySignatureEnvironment, + VerifySignatureLocation verifySignatureLocation); + + /** + * Create a new VerifySignatureLocation object. + * + * @param xPathExpression The XPath expression to select the signature + * element within the signature environment. + * @param namespaceDeclarations The namespace prefix to URI mapping to apply + * while evaluating the XPath expression. + * @return The new VerifySignatureLocation containing the above + * data. + * + * @pre xPathExpression != null + * @pre namespaceDeclarations != null + * @post return != null + */ + public abstract VerifySignatureLocation createVerifySignatureLocation( + String xPathExpression, + Map namespaceDeclarations); + + /** + * Create a new SupplementProfile object containing a reference + * to a locally stored profile. + * + * @param profileID The profile ID to resolve during signature verification. + * @return The SupplementProfile containing the profile ID. + * + * @pre profileID != null && profileID.length() > 0 + * @post return != null + */ + public abstract SupplementProfile createSupplementProfile(String profileID); + + /** + * Create a new SupplementProfile object by providing the profile + * data explicitly. + * + * @param supplementProfile The profile data. + * @return The SupplementProfile containing the profile data. + */ + public abstract SupplementProfile createSupplementProfile(XMLDataObjectAssociation supplementProfile); + + /** + * Create a new SignatureManifestCheckParams object. + * + * @param referenceInfos Information for checking the validity of a + * a reference. + * @param returnReferenceInputData If true, the input data to + * the calculation of reference digest values will be returned in the + * response, otherwise not. + * @return The SignatureManifestCheckParams containing the + * above data. + * + * @pre referenceInfos != null && referenceInfos.size() > 0 + * @pre forall Object o in referenceInfos | + * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo + * @post return != null + */ + public abstract SignatureManifestCheckParams createSignatureManifestCheckParams( + List referenceInfos, + boolean returnReferenceInputData); + + /** + * Create a new ReferenceInfo object. + * + * @param verifyTransformsInfoProfiles The transformation profiles valid for + * the associated reference. + * @return The ReferenceInfo containing the transformation + * profiles. + * + * @pre verifyTransformsInfoProfiles != null && + * verifyTransformsInfoProfiles.size() > 0 + * @pre forall Object o in verifyTransformsInfoProfiles | + * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfile + * @post return != null + */ + public abstract ReferenceInfo createReferenceInfo(List verifyTransformsInfoProfiles); + + /** + * Create a new VerifyTransformsInfoProfile object containing + * a reference to a locally stored profile. + * + * @param profileID The profile ID to resolve during signature verification. + * @return The VerifyTransformsInfoProfile containing the + * given profile ID. + * + * @pre profileID != null && profileID.length() > 0 + * @post return != null + */ + public abstract VerifyTransformsInfoProfile createVerifyTransformsInfoProfile(String profileID); + + /** + * Create a new VerifyTransformsInfoProfile object by providing + * the profile data explicitly. + * + * @param transforms A valid chain of transformations for the reference. + * May be null. + * @param transformParameters Additional transformation information. + * @return The VerifyTransformsInfoProfile containing the above + * data. + * + * @pre transforms != null implies + * (transforms.size() > 0 && + * forall Object o in transforms | o instanceof Transform) + * @pre transformParameters != null implies + * forall Object o in transformParameters | + * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter + * @post return != null + */ + public abstract VerifyTransformsInfoProfile createVerifyTransformsInfoProfile( + List transforms, + List transformParameters); + + /** + * Create a new TransformParameter object with the data + * contained at the given URI. + * + * @param URI The URI identifying the data. The URI will be resolved during + * signature verification. + * @return The TransformParameter containing the URI of the + * data. + * + * @pre URI != null + * @post return != null + */ + public abstract TransformParameter createTransformParameter(String URI); + + /** + * Creata a new TransformParameter object containing the + * binary data. + * + * @param URI The URI identifying the data. + * @param binaryData The binary data. + * @return The TransformParameter containig the binary data. + * + * @pre URI != null + * @pre binary != null + * @post return != null + */ + public abstract TransformParameter createTransformParameter( + String URI, + InputStream binaryData); + + /** + * Create a new TransformParameter object containing the hash + * value of the transformation data. + * + * @param URI The URI identifying the data. It will be resolved during + * signature verification. + * @param digestMethod The digest method used for calculating the digest + * value. + * @param digestValue The hash value of the transformation data. + * @return The TransformParameter containing the above data. + * + * @pre URI != null + * @pre digestMethod != null + * @pre digestValue != null + */ + public abstract TransformParameter createTransformParameter( + String URI, + String digestMethod, + byte[] digestValue); + + /** + * Create a new VerifyXMLSignatureResponse object. + * + * @param signerInfo Information about the signer certificate. + * @param hashInputDatas The signed data objects. May be null. + * @param referenceInputDatas The reference input data objects. + * May be null. + * @param signatureCheck Status information about the signature check. + * @param signatureManifestCheck Status information about the signature + * manifest check. + * @param xmlDsigManifestChecks Status information about each XMLDsig manifest + * check. + * @param certificateCheck Status information about the signer certificate + * check. + * @return The VerifyXMLSignatureResponse containing the above + * data. + * + * @pre signerInfo != null + * @pre hashInputDatas != null implies + * forall Object o in hashInputDatas | + * o instanceof at.gv.egovernment.moa.spss.api.common.Content + * @pre referenceInputDatas != null implies + * forall Object o in referenceInputDatas | + * o instanceof at.gv.egovernment.moa.spss.api.common.Content + * @pre signatureCheck != null + * @pre xmlDsigManifestChecks != null implies + * forall Object o in xmlDsigManifestChecks | + * o instanceof at.gv.egovernment.moa.spss.api.xmlverifyManifestRefsCheckResult + * @pre certificateCheck != null + * @post return != null + */ + public abstract VerifyXMLSignatureResponse createVerifyXMLSignatureResponse( + SignerInfo signerInfo, + List hashInputDatas, + List referenceInputDatas, + ReferencesCheckResult signatureCheck, + ReferencesCheckResult signatureManifestCheck, + List xmlDsigManifestChecks, + CheckResult certificateCheck); + + /** + * Create a new ReferencesCheckResult object. + * + * @param code The status code. + * @param info Additional information about the reference check. + * @return The ReferencesCheckResult containing the above data. + * + * @pre code >= 0 + * @post return != null + */ + public abstract ReferencesCheckResult createReferencesCheckResult( + int code, + ReferencesCheckResultInfo info); + + /** + * Create a new ReferencesCheckResultInfo object. + * + * @param anyOtherInfo Arbitrary XML content describing the check result. + * May be null. + * @param failedReferences The indexes of the failed references. May be + * null. + * @return The ReferencesCheckResultInfo containing the above + * data. + * + * @post return != null + */ + public abstract ReferencesCheckResultInfo createReferencesCheckResultInfo( + NodeList anyOtherInfo, + int[] failedReferences); + + /** + * Create a new ManifestRefsCheckResult object. + * + * @param code The status code. + * @param info Additional information about the manifest check. May be + * null. + * @return The ManifestRefsCheckResult containing the above + * data. + * + * @pre code >= 0 + * @post return != null + */ + public abstract ManifestRefsCheckResult createManifestRefsCheckResult( + int code, + ManifestRefsCheckResultInfo info); + + /** + * Create a new ManifestRefsCheckResultInfo object. + * + * @param anyOtherInfo Arbitrary XML content describing the check result. + * May be null. + * @param failedReferences The indexes of the failed references. May be + * null. + * @param referringSigReference The index of the reference in the signature. + * @return The ManifestRefsCheckResultInfo containing the + * above data. + * + * @pre referringSigReference > 0 + * @post return != null + */ + public abstract ManifestRefsCheckResultInfo createManifestRefsCheckResultInfo( + NodeList anyOtherInfo, + int[] failedReferences, + int referringSigReference); + + // + // Factory methods for common objects + // + + /** + * Create a new Content object referencing data via a URI. + * + * @param referenceURI The URI pointing to the content. + * @return The Content object containing the reference. + * + * @pre referenceURI != null && referenceURI.length() > 0 + * @post return != null + */ + public abstract Content createContent(String referenceURI); + + /** + * Create a new Content object containing binary data. + * + * @param binaryData An InputStream containing the binary data. + * @param referenceURI An URI identifying the data. May be null. + * @return The Content object containing the data. + * + * @pre binaryData != null + * @post return != null + */ + public abstract Content createContent( + InputStream binaryData, + String referenceURI); + + /** + * Create a new Content object containing location reference data. + * + * @param locationReferenceURI a URI pointing to the actual remote location of the content. + * + * @param referenceURI An URI identifying the data. May be null. + * + * @return The Content object containing the data. + * + * @pre locationReferenceURI != null + * @post return != null + */ + public abstract Content createContent( + String locationReferenceURI, + String referenceURI); + + /** + * Create a new Content object containing XML data. + * + * @param xmlData The XML data contained in the new Content. + * @param referenceURI An URI identifying the data. May be null. + * @return The Content object containing the data. + * + * @pre xmlData != null + * @post return != null + */ + public abstract Content createContent(NodeList xmlData, String referenceURI); + + /** + * Create a new XMLDataObjectAssociation object. + * + * @param metaInfo Information about the content type. May be + * null. + * @param content The Content object containing the data. + * @return The XMLDataObjectAssociation containing the above + * data. + * + * @pre content != null + * @pre content.getContentType() == Content.CONTENT_XML || + * content.getContentType() == Contetn.CONTENT_BINARY + * @pre content.getReference() != null + * @post return != null + */ + public abstract XMLDataObjectAssociation createXMLDataObjectAssociation( + MetaInfo metaInfo, + Content content); + + /** + * Create a new MetaInfo object. + * + * @param mimeType The MIME type part of the meta information. + * @param description Descriptive meta information. May be null. + * @param otherInfo XML meta information. May be null. + * @param type Type information for XML signature creation. May be null. + * @return The MetaInfo object containing the above data. + * + * @pre mimeType != null && mimeType.length() > 0 + * @pre otherInfo != null implies + * forall Node n in otherInfo | n.getNodeType() == Node.ELEMENT + */ + public abstract MetaInfo createMetaInfo( + String mimeType, + String description, + NodeList otherInfo, + String type); + + /** + * Create a CanonicalizationTransform type of Transform. + * + * @param algorithmURI The algorithm URI of the canonicalization. + * @return The created CanonicalizationTransform object. + * + * @pre CanonicalizationTransform.CANONICAL_XML.equals(algorithmURI) || + * CanonicalizationTransform.CANONICAL_XML_WITH_COMMENTS.equals(algorithmURI) + * @post return != null + */ + public abstract Transform createCanonicalizationTransform(String algorithmURI); + + /** + * Create an ExclusiveCanonicalizationTransform type of + * Transform. + * + * @param algorithmURI The algorithm URI of the exclusive canonicalization. + * @param inclusiveNamespacePrefixes The prefixes of the namespaces to + * treat according to canonical XML. + * @return The new ExclusiveCanonicalizationTransform + * + * @pre ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML.equals(algorithmURI) || + * ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS.equals(algorithmURI) + * @pre inclusiveNamespacePrefixes != null + * @pre forall Object o in inclusiveNamespacePrefixes | o instanceof String + * @post return != null + */ + public abstract Transform createExclusiveCanonicalizationTransform( + String algorithmURI, + List inclusiveNamespacePrefixes); + + /** + * Create a Base64Transform type of Transform. + * + * @return A Transform denoting a Base64 decoding. + * + * @post return != null + */ + public abstract Transform createBase64Transform(); + + /** + * Create a EnvelopedSignatureTransform type of + * Transform. + * + * @return A Transform denoting an enveloped signature. + * + * @post return != null + */ + public abstract Transform createEnvelopedSignatureTransform(); + + /** + * Create an XSLTTransform type of Transform. + * + * @param styleSheet The XSLT stylesheet contained in the + * Transform. + * @return A Transform containing the XSLT stylesheet. + * + * @post return != null + */ + public abstract Transform createXSLTTransform(Element styleSheet); + + /** + * Create an XPathTransform type of Transform. + * + * @param xPathExpression The XPath expression to use in the created + * Transform. + * @param namespaceDeclarations The namespace prefix to URI mapping to + * apply on evaluation of the XPath expression. + * @return The XPathTransform containing the above data. + * + * @pre xPathExpression != null + * @pre namespaceDeclarations != null + * @post return != null + */ + public abstract Transform createXPathTransform( + String xPathExpression, + Map namespaceDeclarations); + + /** + * Create a new XPathFilter2Transform type of + * Transform. + * + * @param xPathFilters The filters contained in the newly created + * XPathFilter2Transform. + * @return The XPathFilter2Transform containing the given + * filters. + * + * @pre xPathFilters != null && + * forall Object o in xPathFilters | + * o instanceof at.gv.egovernment.moa.spss.api.common.XPathFilter + * @post return != null + */ + public abstract Transform createXPathFilter2Transform(List xPathFilters); + + /** + * Create a new XPathFilter object. + * + * @param filterType The type of filter. + * @param xPathExpression The XPath expression contained in this filter. + * @param namespaceDeclarations The namespace prefix to URI mapping to apply + * on evaluation of the XPath expression. + * @return The XPathFilter containing the above data. + * + * @pre XPathFilter.SUBTRACT_TYPE.equals(filterType) || + * XPathFilter.INTERSECT_TYPE.equals(filterType) || + * XPathFilter.UNION_TYPE.equals(filterType) + * @pre xPathExpression != null + * @pre namespaceDeclarations != null + * @post return != null + */ + public abstract XPathFilter createXPathFilter( + String filterType, + String xPathExpression, + Map namespaceDeclarations); + + /** + * Create a new CheckResult object. + * + * @param code The check code. + * @param info Verbose information about the check. May be null. + * @return The CheckResult containing the above data. + * + * @pre code >= 0 + * @post return != null + */ + public abstract CheckResult createCheckResult(int code, NodeList info); + + /** + * Create a new SignerInfo object. + * + * @param signerCertificate The signer certificate in binary form. + * @param qualifiedCertificate true, if the signer certificate is + * a qualified certificate, otherwise false. + * @param publicAuthority true, if the signer certificate is a + * public authority certificate, otherwise false. + * @param publicAuthorityID The identification of the public authority + * (if publicAuthority is true). May be + * null. + * @return The SignerInfo containing the above data. + * + * @pre signerCertSubjectName != null + * @pre signerCertIssuerSerial != null + * @pre signerCertificate != null + */ + public abstract SignerInfo createSignerInfo( + X509Certificate signerCertificate, + boolean qualifiedCertificate, + boolean publicAuthority, + String publicAuthorityID); + + /** + * Create a new X509IssuerSerial object. + * + * @param issuerName The distinguished name of the issuer. + * @param issuerSerial The certificate serial number. + * @return The X509IssuerSerial containing the above data. + * + * @pre issuerName != null + * @pre issuerSerial != null + */ + public abstract X509IssuerSerial createX509IssuerSerial( + String issuerName, + BigInteger issuerSerial); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java new file mode 100644 index 000000000..a84ca2a83 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java @@ -0,0 +1,57 @@ +package at.gv.egovernment.moa.spss.api; + +import at.gv.egovernment.moa.spss.MOAException; + +import org.apache.commons.discovery.tools.DiscoverClass; + + +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; + +/** + * Interface providing functions for signature creation. + * + * @author Patrick Peck + * @version $Id$ + */ +public abstract class SignatureCreationService { + + /** The default implementation class. */ + private static final String DEFAULT_IMPLEMENTATION = + "at.gv.egovernment.moa.spss.server.invoke.SignatureCreationServiceImpl"; + + /** The single instance of this class. */ + private static SignatureCreationService instance = null; + + /** + * Get an instance of the SignatureCreationService. + * + * @return A concrete instance of the SignatureCreationService. + */ + public static synchronized SignatureCreationService getInstance() { + if (instance == null) { + try { + DiscoverClass discover = new DiscoverClass(); + instance = + (SignatureCreationService) discover.newInstance( + SignatureCreationService.class, + DEFAULT_IMPLEMENTATION); + } catch (Exception e) { + // this can not happen since we provide a valid default + // implementation + } + } + return instance; + } + + /** + * Create an XML signature. + * + * @param request Information on how to create the signature. + * @return A CreateXMLSignatureResponse containing the + * signature. + * @throws MOAException Error in server side MOA module. + */ + public abstract CreateXMLSignatureResponse createXMLSignature(CreateXMLSignatureRequest request) + throws MOAException; +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java new file mode 100644 index 000000000..d0fcb029a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java @@ -0,0 +1,69 @@ +package at.gv.egovernment.moa.spss.api; + +import org.apache.commons.discovery.tools.DiscoverClass; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; + +/** + * Interface providing functions for verifying signatures. + * + * @author Patrick Peck + * @version $Id$ + */ +public abstract class SignatureVerificationService { + + /** The default implementation class. */ + private static final String DEFAULT_IMPLEMENTATION = + "at.gv.egovernment.moa.spss.server.invoke.SignatureVerificationServiceImpl"; + + /** The single instance of this class. */ + private static SignatureVerificationService instance = null; + + /** + * Get an instance of the SignatureVerificationService. + * + * @return A concrete instance of the + * SignatureVerificationService. + */ + public static synchronized SignatureVerificationService getInstance() { + if (instance == null) { + try { + DiscoverClass discover = new DiscoverClass(); + instance = + (SignatureVerificationService) discover.newInstance( + SignatureVerificationService.class, + DEFAULT_IMPLEMENTATION); + } catch (Exception e) { + // this can not happen since we provide a valid default + // implementation + } + } + return instance; + } + + /** + * Verify a CMS signature. + * + * @param request Detailed information on the verification that should be + * performed. + * @return A VerifyCMSSignatureResponse object that contains + * information about the performed verification. + * @throws MOAException Error in server side MOA module. + */ + public abstract VerifyCMSSignatureResponse verifyCMSSignature(VerifyCMSSignatureRequest request) + throws MOAException; + /** + * Verfiy an XML Signature. + * + * @param request information on the verification that should be performed. + * @return A VerifyXMLSignatureResponse object that contains + * information about the performed verification. + * @throws MOAException Error in server side MOA module. + */ + public abstract VerifyXMLSignatureResponse verifyXMLSignature(VerifyXMLSignatureRequest request) + throws MOAException; +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java new file mode 100644 index 000000000..b4ecb3937 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java @@ -0,0 +1,28 @@ +package at.gv.egovernment.moa.spss.api.cmsverify; + +/** + * Base class for objects containing CMS content. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CMSContent { + /** + * Indicates that this object contains a reference to the CMS content. + */ + public static final int REFERENCE_CONTENT = 0; + /** + * Indicates that this object contains the CMS content explicitly. + */ + public static final int EXPLICIT_CONTENT = 1; + + /** + * Gets the type of the contained content. + * + * @return The type of content, either REFERENCE_CONTENT or + * EXPLICIT_CONTENT. + */ + public int getContentType(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java new file mode 100644 index 000000000..58c2b0259 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java @@ -0,0 +1,19 @@ +package at.gv.egovernment.moa.spss.api.cmsverify; + +import java.io.InputStream; + +/** + * Encapsulates binary CMS content. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CMSContentExcplicit extends CMSContent { + /** + * Gets the content as a stream. + * + * @return A stream containing the binary content. + */ + public InputStream getBinaryContent(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java new file mode 100644 index 000000000..7c4e6d913 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java @@ -0,0 +1,17 @@ +package at.gv.egovernment.moa.spss.api.cmsverify; + +/** + * Encapsulates CMS content that is referenced by an URI. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CMSContentReference extends CMSContent { + /** + * Gets the reference URI from wher the content can be retrieved. + * + * @return The reference URI. + */ + public String getReference(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java new file mode 100644 index 000000000..37f6fd396 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.cmsverify; + +import at.gv.egovernment.moa.spss.api.common.MetaInfo; + +/** + * A data object used for verification of CMS signatures. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CMSDataObject { + /** + * Gets the meta information of the content. + * + * @return An object containig the meta information. + */ + public MetaInfo getMetaInfo(); + /** + * Gets the actual content of the data object. + * + * @return The actual content. + */ + public CMSContent getContent(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java new file mode 100644 index 000000000..6d1f389af --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java @@ -0,0 +1,52 @@ +package at.gv.egovernment.moa.spss.api.cmsverify; + +import java.io.InputStream; +import java.util.Date; + +/** + * Object that encapsulates a request to verify a CMS signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface VerifyCMSSignatureRequest { + /** + * Indicates, that signature checks for all signatories must be returned. + */ + public static int[] ALL_SIGNATORIES = new int[] { -1 }; + /** + * Gets the positions of signatories whose signature must be verified. + * + * @return The positions of signatories. + */ + public int[] getSignatories(); + /** + * Gets the date and time for which the signature verification has to + * be performed. + * + * @return Date and time for which the signature verification has + * to be performed. + */ + public Date getDateTime(); + /** + * Gets the binary CMS signature. + * + * @return An InputStream from which the binary CMS signature + * can be read. + */ + public InputStream getCMSSignature(); + /** + * Gets the data object necessary for the verification. + * + * @return The data object necessary for verification. + */ + public CMSDataObject getDataObject(); + /** + * Gets the profile ID of trusted certificates to be used for signature + * verification. + * + * @return The profile ID of trusted certificates. + */ + public String getTrustProfileId(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java new file mode 100644 index 000000000..5f2e6d255 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java @@ -0,0 +1,21 @@ +package at.gv.egovernment.moa.spss.api.cmsverify; + +import java.util.List; + + +/** + * Object that encapsulates the response on a request to verify a CMS + * signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface VerifyCMSSignatureResponse { + /** + * Gets the response elements. + * + * @return The response elements. + */ + public List getResponseElements(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java new file mode 100644 index 000000000..49ddb9419 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java @@ -0,0 +1,32 @@ +package at.gv.egovernment.moa.spss.api.cmsverify; + +import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.SignerInfo; + +/** + * Contains detailed information about the verification of a signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface VerifyCMSSignatureResponseElement { + /** + * Gets a SignerInfo element according to CMS. + * + * @return The SignerInfo element according to CMS. + */ + public SignerInfo getSignerInfo(); + /** + * Gets the result of the signature verification. + * + * @return The result of the signature verification. + */ + public CheckResult getSignatureCheck(); + /** + * Gets the result of the certificate verification. + * + * @return The result of the certificate verification. + */ + public CheckResult getCertificateCheck(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java new file mode 100644 index 000000000..94785727d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java @@ -0,0 +1,13 @@ +package at.gv.egovernment.moa.spss.api.common; + +/** + * A Transform performing a Base64 decoding. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface Base64Transform extends Transform { + /** Algorithm URI of the Base64 Transform type. */ + public static final String BASE64_DECODING = + "http://www.w3.org/2000/09/xmldsig#base64"; +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java new file mode 100644 index 000000000..352461e52 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java @@ -0,0 +1,17 @@ +package at.gv.egovernment.moa.spss.api.common; + +import at.gv.egovernment.moa.util.Constants; + +/** + * A canonicalization type of Transform. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface CanonicalizationTransform extends Transform { + /** Algorithm URI of canonical XML. */ + public static final String CANONICAL_XML = Constants.C14N_URI; + /** Algorithm URI of canonical XML with comments. */ + public static final String CANONICAL_XML_WITH_COMMENTS = + Constants.C14N_WITH_COMMENTS_URI; +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java new file mode 100644 index 000000000..974483d82 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.common; + +import org.w3c.dom.NodeList; + +/** + * Object encapsulating the result of a signature verification. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CheckResult { + /** + * Gets the result code. + * + * @return The result code. + */ + public int getCode(); + /** + * Gets descriptive information. + * + * @return Descriptive information. + */ + public NodeList getInfo(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java new file mode 100644 index 000000000..0777c3d65 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java @@ -0,0 +1,47 @@ +package at.gv.egovernment.moa.spss.api.common; + +/** + * Encapsulates content data. + * + * @author Patrick Peck + * @author Stephan Grill + * @author Gregor Karlinger + * @version $Id$ + */ +public interface Content { + + /** + * Indicates that this object contains a URI reference to some content. + */ + public static final int REFERENCE_CONTENT = 0; + + /** + * Indicates that this object contains binary content. + */ + public static final int BINARY_CONTENT = 1; + + /** + * Indicates that this object contains XML content. + */ + public static final int XML_CONTENT = 2; + + /** + * Indicates that this object contains a location reference content. + */ + public static final int LOCREF_CONTENT = 3; + + /** + * Gets the type of content contained in this object. + * + * @return The type of content, one of BINARY_CONTENT, XML_CONTENT, + * REFERENCE_CONTENT or LOCREF_CONTENT. + */ + public int getContentType(); + + /** + * Gets the reference to the content data (a URI). + * + * @return The reference to the content data. + */ + public String getReference(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java new file mode 100644 index 000000000..664afa406 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java @@ -0,0 +1,21 @@ +package at.gv.egovernment.moa.spss.api.common; + +import java.io.InputStream; + +/** + * Encapsulates binary content. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface ContentBinary extends Content { + /** + * Get the binary content. + * + * @return An InputStream from which the binary content can + * be read. + */ + public InputStream getBinaryContent(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java new file mode 100644 index 000000000..f640f2b92 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java @@ -0,0 +1,17 @@ +package at.gv.egovernment.moa.spss.api.common; + +/** + * Encapsulates location reference content. + * + * @author Gregor Karlinger + * @version $Id$ + */ +public interface ContentLocRef extends Content +{ + /** + * Gets the location reference URI pointing to the actual remote location of the content. + * + * @return the location reference URI. + */ + public String getLocationReferenceURI(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java new file mode 100644 index 000000000..c10f0c2f8 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java @@ -0,0 +1,11 @@ +package at.gv.egovernment.moa.spss.api.common; + +/** + * Content containing a reference to content data. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface ContentReference extends Content { + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java new file mode 100644 index 000000000..ad5930452 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java @@ -0,0 +1,19 @@ +package at.gv.egovernment.moa.spss.api.common; + +import org.w3c.dom.NodeList; + +/** + * Encapsulates arbitrary XML content. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface ContentXML extends Content { + /** + * Gets the XML content stored in this object. + * + * @return The XML content. + */ + public NodeList getXMLContent(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java new file mode 100644 index 000000000..862cb84da --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java @@ -0,0 +1,28 @@ +package at.gv.egovernment.moa.spss.api.common; + +import java.util.Map; + +/** + * A class containing data for selecting single elements using an XPath + * expression. + * + * Derived classes are used to point to the CreateSignatureLocation + * and the VerifySignatureLocation. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface ElementSelector { + /** + * Gets the XPath expression pointing to a single element. + * + * @return The XPath expression to select the signature parent element. + */ + public String getXPathExpression(); + /** + * Gets the namespace prefix to URI mapping to use when evaluating the XPath. + * + * @return The namespace prefix to URI mapping. + */ + public Map getNamespaceDeclarations(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java new file mode 100644 index 000000000..f951e35c0 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java @@ -0,0 +1,15 @@ +package at.gv.egovernment.moa.spss.api.common; + +/** + * An enveloped signature type of Transform. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface EnvelopedSignatureTransform extends Transform { + /** + * Algorithm URI of the enveloped signature type of Transform. + */ + public static final String ENVELOPED_SIGNATURE = + "http://www.w3.org/2000/09/xmldsig#enveloped-signature"; +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java new file mode 100644 index 000000000..369270259 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java @@ -0,0 +1,27 @@ +package at.gv.egovernment.moa.spss.api.common; + +import java.util.List; + +import at.gv.egovernment.moa.util.Constants; + +/** + * An exclusive canonicalization type of Transform. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface ExclusiveCanonicalizationTransform extends Transform { + /** Algorithm URI of exclusive canonical XML. */ + public static final String EXCLUSIVE_CANONICAL_XML = Constants.EXC_C14N_URI; + /** Algorithm URI of exclusive canonical XML with comments. */ + public static final String EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS = + Constants.EXC_C14N_WITH_COMMENTS_URI; + + /** + * Sets the namespace prefixes that are handled in the same manner as in + * canonical XML. + * + * @return The inclusive namespace prefixes. + */ + public List getInclusiveNamespacePrefixes(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java new file mode 100644 index 000000000..fd2b69c6d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java @@ -0,0 +1,47 @@ +package at.gv.egovernment.moa.spss.api.common; + +/** + * Interface specifying accessors for two attributes needed for returning + * HashInputData and ReferenceInputData information + * as part of VerifyXMLSignatureResponse. + * + * @author Gregor Karlinger + * + * @version $Id$ + */ +public interface InputData extends Content +{ + /** + * Possible value returned by {@link #getPartOf}. + */ + public static String CONTAINER_SIGNEDINFO_ = "SignedInfo"; + + /** + * Possible value returned by {@link #getPartOf}. + */ + public static String CONTAINER_XMLDSIGMANIFEST_ = "XMLDSIGManifest"; + + /** + * Value returned by {link getReferringReferenceNumber}, signalling that the + * attribute is not used. + */ + public static int REFERER_NONE_ = -1; + + /** + * Returns a String signalling what kind of container the + * XMLDSIG Reference this InputData belongs + * to is part of. + * + * @return the kind of container. + */ + public String getPartOf(); + + /** + * If this InputData belongs to an XMLDSIG Reference + * being part of either a XMLDSIGManifest or a SignatureManifest, this method + * returns a positive int value signalling the particular Reference + * of the XMLDSIG SignedInfo referring to the XMLDSIGManifest or + * SignatureManifest respectively. + */ + public int getReferringReferenceNumber(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java new file mode 100644 index 000000000..56a1793af --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java @@ -0,0 +1,37 @@ +package at.gv.egovernment.moa.spss.api.common; + +import org.w3c.dom.NodeList; + +/** + * Object encapsulating descriptive meta information. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface MetaInfo { + /** + * Gets the mime type of the associated object. + * + * @return The mimetype of the associated object. + */ + public String getMimeType(); + /** + * Gets the descriptive information (URI). + * + * @return URI referencing the descriptive information. + */ + public String getDescription(); + /** + * Gets the elemental informations. + * + * @return The elemental informations. + */ + public NodeList getAnyElements(); + /** + * Gets the XML signature creation type information of the associated object. + * + * @return the XML signature creation type information of the associated object. + */ + public String getType(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java new file mode 100644 index 000000000..c3b4aaadc --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java @@ -0,0 +1,43 @@ +package at.gv.egovernment.moa.spss.api.common; + +import java.security.cert.X509Certificate; + + +/** + * Contains information about the signer. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface SignerInfo { + /** + * Gets the signer certificate. + * + * @return The signer certificate. + */ + public X509Certificate getSignerCertificate(); + /** + * Checks, whether the certificate contained in this object is qualified. + * + * @return true, if the certificate is qualified, otherwise + * false. + */ + public boolean isQualifiedCertificate(); + /** + * Checks, whether the certificate contained in this object is a + * public authority certificate. + * + * @return true, if the certificate is a public authority + * certificate, otherwise false. + */ + public boolean isPublicAuthority(); + /** + * Gets the public authority ID, if the certificate contained in this + * object is from a public authority. + * + * @return The public authority ID. + */ + public String getPublicAuhtorityID(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java new file mode 100644 index 000000000..49a4e7c35 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java @@ -0,0 +1,16 @@ +package at.gv.egovernment.moa.spss.api.common; + +/** + * Base class for XMLDsig Transform elements. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface Transform { + /** + * Gets the algorithm URI of this Transform. + * + * @return The algorithm URI of this Transform. + */ + public String getAlgorithmURI(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java new file mode 100644 index 000000000..d2ea88968 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.common; + +import java.math.BigInteger; + +/** + * Contains an X.509 issuer distinguished name/serial number pair. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface X509IssuerSerial { + /** + * Gets the issuer distinguished name. + * + * @return The issuer distinguished name. + */ + public String getX509IssuerName(); + /** + * Gets the issuer serial number. + * + * @return The issuer serial number. + */ + public BigInteger getX509SerialNumber(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java new file mode 100644 index 000000000..e1e034222 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.common; + + +/** + * Object encapsulating arbitrary content and optional descriptive meta + * information. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface XMLDataObjectAssociation { + /** + * Gets descriptive meta information. + * + * @return The descriptive meta information. + */ + public MetaInfo getMetaInfo(); + /** + * Gets the actual content. + * + * @return The content of this association. + */ + public Content getContent(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java new file mode 100644 index 000000000..247776ce0 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java @@ -0,0 +1,38 @@ +package at.gv.egovernment.moa.spss.api.common; + +import java.util.Map; + +/** + * An XPath expression set operation. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface XPathFilter { + /** Subtract this filter's node set from the resulting node set. */ + public static final String SUBTRACT_TYPE = "subtract"; + /** Intersect this filter's node set with the resulting node set. */ + public static final String INTERSECT_TYPE = "intersect"; + /** Compute the union of this filter's node set and the resulting node set. */ + public static final String UNION_TYPE = "union"; + + /** + * Gets the type of this XPathFilter. + * + * @return The type of this XPathFilter. + */ + public String getFilterType(); + /** + * Gets the XPath expression for selecting the nodes. + * + * @return The XPath expression for selecting the nodes. + */ + public String getXPathExpression(); + /** + * Gets The namespace prefix to URI mapping used during evaluation of the + * XPath expression. + * + * @return The namespace prefix to URI mapping. + */ + public Map getNamespaceDeclarations(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java new file mode 100644 index 000000000..335d37dbf --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.common; + +import java.util.List; + +/** + * An XPath type of Transform containing multiple filters for + * performing set operations on XPath selections. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface XPathFilter2Transform extends Transform { + /** Algorithm URI for the XPath Filter2 Transform. */ + public static final String XPATH_FILTER2 = + "http://www.w3.org/2002/06/xmldsig-filter2"; + + /** + * Gets the XPathFilters contained in this + * XPathFilter2Transform. + * + * @return The XPathFilters. + */ + public List getFilters(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java new file mode 100644 index 000000000..f1cc1a2bc --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java @@ -0,0 +1,30 @@ +package at.gv.egovernment.moa.spss.api.common; + +import java.util.Map; + +/** + * A Transform performing an XPath selection. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface XPathTransform extends Transform { + /** Algorithm URI of the XPath Transform. */ + public static final String XPATH = + "http://www.w3.org/TR/1999/REC-xpath-19991116"; + + /** + * Gets the XPath expression used for selection. + * + * @return The XPath expression used for selection. + */ + public String getXPathExpression(); + /** + * Gets The namespace prefix to URI mapping used during evaluation of the + * XPath expression. + * + * @return The namespace prefix to URI mapping. + */ + public Map getNamespaceDeclarations(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java new file mode 100644 index 000000000..7f44bb060 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java @@ -0,0 +1,23 @@ +package at.gv.egovernment.moa.spss.api.common; + +import org.w3c.dom.Element; + +/** + * A Transform containing an XSLT stylesheet. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface XSLTTransform extends Transform { + /** Algorithm URI for the XSLT type of Transform. */ + public static final String XSLT = + "http://www.w3.org/TR/1999/REC-xslt-19991116"; + + /** + * Gets the XSLT stylesheet element used for the transformation. + * + * @return The XSLT stylesheet element used for the transformation. + */ + public Element getStylesheet(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java new file mode 100644 index 000000000..4af075da2 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java @@ -0,0 +1,22 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.Base64Transform; + +/** + * Default implementation of Base64Transform. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class Base64TransformImpl + extends TransformImpl + implements Base64Transform { + + /** + * Create a new Base64TransformImpl object. + */ + public Base64TransformImpl() { + setAlgorithmURI(BASE64_DECODING); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java new file mode 100644 index 000000000..dd700cf21 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java @@ -0,0 +1,40 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.io.InputStream; + +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentExcplicit; + +/** + * Default implementation of CMSContentExplicit. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CMSContentExplicitImpl implements CMSContentExcplicit { + + /** The binary content, as a stream. */ + private InputStream binaryContent; + + /** + * Sets the binary content as a stream. + * + * @param content The binary content as a stream. + */ + public void setBinaryContent(InputStream content) { + this.binaryContent = content; + } + + public InputStream getBinaryContent() { + return binaryContent; + } + + /** + * Gets the type of content. + * + * @return EXPLICIT_CONTENT + */ + public int getContentType() { + return EXPLICIT_CONTENT; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java new file mode 100644 index 000000000..f9c080a0d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java @@ -0,0 +1,38 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentReference; + +/** + * Default implementation of CMSContentReference. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CMSContentReferenceImpl implements CMSContentReference { + + /** The reference pointing to the actual data. */ + private String reference; + + /** + * Sets the reference URI. + * + * @param referenceURI The URI pointing to the content data. + */ + public void setReference(String referenceURI) { + this.reference = referenceURI; + } + + public String getReference() { + return reference; + } + + /** + * Gets the content type. + * + * @return REFERENCE_CONTENT + */ + public int getContentType() { + return REFERENCE_CONTENT; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java new file mode 100644 index 000000000..6eec4e847 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java @@ -0,0 +1,46 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; +import at.gv.egovernment.moa.spss.api.common.MetaInfo; + +/** + * Default implementation of CMLSDataObject. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CMSDataObjectImpl implements CMSDataObject { + + /** The MetaInfo associated with the CMS data object. */ + private MetaInfo metaInfo; + /** The CMSContent contained in this data object. */ + private CMSContent cmsContent; + + /** + * Sets the meta information associated with the CMS data object. + * + * @param metaInfo The meta information. + */ + public void setMetaInfo(MetaInfo metaInfo) { + this.metaInfo = metaInfo; + } + + public MetaInfo getMetaInfo() { + return metaInfo; + } + + /** + * Sets the data of this CMSDataObject. + * + * @param cmsContent The actual data of this CMSDataObject. + */ + public void setContent(CMSContent cmsContent) { + this.cmsContent = cmsContent; + } + + public CMSContent getContent() { + return cmsContent; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java new file mode 100644 index 000000000..cf446d1b4 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform; + +/** + * Default implementation of CanonicalizationTransform. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CanonicalizationTransformImpl + extends TransformImpl + implements CanonicalizationTransform { + + /** + * Create a new CanonicalizationTransformImpl object. + * + * @param algorithmURI Algorithm URI of the canonicalization + * Transform type. + */ + public CanonicalizationTransformImpl(String algorithmURI) { + setAlgorithmURI(algorithmURI); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java new file mode 100644 index 000000000..2acb12e51 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java @@ -0,0 +1,52 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.spss.api.common.CheckResult; + +/** + * Default implementation of CheckResult. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CheckResultImpl implements CheckResult { + /** The result code. */ + private int code; + + /** Additional information. */ + private NodeList info; + + /** + * Sets a result code. + * + * @param code The result code. + */ + public void setCode(int code) { + this.code = code; + } + + /** + * @see at.gv.egovernment.moa.spss.api.CheckResult#getCode() + */ + public int getCode() { + return code; + } + + /** + * Sets a descriptive information. + * + * @param info The descriptive information. + */ + public void setInfo(NodeList info) { + this.info = info; + } + + /** + * @see at.gv.egovernment.moa.spss.api.CheckResult#getInfo() + */ + public NodeList getInfo() { + return info; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java new file mode 100644 index 000000000..bbed6bf8b --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java @@ -0,0 +1,40 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.io.InputStream; + +import at.gv.egovernment.moa.spss.api.common.ContentBinary; + +/** + * Default implementation of ContentBinary. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class ContentBinaryImpl extends ContentImpl implements ContentBinary { + + /** The binary content as a stream. */ + private InputStream binaryContent; + + /** + * Sets the binary content as a stream. + * + * @param binaryContent The binary content as a stream. + */ + public void setBinaryContent(InputStream binaryContent) { + this.binaryContent = binaryContent; + } + + public InputStream getBinaryContent() { + return binaryContent; + } + + /** + * Gets the type of content. + * + * @return BINARY_CONTENT + */ + public int getContentType() { + return BINARY_CONTENT; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java new file mode 100644 index 000000000..7f331d2cd --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java @@ -0,0 +1,28 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.Content; + +/** + * Default base class for Content implementations. + * + * @author Patrick Peck + * @version $Id$ + */ +public abstract class ContentImpl implements Content { + /** The reference pointing to the content data. */ + private String reference; + + /** + * Sets the reference pointing to the content data. + * + * @param referenceURI The URI of the content data. + */ + public void setReference(String referenceURI) { + this.reference = referenceURI; + } + + public String getReference() { + return reference; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java new file mode 100644 index 000000000..902f7bd72 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java @@ -0,0 +1,44 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.ContentLocRef; + +/** + * Default implementation of ContentLocRef. + * + * @author Gregor Karlinger + * @version $Id$ + */ +public class ContentLocRefImpl extends ContentImpl implements ContentLocRef +{ + /** + * The location reference URI pointing to the actual remote location of the content. + */ + private String locationReferenceURI_; + + /** + * @see at.gv.egovernment.moa.spss.api.common.ContentLocRef#getLocationReference() + */ + public String getLocationReferenceURI() + { + return locationReferenceURI_; + } + + /** + * Sets the location reference URI pointing to the actual remote location of the content. + * + * @param locationReferenceURI the location reference URI. + */ + public void setLocationReferenceURI(String locationReferenceURI) + { + locationReferenceURI_ = locationReferenceURI; + } + + /** + * Gets the type of content. + * + * @return LOCREF_CONTENT. + */ + public int getContentType() { + return LOCREF_CONTENT; + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java new file mode 100644 index 000000000..50609aa0e --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java @@ -0,0 +1,24 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.ContentReference; + +/** + * Default implementation of ContentReference. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ContentReferenceImpl + extends ContentImpl + implements ContentReference { + + /** + * Gets the type of content. + * + * @return REFERENCE_CONTENT + */ + public int getContentType() { + return REFERENCE_CONTENT; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java new file mode 100644 index 000000000..c03f5edde --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java @@ -0,0 +1,40 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.spss.api.common.ContentXML; + +/** + * Default implementation of ContentXML. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class ContentXMLImpl extends ContentImpl implements ContentXML { + + /** The nodes making up the XML content. */ + private NodeList xmlContent; + + /** + * Sets the nodes making up the XML content. + * + * @param xmlContent The XML content. + */ + public void setXMLContent(NodeList xmlContent) { + this.xmlContent = xmlContent; + } + + public NodeList getXMLContent() { + return xmlContent; + } + + /** + * Gets the type of content. + * + * @return XML_CONTENT + */ + public int getContentType() { + return XML_CONTENT; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java new file mode 100644 index 000000000..22e4cd61d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java @@ -0,0 +1,66 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation; + +/** + * Default implementation of + * . + * + * @author Patrick Peck + * @version $Id$ + */ +public class CreateSignatureEnvironmentProfileExplicitImpl + implements CreateSignatureEnvironmentProfileExplicit { + + /** The insertion location of the signature to be created. */ + private CreateSignatureLocation createSignatureLocation; + + /** Supplemental information for evaluating the signature environment. */ + private List supplements; + + /** + * Sets the insertion location of the signature to be created. + * + * @param createSignatureLocation The insertion location of the signature to + * be created. + */ + public void setCreateSignatureLocation(CreateSignatureLocation createSignatureLocation) { + this.createSignatureLocation = createSignatureLocation; + } + + public CreateSignatureLocation getCreateSignatureLocation() { + return createSignatureLocation; + } + + /** + * Sets the supplemental information for evaluating the signature + * environment. + * + * @param supplements The supplemental information. + */ + public void setSupplements(List supplements) { + this.supplements = + supplements != null + ? Collections.unmodifiableList(new ArrayList(supplements)) + : null; + } + + public List getSupplements() { + return supplements; + } + + /** + * Gets the type of profile. + * + * @return EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE + */ + public int getCreateSignatureEnvironmentProfileType() { + return EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java new file mode 100644 index 000000000..1c7dc6439 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java @@ -0,0 +1,39 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileID; + +/** + * Default implementation of CreateSignatureEnvironmentProfileID. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CreateSignatureEnvironmentProfileIDImpl + implements CreateSignatureEnvironmentProfileID { + + /** The profile ID. */ + private String createSignatureEnvironmentProfileID; + + /** + * Sets the profile ID. + * + * @param profileID The profile ID. + */ + public void setCreateSignatureEnvironmentProfileID(String profileID) { + this.createSignatureEnvironmentProfileID = profileID; + } + + public String getCreateSignatureEnvironmentProfileID() { + return createSignatureEnvironmentProfileID; + } + + /** + * Gets the type of profile. + * + * @return ID_CREATESIGNATUREENVIRONMENTPROFILE + */ + public int getCreateSignatureEnvironmentProfileType() { + return ID_CREATESIGNATUREENVIRONMENTPROFILE; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java new file mode 100644 index 000000000..097af7fff --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java @@ -0,0 +1,50 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfile; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureInfo; + +/** + * Default implementation of CreateSignatureInfo. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CreateSignatureInfoImpl implements CreateSignatureInfo { + + /** The signature environment that will contain the newly created + * signature. */ + private Content createSignatureEnvironment; + + /** Additional information about the signature environment. */ + private CreateSignatureEnvironmentProfile createSignatureEnvironmentProfile; + + /** + * Sets the signature environment that will contain the newly created + * signature. + * + * @param createSignatureEnvironment The signature environment. + */ + public void setCreateSignatureEnvironment(Content createSignatureEnvironment) { + this.createSignatureEnvironment = createSignatureEnvironment; + } + + public Content getCreateSignatureEnvironment() { + return createSignatureEnvironment; + } + + /** + * Sets the signature environment profile containing additional information + * about the signature environment. + * + * @param profile The signature environment profile. + */ + public void setCreateSignatureEnvironmentProfile(CreateSignatureEnvironmentProfile profile) { + this.createSignatureEnvironmentProfile = profile; + } + + public CreateSignatureEnvironmentProfile getCreateSignatureEnvironmentProfile() { + return createSignatureEnvironmentProfile; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java new file mode 100644 index 000000000..c0b36f505 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java @@ -0,0 +1,31 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation; + +/** + * Default implementation of CreateSignatureLocation. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CreateSignatureLocationImpl + extends ElementSelectorImpl + implements CreateSignatureLocation { + + /** The index of the newly created signature. */ + private int index; + + /** + * Sets the index of the newly created signature. + * + * @param index The index of the newly created signature. + */ + public void setIndex(int index) { + this.index = index; + } + + public int getIndex() { + return index; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java new file mode 100644 index 000000000..ff4108248 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java @@ -0,0 +1,51 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.common.MetaInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfo; + +/** + * Default implementation of CreateTransformsInfo. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CreateTransformsInfoImpl implements CreateTransformsInfo { + /** The dsig:Transforms. */ + private List transforms; + /** Meta information about the data resulting from the transforms. */ + private MetaInfo finalDataMetaInfo; + + /** + * Sets the transforms. + * + * @param transforms The transforms. + */ + public void setTransforms(List transforms) { + this.transforms = + transforms != null + ? Collections.unmodifiableList(new ArrayList(transforms)) + : null; + } + + public List getTransforms() { + return transforms; + } + + /** + * Sets the meta information about the data resulting from the transforms. + * + * @param finalDataMetaInfo The meta information. + */ + public void setFinalDataMetaInfo(MetaInfo finalDataMetaInfo) { + this.finalDataMetaInfo = finalDataMetaInfo; + } + + public MetaInfo getFinalDataMetaInfo() { + return finalDataMetaInfo; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java new file mode 100644 index 000000000..508b6c083 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java @@ -0,0 +1,62 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit; + +/** + * Default implementation of CreateTransformsInfoProfileExplicit. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CreateTransformsInfoProfileExplicitImpl + implements CreateTransformsInfoProfileExplicit { + + /** Transformation information. */ + private CreateTransformsInfo transformsInfo; + /** Additional data for the transformations. */ + private List supplements = new ArrayList(); + + /** + * Sets the transformation information. + * + * @param transformsInfo The transformation information. + */ + public void setCreateTransformsInfo(CreateTransformsInfo transformsInfo) { + this.transformsInfo = transformsInfo; + } + + public CreateTransformsInfo getCreateTransformsInfo() { + return transformsInfo; + } + + /** + * Sets the additional data for the transformations. + * + * @param supplements The additional data. + */ + public void setSupplements(List supplements) { + this.supplements = + supplements != null + ? Collections.unmodifiableList(new ArrayList(supplements)) + : null; + } + + public List getSupplements() { + return supplements; + } + + /** + * Gets the type of profile. + * + * @return EXPLICIT_CREATETRANSFORMSINFOPROFILE + */ + public int getCreateTransformsInfoProfileType() { + return EXPLICIT_CREATETRANSFORMSINFOPROFILE; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java new file mode 100644 index 000000000..5cd1fcc48 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java @@ -0,0 +1,38 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileID; + +/** + * Default implementation of CreateTransformsInfoProfileID. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CreateTransformsInfoProfileIDImpl + implements CreateTransformsInfoProfileID { + + /** The profile ID. */ + private String createTransformsID; + + /** + * Sets the profile ID. + * @param createTransformsID The profile ID. + */ + public void setCreateTransformsInfoProfileID(String createTransformsID) { + this.createTransformsID = createTransformsID; + } + + public String getCreateTransformsInfoProfileID() { + return createTransformsID; + } + + /** + * Gets the type of profile. + * + * @return ID_CREATETRANSFORMSINFOPROFILE + */ + public int getCreateTransformsInfoProfileType() { + return ID_CREATETRANSFORMSINFOPROFILE; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java new file mode 100644 index 000000000..08f94cc31 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java @@ -0,0 +1,53 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; + +/** + * Default implementation of CreateXMLSignatureRequest. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CreateXMLSignatureRequestImpl + implements CreateXMLSignatureRequest { + + /** The identifier for selecting the private keys for creating the signature.*/ + private String keyIdentifier; + /** Information for creating a single signature. */ + private List singleSignatureInfos = new ArrayList(); + + /** + * Sets the identifier for selecting the private keys for creating the + * signature. + * + * @param keyIdentifier The identifier for selecting the private keys. + */ + public void setKeyIdentifier(String keyIdentifier) { + this.keyIdentifier = keyIdentifier; + } + + public String getKeyIdentifier() { + return keyIdentifier; + } + + /** + * Sets the information for creating single signatures. + * + * @param singleSignaureInfos The information for creating single signatures. + */ + public void setSingleSignatureInfos(List singleSignaureInfos) { + this.singleSignatureInfos = + singleSignaureInfos != null + ? Collections.unmodifiableList(new ArrayList(singleSignaureInfos)) + : null; + } + + public List getSingleSignatureInfos() { + return singleSignatureInfos; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java new file mode 100644 index 000000000..590258e30 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java @@ -0,0 +1,37 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; + +/** + * Default implementation of CreateXMLSignatureResponse. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class CreateXMLSignatureResponseImpl + implements CreateXMLSignatureResponse { + + /** The elements contained in the response. */ + private List responseElements = new ArrayList(); + + /** + * Sets the elements contained in the response. + * + * @param responseElements The response elements. + */ + public void setResponseElements(List responseElements) { + this.responseElements = + responseElements != null + ? Collections.unmodifiableList(new ArrayList(responseElements)) + : null; + } + + public List getResponseElements() { + return responseElements; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java new file mode 100644 index 000000000..8ab2241de --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java @@ -0,0 +1,79 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfile; +import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo; + +/** + * Default implementation of DataObjectInfo. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class DataObjectInfoImpl implements DataObjectInfo { + /** The signature structure type. */ + private String stucture; + /** Whether a reference will be placed in the signature itself or in the + * manifest */ + private boolean childOfManifest; + /** The data object to be signed. */ + private Content dataObject; + /** The profile containing additional information for the transformations. */ + private CreateTransformsInfoProfile createTransformsInfoProfile; + + /** + * Sets the signature structure type. + * + * @param structure The signature structure type. + */ + public void setStructure(String structure) { + this.stucture = structure; + } + + public String getStructure() { + return stucture; + } + + /** + * Sets whether a reference will be placed in the signature itself or in the + * manifest. + * + * @param childOfManifest Whether to put the reference in the signature of + * in the manifest. + */ + public void setChildOfManifest(boolean childOfManifest) { + this.childOfManifest = childOfManifest; + } + + public boolean isChildOfManifest() { + return childOfManifest; + } + + /** + * Sets the data object to be signed. + * + * @param dataObject The data object to be signed. + */ + public void setDataObject(Content dataObject) { + this.dataObject = dataObject; + } + + public Content getDataObject() { + return dataObject; + } + + /** + * Sets additional information for the transformations. + * + * @param profile The profile containing additional information for the + * transformations. + */ + public void setCreateTransformsInfoProfile(CreateTransformsInfoProfile profile) { + this.createTransformsInfoProfile = profile; + } + + public CreateTransformsInfoProfile getCreateTransformsInfoProfile() { + return createTransformsInfoProfile; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java new file mode 100644 index 000000000..e460bd584 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java @@ -0,0 +1,47 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.HashMap; +import java.util.Map; + +import at.gv.egovernment.moa.spss.api.common.ElementSelector; + +/** + * Default implementation of ElementSelector. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class ElementSelectorImpl implements ElementSelector { + /** The XPath expression pointing to the element. */ + private String xPathExpression; + /** The namespace declarations to apply for evaluating the XPath */ + private Map namespaceDeclarations = new HashMap(); + + /** + * Sets the XPath expression pointing to the element. + * + * @param xPathExpression XPath expression pointing to the element. + */ + public void setXPathExpression(String xPathExpression) { + this.xPathExpression = xPathExpression; + } + + public String getXPathExpression() { + return xPathExpression; + } + + /** + * Sets namespace declarations to apply for evaluating the XPath. + * + * @param namespaceDeclarations The namespace declarations to apply for + * evaluating the XPath. + */ + public void setNamespaceDeclarations(Map namespaceDeclarations) { + this.namespaceDeclarations = namespaceDeclarations; + } + + public Map getNamespaceDeclarations() { + return namespaceDeclarations; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java new file mode 100644 index 000000000..a1be3d86a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java @@ -0,0 +1,22 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform; + +/** + * Default implementation of EnvelopedSignatureTransform. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class EnvelopedSignatureTransformImpl + extends TransformImpl + implements EnvelopedSignatureTransform { + + /** + * Create a EnvelopedSignatureTransformImpl. + */ + public EnvelopedSignatureTransformImpl() { + setAlgorithmURI(ENVELOPED_SIGNATURE); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java new file mode 100644 index 000000000..d7047ab44 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java @@ -0,0 +1,52 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse; + +/** + * Default implementation of ErrorResponse. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class ErrorResponseImpl implements ErrorResponse { + /** The error code. */ + private int code; + /** Verbose error message. */ + private String info; + + /** + * Sets the error code. + * + * @param code The error code. + */ + public void setErrorCode(int code) { + this.code = code; + } + + public int getErrorCode() { + return code; + } + + /** + * Sets the verbose error information. + * + * @param info The verbose error information. + */ + public void setInfo(String info) { + this.info = info; + } + + public String getInfo() { + return info; + } + + /** + * Gets the response type. + * + * @return ERROR_RESPONSE + */ + public int getResponseType() { + return ERROR_RESPONSE; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java new file mode 100644 index 000000000..bf21c8634 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java @@ -0,0 +1,48 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform; + +/** + * Default implementation of ExclusiveCanonicalizationTransform. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ExclusiveCanonicalizationTransformImpl + extends TransformImpl + implements ExclusiveCanonicalizationTransform { + + /** The namespaces to treat according to canonical XML. */ + private List inclusiveNamespacePrefixes; + + /** + * Create a ExclusiveCanonicalizationTransformImpl object. + * + * @param algorithmURI The algorithm URI identifying the transformation + * algorithm. + */ + public ExclusiveCanonicalizationTransformImpl(String algorithmURI) { + setAlgorithmURI(algorithmURI); + } + + /** + * Sets the namespaces to treat according to canonical XML. + * @param inclusiveNamespacePrefixes The namespaces to treat according to + * canonical XML. + */ + public void setInclusiveNamespacePrefixes(List inclusiveNamespacePrefixes) { + this.inclusiveNamespacePrefixes = + inclusiveNamespacePrefixes != null + ? Collections.unmodifiableList(new ArrayList(inclusiveNamespacePrefixes)) + : null; + } + + public List getInclusiveNamespacePrefixes() { + return inclusiveNamespacePrefixes; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java new file mode 100644 index 000000000..42d61559e --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java @@ -0,0 +1,99 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.io.InputStream; + +import at.gv.egovernment.moa.spss.MOARuntimeException; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.common.ContentBinary; +import at.gv.egovernment.moa.spss.api.common.InputData; + +/** + * Content wrapper decorating a binary content with two additional attributes + * needed for returning HashInputData and ReferenceInputData + * information as part of VerifyXMLSignatureResponse. + * + * @author Gregor Karlinger + * + * @version $Id$ + */ +public class InputDataBinaryImpl implements ContentBinary, InputData +{ + /** + * The wrapped Content. + */ + protected ContentBinary wrapped_; + + /** + * This attribute signals what kind of container the XMLDSIG Reference + * this InputData belongs to is part of. + */ + protected String partOf_; + + /** + * If this InputData belongs to an XMLDSIG Reference + * being part of either a XMLDSIGManifest or a SignatureManifest, this attribute + * (a positive int) signals the particular Reference of the XMLDSIG + * SignedInfo referring to the XMLDSIGManifest or SignatureManifest + * respectively. + */ + protected int referringReferenceNumber_; + + /** + * Creates a new instance. + * + * @param wrapped The wrapped Content. Must be of type {@link Content#BINARY_CONTENT}. + * + * @param partOf see {@link InputData} + * + * @param referringReferenceNumber see {@link InputData} + */ + public InputDataBinaryImpl(Content wrapped, String partOf, int referringReferenceNumber) throws MOARuntimeException + { + if (wrapped.getContentType() != Content.BINARY_CONTENT) throw new MOARuntimeException("9901", null); + + wrapped_ = (ContentBinary) wrapped; + partOf_ = partOf; + referringReferenceNumber_ = referringReferenceNumber; + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.Content#getContentType() + */ + public int getContentType() + { + return wrapped_.getContentType(); + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.Content#getReference() + */ + public String getReference() + { + return wrapped_.getReference(); + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.ContentBinary#getBinaryContent() + */ + public InputStream getBinaryContent() + { + return wrapped_.getBinaryContent(); + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.InputData#getPartOf() + */ + public String getPartOf() + { + return partOf_; + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.InputData#getReferringReferenceNumber() + */ + public int getReferringReferenceNumber() + { + return referringReferenceNumber_; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java new file mode 100644 index 000000000..029a402f5 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java @@ -0,0 +1,99 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.spss.MOARuntimeException; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.common.ContentXML; +import at.gv.egovernment.moa.spss.api.common.InputData; + +/** + * Content wrapper decorating an XML content with two additional attributes + * needed for returning HashInputData and ReferenceInputData + * information as part of VerifyXMLSignatureResponse. + * + * @author Gregor Karlinger + * + * @version $Id$ + */ +public class InputDataXMLImpl implements ContentXML, InputData +{ + /** + * The wrapped ContentXML. + */ + protected ContentXML wrapped_; + + /** + * This attribute signals what kind of container the XMLDSIG Reference + * this InputData belongs to is part of. + */ + protected String partOf_; + + /** + * If this InputData belongs to an XMLDSIG Reference + * being part of either a XMLDSIGManifest or a SignatureManifest, this attribute + * (a positive int) signals the particular Reference of the XMLDSIG + * SignedInfo referring to the XMLDSIGManifest or SignatureManifest + * respectively. + */ + protected int referringReferenceNumber_; + + /** + * Creates a new instance. + * + * @param wrapped The wrapped ContentBinary. Must be of type {@link Content#XML_CONTENT}. + * + * @param partOf see {@link InputData} + * + * @param referringReferenceNumber see {@link InputData} + */ + public InputDataXMLImpl(Content wrapped, String partOf, int referringReferenceNumber) + { + if (wrapped.getContentType() != Content.XML_CONTENT) throw new MOARuntimeException("9901", null); + + wrapped_ = (ContentXML) wrapped; + partOf_ = partOf; + referringReferenceNumber_ = referringReferenceNumber; + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.Content#getContentType() + */ + public int getContentType() + { + return wrapped_.getContentType(); + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.Content#getReference() + */ + public String getReference() + { + return wrapped_.getReference(); + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.ContentXML#getXMLContent() + */ + public NodeList getXMLContent() + { + return wrapped_.getXMLContent(); + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.InputData#getPartOf() + */ + public String getPartOf() + { + return partOf_; + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.InputData#getReferringReferenceNumber() + */ + public int getReferringReferenceNumber() + { + return referringReferenceNumber_; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java new file mode 100644 index 000000000..9174e3a46 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java @@ -0,0 +1,44 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResultInfo; + +/** + * Default implementation of ManifestRefsCheckResult. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class ManifestRefsCheckResultImpl implements ManifestRefsCheckResult { + /** The numerical check code. */ + private int code; + /** Additional information about the check. */ + private ManifestRefsCheckResultInfo info; + + /** + * Sets the check code. + * + * @param code A numerical representation of the result of the manifest check. + */ + public void setCode(int code) { + this.code = code; + } + + public int getCode() { + return code; + } + + /** + * Sets a reference to the manifest. + * + * @param info The reference to the manifest. + */ + public void setInfo(ManifestRefsCheckResultInfo info) { + this.info = info; + } + + public ManifestRefsCheckResultInfo getInfo() { + return info; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java new file mode 100644 index 000000000..0071a14f3 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java @@ -0,0 +1,32 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResultInfo; + +/** + * Default implementation of ManifestRefsCheckResultInfo. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class ManifestRefsCheckResultInfoImpl + extends ReferencesCheckResultInfoImpl + implements ManifestRefsCheckResultInfo { + + /** The position of the signature reference containing the reference to the + * manifest being described by this object.*/ + private int referringSignatureReference; + + /** + * Sets the position of the signature reference containing the reference to + * the manifest being described by this object. + * @param referringSignatureReference The position of the signature reference. + */ + public void setReferringSignatureReference(int referringSignatureReference) { + this.referringSignatureReference = referringSignatureReference; + } + + public int getReferringSignatureReference() { + return referringSignatureReference; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java new file mode 100644 index 000000000..93aceb033 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java @@ -0,0 +1,75 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.spss.api.common.MetaInfo; + +/** + * Default implementation of MetaInfo. + * @author Fatemeh Philippi + * @version $Id$ + */ +public class MetaInfoImpl implements MetaInfo { + /** Information about the MIME type. */ + private String mimeType; + /** URI pointing to a description of the content. */ + private String description; + /** Descriptive XML content. */ + private NodeList anyElements; + /** Type information for XML signature creation */ + private String type; + + /** + * Sets the MIME type. + * + * @param mimeType The MIME type to set. + */ + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + public String getMimeType() { + return mimeType; + } + + /** + * Sets the URI pointing to a description of the content. + * + * @param description The URI pointing to a description of the content. + */ + public void setDescription(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + + /** + * Sets descriptive XML content. + * + * @param anyElements The elements to set. + */ + public void setAnyElements(NodeList anyElements) { + this.anyElements = anyElements; + } + + public NodeList getAnyElements() { + return anyElements; + } + + /** + * Sets the XML signature creation type information. + * + * @param type the XML signature creation type information to set. + */ + public void setType(String type) { + this.type = type; + } + + public String getType() { + return type; + } + + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java new file mode 100644 index 000000000..923a4bce1 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java @@ -0,0 +1,38 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; + +/** + * Default implementation of ReferenceInfo. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class ReferenceInfoImpl implements ReferenceInfo { + /** Profile containing the transforms allowed in the signature. */ + private List verifyTransformsInfoProfiles; + + /** + * Sets the transforms profile used for verifying the transforms contained + * in the signature. + * + * @param verifyTransformsInfoProfiles The profiles containing the transforms + * allowed in the signature. + */ + public void setVerifyTransformsInfoProfiles(List verifyTransformsInfoProfiles) { + this.verifyTransformsInfoProfiles = + verifyTransformsInfoProfiles != null + ? Collections.unmodifiableList( + new ArrayList(verifyTransformsInfoProfiles)) + : null; + } + + public List getVerifyTransformsInfoProfiles() { + return verifyTransformsInfoProfiles; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java new file mode 100644 index 000000000..6bb4d30ac --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java @@ -0,0 +1,46 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo; + +/** + * Default implementation of ReferencesCheckResult. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ReferencesCheckResultImpl implements ReferencesCheckResult { + /** The check code. */ + private int code; + /** Additional information about the reference check. */ + private ReferencesCheckResultInfo info; + + /** + * Sets the check code. + * + * @param code A numerical representation of the result of the reference + * check. + */ + public void setCode(int code) { + this.code = code; + } + + public int getCode() { + return code; + } + + /** + * Sets additional information about the reference check. + * + * @param manifestRefsCheckResultInfo Additional information about the + * reference check. + */ + public void setInfo(ReferencesCheckResultInfo manifestRefsCheckResultInfo) { + this.info = manifestRefsCheckResultInfo; + } + + public ReferencesCheckResultInfo getInfo() { + return info; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java new file mode 100644 index 000000000..a21b417ae --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java @@ -0,0 +1,46 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo; + +/** + * Default implementation of ReferencesCheckResultInfo. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ReferencesCheckResultInfoImpl + implements ReferencesCheckResultInfo { + + /** Additional information about the references check. */ + private NodeList anyOtherInfo; + /** The indexes of the failed references. */ + private int[] failedReferences = new int[0]; + + /** + * Sets additional information about the references check. + * @param anyOtherInfo Additional information about the references check. + */ + public void setAnyOtherInfo(NodeList anyOtherInfo) { + this.anyOtherInfo = anyOtherInfo; + } + + public NodeList getAnyOtherInfo() { + return anyOtherInfo; + } + + /** + * Sets the indexes of the failed references. + * + * @param failedReferences The indexes of the failed references. + */ + public void setFailedReferences(int[] failedReferences) { + this.failedReferences = failedReferences; + } + + public int[] getFailedReferences() { + return failedReferences; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java new file mode 100644 index 000000000..bf15bf37e --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java @@ -0,0 +1,568 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.io.InputStream; +import java.math.BigInteger; +import java.security.cert.X509Certificate; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; +import at.gv.egovernment.moa.spss.api.common.CheckResult; +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.common.SignerInfo; +import at.gv.egovernment.moa.spss.api.common.Transform; +import at.gv.egovernment.moa.spss.api.common.X509IssuerSerial; +import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; +import at.gv.egovernment.moa.spss.api.common.XPathFilter; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfile; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation; +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.ErrorResponse; +import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse; +import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResultInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; +import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfile; +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter; +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.VerifyTransformsInfoProfile; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; + +/** + * Default implementation of SPSSFactory. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SPSSFactoryImpl extends SPSSFactory { + + public CreateXMLSignatureRequest createCreateXMLSignatureRequest( + String keyIdentifier, + List singleSignatureInfos) { + CreateXMLSignatureRequestImpl createXMLSignatureRequest = + new CreateXMLSignatureRequestImpl(); + createXMLSignatureRequest.setKeyIdentifier(keyIdentifier); + createXMLSignatureRequest.setSingleSignatureInfos(singleSignatureInfos); + return createXMLSignatureRequest; + } + + public SingleSignatureInfo createSingleSignatureInfo( + List dataObjectInfos, + CreateSignatureInfo createSignatureInfo, + boolean securityLayerConform) { + SingleSignatureInfoImpl singleSignatureInfo = new SingleSignatureInfoImpl(); + singleSignatureInfo.setDataObjectInfos(dataObjectInfos); + singleSignatureInfo.setCreateSignatureInfo(createSignatureInfo); + singleSignatureInfo.setSecurityLayerConform(securityLayerConform); + return singleSignatureInfo; + } + public DataObjectInfo createDataObjectInfo( + String structure, + boolean childOfManifest, + Content dataObject, + CreateTransformsInfoProfile createTransformsInfoProfile) { + DataObjectInfoImpl dataObjectInfo = new DataObjectInfoImpl(); + dataObjectInfo.setStructure(structure); + dataObjectInfo.setChildOfManifest(childOfManifest); + dataObjectInfo.setDataObject(dataObject); + dataObjectInfo.setCreateTransformsInfoProfile(createTransformsInfoProfile); + return dataObjectInfo; + } + + public CreateTransformsInfoProfile createCreateTransformsInfoProfile(String profileID) { + + CreateTransformsInfoProfileIDImpl createTransformsInfoProfile = + new CreateTransformsInfoProfileIDImpl(); + createTransformsInfoProfile.setCreateTransformsInfoProfileID(profileID); + return createTransformsInfoProfile; + } + + public CreateTransformsInfoProfile createCreateTransformsInfoProfile( + CreateTransformsInfo transformsInfo, + List supplements) { + CreateTransformsInfoProfileExplicitImpl createTransformsInfoProfile = + new CreateTransformsInfoProfileExplicitImpl(); + createTransformsInfoProfile.setCreateTransformsInfo(transformsInfo); + createTransformsInfoProfile.setSupplements(supplements); + return createTransformsInfoProfile; + } + + public CreateTransformsInfo createCreateTransformsInfo( + List transforms, + MetaInfo finalDataMetaInfo) { + CreateTransformsInfoImpl createTransformsInfo = + new CreateTransformsInfoImpl(); + + createTransformsInfo.setTransforms(transforms); + createTransformsInfo.setFinalDataMetaInfo(finalDataMetaInfo); + return createTransformsInfo; + } + + public CreateSignatureInfo createCreateSignatureInfo( + Content createSignatureEnvironment, + CreateSignatureEnvironmentProfile createSignatureEnvironmentProfile) { + CreateSignatureInfoImpl createSignatureInfo = new CreateSignatureInfoImpl(); + createSignatureInfo.setCreateSignatureEnvironment( + createSignatureEnvironment); + createSignatureInfo.setCreateSignatureEnvironmentProfile( + createSignatureEnvironmentProfile); + return createSignatureInfo; + } + + public CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile( + CreateSignatureLocation createSignatureLocation, + List supplements) { + CreateSignatureEnvironmentProfileExplicitImpl createSignatureEnvironmentProfile = + new CreateSignatureEnvironmentProfileExplicitImpl(); + createSignatureEnvironmentProfile.setCreateSignatureLocation( + createSignatureLocation); + createSignatureEnvironmentProfile.setSupplements(supplements); + return createSignatureEnvironmentProfile; + } + + public CreateSignatureLocation createCreateSignatureLocation( + String signatureLocationXPath, + int signatureLocationIndex, + Map namespaceDeclarations) { + CreateSignatureLocationImpl createSignatureLocation = + new CreateSignatureLocationImpl(); + createSignatureLocation.setIndex(signatureLocationIndex); + createSignatureLocation.setNamespaceDeclarations(namespaceDeclarations); + createSignatureLocation.setXPathExpression(signatureLocationXPath); + return createSignatureLocation; + } + + public CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile(String profileID) { + CreateSignatureEnvironmentProfileIDImpl createSignatureEnvironmentProfile = + new CreateSignatureEnvironmentProfileIDImpl(); + createSignatureEnvironmentProfile.setCreateSignatureEnvironmentProfileID( + profileID); + return createSignatureEnvironmentProfile; + } + + public CreateXMLSignatureResponse createCreateXMLSignatureResponse(List responseElements) { + CreateXMLSignatureResponseImpl createXMLSignatureResponse = + new CreateXMLSignatureResponseImpl(); + createXMLSignatureResponse.setResponseElements(responseElements); + return createXMLSignatureResponse; + } + + public SignatureEnvironmentResponse createSignatureEnvironmentResponse(Element signatureEnvironment) { + SignatureEnvironmentResponseImpl signatureEnvironmentResponse = + new SignatureEnvironmentResponseImpl(); + signatureEnvironmentResponse.setSignatureEnvironment(signatureEnvironment); + return signatureEnvironmentResponse; + } + + public ErrorResponse createErrorResponse(int code, String info) { + ErrorResponseImpl errorResponse = new ErrorResponseImpl(); + errorResponse.setErrorCode(code); + errorResponse.setInfo(info); + return errorResponse; + } + + public VerifyCMSSignatureRequest createVerifyCMSSignatureRequest( + int[] signatories, + Date dateTime, + InputStream cmsSignature, + CMSDataObject dataObject, + String trustProfileID) { + VerifyCMSSignatureRequestImpl verifyCMSSignatureRequest = + new VerifyCMSSignatureRequestImpl(); + verifyCMSSignatureRequest.setDateTime(dateTime); + verifyCMSSignatureRequest.setCMSSignature(cmsSignature); + verifyCMSSignatureRequest.setDataObject(dataObject); + verifyCMSSignatureRequest.setTrustProfileId(trustProfileID); + verifyCMSSignatureRequest.setSignatories(signatories); + return verifyCMSSignatureRequest; + } + + public CMSDataObject createCMSDataObject( + MetaInfo metaInfo, + CMSContent content) { + + CMSDataObjectImpl cmsDataObject = new CMSDataObjectImpl(); + cmsDataObject.setMetaInfo(metaInfo); + cmsDataObject.setContent(content); + + return cmsDataObject; + } + + public CMSContent createCMSContent(InputStream binaryContent) { + CMSContentExplicitImpl cmsContent = new CMSContentExplicitImpl(); + + cmsContent.setBinaryContent(binaryContent); + return cmsContent; + } + + public CMSContent createCMSContent(String referenceURI) { + CMSContentReferenceImpl cmsContent = new CMSContentReferenceImpl(); + + cmsContent.setReference(referenceURI); + return cmsContent; + } + + + public CMSDataObject createCMSDataObject( + MetaInfo metaInfo, + String referenceURI) { + CMSDataObjectImpl cmsDataObject = new CMSDataObjectImpl(); + CMSContentReferenceImpl cmsContent = new CMSContentReferenceImpl(); + cmsDataObject.setMetaInfo(metaInfo); + cmsContent.setReference(referenceURI); + return cmsDataObject; + } + + public VerifyCMSSignatureResponse createVerifyCMSSignatureResponse(List responseElements) { + VerifyCMSSinatureResponseImpl verifyCMSSignatureResponse = + new VerifyCMSSinatureResponseImpl(); + verifyCMSSignatureResponse.setResponseElements(responseElements); + return verifyCMSSignatureResponse; + } + + public VerifyCMSSignatureResponseElement createVerifyCMSSignatureResponseElement( + SignerInfo signerInfo, + CheckResult signatureCheck, + CheckResult certificateCheck) { + VerifyCMSSignatureResponseElementImpl verifyCMSSignatureResponseElement = + new VerifyCMSSignatureResponseElementImpl(); + verifyCMSSignatureResponseElement.setSignerInfo(signerInfo); + verifyCMSSignatureResponseElement.setSignatureCheck(signatureCheck); + verifyCMSSignatureResponseElement.setCertificateCheck(certificateCheck); + return verifyCMSSignatureResponseElement; + } + + public VerifyXMLSignatureRequest createVerifyXMLSignatureRequest( + Date dateTime, + VerifySignatureInfo verifySignatureInfo, + List supplementProfiles, + SignatureManifestCheckParams signatureManifestParams, + boolean returnHashInputData, + String trustProfileID) { + VerifyXMLSignatureRequestImpl verifyXMLSignatureRequest = + new VerifyXMLSignatureRequestImpl(); + verifyXMLSignatureRequest.setDateTime(dateTime); + verifyXMLSignatureRequest.setSignatureInfo(verifySignatureInfo); + verifyXMLSignatureRequest.setSupplementProfiles(supplementProfiles); + verifyXMLSignatureRequest.setSignatureManifestCheckParams( + signatureManifestParams); + verifyXMLSignatureRequest.setReturnHashInputData(returnHashInputData); + verifyXMLSignatureRequest.setTrustProfileId(trustProfileID); + return verifyXMLSignatureRequest; + } + + public VerifySignatureInfo createVerifySignatureInfo( + Content verifySignatureEnvironment, + VerifySignatureLocation verifySignatureLocation) { + VerifySignatureInfoImpl verifySignatureInfo = new VerifySignatureInfoImpl(); + verifySignatureInfo.setVerifySignatureEnvironment( + verifySignatureEnvironment); + verifySignatureInfo.setVerifySignatureLocation(verifySignatureLocation); + return verifySignatureInfo; + } + + public VerifySignatureLocation createVerifySignatureLocation( + String xPathExpression, + Map namespaceDeclarations) { + VerifySignatureLocationImpl verifySignatureLocation = + new VerifySignatureLocationImpl(); + verifySignatureLocation.setXPathExpression(xPathExpression); + verifySignatureLocation.setNamespaceDeclarations(namespaceDeclarations); + return verifySignatureLocation; + } + + public SupplementProfile createSupplementProfile(String profileID) { + SupplementProfileIDImpl supplementProfileID = new SupplementProfileIDImpl(); + supplementProfileID.setSupplementProfileID(profileID); + return supplementProfileID; + } + + public SupplementProfile createSupplementProfile(XMLDataObjectAssociation supplementProfile) { + SupplementProfileExplicitImpl supplementProfileExplicit = + new SupplementProfileExplicitImpl(); + supplementProfileExplicit.setSupplementProfile(supplementProfile); + return supplementProfileExplicit; + } + + public SignatureManifestCheckParams createSignatureManifestCheckParams( + List referenceInfos, + boolean returnReferenceInputData) { + SignatureManifestCheckParamsImpl signatureManifestCheckParams = + new SignatureManifestCheckParamsImpl(); + signatureManifestCheckParams.setReferenceInfos(referenceInfos); + signatureManifestCheckParams.setReturnReferenceInputData( + returnReferenceInputData); + return signatureManifestCheckParams; + } + + public ReferenceInfo createReferenceInfo(List verifyTransformsInfoProfiles) { + ReferenceInfoImpl referenceInfo = new ReferenceInfoImpl(); + referenceInfo.setVerifyTransformsInfoProfiles(verifyTransformsInfoProfiles); + return referenceInfo; + } + + public VerifyTransformsInfoProfile createVerifyTransformsInfoProfile( + List transforms, + List transformParameters) { + VerifyTransformsInfoProfileExplicitImpl verifyTransformsInfoProfile = + new VerifyTransformsInfoProfileExplicitImpl(); + + verifyTransformsInfoProfile.setTransforms(transforms); + verifyTransformsInfoProfile.setTransformParameters(transformParameters); + + return verifyTransformsInfoProfile; + } + + public VerifyTransformsInfoProfile createVerifyTransformsInfoProfile(String profileID) { + VerifyTransformsInfoProfileIDImpl verifyTransformsInfoProfile = + new VerifyTransformsInfoProfileIDImpl(); + verifyTransformsInfoProfile.setVerifyTransformsInfoProfileID(profileID); + return verifyTransformsInfoProfile; + } + + + public TransformParameter createTransformParameter(String URI, String digestMethod, byte[] digestValue) { + TransformPatameterHashImpl transformParameter = + new TransformPatameterHashImpl(); + transformParameter.setURI(URI); + transformParameter.setDigestMethod(digestMethod); + transformParameter.setDigestValue(digestValue); + return transformParameter; + } + + public TransformParameter createTransformParameter( + String URI, + InputStream binaryData) { + TransformParameterBinaryImpl transformParameter = + new TransformParameterBinaryImpl(); + transformParameter.setURI(URI); + transformParameter.setBinaryContent(binaryData); + return transformParameter; + } + + public TransformParameter createTransformParameter(String URI) { + TransformParameterURIImpl transformParameter = + new TransformParameterURIImpl(); + transformParameter.setURI(URI); + return transformParameter; + } + + public VerifyXMLSignatureResponse createVerifyXMLSignatureResponse( + SignerInfo signerInfo, + List hashInputDatas, + List referenceInputDatas, + ReferencesCheckResult signatureCheck, + ReferencesCheckResult signatureManifestCheck, + List xmlDsigManifestChecks, + CheckResult certificateCheck) { + VerifyXMLSignatureResponseImpl verifyXMLSignatureResponse = + new VerifyXMLSignatureResponseImpl(); + verifyXMLSignatureResponse.setSignerInfo(signerInfo); + verifyXMLSignatureResponse.setHashInputDatas(hashInputDatas); + verifyXMLSignatureResponse.setReferenceInputDatas(referenceInputDatas); + verifyXMLSignatureResponse.setSignatureCheck(signatureCheck); + verifyXMLSignatureResponse.setSignatureManifestCheck( + signatureManifestCheck); + verifyXMLSignatureResponse.setXMLDsigManifestChecks(xmlDsigManifestChecks); + verifyXMLSignatureResponse.setCertificateCheck(certificateCheck); + return verifyXMLSignatureResponse; + } + + public ReferencesCheckResult createReferencesCheckResult( + int code, + ReferencesCheckResultInfo info) { + ReferencesCheckResultImpl referencesCheckResult = + new ReferencesCheckResultImpl(); + referencesCheckResult.setCode(code); + referencesCheckResult.setInfo(info); + return referencesCheckResult; + } + + public ReferencesCheckResultInfo createReferencesCheckResultInfo( + NodeList anyOtherInfo, + int[] failedReferences) { + ReferencesCheckResultInfoImpl referencesCheckResultInfo = + new ReferencesCheckResultInfoImpl(); + referencesCheckResultInfo.setAnyOtherInfo(anyOtherInfo); + referencesCheckResultInfo.setFailedReferences(failedReferences); + return referencesCheckResultInfo; + } + + public ManifestRefsCheckResult createManifestRefsCheckResult( + int code, + ManifestRefsCheckResultInfo info) { + ManifestRefsCheckResultImpl manifestRefsCheckResult = + new ManifestRefsCheckResultImpl(); + manifestRefsCheckResult.setCode(code); + manifestRefsCheckResult.setInfo(info); + return manifestRefsCheckResult; + } + + public ManifestRefsCheckResultInfo createManifestRefsCheckResultInfo( + NodeList anyOtherInfo, + int[] failedReferences, + int referringSigReference) { + ManifestRefsCheckResultInfoImpl manifestRefsCheckResultInfo = + new ManifestRefsCheckResultInfoImpl(); + manifestRefsCheckResultInfo.setAnyOtherInfo(anyOtherInfo); + manifestRefsCheckResultInfo.setReferringSignatureReference( + referringSigReference); + manifestRefsCheckResultInfo.setFailedReferences(failedReferences); + return manifestRefsCheckResultInfo; + } + + public Content createContent(InputStream binaryData, String referenceURI) { + ContentBinaryImpl content = new ContentBinaryImpl(); + content.setBinaryContent(binaryData); + content.setReference(referenceURI); + return content; + } + + public Content createContent(String locationReferenceURI, String referenceURI) { + ContentLocRefImpl content = new ContentLocRefImpl(); + content.setLocationReferenceURI(locationReferenceURI); + content.setReference(referenceURI); + return content; + } + + public Content createContent(String referenceURI) { + ContentReferenceImpl content = new ContentReferenceImpl(); + content.setReference(referenceURI); + return content; + } + + public Content createContent(NodeList xmlData, String referenceURI) { + ContentXMLImpl content = new ContentXMLImpl(); + content.setXMLContent(xmlData); + content.setReference(referenceURI); + return content; + } + + public XMLDataObjectAssociation createXMLDataObjectAssociation( + MetaInfo metaInfo, + Content xmlContent) { + XMLDataObjectAssociationImpl xmlDataObjectAssociation = + new XMLDataObjectAssociationImpl(); + xmlDataObjectAssociation.setMetaInfo(metaInfo); + xmlDataObjectAssociation.setContent(xmlContent); + return xmlDataObjectAssociation; + } + + public MetaInfo createMetaInfo( + String mimeType, + String description, + NodeList otherInfo, + String type) { + MetaInfoImpl metaInfo = new MetaInfoImpl(); + metaInfo.setMimeType(mimeType); + metaInfo.setDescription(description); + metaInfo.setAnyElements(otherInfo); + metaInfo.setType(type); + return metaInfo; + } + + public Transform createCanonicalizationTransform(String algorithmURI) { + CanonicalizationTransformImpl transform = new CanonicalizationTransformImpl(algorithmURI); + return transform; + } + + public Transform createExclusiveCanonicalizationTransform(String algorithmURI, List inclusiveNamespacePrefixes) { + ExclusiveCanonicalizationTransformImpl transform = new ExclusiveCanonicalizationTransformImpl(algorithmURI); + transform.setInclusiveNamespacePrefixes(inclusiveNamespacePrefixes); + return transform; + } + + public Transform createBase64Transform() { + Base64TransformImpl transform = new Base64TransformImpl(); + return transform; + } + + public Transform createEnvelopedSignatureTransform() { + EnvelopedSignatureTransformImpl transform = + new EnvelopedSignatureTransformImpl(); + return transform; + } + + public Transform createXSLTTransform(Element styleSheet) { + XSLTransformImpl transform = new XSLTransformImpl(); + transform.setStylesheet(styleSheet); + return transform; + } + + public Transform createXPathTransform( + String xPathExpression, + Map namespaceDeclarations) { + XPathTransformImpl transform = new XPathTransformImpl(); + transform.setXPathExpression(xPathExpression); + transform.setNamespaceDelcarations(namespaceDeclarations); + return transform; + } + + public Transform createXPathFilter2Transform(List xPathFilters) { + XPathFilter2TransformImpl transform = new XPathFilter2TransformImpl(); + transform.setFilters(xPathFilters); + return transform; + } + + public XPathFilter createXPathFilter( + String filterType, + String xPathExpression, + Map namespaceDeclarations) { + XPathFilterImpl xPathFilter = new XPathFilterImpl(); + xPathFilter.setFilterType(filterType); + xPathFilter.setXPathExpression(xPathExpression); + xPathFilter.setNamespaceDelcarations(namespaceDeclarations); + return xPathFilter; + } + + public CheckResult createCheckResult(int code, NodeList info) { + CheckResultImpl checkResult = new CheckResultImpl(); + checkResult.setCode(code); + checkResult.setInfo(info); + return checkResult; + } + + public SignerInfo createSignerInfo( + X509Certificate signerCertificate, + boolean qualifiedCertificate, + boolean publicAuthority, + String publicAuthorityID) { + SignerInfoImpl signerInfo = new SignerInfoImpl(); + signerInfo.setSignerCertificate(signerCertificate); + signerInfo.setQualifiedCertificate(qualifiedCertificate); + signerInfo.setPublicAuthority(publicAuthority); + signerInfo.setPublicAuhtorityID(publicAuthorityID); + return signerInfo; + } + + public X509IssuerSerial createX509IssuerSerial( + String issuerName, + BigInteger serialNumber) { + X509IssuerSerialImpl x509IssuerSerial = new X509IssuerSerialImpl(); + x509IssuerSerial.setX509IssuerName(issuerName); + x509IssuerSerial.setX509SerialNumber(serialNumber); + return x509IssuerSerial; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java new file mode 100644 index 000000000..57d30ad3b --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java @@ -0,0 +1,41 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse; + +/** + * Default implementation of SignatureEnvironmentResponse. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class SignatureEnvironmentResponseImpl + implements SignatureEnvironmentResponse { + + /** The signature environment containing the XML signature. */ + private Element signatureEnvironment; + + /** + * Sets the XML structure which contains the signature. + * + * @param signatureEnvironment A general XML structure containing the signature. + */ + public void setSignatureEnvironment(Element signatureEnvironment) { + this.signatureEnvironment = signatureEnvironment; + } + + public Element getSignatureEnvironment() { + return signatureEnvironment; + } + + /** + * Gets the type of CreateXMLSignatureResponseElement. + * + * @return SIGNATURE_ENVIRONMENT_RESPONSE + */ + public int getResponseType() { + return SIGNATURE_ENVIRONMENT_RESPONSE; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java new file mode 100644 index 000000000..5924f8447 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java @@ -0,0 +1,52 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; + +/** + * Default implementation of SignatureManifestCheckParams. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class SignatureManifestCheckParamsImpl + implements SignatureManifestCheckParams { + + /** Referential information. */ + private List referenceInfos; + /** Whether to return the signature source data. */ + private boolean returnReferenceInputData = true; + + /** + * Sets the referantial information. + * + * @param referenceInfos The referential information. + */ + public void setReferenceInfos(List referenceInfos) { + this.referenceInfos = + referenceInfos != null + ? Collections.unmodifiableList(new ArrayList(referenceInfos)) + : null; + } + + public List getReferenceInfos() { + return referenceInfos; + } + + /** + * Sets whether to return signature source data. + * + * @param returnReferenceInputData Whether to return signature source data. + */ + public void setReturnReferenceInputData(boolean returnReferenceInputData) { + this.returnReferenceInputData = returnReferenceInputData; + } + + public boolean getReturnReferenceInputData() { + return returnReferenceInputData; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java new file mode 100644 index 000000000..277f1a008 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java @@ -0,0 +1,81 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.security.cert.X509Certificate; + +import at.gv.egovernment.moa.spss.api.common.SignerInfo; + +/** + * Default implementation of SignerInfo. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class SignerInfoImpl implements SignerInfo { + + /** The signer certificate. */ + private X509Certificate signerCertificate; + /** Determines, whether signerCertificate is a qualified + * certificate. */ + private boolean qualifiedCertificate; + /** Determines, whether signerCertificate is from a public + * authority. */ + private boolean publicAuthority; + /** The public authority ID of the signerCertificate. */ + private String publicAuthorityID; + + /** + * Sets the signer certificate. + * + * @param signerCertificate The signer certificate. + */ + public void setSignerCertificate(X509Certificate signerCertificate) { + this.signerCertificate = signerCertificate; + } + + public X509Certificate getSignerCertificate() { + return signerCertificate; + } + + /** + * Sets, whether the certificate contained in this object is qualified or not. + * + * @param qualifiedCertificate Is true, if the certificate is + * qualified, otherwise false. + */ + public void setQualifiedCertificate(boolean qualifiedCertificate) { + this.qualifiedCertificate = qualifiedCertificate; + } + + public boolean isQualifiedCertificate() { + return qualifiedCertificate; + } + + /** + * Sets, whether the certificate contained in this object is an + * e-government certificate or not. + * + * @param publicAuthority Is true, if the certificate is + * public authority certificate, otherwise false. + */ + public void setPublicAuthority(boolean publicAuthority) { + this.publicAuthority = publicAuthority; + } + + public boolean isPublicAuthority() { + return publicAuthority; + } + + /** + * Sets the public authority ID of the signer certificate. + * + * @param publicAuhtorityID The public authority ID of the signer certificate. + */ + public void setPublicAuhtorityID(String publicAuhtorityID) { + this.publicAuthorityID = publicAuhtorityID; + } + + public String getPublicAuhtorityID() { + return publicAuthorityID; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java new file mode 100644 index 000000000..b50a65c68 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java @@ -0,0 +1,49 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; + +/** + * @author Fatemeh Philippi + * @version $Id$ + */ +public class SingleSignatureInfoImpl implements SingleSignatureInfo { + + private List dataObjectInfos = new ArrayList(); + + private CreateSignatureInfo createSignatureInfo; + + private boolean securityLayerConform = true; + + public void setDataObjectInfos(List dataObjectInfos) { + this.dataObjectInfos = + dataObjectInfos != null + ? Collections.unmodifiableList(new ArrayList(dataObjectInfos)) + : null; + } + + public List getDataObjectInfos() { + return dataObjectInfos; + } + + public void setCreateSignatureInfo(CreateSignatureInfo createSignatureInfo) { + this.createSignatureInfo = createSignatureInfo; + } + + public CreateSignatureInfo getCreateSignatureInfo() { + return createSignatureInfo; + } + + public void setSecurityLayerConform(boolean securityLayerConform) { + this.securityLayerConform = securityLayerConform; + } + + public boolean isSecurityLayerConform() { + return securityLayerConform; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java new file mode 100644 index 000000000..78723fec2 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java @@ -0,0 +1,39 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; +import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfileExplicit; + +/** + * Default implementation of SupplementProfileExplicit. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class SupplementProfileExplicitImpl implements SupplementProfileExplicit { + + /** Supplemental information for verifying a signature. */ + private XMLDataObjectAssociation supplement; + + /** + * Sets the supplemental information for verifying a signature. + * + * @param supplement The supplemental information for verifying a signature. + */ + public void setSupplementProfile(XMLDataObjectAssociation supplement) { + this.supplement = supplement; + } + + public XMLDataObjectAssociation getSupplementProfile() { + return supplement; + } + + /** + * Gets the type of SupplementProfile. + * + * @return EXPLICIT_SUPPLEMENTPROFILE + */ + public int getSupplementProfileType() { + return EXPLICIT_SUPPLEMENTPROFILE; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java new file mode 100644 index 000000000..320827fad --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java @@ -0,0 +1,37 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfileID; + +/** + * Default implementation of SupplementProfileID. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class SupplementProfileIDImpl implements SupplementProfileID { + /** The profile ID. */ + private String profileID; + + /** + * Sets the SupplementProfile profile ID. + * + * @param profileID The profile ID. + */ + public void setSupplementProfileID(String profileID) { + this.profileID = profileID; + } + + public String getSupplementProfileID() { + return profileID; + } + + /** + * Gets the type of SupplementProfile. + * + * @return ID_SUPPLEMENTPROFILE + */ + public int getSupplementProfileType() { + return ID_SUPPLEMENTPROFILE; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java new file mode 100644 index 000000000..51c7a543f --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java @@ -0,0 +1,26 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.Transform; + +/** + * @author Fatemeh Philippi + * @version $Id$ + */ +public class TransformImpl implements Transform { + /** The URI identifying the transformation algorithm. */ + private String algorithmURI; + + /** + * Sets the URI identifying the transformation algorithm. + * + * @param algorithmURI The URI identifying the transformation algorithm. + */ + public void setAlgorithmURI(String algorithmURI) { + this.algorithmURI = algorithmURI; + } + + public String getAlgorithmURI() { + return algorithmURI; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java new file mode 100644 index 000000000..2901fb1bb --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java @@ -0,0 +1,42 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.io.InputStream; + +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterBinary; + +/** + * Default implementation of TransformParameterBinary. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class TransformParameterBinaryImpl + extends TransformParameterImpl + implements TransformParameterBinary { + + /** The binary content as a stream. */ + private InputStream binaryContent; + + /** + * Sets the binary content as a stream. + * + * @param binaryContent The binary content as a stream. + */ + public void setBinaryContent(InputStream binaryContent) { + this.binaryContent = binaryContent; + } + + public InputStream getBinaryContent() { + return binaryContent; + } + + /** + * Gets the TransformParameter type. + * + * @return BINARY_TRANSFORMPARAMETER + */ + public int getTransformParameterType() { + return BINARY_TRANSFORMPARAMETER; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java new file mode 100644 index 000000000..9fe60638e --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.impl; + +/** + * Default base implementation of TransformParameter. + * + * @author Patrick Peck + * @version $Id$ + */ +public abstract class TransformParameterImpl { + /** An URI identifying the TransformParameter. */ + private String uri; + + /** + * Sets the URI identifying the TransformParameter. + * @param uri The URI identifying the TransformParameter. + */ + public void setURI(String uri) { + this.uri = uri; + } + + public String getURI() { + return uri; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java new file mode 100644 index 000000000..25449504c --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java @@ -0,0 +1,24 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterURI; + +/** + * Default implementation of TransformParameterURI. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class TransformParameterURIImpl + extends TransformParameterImpl + implements TransformParameterURI { + + /** + * Gets the type of TransformParameter. + * + * @return URI_TRANSFORMPARAMETER + */ + public int getTransformParameterType() { + return URI_TRANSFORMPARAMETER; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java new file mode 100644 index 000000000..a7843e68c --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java @@ -0,0 +1,54 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterHash; + +/** + * Default implementation of TransformParameterHash + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class TransformPatameterHashImpl + extends TransformParameterImpl + implements TransformParameterHash { + + /** The method used to calculate the digest value. */ + private String digestMethod; + /** The digest value. */ + private byte[] digestValue; + + /** + * Sets method used to calculate the digest value. + * @param digestMethod The method used to calculate the digest value. + */ + public void setDigestMethod(String digestMethod) { + this.digestMethod = digestMethod; + } + + public String getDigestMethod() { + return digestMethod; + } + + /** + * Sets the digest value. + * + * @param digestValue The digest value. + */ + public void setDigestValue(byte[] digestValue) { + this.digestValue = digestValue; + } + + public byte[] getDigestValue() { + return digestValue; + } + + /** + * Gets the type of TransformParameter. + * + * @return HASH_TRANSFORMPARAMETER + */ + public int getTransformParameterType() { + return HASH_TRANSFORMPARAMETER; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java new file mode 100644 index 000000000..a3c37aaef --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java @@ -0,0 +1,93 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.io.InputStream; +import java.util.Date; + +import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; + +/** + * Default implementation of VerifyCMSSignatureRequest. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifyCMSSignatureRequestImpl + implements VerifyCMSSignatureRequest { + + /** The indexes of the signatories whose signature should be verified. */ + private int[] signatories; + /** The profile ID of trusted certificates. */ + private String trustProfileId; + /** The data object necessary for signature verification. */ + private CMSDataObject dataObject; + /** The CMS signature to verify. */ + private InputStream cmsSignature; + /** The date for which to verify the signature. */ + private Date dateTime; + + /** + * Sets the indexes of the signatories whose signature should be verified. + * + * @param signatories The indexes of the signatories whose signature should be + * verified. + */ + public void setSignatories(int[] signatories) { + this.signatories = signatories; + } + + public int[] getSignatories() { + return signatories; + } + + /** + * Sets the date for which to verify the signature. + * + * @param dateTime The date for which to verify the signature. + */ + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public Date getDateTime() { + return dateTime; + } + + /** + * Sets the CMS signature to verify. + * @param signature The CMS signature to verify. + */ + public void setCMSSignature(InputStream signature) { + this.cmsSignature = signature; + + } + + public InputStream getCMSSignature() { + return cmsSignature; + } + + /** + * Sets the data object necessary for signature verification. + * @param dataObject The data object necessary for signature verification. + */ + public void setDataObject(CMSDataObject dataObject) { + this.dataObject = dataObject; + } + + public CMSDataObject getDataObject() { + return dataObject; + } + + /** + * Sets the profile ID of trusted certificates. + * @param trustProfileId The profile ID of trusted certificates. + */ + public void setTrustProfileId(String trustProfileId) { + this.trustProfileId = trustProfileId; + } + + public String getTrustProfileId() { + return trustProfileId; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java new file mode 100644 index 000000000..40dc04683 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java @@ -0,0 +1,62 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; +import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.SignerInfo; + +/** + * Default implementation of VerifyCMSSignatureResponseElement. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifyCMSSignatureResponseElementImpl + implements VerifyCMSSignatureResponseElement { + + /** Information about the signer certificate. */ + private SignerInfo signerInfo; + /** Information about the signature check. */ + private CheckResult signatureCheck; + /** Information about the certificate check. */ + private CheckResult certificateCheck; + + /** + * Sets a SignerInfo element according to CMS. + * + * @param signerInfo The SignerInfo element according to CMS. + */ + public void setSignerInfo(SignerInfo signerInfo) { + this.signerInfo = signerInfo; + } + + public SignerInfo getSignerInfo() { + return signerInfo; + } + + /** + * Sets a result of the signature verification. + * + * @param signatureCheck The result of the signature verification. + */ + public void setSignatureCheck(CheckResult signatureCheck) { + this.signatureCheck = signatureCheck; + } + + public CheckResult getSignatureCheck() { + return signatureCheck; + } + + /** + * Sets a result of the certificate verification. + * + * @param certificateCheck The result of the certificate verification. + */ + public void setCertificateCheck(CheckResult certificateCheck) { + this.certificateCheck = certificateCheck; + } + + public CheckResult getCertificateCheck() { + return certificateCheck; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java new file mode 100644 index 000000000..f258380e0 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java @@ -0,0 +1,37 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; + +/** + * Default implementation of VerifyCMSSignatureResponse. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifyCMSSinatureResponseImpl + implements VerifyCMSSignatureResponse { + + /** The elements contained in the response. */ + private List responseElements; + + /** + * Sets the elements contained in the response. + * + * @param responseElements The elements contained in the response. + */ + public void setResponseElements(List responseElements) { + this.responseElements = + responseElements != null + ? Collections.unmodifiableList(new ArrayList(responseElements)) + : null; + } + + public List getResponseElements() { + return responseElements; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java new file mode 100644 index 000000000..2653e2fd2 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java @@ -0,0 +1,47 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureLocation; + +/** + * Default implementation of VerifySignatureInfo. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifySignatureInfoImpl implements VerifySignatureInfo { + /** The location of the signature to be verified. */ + private VerifySignatureLocation verifySignatureLocation; + /** The environment containing the signature to be verified. */ + private Content verifySignatureEnvironment; + + /** + * Sets the location of the signature to be verified. + * + * @param verifySignatureLocation The location of the signature to be + * verified. + */ + public void setVerifySignatureLocation(VerifySignatureLocation verifySignatureLocation) { + this.verifySignatureLocation = verifySignatureLocation; + } + + public VerifySignatureLocation getVerifySignatureLocation() { + return verifySignatureLocation; + } + + /** + * Sets the signature environment containing the signature to be verified. + * + * @param verifySignatureEnvironment The signature environment containing the + * signature to be verified. + */ + public void setVerifySignatureEnvironment(Content verifySignatureEnvironment) { + this.verifySignatureEnvironment = verifySignatureEnvironment; + } + + public Content getVerifySignatureEnvironment() { + return verifySignatureEnvironment; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java new file mode 100644 index 000000000..933e42987 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java @@ -0,0 +1,15 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureLocation; + +/** + * Default implementation of VerifySignatureLocation. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifySignatureLocationImpl + extends ElementSelectorImpl + implements VerifySignatureLocation { + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java new file mode 100644 index 000000000..594f9c246 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java @@ -0,0 +1,36 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; + +/** + * Default implementation of . + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifyTransformsDataImpl implements ReferenceInfo { + /** Information about the transformations contained in the signature. */ + private List verifyTransformsInfoProfiles; + + /** + * Sets the information about the transformations contained in the signature. + * + * @param verifyTransformsInfoProfiles The profiles containing transformation + * information. + */ + public void setVerifyTransformsInfoProfiles(List verifyTransformsInfoProfiles) { + this.verifyTransformsInfoProfiles = + verifyTransformsInfoProfiles != null + ? Collections.unmodifiableList( + new ArrayList(verifyTransformsInfoProfiles)) + : null; + } + + public List getVerifyTransformsInfoProfiles() { + return verifyTransformsInfoProfiles; + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java new file mode 100644 index 000000000..d9a864499 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java @@ -0,0 +1,61 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileExplicit; + +/** + * Default implementation of VerifyTransformsInfoProfileExplicit. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifyTransformsInfoProfileExplicitImpl + implements VerifyTransformsInfoProfileExplicit { + + /** The transforms contained in this profile. */ + private List transforms; + /** Additional information for the transforms. */ + private List transformParameters = new ArrayList(); + + /** + * Sets the transforms contained in this profile. + * + * @param transforms The transforms contained in this profile. + */ + public void setTransforms(List transforms) { + this.transforms = + transforms != null + ? Collections.unmodifiableList(new ArrayList(transforms)) + : null; + } + + public List getTransforms() { + return transforms; + } + + /** + * Sets additional information for the transforms. + * + * @param transformParameters Additional information for the transforms. + */ + public void setTransformParameters(List transformParameters) { + this.transformParameters = new ArrayList(transformParameters); + } + + public List getTransformParameters() { + return transformParameters; + } + + /** + * Gets the type of VerifyTransformsInfoProfile. + * + * @return EXPLICIT_VERIFYTRANSFORMSINFOPROFILE + */ + public int getVerifyTransformsInfoProfileType() { + return EXPLICIT_VERIFYTRANSFORMSINFOPROFILE; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java new file mode 100644 index 000000000..fb1f10cea --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java @@ -0,0 +1,38 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileID; + +/** + * Default implementation of VerifyTransformsInfoProfileID. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifyTransformsInfoProfileIDImpl implements VerifyTransformsInfoProfileID { + + /** The profile ID. */ + private String verifyTransformsInfoProfileID; + + /** + * Sets the profile ID. + * + * @param profileID The profile ID. + */ + public void setVerifyTransformsInfoProfileID(String profileID) { + this.verifyTransformsInfoProfileID = profileID; + } + + public String getVerifyTransformsInfoProfileID() { + return verifyTransformsInfoProfileID; + } + + /** + * Gets the type of VerifyTransformsInfoProfile. + * + * @return ID_VERIFYTRANSFORMSINFOPROFILE + */ + public int getVerifyTransformsInfoProfileType() { + return ID_VERIFYTRANSFORMSINFOPROFILE; + } + +} \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java new file mode 100644 index 000000000..26d7def4c --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java @@ -0,0 +1,113 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; + +/** + * Default implementation of VerifyXMLSignatureRequest. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifyXMLSignatureRequestImpl + implements VerifyXMLSignatureRequest { + /** Date and time for signature verification. */ + private Date dateTime; + /** The signature to be verified. */ + private VerifySignatureInfo verifySignatureInfo; + /** Supplemental information about the singature. */ + private List supplementProfiles; + /** Additional parameters for checking the signature manifest. */ + private SignatureManifestCheckParams signatureManifestCheckParams; + /** Whether to return the hash input data. */ + private boolean returnHashInputData; + /** The profile ID of the trust profile containing the trusted certificates. + */ + private String trustProfileId; + + /** + * Sets the date and time for signature verification. + * + * @param dateTime The date and time for signature verification. + */ + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public Date getDateTime() { + return dateTime; + } + + /** + * Sets the signature to be verified. + * + * @param signatureInfo The signature to be verified. + */ + public void setSignatureInfo(VerifySignatureInfo signatureInfo) { + this.verifySignatureInfo = signatureInfo; + } + + public VerifySignatureInfo getSignatureInfo() { + return verifySignatureInfo; + } + + /** + * Sets supplemental information about the singature. + * @param supplementProfiles + */ + public void setSupplementProfiles(List supplementProfiles) { + this.supplementProfiles = + supplementProfiles != null + ? Collections.unmodifiableList(new ArrayList(supplementProfiles)) + : null; + } + + public List getSupplementProfiles() { + return supplementProfiles; + } + + /** + * Sets supplemental information about the singature. + * @param params Supplemental information about the singature. + */ + public void setSignatureManifestCheckParams(SignatureManifestCheckParams params) { + this.signatureManifestCheckParams = params; + } + + public SignatureManifestCheckParams getSignatureManifestCheckParams() { + return signatureManifestCheckParams; + } + + /** + * Sets whether to return hash input data. + * + * @param returnSignedData Whether to return hash input data. + */ + public void setReturnHashInputData(boolean returnSignedData) { + this.returnHashInputData = returnSignedData; + } + + public boolean getReturnHashInputData() { + return returnHashInputData; + } + + /** + * Sets the profile ID of trusted certificates. + * + * @param trustProfileId The profile ID of trusted certificates. + */ + public void setTrustProfileId(String trustProfileId) { + this.trustProfileId = trustProfileId; + } + + public String getTrustProfileId() { + return trustProfileId; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java new file mode 100644 index 000000000..989dbfb4a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java @@ -0,0 +1,141 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.SignerInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; + +/** + * @author Fatemeh Philippi + * @version $Id$ + */ +public class VerifyXMLSignatureResponseImpl + implements VerifyXMLSignatureResponse { + + /** Information about the signer certificate. */ + private SignerInfo signerInfo; + + /** + * The hash input data objects. The list consists of {@link at.gv.egovernment.moa.spss.api.common.InputData}s. + * */ + private List hashInputDatas = new ArrayList(); + + /** + * The reference input data objects. The list consists of {@link at.gv.egovernment.moa.spss.api.common.InputData}s. + * */ + private List referenceInputDatas = new ArrayList(); + + /** Information about the signature check. */ + private ReferencesCheckResult signatureCheck; + /** Information about the signature manifest check. */ + private ReferencesCheckResult signatureManifestCheck; + /** Information about the XMLDsig manifest check. */ + private List xmlDsigManifestChecks = new ArrayList(); + /** Information about the certificate check. */ + private CheckResult certificateCheck; + + /** + * Sets information about the signer certificate. + * + * @param signerInfo Information about the signer certificate. + */ + public void setSignerInfo(SignerInfo signerInfo) { + this.signerInfo = signerInfo; + } + + public SignerInfo getSignerInfo() { + return signerInfo; + } + + /** + * Sets data signed by the signatory. + * + * @param hashInputDatas The signed datas. + */ + public void setHashInputDatas(List hashInputDatas) { + this.hashInputDatas = + hashInputDatas != null + ? Collections.unmodifiableList(new ArrayList(hashInputDatas)) + : null; + } + + public List getHashInputDatas() { + return hashInputDatas; + } + + /** + * Sets the source data elements. + * + * @param referenceInputDatas The source data elements. + */ + public void setReferenceInputDatas(List referenceInputDatas) { + this.referenceInputDatas = + referenceInputDatas != null + ? Collections.unmodifiableList(new ArrayList(referenceInputDatas)) + : null; + } + + public List getReferenceInputDatas() { + return referenceInputDatas; + } + + /** + * Sets the result of the signature verification. + * + * @param signatureCheck The result of the signature verification. + */ + public void setSignatureCheck(ReferencesCheckResult signatureCheck) { + this.signatureCheck = signatureCheck; + } + + public ReferencesCheckResult getSignatureCheck() { + return signatureCheck; + } + + /** + * Sets the result of the signature manifest verification. + * + * @param signatureManifestCheck The result of the signature manifest verification. + */ + public void setSignatureManifestCheck(ReferencesCheckResult signatureManifestCheck) { + this.signatureManifestCheck = signatureManifestCheck; + } + + public ReferencesCheckResult getSignatureManifestCheck() { + return signatureManifestCheck; + } + + /** + * Sets the result of the certification verification. + * + * @param certificateCheck The result of the certificate verification. + */ + public void setCertificateCheck(CheckResult certificateCheck) { + this.certificateCheck = certificateCheck; + } + + public CheckResult getCertificateCheck() { + return certificateCheck; + } + + /** + * Sets the XMLDSigManifestChecks. + * + * @param xmlDsigManifestChecks The XMLDSigManifestChecks. + */ + public void setXMLDsigManifestChecks(List xmlDsigManifestChecks) { + this.xmlDsigManifestChecks = + xmlDsigManifestChecks != null + ? Collections.unmodifiableList(new ArrayList(xmlDsigManifestChecks)) + : null; + } + + public List getXMLDsigManifestChecks() { + return xmlDsigManifestChecks; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java new file mode 100644 index 000000000..e6d644fd9 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java @@ -0,0 +1,45 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.math.BigInteger; + +import at.gv.egovernment.moa.spss.api.common.X509IssuerSerial; + +/** + * Default implementation of X509IssuerSerial. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class X509IssuerSerialImpl implements X509IssuerSerial { + /** The certificate serial number. */ + private BigInteger x509SerialNumber; + /** The certificate issuer DN. */ + private String x509IssuerName; + + /** + * Sets the issuer distinguished name. + * + * @param x509IssuerName The issuer distinguished name. + */ + public void setX509IssuerName(String x509IssuerName) { + this.x509IssuerName = x509IssuerName; + } + + public String getX509IssuerName() { + return x509IssuerName; + } + + /** + * Sets the certificate serial number. + * + * @param x509SerialNumber The issuer serial number. + */ + public void setX509SerialNumber(BigInteger x509SerialNumber) { + this.x509SerialNumber = x509SerialNumber; + } + + public BigInteger getX509SerialNumber() { + return x509SerialNumber; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java new file mode 100644 index 000000000..b603c3367 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java @@ -0,0 +1,45 @@ +package at.gv.egovernment.moa.spss.api.impl; + +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.common.XMLDataObjectAssociation; + +/** + * Default implementation of XMLDataObjectAssociation. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class XMLDataObjectAssociationImpl implements XMLDataObjectAssociation { + + /** Meta information about the Content object. */ + private MetaInfo metaInfo; + /** The actual data contained in this object. */ + private Content content; + + /** + * Sets meta information about the Content object. + * @param metaInfo Meta information about the Content object. + */ + public void setMetaInfo(MetaInfo metaInfo) { + this.metaInfo = metaInfo; + } + + public MetaInfo getMetaInfo() { + return metaInfo; + } + + /** + * Sets the actual data contained in this object. + * + * @param content The actual data contained in this object. + */ + public void setContent(Content content) { + this.content = content; + } + + public Content getContent() { + return content; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java new file mode 100644 index 000000000..a96a8f161 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java @@ -0,0 +1,43 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.ArrayList; +import java.util.List; + +import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform; + +/** + * Default implementation of XPathFilter2Transform. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class XPathFilter2TransformImpl + extends TransformImpl + implements XPathFilter2Transform { + + /** The XPath filters. */ + private List filters; + + /** + * Create a new XPathFilter2TransformImpl object. + */ + public XPathFilter2TransformImpl() { + setAlgorithmURI(XPATH_FILTER2); + } + + /** + * Sets the XPath filters contained in this + * XPathFilter2Transform. + * + * @param filters The XPath filters contained in this + * XPathFilter2Transform. + */ + public void setFilters(List filters) { + this.filters = new ArrayList(filters); + } + + public List getFilters() { + return filters; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java new file mode 100644 index 000000000..72d91bc58 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java @@ -0,0 +1,64 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.HashMap; +import java.util.Map; + +import at.gv.egovernment.moa.spss.api.common.XPathFilter; + +/** + * Default implementation of XPathFilter. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class XPathFilterImpl implements XPathFilter { + /** The type of filter. */ + private String filterType; + /** The XPath expression of the filter. */ + private String xPathExpression; + /** The namespace prefix to URI mapping to while evaluating the XPath + * expression. */ + private Map namespaceDeclarations = new HashMap(); + + /** + * Sets the type of filter. + * + * @param filterType The type of filter. + */ + public void setFilterType(String filterType) { + this.filterType = filterType; + } + + public String getFilterType() { + return filterType; + } + + /** + * Sets the XPath expression of the filter. + * + * @param xPathExpression The XPath expression of the filter. + */ + public void setXPathExpression(String xPathExpression) { + this.xPathExpression = xPathExpression; + } + + public String getXPathExpression() { + return xPathExpression; + } + + /** + * Sets the namespace prefix to URI mapping to while evaluating the XPath + * expression. + * + * @param namespaceDeclarations The namespace prefix to URI mapping to while + * evaluating the XPath expression. + */ + public void setNamespaceDelcarations(Map namespaceDeclarations) { + this.namespaceDeclarations = namespaceDeclarations; + } + + public Map getNamespaceDeclarations() { + return namespaceDeclarations; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java new file mode 100644 index 000000000..1c9817ecc --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java @@ -0,0 +1,59 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import java.util.HashMap; +import java.util.Map; + +import at.gv.egovernment.moa.spss.api.common.XPathTransform; + +/** + * Default implementation of XPathTransform. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class XPathTransformImpl + extends TransformImpl + implements XPathTransform { + + /** The XPath expression to evaluate. */ + private String xPathExpression; + /** The namespace prefix to URI mapping to while evaluating the XPath + * expression. */ + private Map namespaceDeclarations = new HashMap(); + + /** + * Create a new XPathTransformImpl object. + */ + public XPathTransformImpl() { + setAlgorithmURI(XPATH); + } + + /** + * Sets the XPath expression to evaluate. + * + * @param xPathExpression The XPath expression to evaluate. + */ + public void setXPathExpression(String xPathExpression) { + this.xPathExpression = xPathExpression; + } + + public String getXPathExpression() { + return xPathExpression; + } + + /** + * Sets the namespace prefix to URI mapping to while evaluating the XPath + * expression. + * + * @param namespaceDeclarations The namespace prefix to URI mapping to while + * evaluating the XPath expression. + */ + public void setNamespaceDelcarations(Map namespaceDeclarations) { + this.namespaceDeclarations = namespaceDeclarations; + } + + public Map getNamespaceDeclarations() { + return namespaceDeclarations; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java new file mode 100644 index 000000000..c6ddc0fd6 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java @@ -0,0 +1,37 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.api.common.XSLTTransform; + +/** + * Default implementation of XSLTTransform. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class XSLTransformImpl extends TransformImpl implements XSLTTransform { + /** The XSLT stylesheet to apply. */ + private Element styleSheet; + + /** + * Create a new XSLTransformImpl object. + */ + public XSLTransformImpl() { + setAlgorithmURI(XSLT); + } + + /** + * Sets the XSLT stylesheet to apply. + * + * @param styleSheet The XSLT stylesheet to apply. + */ + public void setStylesheet(Element styleSheet) { + this.styleSheet = styleSheet; + } + + public Element getStylesheet() { + return styleSheet; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java new file mode 100644 index 000000000..319d3ac9d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java @@ -0,0 +1,288 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.util.ArrayList; +import java.util.List; + +import org.w3c.dom.Element; +import org.w3c.dom.traversal.NodeIterator; + +import at.gv.egovernment.moa.util.BoolUtils; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.XPathUtils; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfile; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureInfo; +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.DataObjectInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; + +/** + * A parser to parse CreateXMLSignatureRequest DOM trees into + * CreateXMLSignatureRequest API objects. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CreateXMLSignatureRequestParser { + + // + // XPath expresssions to select elements in the CreateXMLSignatureRequest + // + private static final String MOA = Constants.MOA_PREFIX + ":"; + private static final String KEY_IDENTIFIER_XPATH = + "/" + MOA + "CreateXMLSignatureRequest/" + MOA + "KeyIdentifier"; + private static final String SINGLE_SIGNATURE_INFO_XPATH = + "/" + MOA + "CreateXMLSignatureRequest/" + MOA + "SingleSignatureInfo"; + private static final String DATA_OBJECT_INFO_XPATH = MOA + "DataObjectInfo"; + private static final String DATA_OBJECT_XPATH = MOA + "DataObject"; + private static final String CREATE_SIGNATURE_INFO_XPATH = + MOA + "CreateSignatureInfo"; + private static final String CREATE_TRANSFORMS_INFO_PROFILE_XPATH = + (MOA + "CreateTransformsInfoProfile | ") + + (MOA + "CreateTransformsInfoProfileID"); + private static final String CREATE_SIGNATURE_ENVIRONMENT_XPATH = + MOA + "CreateSignatureEnvironment"; + private static final String CREATE_SIGNATURE_ENVIRONMENT_PROFILE_XPATH = + (MOA + "CreateSignatureEnvironmentProfile | ") + + (MOA + "CreateSignatureEnvironmentProfileID"); + private static final String SL_CONFORM_ATTR_NAME = "SecurityLayerConformity"; + + /** The factory to create API objects. */ + private SPSSFactory factory; + + /** + * Create a new CreateXMLSignatureRequestParser. + */ + public CreateXMLSignatureRequestParser() { + this.factory = SPSSFactory.getInstance(); + } + + /** + * Parse a CreateXMLSignatureRequest DOM element, as defined + * by the MOA schema. + * + * @param requestElem The CreateXMLSignatureRequest to parse. The + * request must have been successfully parsed against the schema for this + * method to succeed. + * @return A CreateXMLSignatureRequest API object containing + * the data from the DOM element. + * @throws MOAApplicationException An error occurred parsing the request. + */ + public CreateXMLSignatureRequest parse(Element requestElem) + throws MOAApplicationException { + + List singleSignatureInfos = parseSingleSignatureInfos(requestElem); + String keyIdentifier = + XPathUtils.getElementValue(requestElem, KEY_IDENTIFIER_XPATH, null); + + return factory.createCreateXMLSignatureRequest( + keyIdentifier, + singleSignatureInfos); + } + + /** + * Parse all SingleSignatureInfo elements of the + * CreateXMLSignatureRequest. + * + * @param requestElem The CreateXMLSignatureRequest to parse. + * @return A List of SingleSignatureInfo API + * objects. + * @throws MOAApplicationException An error occurred parsing on of the + * SingleSignatureInfo elements. + */ + private List parseSingleSignatureInfos(Element requestElem) + throws MOAApplicationException { + + List singleSignatureInfos = new ArrayList(); + NodeIterator sigInfoElems = + XPathUtils.selectNodeIterator(requestElem, SINGLE_SIGNATURE_INFO_XPATH); + Element sigInfoElem; + + while ((sigInfoElem = (Element) sigInfoElems.nextNode()) != null) { + singleSignatureInfos.add(parseSingleSignatureInfo(sigInfoElem)); + } + + return singleSignatureInfos; + } + + /** + * Parse a SingleSignatureInfo DOM element. + * + * @param sigInfoElem The SingleSignatureInfo DOM element to + * parse. + * @return A SingleSignatureInfo API object containing the + * information of sigInfoElem. + * @throws MOAApplicationException An error occurred parsing the + * SingleSignatureInfo. + */ + private SingleSignatureInfo parseSingleSignatureInfo(Element sigInfoElem) + throws MOAApplicationException { + + List dataObjectInfos = parseDataObjectInfos(sigInfoElem); + CreateSignatureInfo createSignatureInfo = + parseCreateSignatureInfo(sigInfoElem); + boolean securityLayerConform; + + if (sigInfoElem.hasAttribute(SL_CONFORM_ATTR_NAME)) { + securityLayerConform = + BoolUtils.valueOf(sigInfoElem.getAttribute(SL_CONFORM_ATTR_NAME)); + } else { + securityLayerConform = true; + } + + return factory.createSingleSignatureInfo( + dataObjectInfos, + createSignatureInfo, + securityLayerConform); + } + + /** + * Parse the DataObjectInfo DOM elements contained in the given + * SingleSignatureInfo DOM element. + * + * @param sigInfoElem The SingleSignatureInfo DOM element + * whose DataObjectInfos to parse. + * @return A List of DataObjectInfo API objects + * containing the data from the DataObjectInfo DOM elements. + * @throws MOAApplicationException An error occurred parsing one of the + * DataObjectInfos. + */ + private List parseDataObjectInfos(Element sigInfoElem) + throws MOAApplicationException { + + List dataObjectInfos = new ArrayList(); + NodeIterator dataObjInfoElems = + XPathUtils.selectNodeIterator(sigInfoElem, DATA_OBJECT_INFO_XPATH); + Element dataObjInfoElem; + + while ((dataObjInfoElem = (Element) dataObjInfoElems.nextNode()) != null) { + dataObjectInfos.add(parseDataObjectInfo(dataObjInfoElem)); + } + return dataObjectInfos; + } + + /** + * Parse a DataObjectInfo DOM element. + * + * @param dataObjInfoElem The DataObjectInfo DOM element to + * parse. + * @return A DataObjectInfo API element containing the data + * from dataObjInfoElem. + * @throws MOAApplicationException An error occurred parsing the + * DataObjectInfo. + */ + private DataObjectInfo parseDataObjectInfo(Element dataObjInfoElem) + throws MOAApplicationException { + + String structure = dataObjInfoElem.getAttribute("Structure"); + Element dataObjectElem = + (Element) XPathUtils.selectSingleNode(dataObjInfoElem, DATA_OBJECT_XPATH); + Content dataObject = RequestParserUtils.parseContent(dataObjectElem); + CreateTransformsInfoProfile createTransformsInfoProfile = + parseCreateTransformsInfoProfile(dataObjInfoElem); + boolean childOfManifest; + + if (dataObjInfoElem.hasAttribute("ChildOfManifest")) { + childOfManifest = + BoolUtils.valueOf(dataObjInfoElem.getAttribute("ChildOfManifest")); + } else { + childOfManifest = false; + } + + return factory.createDataObjectInfo( + structure, + childOfManifest, + dataObject, + createTransformsInfoProfile); + } + + /** + * Parse a CreateTransformsInfoProfile DOM element. + * + * @param dataObjInfoElem The DataObjectInfo DOM element + * containing the CreateTransformsInfoProfile. + * @return The CreateTransformsInfoProfile API object containing + * the profile found in dataObjInfoElem. + * @throws MOAApplicationException An error occurred parsing the + * CreateTransformsInfoProfile. + */ + private CreateTransformsInfoProfile parseCreateTransformsInfoProfile(Element dataObjInfoElem) + throws MOAApplicationException { + + Element profileElem = + (Element) XPathUtils.selectSingleNode( + dataObjInfoElem, + CREATE_TRANSFORMS_INFO_PROFILE_XPATH); + + if ("CreateTransformsInfoProfile".equals(profileElem.getLocalName())) { + ProfileParser profileParser = new ProfileParser(); + return profileParser.parseCreateTransformsInfoProfile(profileElem); + + } else { + String profileID = DOMUtils.getText(profileElem); + return factory.createCreateTransformsInfoProfile(profileID); + } + } + + /** + * Parse the CreateSignatureInfo DOM element contained in + * a SingleSignatureInfo. + * + * @param sigInfoElem The SingleSignatureInfo DOM element + * containing the CreateSignatureInfo to be parsed. + * @return A CreateSignatureInfo API object containing the + * data from the CreateSignatureInfo DOM element, or + * null, if none was found. + */ + private CreateSignatureInfo parseCreateSignatureInfo(Element sigInfoElem) { + Element createInfoElem = + (Element) XPathUtils.selectSingleNode( + sigInfoElem, + CREATE_SIGNATURE_INFO_XPATH); + + if (createInfoElem != null) { + Element environmentElem = + (Element) XPathUtils.selectSingleNode( + createInfoElem, + CREATE_SIGNATURE_ENVIRONMENT_XPATH); + Content environment = RequestParserUtils.parseContent(environmentElem); + CreateSignatureEnvironmentProfile environmentProfile = + parseCreateSignatureEnvironmentProfile(createInfoElem); + + return factory.createCreateSignatureInfo(environment, environmentProfile); + } else { + return null; + } + } + + /** + * Parse the CreateSignatureEnvironmentProfile contained in + * the given CreateSignatureInfo DOM element. + * + * @param createInfoElem CreateSignatureInfo DOM element to + * parse. + * @return The CreateSignatureEnvironmentProfile contained + * in the given CreateSignatureInfo DOM element.. + */ + private CreateSignatureEnvironmentProfile parseCreateSignatureEnvironmentProfile(Element createInfoElem) { + Element profileElem = + (Element) XPathUtils.selectSingleNode( + createInfoElem, + CREATE_SIGNATURE_ENVIRONMENT_PROFILE_XPATH); + + if ("CreateSignatureEnvironmentProfile" + .equals(profileElem.getLocalName())) { + ProfileParser profileParser = new ProfileParser(); + return profileParser.parseCreateSignatureEnvironmentProfile(profileElem); + } else { + String profileID = DOMUtils.getText(profileElem); + return factory.createCreateSignatureEnvironmentProfile(profileID); + } + } + +} \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java new file mode 100644 index 000000000..eec9c4882 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java @@ -0,0 +1,119 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.util.Iterator; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import at.gv.egovernment.moa.util.Constants; + +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponseElement; +import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse; +import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse; + +/** + * Convert a CreateXMLSignatureResponse API object into its + * XML representation, according to the MOA XML schema. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CreateXMLSignatureResponseBuilder { + private static final String MOA_NS_URI = Constants.MOA_NS_URI; + + /** The XML document containing the response element. */ + private Document responseDoc; + /** The response CreateXMLSignatureResponse DOM element. */ + private Element responseElem; + + /** + * Create a new CreateXMLSignatureResponseBuilder: + * + * @throws MOASystemException An error occurred setting up the resulting + * XML document. + */ + public CreateXMLSignatureResponseBuilder() throws MOASystemException { + responseDoc = + ResponseBuilderUtils.createResponse("CreateXMLSignatureResponse"); + responseElem = responseDoc.getDocumentElement(); + } + + /** + * Build a document containing a CreateXMLSignatureResponse + * DOM element being the XML representation of the given + * CreateXMLSignatureResponse API object. + * + * @param response The CreateXMLSignatureResponse to convert + * to XML. + * @return A document containing the CreateXMLSignatureResponse + * DOM element. + */ + public Document build(CreateXMLSignatureResponse response) { + Iterator iter; + + for (iter = response.getResponseElements().iterator(); iter.hasNext();) { + CreateXMLSignatureResponseElement responseElement = + (CreateXMLSignatureResponseElement) iter.next(); + + switch (responseElement.getResponseType()) { + case CreateXMLSignatureResponseElement.SIGNATURE_ENVIRONMENT_RESPONSE : + SignatureEnvironmentResponse envResponse = + (SignatureEnvironmentResponse) responseElement; + addSignatureEnvironment(envResponse); + break; + + case CreateXMLSignatureResponseElement.ERROR_RESPONSE : + ErrorResponse errorResponse = (ErrorResponse) responseElement; + addErrorResponse(errorResponse); + break; + } + + } + + return responseDoc; + } + + /** + * Add a SignatureEnvironment element to the response. + * + * @param envResponse The content to put under the + * SignatureEnvironment element. This should either be a + * dsig:Signature element (in case of a detached signature) or + * the signature environment containing the signature (in case of + * an enveloping signature). + */ + private void addSignatureEnvironment(SignatureEnvironmentResponse envResponse) { + Element content = envResponse.getSignatureEnvironment(); + Node importedSignature = responseDoc.importNode(content, true); + Element signatureEnvironment = + responseDoc.createElementNS(MOA_NS_URI, "SignatureEnvironment"); + signatureEnvironment.appendChild(importedSignature); + responseElem.appendChild(signatureEnvironment); + } + + /** + * Add a ErrorResponse element to the response. + * + * @param errorResponse The API object containing the information to put into + * the ErrorResponse DOM element. + */ + private void addErrorResponse(ErrorResponse errorResponse) { + Element errorElem = + responseDoc.createElementNS(MOA_NS_URI, "ErrorResponse"); + Element errorCodeElem = + responseDoc.createElementNS(MOA_NS_URI, "ErrorCode"); + Element infoElem = responseDoc.createElementNS(MOA_NS_URI, "Info"); + String errorCodeStr = Integer.toString(errorResponse.getErrorCode()); + + errorCodeElem.appendChild(responseDoc.createTextNode(errorCodeStr)); + errorElem.appendChild(errorCodeElem); + infoElem.appendChild(responseDoc.createTextNode(errorResponse.getInfo())); + errorElem.appendChild(errorCodeElem); + errorElem.appendChild(infoElem); + responseElem.appendChild(errorElem); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java new file mode 100644 index 000000000..66c08e0ab --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java @@ -0,0 +1,285 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Element; +import org.w3c.dom.traversal.NodeIterator; + +import at.gv.egovernment.moa.util.Base64Utils; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.XPathUtils; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.common.MetaInfo; +import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfile; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation; +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.xmlverify.SupplementProfile; +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfile; + +/** + * Parse the various profile elements contained in the MOA web service requests + * and given as separate files in the MOA configuration. + * + * The profiles parsed must be schema valid according to the MOA XML schema. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ProfileParser { + + // + // XPath expressions to select parts of the profiles + // + private static final String MOA = Constants.MOA_PREFIX + ":"; + private static final String DSIG = Constants.DSIG_PREFIX + ":"; + private static final String CREATE_TRANSFORMS_XPATH = + MOA + "CreateTransformsInfo/" + DSIG + "Transforms"; + private static final String FINAL_DATA_META_INFO_XPATH = + MOA + "CreateTransformsInfo/" + MOA + "FinalDataMetaInfo"; + private static final String CREATE_SIGNATURE_LOCATION_XPATH = + MOA + "CreateSignatureLocation"; + private static final String SUPPLEMENT_XPATH = MOA + "Supplement"; + private static final String VERIFY_TRANSFORMS_XPATH = DSIG + "Transforms"; + private static final String TRANSFORM_PARAMETER_XPATH = + MOA + "TransformParameter"; + private static final String TRANSFORM_PARAMETER_CONTENT_XPATH = + MOA + "Base64Content | " + MOA + "Hash"; + private static final String DIGEST_METHOD_XPATH = DSIG + "DigestMethod"; + private static final String DIGEST_VALUE_XPATH = DSIG + "DigestValue"; + + /** The factory used to create API objects. */ + private SPSSFactory factory = SPSSFactory.getInstance(); + + /** + * Parse a CreateTransformsInfoProfile DOM element. + * + * @param profileElem The CreateTransformsInfoProfile element + * to parse. + * @return The CreateTransformsInfoProfile API object containing + * the data from the profileElem. + * @throws MOAApplicationException An error occurred parsing the DOM element. + */ + public CreateTransformsInfoProfile parseCreateTransformsInfoProfile(Element profileElem) + throws MOAApplicationException { + CreateTransformsInfo createTransformsInfo = + parseCreateTransformsInfo(profileElem); + List supplements = parseSupplements(profileElem); + + return factory.createCreateTransformsInfoProfile( + createTransformsInfo, + supplements); + } + + /** + * Parse the CreateTransformsInfo DOM element contained in a + * CreateTransformsInfoProfile. + * + * @param profileElem The CreateTransformsInfoProfile DOM + * element containing the CreateTransformsInfo. + * @return The CreateTransformsInfo API object containinig the + * data from the CreateTransformsInfo DOM element. + * @throws MOAApplicationException An error occurred parsing the + * CreateTransformsInfo DOM element. + */ + private CreateTransformsInfo parseCreateTransformsInfo(Element profileElem) + throws MOAApplicationException { + + Element transformsElem = + (Element) XPathUtils.selectSingleNode( + profileElem, + CREATE_TRANSFORMS_XPATH); + Element metaInfoElem = + (Element) XPathUtils.selectSingleNode( + profileElem, + FINAL_DATA_META_INFO_XPATH); + MetaInfo finalDataMetaInfo; + List transforms; + + // parse the dsig:Transforms + if (transformsElem != null) { + TransformParser transformsParser = new TransformParser(); + transforms = transformsParser.parseTransforms(transformsElem); + } else { + transforms = null; + } + + // parse the meta info + finalDataMetaInfo = RequestParserUtils.parseMetaInfo(metaInfoElem); + + return factory.createCreateTransformsInfo(transforms, finalDataMetaInfo); + } + + /** + * Parse a CreateSignatureEnvironmentProfile DOM element. + * + * @param profileElem The CreateSignatureEnvironmentProfile + * DOM element to parse. + * @return The CreateSignatureEnvironmentProfile API object + * containing the data from the profileElem. + */ + public CreateSignatureEnvironmentProfile parseCreateSignatureEnvironmentProfile(Element profileElem) { + CreateSignatureLocation createSignatureLocation = + parseCreateSignatureLocation(profileElem); + List supplements = parseSupplements(profileElem); + + return factory.createCreateSignatureEnvironmentProfile( + createSignatureLocation, + supplements); + } + + /** + * Parse a CreateSignatureLocation DOM element contained in + * a CreateSignatureEnvironmentProfile. + * + * @param profileElem The CreateSignatureEnvironmentProfile DOM + * element containing the CreateSignatureLocation. + * @return The CreateSignatureLocation API object containing + * the data from the CreateSignatureLocation DOM element. + */ + private CreateSignatureLocation parseCreateSignatureLocation(Element profileElem) { + Element locationElem = + (Element) XPathUtils.selectSingleNode( + profileElem, + CREATE_SIGNATURE_LOCATION_XPATH); + String xPathExpression = DOMUtils.getText(locationElem); + Map namespaceDeclarations = DOMUtils.getNamespaceDeclarations(locationElem); + String indexStr = locationElem.getAttribute("Index"); + int index = Integer.parseInt(indexStr); + + return factory.createCreateSignatureLocation( + xPathExpression, + index, + namespaceDeclarations); + } + + /** + * Parse all Supplement DOM elements contained in a given + * parent DOM element. + * + * @param supplementsParentElem The DOM element being the parent of the + * Supplements. + * @return A List of Supplement API objects + * containing the data from the Supplement DOM elements. + */ + private List parseSupplements(Element supplementsParentElem) { + List supplements = new ArrayList(); + NodeIterator supplementElems = + XPathUtils.selectNodeIterator(supplementsParentElem, SUPPLEMENT_XPATH); + Element supplementElem; + + while ((supplementElem = (Element) supplementElems.nextNode()) != null) { + XMLDataObjectAssociation supplement = + RequestParserUtils.parseXMLDataObjectAssociation(supplementElem); + supplements.add(supplement); + } + return supplements; + } + + /** + * Parse a SupplementProfile DOM element. + * + * @param profileElem The SupplementProfile DOM element to parse. + * @return The SupplementProfile API object containing the + * data from the SupplementProfile DOM element. + */ + public SupplementProfile parseSupplementProfile(Element profileElem) { + XMLDataObjectAssociation supplementProfile = + RequestParserUtils.parseXMLDataObjectAssociation(profileElem); + + return factory.createSupplementProfile(supplementProfile); + } + + /** + * Parse a VerifyTransformsInfoProfile DOM element. + * + * @param profileElem The VerifyTransformsInfoProfile DOM + * element to parse. + * @return A VerifyTransformsInfoProfile API object containing + * the information from the VerifyTransformsInfoProfile DOM + * element. + * @throws MOAApplicationException An error occurred parsing the + * VerifyTransformsInfoProfile. + */ + public VerifyTransformsInfoProfile parseVerifyTransformsInfoProfile(Element profileElem) + throws MOAApplicationException { + Element transformsElem = + (Element) XPathUtils.selectSingleNode( + profileElem, + VERIFY_TRANSFORMS_XPATH); + List transforms = null; + NodeIterator paramElems = + XPathUtils.selectNodeIterator(profileElem, TRANSFORM_PARAMETER_XPATH); + Element paramElem; + List transformParameters = new ArrayList(); + + // parse the dsig:Transforms + if (transformsElem != null) { + TransformParser transformsParser = new TransformParser(); + transforms = transformsParser.parseTransforms(transformsElem); + } + + // parse the TransformParameter elements + while ((paramElem = (Element) paramElems.nextNode()) != null) { + transformParameters.add(parseTransformParameter(paramElem)); + } + + return factory.createVerifyTransformsInfoProfile( + transforms, + transformParameters); + } + + /** + * Parse a TransformParameter DOM element. + * + * @param paramElem The TransformParameter DOM element to + * parse. + * @return The TransformParameter API object containing the + * information from the TransformParameter DOM element. + * @throws MOAApplicationException An error occurred parsing the + * TransformParameter DOM element. + */ + private TransformParameter parseTransformParameter(Element paramElem) + throws MOAApplicationException { + String uri = paramElem.getAttribute("URI"); + Element contentElem = + (Element) XPathUtils.selectSingleNode( + paramElem, + TRANSFORM_PARAMETER_CONTENT_XPATH); + + if (contentElem == null) { + return factory.createTransformParameter(uri); + } else if ("Base64Content".equals(contentElem.getLocalName())) { + String base64Str = DOMUtils.getText(contentElem); + InputStream binaryContent = Base64Utils.decodeToStream(base64Str, true); + + return factory.createTransformParameter(uri, binaryContent); + } else { // "Hash".equals(contentElem.getLocalName()) + String digestMethodStr = + XPathUtils.getElementValue(contentElem, DIGEST_METHOD_XPATH, ""); + String digestValueStr = + XPathUtils.getElementValue(contentElem, DIGEST_VALUE_XPATH, ""); + byte[] digestValue = null; + + try { + digestValue = Base64Utils.decode(digestValueStr, true); + } catch (IOException e) { + throw new MOAApplicationException("2270", null); + } + return factory.createTransformParameter( + uri, + digestMethodStr, + digestValue); + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java new file mode 100644 index 000000000..9e8c7d0e2 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java @@ -0,0 +1,157 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.text.ParseException; +import java.util.Date; + +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.util.Base64Utils; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.DateTimeUtils; +import at.gv.egovernment.moa.util.XPathUtils; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +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.common.XMLDataObjectAssociation; + +/** + * Utility methods for parsing XML requests definied in the MOA XML schema. + * + * @author Patrick Peck + * @version $Id$ + */ +public class RequestParserUtils { + // + // XPath expressions for parsing parts of a request + // + private static final String MOA = Constants.MOA_PREFIX + ":"; + private static final String REFERENCE_ATTR_NAME = "Reference"; + private static final String MIME_TYPE_XPATH = MOA + "MimeType"; + private static final String DESCRIPTION_XPATH = MOA + "Description"; + private static final String TYPE_XPATH = MOA + "Type"; + private static final String XML_ASSOC_CONTENT_XPATH = MOA + "Content"; + private static final String CONTENT_XPATH = + MOA + "Base64Content | " + MOA + "XMLContent |" + MOA + "LocRefContent"; + private static final String ANY_OTHER_XPATH = + "*[namespace-uri() != \"" + Constants.MOA_NS_URI + "\"]"; + + /** + * Parse a XMLDataObjectAssociationType kind of DOM element. + * + * @param assocElem The XMLDataObjectAssociationType kind of + * DOM elmeent to parse. + * @return The XMLDataObjectAssociation API object containing + * the data from the XMLDataObjectAssociationType DOM element. + */ + public static XMLDataObjectAssociation parseXMLDataObjectAssociation(Element assocElem) { + SPSSFactory factory = SPSSFactory.getInstance(); + MetaInfo metaInfo = parseMetaInfo(assocElem); + Element contentElem = + (Element) XPathUtils.selectSingleNode(assocElem, XML_ASSOC_CONTENT_XPATH); + Content content = parseContent(contentElem); + + return factory.createXMLDataObjectAssociation(metaInfo, content); + } + + /** + * Parse a MetaInfoType kind of DOM element. + * + * @param metaInfoElem The MetaInfoType kind of DOM element. + * @return The MetaInfo API object containing the data from + * the metaInfoElem. + */ + public static MetaInfo parseMetaInfo(Element metaInfoElem) { + SPSSFactory factory = SPSSFactory.getInstance(); + String mimeType = + XPathUtils.getElementValue(metaInfoElem, MIME_TYPE_XPATH, null); + String description = + XPathUtils.getElementValue(metaInfoElem, DESCRIPTION_XPATH, null); + NodeList anyOther = + XPathUtils.selectNodeList(metaInfoElem, ANY_OTHER_XPATH); + String type = + XPathUtils.getElementValue(metaInfoElem, TYPE_XPATH, null); + + return factory.createMetaInfo(mimeType, description, anyOther, type); + } + + /** + * Parse a ContentOptionalRefType or + * ContentRequiredRefType kind of DOM element. + * @param contentParentElem The DOM element being the parent of the + * content element. + * @return The Content API object containing the data from + * the given DOM element. + */ + public static Content parseContent(Element contentParentElem) { + SPSSFactory factory = SPSSFactory.getInstance(); + String referenceURI = + contentParentElem.hasAttribute(REFERENCE_ATTR_NAME) + ? contentParentElem.getAttribute(REFERENCE_ATTR_NAME) + : null; + Element contentElem = + (Element) XPathUtils.selectSingleNode(contentParentElem, CONTENT_XPATH); + + if (contentElem == null) { + return factory.createContent(referenceURI); + } + + if ("Base64Content".equals(contentElem.getLocalName())) { + String base64String = DOMUtils.getText(contentElem); + return factory.createContent( + Base64Utils.decodeToStream(base64String, true), + referenceURI); + } else if ("LocRefContent".equals(contentElem.getLocalName())) { + String locationReferenceURI = DOMUtils.getText(contentElem); + return factory.createContent( + locationReferenceURI, + referenceURI); + } else { // "XMLContent".equals(contentElem.getLocalName()) + return factory.createContent( + contentElem.getChildNodes(), + referenceURI); + } + } + + /** + * Get the signing time from a Verfiy(CMS|XML)SignatureRequest. + * + * @param requestElem A Verify(CMS|XML)SignatureRequest DOM + * element. + * @param dateTimeXPath The XPath to lookup the DateTime element + * within the request. + * @return Date The date and time corresponding to the DateTime + * element in the request. If no DateTime element exists in the + * request, null is returned. + * @throws MOAApplicationException An error occurred during a parsing the + * DateTime element or creating the return value. + */ + public static Date parseDateTime(Element requestElem, String dateTimeXPath) + throws MOAApplicationException { + + Element dateTimeElem; + String dateTimeText; + + // select the DateTime element + dateTimeElem = + (Element) XPathUtils.selectSingleNode(requestElem, dateTimeXPath); + + // parse a date from the element value + if (dateTimeElem != null) { + dateTimeText = DOMUtils.getText(dateTimeElem); + try { + return DateTimeUtils.parseDateTime(dateTimeText); + } catch (ParseException e) { + throw new MOAApplicationException( + "1104", + new Object[] { dateTimeText }); + } + } else { + return null; + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java new file mode 100644 index 000000000..44134a70c --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java @@ -0,0 +1,206 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.io.IOException; +import java.security.cert.CertificateEncodingException; +import java.security.cert.X509Certificate; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; + +import at.gv.egovernment.moa.util.Base64Utils; +import at.gv.egovernment.moa.util.Constants; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOASystemException; + +/** + * Utility methods used by the verious ResponseBuilder classes. + * + * @author Patrick Peck + * @version $Id$ + */ +class ResponseBuilderUtils { + // + // shortcuts to various XML namespace constants + // + private static final String MOA_NS_URI = Constants.MOA_NS_URI; + private static final String DSIG = Constants.DSIG_PREFIX + ":"; + private static final String DSIG_NS_URI = Constants.DSIG_NS_URI; + private static final String XMLNS_NS_URI = Constants.XMLNS_NS_URI; + + /** + * Create a response element with all the namespaces set. + * + * @param responseName The name of the response root element. + * @return A DOM document containing the response root element and predefined + * MOA, DSIG and XML namespace declarations. + * @throws MOASystemException An error building the response document. + */ + public static Document createResponse(String responseName) + throws MOASystemException { + + try { + DocumentBuilder docBuilder = + DocumentBuilderFactory.newInstance().newDocumentBuilder(); + DOMImplementation impl = docBuilder.getDOMImplementation(); + Document response; + Element root; + String attrValue; + + response = impl.createDocument(MOA_NS_URI, responseName, null); + root = response.getDocumentElement(); + + // add namespace prefix declarations + root.setAttributeNS(XMLNS_NS_URI, "xmlns", MOA_NS_URI); + attrValue = "xmlns:" + Constants.DSIG_PREFIX; + root.setAttributeNS(XMLNS_NS_URI, attrValue, DSIG_NS_URI); + + return response; + } catch (ParserConfigurationException e) { + throw new MOASystemException("2200", null, e); + } + } + + /** + * Add a SignerInfo element to the response. + * + * @param response The response document, in order to create new elements in + * it. + * @param root The root element into which the SignerInfo element + * will be inserted. + * @param cert The signer certificate to add. + * @param isQualified Indicates, whether cert is a qualified + * certificate. + * @param isPublicAuthority Indicates, whether cert is + * certificate owned by a public authority. + * @param publicAuthorityID Information about the public authority owning + * cert. Must not be null, if + * isPublicAuthority ! = null. + * @throws MOAApplicationException An error occurred reading data from the + * certificate. + */ + public static void addSignerInfo( + Document response, + Element root, + X509Certificate cert, + boolean isQualified, + boolean isPublicAuthority, + String publicAuthorityID) + throws MOAApplicationException { + + Element signerInfoElem = response.createElementNS(MOA_NS_URI, "SignerInfo"); + Element x509DataElem = + response.createElementNS(DSIG_NS_URI, DSIG + "X509Data"); + Element x509IssuerSerialElem = + response.createElementNS(DSIG_NS_URI, DSIG + "X509IssuerSerial"); + Element x509IssuerElem = + response.createElementNS(DSIG_NS_URI, DSIG + "X509IssuerName"); + String issuer = cert.getIssuerDN().getName(); + Element x509SerialNumberElem = + response.createElementNS(DSIG_NS_URI, DSIG + "X509SerialNumber"); + String serialNumber = cert.getSerialNumber().toString(); + Element x509SubjectNameElem = + response.createElementNS(DSIG_NS_URI, DSIG + "X509SubjectName"); + Element x509CertificateElem = + response.createElementNS(DSIG_NS_URI, DSIG + "X509Certificate"); + Element qualifiedCertificateElem = + isQualified + ? response.createElementNS(MOA_NS_URI, "QualifiedCertificate") + : null; + Element publicAuthorityElem = + isPublicAuthority + ? response.createElementNS(MOA_NS_URI, "PublicAuthority") + : null; + Element codeElem = + publicAuthorityID != null + ? response.createElementNS(MOA_NS_URI, "Code") + : null; + + // fill in text + x509IssuerElem.appendChild(response.createTextNode(issuer)); + x509SerialNumberElem.appendChild(response.createTextNode(serialNumber)); + try { + RFC2253NameParser parser = + new RFC2253NameParser(cert.getSubjectDN().getName()); + String subjectRfc2253 = parser.parse().getRFC2253String(); + x509SubjectNameElem.appendChild(response.createTextNode(subjectRfc2253)); + } catch (RFC2253NameParserException e) { + x509SubjectNameElem.appendChild( + response.createTextNode(cert.getSubjectDN().getName())); + } + try { + x509CertificateElem.appendChild( + response.createTextNode(Base64Utils.encode(cert.getEncoded()))); + } catch (CertificateEncodingException e) { + throw new MOAApplicationException("2245", null, e); + } catch (IOException e) { + throw new MOAApplicationException("2245", null, e); + } + + // build structure + x509DataElem.appendChild(x509SubjectNameElem); + x509IssuerSerialElem.appendChild(x509IssuerElem); + x509IssuerSerialElem.appendChild(x509SerialNumberElem); + x509DataElem.appendChild(x509IssuerSerialElem); + x509DataElem.appendChild(x509CertificateElem); + if (isQualified) { + x509DataElem.appendChild(qualifiedCertificateElem); + } + if (isPublicAuthority) { + x509DataElem.appendChild(publicAuthorityElem); + if (publicAuthorityID != null) { + codeElem.appendChild(response.createTextNode(publicAuthorityID)); + publicAuthorityElem.appendChild(codeElem); + } + } + signerInfoElem.appendChild(x509DataElem); + root.appendChild(signerInfoElem); + } + + /** + * Add an element containing Code and Info + * subelements. + * + * @param response The response document, in order to create new elements in + * it. + * @param root The root element into which to insert the newly created + * element. + * @param elementName The name of the newly created element. + * @param code The content of the Code subelement. + * @param info The content of the Info subelement. + */ + public static void addCodeInfoElement( + Document response, + Element root, + String elementName, + int code, + NodeList info) { + + Element codeInfoElem = response.createElementNS(MOA_NS_URI, elementName); + Element codeElem = response.createElementNS(MOA_NS_URI, "Code"); + Element infoElem; + int i; + + codeElem.appendChild(response.createTextNode(Integer.toString(code))); + codeInfoElem.appendChild(codeElem); + if (info != null) { + infoElem = response.createElementNS(MOA_NS_URI, "Info"); + + for (i = 0; i < info.getLength(); i++) { + infoElem.appendChild(info.item(i).cloneNode(true)); + } + codeInfoElem.appendChild(infoElem); + } + root.appendChild(codeInfoElem); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java new file mode 100644 index 000000000..2d01f2a0f --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java @@ -0,0 +1,246 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import org.w3c.dom.Element; +import org.w3c.dom.traversal.NodeIterator; + +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.XPathUtils; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.common.Base64Transform; +import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform; +import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform; +import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform; +import at.gv.egovernment.moa.spss.api.common.Transform; +import at.gv.egovernment.moa.spss.api.common.XPathFilter; +import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform; +import at.gv.egovernment.moa.spss.api.common.XPathTransform; +import at.gv.egovernment.moa.spss.api.common.XSLTTransform; + +/** + * A parser to parse XMLDsig Transform DOM elements into their + * MOA SPSS API representation. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TransformParser { + // + // XPath expressions for selecting information from the DOM tree + // + private static final String DSIG = Constants.DSIG_PREFIX + ":"; + private static final String DSIG_FILTER2 = + Constants.DSIG_FILTER2_PREFIX + ":"; + private static final String XSLT = Constants.XSLT_PREFIX + ":"; + private static final String EC = Constants.DSIG_EC_PREFIX + ":"; + private static final String TRANSFORM_XPATH = DSIG + "Transform"; + private static final String XPATH_XPATH = DSIG + "XPath"; + private static final String XSLT_ELEMENT_XPATH = XSLT + "stylesheet"; + private static final String XPATH2_XPATH = + (DSIG_FILTER2 + "XPath[@Filter=\"intersect\"] | ") + + (DSIG_FILTER2 + "XPath[@Filter=\"subtract\"] | ") + + (DSIG_FILTER2 + "XPath[@Filter=\"union\"]"); + private static final String INCLUSIVE_NAMESPACES_XPATH = + EC + "InclusiveNamespaces"; + + /** + * The SPSSFactory to use for creating new API objects. + */ + private SPSSFactory factory = SPSSFactory.getInstance(); + + /** + * Parse an XMLDsig Transforms DOM element. + * + * @param transformsElem The Transforms DOM element to parse. + * @return A List of Transform API objects + * containing the data from the individual Transform DOM + * elements. + * @throws MOAApplicationException An error occurred parsing the + * Transforms DOM element. + */ + public List parseTransforms(Element transformsElem) + throws MOAApplicationException { + List transforms = new ArrayList(); + NodeIterator transformElems = + XPathUtils.selectNodeIterator(transformsElem, TRANSFORM_XPATH); + Element transformElem; + Transform transform; + + while ((transformElem = (Element) transformElems.nextNode()) != null) { + transform = parseTransform(transformElem); + transforms.add(transform); + } + + return transforms; + } + + /** + * Parse an XMLDsig Transform DOM element. + * + * @param transformElem Transform DOM element to parse. + * @return The Transform API object containing the data + * from the Transform DOM element. + * @throws MOAApplicationException An error occurred parsing the + * Transform DOM element. + */ + public Transform parseTransform(Element transformElem) + throws MOAApplicationException { + + String algorithmUri = transformElem.getAttribute("Algorithm"); + + if (CanonicalizationTransform.CANONICAL_XML.equals(algorithmUri) + || CanonicalizationTransform.CANONICAL_XML_WITH_COMMENTS.equals( + algorithmUri)) { + return factory.createCanonicalizationTransform(algorithmUri); + } else if ( + ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML.equals( + algorithmUri) + || ExclusiveCanonicalizationTransform + .EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS + .equals( + algorithmUri)) { + return parseExclusiveC14nTransform(algorithmUri, transformElem); + } else if (Base64Transform.BASE64_DECODING.equals(algorithmUri)) { + return factory.createBase64Transform(); + } else if ( + EnvelopedSignatureTransform.ENVELOPED_SIGNATURE.equals(algorithmUri)) { + return factory.createEnvelopedSignatureTransform(); + } else if (XPathTransform.XPATH.equals(algorithmUri)) { + return parseXPathTransform(transformElem); + } else if (XPathFilter2Transform.XPATH_FILTER2.equals(algorithmUri)) { + return parseXPathFilter2Transform(transformElem); + } else if (XSLTTransform.XSLT.equals(algorithmUri)) { + return parseXSLTTransform(transformElem); + } else { + throw new MOAApplicationException("1108", new Object[] { algorithmUri }); + } + } + + /** + * Parse an exclusive canonicalization type of transform. + * + * @param algorithmUri The algorithm URI of the canonicalization algorithm. + * @param transformElem The Transform DOM element to parse. + * @return An ExclusiveCanonicalizationTransform API object + * containing the data from the transformElem. + */ + private Transform parseExclusiveC14nTransform( + String algorithmUri, + Element transformElem) + { + + Element inclusiveNamespacesElem = + (Element) XPathUtils.selectSingleNode( + transformElem, + INCLUSIVE_NAMESPACES_XPATH); + + List inclusiveNamespaces = new ArrayList(); + if (inclusiveNamespacesElem != null) + { + StringTokenizer tokenizer = new StringTokenizer(inclusiveNamespacesElem.getAttribute("PrefixList")); + while (tokenizer.hasMoreTokens()) + { + inclusiveNamespaces.add(tokenizer.nextToken()); + } + } + return factory.createExclusiveCanonicalizationTransform( + algorithmUri, + inclusiveNamespaces); + } + + /** + * Parse an XPath type of Transform. + * + * @param transformElem The Transform DOM element to parse. + * @return The Transform API object representation of the + * Transform DOM element. + * @throws MOAApplicationException An error occurred parsing the + * Transform DOM element. + */ + private Transform parseXPathTransform(Element transformElem) + throws MOAApplicationException { + Element xPathElem = + (Element) XPathUtils.selectSingleNode(transformElem, XPATH_XPATH); + Map nsDecls; + + if (xPathElem == null) { + throw new MOAApplicationException("2202", null); + } + + nsDecls = DOMUtils.getNamespaceDeclarations(xPathElem); + nsDecls.remove(""); + + return factory.createXPathTransform(DOMUtils.getText(xPathElem), nsDecls); + } + + /** + * Parse an XPathFilter2 type of Transform. + * + * @param transformElem The Transform DOM element to parse. + * @return The Transform API object representation of the + * Transform DOM element. + * @throws MOAApplicationException An error occurred parsing the + * Transform DOM element. + */ + private Transform parseXPathFilter2Transform(Element transformElem) + throws MOAApplicationException { + List filters = new ArrayList(); + NodeIterator iter = + XPathUtils.selectNodeIterator(transformElem, XPATH2_XPATH); + Element filterElem; + + while ((filterElem = (Element) iter.nextNode()) != null) { + String filterAttr = filterElem.getAttribute("Filter"); + String filterType; + String expression; + Map nsDecls; + + if (filterAttr.equals("intersect")) { + filterType = XPathFilter.INTERSECT_TYPE; + } else if (filterAttr.equals("subtract")) { + filterType = XPathFilter.SUBTRACT_TYPE; + } else { + filterType = XPathFilter.UNION_TYPE; + } + + expression = DOMUtils.getText(filterElem); + nsDecls = DOMUtils.getNamespaceDeclarations(filterElem); + nsDecls.remove(""); + filters.add(factory.createXPathFilter(filterType, expression, nsDecls)); + } + if (filters.size() == 0) { + throw new MOAApplicationException("2216", null); + } + + return factory.createXPathFilter2Transform(filters); + } + + /** + * Parse an XSLT type of Transform. + * + * @param transformElem The Transform DOM element to parse. + * @return The Transform API object representation of the + * Transform DOM element. + * @throws MOAApplicationException An error occurred parsing the + * Transform DOM element. + */ + private Transform parseXSLTTransform(Element transformElem) + throws MOAApplicationException { + Element xsltElem = + (Element) XPathUtils.selectSingleNode(transformElem, XSLT_ELEMENT_XPATH); + + if (xsltElem == null) { + throw new MOAApplicationException("2215", null); + } + + return factory.createXSLTTransform(xsltElem); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java new file mode 100644 index 000000000..74d14b7cc --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java @@ -0,0 +1,169 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.StringTokenizer; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.util.Base64Utils; +import at.gv.egovernment.moa.util.CollectionUtils; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.XPathUtils; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.common.MetaInfo; + +/** + * A parser to parse VerifyCMSSignatureRequest DOM trees into + * VerifyCMSSignatureRequest API objects. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyCMSSignatureRequestParser { + + // + // XPath expressions for selecting parts of the DOM message + // + private static final String MOA = Constants.MOA_PREFIX + ":"; + private static final String DATE_TIME_XPATH = MOA + "DateTime"; + private static final String CMS_SIGNATURE_XPATH = MOA + "CMSSignature"; + private static final String TRUST_PROFILE_ID_XPATH = MOA + "TrustProfileID"; + private static final String DATA_OBJECT_XPATH = MOA + "DataObject"; + private static final String META_INFO_XPATH = MOA + "MetaInfo"; + private static final String CONTENT_XPATH = MOA + "Content"; + private static final String BASE64_CONTENT_XPATH = MOA + "Base64Content"; + + /** The SPSSFactory for creating new API objects. */ + private SPSSFactory factory = SPSSFactory.getInstance(); + + /** + * Parse a VerifyCMSSignatureRequest DOM element, as defined + * by the MOA schema. + * + * @param requestElem The VerifyCMSSignatureRequest to parse. The + * request must have been successfully parsed against the schema for this + * method to succeed. + * @return A VerifyCMSSignatureRequest API objects containing + * the data from the DOM element. + * @throws MOAApplicationException An error occurred parsing the request. + */ + public VerifyCMSSignatureRequest parse(Element requestElem) + throws MOAApplicationException { + + int[] signatories = parseSignatories(requestElem); + Date dateTime = + RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH); + String cmsSignatureStr = + XPathUtils.getElementValue(requestElem, CMS_SIGNATURE_XPATH, ""); + CMSDataObject dataObject = parseDataObject(requestElem); + String trustProfileID = + XPathUtils.getElementValue(requestElem, TRUST_PROFILE_ID_XPATH, null); + InputStream cmsSignature = + Base64Utils.decodeToStream(cmsSignatureStr, true); + + return factory.createVerifyCMSSignatureRequest( + signatories, + dateTime, + cmsSignature, + dataObject, + trustProfileID); + } + + /** + * Parse the Signatories attribute contained in the + * VerifyCMSSignatureRequest DOM element. + * + * @param requestElem The VerifyCMSSignatureRequest DOM element. + * @return The signatories contained in the given + * VerifyCMSSignatureRequest DOM element. + */ + private int[] parseSignatories(Element requestElem) { + String signatoriesStr = requestElem.getAttribute("Signatories"); + + if ("all".equals(signatoriesStr)) { + return VerifyCMSSignatureRequest.ALL_SIGNATORIES; + } else { + StringTokenizer tokenizer = new StringTokenizer(signatoriesStr); + List signatoriesList = new ArrayList(); + int[] signatories; + + // put the signatories into a List + while (tokenizer.hasMoreTokens()) { + try { + signatoriesList.add(new Integer(tokenizer.nextToken())); + } catch (NumberFormatException e) { + // this cannot occur if the request has been validated + } + } + + // convert the List into an int array + signatories = CollectionUtils.toIntArray(signatoriesList); + + return signatories; + } + } + + /** + * Parse a the DataObject DOM element contained in a given + * VerifyCMSSignatureRequest DOM element. + * + * @param requestElem The VerifyCMSSignatureRequest DOM element + * to parse. + * @return The CMSDataObject API object containing the data + * from the DataObject DOM element. + */ + private CMSDataObject parseDataObject(Element requestElem) { + Element dataObjectElem = + (Element) XPathUtils.selectSingleNode(requestElem, DATA_OBJECT_XPATH); + + if (dataObjectElem != null) { + Element metaInfoElem = + (Element) XPathUtils.selectSingleNode(dataObjectElem, META_INFO_XPATH); + MetaInfo metaInfo = null; + Element contentElem = + (Element) XPathUtils.selectSingleNode(dataObjectElem, CONTENT_XPATH); + CMSContent content = parseContent(contentElem); + + if (metaInfoElem != null) { + metaInfo = RequestParserUtils.parseMetaInfo(metaInfoElem); + } + + return factory.createCMSDataObject(metaInfo, content); + } else { + return null; + } + + } + + /** + * Parse the content contained in a CMSContentBaseType kind of + * DOM element. + * + * @param contentElem The CMSContentBaseType kind of element to + * parse. + * @return A CMSDataObject API object containing the data + * from the given DOM element. + */ + private CMSContent parseContent(Element contentElem) { + Element base64ContentElem = + (Element) XPathUtils.selectSingleNode(contentElem, BASE64_CONTENT_XPATH); + + if (base64ContentElem != null) { + String base64Str = DOMUtils.getText(base64ContentElem); + InputStream binaryContent = Base64Utils.decodeToStream(base64Str, true); + return factory.createCMSContent(binaryContent); + } else { + return factory.createCMSContent( + contentElem.getAttribute("Reference")); + } + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java new file mode 100644 index 000000000..3fc8f223d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java @@ -0,0 +1,101 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.util.Iterator; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; +import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.SignerInfo; + +/** + * Convert a VerifyCMSSignatureResponse API object into its + * XML representation, according to the MOA XML schema. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyCMSSignatureResponseBuilder { + /** The XML document containing the response element. */ + private Document responseDoc; + /** The response VerifyCMSSignatureResponse DOM element. */ + private Element responseElem; + + /** + * Create a new VerifyCMSSignatureResponseBuilder: + * + * @throws MOASystemException An error occurred setting up the resulting + * XML document. + */ + public VerifyCMSSignatureResponseBuilder() throws MOASystemException { + responseDoc = + ResponseBuilderUtils.createResponse("VerifyCMSSignatureResponse"); + responseElem = responseDoc.getDocumentElement(); + } + + /** + * Build a document containing a VerifyCMSSignatureResponse + * DOM element being the XML representation of the given + * VerifyCMSSignatureResponse API object. + * + * @param response The VerifyCMSSignatureResponse to convert + * to XML. + * @return A document containing the VerifyCMSSignatureResponse + * DOM element. + * @throws MOAApplicationException An error occurred building the response. + */ + public Document build(VerifyCMSSignatureResponse response) + throws MOAApplicationException { + + Iterator iter; + + for (iter = response.getResponseElements().iterator(); iter.hasNext();) { + VerifyCMSSignatureResponseElement responseElement = + (VerifyCMSSignatureResponseElement) iter.next(); + addResponseElement(responseElement); + } + + return responseDoc; + } + + /** + * Add an element to the response. + * + * @param responseElement The element to add to the response. + * @throws MOAApplicationException An error occurred adding the element. + */ + private void addResponseElement(VerifyCMSSignatureResponseElement responseElement) + throws MOAApplicationException { + + SignerInfo signerInfo = responseElement.getSignerInfo(); + CheckResult signatureCheck = responseElement.getSignatureCheck(); + CheckResult certCheck = responseElement.getCertificateCheck(); + + ResponseBuilderUtils.addSignerInfo( + responseDoc, + responseElem, + signerInfo.getSignerCertificate(), + signerInfo.isQualifiedCertificate(), + signerInfo.isPublicAuthority(), + signerInfo.getPublicAuhtorityID()); + + ResponseBuilderUtils.addCodeInfoElement( + responseDoc, + responseElem, + "SignatureCheck", + signatureCheck.getCode(), + signatureCheck.getInfo()); + + ResponseBuilderUtils.addCodeInfoElement( + responseDoc, + responseElem, + "CertificateCheck", + certCheck.getCode(), + certCheck.getInfo()); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java new file mode 100644 index 000000000..e736af522 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java @@ -0,0 +1,275 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Element; +import org.w3c.dom.traversal.NodeIterator; + +import at.gv.egovernment.moa.util.BoolUtils; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.XPathUtils; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; +import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfile; +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; + +/** + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyXMLSignatureRequestParser { + + // + // XPath expressions for parsing parts of the request + // + private static final String MOA = Constants.MOA_PREFIX + ":"; + private static final String DATE_TIME_XPATH = MOA + "DateTime"; + private static final String RETURN_HASH_INPUT_DATA_XPATH = + MOA + "ReturnHashInputData"; + private static final String TRUST_PROFILE_ID_XPATH = MOA + "TrustProfileID"; + private static final String VERIFY_SIGNATURE_ENVIRONMENT_XPATH = + MOA + "VerifySignatureInfo/" + MOA + "VerifySignatureEnvironment"; + private static final String VERIFY_SIGNATURE_LOCATION_XPATH = + MOA + "VerifySignatureInfo/" + MOA + "VerifySignatureLocation"; + private static final String SUPPLEMENT_PROFILE_XPATH = + MOA + "SupplementProfile | " + MOA + "SupplementProfileID"; + private static final String SIGNATURE_MANIFEST_CHECK_PARAMS_XPATH = + MOA + "SignatureManifestCheckParams"; + private static final String VERIFY_TRANSFORMS_INFO_PROFILE_XPATH = + (MOA + "VerifyTransformsInfoProfile | ") + + (MOA + "VerifyTransformsInfoProfileID"); + private static final String REFERENCE_INFO_XPATH = MOA + "ReferenceInfo"; + + /** The SPSSFactory for creating new API objects. */ + private SPSSFactory factory = SPSSFactory.getInstance(); + + + /** + * Parse a VerifyXMLSignatureRequest DOM element, as defined + * by the MOA schema. + * + * @param requestElem The VerifyXMLSignatureRequest to parse. The + * request must have been successfully parsed against the schema for this + * method to succeed. + * @return A VerifyXMLSignatureRequest API object containing + * the data from the DOM element. + * @throws MOAApplicationException An error occurred parsing the request. + */ + public VerifyXMLSignatureRequest parse(Element requestElem) + throws MOAApplicationException { + + Date dateTime = + RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH); + VerifySignatureInfo verifySignatureInfo = + parseVerifySignatureInfo(requestElem); + List supplementProfiles = parseSupplementProfiles(requestElem); + SignatureManifestCheckParams signatureManifestCheckParams = + parseSignatureManifestCheckParams(requestElem); + boolean returnHashInputData = + XPathUtils.selectSingleNode(requestElem, RETURN_HASH_INPUT_DATA_XPATH) + != null; + String trustProfileID = + XPathUtils.getElementValue(requestElem, TRUST_PROFILE_ID_XPATH, null); + + return factory.createVerifyXMLSignatureRequest( + dateTime, + verifySignatureInfo, + supplementProfiles, + signatureManifestCheckParams, + returnHashInputData, + trustProfileID); + } + + /** + * Parse the VerifySignatureInfo DOM element contained in + * the VerifyXMLSignatureRequest DOM element. + * + * @param requestElem The VerifyXMLSignatureRequest DOM element + * containing the VerifySignatureInfo DOM element. + * @return The VerifySignatureInfo API object containing the + * data from the DOM element. + */ + private VerifySignatureInfo parseVerifySignatureInfo(Element requestElem) { + Element verifySignatureEnvironmentElem = + (Element) XPathUtils.selectSingleNode( + requestElem, + VERIFY_SIGNATURE_ENVIRONMENT_XPATH); + Content verifySignatureEnvironment = + RequestParserUtils.parseContent(verifySignatureEnvironmentElem); + VerifySignatureLocation verifySignatureLocation = + parseVerifySignatureLocation(requestElem); + + return factory.createVerifySignatureInfo( + verifySignatureEnvironment, + verifySignatureLocation); + } + + /** + * Parse the VerifySignatureLocation DOM element contained + * in the given VerifyXMLSignatureRequest DOM element. + * + * @param requestElem The VerifyXMLSignatureRequst DOM element. + * @return The VerifySignatureLocation API object containing the + * data from the DOM element. + */ + private VerifySignatureLocation parseVerifySignatureLocation(Element requestElem) { + Element locationElem = + (Element) XPathUtils.selectSingleNode( + requestElem, + VERIFY_SIGNATURE_LOCATION_XPATH); + String xPathExpression = DOMUtils.getText(locationElem); + Map namespaceDeclarations = DOMUtils.getNamespaceDeclarations(locationElem); + + return factory.createVerifySignatureLocation( + xPathExpression, + namespaceDeclarations); + } + + /** + * Parse the supplement profiles contained in the given + * VerifyXMLSignatureRequest DOM element. + * + * @param requestElem The VerifyXMLSignatureRequest DOM element. + * @return A List of SupplementProfile API objects + * containing the data from the SupplementProfile DOM elements. + */ + private List parseSupplementProfiles(Element requestElem) { + List supplementProfiles = new ArrayList(); + NodeIterator profileElems = + XPathUtils.selectNodeIterator(requestElem, SUPPLEMENT_PROFILE_XPATH); + Element profileElem; + + while ((profileElem = (Element) profileElems.nextNode()) != null) { + SupplementProfile profile; + + if ("SupplementProfile".equals(profileElem.getLocalName())) { + ProfileParser profileParser = new ProfileParser(); + profile = profileParser.parseSupplementProfile(profileElem); + } else { + String profileID = DOMUtils.getText(profileElem); + profile = factory.createSupplementProfile(profileID); + } + supplementProfiles.add(profile); + } + return supplementProfiles; + } + + /** + * Parse the SignatureManifestCheckParams DOM element contained + * in the given VerifyXMLSignatureRequest DOM element. + * @param requestElem The VerifyXMLSignatureRequest DOM element. + * @return The SignatureManifestCheckParams API object containing + * the data from the SignatureManifestCheckParams DOM element. + * @throws MOAApplicationException An error occurred parsing the + * SignatureManifestCheckParams DOM element. + */ + private SignatureManifestCheckParams parseSignatureManifestCheckParams(Element requestElem) + throws MOAApplicationException { + Element paramsElem = + (Element) XPathUtils.selectSingleNode( + requestElem, + SIGNATURE_MANIFEST_CHECK_PARAMS_XPATH); + + if (paramsElem != null) { + String returnReferenceInputDataStr = + paramsElem.getAttribute("ReturnReferenceInputData"); + boolean returnReferencInputData = + BoolUtils.valueOf(returnReferenceInputDataStr); + List referenceInfos = parseReferenceInfos(paramsElem); + + return factory.createSignatureManifestCheckParams( + referenceInfos, + returnReferencInputData); + } else { + return null; + } + } + + /** + * Parse the ReferenceInfo DOM elements contained in a + * SignatureManifestCheckParams DOM element. + * + * @param paramsElem The SignatureManifestCheckParams DOM element + * containing the ReferenceInfo DOM elements. + * @return A List of RefernceInfo API objects + * containing the data from the ReferenceInfo DOM elements. + * @throws MOAApplicationException An error occurred parsing the + * ReferenceInfo DOM elements. + */ + private List parseReferenceInfos(Element paramsElem) + throws MOAApplicationException { + + List referenceInfos = new ArrayList(); + NodeIterator refInfoElems = + XPathUtils.selectNodeIterator(paramsElem, REFERENCE_INFO_XPATH); + Element refInfoElem; + + while ((refInfoElem = (Element) refInfoElems.nextNode()) != null) { + ReferenceInfo referenceInfo = parseReferenceInfo(refInfoElem); + + referenceInfos.add(referenceInfo); + } + + return referenceInfos; + } + + /** + * Parse a ReferenceInfo DOM element. + * + * @param refInfoElem The ReferenceInfo DOM element to parse. + * @return The ReferenceInfo API object containing the data + * from the given ReferenceInfo DOM element. + * @throws MOAApplicationException An error occurred parsing the + * ReferenceInfo DOM element. + */ + private ReferenceInfo parseReferenceInfo(Element refInfoElem) + throws MOAApplicationException { + List profiles = parseVerifyTransformsInfoProfiles(refInfoElem); + return factory.createReferenceInfo(profiles); + } + + /** + * Parse the VerifyTransformsInfoProfile DOM elements contained + * in a ReferenceInfo DOM element. + * + * @param refInfoElem ReferenceInfo DOM element containing + * the VerifyTransformsInfoProfile DOM elements. + * @return A List of VerifyTransformsInfoProfile + * API objects containing the profile data. + * @throws MOAApplicationException An error occurred building the + * VerifyTransformsInfoProfiles. + */ + private List parseVerifyTransformsInfoProfiles(Element refInfoElem) + throws MOAApplicationException { + + List profiles = new ArrayList(); + NodeIterator profileElems = + XPathUtils.selectNodeIterator( + refInfoElem, + VERIFY_TRANSFORMS_INFO_PROFILE_XPATH); + Element profileElem; + + while ((profileElem = (Element) profileElems.nextNode()) != null) { + if ("VerifyTransformsInfoProfile".equals(profileElem.getLocalName())) { + ProfileParser profileParser = new ProfileParser(); + profiles.add( + profileParser.parseVerifyTransformsInfoProfile(profileElem)); + } else { + String profileID = DOMUtils.getText(profileElem); + profiles.add(factory.createVerifyTransformsInfoProfile(profileID)); + } + } + return profiles; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java new file mode 100644 index 000000000..960d9571d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java @@ -0,0 +1,310 @@ +package at.gv.egovernment.moa.spss.api.xmlbind; + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import org.w3c.dom.Document; +import org.w3c.dom.DocumentFragment; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.util.Base64Utils; +import at.gv.egovernment.moa.util.Constants; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.common.ContentBinary; +import at.gv.egovernment.moa.spss.api.common.ContentXML; +import at.gv.egovernment.moa.spss.api.common.InputData; +import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; + +/** + * Convert a VerifyXMLSignatureResponse API object into its + * XML representation, according to the MOA XML schema. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyXMLSignatureResponseBuilder { + private static final String MOA_NS_URI = Constants.MOA_NS_URI; + + /** The XML document containing the response element. */ + private Document responseDoc; + /** The response VerifyXMLSignatureResponse DOM element. */ + private Element responseElem; + + /** + * Create a new VerifyXMLSignatureResponseBuilder: + * + * @throws MOASystemException An error occurred setting up the resulting + * XML document. + */ + public VerifyXMLSignatureResponseBuilder() throws MOASystemException { + responseDoc = + ResponseBuilderUtils.createResponse("VerifyXMLSignatureResponse"); + responseElem = responseDoc.getDocumentElement(); + } + + /** + * Build a document containing a VerifyXMLSignatureResponse + * DOM element being the XML representation of the given + * VerifyXMLSignatureResponse API object. + * + * @param response The VerifyXMLSignatureResponse to convert + * to XML. + * @return A document containing the VerifyXMLSignatureResponse + * DOM element. + * @throws MOAApplicationException An error occurred building the response. + */ + public Document build(VerifyXMLSignatureResponse response) + throws MOAApplicationException { + + Iterator iter; + List responseData; + + // add the SignerInfo + ResponseBuilderUtils.addSignerInfo( + responseDoc, + responseElem, + response.getSignerInfo().getSignerCertificate(), + response.getSignerInfo().isQualifiedCertificate(), + response.getSignerInfo().isPublicAuthority(), + response.getSignerInfo().getPublicAuhtorityID()); + + // add HashInputData elements + responseData = response.getHashInputDatas(); + if (responseData != null && !responseData.isEmpty()) { + for (iter = responseData.iterator(); iter.hasNext();) { + InputData inputData = (InputData) iter.next(); + addContent("HashInputData", inputData); + } + } + + // add ReferenceInputData elements + responseData = response.getReferenceInputDatas(); + if (responseData != null && !responseData.isEmpty()) { + for (iter = responseData.iterator(); iter.hasNext();) { + InputData inputData = (InputData) iter.next(); + addContent("ReferenceInputData", inputData); + } + } + + // add the SignatureCheck + addReferencesCheckResult("SignatureCheck", response.getSignatureCheck()); + + // add the SignatureManifestCheck + if (response.getSignatureManifestCheck() != null) { + addReferencesCheckResult( + "SignatureManifestCheck", + response.getSignatureManifestCheck()); + } + + // add the XMLDsigManifestChecks + responseData = response.getXMLDsigManifestChecks(); + if (responseData != null && !responseData.isEmpty()) { + for (iter = responseData.iterator(); iter.hasNext();) { + ManifestRefsCheckResult checkResult = + (ManifestRefsCheckResult) iter.next(); + addManifestRefsCheckResult("XMLDSIGManifestCheck", checkResult); + } + } + + // add the CertificateCheck + ResponseBuilderUtils.addCodeInfoElement( + responseDoc, + responseElem, + "CertificateCheck", + response.getCertificateCheck().getCode(), + response.getCertificateCheck().getInfo()); + + return responseDoc; + } + + /** + * Add an element of type ContentBaseType to the response. + * + * @param elementName The name of the element. + * + * @param inputData The InputData to add. Based on the type of + * + * the InputData, either a Base64Content element + * or a XMLContent subelement will be added. An + * InputDataBinaryImpl will be added as a Base64Content + * child element. AnInputDataXMLImpl will be added as + * XMLContent child element. + * + * @throws MOAApplicationException An error occurred adding the content. + */ + private void addContent(String elementName, InputData inputData) + throws MOAApplicationException { + + Element contentElem = responseDoc.createElementNS(MOA_NS_URI, elementName); + + contentElem.setAttributeNS(null, "PartOf", inputData.getPartOf()); + if (inputData.getReferringReferenceNumber() != InputData.REFERER_NONE_) + contentElem.setAttributeNS( + null, + "ReferringSigReference", + Integer.toString(inputData.getReferringReferenceNumber())); + + switch (inputData.getContentType()) { + case Content.XML_CONTENT : + ContentXML contentXml = (ContentXML) inputData; + NodeList nodes = contentXml.getXMLContent(); + Element xmlElem; + int i; + + xmlElem = responseDoc.createElementNS(MOA_NS_URI, "XMLContent"); + //xmlElem.setAttributeNS(XML_NS_URI, "xml:space", "preserve"); + xmlElem.setAttribute("xml:space", "preserve"); + + for (i = 0; i < nodes.getLength(); i++) { + xmlElem.appendChild(responseDoc.importNode(nodes.item(i), true)); + } + contentElem.appendChild(xmlElem); + responseElem.appendChild(contentElem); + break; + case Content.BINARY_CONTENT : + Element binaryElem = + responseDoc.createElementNS(MOA_NS_URI, "Base64Content"); + ContentBinary contentBinary = (ContentBinary) inputData; + String base64Str; + + try { + base64Str = Base64Utils.encode(contentBinary.getBinaryContent()); + } catch (IOException e) { + throw new MOAApplicationException("2200", null, e); + } + binaryElem.appendChild(responseDoc.createTextNode(base64Str)); + contentElem.appendChild(binaryElem); + responseElem.appendChild(contentElem); + break; + } + } + + /** + * Add a ReferencesCheckResult to the response. + * + * @param elementName The DOM element name to use. + * @param checkResult The ReferencesCheckResult to add. + */ + private void addReferencesCheckResult( + String elementName, + ReferencesCheckResult checkResult) { + + NodeList info = null; + + if (checkResult.getInfo() != null) { + DocumentFragment fragment = responseDoc.createDocumentFragment(); + NodeList anyOtherInfo = checkResult.getInfo().getAnyOtherInfo(); + int[] failedReferences = checkResult.getInfo().getFailedReferences(); + + if (anyOtherInfo != null) { + addAnyOtherInfo(fragment, checkResult.getInfo().getAnyOtherInfo()); + } + + if (failedReferences != null) { + addFailedReferences(fragment, failedReferences); + } + + info = fragment.getChildNodes(); + } + + ResponseBuilderUtils.addCodeInfoElement( + responseDoc, + responseElem, + elementName, + checkResult.getCode(), + info); + } + + + /** + * Add a ManifestRefsCheckResult to the response. + * + * @param elementName The DOM element name to use. + * @param checkResult The ManifestRefsCheckResult to add. + */ + private void addManifestRefsCheckResult( + String elementName, + ManifestRefsCheckResult checkResult) { + + DocumentFragment fragment = responseDoc.createDocumentFragment(); + NodeList anyOtherInfo = checkResult.getInfo().getAnyOtherInfo(); + int[] failedReferences = checkResult.getInfo().getFailedReferences(); + Element referringSigRefElem; + String referringSigRefStr; + + // add any other elements + if (anyOtherInfo != null) { + addAnyOtherInfo(fragment, checkResult.getInfo().getAnyOtherInfo()); + } + + // add the failed references + if (failedReferences != null) { + addFailedReferences(fragment, failedReferences); + } + + // add the ReferringSigReference + referringSigRefElem = + responseDoc.createElementNS(MOA_NS_URI, "ReferringSigReference"); + referringSigRefStr = + Integer.toString(checkResult.getInfo().getReferringSignatureReference()); + referringSigRefElem.appendChild( + responseDoc.createTextNode(referringSigRefStr)); + fragment.appendChild(referringSigRefElem); + + // add XMLDSIGManifestCheckResult to the response + ResponseBuilderUtils.addCodeInfoElement( + responseDoc, + responseElem, + elementName, + checkResult.getCode(), + fragment.getChildNodes()); + } + + /** + * Add arbitrary XML content to a DOM DocumentFragment. + * + * @param fragment The fragment to add the XML content to. + * @param anyOtherInfo The XML content to add. + */ + private void addAnyOtherInfo( + DocumentFragment fragment, + NodeList anyOtherInfo) { + + int i; + + for (i = 0; i < anyOtherInfo.getLength(); i++) { + fragment.appendChild(responseDoc.importNode(anyOtherInfo.item(i), true)); + } + } + + /** + * Add the failed references as FailedReference DOM elements to + * the fragment. + * + * @param fragment The DOM document fragment to add the + * FailedReference elements to. + * @param failedReferences The indexes of the failed references. + */ + private void addFailedReferences( + DocumentFragment fragment, + int[] failedReferences) { + Element failedReferenceElem; + int i; + + for (i = 0; i < failedReferences.length; i++) { + failedReferenceElem = + responseDoc.createElementNS(MOA_NS_URI, "FailedReference"); + failedReferenceElem.appendChild( + responseDoc.createTextNode(Integer.toString(failedReferences[i]))); + fragment.appendChild(failedReferenceElem); + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java new file mode 100644 index 000000000..425c410ad --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java @@ -0,0 +1,30 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +/** + * Base class for signature environment profile data used in XML signature + * creation. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface CreateSignatureEnvironmentProfile { + /** + * Indicates that the profile data is given explicitly. + */ + public static int EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE = 0; + /** + * Indicates that the profile data is stored in the configuration and resolved + * using an ID. + */ + public static int ID_CREATESIGNATUREENVIRONMENTPROFILE = 1; + + /** + * Gets the type of this object. + * + * @return The type of CreateSignatureEnvironmentProfile denoted + * by this object. Either + * EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE or + * ID_CREATESIGNATUREENVIRONMENTPROFILE. + */ + public int getCreateSignatureEnvironmentProfileType(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java new file mode 100644 index 000000000..6aebd102b --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java @@ -0,0 +1,30 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import java.util.List; + +/** + * A CreateSignatureEnvironmentProfile containing the profile + * data explicitly. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface CreateSignatureEnvironmentProfileExplicit + extends CreateSignatureEnvironmentProfile { + + /** + * Gets the location and index of where to insert the signature into the + * signature environment. + * + * @return The location and index of the signature in the signature + * environment. + */ + public CreateSignatureLocation getCreateSignatureLocation(); + /** + * Gets the supplemental information. + * + * @return The supplemental information. + */ + public List getSupplements(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java new file mode 100644 index 000000000..1c0d87adc --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java @@ -0,0 +1,20 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +/** + * A CreateSignatureEnvironmentProfile containing a profile ID + * pointing to locally stored profile data. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface CreateSignatureEnvironmentProfileID + extends CreateSignatureEnvironmentProfile { + + /** + * Gets the profile ID. + * + * @return The profile ID. + */ + public String getCreateSignatureEnvironmentProfileID(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java new file mode 100644 index 000000000..5ceae4d0a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import at.gv.egovernment.moa.spss.api.common.Content; + +/** + * Encapsulates a signature object used during signature creation. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CreateSignatureInfo { + /** + * Gets the XML structure where the signature will be inserted. + * + * @return The XML structure where the signature will be inserted. + */ + public Content getCreateSignatureEnvironment(); + /** + * Gets the supplemental data for the signature environment. + * + * @return The supplemental data for the signature envoronment. + */ + public CreateSignatureEnvironmentProfile getCreateSignatureEnvironmentProfile(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java new file mode 100644 index 000000000..81374ceaa --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java @@ -0,0 +1,23 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import at.gv.egovernment.moa.spss.api.common.ElementSelector; + +/** + * Specifies where to insert the newly created signature. + * + * An XPath expression is used to select the signature parent element. An + * additional index specifies the node index after which to insert the + * signature into the parent element. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface CreateSignatureLocation extends ElementSelector { + /** + * Gets the node index, after which the signature will be inserted into the + * parent elemen. + * + * @return The index of the node after which the signature will be inserted. + */ + public int getIndex(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java new file mode 100644 index 000000000..94152434e --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java @@ -0,0 +1,27 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import java.util.List; + +import at.gv.egovernment.moa.spss.api.common.MetaInfo; + +/** + * Encapsulates information used for the transformation of the data object. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CreateTransformsInfo { + /** + * Gets the XMLDSig transforms. + * + * @return A List of Transform objects. + */ + public List getTransforms(); + /** + * Gets meta information about the data resulting from the transformation. + * + * @return Meta information about the resulting data. + */ + public MetaInfo getFinalDataMetaInfo(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java new file mode 100644 index 000000000..40acfd317 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java @@ -0,0 +1,28 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +/** + * Base class for transformation informations used in signature creation. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CreateTransformsInfoProfile { + /** + * Indicates transformation information given explicitly. + */ + public static final int EXPLICIT_CREATETRANSFORMSINFOPROFILE = 0; + /** + * Indicates transformation information given as an ID. + */ + public static final int ID_CREATETRANSFORMSINFOPROFILE = 1; + + /** + * Gets the type of profile information this object contains. + * + * @return The type of transformation information, either + * EXPLICIT_CREATETRANSFORMSINFOPROFILE or + * ID_CREATETRANSFORMSINFOPROFILE. + */ + public int getCreateTransformsInfoProfileType(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java new file mode 100644 index 000000000..aeb74445f --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java @@ -0,0 +1,26 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import java.util.List; + +/** + * Encapsulates explicit transformation informations. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CreateTransformsInfoProfileExplicit + extends CreateTransformsInfoProfile { + /** + * Gets the transformation information of the data object. + * + * @return Transformation information of the data object. + */ + public CreateTransformsInfo getCreateTransformsInfo(); + /** + * Gets the supplemental information. + * + * @return The supplemental information. + */ + public List getSupplements(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java new file mode 100644 index 000000000..3631ead29 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java @@ -0,0 +1,18 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +/** + * Encapsulates transformation information given via an identifier. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CreateTransformsInfoProfileID + extends CreateTransformsInfoProfile { + /** + * Gets the ID of the transformation. + * + * @return The transformation profile ID. + */ + public String getCreateTransformsInfoProfileID(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java new file mode 100644 index 000000000..b8157fdfb --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java @@ -0,0 +1,26 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import java.util.List; + + +/** + * Object that encapsulates a request to create an XML Signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CreateXMLSignatureRequest { + /** + * Gets the identifier for the keys to be used for the signature. + * + * @return The identifier for the keys to be used. + */ + public String getKeyIdentifier(); + /** + * Gets the information of the singleSignatureInfo elements. + * + * @return The information of singleSignatureInfo elements. + */ + public List getSingleSignatureInfos(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java new file mode 100644 index 000000000..6bf54e6a5 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java @@ -0,0 +1,20 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import java.util.List; + +/** + * Object that encapsulates the response on to a + * CreateXMLSignatureRequest to create an XML signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CreateXMLSignatureResponse { + /** + * Gets the response elements. + * + * @return The response elements. + */ + public List getResponseElements(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java new file mode 100644 index 000000000..2162d82fd --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java @@ -0,0 +1,29 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +/** + * Base class for SignatureEnvironmentResponse and + * ErrorResponse elements in a + * CreateXMLSignatureResponse. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface CreateXMLSignatureResponseElement { + /** + * Indicates that this object contains a SignatureEnvironment. + */ + public static final int SIGNATURE_ENVIRONMENT_RESPONSE = 0; + /** + * Indicates that this objet contains an ErrorResponse. + */ + public static final int ERROR_RESPONSE = 1; + + /** + * Gets the type of response object. + * + * @return The type of response object, either + * SIGNATURE_ENVIRONMENT_RESPONSE or ERROR_RESPONSE. + */ + public int getResponseType(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java new file mode 100644 index 000000000..43d49c587 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java @@ -0,0 +1,48 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import at.gv.egovernment.moa.spss.api.common.Content; + +/** + * Encapsulates information required to create a single signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface DataObjectInfo { + /** + * Indicates that a detached signature will be created. + */ + public static final String STRUCTURE_DETACHED = "detached"; + /** + * Indicates that an enveloping signature will be created. + */ + public static final String STRUCTURE_ENVELOPING = "enveloping"; + + /** + * Gets the structure of the signature. + * + * @return The structure of the signature. + */ + public String getStructure(); + /** + * Checks whether a refercence will be placed in the signature itself or + * in the manifest. + * + * @return true if a reference will be placed in the manifest, + * false if it will be placed in the signature. + */ + public boolean isChildOfManifest(); + /** + * Gets information related to a single data object. + * + * @return Information related to a single data object. + */ + public Content getDataObject(); + /** + * Gets information for the transformation of the data object. + * + * @return The transformation information. + */ + public CreateTransformsInfoProfile getCreateTransformsInfoProfile(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java new file mode 100644 index 000000000..30fa4fb52 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java @@ -0,0 +1,24 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + + +/** + * Object containing detailed error information. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface ErrorResponse extends CreateXMLSignatureResponseElement { + /** + * Gets the error code. + * + * @return The error code. + */ + public int getErrorCode(); + /** + * Gets verbose error information. + * + * @return Verbose error information. + */ + public String getInfo(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java new file mode 100644 index 000000000..449349a68 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java @@ -0,0 +1,20 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import org.w3c.dom.Element; + +/** + * Contains the signature if the signature creation was successful. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface SignatureEnvironmentResponse + extends CreateXMLSignatureResponseElement { + /** + * Gets the XML structure which contains the signature. + * + * @return A general XML structure containing the signature. + */ + public Element getSignatureEnvironment(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java new file mode 100644 index 000000000..9c74c5157 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java @@ -0,0 +1,32 @@ +package at.gv.egovernment.moa.spss.api.xmlsign; + +import java.util.List; + +/** + * Encapsulates data to create a single signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface SingleSignatureInfo { + /** + * Gets the dataObjectInfo information. + * + * @return The dataObjectInfo information. + */ + public List getDataObjectInfos(); + /** + * Gets the signature object. + * + * @return The signature object used during signature creation. + */ + public CreateSignatureInfo getCreateSignatureInfo(); + /** + * Check whether a Security Layer conform signature manifest will be created. + * + * @return true, if a Security Layer conform signature manifest + * will be created, false otherwise. + */ + public boolean isSecurityLayerConform(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java new file mode 100644 index 000000000..1984ba349 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java @@ -0,0 +1,24 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + + +/** + * Contains the results of manifest checks according to XMLDsig. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface ManifestRefsCheckResult { + /** + * Gets the check code. + * + * @return A numerical representation of the result of the manifest check. + */ + public int getCode(); + /** + * Gets the reference to the manifest. + * + * @return The reference to the manifest. + */ + public ManifestRefsCheckResultInfo getInfo(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java new file mode 100644 index 000000000..258840162 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java @@ -0,0 +1,19 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + + +/** + * Encapsulates information referring to the manifest of the check. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface ManifestRefsCheckResultInfo extends ReferencesCheckResultInfo { + /** + * Gets the position of the signature reference containing the + * reference to the manifest being described by this object. + * + * @return The position of the signature reference. + */ + public int getReferringSignatureReference(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java new file mode 100644 index 000000000..4c644583b --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java @@ -0,0 +1,19 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import java.util.List; + +/** + * Contains transformation parameters which are locally available. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface ReferenceInfo { + /** + * Gets the transformation info. + * + * @return The transformation info. + */ + public List getVerifyTransformsInfoProfiles(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java new file mode 100644 index 000000000..7b5488613 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java @@ -0,0 +1,23 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +/** + * Contains information about the verification status of references contained + * in the signature. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface ReferencesCheckResult { + /** + * Gets the check code. + * + * @return A numerical representation of the result of the reference check. + */ + public int getCode(); + /** + * Gets the additional information about the result. + * + * @return Additional information about the result. + */ + public ReferencesCheckResultInfo getInfo(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java new file mode 100644 index 000000000..be21b61c2 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import org.w3c.dom.NodeList; + +/** + * Additional information contained in a ReferencesCheckResult. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface ReferencesCheckResultInfo { + /** + * Gets the additional info of the failed dsig:reference element. + * + * @return The info elements. + */ + public NodeList getAnyOtherInfo(); + /** + * Gets the positions of the failed signature references containing the + * references to the manifests being described by this object. + * + * @return The positions of the failed signature references. + */ + public int[] getFailedReferences(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java new file mode 100644 index 000000000..8f0efacf3 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java @@ -0,0 +1,26 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import java.util.List; + +/** + * Contains parameters used to check the signature manifest. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface SignatureManifestCheckParams { + /** + * Gets the referential information. + * + * @return The referential information. + */ + public List getReferenceInfos(); + /** + * Gets information on whether signature source data should be returned. + * + * @return true, if signature source data should be returned, + * otherwise false. + */ + public boolean getReturnReferenceInputData(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java new file mode 100644 index 000000000..569e691ca --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java @@ -0,0 +1,28 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +/** + * Base class for supplementary information. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface SupplementProfile { + /** + * Indicates that this object contains explicit supplementary information. + */ + public static final int EXPLICIT_SUPPLEMENTPROFILE = 0; + /** + * Indicates that this object contains a profile id where supplementary + * information can be found. + */ + public static final int ID_SUPPLEMENTPROFILE = 1; + + /** + * Gets the type of supplementary information contained in this object. + * + * @return The type of supplementary information contained in this object, + * either EXPLICIT_SUPPLEMENT or ID_SUPPLEMENT. + */ + public int getSupplementProfileType(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java new file mode 100644 index 000000000..7dd37a2d1 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java @@ -0,0 +1,19 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; + +/** + * Encapsulates explicit supplementary information. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface SupplementProfileExplicit extends SupplementProfile { + /** + * Gets the supplemental object. + * + * @return The supplemental object. + */ + public XMLDataObjectAssociation getSupplementProfile(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java new file mode 100644 index 000000000..5b5083be9 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java @@ -0,0 +1,18 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +/** + * Encapsulates supplementary information stored in a profile. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface SupplementProfileID extends SupplementProfile { + /** + * Gets the id of the profile where the supplementary information can be + * found. + * + * @return The profile id. + */ + public String getSupplementProfileID(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java new file mode 100644 index 000000000..3e173e0cd --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java @@ -0,0 +1,40 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +/** + * Object encapsulating transform parameters either as a URI, binary or + * hashed. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface TransformParameter { + /** + * Indicates that this object contains a transform parameter given as + * a URI. + */ + public static final int URI_TRANSFORMPARAMETER = 0; + /** + * Indicates that this object contains binary transform parameter. + */ + public static final int BINARY_TRANSFORMPARAMETER = 1; + /** + * Indicatest that this object contains a binary hash of the transform + * parameter. + */ + public static final int HASH_TRANSFORMPARAMETER = 2; + + /** + * Gets the type of transform parameter contained in this object. + * + * @return The type of transform parameter, being one of + * URI_TRANSFORMPARAMETER, BINARY_TRANSFORMPARAMETER + * or HASH_TRANSFORMPARAMETER. + */ + public int getTransformParameterType(); + /** + * Gets the transform parameter URI. + * + * @return The transform parameter URI. + */ + public String getURI();} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java new file mode 100644 index 000000000..600227dfd --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java @@ -0,0 +1,21 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import java.io.InputStream; + +/** + * Encapsulates a binary transform parameter. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface TransformParameterBinary extends TransformParameter { + /** + * Gets the binary transform parameter. + * + * @return An InputStream from which the binary content can + * be read. + */ + public InputStream getBinaryContent(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java new file mode 100644 index 000000000..ec45ea4f4 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java @@ -0,0 +1,26 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + + +/** + * Contains a hash of the transform parameter. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface TransformParameterHash extends TransformParameter { + /** + * Gets the method used for calculating the digest value. + * + * @return The digest method. + */ + public String getDigestMethod(); + /** + * Gets the binary hash of the transform parameter. + * + * @return A binary representation of the hash. + */ + public byte[] getDigestValue(); + + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java new file mode 100644 index 000000000..4a6f0a58f --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java @@ -0,0 +1,12 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +/** + * Encapsulates a transform parameter given as a URI. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface TransformParameterURI extends TransformParameter { + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java new file mode 100644 index 000000000..386651c47 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java @@ -0,0 +1,27 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import at.gv.egovernment.moa.spss.api.common.Content; + +/** + * Encapsulates a signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface VerifySignatureInfo { + /** + * Gets the content of the VerifySignatureEnvironment element. + * + * @return A MOAElement containing the + * VerifySignatureEnvironment in a DOM-like structure. + */ + public Content getVerifySignatureEnvironment(); + /** + * Gets the location of the signature. + * + * @return The location of the signature within the signature environment. + */ + public VerifySignatureLocation getVerifySignatureLocation(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java new file mode 100644 index 000000000..f05e3e889 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java @@ -0,0 +1,13 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import at.gv.egovernment.moa.spss.api.common.ElementSelector; + +/** + * Specifies where to find the signature to be verified. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface VerifySignatureLocation extends ElementSelector { + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java new file mode 100644 index 000000000..909fc58a2 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java @@ -0,0 +1,28 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +/** + * Object for explicitly specifying a transformation path. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface VerifyTransformsInfoProfile { + /** + * Indicates that this object contains the transformation path explicitly. + */ + public static final int EXPLICIT_VERIFYTRANSFORMSINFOPROFILE = 0; + /** + * Indicatest that this object contains a transformation info id. + */ + public static final int ID_VERIFYTRANSFORMSINFOPROFILE = 1; + + /** + * Gets the type of transformation information contained in this object. + * + * @return The type of transformation information, either + * EXPLICIT_VERIFYTRANSFORMSINFOPROFILE or + * ID_VERIFYTRANSFORMSINFOPROFILE. + */ + public int getVerifyTransformsInfoProfileType(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java new file mode 100644 index 000000000..ff19683da --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java @@ -0,0 +1,25 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import java.util.List; + +/** + * Encapsulates explicit transformation information. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface VerifyTransformsInfoProfileExplicit extends VerifyTransformsInfoProfile { + /** + * Gets the XMLDSig transforms element. + * + * @return The List of Transforms. + */ + public List getTransforms(); + /** + * Gets the transformation parameters. + * + * @return The transformation parameters. + */ + public List getTransformParameters(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java new file mode 100644 index 000000000..0df3664da --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java @@ -0,0 +1,18 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +/** + * Encapsulates transformation info id for signature verification. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface VerifyTransformsInfoProfileID extends VerifyTransformsInfoProfile { + /** + * Gets the identifier referencing the transformation info. + * + * @return The identifier referencing the transformation info. + */ + public String getVerifyTransformsInfoProfileID(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java new file mode 100644 index 000000000..eb71f500b --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java @@ -0,0 +1,55 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import java.util.Date; +import java.util.List; + + +/** + * Object that encapsulates a request to verify an XML signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface VerifyXMLSignatureRequest { + /** + * Gets the date and time for which the signature verification has to + * be performed. + * + * @return Date and time for which the signature verification has + * to be performed. + */ + public Date getDateTime(); + /** + * Gets the signature to be verified. + * + * @return The signature to be verified. + */ + public VerifySignatureInfo getSignatureInfo(); + /** + * Gets the supplemental information. + * + * @return The supplemental information. + */ + public List getSupplementProfiles(); + /** + * Gets parameters for Security Layer signature verification. + * + * @return Parameters for Security Layer signature verification. + */ + public SignatureManifestCheckParams getSignatureManifestCheckParams(); + /** + * Checks, whether actually signed data shall be returned. + * + * @return true, if signed data will be returned, + * otherwise false. + */ + public boolean getReturnHashInputData(); + /** + * Gets the profile id of the set of trusted certificates to be used for + * signature verification. + * + * @return The id of the trusted certificates. + */ + public String getTrustProfileId(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java new file mode 100644 index 000000000..14ac71e67 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java @@ -0,0 +1,60 @@ +package at.gv.egovernment.moa.spss.api.xmlverify; + +import java.util.List; + +import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.SignerInfo; + +/** + * Object that encapsulates the response on a request to verify an XML + * signature. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id$ + */ +public interface VerifyXMLSignatureResponse { + /** + * Gets a SignerInfo element according to XMLDSig. + * + * @return A SignerInfo element according to XMLDSig. + */ + public SignerInfo getSignerInfo(); + /** + * Gets datas signed by the signatory. + * + * @return The signed datas. + */ + public List getHashInputDatas(); + /** + * Gets source datas elements. + * + * @return The source datas elements. + */ + public List getReferenceInputDatas(); + /** + * Gets the result of the signature verification. + * + * @return The result of the signature verification. + */ + public ReferencesCheckResult getSignatureCheck(); + /** + * Gets the result of the signature manifest verification. + * + * @return The result of the signature manifest verification. + */ + public ReferencesCheckResult getSignatureManifestCheck(); + /** + * Gets XMLDSigManifestCheck elements. + * + * @return The XMLDSigManifestCheck elements. + */ + public List getXMLDsigManifestChecks(); + /** + * Gets the result of the certification verification. + * + * @return The result of the certificate verification. + */ + public CheckResult getCertificateCheck(); + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/overview.htm b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/overview.htm new file mode 100644 index 000000000..9b17bbf91 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/overview.htm @@ -0,0 +1,155 @@ + + + + + + +MOA SP/SS API documentation overview. + + +

Using the MOA SP/SS API

+ +

Invoking the services

+In general, invoking the MOA SP/SS API involves the following steps: +
    +
  1. Set the moa.spss.server.configuration system property to point +to the main MOA SP/SS configuration file. This needs to be done only once per +JVM instance. You may also call +{@link at.gv.egovernment.moa.spss.api.Configurator#init} at this point to +pre-initialize MOA SP/SS (if not, it is done automatically upon service +invocation).
  2. +
  3. Create an instance of the service to be used +({@link at.gv.egovernment.moa.spss.api.SignatureCreationService} or +{@link at.gv.egovernment.moa.spss.api.SignatureVerificationService}), +via its getInstance() method.
  4. +
  5. Create an instance of the +{@link at.gv.egovernment.moa.spss.api.SPSSFactory}, via its +{@link at.gv.egovernment.moa.spss.api.SPSSFactory#getInstance} method.
  6. +
  7. Use the create... methods of the SPSSFactory to +create the desired {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest}, +{@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest} or +{@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest} object. +
  8. +
  9. Call one of the service methods: +{@link at.gv.egovernment.moa.spss.api.SignatureCreationService#createXMLSignature(at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest) createXMLSignature()}, +{@link at.gv.egovernment.moa.spss.api.SignatureVerificationService#verifyCMSSignature(at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest) verifyCMSSignature()} or +{@link at.gv.egovernment.moa.spss.api.SignatureVerificationService#verifyXMLSignature(at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest) verifyXMLSignature()}. +
  10. +
  11. Analyze the result of the service call, given as a +{@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse}, +{@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse} or +{@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse}. +In case of an error, a {@link at.gv.egovernment.moa.spss.MOAException} +is thrown by the service. Please be aware that errors during signature creation +are reported as part of a CreateXMLSignatureResponse. +
+ +

Creating MOA SP/SS API objects

+

+Invoking the MOA SP/SS API Service classes involves creating +a Request object using the {@link at.gv.egovernment.moa.spss.api.SPSSFactory SPSSFactory}. +Object creation using the SPSSFactory is always bottom-up, meaning +that in order to create an object all of its components must have been created +before. +

+

+The names of the MOA SP/SS API classes have been chosen to correspond to the +MOA SP/SS schema elements. The structure of the classes (i.e., their fields) +also corresponds to the structure of the respective MOA SP/SS schema elements. +However, a few classes escape this naming convention, mainly because the +corresponding schema elements contain xsd:choice components: +

    +
  • The various Profile classes have subclasses called +ProfileID and ProfileExplicit +(e.g., {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileID} and +{@link at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit}), +so that the profile can be given either as an ID (which is to be resolved from the +MOA SP/SS configuration) or explicitly.
  • +
  • The classes {@link at.gv.egovernment.moa.spss.api.common.Content}, +{@link at.gv.egovernment.moa.spss.api.cmsverify.CMSContent} and +{@link at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter} have +subclasses specifying the type of content they actually contain. E.g., +{@link at.gv.egovernment.moa.spss.api.common.ContentBinary} will contain +a byte stream.
  • +
+ +

+

+For clarity, the MOA SP/SS API classes have been organized in several packages +listed in the following table: +

+ + + + + + + + + + + + + + + + + + + + + +
PackagePurpose
{@link at.gv.egovernment.moa.spss.api.xmlsign}Components of the {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest} and + {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse}
{@link at.gv.egovernment.moa.spss.api.cmsverify}Components of the + {@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest} and + {@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse}
{@link at.gv.egovernment.moa.spss.api.xmlverify}Components of the + {@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest} and + {@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse}
{@link at.gv.egovernment.moa.spss.api.common}Common components used across the classes of the above packages
+ +

Converting MOA SP/SS API objects to and from DOM trees

+The package {@link at.gv.egovernment.moa.spss.api.xmlbind} contains helper +classes to: +
    +
  • Parse a DOM tree containing a CreateXMLSignatureRequest, +VerifyCMSSignatureRequest or +VerifyCMSSignatureRequest into its respective MOA SP/SS API object +representation. For example, to parse a CreateXMLSignatureRequest +DOM tree, the {@link at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser#parse(org.w3c.dom.Element) CreateXMLSignatureRequestParser.parse()} +method can be used.
    +Note: The DOM tree of the request must be derived from a schema valid +XML document. Otherwise, unexpected behaviour will almost certainly result.
  • +
  • Build a CreateXMLSignatureResponse, +VerifyCMSSignatureResponse or a +VerifyXMLSignatureResponse DOM tree from the respective MOA SP/SS +API object. For example, to build a VerifyXMLSignatureResponse +DOM tree, the {@link at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureResponseBuilder#build(at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse) VerifyXMLSignatureResponseBuilder.build()} +can be used.
    +Note:The serialized DOM tree will be schema valid. +
  • +
+The DOM trees can easily be read from and written to XML byte streams using +the methods in the {@link at.gv.egovernment.moa.util.DOMUtils} class. +
+ +

Utilities and Logging

+

The packages {@link at.gv.egovernment.moa.util} and +{@link at.gv.egovernment.moa.spss.util} contain utility classes developed for +the MOA SP/SS implementation. Since the classes contained in these packages are +tailored towards the MOA SP/SS implementation, they are far from being complete +in the sense of providing a utility class library. Therefore, they may or may +not prove useful in the context of your application. Their interfaces may also +change in future releases. +

+ +

The package {@link at.gv.egovernment.moa.logging} contains classes for +logging messages to the MOA SP/SS log hierarchy via the +{@link at.gv.egovernment.moa.logging.Logger} class. +

+ +

Related Documentation

+ +See also the API example in the +MOA SP/SS documentation. + + + \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java new file mode 100644 index 000000000..bd78012ef --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java @@ -0,0 +1,165 @@ +package at.gv.egovernment.moa.spss.server.config; + +import iaik.pki.revocation.RevocationSourceTypes; + +import java.util.HashMap; +import java.util.Map; +import java.util.StringTokenizer; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; + +import at.gv.egovernment.moa.spss.util.MessageProvider; + +/** + * A class representing a CRL distribution point. + * + * @author Sven Aigner + * @author Patrick Peck + * @version $Id$ + */ +public class CRLDistributionPoint + extends DistributionPoint + implements iaik.pki.revocation.CRLDistributionPoint +{ + + private static Map RC_MAPPING = new HashMap(); + + static { + + // create the mapping between reason code strings and their integer values + RC_MAPPING.put( + "unused", + new Integer(iaik.asn1.structures.DistributionPoint.unused)); + RC_MAPPING.put( + "keyCompromise", + new Integer(iaik.asn1.structures.DistributionPoint.keyCompromise)); + RC_MAPPING.put( + "cACompromise", + new Integer(iaik.asn1.structures.DistributionPoint.cACompromise)); + RC_MAPPING.put( + "affiliationChanged", + new Integer(iaik.asn1.structures.DistributionPoint.affiliationChanged)); + RC_MAPPING.put( + "superseded", + new Integer(iaik.asn1.structures.DistributionPoint.superseded)); + RC_MAPPING.put( + "cessationOfOperation", + new Integer(iaik.asn1.structures.DistributionPoint.cessationOfOperation)); + RC_MAPPING.put( + "certificateHold", + new Integer(iaik.asn1.structures.DistributionPoint.certificateHold)); + RC_MAPPING.put( + "privilegeWithdrawn", + new Integer(iaik.asn1.structures.DistributionPoint.privilegeWithdrawn)); + RC_MAPPING.put( + "aACompromise", + new Integer(iaik.asn1.structures.DistributionPoint.aACompromise)); + } + + /** + * The name of the CA issuing the CRL referred to by this DP. + */ + private String issuerName_; + + /** + * The reason codes applicable for the distribution point. + */ + private int reasonCodes; + + /** + * Create a CRLDistributionPoint. + * + * @param issuerName The name of the CA issuing the CRL referred to by this DP. + * + * @param uri The URI of the distribution point. + * + * @param reasonCodeStr A list of reason codes (a space-separated enumeration). + */ + public CRLDistributionPoint(String issuerName, String uri, String reasonCodeStr) + { + super(uri); + issuerName_ = issuerName; + this.reasonCodes = extractReasonCodes(reasonCodeStr); + } + + /** + * @see DistributionPoint#getType() + */ + public String getType() + { + return RevocationSourceTypes.CRL; + } + + /** + * Convert a list of reason codes provided as a String to a + * binary representation. + * + * @param reasonCodeStr A String containing a blank-separated, + * textual representation of reason codes. + * @return int A binary representation of reason codes. + * @see iaik.asn1.structures.DistributionPoint + */ + private int extractReasonCodes(String reasonCodeStr) { + int codes = 0; + StringTokenizer tokenizer = new StringTokenizer(reasonCodeStr); + String token; + Integer reasonCode; + + while (tokenizer.hasMoreTokens()) { + token = tokenizer.nextToken(); + reasonCode = (Integer) RC_MAPPING.get(token); + if (reasonCode != null) { + codes |= reasonCode.intValue(); + } else { + MessageProvider msg = MessageProvider.getInstance(); + Logger.warn( + new LogMsg(msg.getMessage("config.07", new Object[] { token }))); + } + } + + // If reasonCodeStr is empty, set all possible reason codes + if (codes == 0) codes = + iaik.asn1.structures.DistributionPoint.unused | + iaik.asn1.structures.DistributionPoint.keyCompromise | + iaik.asn1.structures.DistributionPoint.cACompromise | + iaik.asn1.structures.DistributionPoint.affiliationChanged | + iaik.asn1.structures.DistributionPoint.superseded | + iaik.asn1.structures.DistributionPoint.cessationOfOperation | + iaik.asn1.structures.DistributionPoint.certificateHold | + iaik.asn1.structures.DistributionPoint.privilegeWithdrawn | + iaik.asn1.structures.DistributionPoint.aACompromise; + + return codes; + } + + /** + * Return a binary representation of the reason codes of this distribution + * point. + * + * @return The binary representation of the reason codes. + */ + public int getReasonCodes() { + return reasonCodes; + } + + /** + * Return a String representation of this distribution point. + * + * @return The String representation of this distribution point. + * @see java.lang.Object#toString() + */ + public String toString() { + return "(DistributionPoint - " + + ("URI<" + getUri()) + + ("> REASONCODES<" + getReasonCodes() + ">)"); + } + + /** + * @see iaik.pki.revocation.CRLDistributionPoint#getIssuerName() + */ + public String getIssuerName() + { + return issuerName_; + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java new file mode 100644 index 000000000..4c2b3aea3 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java @@ -0,0 +1,34 @@ +package at.gv.egovernment.moa.spss.server.config; + +import at.gv.egovernment.moa.spss.MOASystemException; + +/** + * Exception signalling an error in the configuration. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ConfigurationException extends MOASystemException { + + /** + * Create a ConfigurationException. + * + * @see at.gv.egovernment.moa.spss.MOAException#MOAException(String, Object[]) + */ + public ConfigurationException(String messageId, Object[] parameters) { + super(messageId, parameters); + } + + /** + * Create a ConfigurationException. + * @see at.gv.egovernment.moa.spss.MOAException#MOAException(String, Object[], Throwable) + */ + public ConfigurationException( + String messageId, + Object[] parameters, + Throwable wrapped) { + + super(messageId, parameters, wrapped); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java new file mode 100644 index 000000000..14ceb71cd --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -0,0 +1,1239 @@ +package at.gv.egovernment.moa.spss.server.config; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigInteger; +import java.net.MalformedURLException; +import java.security.Principal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.traversal.NodeIterator; + +import org.xml.sax.SAXException; + +import iaik.ixsil.exceptions.URIException; +import iaik.ixsil.util.URI; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.pki.revocation.RevocationSourceTypes; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.XPathUtils; + +import at.gv.egovernment.moa.spss.util.MessageProvider; + +/** + * A class that builds configuration data from a DOM based representation. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ConfigurationPartsBuilder { + + // + // XPath namespace prefix shortcuts + // + + private static final String CONF = Constants.MOA_CONFIG_PREFIX + ":"; + private static final String DSIG = Constants.DSIG_PREFIX + ":"; + + // + // chaining mode constants appearing in the configuration file + // + + private static final String CM_CHAINING = "chaining"; + private static final String CM_PKIX = "pkix"; + + // + // XPath expressions to select certain parts of the configuration + // + + private static final String ROOT = "/" + CONF + "MOAConfiguration/"; + + private static final String DIGEST_METHOD_XPATH = + ROOT + CONF + "SignatureCreation/" + + CONF + "XMLDSig/" + + CONF + "DigestMethodAlgorithm"; + private static final String C14N_ALGORITHM_XPATH = + ROOT + CONF + "SignatureCreation/" + + CONF + "XMLDSig/" + + CONF + "CanonicalizationAlgorithm"; + private static final String HARDWARE_CRYPTO_MODULE_XPATH = + ROOT + CONF + "Common/" + + CONF + "HardwareCryptoModule"; + private static final String HARDWARE_KEY_XPATH = + ROOT + CONF + "SignatureCreation/" + + CONF + "KeyModules/" + + CONF + "HardwareKeyModule"; + private static final String SOFTWARE_KEY_XPATH = + ROOT + CONF + "SignatureCreation/" + + CONF + "KeyModules/" + + CONF + "SoftwareKeyModule"; + private static final String KEYGROUP_XPATH = + ROOT + CONF + "SignatureCreation/" + + CONF + "KeyGroup"; + private static final String KEYGROUP_MAPPING_XPATH = + ROOT + CONF + "SignatureCreation/" + + CONF + "KeyGroupMapping"; + private static final String ISSUER_XPATH = + DSIG + "X509IssuerName"; + private static final String SERIAL_XPATH = + DSIG + "X509SerialNumber"; + private static final String CERTSTORE_LOCATION_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "PathConstruction/" + + CONF + "CertificateStore/" + + CONF + "DirectoryStore/" + + CONF + "Location"; + private static final String AUTO_ADD_CERTIFICATES_XPATH_ = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "PathConstruction/" + + CONF + "AutoAddCertificates"; + private static final String USE_AUTHORITY_INFO_ACCESS_XPATH_ = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "PathConstruction/" + + CONF + "UseAuthorityInformationAccess"; + private static final String CHAINING_MODES_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "PathValidation/" + + CONF + "ChainingMode"; + private static final String CHAINING_MODES_DEFAULT_XPATH = + CHAINING_MODES_XPATH + "/" + + CONF + "DefaultMode"; + private static final String TRUST_ANCHOR_XPATH = + CHAINING_MODES_XPATH + "/" + + CONF + "TrustAnchor"; + private static final String TRUST_PROFILE_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "PathValidation/" + + CONF + "TrustProfile"; + private static final String DISTRIBUTION_POINTS_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "DistributionPoint"; + private static final String ENABLE_REVOCATION_CHECKING_XPATH_ = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "EnableChecking"; + private static final String MAX_REVOCATION_AGE_XPATH_ = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "MaxRevocationAge"; + private static final String REVOCATION_SERVICEORDER_XPATH_ = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "ServiceOrder/" + + CONF + "Service"; + private static final String ENABLE_ARCHIVING_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "Archiving/" + + CONF + "EnableArchiving"; + private static final String CRL_ARCHIVE_DURATION_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "Archiving/" + + CONF + "ArchiveDuration"; + private static final String ACHIVE_JDBC_URL_ = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "Archiving/" + + CONF + "Archive/" + + CONF + "DatabaseArchive/" + + CONF + "JDBCURL"; + private static final String ACHIVE_JDBC_DRIVER_CLASS_ = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "Archiving/" + + CONF + "Archive/" + + CONF + "DatabaseArchive/" + + CONF + "JDBCDriverClassName"; + private static final String CREATE_TRANSFORMS_INFO_PROFILE_XPATH = + ROOT + CONF + "SignatureCreation/" + + CONF + "CreateTransformsInfoProfile"; + private static final String CREATE_SIGNATURE_ENVIRONMENT_PROFILE_XPATH = + ROOT + CONF + "SignatureCreation/" + + CONF + "CreateSignatureEnvironmentProfile"; + private static final String VERIFY_TRANSFORMS_INFO_PROFILE_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "VerifyTransformsInfoProfile"; + private static final String SUPPLEMENT_PROFILE_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "SupplementProfile"; + + // + // default values for configuration parameters + // + + /** The accepted canonicalization algorithm URIs, as an array */ + private static final String[] ACCEPTED_C14N_ALGORITHMS_ARRAY = + { + Constants.C14N_URI, + Constants.C14N_WITH_COMMENTS_URI, + Constants.EXC_C14N_URI, + Constants.EXC_C14N_WITH_COMMENTS_URI }; + + /** The accepted canonicalization algorithm URIs, as a Set */ + private static final Set ACCEPTED_C14N_ALGORITHMS = + new HashSet(Arrays.asList(ACCEPTED_C14N_ALGORITHMS_ARRAY)); + + /** Default canonicalization algorithm, if none/illegal has been configured */ + private static final String C14N_ALGORITHM_DEFAULT = Constants.C14N_URI; + + /** The accepted digest method algorithm URIs, as an array */ + private static final String[] ACCEPTED_DIGEST_ALGORITHMS_ARRAY = + { Constants.SHA1_URI }; + + /** The accepted digest method algorithm URIs, as a Set */ + private static final Set ACCEPTED_DIGEST_ALGORITHMS = + new HashSet(Arrays.asList(ACCEPTED_DIGEST_ALGORITHMS_ARRAY)); + + /** Default digest algorithm URI, if none/illegal has been configured */ + private static final String DIGEST_ALGORITHM_DEFAULT = Constants.SHA1_URI; + + /** The root element of the MOA configuration */ + private Element configElem; + + /** + * The directory containing the underlying configuration file. + */ + private File configRoot_; + + /** Whether any warnings were encountered building the configuration. */ + private List warnings = new ArrayList(); + + /** + * Create a new ConfigurationPartsBuilder. + * + * @param configElem The root element of the MOA configuration. + * + * @param configRoot The directory containing the underlying configuration file. + */ + public ConfigurationPartsBuilder(Element configElem, File configRoot) + { + this.configElem = configElem; + configRoot_ = configRoot; + } + + /** + * Returns the root element of the MOA configuration. + * + * @return The root element of the MOA configuration. + */ + public Element getConfigElem() { + return configElem; + } + + /** + * Returns the directory containing the underlying configuration file. + * + * @return the directory containing the underlying configuration file. + */ + public File getConfigRoot() + { + return configRoot_; + } + + /** + * Returns the warnings encountered during building the configuration. + * + * @return A List of Strings, containing the + * warning messages. + */ + public List getWarnings() { + return warnings; + } + + /** + * Returns the digest method algorithm name. + * + * @return The digest method algorithm name from the configuration. + */ + public String getDigestMethodAlgorithmName() + { + String digestMethod = getElementValue(getConfigElem(), DIGEST_METHOD_XPATH, null); + + if (digestMethod == null || !ACCEPTED_DIGEST_ALGORITHMS.contains(digestMethod)) + { + info( + "config.23", + new Object[] { "DigestMethodAlgorithm", DIGEST_ALGORITHM_DEFAULT }); + digestMethod = DIGEST_ALGORITHM_DEFAULT; + } + + return digestMethod; + } + + /** + * Returns the canonicalization algorithm name. + * + * @return The canonicalization algorithm name from the configuration. + */ + public String getCanonicalizationAlgorithmName() + { + String c14nAlgorithm = getElementValue(getConfigElem(), C14N_ALGORITHM_XPATH, null); + + if (c14nAlgorithm == null || !ACCEPTED_C14N_ALGORITHMS.contains(c14nAlgorithm)) + { + info( + "config.23", + new Object[] { "CanonicalizationAlgorithm", C14N_ALGORITHM_DEFAULT }); + c14nAlgorithm = C14N_ALGORITHM_DEFAULT; + } + + return c14nAlgorithm; + } + + /** + * Build the configured hardware crypto modules. + * + * @return The hardware crypto modules from the configuration. + */ + public List buildHardwareCryptoModules() + { + List modules = new ArrayList(); + NodeIterator modIter = XPathUtils.selectNodeIterator( + getConfigElem(), + HARDWARE_CRYPTO_MODULE_XPATH); + + Element modElem; + while ((modElem = (Element) modIter.nextNode()) != null) { + String name = getElementValue(modElem, CONF + "Name", null); + String slotId = getElementValue(modElem, CONF + "SlotId", null); + String userPIN = getElementValue(modElem, CONF + "UserPIN", null); + HardwareCryptoModule module = new HardwareCryptoModule(name, slotId, userPIN); + modules.add(module); + } + + return modules; + } + + /** + * Build the configured hardware keys. + * + * @param keyModules The keyModules that the configuration already knows about. To + * prevent multiple key modules with the same ID. + * @return The hardware keys contained in the configuration. + */ + public List buildHardwareKeyModules(List keyModules) + { + Set existingIds = toIdSet(keyModules); + List hardwareKeys = new ArrayList(); + NodeIterator hkIter = + XPathUtils.selectNodeIterator(getConfigElem(), HARDWARE_KEY_XPATH); + Element keyElem; + + while ((keyElem = (Element) hkIter.nextNode()) != null) + { + String id = getElementValue(keyElem, CONF + "Id", null); + String name = getElementValue(keyElem, CONF + "Name", null); + String slotId = getElementValue(keyElem, CONF + "SlotId", null); + String userPIN = getElementValue(keyElem, CONF + "UserPIN", null); + + if (existingIds.contains(id)) + { + warn( + "config.04", + new Object[] { "Hardware- oder SoftwareKeyModule", id }); + } + else + { + KeyModule key = new HardwareKeyModule(id, name, slotId, userPIN); + hardwareKeys.add(key); + existingIds.add(id); + } + + } + + return hardwareKeys; + } + + /** + * Build the configured software keys. + * + * @param keyModules The keyModules that the configuration already knows about. To + * prevent multiple key modules with the same ID. + * + * @return The software keys contained in the configuration. + */ + public List buildSoftwareKeyModules(List keyModules) + { + Set existingIds = toIdSet(keyModules); + List softwareKeys = new ArrayList(); + NodeIterator skIter = + XPathUtils.selectNodeIterator(getConfigElem(), SOFTWARE_KEY_XPATH); + + Element keyElem; + while ((keyElem = (Element) skIter.nextNode()) != null) + { + String id = getElementValue(keyElem, CONF + "Id", null); + String fileName = getElementValue(keyElem, CONF + "FileName", null); + String passWord = getElementValue(keyElem, CONF + "Password", null); + + if (existingIds.contains(id)) + { + warn( + "config.04", + new Object[] { "Hardware- oder SoftwareKeyModule", id }); + } + else + { + File keyFile; + KeyModule key; + + // make keyFile absolute + keyFile = new File(fileName); + if (!keyFile.isAbsolute()) { + keyFile = new File(configRoot_, fileName); + } + + // check for existence + if (!keyFile.exists() || keyFile.isDirectory()) { + warn("config.25", new Object[] { id, keyFile.getAbsolutePath()}); + } else { + // create a new key module + key = new SoftwareKeyModule(id, keyFile.getAbsolutePath(), passWord); + softwareKeys.add(key); + existingIds.add(id); + } + } + } + + return softwareKeys; + } + + /** + * Build the key group configuration. + * + * @param keyModules The KeyModules that the configuration + * knows about. Used to check for errors in the configuration. + * @return The mapping between key group IDs and key groups. + */ + public Map buildKeyGroups(List keyModules) + { + Set keyModuleIds = toIdSet(keyModules); + Map keyGroups = new HashMap(); + NodeIterator kgIter; + Element keyGroupElem; + + // select all KeyGroup elements and build the KeyGroup objects from them + kgIter = XPathUtils.selectNodeIterator(getConfigElem(), KEYGROUP_XPATH); + while ((keyGroupElem = (Element) kgIter.nextNode()) != null) + { + String keyGroupId = getElementValue(keyGroupElem, CONF + "Id", null); + Set keyGroupEntries = + buildKeyGroupEntries(keyGroupId, keyModuleIds, keyGroupElem); + KeyGroup keyGroup = new KeyGroup(keyGroupId, keyGroupEntries); + + if (keyGroups.containsKey(keyGroupId)) + { + warn("config.04", new Object[] { "KeyGroup", keyGroupId }); + } + else + { + keyGroups.put(keyGroup.getId(), keyGroup); + } + } + + return keyGroups; + } + + /** + * Return the set of IDs contained in the given KeyModules. + * + * @param keyModules The KeyModules from which to extract the + * IDs. + * @return The IDs from the given KeyModules. + */ + private Set toIdSet(List keyModules) { + Set ids = new HashSet(); + Iterator iter; + + for (iter = keyModules.iterator(); iter.hasNext();) { + KeyModule keyModule = (KeyModule) iter.next(); + ids.add(keyModule.getId()); + } + + return ids; + } + + /** + * Build the key entries belonging to a key group. + * + * @param keyGroupId The ID of the key group we are building here. Passed + * for logging purposes. + * @param keyModuleIds The IDs of the HardwareKeyModules and + * SoftwareKeyModules that exist in the configuration. + * @param keyGroupElem The KeyGroup DOM element to parse. + * @return A Set of KeyGroupEntry objects. + */ + private Set buildKeyGroupEntries( + String keyGroupId, + Set keyModuleIds, + Element keyGroupElem) { + + Set entries = new HashSet(); + NodeIterator keyEntryIter; + Element keyEntryElem; + + // select all Key elements and put them into the Map + keyEntryIter = XPathUtils.selectNodeIterator(keyGroupElem, CONF + "Key"); + while ((keyEntryElem = (Element) keyEntryIter.nextNode()) != null) + { + String keyModuleId = getElementValue(keyEntryElem, CONF + "KeyModuleId", ""); + Element keyCertElem = (Element) XPathUtils.selectSingleNode(keyEntryElem, CONF + "KeyCertIssuerSerial"); + IssuerAndSerial issuerSerial = buildIssuerAndSerial(keyCertElem); + + if (!keyModuleIds.contains(keyModuleId)) { + warn("config.26", new Object[] { keyGroupId, keyModuleId }); + } else if (issuerSerial != null) { + KeyGroupEntry entry = new KeyGroupEntry(keyModuleId, issuerSerial); + entries.add(entry); + } + } + return entries; + } + + /** + * Build the key group mapping. + * + * @param keyGroups The available key groups. + * @param anonymous The IssuerAndSerial to be used for key group + * mappings not protected by a certificate. + * @return The key group mapping. + */ + public Map buildKeyGroupMappings(Map keyGroups, IssuerAndSerial anonymous) { + Map mappings = new HashMap(); + NodeIterator mappingIter; + Element mappingElem; + + // select all KeyGroupMapping elements + mappingIter = + XPathUtils.selectNodeIterator(getConfigElem(), KEYGROUP_MAPPING_XPATH); + + // build the mapping for each KeyGroupMapping element + while ((mappingElem = (Element) mappingIter.nextNode()) != null) + { + Element issuerSerialElem = (Element) XPathUtils.selectSingleNode(mappingElem, CONF + "CustomerId"); + + // build the IssuerAndSerial who has access to the key groups + IssuerAndSerial issuerAndSerial; + if (issuerSerialElem != null) + { + issuerAndSerial = buildIssuerAndSerial(issuerSerialElem); + } + else + { + // IssuerSerial element: the keygroup is generally available + issuerAndSerial = anonymous; + } + + // add the key groups to the mappings + if (issuerAndSerial != null) { + Map groups = (Map) mappings.get(issuerAndSerial); + NodeIterator keyGroupIter; + Element keyGroupElem; + + if (groups == null) + { + // no mapping exist -> build one + groups = new HashMap(); + mappings.put(issuerAndSerial, groups); + } + + // select the available key groups and add them to the mapping + keyGroupIter = XPathUtils.selectNodeIterator(mappingElem, CONF + "KeyGroupId"); + while ((keyGroupElem = (Element) keyGroupIter.nextNode()) != null) + { + String keyGroupId = getElementValue(keyGroupElem, ".", null); + KeyGroup keyGroup = (KeyGroup) keyGroups.get(keyGroupId); + + if (keyGroup != null) + { + groups.put(keyGroupId, keyGroup); + } else + { + warn("config.00", new Object[] { keyGroupId }); + } + } + } + } + + return mappings; + } + + /** + * Returns the default chaining mode from the configuration. + * + * @return The default chaining mode. + */ + public String getDefaultChainingMode() + { + String defaultChaining = getElementValue( + getConfigElem(), + CHAINING_MODES_DEFAULT_XPATH, + CM_PKIX); + + return translateChainingMode(defaultChaining); + + } + + /** + * Build the chaining modes for all configured trust anchors. + * + * @return The mapping from trust anchors to chaining modes. + */ + public Map buildChainingModes() + { + Map chainingModes = new HashMap(); + NodeIterator trustIter = XPathUtils.selectNodeIterator(getConfigElem(), TRUST_ANCHOR_XPATH); + + Element trustAnchorElem; + while ((trustAnchorElem = (Element) trustIter.nextNode()) != null) + { + IssuerAndSerial issuerAndSerial = buildIssuerAndSerial( + (Element)XPathUtils.selectSingleNode(trustAnchorElem, CONF + "Identification")); + String mode = getElementValue(trustAnchorElem, CONF + "Mode", null); + + if (issuerAndSerial != null) + { + chainingModes.put(issuerAndSerial, translateChainingMode(mode)); + } + } + + return chainingModes; + } + + /** + * Build an IssuerAndSerial from the DOM representation. + * + * @param root The root element (being of type dsig: + * X509IssuerSerialType. + * @return The issuer and serial number contained in the root + * element or null if could not be built for any reason. + */ + private IssuerAndSerial buildIssuerAndSerial(Element root) { + String issuer = getElementValue(root, ISSUER_XPATH, null); + String serial = getElementValue(root, SERIAL_XPATH, null); + + if (issuer != null && serial != null) { + try { + RFC2253NameParser nameParser = new RFC2253NameParser(issuer); + Principal issuerDN = nameParser.parse(); + + return new IssuerAndSerial(issuerDN, new BigInteger(serial)); + } catch (RFC2253NameParserException e) { + warn("config.16", new Object[] { issuer, serial }, e); + return null; + } catch (NumberFormatException e) { + warn("config.16", new Object[] { issuer, serial }, e); + return null; + } + } + return null; + } + + /** + * Translate the chaining mode from the configuration file to one used in the + * IAIK MOA API. + * + * @param chainingMode The chaining mode from the configuration. + * @return The chaining mode as provided by the ChainingModes + * interface. + * @see iaik.pki.pathvalidation.ChainingModes + */ + private String translateChainingMode(String chainingMode) { + if (chainingMode.equals(CM_CHAINING)) { + return ChainingModes.CHAIN_MODE; + } else if (chainingMode.equals(CM_PKIX)) { + return ChainingModes.PKIX_MODE; + } else { + return ChainingModes.PKIX_MODE; + } + } + + /** + * Build the distribution points mapping. + * + * @return The mapping from certificate authorities to distribution points. + */ + public Map buildDistributionPoints() + { + Map dPs = new HashMap(); + NodeIterator dPIter; + Element dPElem; + + // select all DistributionPoint elements + dPIter = XPathUtils.selectNodeIterator(getConfigElem(), DISTRIBUTION_POINTS_XPATH); + + // build the mapping of CA name to distribution points + while ((dPElem = (Element) dPIter.nextNode()) != null) { + String caIssuerDNText = getElementValue(dPElem, CONF + "CAIssuerDN", ""); + RFC2253NameParser nameParser = new RFC2253NameParser(caIssuerDNText); + NodeIterator cRLDPIter = XPathUtils.selectNodeIterator(dPElem, CONF + "CRLDP"); + NodeIterator oCSPDPPIter = XPathUtils.selectNodeIterator(dPElem, CONF + "OCSPDP"); + + try + { + String caIssuerDN = nameParser.parse().getName(); + + // check, if a mapping exists or make a new mapping + Set dPsForCA = (Set) dPs.get(caIssuerDN); + if (dPsForCA == null) + { + dPsForCA = new HashSet(); + dPs.put(caIssuerDN, dPsForCA); + } + + // add the CRL distribution points of this CA to the set + Element cRLDPElem; + while ((cRLDPElem = (Element) cRLDPIter.nextNode()) != null) + { + CRLDistributionPoint cRLDP = (CRLDistributionPoint) buildDistributionPoint(cRLDPElem, caIssuerDN); + dPsForCA.add(cRLDP); + } + + // add the OCSP distribution points of this CA to the set + Element oCSPPElem; + while ((oCSPPElem = (Element) oCSPDPPIter.nextNode()) != null) + { + OCSPDistributionPoint oCSPDP = (OCSPDistributionPoint) buildDistributionPoint(oCSPPElem, null); + dPsForCA.add(oCSPDP); + } +} + catch (RFC2253NameParserException e) + { + warn("config.13", new Object[] { caIssuerDNText }, e); + } + + } + + return dPs; + } + + /** + * Build a distribution point from the DOM representation. + * + * @param dpElem The root element of the distribution point. + * + * @param issuerName The name of the CA issuing the CRL referred to by this DP, or null + * if this DP refers to an OCSP responder. + * + * @return The distribution point. + */ + private DistributionPoint buildDistributionPoint(Element dpElem, String issuerName) + { + String uri = getElementValue(dpElem, CONF + "Location", null); + + if ("CRLDP".equals(dpElem.getLocalName())) + { + NodeIterator reasonCodesIter = XPathUtils.selectNodeIterator(dpElem, CONF + "ReasonCode"); + Element reasonCodeElem; + StringBuffer reasonCodesSB = new StringBuffer(); + while ((reasonCodeElem = (Element)reasonCodesIter.nextNode()) != null) + { + if (reasonCodesSB.length() > 0) reasonCodesSB.append(" "); + reasonCodesSB.append(getElementValue(reasonCodeElem, ".", "").trim()); + } + return new CRLDistributionPoint(issuerName, uri, reasonCodesSB.toString()); + } + else + { + return new OCSPDistributionPoint(uri); + } + } + + /** + * Return the CRL archive duration. + * + * @return The value of the CRL archive duration setting from the configuration, or 0 if + * no value is set in the configuration. + */ + public int getRevocationArchiveDuration() + { + String archiveDuration = getElementValue(getConfigElem(), CRL_ARCHIVE_DURATION_XPATH, null); + try + { + return Integer.parseInt(archiveDuration); + } + catch (NumberFormatException e) + { + warn("config.01", null); + return 365; + } + } + + /** + * Build the CreateTransformsInfoProfiles. + * + * @return The mapping from profile ID to profile. + */ + public Map buildCreateTransformsInfoProfiles() + { + return loadProfiles(CREATE_TRANSFORMS_INFO_PROFILE_XPATH, "CreateTransformsInfoProfile"); + } + + /** + * Build the CreateSignatureEnvironmentProfiles. + * + * @return The mapping from profile ID to profile. + */ + public Map buildCreateSignatureEnvironmentProfiles() + { + return loadProfiles(CREATE_SIGNATURE_ENVIRONMENT_PROFILE_XPATH, "CreateSignatureEnvironmentProfile"); + } + + /** + * Build the VerifyTransformsInfoProfiles. + * + * @return The mapping from profile ID to profile. + */ + public Map buildVerifyTransformsInfoProfiles() + { + return loadProfiles(VERIFY_TRANSFORMS_INFO_PROFILE_XPATH, "VerifyTransformsInfoProfile"); + } + + /** + * Build the SupplementProfiles. + * + * @return The mapping from profile ID to profile. + */ + public Map buildSupplementProfiles() + { + return loadProfiles(SUPPLEMENT_PROFILE_XPATH, "SupplementProfile"); + } + + /** + * Load a profile mapping. + * + * @param xpath The XPath to select the profiles from the configuration. + * + * @param profileRoot The name of the profile root element. + * + * @return Map The profile ID to profile mapping. + */ + private Map loadProfiles(String xpath, String profileRoot) + { + Map profiles = new HashMap(); + NodeIterator profileIter = XPathUtils.selectNodeIterator(getConfigElem(), xpath); + Element profileElem; + + while ((profileElem = (Element) profileIter.nextNode()) != null) + { + String id = getElementValue(profileElem, CONF + "Id", null); + String fileName = getElementValue(profileElem, CONF + "Location", null); + + if (profiles.containsKey(id)) + { + warn("config.04", new Object[] { profileRoot, id }); + } + else + { + try + { + File profileFile = new File(fileName); + + // make profileFile absolute + if (!profileFile.isAbsolute()) profileFile = new File(configRoot_, fileName); + + // load the profile + info("config.22", new Object[] { profileRoot, id, profileFile.getAbsoluteFile()}); + Element profile = loadProfile(profileFile); + + if (profile.getTagName().equals(profileRoot)) + { + profiles.put(id, profile); + } + else + { + warn("config.02", new Object[] { profileRoot, id, fileName }); + } + } catch (ConfigurationException e) { + warn("config.03", new Object[] { profileRoot, id }); + } + } + } + + return profiles; + } + + /** + * Load a profile from a file. + * + * @param root The absolute directory path of the main configuration file. + * @param profileFile The file containing the profile. + * @return The profile in its DOM representation. + * @throws ConfigurationException An error occurred loading the profile. + */ + private Element loadProfile(File profileFile) throws ConfigurationException { + + Element profile; + + try { + profile = parseXml(new FileInputStream(profileFile)); + } catch (Exception e) { + throw new ConfigurationException("config.12", null, e); + } + + return profile; + } + + /** + * Bulid the trust profile mapping. + * + * @return The profile ID to profile mapping. + */ + public Map buildTrustProfiles() + { + Map trustProfiles = new HashMap(); + NodeIterator profileIter = XPathUtils.selectNodeIterator(getConfigElem(), TRUST_PROFILE_XPATH); + Element profileElem; + + while ((profileElem = (Element) profileIter.nextNode()) != null) + { + String id = getElementValue(profileElem, CONF + "Id", null); + String trustAnchorsLocStr = getElementValue(profileElem, CONF + "TrustAnchorsLocation", null); + String signerCertsLocStr = getElementValue(profileElem, CONF + "SignerCertsLocation", null); + + URI trustAnchorsLocURI = null; + try + { + trustAnchorsLocURI = new URI(trustAnchorsLocStr); + if (!trustAnchorsLocURI.isAbsolute()) { // make it absolute to the config file + trustAnchorsLocURI = new URI(configRoot_.toURL() + trustAnchorsLocStr); + } + } + catch (URIException e) { + warn("config.14", new Object[] { "uri", id, trustAnchorsLocStr }, e); + continue; + } + catch (MalformedURLException e) + { + warn("config.15", new Object[] {id}, e); + continue; + } + + File profileDir = new File(trustAnchorsLocURI.getPath()); + if (!profileDir.exists() || !profileDir.isDirectory()) { + warn("config.27", new Object[] { "uri", id }); + continue; + } + + if (trustProfiles.containsKey(id)) { + warn("config.04", new Object[] { "TrustProfile", id }); + continue; + } + + URI signerCertsLocURI = null; + if (signerCertsLocStr != null && !"".equals(signerCertsLocStr)) + { + try + { + signerCertsLocURI = new URI(signerCertsLocStr); + if (!signerCertsLocURI.isAbsolute()) signerCertsLocURI = new URI(configRoot_.toURL() + signerCertsLocStr); + + File signerCertsDir = new File(signerCertsLocURI.getPath()); + if (!signerCertsDir.exists() || !signerCertsDir.isDirectory()) { + warn("config.27", new Object[] { "signerCertsUri", id }); + continue; + } + } + catch (URIException e) { + warn("config.14", new Object[] { "signerCertsUri", id, trustAnchorsLocStr }, e); + continue; + } + catch (MalformedURLException e) { + warn("config.15", new Object[] {id}, e); + continue; + } + } + + signerCertsLocStr = (signerCertsLocURI != null) ? signerCertsLocURI.toString() : null; + TrustProfile profile = new TrustProfile(id, trustAnchorsLocURI.toString(), signerCertsLocStr); + trustProfiles.put(id, profile); + } + + return trustProfiles; + } + + /** + * Returns the location of the certificate store. + * + * @return the location of the certificate store. + */ + public String getCertStoreLocation() + { + String certStoreLocStr = getElementValue(getConfigElem(), CERTSTORE_LOCATION_XPATH, null); + File certStoreLocFile; + + // No value specified in configuration file: Set it to a reasonable (absolute) default + if (certStoreLocStr == null) + return new File(configRoot_, "certstore").getAbsolutePath(); + + // Make cert store location an absolute value + certStoreLocFile = new File(certStoreLocStr); + if (!certStoreLocFile.isAbsolute()) + { + certStoreLocFile = new File(configRoot_, certStoreLocStr); + } + + // Check if cert store location exists, eventually try to create it + if (!certStoreLocFile.isDirectory()) + { + boolean created = false; + try + { + created = certStoreLocFile.mkdirs(); + } + finally + { + if (!created) + { + warn("config.32", new Object[] { certStoreLocFile.getAbsolutePath() }); + } + } + } + + return certStoreLocFile.getAbsolutePath(); + } + + // + // various utility methods + // + + /** + * Parse a configuration XML file. + * + * @param inputStream The stream from which to read the XML data. + * @return The DOM representation of the XML data. + * @throws ParserConfigurationException XML parser not configured properly. + * @throws SAXException An error parsing the XML file. + * @throws IOException An error reading the stream. + */ + private static Element parseXml(InputStream inputStream) + throws ParserConfigurationException, SAXException, IOException { + return DOMUtils + .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null) + .getDocumentElement(); + } + + /** + * Return the value of an element located by an XPath. + * + * @param root The root element from which to evaluate the xpath. + * @param xpath The XPath pointing to the element. + * @param def The default value, if no element can be found with the given + * xpath. + * @return The element value or def, if the element cannot be + * found. + */ + private String getElementValue(Element root, String xpath, String def) { + + Element elem = (Element) XPathUtils.selectSingleNode(root, xpath); + return elem != null ? DOMUtils.getText(elem) : def; + } + + /** + * Return the value of an attribute located by an XPath. + * + * @param root The root element from which to evaluate the xpath. + * @param xpath The XPath pointing to the attribute. + * @param def The default value, if no attribute can be found with the given + * xpath. + * @return The element value or def, if the attribute cannot be + * found. + */ + private String getAttributeValue(Element root, String xpath, String def) { + Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); + return attr != null ? attr.getValue() : def; + } + + /** + * Log an info message. + * + * @param messageId The message ID. + * @param parameters Additional parameters for the message. + * @see at.gv.egovernment.moa.spss.server.util.MessageProvider + */ + private static void info(String messageId, Object[] parameters) { + MessageProvider msg = MessageProvider.getInstance(); + Logger.info(new LogMsg(msg.getMessage(messageId, parameters))); + } + + /** + * Log a warning. + * + * @param messageId The message ID. + * @param args Additional parameters for the message. + * @see at.gv.egovernment.moa.spss.server.util.MessageProvider + */ + private void warn(String messageId, Object[] args) { + MessageProvider msg = MessageProvider.getInstance(); + String txt = msg.getMessage(messageId, args); + + Logger.warn(new LogMsg(txt)); + warnings.add(txt); + } + + /** + * Log a warning. + * + * @param messageId The message ID. + * @param args Additional parameters for the message. + * @param t An exception being the cause of the warning. + * @see at.gv.egovernment.moa.spss.server.util.MessageProvider + */ + private void warn(String messageId, Object[] args, Throwable t) { + MessageProvider msg = MessageProvider.getInstance(); + String txt = msg.getMessage(messageId, args); + + Logger.warn(new LogMsg(txt), t); + warnings.add(txt); + } + + /** + * Returns whether revocation information should be archived. + * + * @return whether revocation information should be archived. + */ + public boolean getEnableRevocationArchiving() + { + String enableArchiving = getElementValue(getConfigElem(), ENABLE_ARCHIVING_XPATH, null); + return Boolean.valueOf(enableArchiving).booleanValue(); + } + + /** + * Returns the JDBC URL for the revocation archive database. + * + * @return the JDBC URL for the revocation archive database, or nullnullConfiguration data is read from an XML file, whose location is given by + * the moa.spss.server.configuration system property.

+ *

This class implements the Singleton pattern. The reload() + * method can be used to update the configuration data. Therefore, it is not + * guaranteed that consecutive calls to getInstance() will return + * the same ConfigurationProvider all the time. During the + * processing of a web service request, the current + * TransactionContext should be used to obtain the + * ConfigurationProvider local to that request.

+ * + * @author Patrick Peck + * @author Sven Aigner + * @version $Id$ + */ +public class ConfigurationProvider +{ + /** + * The name of the system property which contains the file name of the + * configuration file. + */ + public static final String CONFIG_PROPERTY_NAME = + "moa.spss.server.configuration"; + + /** + * A fake IssuerAndSerial object for storing KeyGroup information + * accessible by all clients. + */ + private static final IssuerAndSerial ANONYMOUS_ISSUER_SERIAL = + new IssuerAndSerial(new Name(), new BigInteger("0")); + + /** Singleton instance. null, if none has been created. */ + private static ConfigurationProvider instance; + + // + // configuration data + // + + /** The warnings generated when building the configuration. */ + private List warnings = new ArrayList(); + + /** The default digest method algorithm name */ + private String digestMethodAlgorithmName; + + /** The default canonicalization algorithm name */ + private String canonicalizationAlgorithmName; + + /** + * A List of HardwareCryptoModule objects for + * configuring hardware modules. + */ + private List hardwareCryptoModules; + + /** + * A List of HardwareKey objects containing the + * configuration data for hardware keys. + */ + private List hardwareKeyModules; + + /** + * A List of SoftwareKey objects containing the + * configuration data for software keys. + */ + private List softwareKeyModules; + + /** + * A Map which contains a KeyGroupId (a String) to + * KeyGroup mapping. + */ + private Map keyGroups; + + /** + * A Map which contains the IssuerAndSerial to + * KeyGroup mapping. + */ + private Map keyGroupMappings; + + /** The default chaining mode. */ + private String defaultChainingMode; + + /** + * A Map which contains the IssuerAndSerial to + * chaining mode (a String) mapping. + */ + private Map chainingModes; + + /** + * A Map which contains the CAIssuerDN (a String) + * to distribution points (a Set of + * DistributionPoints) mapping. + */ + private Map distributionPoints; + + /** + * The CRL archive duration. + */ + private int cRLArchiveDuration; + + /** + * Indicates whether revocation information should be archived. + */ + private boolean enableRevocationArchiving_; + + /** + * The location of the certificate store. + */ + private String certStoreLocation_; + + /** + * A Map which contains a mapping from + * CreateSignatureEnvironmentProfile Ids (String) to + * CreateSignatureEnvironmentProfile elements (an Element). + */ + private Map createSignatureEnvironmentProfiles; + + /** + * A Map which contains a mapping from + * CreateTransformsInfoProfile Ids (String) to + * CreateTransformsInfoProfile elements (an Element). + */ + private Map createTransformsInfoProfiles; + + /** + * A Map which contains a mapping from + * VerifyTransformsInfoProfile Ids (String) to + * VerifyTransformsInfoProfile elements (an Element). + */ + private Map verifyTransformsInfoProfiles; + + /** + * A Map which contains a mapping from + * SupplementProfile Ids (String) to SupplementProfile elements + * (an Element). + */ + private Map supplementProfiles; + + /** + * A Map which contains a TrustProfile Id (a String + * to trust profile (a TrustProfile) mapping. + */ + private Map trustProfiles; + + /** + * The JDBC URL for the revocation archive database. + */ + private String revocationArchiveJDBCURL_; + + /** + * The JDBC driver class name for the revocation archive database. + */ + private String revocationArchiveJDBCDriverClass_; + + /** + * Indicates whether revocation checking should be done. + */ + private boolean enableRevocationChecking_; + + /** + * The maximum age of a revocation information for considering it still as valid. + */ + private long maxRevocationAge_; + + /** + * The service order for revocation checking. + */ + private String[] serviceOrder_; + + /** + * Indicates whether certificates found during certificate path construction + * should be added to the certificate store. + */ + private boolean autoAddCertificates_; + + /** + * Indicates whether the certificate extension Authority Info Access should + * be used during certificate path construction. + */ + private boolean useAuthorityInfoAccess_; + + /** + * Return the single instance of configuration data. + * + * @return MOAConfigurationProvider The current configuration data. + * @throws ConfigurationException Failure to load the configuration data. + */ + public static synchronized ConfigurationProvider getInstance() + throws ConfigurationException { + + if (instance == null) { + reload(); + } + return instance; + } + + /** + * Reload the configuration data and set it if successful. + * + * @return MOAConfigurationProvider The loaded configuration data. + * @throws ConfigurationException Failure to load the configuration data. + */ + public static synchronized ConfigurationProvider reload() + throws ConfigurationException { + String fileName = System.getProperty(CONFIG_PROPERTY_NAME); + + if (fileName == null) { + // find out where we are running and use the configuration provided + // under WEB-INF/conf/moa-spss/MOA-SPSSConfiguration + URL url = ConfigurationProvider.class.getResource("/"); + fileName = + new File(url.getPath()).getParent() + + "/conf/moa-spss/MOA-SPSSConfiguration.xml"; + info("config.05", new Object[] { CONFIG_PROPERTY_NAME }); + } + + instance = new ConfigurationProvider(fileName); + return instance; + } + + /** + * Constructor for ConfigurationProvider. + * + * @param fileName The name of the configuration file. + * @throws ConfigurationException An error occurred loading the configuration. + */ + public ConfigurationProvider(String fileName) throws ConfigurationException { + load(fileName); + } + + /** + * Load the configuration data from XML file with the given name and build + * the internal data structures representing the MOA configuration. + * + * @param fileName The name of the XML file to load. + * @throws ConfigurationException The MOA configuration could not be + * read/built. + */ + private void load(String fileName) throws ConfigurationException { + FileInputStream stream = null; + File configFile; + File configRoot; + Element configElem; + ConfigurationPartsBuilder builder; + List allKeyModules; + + + // load the main config file + try { + configFile = new File(fileName); + configRoot = new File(configFile.getParent()); + info("config.21", new Object[] { configFile.getAbsoluteFile()}); + stream = new FileInputStream(fileName); + configElem = DOMUtils.parseXmlValidating(new FileInputStream(fileName)); + } catch (Throwable t) { + throw new ConfigurationException("config.10", null, t); + } + + // build the internal datastructures + try { + builder = new ConfigurationPartsBuilder(configElem, configRoot); + digestMethodAlgorithmName = builder.getDigestMethodAlgorithmName(); + canonicalizationAlgorithmName = + builder.getCanonicalizationAlgorithmName(); + hardwareCryptoModules = builder.buildHardwareCryptoModules(); + hardwareKeyModules = + builder.buildHardwareKeyModules(Collections.EMPTY_LIST); + softwareKeyModules = + builder.buildSoftwareKeyModules(hardwareKeyModules); + allKeyModules = new ArrayList(hardwareKeyModules); + allKeyModules.addAll(softwareKeyModules); + keyGroups = builder.buildKeyGroups(allKeyModules); + keyGroupMappings = + builder.buildKeyGroupMappings(keyGroups, ANONYMOUS_ISSUER_SERIAL); + defaultChainingMode = builder.getDefaultChainingMode(); + chainingModes = builder.buildChainingModes(); + useAuthorityInfoAccess_ = builder.getUseAuthorityInfoAccess(); + autoAddCertificates_ = builder.getAutoAddCertificates(); + trustProfiles = builder.buildTrustProfiles(); + distributionPoints = builder.buildDistributionPoints(); + enableRevocationChecking_ = builder.getEnableRevocationChecking(); + maxRevocationAge_ = builder.getMaxRevocationAge(); + serviceOrder_ = builder.getServiceOrder(); + enableRevocationArchiving_ = builder.getEnableRevocationArchiving(); + cRLArchiveDuration = builder.getRevocationArchiveDuration(); + revocationArchiveJDBCURL_ = builder.getRevocationArchiveJDBCURL(); + revocationArchiveJDBCDriverClass_ = builder.getRevocationArchiveJDBCDriverClass(); + certStoreLocation_ = builder.getCertStoreLocation(); + createTransformsInfoProfiles = builder.buildCreateTransformsInfoProfiles(); + createSignatureEnvironmentProfiles = builder.buildCreateSignatureEnvironmentProfiles(); + verifyTransformsInfoProfiles = builder.buildVerifyTransformsInfoProfiles(); + supplementProfiles = builder.buildSupplementProfiles(); + warnings = new ArrayList(builder.getWarnings()); + } catch (Throwable t) { + throw new ConfigurationException("config.11", null, t); + } finally { + try { + if (stream != null) { + stream.close(); + } + } catch (IOException e) { + // don't complain about this + } + } + } + + /** + * Returns the warnings encountered during building the configuration. + * + * @return A List of Strings, containing the + * warning messages. + */ + public List getWarnings() { + return warnings; + } + + /** + * Return the name of the digest algorithm used during signature creation. + * + * @return The digest method algorithm name, or an empty String, + * if none has been configured. + */ + public String getDigestMethodAlgorithmName() { + return digestMethodAlgorithmName; + } + + /** + * Return the name of the canonicalization algorithm used during signature + * creation. + * + * @return The canonicalization algorithm name, or an empty + * String if none has been configured. + */ + public String getCanonicalizationAlgorithmName() { + return canonicalizationAlgorithmName; + } + + /** + * Return the configured hardware crypto modules. + * + * @return A List of HardwareCryptoModule objects + * containing the hardware crypto module configurations. + */ + public List getHardwareCryptoModules() { + return hardwareCryptoModules; + } + + /** + * Return the hardware key modules configuration. + * + * @return A List of HardwareKeyModule objects + * containing the configuration of the hardware key modules. + */ + public List getHardwareKeyModules() { + return hardwareKeyModules; + } + + /** + * Return the software key module configuration. + * + * @return A List of SoftwareKeyModule objects + * containing the configuration of the software key modules. + */ + public List getSoftwareKeyModules() { + return softwareKeyModules; + } + + /** + * Return the key group mapping. + * + * @return A mapping from key group ID (a String) to + * KeyGroup mapping. + */ + public Map getKeyGroups() { + return keyGroups; + } + + /** + * Return the set of KeyGroupEntrys of a given key group, which a + * client (identified by an issuer/serial pair) may access. + * + * @param issuer The issuer of the client certificate. + * @param serial The serial number of the client certificate. + * @param keyGroupId The ID of the key group. + * @return A Set of all the KeyGroupEntrys in the + * given key group, if the user may access them. Returns null, if + * the user may not access the given key group or if the key group does not + * exist. + */ + public Set getKeyGroupEntries( + Principal issuer, + BigInteger serial, + String keyGroupId) { + + IssuerAndSerial issuerAndSerial; + Map mapping; + + if (issuer == null && serial == null) { + issuerAndSerial = ANONYMOUS_ISSUER_SERIAL; + } else { + issuerAndSerial = new IssuerAndSerial(issuer, serial); + } + + mapping = (Map) keyGroupMappings.get(issuerAndSerial); + if (mapping != null) { + KeyGroup keyGroup = (KeyGroup) mapping.get(keyGroupId); + + if (keyGroup != null) { + return keyGroup.getKeyGroupEntries(); + } + } + + // If no key group is available for a client identified by a certificate, + // try to find a key group in the anonymous key group mapping + if (issuer != null || serial != null) + { + mapping = (Map) keyGroupMappings.get(ANONYMOUS_ISSUER_SERIAL); + if (mapping != null) + { + KeyGroup keyGroup = (KeyGroup) mapping.get(keyGroupId); + if (keyGroup != null) return keyGroup.getKeyGroupEntries(); + } + } + + return null; + } + + /** + * Return the chaining mode for a given trust anchor. + * + * @param trustAnchor The trust anchor for which the chaining mode should be + * returned. + * @return The chaining mode for the given trust anchor. If the trust anchor + * has not been configured separately, the system default will be returned. + */ + public String getChainingMode(X509Certificate trustAnchor) { + Principal issuer = trustAnchor.getIssuerDN(); + BigInteger serial = trustAnchor.getSerialNumber(); + IssuerAndSerial issuerAndSerial = new IssuerAndSerial(issuer, serial); + + String mode = (String) chainingModes.get(issuerAndSerial); + return mode != null ? mode : defaultChainingMode; + } + + /** + * Return the distribution points for a given CA. + * + * @param cert The certificate for which the distribution points should be + * looked up. The issuer information is used to perform the lookup. + * + * @return A Set of DistributionPoint objects. The + * set will be empty, if no distribution points have been configured + * for this certificate. + */ + public Set getDistributionPoints(X509Certificate cert) + { + try { + RFC2253NameParser nameParser = + new RFC2253NameParser(cert.getIssuerDN().toString()); + String caIssuerDN = nameParser.parse().getName(); + Set dps = (Set) distributionPoints.get(caIssuerDN); + + if (dps == null) { + return Collections.EMPTY_SET; + } + return dps; + } catch (RFC2253NameParserException e) { + return Collections.EMPTY_SET; + } + } + + /** + * Return the CRL archive duration. + * + * @return The duration of how long to keep CRL archive entries (measured in + * days). + */ + public int getCRLArchiveDuration() { + return cRLArchiveDuration; + } + + /** + * Returns whether revocation information should be archived. + * + * @return whether revocation information should be archived. + */ + public boolean getEnableRevocationArchiving() + { + return enableRevocationArchiving_; + } + + /** + * Returns the location of the certificate store. + * + * @return the location of the certificate store. + */ + public String getCertStoreLocation() + { + return certStoreLocation_; + } + + /** + * Return a CreateTransformsInfoProfile with the given ID. + * + * @param id The CreateTransformsInfoProfile ID. + * @return The CreateTransformsInfoProfile with the given + * ID or null, if none exists. + */ + public Element getCreateTransformsInfoProfile(String id) { + return (Element) createTransformsInfoProfiles.get(id); + } + + /** + * Return a CreateSignatureEnvironmentProfile with the given ID. + * + * @param id The CreateSignatureEnvironmentProfile ID. + * @return The CreateSignatureEnvironmentProfile with the given + * ID or null, if none exists. + */ + public Element getCreateSignatureEnvironmentProfile(String id) { + return (Element) createSignatureEnvironmentProfiles.get(id); + } + + /** + * Return a VerifyTransformsInfoProfile with the given ID. + * + * @param id The VerifyTransformsInfoProfile ID. + * @return The VerifyTransformsInfoProfile with the given ID or + * null, if none exists. + */ + public Element getVerifyTransformsInfoProfile(String id) { + return (Element) verifyTransformsInfoProfiles.get(id); + } + + /** + * Return a SupplementProfile with the given ID. + * + * @param id The SupplementProfile ID. + * @return The SupplementProfile with the given ID or + * null, if none exists. + */ + public Element getSupplementProfile(String id) { + return (Element) supplementProfiles.get(id); + } + + /** + * Return a TrustProfile with the given ID. + * + * @param id The TrustProfile ID. + * @return The TrustProfile with the given ID or + * null, if none exists. + */ + public TrustProfile getTrustProfile(String id) { + return (TrustProfile) trustProfiles.get(id); + } + + /** + * Log a warning. + * + * @param messageId The message ID. + * @param parameters Additional parameters for the message. + * @see at.gv.egovernment.moa.spss.server.util.MessageProvider + */ + private static void info(String messageId, Object[] parameters) { + MessageProvider msg = MessageProvider.getInstance(); + Logger.info(new LogMsg(msg.getMessage(messageId, parameters))); + } + + /** + * Log a warning. + * + * @param messageId The message ID. + * @param args Additional parameters for the message. + * @see at.gv.egovernment.moa.spss.server.util.MessageProvider + */ + private void warn(String messageId, Object[] args) { + MessageProvider msg = MessageProvider.getInstance(); + String txt = msg.getMessage(messageId, args); + + Logger.warn(new LogMsg(txt)); + warnings.add(txt); + } + + /** + * Returns the JDBC URL for the revocation archive database. + * + * @return the JDBC URL for the revocation archive database. + */ + public String getRevocationArchiveJDBCURL() + { + return revocationArchiveJDBCURL_; + } + + /** + * Returns the JDBC driver class name for the revocation archive database. + * + * @return the JDBC driver class name for the revocation archive database. + */ + public String getRevocationArchiveJDBCDriverClass() + { + return revocationArchiveJDBCDriverClass_; + } + + /** + * Returns whether revocation checking should be done. + * + * @return whether revocation checking should be done. + */ + public boolean getEnableRevocationChecking() + { + return enableRevocationChecking_; + } + + /** + * Returns the maximum age of a revocation information for considering it + * still as valid. + * + * @return the maximum age of a revocation information for considering it + * still as valid. + */ + public long getMaxRevocationAge() + { + return maxRevocationAge_; + } + + /** + * Returns the service order for revocation checking. + * + * @return the service order for revocation checking. Valid array entries are + * {@link RevocationSourceTypes#OCSP} and {@link RevocationSourceTypes#CRL}. + */ + public String[] getServiceOrder() + { + return serviceOrder_; + } + + /** + * Returns whether certificates found during certificate path construction + * should be added to the certificate store. + * + * @return whether certificates found during certificate path construction + * should be added to the certificate store. + */ + public boolean getAutoAddCertificates() + { + return autoAddCertificates_; + } + + /** + * Returns whether the certificate extension Authority Info Access should + * be used during certificate path construction. + * + * @return whether the certificate extension Authority Info Access should + * be used during certificate path construction. + */ + public boolean getUseAuthorityInfoAccess() + { + return useAuthorityInfoAccess_; + } + +} \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java new file mode 100644 index 000000000..5c0646449 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java @@ -0,0 +1,38 @@ +package at.gv.egovernment.moa.spss.server.config; + +/** + * Abstract base class for distribution points. + * + * @author Gregor Karlinger + * @version $Id$ + * */ +public abstract class DistributionPoint implements iaik.pki.revocation.DistributionPoint +{ + /** + * The distribution point URI. + */ + private String uri_; + + /** + * Create a DistributionPoint with a URI. + * + * @param uri The URI of the distribution point. + */ + public DistributionPoint(String uri) + { + uri_ = uri; + } + + /** + * @see iaik.pki.revocation.DistributionPoint#getType() + */ + public abstract String getType(); + + /** + * @see iaik.pki.revocation.DistributionPoint#getUri() + */ + public String getUri() + { + return uri_; + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java new file mode 100644 index 000000000..62e8d63a6 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java @@ -0,0 +1,60 @@ +package at.gv.egovernment.moa.spss.server.config; + +/** + * Contains configuration data for a hardware crypto module. + * + * @author Patrick Peck + * @version $Id$ + */ +public class HardwareCryptoModule { + /** The name of the module. */ + private String name; + /** The slod ID of the module. */ + private String slotID; + /** The user PIN of the module. */ + private String userPIN; + + /** + * Create a new HardwareCryptoModule. + * + * @param name The name of this HardwareCryptoModule. + * @param slotID The slot ID of this HardwareCryptoModule. + * @param userPIN The user PIN to access this + * HardwareCryptoModule. + */ + public HardwareCryptoModule(String name, String slotID, String userPIN) { + this.name = name; + this.slotID = slotID; + this.userPIN = userPIN; + } + + /** + * Returns the name of this HardwareCryptoModule. + * + * @return The name of this HardwareCryptoModule. + */ + public String getName() { + return name; + } + + /** + * Returns the slot ID of this HardwareCryptoModule. + * + * @return The slot ID. + */ + public String getSlotID() { + return slotID; + } + + + /** + * Returns the user PIN of this HardwareCryptoModule. + * + * @return The user PIN used to access the module. + */ + public String getUserPIN() { + return userPIN; + } + + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java new file mode 100644 index 000000000..622c8d110 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java @@ -0,0 +1,59 @@ +package at.gv.egovernment.moa.spss.server.config; + +/** + * A class that contains information about a hardware key module. + * + * @author Patrick Peck + * @version $Id$ + */ +public class HardwareKeyModule extends KeyModule { + /** The name of the module. */ + private String name; + /** The slod ID of the module. */ + private String slotID; + /** The user PIN of the module. */ + private String userPIN; + + /** + * Create a new HardwareKey. + * + * @param id The key module ID. + * @param name The name of the key. + * @param slotID The slot ID of the key within the hardware module. May be + * null. + * @param userPIN The user PIN to access the key. + */ + public HardwareKeyModule(String id, String name, String slotID, String userPIN) { + super(id); + this.name = name; + this.slotID = slotID; + this.userPIN = userPIN; + } + + /** + * Return the name of this HardwareKey. + * + * @return The name of this HardwareKey. + */ + public String getName() { + return name; + } + + /** + * Return the slot ID of this HardwareKey. + * + * @return The slot ID of this HardwareKey. + */ + public String getSlotID() { + return slotID; + } + + /** + * Return the user PIN to access this HardwareKey. + * + * @return The user PIN to access this HardwareKey. + */ + public String getUserPIN() { + return userPIN; + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java new file mode 100644 index 000000000..0814c90d6 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java @@ -0,0 +1,125 @@ +package at.gv.egovernment.moa.spss.server.config; + +import java.math.BigInteger; +import java.security.Principal; + +import iaik.asn1.structures.Name; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; + +/** + * A class containing the issuer and serial number of a certificate, which can + * be used to uniquely identify the certificate. + * + * The issuer is contained as an RFC2253 encoded String. + * + * @author Patrick Peck + * @version $Id$ + */ +public class IssuerAndSerial { + + /** The issuer distinguished name. */ + private String issuerDN; + /** The certificate serial number. */ + private BigInteger serial; + + /** + * Create an IssuerAndSerial object. + * + * The name of the issuer is converted to RFC2253. If it cannot be parsed, the + * DN contained in the issuer is set. + * + * @param issuer The isser of a certificate. + * @param serial The serial number of the certificate. + */ + public IssuerAndSerial(Principal issuer, BigInteger serial) { + String issuerDN = null; + if (issuer instanceof Name) { + try { + issuerDN = ((Name)issuer).getRFC2253String(); + } catch (RFC2253NameParserException e) { + // do nothing + } + } + if (issuerDN == null) { + RFC2253NameParser parser = new RFC2253NameParser(issuer.getName()); + try { + issuerDN = ((Name)parser.parse()).getRFC2253String(); + } catch (RFC2253NameParserException e) { + issuerDN = issuer.getName(); + } + } + this.serial = serial; + this.issuerDN = issuerDN; + } + + /** + * Create an IssuerAndSerial object. + * + * @param issuerDN The issuer distinguished name. Should be an RFC2253 name. + * @param serial The serial number of the certificate. + */ + public IssuerAndSerial(String issuerDN, BigInteger serial) { + this.issuerDN = issuerDN; + this.serial = serial; + } + + /** + * Return the issuer DN in RFC2253 format. + * + * @return The issuer part of this object. + */ + public String getIssuerDN() { + return issuerDN; + } + + /** + * Return the serial number. + * + * @return The serial number of this object. + */ + public BigInteger getSerial() { + return serial; + } + + /** + * Compare this IssuerAndSerial to another object. + * + * @param other The object to compare this IssuerAndSerial to. + * @return true, if other is an + * IssuerAndSerial object and the issuer and + * serial fields are both equal. false otherwise. + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object other) { + if (other instanceof IssuerAndSerial) { + IssuerAndSerial ias = (IssuerAndSerial) other; + return getIssuerDN().equals(ias.getIssuerDN()) + && getSerial().equals(ias.getSerial()); + } + return false; + } + + /** + * Return the hash code of this IssuerAndSerial. + * + * @return The hash code of this IssuerAndSerial. + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return issuerDN.hashCode() ^ serial.hashCode(); + } + + /** + * Return a String representation of this + * IssuerAndSerial object. + * + * @return The String representation. + * @see java.lang.Object#toString() + */ + public String toString() { + return ("(IssuerAndSerial - Issuer<" + getIssuerDN()) + + ("> Serial<" + serial.toString() + ">)"); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java new file mode 100644 index 000000000..5fd108e1a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java @@ -0,0 +1,69 @@ +package at.gv.egovernment.moa.spss.server.config; + +import java.util.Iterator; +import java.util.Set; + +/** + * A collection of KeyGroupEntrys with its own ID. + * + * @author Sven Aigner + * @author Patrick Peck + * @version $Id$ + */ +public class KeyGroup { + + /** The keys belonging to this key group. */ + private Set keyGroupEntries; + /** The key group ID. */ + private String id; + + /** + * Create a KeyGroup. + * + * @param id The ID of this KeyGroup. + * @param keyGroupEntries The keys belonging to this KeyGroup. + */ + public KeyGroup(String id, Set keyGroupEntries) { + this.id = id; + this.keyGroupEntries = keyGroupEntries; + } + + /** + * Return the KeyEntrys contained in this KeyGroup. + * + * @return The KeyEntrys contained in this KeyGroup. + */ + public Set getKeyGroupEntries() { + return keyGroupEntries; + } + + /** + * Return the ID of this KeyGroup. + * + * @return The KeyGroup ID. + */ + public String getId() { + return id; + } + + /** + * Return a String representation of this KeyGroup. + * + * @return The String representation. + * @see java.lang.Object#toString() + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + Iterator i; + + if (getKeyGroupEntries() != null) { + i = getKeyGroupEntries().iterator(); + + while (i.hasNext()) { + sb.append(" " + i.next()); + } + } + return "(KeyGroup - ID:" + id + " " + sb.toString() + ")"; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java new file mode 100644 index 000000000..2e39d6aa3 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java @@ -0,0 +1,106 @@ +package at.gv.egovernment.moa.spss.server.config; + +import java.math.BigInteger; + +/** + * A class containing information about an entry in a key group. + * + * @author Patrick Peck + * @version $Id$ + */ +public class KeyGroupEntry { + /** The module ID of the key. */ + private String moduleID; + /** The issuer DN of the certificate identifying the key. */ + private String issuerDN; + /** The serial number of the certificate identifying the key. */ + private BigInteger serialNumber; + + /** + * Create a new KeyGroupEntry. + * + * @param moduleID The key module ID to which this entry belongs to. + * @param issuerAndSerial The issuer and serial number which uniquely + * identifies a certificate within the key module. + */ + public KeyGroupEntry(String moduleID, IssuerAndSerial issuerAndSerial) { + this.moduleID = moduleID; + this.issuerDN = issuerAndSerial.getIssuerDN(); + this.serialNumber = issuerAndSerial.getSerial(); + } + + /** + * Create a new KeyGroupEntry. + * + * @param moduleID The key module ID to which this entry belongs to. + * @param issuerDN The isser DN of the certificate within the key module. + * @param serialNumber The serial number of the certificate within the key + * module. + */ + public KeyGroupEntry( + String moduleID, + String issuerDN, + BigInteger serialNumber) { + this.moduleID = moduleID; + this.issuerDN = issuerDN; + this.serialNumber = serialNumber; + } + + /** + * Return the key module ID to which this KeyGroupEntry belongs + * to. + * + * @return The key module ID. + */ + public String getModuleID() { + return moduleID; + } + + /** + * Return the issuer DN of this KeyGroupEntry for identifying the + * certificate within the key module. + * + * @return The issuer DN of the certificate. + */ + public String getIssuerDN() { + return issuerDN; + } + + /** + * Return the serial number of this KeyGroupEntry for identifying + * the certificate within the key module. + * + * @return The serial number of the certificate. + */ + public BigInteger getSerialNumber() { + return serialNumber; + } + + /** + * Compare this KeyGroupEntry to another. + * + * @param other The KeyGroupEntry to compare to. + * @return true, if module ID, isser DN and serial number of + * other match the ones contained in this object, otherwise + * false. + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object other) { + if (other instanceof KeyGroupEntry) { + KeyGroupEntry entry = (KeyGroupEntry) other; + return getModuleID().equals(entry.getModuleID()) + && getIssuerDN().equals(entry.getIssuerDN()) + && getSerialNumber().equals(entry.getSerialNumber()); + } + return false; + } + + /** + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return getModuleID().hashCode() + ^ getIssuerDN().hashCode() + ^ getSerialNumber().hashCode(); + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java new file mode 100644 index 000000000..412516d82 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java @@ -0,0 +1,41 @@ +package at.gv.egovernment.moa.spss.server.config; + +/** + * A class that contains information about a key module. + * + * @author Patrick Peck + * @version $Id$ + */ +public class KeyModule { + + /** The key module ID. */ + private String id; + + /** + * Create a Key object. + * + * @param id The key module ID. + */ + public KeyModule(String id) { + this.id = id; + } + + /** + * Return the key ID. + * + * @return The key ID. + */ + public String getId() { + return id; + } + + /** + * Return a String representation of this Key. + * + * @return The String representation. + * @see java.lang.Object#toString() + */ + public String toString() { + return "(Key - Id<" + id + ">)"; + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java new file mode 100644 index 000000000..e4509ac97 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java @@ -0,0 +1,33 @@ +package at.gv.egovernment.moa.spss.server.config; + +import iaik.pki.revocation.RevocationSourceTypes; + +/** + * A class representing a CRL distribution point. + * + * @author Gregor Karlinger + * @version $Id$ + */ +public class OCSPDistributionPoint + extends DistributionPoint + implements iaik.pki.revocation.DistributionPoint +{ + /** + * Create a OCSPDistributionPoint with a URI. + * + * @param uri The URI of the ocsp distribution point. + */ + public OCSPDistributionPoint(String uri) + { + super(uri); + } + + /** + * @see iaik.pki.revocation.DistributionPoint#getType() + */ + public String getType() + { + return RevocationSourceTypes.OCSP; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java new file mode 100644 index 000000000..479e98ca5 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java @@ -0,0 +1,48 @@ +package at.gv.egovernment.moa.spss.server.config; + +/** + * A class containing information about a software key, stored in PKCS12 format. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SoftwareKeyModule extends KeyModule { + /** The name of the file containing the keys. */ + private String fileName; + /** The password for accessing the file. */ + private String passWord; + + /** + * Create a new SoftwareKey. + * + * @param id The key ID. + * @param fileName The name of the PKCS12 keystore file containing the key. + * @param passWord The password to access the keystore file. + */ + public SoftwareKeyModule(String id, String fileName, String passWord) { + super(id); + this.fileName = fileName; + this.passWord = passWord; + } + + /** + * Return the name of the PKCS12 keystore file containing this + * SoftwareKey. + * + * @return The name of the PKCS12 keystore file. + */ + public String getFileName() { + return fileName; + } + + /** + * Return the password to access the keystore file. + * + * @return The password to access the keystore file. + */ + public String getPassWord() { + return passWord; + } + + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java new file mode 100644 index 000000000..929d5ce2b --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java @@ -0,0 +1,58 @@ +package at.gv.egovernment.moa.spss.server.config; + +/** + * Information about a trust profile. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TrustProfile { + /** The ID of the trust profile. */ + private String id; + /** The URI giving the location of the trust profile. */ + private String uri; + /** The URI giving the location of the allowed signer certificates. */ + private String signerCertsUri; + + /** + * Create a TrustProfile. + * + * @param id The ID of the TrustProfile to create. + * @param uri The URI of the TrustProfile to create. + * @param signerCertsUri The URI of the location of the allowed signer + * certificates of the TrustProfile to create. + */ + public TrustProfile(String id, String uri, String signerCertsUri) { + this.id = id; + this.uri = uri; + this.signerCertsUri = signerCertsUri; + } + + /** + * Return the ID of this TrustProfile. + * + * @return The TrustProfile ID. + */ + public String getId() { + return id; + } + + /** + * Return the URI of this TrustProfile. + * + * @return The URI of TrustProfile. + */ + public String getUri() { + return uri; + } + + /** + * Return the URI giving the location of the allowed signer certificates + * of this TrustProfile. + * + * @return The URI of TrustProfile. + */ + public String getSignerCertsUri() { + return signerCertsUri; + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java new file mode 100644 index 000000000..eaee58d3f --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java @@ -0,0 +1,37 @@ +package at.gv.egovernment.moa.spss.server.iaik.cmsverify; + +import iaik.pki.PKIProfile; +import iaik.server.modules.cmsverify.CMSSignatureVerificationProfile; + +/** + * An implementation of the CMSSignatureVerificationProfile + * interface. + * + * @see iaik.server.modules.cmsverify.CMSSignatureVerificationProfile + * @author Patrick Peck + * @version $Id$ + */ +public class CMSSignatureVerificationProfileImpl + implements CMSSignatureVerificationProfile { + + /** The profile for validating the certificate. */ + private PKIProfile certificateValidationProfile; + + /** + * @see iaik.server.modules.cmsverify.CMSSignatureVerificationProfile#getCertificateValidationProfile() + */ + public PKIProfile getCertificateValidationProfile() { + return certificateValidationProfile; + } + + /** + * Sets the profile for validating the signer certificate. + * + * @param certificateValidationProfile The certificate validation profile to + * set. + */ + public void setCertificateValidationProfile(PKIProfile certificateValidationProfile) { + this.certificateValidationProfile = certificateValidationProfile; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java new file mode 100644 index 000000000..713891714 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java @@ -0,0 +1,36 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.server.modules.keys.KeyModuleConfiguration; + +/** + * Base implementation class for the KeyModuleConfiguration + * interface and the interfaces derived from it. + * + * @see iaik.server.modules.keys.KeyModuleConfiguration + * @author Patrick Peck + * @version $Id$ + */ +public abstract class AbstractKeyModuleConfigurationImpl + implements KeyModuleConfiguration { + + /** The module ID. */ + private String moduleID; + + /** + * Creata new AbstractKeyModuleConfigurationImpl. + * + * @param moduleID The key module ID of this + * KeyModuleConfiguration. + */ + public AbstractKeyModuleConfigurationImpl(String moduleID) { + this.moduleID = moduleID; + } + + /** + * @see iaik.server.modules.keys.KeyModuleConfiguration#getModuleID() + */ + public String getModuleID() { + return moduleID; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java new file mode 100644 index 000000000..88d53d6ad --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java @@ -0,0 +1,48 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import iaik.pki.store.observer.NotificationData; +import iaik.pki.store.observer.Observable; +import iaik.pki.store.observer.Observer; + +/** + * A base class for observable configuration data. + * + * @author Patrick Peck + * @version $Id$ + */ +public abstract class AbstractObservableConfiguration implements Observable { + + /** The observers registered with this Observable. */ + private List observers = new ArrayList(); + + /** + * @see iaik.pki.store.observer.Observable#addObserver(iaik.pki.store.observer.Observer) + */ + public void addObserver(Observer observer) { + observers.add(observer); + } + + /** + * @see iaik.pki.store.observer.Observable#removeObserver(iaik.pki.store.observer.Observer) + */ + public boolean removeObserver(Observer observer) { + return observers.remove(observer); + } + + /** + * @see iaik.pki.store.observer.Observable#notify(iaik.pki.store.observer.NotificationData) + */ + public void notify(NotificationData data) { + Iterator iter = observers.iterator(); + + for (iter = observers.iterator(); iter.hasNext();) { + Observer observer = (Observer) iter.next(); + observer.notify(data); + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java new file mode 100644 index 000000000..bf56d437c --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java @@ -0,0 +1,97 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.pki.store.revocation.archive.ArchiveConfiguration; +import iaik.pki.store.revocation.archive.ArchiveParameter; +import iaik.pki.store.revocation.archive.ArchiveTypes; + +import java.sql.Driver; +import java.sql.DriverManager; +import java.util.Enumeration; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; + +/** + * An implementation of the ArchiveConfiguration interface + * using configuration data provided by the MOA configuration file. + * + * @see iaik.pki.store.revocation.archive.ArchiveConfiguration + * @author Patrick Peck + * @version $Id$ + */ +public class ArchiveConfigurationImpl + extends AbstractObservableConfiguration + implements ArchiveConfiguration { + + /** The configuration parameters of the archive. */ + private ArchiveParameter archiveParameters; + + /** + * Create a new ArchiveConfigurationImpl. + * + * @param config The MOA configuration from which the configuration data is being read. + */ + public ArchiveConfigurationImpl(ConfigurationProvider config) + { + String jdbcUrl = config.getRevocationArchiveJDBCURL(); + this.archiveParameters = new DataBaseArchiveParameterImpl(jdbcUrl); + + // Register JDBC driver class + if (jdbcUrl != null) + { + String jdbcDriverClass = config.getRevocationArchiveJDBCDriverClass(); + try + { + Class.forName(jdbcDriverClass); + } + catch (ClassNotFoundException e) + { + // TODO 20030709 GK Improve exception handling + throw new RuntimeException("JDBC driver class \"" + jdbcDriverClass + " could not be found."); + } + + Enumeration regDrivers = DriverManager.getDrivers(); + boolean isRegistered = false; + while (regDrivers.hasMoreElements()) + { + Object currentDriver = regDrivers.nextElement(); + if (jdbcDriverClass.equals(currentDriver.getClass().getName())) isRegistered = true; + } + if (!isRegistered) + { + // Workaround for a driver which does not register itselve at invocation of Class.forName(drvname) + try + { + DriverManager.registerDriver((Driver)Class.forName(jdbcDriverClass).newInstance()); + } + catch (Exception e) + { + // TODO 20030709 GK Improve exception handling + throw new RuntimeException("Registering JDBC driver \"" + jdbcDriverClass + " failed."); + } + } + } + } + + /** + * Return the type of archive. + * + * This will always return ArchiveTypes.DATABASE. + * @return ArchiveTypes.DATABASE. + * @see iaik.pki.store.revocation.archive.ArchiveConfiguration#getType() + */ + public String getType() { + return ArchiveTypes.DATABASE; + } + + /** + * Return the ArchiveParameters describing this + * ArchiveConfiguration. + * + * @return The archive parameters. + * @see iaik.pki.store.revocation.archive.ArchiveConfiguration#getArchiveParameters() + */ + public ArchiveParameter getArchiveParameters() { + return archiveParameters; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java new file mode 100644 index 000000000..71b8680c8 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java @@ -0,0 +1,69 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.logging.TransactionId; +import iaik.pki.revocation.RevocationSourceTypes; +import iaik.pki.store.revocation.RevocationInfoRetriever; +import iaik.pki.store.revocation.RevocationSource; +import iaik.pki.store.revocation.RevocationStoreException; +import iaik.pki.ldap.Handler; + +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLStreamHandler; +import java.util.Collection; +import java.util.Date; + +import at.gv.egovernment.moa.logging.Logger; + +/** + * A customized implementation of {@link iaik.pki.store.revocation.RevocationInfoRetriever}. Will be used + * instead of the default implementation {@link iaik.pki.store.revocation.CRLRetriever} to overcome a + * classloader problem in connection with the {@link java.net.URL} class in a Tomcat deployment environment. + * + * @author Gregor Karlinger + * @version $$ + */ +public class CRLRetriever implements RevocationInfoRetriever +{ + public void update(RevocationSource source, Collection supplementalRequestData, TransactionId tid) + throws RevocationStoreException + { + if (source == null) + { + throw new NullPointerException("RevocationSource parameter mustn't be null."); + } + Logger.info("Downloading crl from " + source.getUri()); + if (!source.getType().equals(RevocationSourceTypes.CRL)) + { + throw new RevocationStoreException( + source.getType() + " not supported", + null, + getClass().getName() + ":1"); + } + try + { + URL crlUrl; + try + { + crlUrl = new URL(source.getUri()); + } + catch (MalformedURLException e) + { + // Workaround for classloader problem with deployment in Tomcat 4.1 + URLStreamHandler handler = new Handler(); + crlUrl = new URL(null, source.getUri(), handler); + } + + InputStream crlInputStream = crlUrl.openStream(); + source.readFrom(crlInputStream, tid); + source.setDownloadTime(new Date()); + crlInputStream.close(); + } + catch (Exception iox) + { + Logger.warn("Cannot retrieve crl", iox); + throw new RevocationStoreException("Cannot retrieve CRL", iox, getClass().getName() + ":1"); + } + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java new file mode 100644 index 000000000..e6e084e11 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java @@ -0,0 +1,50 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.pki.store.certstore.CertStoreConfiguration; +import iaik.pki.store.certstore.CertStoreParameters; +import iaik.pki.store.certstore.directory.DirectoryCertStoreParameters; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; + +/** + * An implementation of the CertStoreConfiguration interface based + * on MOA configuration data. + * + * @see iaik.pki.store.certstore.CertStoreConfiguration + * @author Patrick Peck + * @version $Id$ + */ +public class CertStoreConfigurationImpl + extends AbstractObservableConfiguration + implements CertStoreConfiguration { + + /** The configuration parameters of the CertStore. */ + private CertStoreParameters[] parameters; + + /** + * Create a new CertStoreConfigurationImpl. + * + * @param config The MOA configuration from which the configuration data is + * being read. + */ + public CertStoreConfigurationImpl(ConfigurationProvider config) + { + String certStoreRoot = config.getCertStoreLocation(); + + DirectoryCertStoreParameters dirParameters = new DirectoryCertStoreParametersImpl( + "MOA Directory CertStore", + certStoreRoot, + true, + false); + + parameters = new CertStoreParameters[] { dirParameters }; + } + + /** + * @see iaik.pki.store.certstore.CertStoreConfiguration#getParameters() + */ + public CertStoreParameters[] getParameters() { + return parameters; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java new file mode 100644 index 000000000..7aa4cbe4b --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java @@ -0,0 +1,121 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import iaik.logging.LoggerConfig; +import iaik.pki.PKIConfiguration; +import iaik.server.ConfigurationData; + +import at.gv.egovernment.moa.spss.server.config.HardwareCryptoModule; +import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule; + +/** + * An implementation of the ConfigurationData interface using + * MOA configuration data. + * + * @see iaik.server.ConfigurationData + * @author Patrick Peck + * @version $Id$ + */ +public class ConfigurationDataImpl implements ConfigurationData { + /** PKI configuration data. */ + private PKIConfiguration pkiConfiguration; + /** Crypto modules configuration data. */ + private List cryptoModuleConfigurations; + /** Key modules configuration data. */ + private List keyModuleConfigurations; + /** Logging configuration data. */ + private LoggerConfig loggerConfig; + + /** + * Create a new ConfigurationDataImpl. + * + * @param config The underlying MOA configuration data. + */ + public ConfigurationDataImpl(ConfigurationProvider config) { + this.pkiConfiguration = new PKIConfigurationImpl(config); + this.cryptoModuleConfigurations = buildCryptoModuleConfigurations(config); + this.keyModuleConfigurations = buildKeyModuleConfigurations(config); + this.loggerConfig = new LoggerConfigImpl(); + } + + /** + * Build the list of CryptoModuleConfigurations. + * + * @param config The underlying MOA configuration data. + * @return The list of CryptoModuleConfigurations configured in + * the MOA configuration. + */ + private List buildCryptoModuleConfigurations(ConfigurationProvider config) { + List modules = new ArrayList(); + Iterator iter = config.getHardwareCryptoModules().iterator(); + + while (iter.hasNext()) { + HardwareCryptoModule module = (HardwareCryptoModule) iter.next(); + modules.add(new HardwareCryptoModuleConfigurationImpl(module)); + } + + return modules; + } + + /** + * Build the list of KeyModuleConfigurations. + * + * @param config The underlying MOA configuration data. + * @return The list of KeyModuleConfigurations configured in the + * MOA configuration. + */ + private List buildKeyModuleConfigurations(ConfigurationProvider config) { + List keys = new ArrayList(); + Iterator iter; + + // add the hardware keys + iter = config.getHardwareKeyModules().iterator(); + while (iter.hasNext()) { + HardwareKeyModule key = (HardwareKeyModule) iter.next(); + keys.add(new HardwareKeyModuleConfigurationImpl(key)); + } + + // add the software keys + iter = config.getSoftwareKeyModules().iterator(); + while (iter.hasNext()) { + SoftwareKeyModule key = (SoftwareKeyModule) iter.next(); + keys.add(new SoftwareKeyModuleConfigurationImpl(key)); + } + + return keys; + } + + /** + * @see iaik.server.ConfigurationData#getPKIConfiguration() + */ + public PKIConfiguration getPKIConfiguration() { + return pkiConfiguration; + } + + /** + * @see iaik.server.ConfigurationData#getCryptoModuleConfigurations() + */ + public List getCryptoModuleConfigurations() { + return cryptoModuleConfigurations; + } + + /** + * @see iaik.server.ConfigurationData#getKeyModuleConfigurations() + */ + public List getKeyModuleConfigurations() { + return keyModuleConfigurations; + } + + /** + * @see iaik.server.ConfigurationData#getLoggerConfig() + */ + public LoggerConfig getLoggerConfig() { + return loggerConfig; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java new file mode 100644 index 000000000..d67523944 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java @@ -0,0 +1,33 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter; + +/** + * An implementation of the DataBaseArchiveParameter interface. + * + * @see iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter + * @author Patrick Peck + * @version $Id$ + */ +public class DataBaseArchiveParameterImpl implements DataBaseArchiveParameter { + + /** The JDBC URL for accessing the archive. */ + private String jDBCUrl; + + /** + * Create a new DataBaseArchiveParameterImpl. + * + * @param jDBCUrl The JDBC URL of the archive. + */ + public DataBaseArchiveParameterImpl(String jDBCUrl) { + this.jDBCUrl = jDBCUrl; + } + + /** + * @see iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter#getJDBCUrl() + */ + public String getJDBCUrl() { + return jDBCUrl; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java new file mode 100644 index 000000000..2b00d6766 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java @@ -0,0 +1,81 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.pki.store.certstore.CertStoreTypes; +import iaik.pki.store.certstore.directory.DirectoryCertStoreParameters; + +/** + * An implementation of the DirectoryCertStoreParameters interface. + * + * @see iaik.pki.store.certstore.directory.DirectoryCertStoreParameters + * @author Patrick Peck + * @version $Id$ + */ +public class DirectoryCertStoreParametersImpl + implements DirectoryCertStoreParameters { + + /** The root directory of the CertStore. */ + private String rootDirectory; + /** Whether a new directory may be created. */ + private boolean createNew; + /** The CertStore ID. */ + private String id; + /** Whether the CertStore is read-only. */ + private boolean readOnly; + + /** + * Create a new DirectoryCertStoreParameterImpl. + * + * @param id The CertStore ID. + * @param rootDirectory The root directory of the CertStore. + * @param createNew Whether a new directory may be created. + * @param readOnly Whether the CertStore is read-only. + */ + public DirectoryCertStoreParametersImpl( + String id, + String rootDirectory, + boolean createNew, + boolean readOnly) { + + this.id = id; + this.rootDirectory = rootDirectory; + this.createNew = createNew; + this.readOnly = readOnly; + } + + /** + * @see iaik.pki.store.certstore.directory.DirectoryCertStoreParameters#getRootDirectory() + */ + public String getRootDirectory() { + return rootDirectory; + } + + /** + * @see iaik.pki.store.certstore.directory.DirectoryCertStoreParameters#createNew() + */ + public boolean createNew() { + return createNew; + } + + /** + * @see iaik.pki.store.certstore.CertStoreParameters#getId() + */ + public String getId() { + return id; + } + + /** + * @see iaik.pki.store.certstore.CertStoreParameters#isReadOnly() + */ + public boolean isReadOnly() { + return readOnly; + } + + /** + * @return CertStoreTypes.DIRECTORY + * @see iaik.pki.store.certstore.CertStoreParameters#getType() + */ + public String getType() { + return CertStoreTypes.DIRECTORY; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java new file mode 100644 index 000000000..3c8f4c002 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java @@ -0,0 +1,51 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.server.modules.crypto.HardwareCryptoModuleConfiguration; + +import at.gv.egovernment.moa.spss.server.config.HardwareCryptoModule; + +/** + * An implementation of the HardwareCryptoModuleConfiguration + * wrapping a HardwareCryptoModule from the MOA configuration. + * + * @author Patrick Peck + * @version $Id$ + */ +public class HardwareCryptoModuleConfigurationImpl + implements HardwareCryptoModuleConfiguration { + + /** The wrapped HardwareCryptoModule. */ + private HardwareCryptoModule module; + + /** + * Create a new HardwareCryptoModuleConfigurationImpl. + * + * @param module The HardwareCryptoModule from the underlying MOA + * configuration. + */ + public HardwareCryptoModuleConfigurationImpl(HardwareCryptoModule module) { + this.module = module; + } + + /** + * @see iaik.server.modules.crypto.HardwareCryptoModuleConfiguration#getModuleName() + */ + public String getModuleName() { + return module.getName(); + } + + /** + * @see iaik.server.modules.crypto.HardwareCryptoModuleConfiguration#getSlotID() + */ + public String getSlotID() { + return module.getSlotID(); + } + + /** + * @see iaik.server.modules.crypto.HardwareCryptoModuleConfiguration#getUserPIN() + */ + public char[] getUserPIN() { + return module.getUserPIN().toCharArray(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java new file mode 100644 index 000000000..d905588c6 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java @@ -0,0 +1,55 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.server.modules.keys.HardwareKeyModuleConfiguration; + +import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule; + +/** + * An implementation of the HardwareKeyModuleConfiguration + * interface wrapping a HardwareKeyModule from the MOA + * configuration. + * + * @see iaik.server.modules.keys.HardwareKeyModuleConfiguration + * @author Patrick Peck + * @version $Id$ + */ +public class HardwareKeyModuleConfigurationImpl + extends AbstractKeyModuleConfigurationImpl + implements HardwareKeyModuleConfiguration { + + /** The wrapped HardwareKeyModule. */ + private HardwareKeyModule keyModule; + + /** + * Create a new HardwareKeyModuleConfigurationImpl. + * + * @param keyModule The HardwareKeyModule from the underlying + * MOA configuration. + */ + public HardwareKeyModuleConfigurationImpl(HardwareKeyModule keyModule) { + super(keyModule.getId()); + this.keyModule = keyModule; + } + + /** + * @see iaik.server.modules.keys.HardwareKeyModuleConfiguration#getModuleName() + */ + public String getModuleName() { + return keyModule.getName(); + } + + /** + * @see iaik.server.modules.keys.HardwareKeyModuleConfiguration#getSlotID() + */ + public String getSlotID() { + return keyModule.getSlotID(); + } + + /** + * @see iaik.server.modules.keys.HardwareKeyModuleConfiguration#getUserPIN() + */ + public char[] getUserPIN() { + return keyModule.getUserPIN().toCharArray(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java new file mode 100644 index 000000000..2508b7946 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java @@ -0,0 +1,173 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import iaik.pki.revocation.RevocationSourceTypes; +import iaik.pki.store.revocation.RevocationFactory; +import iaik.pki.store.revocation.RevocationSourceStore; +import iaik.pki.store.truststore.TrustStoreFactory; +import iaik.server.ConfigurationData; +import iaik.server.Configurator; +import iaik.server.modules.keys.KeyEntryID; +import iaik.server.modules.keys.KeyModule; +import iaik.server.modules.keys.KeyModuleFactory; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; + +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.config.KeyGroup; +import at.gv.egovernment.moa.spss.server.config.KeyGroupEntry; +import at.gv.egovernment.moa.spss.server.logging.TransactionId; +import at.gv.egovernment.moa.spss.util.MessageProvider; + +/** + * A class responsible for configuring the IAIK MOA modules. + * + * @author Patrick Peck + * @version $Id$ + */ +public class IaikConfigurator { + + /** The warnings encountered during configuration. */ + private List warnings = new ArrayList(); + + /** + * Configure the IAIK MOA subsystem. + * + * + * @param moaConfig The underlying MOA configuration. + * @throws ConfigurationException An error occurred configuring the IAIK + * MOA subsystem. + */ + public void configure(ConfigurationProvider moaConfig) + throws ConfigurationException { + ConfigurationData configData = new ConfigurationDataImpl(moaConfig); + + warnings = new ArrayList(); + + try { + TransactionId transId = new TransactionId("IaikConfigurator"); + Configurator.init(configData, transId); + + // Set customized CRL retriever to overcome a classloader problem when MOA is deployed in Tomcat + RevocationSourceStore rss = RevocationFactory.getInstance(transId).getRevocationSourceStore(); + rss.setRetriever(new CRLRetriever(), RevocationSourceTypes.CRL); + if ((moaConfig.getSoftwareKeyModules().size() > 0) || (moaConfig.getHardwareKeyModules().size() > 0)) { + dumpKeyEntryIDs(); + } + checkKeyGroupConfig(moaConfig); + TrustStoreFactory.reset(); + } catch (iaik.server.ConfigurationException e) { + throw new ConfigurationException("config.08", null, e); + } catch (Throwable t) { + throw new ConfigurationException("config.08", null, t); + } + } + + /** + * Return the warnings encountered during configuration. + * + * @return The warnings. + */ + public List getWarnings() { + return warnings; + } + + /** + * Dump all KeyEntryIDs contained in the configured + * KeyModules to the log file. + */ + private void dumpKeyEntryIDs() { + MessageProvider msg = MessageProvider.getInstance(); + KeyModule module = KeyModuleFactory.getInstance(new TransactionId("dump")); + Set keyEntryIds = module.getPrivateKeyEntryIDs(); + Iterator iter; + + for (iter = keyEntryIds.iterator(); iter.hasNext();) { + KeyEntryID keyEntryId = (KeyEntryID) iter.next(); + Logger.info( + new LogMsg(msg.getMessage("config.19", new Object[] { keyEntryId }))); + } + } + + /** + * Check that each key group entry in each key group can be resolved to a + * KeyEntryID. + * + * Logs a warning for each key group entry that cannot be resolved. + * + * @param moaConfig The MOA configuration to check. + */ + private void checkKeyGroupConfig(ConfigurationProvider moaConfig) { + Map keyGroups = moaConfig.getKeyGroups(); + Iterator iter; + + for (iter = keyGroups.values().iterator(); iter.hasNext();) { + KeyGroup keyGroup = (KeyGroup) iter.next(); + Set keyGroupEntries = keyGroup.getKeyGroupEntries(); + Iterator kgIter; + + for (kgIter = keyGroupEntries.iterator(); kgIter.hasNext();) { + KeyGroupEntry entry = (KeyGroupEntry) kgIter.next(); + + if (!findKeyEntryID(entry)) { + warn( + "config.31", + new Object[] { + keyGroup.getId(), + entry.getModuleID(), + entry.getIssuerDN(), + entry.getSerialNumber()}); + } + } + } + } + + /** + * Find out that a certain KeyGroupEntry could be resolved to a KeyEntryID + * by the Configurator. + * + * @param keyGroupEntry The key group entry to find. + * @return true, if the keyGroupEntry could be + * resolved to a KeyEntryID; otherwise false. + */ + private boolean findKeyEntryID(KeyGroupEntry keyGroupEntry) { + KeyModule module = KeyModuleFactory.getInstance(new TransactionId("check")); + Set keyEntryIDs = module.getPrivateKeyEntryIDs(); + Iterator iter; + + for (iter = keyEntryIDs.iterator(); iter.hasNext();) { + KeyEntryID entry = (KeyEntryID) iter.next(); + + if (entry.getCertificateIssuer().equals(keyGroupEntry.getIssuerDN()) + && entry.getCertificateSerialNumber().equals( + keyGroupEntry.getSerialNumber()) + && entry.getModuleID().equals(keyGroupEntry.getModuleID())) { + return true; + } + } + + return false; + } + + /** + * Log a warning. + * + * @param messageId The message ID. + * @param args Additional parameters for the message. + * @see at.gv.egovernment.moa.spss.server.util.MessageProvider + */ + private void warn(String messageId, Object[] args) { + MessageProvider msg = MessageProvider.getInstance(); + String txt = msg.getMessage(messageId, args); + + Logger.warn(new LogMsg(txt)); + warnings.add(txt); + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java new file mode 100644 index 000000000..9679e8d18 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java @@ -0,0 +1,34 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import java.util.Properties; + +import iaik.logging.LogConfigurationException; +import iaik.logging.LoggerConfig; + +import at.gv.egovernment.moa.logging.LoggingContextManager; + +/** + * Default implementation of the LoggerConfig interface. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LoggerConfigImpl implements LoggerConfig { + + /** The implementation of iaik.logging.LogFactory. */ + private static final String DEFAULT_IMPLEMENTATION = + "at.gv.egovernment.moa.spss.server.logging.IaikLogFactory"; + + public String getFactory() { + return DEFAULT_IMPLEMENTATION; + } + + public Properties getProperties() throws LogConfigurationException { + return new Properties(); + } + + public String getNodeId() { + return LoggingContextManager.getInstance().getLoggingContext().getNodeID(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java new file mode 100644 index 000000000..1c42cc4af --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java @@ -0,0 +1,80 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.pki.PKIConfiguration; +import iaik.pki.pathvalidation.ValidationConfiguration; +import iaik.pki.revocation.RevocationConfiguration; +import iaik.pki.store.certstore.CertStoreConfiguration; +import iaik.pki.store.revocation.archive.ArchiveConfiguration; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; + +/** + * An implementation of the PKIConfiguration interface using data + * from the MOA configuration. + * + * @see iaik.pki.PKIConfiguration + * @author Patrick Peck + * @version $Id$ + */ +public class PKIConfigurationImpl implements PKIConfiguration { + /** The CertStore configuration. */ + private CertStoreConfiguration certStoreConfiguration; + /** The revocation checking configuration. */ + private RevocationConfiguration revocationConfiguration; + /** The revocation archive configuration. */ + private ArchiveConfiguration archiveConfiguration; + /** The certificate validation configuration. */ + private ValidationConfiguration validationConfiguration; + + /** + * Create a new PKIConfigurationImpl. + * + * @param config The underlying MOA configuration which will be used to build + * the configuration data contained in this object. + */ + public PKIConfigurationImpl(ConfigurationProvider config) { + + this.certStoreConfiguration = new CertStoreConfigurationImpl(config); + this.revocationConfiguration = new RevocationConfigurationImpl(config); + + boolean archiveInfo = config.getEnableRevocationArchiving(); + if (archiveInfo) + { + this.archiveConfiguration = new ArchiveConfigurationImpl(config); + } + else + { + this.archiveConfiguration = null; + } + + this.validationConfiguration = new ValidationConfigurationImpl(config); + } + + /** + * @see iaik.pki.PKIConfiguration#getCertStoreConfiguration() + */ + public CertStoreConfiguration getCertStoreConfiguration() { + return certStoreConfiguration; + } + + /** + * @see iaik.pki.PKIConfiguration#getRevocationConfiguration() + */ + public RevocationConfiguration getRevocationConfiguration() { + return revocationConfiguration; + } + + /** + * @see iaik.pki.PKIConfiguration#getArchiveConfiguration() + */ + public ArchiveConfiguration getArchiveConfiguration() { + return archiveConfiguration; + } + + /** + * @see iaik.pki.PKIConfiguration#getValidationConfiguration() + */ + public ValidationConfiguration getValidationConfiguration() { + return validationConfiguration; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java new file mode 100644 index 000000000..bccb04a09 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java @@ -0,0 +1,53 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import iaik.pki.revocation.RevocationConfiguration; + +import java.security.cert.X509Certificate; +import java.util.Date; +import java.util.Set; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; + +/** + * An implementation of the RevocationConfiguration interface using + * MOA configuration data. + * + * @see iaik.pki.revocation.RevocationConfiguration + * @author Patrick Peck + * @version $Id$ + */ +public class RevocationConfigurationImpl + extends AbstractObservableConfiguration + implements RevocationConfiguration { + + /** The ConfigurationProvider to read the configuration data + * from. */ + private ConfigurationProvider config; + + /** + * Create a new RevocationConfigurationImpl. + * + * @param config The underlying MOA configuration containing the configuration + * data. + */ + public RevocationConfigurationImpl(ConfigurationProvider config) { + this.config = config; + } + + /** + * @see iaik.pki.revocation.RevocationConfiguration#getAlternativeDistributionPoints + */ + public Set getAlternativeDistributionPoints(X509Certificate cert, X509Certificate issuer, Date date) + { + return config.getDistributionPoints(cert); + } + + /** + * @see iaik.pki.revocation.RevocationConfiguration#archiveRevocationInfo(java.lang.String, java.lang.String) + */ + public boolean archiveRevocationInfo(String type, String uri) + { + return config.getEnableRevocationArchiving(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java new file mode 100644 index 000000000..343f096ef --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java @@ -0,0 +1,75 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; + +import iaik.server.modules.keys.ConfigurationException; +import iaik.server.modules.keys.SoftwareKeyModuleConfiguration; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; + +import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule; +import at.gv.egovernment.moa.spss.util.MessageProvider; + +/** + * An implementation of the SoftwareKeyModuleConfiguration wrapping + * a SoftwareKeyModule from the MOA configuration. + * + * @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration + * @author Patrick Peck + * @version $Id$ + */ +public class SoftwareKeyModuleConfigurationImpl + extends AbstractKeyModuleConfigurationImpl + implements SoftwareKeyModuleConfiguration { + + /** The wrapped SoftwareKeyModule. */ + private SoftwareKeyModule keyModule; + + /** + * Create a new SoftwareKeyModuleConfigurationImpl. + * + * @param keyModule The SoftwareKeyModule from the underlying MOA + * configuration. + */ + public SoftwareKeyModuleConfigurationImpl(SoftwareKeyModule keyModule) { + super(keyModule.getId()); + this.keyModule = keyModule; + } + + /** + * @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration#getKeyStoreTypeName() + */ + public String getKeyStoreTypeName() { + return KEY_STORE_TYPE_NAME_PKCS12; + } + + /** + * @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration#getKeyStoreAsStream() + */ + public InputStream getKeyStoreAsStream() { + MessageProvider msg = MessageProvider.getInstance(); + + try { + String message = + msg.getMessage("config.18", new Object[] { keyModule.getFileName()}); + Logger.info(new LogMsg(message)); + return new FileInputStream(keyModule.getFileName()); + } catch (FileNotFoundException e) { + String message = + msg.getMessage("config.09", new Object[] { keyModule.getFileName()}); + + throw new ConfigurationException(message, e, null); + } + } + + /** + * @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration#getKeyStoreAuthenticationData() + */ + public char[] getKeyStoreAuthenticationData() { + return keyModule.getPassWord().toCharArray(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java new file mode 100644 index 000000000..f6fbad215 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java @@ -0,0 +1,56 @@ +package at.gv.egovernment.moa.spss.server.iaik.config; + +import java.security.cert.X509Certificate; +import java.security.spec.AlgorithmParameterSpec; + +import iaik.pki.pathvalidation.ValidationConfiguration; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; + +/** + * An implementation of the ValidationConfiguration interface using + * MOA configuration data. + * + * @see iaik.pki.pathvalidation.ValidationConfiguration + * @author Patrick Peck + * @version $Id$ + */ +public class ValidationConfigurationImpl + extends AbstractObservableConfiguration + implements ValidationConfiguration { + + /** The ConfigurationProvider to read the configuration data + * from. */ + private ConfigurationProvider config; + + /** + * Create a new ValidationConfigurationImpl. + * + * @param config The underlying MOA configuration data. + */ + public ValidationConfigurationImpl(ConfigurationProvider config) { + this.config = config; + } + + /** + * @see iaik.pki.pathvalidation.ValidationConfiguration#getChainingMode(java.security.cert.X509Certificate) + */ + public String getChainingMode(X509Certificate cert) { + return config.getChainingMode(cert); + } + + /** + * @see iaik.pki.pathvalidation.ValidationConfiguration#getPublicKeyParamsAsSpec(java.security.cert.X509Certificate) + */ + public AlgorithmParameterSpec getPublicKeyParamsAsSpec(X509Certificate cert) { + return null; + } + + /** + * @see iaik.pki.pathvalidation.ValidationConfiguration#getPublicKeyParamsAsCert(java.security.cert.X509Certificate) + */ + public X509Certificate getPublicKeyParamsAsCert(X509Certificate cert) { + return null; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java new file mode 100644 index 000000000..76f03ae07 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java @@ -0,0 +1,116 @@ +package at.gv.egovernment.moa.spss.server.iaik.pki; + +import iaik.pki.PKIProfile; +import iaik.pki.pathvalidation.ValidationProfile; +import iaik.pki.revocation.RevocationProfile; +import iaik.pki.store.truststore.TrustStoreProfile; +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.iaik.pki.pathvalidation.ValidationProfileImpl; +import at.gv.egovernment.moa.spss.server.iaik.pki.revocation.RevocationProfileImpl; +import at.gv.egovernment.moa.spss.server.iaik.pki.store.truststore.TrustStoreProfileImpl; + +/** + * Implementation of the PKIProfile interface containing + * information needed for certificate path validation. It uses configuration + * data from the MOA configuration. + * + * @author Patrick Peck + * @version $Id$ + */ +public class PKIProfileImpl implements PKIProfile { + + /** Profile information for revocation checking. */ + private RevocationProfile revocationProfile; + /** Profile information about the trust profile to use. */ + private TrustStoreProfile trustStoreProfile; + /** Profile information about the certificate validation. */ + private ValidationProfile validationProfile; + /** The ConfigurationProvider to read the MOA configuration data + * from. */ + private ConfigurationProvider config; + + /** + * Create a new PKIProfileImpl. + * + * @param config The MOA configuration providing configuration data about + * certificate path validation. + * @param trustProfileID The trust profile ID denoting the location of the + * trust store. + * @throws MOAApplicationException An error occurred building the profile. + */ + public PKIProfileImpl(ConfigurationProvider config, String trustProfileID) + throws MOAApplicationException { + + this.config = config; + setRevocationProfile(new RevocationProfileImpl(config)); + setTrustStoreProfile(new TrustStoreProfileImpl(config, trustProfileID)); + setValidationProfile(new ValidationProfileImpl(config)); + } + + /** + * @see iaik.pki.PKIProfile#autoAddCertificates() + */ + public boolean autoAddCertificates() + { + return useAuthorityInfoAccess() ? true : config.getAutoAddCertificates(); + } + + /** + * @see iaik.pki.PKIProfile#getRevocationProfile() + */ + public RevocationProfile getRevocationProfile() { + return revocationProfile; + } + + /** + * Sets the RevocationProfile. + * + * @param revocationProfile The RevocationProfile used for + * revocation checking. + */ + protected void setRevocationProfile(RevocationProfile revocationProfile) { + this.revocationProfile = revocationProfile; + } + + /** + * @see iaik.pki.PKIProfile#getTrustStoreProfile() + */ + public TrustStoreProfile getTrustStoreProfile() { + return trustStoreProfile; + } + + /** + * Sets the TrustStoreProfile. + * + * @param trustStoreProfile The TrustStoreProfile. + */ + protected void setTrustStoreProfile(TrustStoreProfile trustStoreProfile) { + this.trustStoreProfile = trustStoreProfile; + } + + /** + * @see iaik.pki.PKIProfile#getValidationProfile() + */ + public ValidationProfile getValidationProfile() { + return validationProfile; + } + + /** + * Sets the ValidationProfile. + * + * @param validationProfile The ValidationProfile to set. + */ + protected void setValidationProfile(ValidationProfile validationProfile) { + this.validationProfile = validationProfile; + } + + /** + * @see iaik.pki.PKIProfile#useAuthorityInfoAccess() + */ + public boolean useAuthorityInfoAccess() + { + return config.getUseAuthorityInfoAccess(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java new file mode 100644 index 000000000..a4d7ea7fa --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java @@ -0,0 +1,107 @@ +package at.gv.egovernment.moa.spss.server.iaik.pki.pathvalidation; + +import iaik.pki.pathvalidation.ValidationProfile; + +import java.util.Collections; +import java.util.Set; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; + +/** + * An implementation of the ValidationProfile interface providing + * information about certificat path validation. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ValidationProfileImpl implements ValidationProfile { + + /** The ConfigurationProvider to read the configuration data + * from. */ + private ConfigurationProvider config; + private boolean initialAnyPolicyInhibit; + private boolean initialExplicitPolicy; + private boolean initialPolicyMappingInhibit; + private Set initialPolicySet; + private boolean nameConstraintsProcessing; + private boolean policyProcessing; + + /** + * Create a new ValidationProfileImpl object. + * + * This objects's fields are preset to the following values: + * + *
    + *
  • initialAnyPolicyInhibit = true
  • + *
  • initialExplicitPoliy = true
  • + *
  • initialPolicyMappingInhibit = true
  • + *
  • initialPolicySet = empty
  • + *
  • policyProcessing = false
  • + *
  • nameConstraintsProcessing = false
  • + *
  • revocationChecking = false
  • + *
+ * + * @param config MOA configuration data for additional configuration + * information (currently unused). + */ + public ValidationProfileImpl(ConfigurationProvider config) { + this.config = config; + initialAnyPolicyInhibit = true; + initialExplicitPolicy = true; + initialPolicyMappingInhibit = true; + initialPolicySet = Collections.EMPTY_SET; + policyProcessing = false; + nameConstraintsProcessing = false; + } + + /** + * @see iaik.pki.pathvalidation.ValidationProfile#getInitialAnyPolicyInhibit() + */ + public boolean getInitialAnyPolicyInhibit() { + return initialAnyPolicyInhibit; + } + + /** + * @see iaik.pki.pathvalidation.ValidationProfile#getInitialExplicitPolicy() + */ + public boolean getInitialExplicitPolicy() { + return initialExplicitPolicy; + } + + /** + * @see iaik.pki.pathvalidation.ValidationProfile#getInitialPolicyMappingInhibit() + */ + public boolean getInitialPolicyMappingInhibit() { + return initialPolicyMappingInhibit; + } + + /** + * @see iaik.pki.pathvalidation.ValidationProfile#getInitialPolicySet() + */ + public Set getInitialPolicySet() { + return initialPolicySet; + } + + /** + * @see iaik.pki.pathvalidation.ValidationProfile#getPolicyProcessing() + */ + public boolean getPolicyProcessing() { + return policyProcessing; + } + + /** + * @see iaik.pki.pathvalidation.ValidationProfile#getNameConstraintsProcessing() + */ + public boolean getNameConstraintsProcessing() { + return nameConstraintsProcessing; + } + + /** + * @see iaik.pki.pathvalidation.ValidationProfile#getRevocationChecking() + */ + public boolean getRevocationChecking() + { + return config.getEnableRevocationChecking(); + } + +} \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java new file mode 100644 index 000000000..c8809b0d8 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java @@ -0,0 +1,64 @@ +package at.gv.egovernment.moa.spss.server.iaik.pki.revocation; + +import java.security.cert.X509Certificate; + +import iaik.pki.revocation.RevocationProfile; +import iaik.pki.revocation.RevocationSourceTypes; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; + +/** + * An implementation of the RevocationProfile interface providing + * information about revocation status checking, based on MOA configuration + * data. + * + * @author Patrick Peck + * @version $Id$ + */ +public class RevocationProfileImpl implements RevocationProfile { + /** The default service order. */ + private static final String[] DEFAULT_SERVICE_ORDER = + { RevocationSourceTypes.CRL, RevocationSourceTypes.OCSP }; + /** The ConfigurationProvider to read the MOA configuration data + * from. */ + private ConfigurationProvider config; + /** The OCSP request hash algorithm. Currently only "SHA" is supported. */ + private static final String oCSPRequestHashAlgorithm = "SHA"; + + /** + * Create a new RevocationProfileImpl. + * + * @param config The MOA configuration data. + */ + public RevocationProfileImpl(ConfigurationProvider config) { + this.config = config; + // currently only "SHA" is supported +// this.oCSPRequestHashAlgorithm = ""; + } + + /** + * @see iaik.pki.revocation.RevocationProfile#getMaxRevocationAge(String) + */ + public long getMaxRevocationAge(String distributionPointUri) + { + return config.getMaxRevocationAge(); + } + + /** + * @see iaik.pki.revocation.RevocationProfile#getOCSPRequestHashAlgorithm() + */ + public String getOCSPRequestHashAlgorithm() { + return oCSPRequestHashAlgorithm; + } + + /** + * @see iaik.pki.revocation.RevocationProfile#getPreferredServiceOrder(java.security.cert.X509Certificate) + */ + public String[] getPreferredServiceOrder(X509Certificate cert) + { + String[] serviceOrder = config.getServiceOrder(); + if (serviceOrder == null || serviceOrder.length == 0) return DEFAULT_SERVICE_ORDER; + return serviceOrder; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java new file mode 100644 index 000000000..c49f7fe8c --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java @@ -0,0 +1,135 @@ +package at.gv.egovernment.moa.spss.server.iaik.pki.store.truststore; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import iaik.pki.store.truststore.TrustStoreProfile; +import iaik.pki.store.truststore.TrustStoreTypes; +import iaik.pki.store.observer.NotificationData; +import iaik.pki.store.observer.Observer; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.config.TrustProfile; + +/** + * An implementation of the TrustStoreProfile interface, using data + * from the MOA configuration. + * + * @see iaik.pki.store.truststore.TrustStoreProfile + * @author Patrick Peck + * @version $Id$ + */ +public class TrustStoreProfileImpl implements TrustStoreProfile { + + /** The observers of this profile. */ + private List observers = new ArrayList(); + + /** + * The trust profile identifier. + */ + private String id_; + + /** The type of the trust profile. */ + private String type; + /** The URI of the trust profile.*/ + private String URI; + + /** + * Create a new TrustStoreProfileImpl. + * + * @param config The MOA configuration data, from which trust store + * configuration data is read. + * @param trustProfileId The trust profile id on which this + * TrustStoreProfile is based. + * @throws MOAApplicationException The trustProfileId could not + * be found in the MOA configuration. + */ + public TrustStoreProfileImpl( + ConfigurationProvider config, + String trustProfileId) + throws MOAApplicationException { + + TrustProfile tp = (TrustProfile) config.getTrustProfile(trustProfileId); + if (tp != null) + { + id_ = trustProfileId; + setURI(tp.getUri()); + setType(TrustStoreTypes.DIRECTORY); + } + else + { + throw new MOAApplicationException("2203", new Object[] { trustProfileId }); + } + } + + /** + * @see iaik.pki.store.truststore.TrustStoreProfile#getType() + */ + public String getType() { + return type; + } + + /** + * Sets the the trust store type. + * + * @param type The trust store type to set. + */ + protected void setType(String type) { + this.type = type; + } + + /** + * @see iaik.pki.store.truststore.TrustStoreProfile#getURI() + */ + public String getURI() { + return URI; + } + + /** + * Sets the trust store URI. + * + * @param URI The trust store URI to set. + */ + protected void setURI(String URI) { + this.URI = URI; + } + + // + // Methods of iaik.pki.store.observer.Observable interface + // + + /** + * @see iaik.pki.store.observer.Observable#addObserver(iaik.pki.store.observer.Observer) + */ + public void addObserver(Observer observer) { + observers.add(observer); + } + + /** + * @see iaik.pki.store.observer.Observable#removeObserver(iaik.pki.store.observer.Observer) + */ + public boolean removeObserver(Observer observer) { + return observers.remove(observer); + } + + /** + * @see iaik.pki.store.observer.Observable#notify(iaik.pki.store.observer.NotificationData) + */ + public void notify(NotificationData notificationData) { + for (Iterator iter = observers.iterator(); iter.hasNext();) { + Observer observer = (Observer) iter.next(); + observer.notify(notificationData); + } + } + + /** + * @see iaik.pki.store.truststore.TrustStoreProfile#getId() + */ + public String getId() + { + return id_; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java new file mode 100644 index 000000000..e076fe1eb --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java @@ -0,0 +1,43 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import iaik.server.modules.xml.Base64Transformation; + +/** + * An implementation of the Base64Transformation + * Transformation type. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Base64TransformationImpl + extends TransformationImpl + implements Base64Transformation { + + /** + * Create a new Base64TransformationImpl. + * + * @see java.lang.Object#Object() + */ + public Base64TransformationImpl() { + setAlgorithmURI(Base64Transformation.BASE64_DECODING); + } + + /** + * Compare this Base64Transformation to another. + * + * @param other The object to compare thisBase64Transformation + * to. + * @return true, if other is a + * Base64Transformation and the algorithm URIs match, otherwise + * false. + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object other) { + if (other instanceof Base64Transformation) { + Base64Transformation transform = (Base64Transformation) other; + return getAlgorithmURI().equals(transform.getAlgorithmURI()); + } + return false; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java new file mode 100644 index 000000000..921b10cb6 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java @@ -0,0 +1,54 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import iaik.server.modules.xml.BinaryDataObject; + +/** + * A BinaryDataObject encapsulating Base64 data. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ByteArrayDataObjectImpl + extends DataObjectImpl + implements BinaryDataObject { + + /** The binary data contained in this BinaryDataObject. */ + private byte[] bytes; + + /** + * Create a new ByteArrayDataObjectImpl. + * + * @param bytes The binary data contained in this + * BinaryDataObject. + */ + public ByteArrayDataObjectImpl(byte[] bytes) { + setBytes(bytes); + } + + /** + * Set the Base64 data. + * + * @param bytes The binary data contained in this + * BinaryDataObject. + */ + public void setBytes(byte[] bytes) { + this.bytes = bytes; + } + + /** + * Return the binary data encoded in the Base64 String as a + * stream. + * + * @return The binary data contained in this object, as a + * InputStream. Repeated calls to this function will return a + * new stream to the Base64 data. + * @see iaik.server.modules.xml.BinaryDataObject#getInputStream() + */ + public InputStream getInputStream() { + return new ByteArrayInputStream(bytes); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java new file mode 100644 index 000000000..ce400e61a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java @@ -0,0 +1,49 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import java.io.InputStream; + +import iaik.server.modules.xml.BinaryDataObject; + +/** + * A BinaryDataObject encapsulating binary data from a stream. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ByteStreamDataObjectImpl + extends DataObjectImpl + implements BinaryDataObject { + + /** The InputStream containing the binary data. */ + private InputStream inputStream; + + /** + * Create a new ByteStreamDataObjectImpl. + * + * @param inputStream The stream from which to read the binary data. + */ + public ByteStreamDataObjectImpl(InputStream inputStream) { + setInputStream(inputStream); + } + + /** + * Set the input stream from which to read the binary data. + * + * @param inputStream The input stream from which to read the binary data. + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } + + /** + * Return the binary data from this object as a stream. + * + * @return The stream containing the binary data. Calling this function + * repeatedly will always return the same InputStream. + * @see iaik.server.modules.xml.BinaryDataObject#getInputStream() + */ + public InputStream getInputStream() { + return inputStream; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java new file mode 100644 index 000000000..a597b214d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java @@ -0,0 +1,43 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import iaik.server.modules.xml.Canonicalization; + +/** + * An implementation of the CanonicalizationTransform + * Transformation type. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CanonicalizationImpl + extends TransformationImpl + implements Canonicalization { + + /** + * Create a new CanonicalizationTransformImpl object. + * + * @param algorithmURI The canonicalization algorithm URI. + */ + public CanonicalizationImpl(String algorithmURI) { + setAlgorithmURI(algorithmURI); + } + + /** + * Compare this object to another Canonicalization. + * + * @param other The object to compare this + * Canonicalization to. + * @return true, if other is a + * Canonicalization and the algorithm URIs match, otherwise + * false. + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object other) { + if (other instanceof Canonicalization) { + Canonicalization c14n = (Canonicalization) other; + return getAlgorithmURI().equals(c14n.getAlgorithmURI()); + } + return false; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java new file mode 100644 index 000000000..875d82613 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java @@ -0,0 +1,87 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import iaik.server.modules.xml.DataObject; + +/** + * Abstract base implementation for the classes derived from + * DataObject. + * + * @author Patrick Peck + * @version $Id$ + */ +public abstract class DataObjectImpl implements DataObject { + + /** The MIME type of the data object. */ + private String mimeType; + /** The refernce ID. */ + private String referenceID; + /** The URI of the type. */ + private String typeURI; + /** The URI identifying the data. */ + private String URI; + + /** + * @see iaik.server.modules.xml.DataObject#getMimeType() + */ + public String getMimeType() { + return mimeType; + } + + /** + * Set the mime type. + * + * @param mimeType The mime type to set. + */ + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + /** + * @see iaik.server.modules.xml.DataObject#getReferenceID() + */ + public String getReferenceID() { + return referenceID; + } + + /** + * Set the reference ID. + * + * @param referenceID The reference ID. + */ + public void setReferenceID(String referenceID) { + this.referenceID = referenceID; + } + + /** + * @see iaik.server.modules.xml.DataObject#getTypeURI() + */ + public String getTypeURI() { + return typeURI; + } + + /** + * Set the type URI. + * + * @param typeURI The type URI. + */ + public void setTypeURI(String typeURI) { + this.typeURI = typeURI; + } + + /** + * @see iaik.server.modules.xml.DataObject#getURI() + */ + public String getURI() { + return URI; + } + + /** + * Set the URI. + * + * @param URI The URI. + */ + public void setURI(String URI) { + this.URI = URI; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java new file mode 100644 index 000000000..41a47d0a1 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java @@ -0,0 +1,42 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import iaik.server.modules.xml.EnvelopedSignatureTransformation; + +/** + * An implementation of the EnvelopedSignatureTransformation + * Transformation type. + * + * @author Patrick Peck + * @version $Id$ + */ +public class EnvelopedSignatureTransformationImpl + extends TransformationImpl + implements EnvelopedSignatureTransformation { + + /** + * Create a new EnvelopedSignatureTransformationImpl. + */ + public EnvelopedSignatureTransformationImpl() { + setAlgorithmURI(EnvelopedSignatureTransformation.ENVELOPED_SIGNATURE); + } + + /** + * Compare this object to another EnvelopedSignatureTransformation. + * + * @param other The object to compare this + * EnvelopedSignatureTransformation to. + * @return true, if other is a + * EnvelopedSignatureTransformation, otherwise + * false. + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object other) { + if (other instanceof EnvelopedSignatureTransformation) { + EnvelopedSignatureTransformation transform = + (EnvelopedSignatureTransformation) other; + return getAlgorithmURI().equals(transform.getAlgorithmURI()); + } + return false; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java new file mode 100644 index 000000000..b38fbe128 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java @@ -0,0 +1,76 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import java.util.List; + +import iaik.server.modules.xml.ExclusiveCanonicalization; + +/** + * An implementation of the ExclusiveCanonicalization type + * of Transformation. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ExclusiveCanonicalizationImpl + extends TransformationImpl + implements ExclusiveCanonicalization { + + /** The prefixes of the namespaces to treat according to canonical XML. */ + private List inclusiveNamespacePrefixes; + + /** + * Create a new ExclusiveCanonicalizationImpl object. + * + * @param algorithmURI The exclusive canonicalization algorithm URI. + * @param inclusiveNamespacePrefixes The namespace prefixes to be processed + * according to canonical XML. + */ + public ExclusiveCanonicalizationImpl( + String algorithmURI, + List inclusiveNamespacePrefixes) { + setAlgorithmURI(algorithmURI); + setInclusiveNamespacePrefixes(inclusiveNamespacePrefixes); + } + + /** + * Sets the namespace prefixes to be processed according to canonical XML. + * + * @param inclusiveNamespacePrefixes The prefixes of the namespaces to treat + * according to canonical XML. + */ + protected void setInclusiveNamespacePrefixes(List inclusiveNamespacePrefixes) { + this.inclusiveNamespacePrefixes = inclusiveNamespacePrefixes; + } + + /** + * @see iaik.server.modules.xml.ExclusiveCanonicalization#getInclusiveNamespacePrefixes() + */ + public List getInclusiveNamespacePrefixes() { + return inclusiveNamespacePrefixes; + } + + /** + * Compare this object to another CanonicalizationTransform. + * + * @param other The object to compare this + * ExclusiveCanonicalization to. + * @return true, if other is a + * ExclusiveCanonicalization and the algorithm URIs match, + * otherwise false. + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object other) { + if (other instanceof ExclusiveCanonicalization) { + ExclusiveCanonicalization eC14n = + (ExclusiveCanonicalization) other; + boolean algURIEquals = getAlgorithmURI().equals(eC14n.getAlgorithmURI()); + boolean inclNSPrefs = + (getInclusiveNamespacePrefixes() == null || getInclusiveNamespacePrefixes().isEmpty()) + ? eC14n.getInclusiveNamespacePrefixes() == null || eC14n.getInclusiveNamespacePrefixes().isEmpty() + : getInclusiveNamespacePrefixes().equals(eC14n.getInclusiveNamespacePrefixes()); + return algURIEquals && inclNSPrefs; + } + return false; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java new file mode 100644 index 000000000..19ca3dadf --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java @@ -0,0 +1,34 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import java.util.Date; + +import iaik.server.modules.xml.SigningTime; + +/** + * An implementation of the SigningTime Property. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SigningTimeImpl implements SigningTime { + + /** The signing time. */ + private Date signingTime; + + /** + * Create a new SigningTimeImpl. + * + * @param signingTime The signing time. + */ + public SigningTimeImpl(Date signingTime) { + this.signingTime = signingTime; + } + + /** + * @see iaik.server.modules.xml.SigningTime#getSigningTime() + */ + public Date getSigningTime() { + return signingTime; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java new file mode 100644 index 000000000..59a414b69 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java @@ -0,0 +1,43 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import iaik.server.modules.xml.Transformation; + +/** + * Base implementation class for Transformation derived classes. + * + * @author Patrick Peck + * @version $Id$ + */ +public abstract class TransformationImpl implements Transformation { + + /** The algorithm URI identifying the transformation algorithm. */ + private String algorithmURI; + + /** + * @see iaik.server.modules.xml.Transformation#getAlgorithmURI() + */ + public String getAlgorithmURI() { + return algorithmURI; + } + + /** + * Sets the algorithm URI. + * + * @param algorithmURI The algorithm URI to set. + */ + protected void setAlgorithmURI(String algorithmURI) { + this.algorithmURI = algorithmURI; + } + + /** + * Returns the hash code of the algorithm URI. Should be overridden if a + * transformation distinguishes itself from others by more than just the + * algorithm URI. + * + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return getAlgorithmURI().hashCode(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java new file mode 100644 index 000000000..bc31d694e --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java @@ -0,0 +1,46 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import org.w3c.dom.Element; + +import iaik.server.modules.xml.XMLDataObject; + +/** + * A DataObject containing a single DOM element. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLDataObjectImpl + extends DataObjectImpl + implements XMLDataObject { + + /** The XML data contained in this XMLDataObject. */ + private Element element; + + /** + * Create a new XMLDataObjectImpl. + * + * @param element The DOM element contained in this + * XMLDataObject. + */ + public XMLDataObjectImpl(Element element) { + setElement(element); + } + + /** + * @see iaik.server.modules.xml.XMLDataObject#getElement() + */ + public Element getElement() { + return element; + } + + /** + * Set the DOM element contained in this XMLDataObject. + * + * @param element The DOM element to set. + */ + public void setElement(Element element) { + this.element = element; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java new file mode 100644 index 000000000..c855a922a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java @@ -0,0 +1,47 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import org.w3c.dom.NodeList; + +import iaik.server.modules.xml.XMLNodeListDataObject; + +/** + * A DataObject containing a list of DOM nodes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLNodeListDataObjectImpl + extends DataObjectImpl + implements XMLNodeListDataObject { + + /** The nodes contained in this XMLNodeListDataObject. */ + private NodeList nodeList; + + /** + * Create a new XMLNodeListDataObjectImpl. + * + * @param nodeList The list of DOM nodes contained in this + * XMLNodeListDataObject. + */ + public XMLNodeListDataObjectImpl(NodeList nodeList) { + setNodeList(nodeList); + } + + /** + * Set the list of DOM nodes contained in this + * XMLNodeListDataObject. + * + * @param nodeList The list of DOM nodes to set. + */ + public void setNodeList(NodeList nodeList) { + this.nodeList = nodeList; + } + + /** + * @see iaik.server.modules.xml.XMLNodeListDataObject#getNodeList() + */ + public NodeList getNodeList() { + return nodeList; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java new file mode 100644 index 000000000..4fca907f3 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java @@ -0,0 +1,43 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import org.w3c.dom.Element; + +import iaik.server.modules.xml.XMLSignature; + +/** + * An object containing an XMLDsig signature in the form of a + * dsig:Signature DOM element. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureImpl implements XMLSignature { + /** The signature DOM element. */ + private Element element; + + /** + * Create a new XMLSignatureImpl. + * + * @param element The dsig:Signature DOM element. + */ + public XMLSignatureImpl(Element element) { + setElement(element); + } + + /** + * Set the dsig:Signature DOM element. + * + * @param element The dsig:Signature element to set. + */ + public void setElement(Element element) { + this.element = element; + } + + /** + * @see iaik.server.modules.xml.XMLSignature#getElement() + */ + public Element getElement() { + return element; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java new file mode 100644 index 000000000..034d4b653 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java @@ -0,0 +1,116 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import java.util.Map; + +import iaik.server.modules.xml.XPath2Transformation; +import iaik.server.modules.xml.XPath2Transformation.XPath2Filter; + +/** + * An object encapsulating an XPath-Filter2 expression. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPath2FilterImpl implements XPath2Filter { + + /** The type of this filter. */ + private String filterType; + /** The XPath expression of this filter. */ + private String xPathExpression; + /** The namespace prefix to URI mapping to use for evaluating the XPath. */ + private Map namespaceDeclarations; + + /** + * Create a new XPath2FilterImpl object. + * + * @param filterType The type of filter. Must be one of the filter type + * constants declared in iaik.server.modules.xml.XPath2Transformation.XPath2Filter + * @param xPathExpression The XPath expression belonging to this filter. + * @param namespaceDeclarations The namespace declarations visible for this + * XPath2Filter. + */ + public XPath2FilterImpl( + String filterType, + String xPathExpression, + Map namespaceDeclarations) { + + setFilterType(filterType); + setXPathExpression(xPathExpression); + setNamespaceDeclarations(namespaceDeclarations); + } + + /** + * @see iaik.server.modules.xml.XPath2Transformation.XPath2Filter#getFilterType() + */ + public String getFilterType() { + return filterType; + } + + /** + * Set the filter type. + * + * @param filterType The filter type to set. + */ + protected void setFilterType(String filterType) { + this.filterType = filterType; + } + + /** + * @see iaik.server.modules.xml.XPath2Transformation.XPath2Filter#getXPathExpression() + */ + public String getXPathExpression() { + return xPathExpression; + } + + /** + * Set the XPath expression. + * + * @param xPathExpression The XPath expression to set. + */ + protected void setXPathExpression(String xPathExpression) { + this.xPathExpression = xPathExpression; + } + + /** + * @see iaik.server.modules.xml.XPath2Transformation.XPath2Filter#getNamespaceDeclarations() + */ + public Map getNamespaceDeclarations() { + return namespaceDeclarations; + } + + /** + * Set the namespace declarations. + * + * @param namespaceDeclarations The mapping between namespace prefixes and + * their associated URI. + */ + protected void setNamespaceDeclarations(Map namespaceDeclarations) { + this.namespaceDeclarations = namespaceDeclarations; + } + + /** + * Compare this object to another. + * + * @param other The object to compare this XPath2Filter to. + * @return true, if other is a + * XPath2Filter and the filter types match and the XPath + * expressions match. Otherwise false is returned. + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object other) { + if (other instanceof XPath2Transformation.XPath2Filter) { + XPath2Filter filter = (XPath2Transformation.XPath2Filter) other; + return getFilterType().equals(filter.getFilterType()) + && getXPathExpression().equals(filter.getXPathExpression()); + } + return false; + } + + /** + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return getXPathExpression().hashCode() * 31 + getFilterType().hashCode(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java new file mode 100644 index 000000000..c7496c2cd --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java @@ -0,0 +1,82 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import iaik.server.modules.xml.XPath2Transformation; + +/** + * An object encapsulating a Transformation containing several + * XPath-Filter2 expressions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPath2TransformationImpl + extends TransformationImpl + implements XPath2Transformation { + + /** The filters contained in this XPath2Transformation */ + private List xPathFilters = new ArrayList(); + + /** + * Create a new XPath2TransformationImpl. + * + * The list of XPath-Filter2 expression is initially empty. + */ + public XPath2TransformationImpl() { + setAlgorithmURI(XPath2Transformation.XPATH2); + } + + /** + * @see iaik.server.modules.xml.XPath2Transformation#getXPathFilters() + */ + public List getXPathFilters() { + return xPathFilters; + } + + /** + * Add an XPath-Filter2 expression to the list of filters. + * + * @param filter The filter to add. + */ + public void addXPathFilter(XPath2Filter filter) { + xPathFilters.add(filter); + } + + /** + * Compare this XPath2Transformation to another. + * + * @param other The object to compare this + * XPath2Transformation to. + * @return true, if other is an + * XPath2Transformation and getXPathFilters() equals + * other.getXPathFilters(). Otherwise false is + * returned. + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object other) { + if (other instanceof XPath2Transformation) { + XPath2Transformation transform = (XPath2Transformation) other; + + return getXPathFilters().equals(transform.getXPathFilters()); + } + return false; + } + + /** + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + Iterator iter = getXPathFilters().iterator(); + int hashCode = 0; + + while (iter.hasNext()) { + hashCode ^= iter.next().hashCode(); + } + + return hashCode; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java new file mode 100644 index 000000000..ccedbadb2 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java @@ -0,0 +1,98 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import java.util.Map; + +import iaik.server.modules.xml.XPathTransformation; + +/** + * A Transformation containing an XPath expression. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPathTransformationImpl + extends TransformationImpl + implements XPathTransformation { + + /** The XPath expression. */ + private String xPathExpression; + /** The namespace prefix to URI mapping to use for XPath evaluation. */ + private Map namespaceDeclarations; + + /** + * Create a new XPathTransformationImpl. + * + * The namespace declarations are initialized empty. + * + * @param xPathExpression The XPath expression this object will contain. + * @param namespaceDeclarations The namespace declarations visible for this + * XPath. + */ + public XPathTransformationImpl( + String xPathExpression, + Map namespaceDeclarations) { + + setAlgorithmURI(XPathTransformation.XPATH); + setXPathExpression(xPathExpression); + setNamespaceDeclarations(namespaceDeclarations); + } + + /** + * Set the XPath expression. + * + * @param xPathExpression The XPath expression. + */ + protected void setXPathExpression(String xPathExpression) { + this.xPathExpression = xPathExpression; + } + + /** + * @see iaik.server.modules.xml.XPathTransformation#getXPathExpression() + */ + public String getXPathExpression() { + return xPathExpression; + } + + /** + * @see iaik.server.modules.xml.XPathTransformation#getNamespaceDeclarations() + */ + public Map getNamespaceDeclarations() { + return namespaceDeclarations; + } + + /** + * Set the namespace declarations. + * + * @param namespaceDeclarations The mapping between namespace prefixes and + * their associated URI. + */ + protected void setNamespaceDeclarations(Map namespaceDeclarations) { + this.namespaceDeclarations = namespaceDeclarations; + } + + /** + * Compare this XPathTransformation to another. + * + * @param other The object to compare this + * XPathTransformation to. + * @return true, if other is an + * XPathTransformation and if this object contains the same XPath + * expression as other. Otherwise false is returned. + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object other) { + if (other instanceof XPathTransformation) { + XPathTransformation transform = (XPathTransformation) other; + return getXPathExpression().equals(transform.getXPathExpression()); + } + return false; + } + + /** + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return getXPathExpression().hashCode(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java new file mode 100644 index 000000000..d38da650b --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java @@ -0,0 +1,168 @@ +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Collections; + +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import iaik.ixsil.algorithms.CanonicalizationAlgorithm; +import iaik.ixsil.algorithms.CanonicalizationAlgorithmImplExclusiveCanonicalXML; +import iaik.ixsil.exceptions.AlgorithmException; +import iaik.server.modules.xml.XSLTTransformation; + +import at.gv.egovernment.moa.util.NodeListAdapter; +import at.gv.egovernment.moa.util.StreamUtils; +import at.gv.egovernment.moa.util.XPathException; +import at.gv.egovernment.moa.util.XPathUtils; + + +/** + * A Transformation containing an XSLT transformation. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XSLTTransformationImpl + extends TransformationImpl + implements XSLTTransformation { + + /** The XSLT stylesheet. */ + private Element styleSheetElement; + /** The hash code of the canonicalized stylesheet. If calculated, this value + * should be != 0. */ + private int hashCode; + + /** + * Create a new XSLTTransformationImpl object. + * + * @param styleSheetElement The XSLT stylesheet element. + */ + public XSLTTransformationImpl(Element styleSheetElement) { + setAlgorithmURI(XSLTTransformation.XSLT); + setStyleSheetElement(styleSheetElement); + } + + /** + * Set the XSLT stylesheet element. + * + * @param styleSheetElement The XSLT stylesheet element to set. + */ + protected void setStyleSheetElement(Element styleSheetElement) { + this.styleSheetElement = styleSheetElement; + this.hashCode = 0; + } + + /** + * @see iaik.server.modules.xml.XSLTTransformation#getStylesheetElement() + */ + public Element getStylesheetElement() { + return styleSheetElement; + } + + /** + * Compare this XSLTTransformation to another. + * + * @param other The object to compare this + * XSLTTransformation to. + * @return true, if other is an + * XSLTTransformation and if the canonicalized representations of + * the stylesheets contained in this and other + * match. Otherwise, false is returned. + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object other) { + if (other instanceof XSLTTransformation) { + XSLTTransformation xslt = (XSLTTransformation) other; + + return compareElements( + getStylesheetElement(), + xslt.getStylesheetElement()); + } + return false; + } + + /** + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + if (hashCode == 0) { + hashCode = calculateHashCode(getStylesheetElement()); + } + return hashCode; + } + + /** + * Calculate the hash code for a DOM element by canonicalizing it. + * + * @param element The DOM element for which the hash code is to be calculated. + * @return int The hash code, or 0, if it could not be + * calculated. + */ + private static int calculateHashCode(Element element) { + try { + InputStream is = canonicalize(element); + byte[] buf = new byte[256]; + int hashCode = 1; + int length; + int i; + + while ((length = is.read(buf)) > 0) { + for (i = 0; i < length; i++) { + hashCode += buf[i] * 31 + i; + } + } + is.close(); + return hashCode; + } catch (AlgorithmException e) { + return 0; + } catch (IOException e) { + return 0; + } + } + + /** + * Compare two DOM elements by canonicalizing their contents and comparing the + * resulting byte stream. + * + * @param elem1 The 1st element to compare. + * @param elem2 The 2nd element to compare. + * @return boolean true, if the elements are considered equal + * after canonicalization. Otherwise false is returned. + */ + private static boolean compareElements(Element elem1, Element elem2) { + try { + InputStream is1 = canonicalize(elem1); + InputStream is2 = canonicalize(elem2); + return StreamUtils.compareStreams(is1, is2); + } catch (AlgorithmException e) { + return false; + } catch (IOException e) { + return false; + } + } + + /** + * Canonicalize a DOM element. + * + * @param element The element to canonicalize. + * @return InputStream A stream with the canonicalized data. + * @throws AlgorithmException An error occurred canonicalizing the element. + */ + private static InputStream canonicalize(Element element) + throws AlgorithmException { + CanonicalizationAlgorithm c14n = + new CanonicalizationAlgorithmImplExclusiveCanonicalXML(); + NodeList nodeList; + + try { + nodeList = XPathUtils.selectNodeList(element, XPathUtils.ALL_NODES_XPATH); + } catch (XPathException e) { + nodeList = new NodeListAdapter(Collections.EMPTY_LIST); + } + c14n.setInput(nodeList); + return c14n.canonicalize(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java new file mode 100644 index 000000000..a14b83b7d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java @@ -0,0 +1,150 @@ +package at.gv.egovernment.moa.spss.server.iaik.xmlsign; + +import java.util.List; + +import iaik.server.modules.xmlsign.DataObjectTreatment; + +import at.gv.egovernment.moa.spss.server.util.IdGenerator; + +/** + * An object encapsulating how to treat an associated DataObject + * when creating a signature. + * + * @author Patrick Peck + * @version $Id$ + */ +public class DataObjectTreatmentImpl implements DataObjectTreatment { + /** The final content MIME type. */ + private String finalContentType; + /** The name of the hash algorithm. */ + private String hashAlgorithmName; + /** This transformations to apply to the associated data object. */ + private List transformationList; + /** Supplemental information for the transformations. */ + private List transformationSupplements; + /** Whether to include the associated data object in the signature. */ + private boolean includedInSignature; + /** Whether to include the associated data object in the manifest. */ + private boolean referenceInManifest; + /** The object ID generator. */ + private IdGenerator objIdGen; + + /** + * Create a new DataObjectTreatmentImpl. + * + * @param objIdGen The IdGenerator for unique object IDs. + */ + public DataObjectTreatmentImpl(IdGenerator objIdGen) { + this.objIdGen = objIdGen; + } + + /** + * @see iaik.server.modules.xmlsign.DataObjectTreatment#getFinalContentType() + */ + public String getFinalContentType() { + return finalContentType; + } + + /** + * Sets the final content type. + * + * @param finalContentType The final content type to set (a MIME-type type of + * String). + */ + public void setFinalContentType(String finalContentType) { + this.finalContentType = finalContentType; + } + + /** + * @see iaik.server.modules.xmlsign.DataObjectTreatment#getHashAlgorithmName() + */ + public String getHashAlgorithmName() { + return hashAlgorithmName; + } + + /** + * Sets the hash algorithm name. + * + * @param hashAlgorithmName The hash algorithm name to set. + */ + public void setHashAlgorithmName(String hashAlgorithmName) { + this.hashAlgorithmName = hashAlgorithmName; + } + + /** + * @see iaik.server.modules.xmlsign.DataObjectTreatment#isIncludedInSignature() + */ + public boolean isIncludedInSignature() { + return includedInSignature; + } + + /** + * Sets whether the associated DataObject is to be included in + * the signature. + * + * @param includedInSignature If true, the associated + * DataObject will be included in the signature, otherwise not. + */ + public void setIncludedInSignature(boolean includedInSignature) { + this.includedInSignature = includedInSignature; + } + + /** + * @see iaik.server.modules.xmlsign.DataObjectTreatment#isReferenceInManifest() + */ + public boolean isReferenceInManifest() { + return referenceInManifest; + } + + /** + * Sets whether the associated DataObject is + * to be included in the dsig:Manifest. + * + * @param referenceInManifest If true, the associated + * DataObject will be included in the manifest, otherwise not. + */ + public void setReferenceInManifest(boolean referenceInManifest) { + this.referenceInManifest = referenceInManifest; + } + + /** + * @see iaik.server.modules.xmlsign.DataObjectTreatment#getTransformationList() + */ + public List getTransformationList() { + return transformationList; + } + + /** + * Set the list of transformations for the associated DataObject. + * + * @param transformationList The transformations to set. + */ + public void setTransformationList(List transformationList) { + this.transformationList = transformationList; + } + + /** + * @see iaik.server.modules.xmlsign.DataObjectTreatment#getTransformationSupplements() + */ + public List getTransformationSupplements() { + return transformationSupplements; + } + + /** + * Sets the transformation supplements for the associated + * DataObject. + * + * @param transformationSupplements The transformation supplements to set. + */ + public void setTransformationSupplements(List transformationSupplements) { + this.transformationSupplements = transformationSupplements; + } + + /** + * @see iaik.server.modules.xmlsign.DataObjectTreatment#getDsigDataObjectID() + */ + public String getDsigDataObjectID() { + return objIdGen.uniqueId(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java new file mode 100644 index 000000000..fb3ff4931 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java @@ -0,0 +1,279 @@ +package at.gv.egovernment.moa.spss.server.iaik.xmlsign; + +import java.util.List; +import java.util.Set; + +import iaik.server.modules.algorithms.SignatureAlgorithms; +import iaik.server.modules.keys.AlgorithmUnavailableException; +import iaik.server.modules.keys.KeyEntryID; +import iaik.server.modules.keys.KeyModule; +import iaik.server.modules.keys.KeyModuleFactory; +import iaik.server.modules.keys.UnknownKeyException; +import iaik.server.modules.xml.Canonicalization; +import iaik.server.modules.xmlsign.XMLSignatureCreationProfile; +import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation; + +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.server.util.IdGenerator; + +/** + * An object providing auxiliary information for creating an XML signature. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureCreationProfileImpl + implements XMLSignatureCreationProfile { + + /** The transformations to apply to a data object. */ + private List dataObjectTreatmentList; + /** The set of keys available to the signing process. */ + private Set keySet; + /** The type URI of the signature manifest. */ + private String securityLayerManifestTypeURI; + /** Whether the created signature is to be Security Layer conform. */ + private boolean securityLayerConform; + /** Where to insert the signature into the signature environment. */ + private XMLSignatureInsertionLocation signatureInsertionLocation; + /** The signature structur type. */ + private String signatureStructureType; + /** The type of Canonicalization to use for the signed info. */ + private Canonicalization signedInfoCanonicalization; + /** Properties to be signed during signature creation. */ + private List signedProperties; + /** The ID generator for signature IDs. */ + private IdGenerator signatureIDGenerator; + /** The ID generator for manifst IDs. */ + private IdGenerator manifestIDGenerator; + /** The ID generator for XMLDsig manifest IDs. */ + private IdGenerator dsigManifestIDGenerator; + /** The ID generator for signed property IDs. */ + private IdGenerator propertyIDGenerator; + + /** + * Create a new XMLSignatureCreationProfileImpl. + * + * @param createProfileCount Provides external information about the + * number of calls to the signature creation module, using the same request. + * @param reservedIDs The set of IDs that must not be used while generating + * new IDs. + */ + public XMLSignatureCreationProfileImpl( + int createProfileCount, + Set reservedIDs) { + signatureIDGenerator = + new IdGenerator("signature-" + createProfileCount, reservedIDs); + manifestIDGenerator = + new IdGenerator("manifest-" + createProfileCount, reservedIDs); + dsigManifestIDGenerator = + new IdGenerator("dsig-manifest-" + createProfileCount, reservedIDs); + propertyIDGenerator = + new IdGenerator("etsi-signed-" + createProfileCount, reservedIDs); + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getDataObjectTreatmentList() + */ + public List getDataObjectTreatmentList() { + return dataObjectTreatmentList; + } + + /** + * Sets the list of DataObjectTreatments. + * + * @param dataObjectTreatmentList The DataObjectTreatments to + * set. + */ + public void setDataObjectTreatmentList(List dataObjectTreatmentList) { + this.dataObjectTreatmentList = dataObjectTreatmentList; + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getKeySet() + */ + public Set getKeySet() { + return keySet; + } + + /** + * Set the set of KeyEntryIDs which may be used for signature + * creation. + * + * @param keySet The set of KeyEntryIDs to set. + */ + public void setKeySet(Set keySet) { + this.keySet = keySet; + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSecurityLayerManifestTypeURI() + */ + public String getSecurityLayerManifestTypeURI() { + return securityLayerManifestTypeURI; + } + + /** + * Set the SecurityLayerManifestTypeURI. + * + * @param securityLayerManifestTypeURI The SecurityLayerManifestTypeURI to + * set. + */ + public void setSecurityLayerManifestTypeURI(String securityLayerManifestTypeURI) { + this.securityLayerManifestTypeURI = securityLayerManifestTypeURI; + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignatureAlgorithmName(KeyEntryID) + */ + public String getSignatureAlgorithmName(KeyEntryID selectedKeyID) + throws AlgorithmUnavailableException { + + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + TransactionId tid = new TransactionId(context.getTransactionID()); + KeyModule module = KeyModuleFactory.getInstance(tid); + Set algorithms; + + try { + algorithms = module.getSupportedSignatureAlgorithms(selectedKeyID); + } catch (UnknownKeyException e) { + throw new AlgorithmUnavailableException( + "Unknown key entry: " + selectedKeyID, + e, + null); + } + + if (algorithms.contains(SignatureAlgorithms.MD2_WITH_RSA) // TODO retournierten Algorithmus abhängig von der Schlüssellänge machen (bei längeren Schlüsseln SHA256 statt SHA1) + || algorithms.contains(SignatureAlgorithms.MD5_WITH_RSA) + || algorithms.contains(SignatureAlgorithms.RIPEMD128_WITH_RSA) + || algorithms.contains(SignatureAlgorithms.RIPEMD160_WITH_RSA) + || algorithms.contains(SignatureAlgorithms.SHA1_WITH_RSA) + || algorithms.contains(SignatureAlgorithms.SHA256_WITH_RSA)) { + + return SignatureAlgorithms.SHA1_WITH_RSA; + } else if ( + algorithms.contains(SignatureAlgorithms.ECDSA)) { + return SignatureAlgorithms.ECDSA; + } else if ( + algorithms.contains(SignatureAlgorithms.DSA)) { + return SignatureAlgorithms.DSA; + } else { + throw new AlgorithmUnavailableException( + "No algorithm for key entry: " + selectedKeyID, + null, + null); + } + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignatureInsertionLocation() + */ + public XMLSignatureInsertionLocation getSignatureInsertionLocation() { + return signatureInsertionLocation; + } + + /** + * Set the location where the signature is to be inserted into the signature + * parent. + * + * @param signatureInsertionLocation The location to set. + */ + public void setSignatureInsertionLocation(XMLSignatureInsertionLocation signatureInsertionLocation) { + this.signatureInsertionLocation = signatureInsertionLocation; + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignatureStructureType() + */ + public String getSignatureStructureType() { + return signatureStructureType; + } + + /** + * Set the signature structure type. + * @param signatureStructureType The signature structure type to set. + */ + public void setSignatureStructureType(String signatureStructureType) { + this.signatureStructureType = signatureStructureType; + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignedInfoCanonicalization() + */ + public Canonicalization getSignedInfoCanonicalization() { + return signedInfoCanonicalization; + } + + /** + * Sets the canonicalization method to use for the SignedInfo object. + * + * @param signedInfoCanonicalization The canonicalization method to set. + */ + public void setSignedInfoCanonicalization(Canonicalization signedInfoCanonicalization) { + this.signedInfoCanonicalization = signedInfoCanonicalization; + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignedProperties() + */ + public List getSignedProperties() { + return signedProperties; + } + + /** + * Set the signed properties. + * + * @param signedProperties The signed properties to set. + */ + public void setSignedProperties(List signedProperties) { + this.signedProperties = signedProperties; + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#isSecurityLayerConform() + */ + public boolean isSecurityLayerConform() { + return securityLayerConform; + } + + /** + * Sets the security layer conformity. + * + * @param securityLayerConform true, if the created signature + * is to be conform to the Security Layer specification. + */ + public void setSecurityLayerConform(boolean securityLayerConform) { + this.securityLayerConform = securityLayerConform; + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignatureID() + */ + public String getSignatureID() { + return signatureIDGenerator.uniqueId(); + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSecurityLayerManifestID() + */ + public String getSecurityLayerManifestID() { + return manifestIDGenerator.uniqueId(); + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getDsigManifestID() + */ + public String getDsigManifestID() { + return dsigManifestIDGenerator.uniqueId(); + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignedPropertiesID() + */ + public String getSignedPropertiesID() { + return propertyIDGenerator.uniqueId(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java new file mode 100644 index 000000000..d55f61303 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java @@ -0,0 +1,45 @@ +package at.gv.egovernment.moa.spss.server.iaik.xmlsign; + +import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation; + +/** + * An object giving the location of where the signature will be + * inserted into the parent element. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureInsertionLocationImpl + implements XMLSignatureInsertionLocation { + + /** Where to put the signature into the signature parent element. */ + private int signatureChildIndex; + + /** + * Create a new XMLSignatureInsertLocationImpl. + * + * @param signatureChildIndex The position index at which to append the + * signature to the parent element. + */ + public XMLSignatureInsertionLocationImpl(int signatureChildIndex) { + setSignatureChildIndex(signatureChildIndex); + } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureInsertionLocation#getSignatureChildIndex() + */ + public int getSignatureChildIndex() { + return signatureChildIndex; + } + + /** + * Sets the position index at which to append the signature to the parent + * element. + * + * @param signatureChildIndex The position index to set. + */ + public void setSignatureChildIndex(int signatureChildIndex) { + this.signatureChildIndex = signatureChildIndex; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java new file mode 100644 index 000000000..216596dc3 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java @@ -0,0 +1,131 @@ +package at.gv.egovernment.moa.spss.server.iaik.xmlverify; + +import java.util.List; + +import iaik.pki.PKIProfile; +import iaik.server.modules.xmlverify.XMLSignatureVerificationProfile; + +/** + * An object providing auxiliary information for verifying an XML signature. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureVerificationProfileImpl + implements XMLSignatureVerificationProfile { + + /** Whether to check the Security Layer manifest. */ + private boolean checkSecurityLayerManifest; + /** Whether to check the XMLDsig manifest. */ + private boolean checkXMLDsigManifests; + /** The profile for validating the signer certificate. */ + private PKIProfile certificateValidationProfile; + /** Supplements for the transformations. */ + private List transformationSupplements; + /** Whether to include hash input data in the response. */ + private boolean includeHashInputData; + /** Whether to include reference input data in the response. */ + private boolean includeReferenceInputData; + + /** + * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#checkSecurityLayerManifest() + */ + public boolean checkSecurityLayerManifest() { + return checkSecurityLayerManifest; + } + + /** + * Set whether to check the references in the Security Layer manifest. + * + * @param checkSecurityLayerManifest true, if the references + * in the Security Layer manifest must be checked. + */ + public void setCheckSecurityLayerManifest(boolean checkSecurityLayerManifest) { + this.checkSecurityLayerManifest = checkSecurityLayerManifest; + } + + /** + * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#checkXMLDsigManifests() + */ + public boolean checkXMLDsigManifests() { + return checkXMLDsigManifests; + } + + /** + * Sets whether to check the references of all XML Dsig manifests. + * + * @param checkXMLDSigManifests true, if the references in the + * XML Dsig manifest must be checked. + */ + public void setCheckXMLDsigManifests(boolean checkXMLDSigManifests) { + this.checkXMLDsigManifests = checkXMLDSigManifests; + } + + /** + * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#getCertificateValidationProfile() + */ + public PKIProfile getCertificateValidationProfile() { + return certificateValidationProfile; + } + + /** + * Sets the profile for validating the signer certificate. + * + * @param certificateValidationProfile The certificate validation profile to + * set. + */ + public void setCertificateValidationProfile(PKIProfile certificateValidationProfile) { + this.certificateValidationProfile = certificateValidationProfile; + } + + /** + * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#getTransformationSupplements() + */ + public List getTransformationSupplements() { + return transformationSupplements; + } + + /** + * Sets the transformation supplements. + * + * @param transformationSupplements The transformation supplements to set. + */ + public void setTransformationSupplements(List transformationSupplements) { + this.transformationSupplements = transformationSupplements; + } + + /** + * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#includeHashInputData() + */ + public boolean includeHashInputData() { + return includeHashInputData; + } + + /** + * Set whether to include the hash input data in the result. + * + * @param includeHashInputData If true, the hash input data + * will be returned in the result. + */ + public void setIncludeHashInputData(boolean includeHashInputData) { + this.includeHashInputData = includeHashInputData; + } + + /** + * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#includeReferenceInputData() + */ + public boolean includeReferenceInputData() { + return includeReferenceInputData; + } + + /** + * Set whether to include the reference input data in the result. + * + * @param includeReferenceInputData If true, the reference + * input data will be included in the result. + */ + public void setIncludeReferenceInputData(boolean includeReferenceInputData) { + this.includeReferenceInputData = includeReferenceInputData; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java new file mode 100644 index 000000000..caf17db66 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java @@ -0,0 +1,42 @@ +package at.gv.egovernment.moa.spss.server.init; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.api.Configurator; +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.config.IaikConfigurator; + +/** + * Default implementation of Configurator. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ConfiguratorImpl extends Configurator { + /** whether the configuration has been initialized */ + private boolean initialized = false; + + public void init() throws MOAException { + if (!initialized) { + SystemInitializer.init(); + initialized = true; + } + } + + public void update() throws MOAException { + if (!initialized) { + return; + } + + try { + // reconfigure the system + ConfigurationProvider config = ConfigurationProvider.reload(); + new IaikConfigurator().configure(config); + } catch (MOAException e) { + throw e; + } catch (Throwable t) { + throw new ConfigurationException("", null, t); + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java new file mode 100644 index 000000000..4871ac4fe --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java @@ -0,0 +1,129 @@ +package at.gv.egovernment.moa.spss.server.init; + +import java.io.IOException; +import java.security.Security; + +import javax.net.ssl.SSLSocketFactory; + +import org.apache.axis.AxisProperties; + +import iaik.ixsil.init.IXSILInit; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; +import at.gv.egovernment.moa.spss.server.logging.IaikLog; +import at.gv.egovernment.moa.spss.server.service.RevocationArchiveCleaner; +import at.gv.egovernment.moa.spss.util.MessageProvider; + +/** + * MOA SP/SS web service initialization. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SystemInitializer { + /** Interval between archive cleanups in seconds */ + private static final long ARCHIVE_CLEANUP_INTERVAL = 60 * 60; // 1h + /** The MOA SP/SS logging hierarchy. */ + private static final String LOGGING_HIERARCHY = "moa.spss.server"; + /** Whether XML schema grammars have been initialized. */ + private static boolean grammarsInitialized = false; + + /** + * Initialize the MOA SP/SS webservice. + */ + public static void init() { + MessageProvider msg = MessageProvider.getInstance(); + ClassLoader cl = SystemInitializer.class.getClassLoader(); + Thread archiveCleaner; + + // set up the MOA SPSS logging hierarchy + Logger.setHierarchy(LOGGING_HIERARCHY); + + // set up a logging context for logging the startup + LoggingContextManager.getInstance().setLoggingContext( + new LoggingContext("startup")); + + // load some jsse classes so that the integrity of the jars can be verified + // before the iaik jce is installed as the security provider + // this workaround is only needed when sun jsse is used in conjunction with + // iaik-jce (on jdk1.3) + try { + cl.loadClass("javax.security.cert.Certificate"); // from jcert.jar + } catch (ClassNotFoundException e) { + Logger.warn(msg.getMessage("init.03", null), e); + } + + // set up SUN JSSE SSL + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + System.setProperty( + "java.protocol.handler.pkgs", + "com.sun.net.ssl.internal.www.protocol"); + SSLSocketFactory.getDefault(); + + +// AxisProperties.setProperty("enableNamespacePrefixOptimization","false"); +// AxisProperties.setProperty("disablePrettyXML", "true"); +// AxisProperties.setProperty("axis.doAutoTypes", "true"); + + // initialize preparsed Xerces grammar pool for faster XML + // parsing/validating + try { + if (!grammarsInitialized) { + Class clazz = SystemInitializer.class; + // preparse XML schema + DOMUtils.addSchemaToPool( + clazz.getResourceAsStream(Constants.XML_SCHEMA_LOCATION), + Constants.XML_NS_URI); + // preparse XMLDsig Filter2 schema + DOMUtils.addSchemaToPool( + clazz.getResourceAsStream(Constants.DSIG_FILTER2_SCHEMA_LOCATION), + Constants.DSIG_FILTER2_NS_URI); + // preparse XMLDsig schema + DOMUtils.addSchemaToPool( + clazz.getResourceAsStream(Constants.DSIG_SCHEMA_LOCATION), + Constants.DSIG_NS_URI); + // preparse MOA schema + DOMUtils.addSchemaToPool( + clazz.getResourceAsStream(Constants.MOA_SCHEMA_LOCATION), + Constants.MOA_NS_URI); + grammarsInitialized = true; + } + } catch (IOException e) { + Logger.warn(new LogMsg(msg.getMessage("init.04", null)), e); + } + + // initialize configuration + try { + ConfigurationProvider config = ConfigurationProvider.getInstance(); + new IaikConfigurator().configure(config); + Logger.info(new LogMsg(msg.getMessage("init.01", null))); + } catch (MOAException e) { + Logger.fatal(new LogMsg(msg.getMessage("init.00", null)), e); + } + + // set IXSIL debug output + IXSILInit.setPrintDebugLog( + Logger.isDebugEnabled(IaikLog.IAIK_LOG_HIERARCHY)); + + // start the archive cleanup thread + archiveCleaner = + new Thread(new RevocationArchiveCleaner(ARCHIVE_CLEANUP_INTERVAL)); + archiveCleaner.setName("RevocationArchiveCleaner"); + archiveCleaner.setDaemon(true); + archiveCleaner.setPriority(Thread.MIN_PRIORITY); + archiveCleaner.start(); + + // unset the startup logging context + LoggingContextManager.getInstance().setLoggingContext(null); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java new file mode 100644 index 000000000..f7a322d11 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java @@ -0,0 +1,221 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import iaik.IAIKException; +import iaik.IAIKRuntimeException; +import iaik.server.modules.cmsverify.CMSSignatureVerificationModule; +import iaik.server.modules.cmsverify.CMSSignatureVerificationModuleFactory; +import iaik.server.modules.cmsverify.CMSSignatureVerificationProfile; +import iaik.server.modules.cmsverify.CMSSignatureVerificationResult; + +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentExcplicit; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentReference; +import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.server.logging.IaikLog; +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; + +/** + * A class providing an interface to the + * CMSSignatureVerificationModule. + * + * This class performs the invocation of the + * iaik.server.modules.cmsverify.CMSSignatureVerificationModule + * from a VerifyCMSSignatureRequest. The result of the invocation + * is integrated into a VerifyCMSSignatureResponse returned. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CMSSignatureVerificationInvoker { + + /** The single instance of this class. */ + private static CMSSignatureVerificationInvoker instance = null; + + /** + * Return the only instance of this class. + * + * @return The only instance of this class. + */ + public static synchronized CMSSignatureVerificationInvoker getInstance() { + if (instance == null) { + instance = new CMSSignatureVerificationInvoker(); + } + return instance; + } + + /** + * Create a new CMSSignatureVerificationInvoker. + * + * Protected to disallow multiple instances. + */ + protected CMSSignatureVerificationInvoker() { + } + + /** + * Verify a CMS signature. + * + * @param request The VerifyCMSSignatureRequest containing the + * CMS signature, as well as additional data needed for verification. + * @return Element A VerifyCMSSignatureResponse containing the + * answer to the VerifyCMSSignatureRequest. + * @throws MOAException An error occurred while processing the request. + */ + public VerifyCMSSignatureResponse verifyCMSSignature(VerifyCMSSignatureRequest request) + throws MOAException { + CMSSignatureVerificationProfileFactory profileFactory = + new CMSSignatureVerificationProfileFactory(request); + VerifyCMSSignatureResponseBuilder responseBuilder = + new VerifyCMSSignatureResponseBuilder(); + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + LoggingContext loggingCtx = + LoggingContextManager.getInstance().getLoggingContext(); + InputStream signature; + InputStream signedContent = null; + CMSSignatureVerificationProfile profile; + Date signingTime; + List results; + CMSSignatureVerificationResult result; + int[] signatories; + InputStream input; + byte[] buf = new byte[256]; + + // get the signature + signature = request.getCMSSignature(); + + try { + // get the signed content + signedContent = getSignedContent(request); + + // build the profile + profile = profileFactory.createProfile(); + + // get the signing time + signingTime = request.getDateTime(); + + // verify the signature + CMSSignatureVerificationModule module = + CMSSignatureVerificationModuleFactory.getInstance(); + + module.setLog(new IaikLog(loggingCtx.getNodeID())); + + module.init( + signature, + signedContent, + profile, + new TransactionId(context.getTransactionID())); + input = module.getInputStream(); + + while (input.read(buf) > 0); + results = module.verifySignature(signingTime); + } catch (IAIKException e) { + MOAException moaException = IaikExceptionMapper.getInstance().map(e); + throw moaException; + } catch (IAIKRuntimeException e) { + MOAException moaException = IaikExceptionMapper.getInstance().map(e); + throw moaException; + } catch (IOException e) { + throw new MOAApplicationException("2244", null, e); + } catch (MOAException e) + { + throw e; + } + finally + { + try + { + if (signedContent != null) signedContent.close(); + } + catch (Throwable t) + { + // Intentionally do nothing here + } + } + + // build the response: for each signatory add the result to the response + signatories = request.getSignatories(); + if (signatories == VerifyCMSSignatureRequest.ALL_SIGNATORIES) { + Iterator resultIter; + + for (resultIter = results.iterator(); resultIter.hasNext();) { + result = (CMSSignatureVerificationResult) resultIter.next(); + responseBuilder.addResult(result); + } + } else { + int i; + + for (i = 0; i < signatories.length; i++) { + int sigIndex = signatories[i] - 1; + + try { + result = + (CMSSignatureVerificationResult) results.get(signatories[i] - 1); + responseBuilder.addResult(result); + } catch (IndexOutOfBoundsException e) { + throw new MOAApplicationException( + "2249", + new Object[] { new Integer(sigIndex)}); + } + } + } + + return responseBuilder.getResponse(); + } + + /** + * Get the signed content contained either in the request itself or given as a + * reference to external data. + * + * @param request The VerifyCMSSignatureRequest containing the + * signed content (or the reference to the signed content). + * @return InputStream A stream providing the signed content data, or + * null if no signed content was provided with the request. + * @throws MOAApplicationException An error occurred building the stream. + */ + private InputStream getSignedContent(VerifyCMSSignatureRequest request) + throws MOAApplicationException { + + CMSDataObject dataObj; + CMSContent content; + + // select the Content element + dataObj = request.getDataObject(); + if (dataObj == null) { + return null; + } + content = dataObj.getContent(); + + // build the content data + switch (content.getContentType()) { + case CMSContent.EXPLICIT_CONTENT : + return ((CMSContentExcplicit) content).getBinaryContent(); + case CMSContent.REFERENCE_CONTENT : + String reference = ((CMSContentReference) content).getReference(); + if (!"".equals(reference)) { + ExternalURIResolver resolver = new ExternalURIResolver(); + return resolver.resolve(reference); + } else { + return null; + } + default : + return null; + } + + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java new file mode 100644 index 000000000..442921850 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java @@ -0,0 +1,61 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import iaik.server.modules.cmsverify.CMSSignatureVerificationProfile; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.iaik.cmsverify.CMSSignatureVerificationProfileImpl; +import at.gv.egovernment.moa.spss.server.iaik.pki.PKIProfileImpl; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * A factory to create a CMSSignatureVerificationProfile from a + * VerifyCMSSignatureRequest and the current MOA configuration + * data. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CMSSignatureVerificationProfileFactory { + + /** The VerifyCMSSignatureRequest to draw profile data from. */ + private VerifyCMSSignatureRequest request; + + /** + * Create a new CMSSignatureVerificationProfileFactory. + * + * @param request The VerifyCMSSignatureRequest to draw profile + * data from. + */ + public CMSSignatureVerificationProfileFactory(VerifyCMSSignatureRequest request) { + this.request = request; + } + + /** + * Create a CMSSignatureVerificationProfile from the given + * request and the current MOA configuration. + * + * @return The CMSSignatureVerificationProfile for the + * request, based on the current configuration. + * @throws MOAException An error occurred creating the profile. + */ + public CMSSignatureVerificationProfile createProfile() + throws MOAException { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + CMSSignatureVerificationProfileImpl profile = + new CMSSignatureVerificationProfileImpl(); + String trustProfileID; + + // set the certificate validation profile + trustProfileID = request.getTrustProfileId(); + profile.setCertificateValidationProfile( + new PKIProfileImpl(config, trustProfileID)); + + return profile; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java new file mode 100644 index 000000000..6302cadfd --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java @@ -0,0 +1,71 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +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.xmlsign.CreateXMLSignatureResponse; +import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse; +import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse; + +/** + * A class to build a CreateXMLSignatureResponse. + * + *

The methods addSignature() and addError() may be + * called in any combination to add SignatureEnvironment and + * ErrorResponse elements to the response. One of these functions + * must be called at least once to produce a + * CreateXMLSignatureResponse.

+ * + *

The getResponseElement() method then returns the + * CreateXMLSignatureResponse built so far.

+ * + * @author Patrick Peck + * @version $Id$ + */ +public class CreateXMLSignatureResponseBuilder { + + /** The SPSSFactory for creating API objects. */ + private SPSSFactory factory = SPSSFactory.getInstance(); + /** The elements to add to the response. */ + private List responseElements = new ArrayList(); + + /** + * Get the CreateXMLSignatureResponse built so far. + * + * @return The CreateXMLSignatureResponse built so far. + */ + public CreateXMLSignatureResponse getResponse() { + return factory.createCreateXMLSignatureResponse(responseElements); + } + + /** + * Add a SignatureEnvironment element to the response. + * + * @param signatureEnvironment The content to put under the + * SignatureEnvironment element. This should either be a + * dsig:Signature element (in case of a detached signature) or + * the signature environment containing the signature (in case of + * an enveloping signature). + */ + public void addSignatureEnvironment(Element signatureEnvironment) { + SignatureEnvironmentResponse responseElement = + factory.createSignatureEnvironmentResponse(signatureEnvironment); + responseElements.add(responseElement); + } + + /** + * Add a ErrorResponse element to the response. + * + * @param errorCode The error code. + * @param info Additional information about the error. + */ + public void addError(String errorCode, String info) { + ErrorResponse errorResponse = + factory.createErrorResponse(Integer.parseInt(errorCode), info); + responseElements.add(errorResponse); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java new file mode 100644 index 000000000..1386d5c2d --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -0,0 +1,892 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import org.xml.sax.EntityResolver; +import org.xml.sax.SAXException; + +import iaik.ixsil.util.URI; +import iaik.ixsil.util.XPointerReferenceResolver; +import iaik.server.modules.xml.DataObject; +import iaik.server.modules.xml.XMLDataObject; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.EntityResolverChain; +import at.gv.egovernment.moa.util.MOAEntityResolver; +import at.gv.egovernment.moa.util.MOAErrorHandler; +import at.gv.egovernment.moa.util.StreamEntityResolver; +import at.gv.egovernment.moa.util.StreamUtils; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.common.ContentBinary; +import at.gv.egovernment.moa.spss.api.common.ContentLocRef; +import at.gv.egovernment.moa.spss.api.common.ContentXML; +import at.gv.egovernment.moa.spss.api.common.MetaInfo; +import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter; +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterBinary; +import at.gv.egovernment.moa.spss.server.iaik.xml.ByteArrayDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.ByteStreamDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.DataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLNodeListDataObjectImpl; +import at.gv.egovernment.moa.spss.util.MessageProvider; + +/** + * A class to create DataObjects contained in different + * locations of the MOA XML request format. + * + * @author Patrick Peck + * @author Gregor Karlinger + * @version $Id$ + */ +public class DataObjectFactory { + + /** The single instance of this class. */ + private static DataObjectFactory instance = null; + + /** + * Return the only instance of this class. + * + * @return The only instance of this class. + */ + public static synchronized DataObjectFactory getInstance() { + if (instance == null) { + instance = new DataObjectFactory(); + } + return instance; + } + + /** + * Create a new DataObjectFactory. + * + * Protected to disallow multiple instances. + */ + protected DataObjectFactory() { + } + + /** + * Return the signature environment, i.e., the root element of the + * document, into which the signature will be inserted (if created) or which + * contains the signature (if verified). + * + * @param content The Content object containing the signature + * environment. + * @param supplements Additional schema or DTD information. + * @return The signature environment or null, if no + * signature environment exists. + * @throws MOASystemException A system error occurred building the signature + * environment (see message for details). + * @throws MOAApplicationException An error occurred building the signature + * environment (see message for details). + */ + public XMLDataObject createSignatureEnvironment( + Content content, + List supplements) + throws MOASystemException, MOAApplicationException { + + String reference = content.getReference(); + EntityResolver entityResolver; + byte[] contentBytes; + + // check for content and reference not being set at the same time + checkAllowContentAndReference(content, false); + + // build the EntityResolver for validating parsing + if (supplements == null || supplements.isEmpty()) { + entityResolver = new MOAEntityResolver(); + } else { + EntityResolverChain chain = new EntityResolverChain(); + + chain.addEntityResolver(buildSupplementEntityResolver(supplements)); + chain.addEntityResolver(new MOAEntityResolver()); + entityResolver = chain; + } + + // convert the content into a byte array + try { + switch (content.getContentType()) { + case Content.BINARY_CONTENT : + { + InputStream is = ((ContentBinary) content).getBinaryContent(); + contentBytes = StreamUtils.readStream(is); + break; + } + case Content.LOCREF_CONTENT: + { + ExternalURIResolver uriResolver = new ExternalURIResolver(); + String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); + InputStream is = null; + try + { + is = uriResolver.resolve(locRefURI); + contentBytes = StreamUtils.readStream(is); + } + catch (MOAApplicationException e) + { + throw new MOAApplicationException("3203", new Object[]{reference, locRefURI}, e); + } + finally + { + closeInputStream(is); + } + break; + } + case Content.REFERENCE_CONTENT : + { + ExternalURIResolver uriResolver = new ExternalURIResolver(); + InputStream is = null; + try + { + is = uriResolver.resolve(reference); + contentBytes = StreamUtils.readStream(is); + } + catch (Exception e) + { + throw e; + } + finally + { + closeInputStream(is); + } + break; + } + case Content.XML_CONTENT : + { + Element element = + checkForSingleElement(((ContentXML) content).getXMLContent()); + contentBytes = DOMUtils.serializeNode(element, "UTF-8"); + break; + } + default : + contentBytes = null; // this will not happen + } + } catch (MOAApplicationException e) { + throw e; + } catch (Exception e) { + throw new MOAApplicationException("2219", null); + } + + // try to parse validating + try { + ByteArrayInputStream is = new ByteArrayInputStream(contentBytes); + Document doc = + DOMUtils.parseDocument( + is, + true, + Constants.ALL_SCHEMA_LOCATIONS, + null, + entityResolver, + new MOAErrorHandler()); + + return new XMLDataObjectImpl(doc.getDocumentElement()); + } catch (Exception e) { + // never mind, we'll try non-validating + MessageProvider msg = MessageProvider.getInstance(); + Logger.info(new LogMsg(msg.getMessage("invoker.00", null))); + } + + // try to parse non-validating + try { + ByteArrayInputStream is = new ByteArrayInputStream(contentBytes); + Document doc = DOMUtils.parseDocument(is, false, null, null); + return new XMLDataObjectImpl(doc.getDocumentElement()); + } catch (Exception e) { + throw new MOAApplicationException("2218", null); + } + } + + /** + * Create an XMLDataObject from the given signature environment. + * + * @param signatureEnvironment The signature environment contained in the + * result. + * @param uri The URI identifying the data. This must be either the empty + * URI, an URI starting with "#xpointer", "#xmlns" + * or "#element"; or an URI starting with "#" and + * followed by an element ID. + * @param referenceID The reference ID to set for the data object. + * @return A data object containing the signature environment. + */ + public DataObject createFromSignatureEnvironment( + Element signatureEnvironment, + String uri, + String referenceID) + throws MOAApplicationException { + + DataObjectImpl dataObject = null; + + if ("".equals(uri)) { + dataObject = new XMLDataObjectImpl(signatureEnvironment); + } else if ( + uri.startsWith("#xpointer") + || uri.startsWith("#xmlns") + || uri.startsWith("#element")) { + try { + XPointerReferenceResolver resolver = new XPointerReferenceResolver(); + URI uriObj = new URI(uri); + NodeList nodes = + resolver.resolveForest( + uriObj, + signatureEnvironment.getOwnerDocument(), + null); + dataObject = new XMLNodeListDataObjectImpl(nodes); + } catch (Exception e) { + throw new MOAApplicationException("2237", new Object[] { uri }); + } + } else if (uri.startsWith("#")) { + String id = uri.substring(1); + Element refElem = + signatureEnvironment.getOwnerDocument().getElementById(id); + + if (refElem == null) { + throw new MOAApplicationException("2237", new Object[] { id }); + } + dataObject = new XMLDataObjectImpl(refElem); + } + + dataObject.setReferenceID(referenceID); + dataObject.setURI(uri); + + return dataObject; + } + + /** + * Build a StreamEntityResolver from a List of + * supplements. + * + * @param supplements The supplements, given as + * XMLDataObjectAssociations. + * @return A StreamEntityResolver mapping the supplements by + * their reference URI to an InputStream of their respective + * content. + */ + private static StreamEntityResolver buildSupplementEntityResolver(List supplements) + throws MOAApplicationException + { + Map entities = new HashMap(); + Iterator iter; + + for (iter = supplements.iterator(); iter.hasNext();) { + XMLDataObjectAssociation supplement = + (XMLDataObjectAssociation) iter.next(); + Content content = supplement.getContent(); + String reference = content.getReference(); + + switch (content.getContentType()) { + case Content.BINARY_CONTENT : + { + entities.put(reference, ((ContentBinary) content).getBinaryContent()); + break; + } + case Content.LOCREF_CONTENT: + { + ExternalURIResolver uriResolver = new ExternalURIResolver(); + String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); + InputStream contentIS = null; + InputStream uriStream = null; + try + { + uriStream = uriResolver.resolve(locRefURI); + byte[] contentBytes = StreamUtils.readStream(uriStream); + contentIS = new ByteArrayInputStream(contentBytes); + } + catch (Exception e) + { + throw new MOAApplicationException("3202", new Object[]{reference, locRefURI}, e); + } + finally + { + closeInputStream(uriStream); + } + entities.put(reference, contentIS); + break; + } + case Content.XML_CONTENT : + { + // serialize the first element node that is found in the supplement + // and make it available as a stream + NodeList nodes = ((ContentXML) content).getXMLContent(); + int i = 0; + + // find the first element node + while (i < nodes.getLength() + && nodes.item(i).getNodeType() != Node.ELEMENT_NODE) + i++; + + // serialize the node + if (i < nodes.getLength()) { + try + { + byte[] serialized = DOMUtils.serializeNode(nodes.item(i), "UTF-8"); + entities.put(reference, new ByteArrayInputStream(serialized)); + } + catch (Exception e) + { + throw new MOAApplicationException("2281", new Object[]{reference}, e); + } + } + break; + } + } + } + + return new StreamEntityResolver(entities); + } + + /** + * Create a DataObject from a Content object. + * + * @param content The Content object containing the data. + * @param finalDataMetaInfo The meta information corresponding with content. + * @param referenceID The reference ID to set in the resulting + * DataObject. May be null. + * @param allowContentAndReference If true, then + * content is allowed to contain both a Reference + * attribute and content. Otherwise, either a Reference + * attribute or content must be set. + * @param binaryAsXml If true, a content child given as + * Base64Content must contain XML data. + * @param xmlAsNodeList If true, the children of a + * XMLContent child element are returned as a + * XMLNodeListDataObject. Otherwise, XMLContent may + * only contain a single child node, which must be an element and which is + * returned as an XMLDataObject. + * @param referenceAsXml If true, then content loaded from the + * URI given as the Reference attribute must be XML data. + * If false, an attempt is made to parse the data as XML and + * return an XMLDataObject but if this fails, a + * BinaryDataObject is returned containing a byte stream to the + * data. + * @return A DataObject representing the data in + * content. If base64AsXml==true and + * xmlAsNodeList==false and referenceAsXml==true, + * then the result can safely be cast to an XMLDataObject. + * @throws MOASystemException An error indicating an internal problem. See the + * wrapped exception for details. + * @throws MOAApplicationException An error occurred handling the content + * (probably while opening a reference or parsing the data). See the wrapped + * exception for details. + */ + public DataObject createFromContentOptionalRefType( + Content content, + MetaInfo finalDataMetaInfo, + String referenceID, + boolean allowContentAndReference, + boolean binaryAsXml, + boolean xmlAsNodeList, + boolean referenceAsXml) + throws MOASystemException, MOAApplicationException { + + String reference = content.getReference(); + DataObjectImpl dataObject = null; + + checkAllowContentAndReference(content, allowContentAndReference); + + // ok, build the data object; use content first, if available + switch (content.getContentType()) + { + case Content.XML_CONTENT : + { + ContentXML contentXml = (ContentXML) content; + dataObject = createFromXmlContent(contentXml, xmlAsNodeList); + break; + } + case Content.BINARY_CONTENT : + { + ContentBinary contentBinary = (ContentBinary) content; + dataObject = createFromBinaryContent(contentBinary, binaryAsXml, false); + break; + } + case Content.LOCREF_CONTENT : + { + String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); + try + { + dataObject = createFromURIImpl(locRefURI, referenceAsXml); + } + catch (MOAApplicationException e) + { + throw new MOAApplicationException("3201", new Object[]{reference, locRefURI}, e); + } + break; + } + case Content.REFERENCE_CONTENT : + { + dataObject = createFromURIImpl(reference, referenceAsXml); + break; + } + } + + // set URI and reference ID + dataObject.setURI(reference); + dataObject.setReferenceID(referenceID); + + // set Type gathered from corresponding meta information + dataObject.setTypeURI(finalDataMetaInfo.getType()); + + return dataObject; + } + + /** + * Check, if content and reference URIs are allowed in the content an throw + * an exception if an illegal combination of the two occurs. + * + * @param content The Content to check. + * @param allowContentAndReference Whether explicit content and a reference + * are allowed at the same time. + * @throws MOAApplicationException If allowContentAndRefernece + * is false and both explicit content and reference are set, + * an exception is thrown. + */ + private static void checkAllowContentAndReference( + Content content, + boolean allowContentAndReference) + throws MOAApplicationException { + String reference = content.getReference(); + + // check for content and reference not being set + if (content.getContentType() == Content.REFERENCE_CONTENT + && reference == null) { + String errorCode = allowContentAndReference ? "1111" : "1110"; + throw new MOAApplicationException(errorCode, null); + } + + // if we only allow either content or reference being set at once, check + if (!allowContentAndReference + && (content.getContentType() != Content.REFERENCE_CONTENT) + && (reference != null)) { + throw new MOAApplicationException("1110", null); + } + } + + /** + * Create a DataObject from a + * XMLDataObjectAssociation object. + * + * @param xmlDataObjAssoc The XMLDataObjectAssociation object. + * @param xmlContentAllowed Whether the content contained in the + * xmlDataObjAssoc is allowed to be of type + * XML_CONTENT. + * @param binaryContentRepeatable If binary content must be provided as a + * DataObject that can be read multiple times. + * @return A DataObject representing the data in + * xmlDataObjAssoc. + * @throws MOASystemException An error indicating an internal problem. See the + * wrapped exception for details. + * @throws MOAApplicationException An error occurred handling the content + * (probably while parsing the data). See the wrapped exception for details. + */ + public DataObject createFromXmlDataObjectAssociation( + XMLDataObjectAssociation xmlDataObjAssoc, + boolean xmlContentAllowed, + boolean binaryContentRepeatable) + throws MOASystemException, MOAApplicationException { + + Content content = xmlDataObjAssoc.getContent(); + MetaInfo metaInfo = xmlDataObjAssoc.getMetaInfo(); + String mimeType = metaInfo != null ? metaInfo.getMimeType() : null; + DataObjectImpl dataObject = null; + + switch (content.getContentType()) + { + case Content.XML_CONTENT : + { + if (xmlContentAllowed) + { + dataObject = createFromXmlContent((ContentXML) content, true); + } + else + { + throw new MOAApplicationException("2280", null); + } + break; + } + case Content.BINARY_CONTENT : + { + dataObject = createFromBinaryContent( + (ContentBinary) content, + false, + binaryContentRepeatable); + break; + } + case Content.LOCREF_CONTENT : + { + String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); + try + { + dataObject = createFromURIImpl(locRefURI, false); + } + catch (MOAApplicationException e) + { + throw new MOAApplicationException("3201", new Object[]{content.getReference(), locRefURI}, e); + } + break; + } + } + + dataObject.setURI(content.getReference()); + dataObject.setMimeType(mimeType); + return dataObject; + } + + /** + * Create a DataObject from a TransformParameter + * object. + * + * @param transformParameter The TransformParameter object + * containing the data. + * @return A DataObject representing the data in + * root. + * @throws MOASystemException An error indicating an internal problem. See the + * wrapped exception for details. + * @throws MOAApplicationException An error occurred handling the content + * (probably while opening a reference or parsing the data). See the wrapped + * exception for details. + */ + public DataObject createFromTransformParameter(TransformParameter transformParameter) + throws MOASystemException, MOAApplicationException { + + DataObjectImpl dataObject; + + switch (transformParameter.getTransformParameterType()) { + case TransformParameter.BINARY_TRANSFORMPARAMETER : + TransformParameterBinary tpBinary = + (TransformParameterBinary) transformParameter; + + try { + //dataObject = new ByteArrayDataObjectImpl(Base64Utils.encode(tpBinary.getBinaryContent())); + dataObject = + new ByteArrayDataObjectImpl( + StreamUtils.readStream(tpBinary.getBinaryContent())); + } catch (Exception e) { + return null; + } + //dataObject = new ByteStreamDataObjectImpl(tpBinary.getBinaryContent()); + break; + default : + // resolve uri and build the content + ExternalURIResolver resolver = new ExternalURIResolver(); + InputStream is = resolver.resolve(transformParameter.getURI()); + ByteArrayInputStream bis; + try + { + bis = new ByteArrayInputStream(StreamUtils.readStream(is)); + } + catch (IOException e) + { + throw new MOAApplicationException("2238", new Object[] {transformParameter.getURI()}, e); + } + finally + { + closeInputStream(is); + } + String contentType = resolver.getContentType(); + dataObject = new ByteStreamDataObjectImpl(bis); + dataObject.setMimeType(contentType); + break; + } + + dataObject.setURI(transformParameter.getURI()); + + return dataObject; + } + + /** + * Create a DataObject from data located at the given URI. + * + * @param uri The URI where the data is located. This method uses + * an ExternalURIResolver to resolve URIs. + * @param asXml If true, a DataObject is only + * returned, if the content consists of XML data. If it does not consist of + * XML data, an MOAApplicationException will be thrown. If this + * parameter is false and the content consists of XML data, this + * method will still attempt to parse it. + * @return The DataObject contained at the URI. + * @throws MOASystemException A system error parsing the XML content. + * @throws MOAApplicationException An error occurred on opening, reading or + * parsing the data behind the URI. + */ + public DataObject createFromURI(String uri, boolean asXml) + throws MOASystemException, MOAApplicationException { + return createFromURIImpl(uri, asXml); + } + + /** + * Create a DataObject from data located at the given URI. + * + * @param uri The URI where the data is located. This method uses + * an ExternalURIResolver to resolve URIs. + * @param asXml If true, a DataObject is only + * returned, if the content consists of XML data. If it does not consist of + * XML data, an MOAApplicationException will be thrown. If this + * parameter is false and the content type is detected as being + * XML data, this method will still attemt to parse it. + * @return The DataObject contained at the URI. + * @throws MOASystemException A system error parsing the XML content. + * @throws MOAApplicationException An error occurred on opening, reading or + * parsing the data behind the URI. + */ + private DataObjectImpl createFromURIImpl(String uri, boolean asXml) + throws MOASystemException, MOAApplicationException { + + ExternalURIResolver resolver = new ExternalURIResolver(); + InputStream is = resolver.resolve(uri); + String contentType = resolver.getContentType(); + DataObjectImpl dataObject; + + // read the content + if (contentType != null && contentTypeIsXml(contentType)) { + Document doc; + + if (asXml) { + try { + // try parsing non-validating: this has to succeed or we + // bail out by throwing an exception + is = resolver.resolve(uri); + doc = DOMUtils.parseDocument(is, false, null, null); + dataObject = new XMLDataObjectImpl(doc.getDocumentElement()); + } catch (ParserConfigurationException e) { + throw new MOASystemException("1106", null, e); + } catch (SAXException e) { + throw new MOAApplicationException("2209", null, e); + } catch (IOException e) { + throw new MOAApplicationException("2210", null, e); + } + finally + { + closeInputStream(is); + } + } else { + try { + // try parsing non-validating: need not succeed + is = resolver.resolve(uri); + doc = DOMUtils.parseDocument(is, false, null, null); + closeInputStream(is); + dataObject = new XMLDataObjectImpl(doc.getDocumentElement()); + } catch (Exception e) { + // this is the last chance: return the data as a byte stream + is = resolver.resolve(uri); + ByteArrayInputStream bis; + try + { + bis = new ByteArrayInputStream(StreamUtils.readStream(is)); + dataObject = new ByteStreamDataObjectImpl(bis); + } + catch (IOException e1) + { + throw new MOAApplicationException("2210", new Object[] { uri }, e1); + } + finally + { + closeInputStream(is); + } + } + } + } + else if (asXml) + { + // if we need XML data, we're in the wrong place here + closeInputStream(is); + throw new MOAApplicationException("2211", new Object[] { uri }); + } + else + { + // content is binary: make it available as a binary input stream + ByteArrayInputStream bis; + try + { + bis = new ByteArrayInputStream(StreamUtils.readStream(is)); + } + catch (IOException e) + { + throw new MOAApplicationException("2210", null, e); + } + finally + { + closeInputStream(is); + } + dataObject = new ByteStreamDataObjectImpl(bis); + } + + dataObject.setMimeType(contentType); + dataObject.setURI(uri); + + return dataObject; + } + + /** + * Savely closes the specified input stream. + * + * @param is The input stream to be closed. + */ + private static void closeInputStream(InputStream is) + { + try + { + if (is != null) is.close(); + } + catch (Throwable t) + { + // Intentionally do nothing here + } + } + + /** + * Determine whether the content type is XML. + * + * Content types recognized as XML start with text/xml and + * application/xml. + * + * @param contentType The content MIME type. + * @return boolean If true, the content type is XML, otherwise + * not. + */ + private static boolean contentTypeIsXml(String contentType) { + return contentType.startsWith("text/xml") + || (contentType.startsWith("application/xml")); + } + + /** + * Create a DataObject from a ContentXML object. + * + * @param xmlContent The ContentXML object from + * which the DataObject is to be built. + * @param xmlAsNodeList If true, the children of + * xmlContent are returned as a + * XMLNodeListDataObject. Otherwise, + * xmlContent may only contain a single child node, which must be + * an element and which is returned as an XMLDataObject. + * @return A DataObject representing the XML content in + * xmlContent. + * @throws MOAApplicationException If xmlAsNodeList is + * false and xmlContent does not have a single child + * element. + */ + private DataObjectImpl createFromXmlContent( + ContentXML xmlContent, + boolean xmlAsNodeList) + throws MOAApplicationException { + + DataObjectImpl dataObject; + + if (xmlAsNodeList) { + dataObject = new XMLNodeListDataObjectImpl(xmlContent.getXMLContent()); + } else { + NodeList nodes = xmlContent.getXMLContent(); + Element element = checkForSingleElement(nodes); + + // build the XMLDataObject + dataObject = new XMLDataObjectImpl(element); + } + return dataObject; + } + + /** + * Check, that the given NodeList contains a single DOM element + * node and return it, otherwise throw an exception. + * + * @param nodes The NodeList to check for a single element. + * @return The single element contained in nodes. + * @throws MOAApplicationException Thrown, if nodes does not + * contain exactly 1 element node. + */ + private Element checkForSingleElement(NodeList nodes) + throws MOAApplicationException { + + Element element = null; + int i; + + // check for a single element node + for (i = 0; i < nodes.getLength(); i++) { + if (nodes.item(i).getNodeType() == Node.ELEMENT_NODE) { + if (element == null) { + element = (Element) nodes.item(i); + } else { + throw new MOAApplicationException("1109", null); + } + } + } + + // return the element node + if (element == null) { + throw new MOAApplicationException("1107", null); + } else { + return element; + } + } + + /** + * Create a DataObject from a ContentBinary object. + * + * @param binaryContent The ContentBinary object containing the + * data. + * @param asXml If true, binaryContent must + * contain XML data. Otherwise, a BinaryDataObject will be + * returned containing a byte stream to the decoded Base64 data. + * @param repeatable If multiple calls to getInputStream() must + * repeatedly return the content of the data object. + * @return A DataObject representing the content contained in + * binaryContent. + * @throws MOASystemException An error indicating an internal problem. See the + * wrapped exception for details. + * @throws MOAApplicationException An error occurred handling the content + * (probably while parsing the data). See the wrapped exception for details. + */ + private DataObjectImpl createFromBinaryContent( + ContentBinary binaryContent, + boolean asXml, + boolean repeatable) + throws MOASystemException, MOAApplicationException { + + InputStream byteStream = binaryContent.getBinaryContent(); + DataObjectImpl dataObject; + + if (asXml) { + Document doc; + + try { + doc = DOMUtils.parseDocument(byteStream, false, null, null); + dataObject = new XMLDataObjectImpl(doc.getDocumentElement()); + } catch (ParserConfigurationException e) { + throw new MOASystemException("1106", null, e); + } catch (SAXException e) { + throw new MOAApplicationException("2209", null, e); + } catch (IOException e) { + throw new MOAApplicationException("2210", null, e); + } + } else { + if (repeatable) { + try { + dataObject = + new ByteArrayDataObjectImpl(StreamUtils.readStream(byteStream)); + } catch (IOException e) { + throw new MOAApplicationException("2210", null); + } + } else { + dataObject = new ByteStreamDataObjectImpl(byteStream); + } + } + + return dataObject; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java new file mode 100644 index 000000000..106742067 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java @@ -0,0 +1,162 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import iaik.ixsil.exceptions.URIException; +import iaik.ixsil.util.URI; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Resolve external URIs and provide them as a stream. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ExternalURIResolver { + + /** The MIME type of the content currently resolved. */ + private String contentType; + + /** + * Return a stream to data at the given URI. + * + * This method will try to open an URLConnection to the given + * URI. Access to the file system is disallowed. + * + * @param uriStr The URI to resolve. + * @return InputStream The data contained at the URI. + * @throws MOAApplicationException An error occurred resolving the URI (e.g., + * the URI is syntactically incorrect or the stream could not be opened). + */ + public InputStream resolve(String uriStr) throws MOAApplicationException { + URI uri; + URL url; + URLConnection connection; + InputStream is; + + // build the URI + try { + uri = new URI(uriStr); + } catch (URIException e) { + throw new MOAApplicationException("2207", new Object[] { uriStr }); + } + + // disallow access to local file system + if ("".equals(uri.getScheme()) || "file".equals(uri.getScheme())) { + throw new MOAApplicationException("2213", new Object[] { uriStr }); + } + + // if we have local content (SOAP with attachments) + if ("formdata".equals(uri.getScheme())) { + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); + if (context==null) { + //no transaction + throw new MOAApplicationException("2282", new Object[] { uri }); + } else { + + InputStream attachmentIs = context.getAttachmentInputStream(uri); + if (attachmentIs != null) { + setContentType(context.getAttachmentContentType(uri.getPath())); + return attachmentIs; + } else { + //maybe attachments provided but no suiting attachment found + throw new MOAApplicationException("2282", new Object[] { uri }); + } +/* + try { + InputStream attachmentIs = context.getAttachment(uri).getInputStream(); + if (attachmentIs != null) { + setContentType(context.getAttachmentContentType(uri.getPath())); + return attachmentIs; + } else { + //maybe attachments provided but no suiting attachment found + throw new MOAApplicationException("2282", new Object[] { uri }); + } + } catch (IOException e) { + throw new MOAApplicationException("2208", new Object[] { uri }, e); + } +*/ + } + } + + // convert URI to URL + try { + // create the URL + url = new URL(uriStr); + } catch (MalformedURLException e) { + throw new MOAApplicationException("2214", new Object[] { uriStr }); + } + + // build the URLConnection + try { + connection = url.openConnection(); + if ("http".equals(url.getProtocol())) { + HttpURLConnection httpConnection = (HttpURLConnection) connection; + + httpConnection.connect(); + if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK) { + throw new MOAApplicationException("2208", new Object[] { uri }); + } + } else if ("https".equals(url.getProtocol())) { + /* + * this doesn't work because of some interaction between the IAIK + * JCE and Sun JSSE that results in an "Invalid AVA format" exception + */ + + /* + HttpsURLConnection httpsConnection = (HttpsURLConnection) connection; + InputStream trustStore = + getClass().getResourceAsStream(DEFAULT_TRUST_STORE); + SSLSocketFactory factory = + SSLUtils.getSSLSocketFactory("jks", trustStore, "changeit"); + httpsConnection.setSSLSocketFactory(factory); + httpsConnection.connect(); + if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK) { + throw new MOAApplicationException("2208", new Object[] { uri }); + } + */ + connection.connect(); + } else { + connection.connect(); + } + is = connection.getInputStream(); + } catch (IOException e) { + throw new MOAApplicationException("2208", new Object[] { uri }, e); + } /*catch (GeneralSecurityException e) { + throw new MOAApplicationException("2208", new Object[] { uri }, e); + }*/ + + // set the content type + setContentType(connection.getContentType()); + + return is; + } + + /** + * Set the content type of the data at the URI. + * + * @param contentType The content type to set. + */ + protected void setContentType(String contentType) { + this.contentType = contentType; + } + + /** + * Return the content type of the data detected at the URI from the previous + * call of resolve(). + * + * @return String The content type. + */ + public String getContentType() { + return contentType; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java new file mode 100644 index 000000000..60f573e5a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java @@ -0,0 +1,267 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.Map; + +import iaik.IAIKException; +import iaik.IAIKRuntimeException; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.MOASystemException; + + +/** + * Map an exception from the iaik namespace to a + * MOAException. + * + * @author Patrick Peck + * @version $Id$ + */ +public class IaikExceptionMapper { + + /** The argument classes for MOAExceptions. */ + private static final Class[] CONSTRUCTOR_ARGS = + new Class[] { String.class, Object[].class, Throwable.class }; + /** The exception mapping, as an array. */ + private static final Object[][] MESSAGES = + { + { iaik.IAIKException.class, "9900", MOASystemException.class }, + { iaik.IAIKRuntimeException.class, "9901", MOASystemException.class }, + { iaik.server.modules.xmlsign.XMLSignatureCreationException.class, "2220", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.XMLSignatureCreationRuntimeException.class, "2220", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.InvalidKeyException.class, "2221", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.ManifestException.class, "2222", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.ReferenceException.class, "2223", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.HashUnavailableException.class, "2224", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.SignatureAlgorithmException.class, "2225", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.SignatureEmbeddingException.class, "2226", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.SignatureValueException.class, "2227", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.SignedPropertyException.class, "2228", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.SignerCertificateUnavailableException.class, "2229", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.SupplementException.class, "2230", MOAApplicationException.class }, + { iaik.server.modules.xmlsign.TransformationException.class, "2233", MOAApplicationException.class }, + { iaik.server.modules.cmsverify.CMSSignatureVerificationException.class, "2240", MOAApplicationException.class }, + { iaik.server.modules.cmsverify.CMSSignatureVerificationRuntimeException.class, "2240", MOAApplicationException.class }, + { iaik.server.modules.cmsverify.AlgorithmNotSupportedException.class, "2241", MOAApplicationException.class }, + { iaik.server.modules.cmsverify.CMSSignatureParsingException.class, "2242", MOAApplicationException.class }, + { iaik.server.modules.cmsverify.SignerCertificateUnavailableException.class, "2243", MOAApplicationException.class }, + { iaik.server.modules.cmsverify.CMSSignatureVerificationRuntimeException.class, "2247", MOAApplicationException.class }, + { iaik.server.modules.cmsverify.InitException.class, "2248", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.XMLSignatureVerificationException.class, "2240", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.XMLSignatureVerificationRuntimeException.class, "2240", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.AlgorithmNotSupportedException.class, "2241", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.ManifestException.class, "2262", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.PropertiesException.class, "2263", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.ReferenceException.class, "2264", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.HashUnavailableException.class, "2224", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.SignerCertificateUnavailableException.class, "2243", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.SupplementException.class, "2230", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.TransformationException.class, "2265", MOAApplicationException.class }, + { iaik.server.modules.xmlverify.TransformationParsingException.class, "2269", MOAApplicationException.class } + }; + + /** The single instance of this class. */ + private static IaikExceptionMapper instance; + /** The exception mapping, as a Map for fast lookup. */ + private Map messages = new HashMap(); + + /** + * Get the single instance of this class. + * + * @return The single instance of this class. + */ + public static synchronized IaikExceptionMapper getInstance() { + if (instance == null) { + instance = new IaikExceptionMapper(); + } + return instance; + } + + /** + * Create a new IaikExceptionMapper. + * + * Protected to disallow multple instances. + */ + protected IaikExceptionMapper() { + registerMessages(); + } + + /** + * Build the complete IAIKException to message code mapping. + */ + protected void registerMessages() { + int i; + + for (i = 0; i < MESSAGES.length; i++) { + registerMessage( + (Class) MESSAGES[i][0], + (String) MESSAGES[i][1], + (Class) MESSAGES[i][2]); + } + } + + /** + * Register a single IAIKException to message mapping. + * + * @param iaikExceptionClass An exception from the iaik package. + * @param messageId The corresponding error message id. + * @param moaExceptionClass The type of MOAException that the + * IAIKException is mapped to (usually + * MOAApplicationException or MOASystemException). + */ + protected void registerMessage( + Class iaikExceptionClass, + String messageId, + Class moaExceptionClass) { + + messages.put( + iaikExceptionClass, + new ExceptionMappingInfo(messageId, moaExceptionClass)); + } + + /** + * Map an IAIKException to a MOAException. + * + * @param iaikException The IAIKException to map. + * @return A MOAException containing the message for the + * given IAIKException. + */ + public MOAException map(IAIKException iaikException) { + return mapImpl(iaikException); + } + + /** + * Map an IAIKRuntimeException to a MOAException. + * + * @param iaikException The IAIKException to map. + * @return A MOAException containing the message for the + * given IAIKRuntimeException. + */ + public MOAException map(IAIKRuntimeException iaikException) { + return mapImpl(iaikException); + } + + /** + * Map an IAIKException or IAIKRuntimeException to a + * MOAException. + * + * @param iaikException The IAIKException or + * IAIKRuntimeException to map. + * @return A MOAException containing the message for the + * given IAIKRuntimeException. + */ + private MOAException mapImpl(Exception iaikException) { + MOAException moaException = createMoaException(iaikException); + + if (moaException == null) { + return new MOASystemException("9999", null, iaikException); + } + return moaException; + } + + /** + * Create a MOAException from a given IAIKException + * by looking it up in the mapping. + * + * @param iaikException The IAIKException to map. + * @return A MOAException with an error code corresponding to + * the given IAIKException. Returns null, if no + * mapping could be found. + */ + protected MOAException createMoaException(Exception iaikException) { + ExceptionMappingInfo info = lookupMessage(iaikException.getClass()); + Constructor constructor; + + if (info == null) { + return null; + } + + // instantiate the proper MOAException and return it + try { + constructor = + info.getMoaExceptionClass().getConstructor(CONSTRUCTOR_ARGS); + return (MOAException) constructor.newInstance( + new Object[] { + info.getMessageId(), + new Object[] { iaikException.getMessage()}, + iaikException }); + } catch (Exception e) { + return null; + } + } + + /** + * Recursively look up the message associated with an + * IAIKException. + * + * This method walks up the exception inheritance hierarchy until it finds a + * mapping. + * + * @param iaikExceptionClass The IAIKException to look up. + * @return Information about the message id and + * MOAException class that the iaikExceptionClass + * maps to. If no mapping could be found, null is returned. + */ + protected ExceptionMappingInfo lookupMessage(Class iaikExceptionClass) { + ExceptionMappingInfo info; + + // break if + if (iaikExceptionClass.equals(Exception.class)) { + return null; + } + + // look up the exception class + info = (ExceptionMappingInfo) messages.get(iaikExceptionClass); + if (info == null) { + return lookupMessage(iaikExceptionClass.getSuperclass()); + } + return info; + } + +} + +/** + * A class containing a mapping from an error message ID to a + * MOAException class. + * + * @author Patrick Peck + * @version $Id$ + */ +class ExceptionMappingInfo { + /** The message ID. */ + private String messageId; + /** The MOAException class. */ + private Class moaExceptionClass; + + /** + * Create a new ExceptionMappingInfo. + * + * @param messageId The message ID. + * @param moaExceptionClass The MOAException class. + */ + public ExceptionMappingInfo(String messageId, Class moaExceptionClass) { + this.messageId = messageId; + this.moaExceptionClass = moaExceptionClass; + } + + /** + * Return the message ID. + * + * @return The message ID. + */ + public String getMessageId() { + return messageId; + } + + /** + * Returns the MOAException class that the message ID maps to. + * + * @return The MOAException class. + */ + public Class getMoaExceptionClass() { + return moaExceptionClass; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java new file mode 100644 index 000000000..0c3b45539 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java @@ -0,0 +1,63 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.util.XPathException; +import at.gv.egovernment.moa.util.XPathUtils; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.common.ElementSelector; + +/** + * Utility methods for invoking the IAIK MOA modules. + * + * @author Patrick Peck + * @version $Id$ + */ +public class InvokerUtils { + + /** + * Select the signature parent element. + * + * @param root The root DOM element which contains the signature parent + * element somewhere in its subtree. + * @param location The ElementSelector containing the XPath + * expression to select the signature parent element from the document. + * It is also contains the namespace prefix to URI mapping. + * @return Element The signature parent element. + * @throws MOAApplicationException An error occurred evaluating the + * location. + */ + public static Element evaluateSignatureLocation( + Element root, + ElementSelector location) + throws MOAApplicationException { + + NodeList nodes; + + try { + nodes = + XPathUtils.selectNodeList( + root, + location.getNamespaceDeclarations(), + location.getXPathExpression()); + } catch (XPathException e) { + throw new MOAApplicationException( + "2212", + new Object[] { location.getXPathExpression()}, + e); + } + + if (nodes.getLength() != 1 + || !(nodes.item(0).getNodeType() == Node.ELEMENT_NODE)) { + throw new MOAApplicationException( + "2212", + new Object[] { location.getXPathExpression()}); + } + return (Element) nodes.item(0); + } + + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java new file mode 100644 index 000000000..158a3ddb5 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java @@ -0,0 +1,249 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.xmlbind.ProfileParser; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfile; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileID; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfile; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileID; +import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfile; +import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfileID; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfile; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileID; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; + +/** + * Map ProfileID objects to their explicit represantation. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ProfileMapper { + + /** The parser to parse the profiles. */ + private static ProfileParser profileParser = new ProfileParser(); + + /** + * Map a CreateTransformsInfoProfile to a + * CreateTransformsInfoProfileExplicit. + * + * @param profile The profile object to map. + * @param config The MOA configuration to use for looking up the profile. + * @return profile, if the given profile is of type + * EXPLICIT_CREATETRANSFORMSINFOPROFILE, otherwise the profile + * that is looked up and parsed from the configuration. + * @throws MOAApplicationException An error occurred parsing the profile. + */ + public static CreateTransformsInfoProfileExplicit mapCreateTransformsInfoProfile( + CreateTransformsInfoProfile profile, + ConfigurationProvider config) + throws MOAApplicationException { + + switch (profile.getCreateTransformsInfoProfileType()) { + case CreateTransformsInfoProfile.EXPLICIT_CREATETRANSFORMSINFOPROFILE : + return (CreateTransformsInfoProfileExplicit) profile; + + case CreateTransformsInfoProfile.ID_CREATETRANSFORMSINFOPROFILE : + CreateTransformsInfoProfileID profileIdObj = + (CreateTransformsInfoProfileID) profile; + String profileID = profileIdObj.getCreateTransformsInfoProfileID(); + Element profileElem = config.getCreateTransformsInfoProfile(profileID); + + if (profileElem == null) { + throw new MOAApplicationException("2234", new Object[] { profileID }); + } + + return ( + CreateTransformsInfoProfileExplicit) profileParser + .parseCreateTransformsInfoProfile( + profileElem); + } + return null; // this will not happen + } + + /** + * Map a CreateSignatureEnvironmentProfile to a + * CreateSignatureEnvironmentProfileExplicit. + * + * @param profile The profile object to map. + * @param config The MOA configuration to use for looking up the profile. + * @return profile, if the given profile is of type + * EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE, otherwise the + * profile that is looked up and parsed from the configuration. + * @throws MOAApplicationException An error occurred parsing the profile. + */ + public static CreateSignatureEnvironmentProfileExplicit mapCreateSignatureEnvironmentProfile( + CreateSignatureEnvironmentProfile profile, + ConfigurationProvider config) + throws MOAApplicationException { + + switch (profile.getCreateSignatureEnvironmentProfileType()) { + case CreateSignatureEnvironmentProfile + .EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE : + + return (CreateSignatureEnvironmentProfileExplicit) profile; + + case CreateSignatureEnvironmentProfile + .ID_CREATESIGNATUREENVIRONMENTPROFILE : + + CreateSignatureEnvironmentProfileID profileIdObj = + (CreateSignatureEnvironmentProfileID) profile; + String profileID = + profileIdObj.getCreateSignatureEnvironmentProfileID(); + Element profileElem = + config.getCreateSignatureEnvironmentProfile(profileID); + + if (profileElem == null) { + throw new MOAApplicationException("2236", new Object[] { profileID }); + } + + return ( + CreateSignatureEnvironmentProfileExplicit) profileParser + .parseCreateSignatureEnvironmentProfile( + profileElem); + + } + return null; + + } + + /** + * Map a List of SupplementProfiles to their + * explicit representation. + * + * @param profiles The profiles to map. + * @param config The MOA configuration to use for looking up profiles. + * @return The mapped profiles. + * @throws MOAApplicationException An error occurred mapping one of the + * profiles. + */ + public static List mapSupplementProfiles( + List profiles, + ConfigurationProvider config) + throws MOAApplicationException { + + List mappedProfiles = new ArrayList(); + Iterator iter; + + for (iter = profiles.iterator(); iter.hasNext();) { + SupplementProfile profile = (SupplementProfile) iter.next(); + mappedProfiles.add(mapSupplementProfile(profile, config)); + } + + return mappedProfiles; + } + + /** + * Map a SupplementProfile to a + * SupplementProfileExplicit. + * + * @param profile The profile object to map. + * @param config The MOA configuration to use for looking up the profile. + * @return profile, if the given profile is of type + * EXPLICIT_SUPPLEMENTPROFILE, otherwise the + * profile that is looked up and parsed from the configuration. + * @throws MOAApplicationException An error occurred parsing the profile. + */ + public static SupplementProfileExplicit mapSupplementProfile( + SupplementProfile profile, + ConfigurationProvider config) + throws MOAApplicationException { + + switch (profile.getSupplementProfileType()) { + case SupplementProfile.EXPLICIT_SUPPLEMENTPROFILE : + return (SupplementProfileExplicit) profile; + + case SupplementProfile.ID_SUPPLEMENTPROFILE : + SupplementProfileID profileIdObj = (SupplementProfileID) profile; + String profileID = profileIdObj.getSupplementProfileID(); + Element profileElem = config.getSupplementProfile(profileID); + + if (profileElem == null) { + throw new MOAApplicationException("2267", new Object[] { profileID }); + } + + return ( + SupplementProfileExplicit) profileParser.parseSupplementProfile( + profileElem); + } + + return null; + } + + /** + * Map a List of VerifyTransformsInfoProfiles to + * their explicit representation. + * + * @param profiles The profiles to map. + * @param config The MOA configuration to use for looking up profiles. + * @return The mapped profiles. + * @throws MOAApplicationException An error occurred mapping one of the + * profiles. + */ + public static List mapVerifyTransformsInfoProfiles( + List profiles, + ConfigurationProvider config) + throws MOAApplicationException { + + List mappedProfiles = new ArrayList(); + Iterator iter; + + for (iter = profiles.iterator(); iter.hasNext();) { + VerifyTransformsInfoProfile profile = + (VerifyTransformsInfoProfile) iter.next(); + mappedProfiles.add(mapVerifyTransformsInfoProfile(profile, config)); + } + + return mappedProfiles; + } + + /** + * Map a VerifyTransformsInfoProfile to a + * VerifyTransformsInfoProfileExplicit. + * + * @param profile The profile object to map. + * @param config The MOA configuration to use for looking up the profile. + * @return profile, if the given profile is of type + * EXPLICIT_VERIFYTRANSFORMSINFOPROFILE, otherwise the + * profile that is looked up and parsed from the configuration. + * @throws MOAApplicationException An error occurred parsing the profile. + */ + public static VerifyTransformsInfoProfileExplicit mapVerifyTransformsInfoProfile( + VerifyTransformsInfoProfile profile, + ConfigurationProvider config) + throws MOAApplicationException { + + switch (profile.getVerifyTransformsInfoProfileType()) { + case VerifyTransformsInfoProfile.EXPLICIT_VERIFYTRANSFORMSINFOPROFILE : + return (VerifyTransformsInfoProfileExplicit) profile; + + case VerifyTransformsInfoProfile.ID_VERIFYTRANSFORMSINFOPROFILE : + VerifyTransformsInfoProfileID profileIdObj = + (VerifyTransformsInfoProfileID) profile; + String profileID = profileIdObj.getVerifyTransformsInfoProfileID(); + Element profileElem = + config.getVerifyTransformsInfoProfile(profileID); + + if (profileElem == null) { + throw new MOAApplicationException("2268", new Object[] { profileID }); + } + + return ( + VerifyTransformsInfoProfileExplicit) profileParser + .parseVerifyTransformsInfoProfile( + profileElem); + } + + return null; + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java new file mode 100644 index 000000000..11f05a2f1 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java @@ -0,0 +1,51 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; + +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.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * A utility class for setting up and tearing down thread-local context + * information needed for calling the Invoker classes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ServiceContextUtils { + + /** + * Set up the thread-local context information needed for calling the various + * Invoker classes. + * + * @throws ConfigurationException An error occurred setting up the + * configuration in the TransactionContext. + */ + public static void setUpContexts() throws ConfigurationException { + TransactionContextManager txMgr = TransactionContextManager.getInstance(); + LoggingContextManager logMgr = LoggingContextManager.getInstance(); + String transactionID = Thread.currentThread().getName(); + + if (txMgr.getTransactionContext() == null) { + TransactionContext ctx = new TransactionContext(transactionID, null, ConfigurationProvider.getInstance()); + txMgr.setTransactionContext(ctx); + } + + if (logMgr.getLoggingContext() == null) { + LoggingContext ctx = new LoggingContext(transactionID); + logMgr.setLoggingContext(ctx); + } + } + + /** + * Tear down thread-local context information. + */ + public static void tearDownContexts() { + TransactionContextManager.getInstance().setTransactionContext(null); + LoggingContextManager.getInstance().setLoggingContext(null); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java new file mode 100644 index 000000000..dc5ceb21e --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java @@ -0,0 +1,45 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import java.util.Collections; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.api.Configurator; +import at.gv.egovernment.moa.spss.api.SignatureCreationService; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; + +/** + * An implementation of the SignatureCreationService, using + * the XMLSignatureCreationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SignatureCreationServiceImpl extends SignatureCreationService { + + /** + * Create an XML signature. + * + * @param request The CreateXMLSignatureRequest containing + * information about the signature(s) to create. + * @return The created signature(s). + * @throws MOAException An error occurred creating the signature(s). + */ + public CreateXMLSignatureResponse createXMLSignature(CreateXMLSignatureRequest request) + throws MOAException { + + XMLSignatureCreationInvoker invoker = + XMLSignatureCreationInvoker.getInstance(); + CreateXMLSignatureResponse response; + + try { + Configurator.getInstance().init(); + ServiceContextUtils.setUpContexts(); + response = invoker.createXMLSignature(request, Collections.EMPTY_SET); + return response; + } finally { + ServiceContextUtils.tearDownContexts(); + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java new file mode 100644 index 000000000..94cdea5d9 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java @@ -0,0 +1,72 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.api.Configurator; +import at.gv.egovernment.moa.spss.api.SignatureVerificationService; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; + +/** + * An implementation of the SignatureVerificationService using + * the XMLSignatureVerificationInvoker and the + * CMSSignatureVerificationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SignatureVerificationServiceImpl + extends SignatureVerificationService { + + /** + * Verify a CMS signature. + * + * @param request The VerifyCMSSignatureRequest containing + * information about the signature verification. + * @return The result of the signature verification. + * @throws MOAException An error occurred during signature verification. + */ + public VerifyCMSSignatureResponse verifyCMSSignature(VerifyCMSSignatureRequest request) + throws MOAException { + + CMSSignatureVerificationInvoker invoker = + CMSSignatureVerificationInvoker.getInstance(); + VerifyCMSSignatureResponse response; + + try { + Configurator.getInstance().init(); + ServiceContextUtils.setUpContexts(); + response = invoker.verifyCMSSignature(request); + return response; + } finally { + ServiceContextUtils.tearDownContexts(); + } + } + + /** + * Verify an XML signature. + * + * @param request The VerifyXMLSignatureRequest containinig + * information about the signature verification. + * @return The result of the signature verification. + * @throws MOAException An error occurred during signature verification. + */ + public VerifyXMLSignatureResponse verifyXMLSignature(VerifyXMLSignatureRequest request) + throws MOAException { + + XMLSignatureVerificationInvoker invoker = + XMLSignatureVerificationInvoker.getInstance(); + VerifyXMLSignatureResponse response; + + try { + Configurator.getInstance().init(); + ServiceContextUtils.setUpContexts(); + response = invoker.verifyXMLSignature(request); + return response; + } finally { + ServiceContextUtils.tearDownContexts(); + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java new file mode 100644 index 000000000..9984a95a5 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java @@ -0,0 +1,258 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import iaik.server.modules.xml.Base64Transformation; +import iaik.server.modules.xml.Canonicalization; +import iaik.server.modules.xml.EnvelopedSignatureTransformation; +import iaik.server.modules.xml.Transformation; +import iaik.server.modules.xml.XPath2Transformation; +import iaik.server.modules.xml.XPathTransformation; +import iaik.server.modules.xml.XSLTTransformation; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform; +import at.gv.egovernment.moa.spss.api.common.Transform; +import at.gv.egovernment.moa.spss.api.common.XPathFilter; +import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform; +import at.gv.egovernment.moa.spss.api.common.XPathTransform; +import at.gv.egovernment.moa.spss.api.common.XSLTTransform; +import at.gv.egovernment.moa.spss.server.iaik.xml.Base64TransformationImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.CanonicalizationImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.EnvelopedSignatureTransformationImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.ExclusiveCanonicalizationImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XPath2FilterImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XPath2TransformationImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XPathTransformationImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XSLTTransformationImpl; + +/** + * A factory to create Transformation objects from + * Transform objects. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TransformationFactory { + + + /** The single instance of this class. */ + private static TransformationFactory instance = null; + + /** Maps XPathFilter filter types to + * XPath2Transformation filter types. */ + private static Map FILTER_TYPE_MAPPING; + + static { + FILTER_TYPE_MAPPING = new HashMap(); + + FILTER_TYPE_MAPPING.put( + XPathFilter.INTERSECT_TYPE, + XPath2Transformation.XPath2Filter.INTERSECTION); + FILTER_TYPE_MAPPING.put( + XPathFilter.SUBTRACT_TYPE, + XPath2Transformation.XPath2Filter.SUBTRACTION); + FILTER_TYPE_MAPPING.put( + XPathFilter.UNION_TYPE, + XPath2Transformation.XPath2Filter.UNION); + } + + /** + * Get the single instance of the factory. + * + * @return TransformationFactory The single instance. + */ + public static synchronized TransformationFactory getInstance() { + if (instance == null) { + instance = new TransformationFactory(); + } + return instance; + } + + /** + * Create a new TransformationFactory. + * + * Protected to disallow multiple instances. + */ + protected TransformationFactory() { + } + + /** + * Create a Transformation based on a + * Transform object. + * + * @param transform The Transform object to extract + * transformation data from. + * @return The transformation contained in the transform + * object. + * @throws MOAApplicationException An error occured creating the + * Transformation. See exception message for details. + */ + public Transformation createTransformation(Transform transform) + throws MOAApplicationException { + String algorithmUri = transform.getAlgorithmURI(); + + if (Canonicalization.CANONICAL_XML.equals(algorithmUri) + || Canonicalization.CANONICAL_XML_WITH_COMMENTS.equals(algorithmUri)) { + return createC14nTransformation(algorithmUri); + } else if ( + Canonicalization.EXCLUSIVE_CANONICAL_XML.equals(algorithmUri) + || Canonicalization.EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS.equals( + algorithmUri)) { + + return createExclusiveC14nTransformation( + (ExclusiveCanonicalizationTransform) transform); + + } else if (Base64Transformation.ALL.contains(algorithmUri)) { + return createBase64Transformation(); + } else if (EnvelopedSignatureTransformation.ALL.contains(algorithmUri)) { + return createEnvelopedSignatureTransformation(); + } else if (XPathTransformation.ALL.contains(algorithmUri)) { + return createXPathTransformation((XPathTransform) transform); + } else if (XPath2Transformation.ALL.contains(algorithmUri)) { + return createXPath2Transformation((XPathFilter2Transform) transform); + } else if (XSLTTransformation.ALL.contains(algorithmUri)) { + return createXSLTTransformation((XSLTTransform) transform); + } else { + throw new MOAApplicationException("1108", new Object[] { algorithmUri }); + } + } + + /** + * Create a List of Transformations from a + * List of Transforms. + * + * @param transforms The List containing the + * Transforms. + * @return The List of Transformations corresponding + * to the transforms. + * @throws MOAApplicationException An error occurred building one of the + * transformations. See exception message for details. + */ + public List createTransformationList(List transforms) + throws MOAApplicationException { + List transformationList = new ArrayList(); + Iterator trIter; + + for (trIter = transforms.iterator(); trIter.hasNext();) { + Transform transform = (Transform) trIter.next(); + transformationList.add(createTransformation(transform)); + } + + return transformationList; + } + + /** + * Create a Canonicalization. + * + * @param algorithmUri The algorithm URI of the canonicalization. + * @return The Canonicalization. + */ + private Transformation createC14nTransformation(String algorithmUri) { + return new CanonicalizationImpl(algorithmUri); + } + + /** + * Create a ExclusiveCanonicalization. + * + * @param transform The ExclusiveCanonicalizationTransform + * containing the transformation data. + * @return The ExclusiveCanonicalization. + */ + private Transformation createExclusiveC14nTransformation(ExclusiveCanonicalizationTransform transform) { + return new ExclusiveCanonicalizationImpl( + transform.getAlgorithmURI(), + transform.getInclusiveNamespacePrefixes()); + } + + /** + * Create a Base64Transformation. + * + * @return The + */ + private Transformation createBase64Transformation() { + return new Base64TransformationImpl(); + } + + /** + * Create an EnvelopedSignatureTransformation. + * + * @return An EnvelopedSignatureTransformation. + */ + private Transformation createEnvelopedSignatureTransformation() { + return new EnvelopedSignatureTransformationImpl(); + } + + /** + * Create an XPathTransformation. + * + * @param transform The Transform object containing the + * XPath transformation. + * @return An XPathTransformation corresponding the + * transformation given in transform. + * @throws MOAApplicationException An error occurred creating the + * Transformation. + */ + private Transformation createXPathTransformation(XPathTransform transform) + throws MOAApplicationException { + + return new XPathTransformationImpl( + transform.getXPathExpression(), + transform.getNamespaceDeclarations()); + } + + /** + * Create an XPath2Transformation. + * + * @param transform The Transform object containing the + * XPath filter transformation. + * @return An XPath2Transformation corresponding the + * transformation given in transform. + * @throws MOAApplicationException An error occurred creating the + * Transformation. + */ + private Transformation createXPath2Transformation(XPathFilter2Transform transform) + throws MOAApplicationException { + + XPath2TransformationImpl xpath2 = new XPath2TransformationImpl(); + Iterator iter; + + for (iter = transform.getFilters().iterator(); iter.hasNext();) { + XPathFilter filter = (XPathFilter) iter.next(); + String mappedFilterType = + (String) FILTER_TYPE_MAPPING.get(filter.getFilterType()); + XPath2FilterImpl mappedFilter = + new XPath2FilterImpl( + mappedFilterType, + filter.getXPathExpression(), + filter.getNamespaceDeclarations()); + xpath2.addXPathFilter(mappedFilter); + } + + if (xpath2.getXPathFilters().size() == 0) { + throw new MOAApplicationException("2216", null); + } + + return xpath2; + } + + /** + * Create an XSLTTransformation. + * + * @param transform The Transform containing the XSLT stylesheet. + * @return An XSLTTransformation corresponding the transformation + * given in transform. + * @throws MOAApplicationException An error occurred creating the + * Transformation. + */ + private Transformation createXSLTTransformation(XSLTTransform transform) + throws MOAApplicationException { + + return new XSLTTransformationImpl(transform.getStylesheet()); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java new file mode 100644 index 000000000..55e2e1505 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java @@ -0,0 +1,86 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; + +import iaik.server.modules.cmsverify.CMSSignatureVerificationResult; +import iaik.server.modules.cmsverify.CertificateValidationResult; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; +import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.SignerInfo; + +/** + * A class to build a VerifyCMSSignatureResponse object. + * + *

Via subsequent calls to addResult() a number of results from + * a CMS signature verification can be added to the response.

+ * + *

The getResponseElement() method then returns the + * VerifyCMSSignatureResponse built so far.

+ * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyCMSSignatureResponseBuilder { + /** The SPSSFactory for creating API objects. */ + private SPSSFactory factory = SPSSFactory.getInstance(); + /** The elements making up the response. */ + private List responseElements = new ArrayList(); + + /** + * Get the VerifyCMSSignatureResponse built so far. + * + * @return The VerifyCMSSignatureResponse built so far. + */ + public VerifyCMSSignatureResponse getResponse() { + return factory.createVerifyCMSSignatureResponse(responseElements); + } + + /** + * Add a verification result to the response. + * + * @param result The result to add. + * @throws MOAApplicationException An error occurred adding the result. + */ + public void addResult(CMSSignatureVerificationResult result) + throws MOAApplicationException { + + CertificateValidationResult certResult = + result.getCertificateValidationResult(); + int signatureCheckCode = + result.getSignatureValueVerificationCode().intValue(); + int certificateCheckCode = certResult.getValidationResultCode().intValue(); + VerifyCMSSignatureResponseElement responseElement; + SignerInfo signerInfo; + CheckResult signatureCheck; + CheckResult certificateCheck; + + // add SignerInfo element + signerInfo = + factory.createSignerInfo( + (X509Certificate) certResult.getCertificateChain().get(0), + certResult.isQualifiedCertificate(), + certResult.isPublicAuthorityCertificate(), + certResult.getPublicAuthorityID()); + + // add SignatureCheck element + signatureCheck = factory.createCheckResult(signatureCheckCode, null); + + // add CertificateCheck element + certificateCheck = factory.createCheckResult(certificateCheckCode, null); + + // build the response element + responseElement = + factory.createVerifyCMSSignatureResponseElement( + signerInfo, + signatureCheck, + certificateCheck); + responseElements.add(responseElement); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java new file mode 100644 index 000000000..d6f58a560 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java @@ -0,0 +1,437 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import iaik.ixsil.algorithms.CanonicalizationAlgorithm; +import iaik.ixsil.algorithms.CanonicalizationAlgorithmImplExclusiveCanonicalXMLWithComments; +import iaik.server.modules.xml.BinaryDataObject; +import iaik.server.modules.xml.DataObject; +import iaik.server.modules.xml.XMLDataObject; +import iaik.server.modules.xml.XMLNodeListDataObject; +import iaik.server.modules.xmlverify.CertificateValidationResult; +import iaik.server.modules.xmlverify.DsigManifest; +import iaik.server.modules.xmlverify.HashUnavailableException; +import iaik.server.modules.xmlverify.ReferenceData; +import iaik.server.modules.xmlverify.ReferenceInfo; +import iaik.server.modules.xmlverify.SecurityLayerManifest; +import iaik.server.modules.xmlverify.XMLSignatureVerificationProfile; +import iaik.server.modules.xmlverify.XMLSignatureVerificationResult; +import iaik.x509.X509Certificate; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.w3c.dom.DocumentFragment; +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.api.common.InputData; +import at.gv.egovernment.moa.spss.api.common.SignerInfo; +import at.gv.egovernment.moa.spss.api.impl.InputDataBinaryImpl; +import at.gv.egovernment.moa.spss.api.impl.InputDataXMLImpl; +import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResultInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; +import at.gv.egovernment.moa.util.CollectionUtils; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.NodeListAdapter; + +/** + * A class to build a VerifyXMLSignatureResponse object. + * + *

Via a call to addResult() the only result of the + * signature verification must be added.

+ * + *

The getResponseElement() method then returns the + * VerifyXMLSignatureResponse built so far.

+ * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyXMLSignatureResponseBuilder { + + /** The SPSSFactory for creating API objects. */ + private SPSSFactory factory = SPSSFactory.getInstance(); + + /** Information about the signer certificate. */ + private SignerInfo signerInfo; + /** The hash input data. */ + private List hashInputDatas; + /** The reference input data. */ + private List referenceInputDatas; + /** The result of the signature check. */ + private ReferencesCheckResult signatureCheck; + /** The result of the signature manifest check. */ + private ReferencesCheckResult signatureManifestCheck; + /** The result of the XMLDsig manifest check. */ + private List xmlDsigManifestChecks; + /** The result of the certificate check. */ + private CheckResult certificateCheck; + + /** + * Get the VerifyMLSignatureResponse built so far. + * + * @return The VerifyXMLSignatureResponse built so far. + */ + public VerifyXMLSignatureResponse getResponse() { + return factory.createVerifyXMLSignatureResponse( + signerInfo, + hashInputDatas, + referenceInputDatas, + signatureCheck, + signatureManifestCheck, + xmlDsigManifestChecks, + certificateCheck); + } + + /** + * Sets the verification result to the response. + * + * This method must be called exactly once to ensure a valid + * VerifyXMLSignatureResponse. + * + * @param result The result to set for the response. + * @param profile The profile used for verifying the signature. + * @param transformsSignatureManifestCheck The overall result for the signature + * manifest check. + * @param certificateCheck The overall result for the certificate check. + * @throws MOAApplicationException An error occurred adding the result. + */ + public void setResult( + XMLSignatureVerificationResult result, + XMLSignatureVerificationProfile profile, + ReferencesCheckResult transformsSignatureManifestCheck, + CheckResult certificateCheck) + throws MOAApplicationException { + + CertificateValidationResult certResult = + result.getCertificateValidationResult(); + List referenceDataList; + ReferenceData referenceData; + List dsigManifestList; + ReferencesCheckResultInfo checkResultInfo; + int[] failedReferences; + Iterator iter; + + // create the SignerInfo; + signerInfo = + factory.createSignerInfo( + (X509Certificate) certResult.getCertificateChain().get(0), + certResult.isQualifiedCertificate(), + certResult.isPublicAuthorityCertificate(), + certResult.getPublicAuthorityID()); + + // Create HashInputData Content objects + referenceDataList = result.getReferenceDataList(); + if (profile.includeHashInputData()) { + hashInputDatas = new ArrayList(); + + // Include SignedInfo references + addHashInputDatas( + hashInputDatas, + referenceDataList, + InputData.CONTAINER_SIGNEDINFO_, + InputData.REFERER_NONE_); + + // Include XMLDSIGManifest references + List xMLDSIGManifests = result.getDsigManifestList(); + for (iter = xMLDSIGManifests.iterator(); iter.hasNext();) + { + DsigManifest currentMF = (DsigManifest) iter.next(); + List xMLDSIGMFReferenceDataList = currentMF.getReferenceDataList(); + addHashInputDatas( + hashInputDatas, + xMLDSIGMFReferenceDataList, + InputData.CONTAINER_XMLDSIGMANIFEST_, + currentMF.getReferringReferenceInfo().getReferenceIndex()); + } + } + + // Create the ReferenceInputData Content objects + if (profile.includeReferenceInputData()) { + referenceInputDatas = new ArrayList(); + + // Include SignedInfo references + addReferenceInputDatas( + referenceInputDatas, + referenceDataList, + InputData.CONTAINER_SIGNEDINFO_, + InputData.REFERER_NONE_); + + // Include XMLDSIGManifest references + List xMLDSIGManifests = result.getDsigManifestList(); + for (iter = xMLDSIGManifests.iterator(); iter.hasNext();) + { + DsigManifest currentMF = (DsigManifest) iter.next(); + List xMLDSIGMFReferenceDataList = currentMF.getReferenceDataList(); + addReferenceInputDatas( + referenceInputDatas, + xMLDSIGMFReferenceDataList, + InputData.CONTAINER_XMLDSIGMANIFEST_, + currentMF.getReferringReferenceInfo().getReferenceIndex()); + } + } + + // create the signature check + failedReferences = buildFailedReferences(result.getReferenceDataList()); + checkResultInfo = + failedReferences != null + ? factory.createReferencesCheckResultInfo(null, failedReferences) + : null; + signatureCheck = + factory.createReferencesCheckResult( + result.getSignatureValueVerificationCode().intValue(), + checkResultInfo); + + // create the signature manifest check + if (profile.checkSecurityLayerManifest()) + { + if (transformsSignatureManifestCheck.getCode() == 1) + { + // checking the transforms failed + signatureManifestCheck = transformsSignatureManifestCheck; + } + else if (result.isSecurityLayerManifestRequired()) + { + if (!result.containsSecurityLayerManifest()) + { + // required security layer manifest is missing in signature + signatureManifestCheck = factory.createReferencesCheckResult(2, null); + } + else + { + // security layer manifest exists, so we have to check its validity + SecurityLayerManifest slManifest = result.getSecurityLayerManifest(); + int verificationResult = slManifest.getManifestVerificationResult().intValue(); + + if (SecurityLayerManifest.CODE_MANIFEST_VALID.intValue() == verificationResult) + { + // security layer manifest exists and is free of errors + signatureManifestCheck = factory.createReferencesCheckResult(0, null); + } + else + { + // security layer manifest exists, but has errors + failedReferences = buildFailedReferences(slManifest.getReferenceDataList()); + checkResultInfo = (failedReferences != null) + ? factory.createReferencesCheckResultInfo(null, failedReferences) + : null; + if (SecurityLayerManifest.CODE_MANIFEST_INCOMPLETE.intValue() == verificationResult) + { + signatureManifestCheck = factory.createReferencesCheckResult(3, checkResultInfo); + } + else if (SecurityLayerManifest.CODE_REFERENCE_HASH_INVALID.intValue() == verificationResult) + { + signatureManifestCheck = factory.createReferencesCheckResult(4, checkResultInfo); + } + else + { + // Should not happen + throw new RuntimeException("Unexpected result from security layer manifest verification."); + } + } + } + } + else + { + // no security layer manifest is required, so the signature manifest check is ok + signatureManifestCheck = factory.createReferencesCheckResult(0, null); + } + } + + // create the xmlDsigManifestCheck + if (profile.checkXMLDsigManifests()) { + xmlDsigManifestChecks = new ArrayList(); + dsigManifestList = result.getDsigManifestList(); + for (iter = dsigManifestList.iterator(); iter.hasNext();) { + DsigManifest dsigManifest = (DsigManifest) iter.next(); + int refIndex = + dsigManifest.getReferringReferenceInfo().getReferenceIndex(); + ManifestRefsCheckResultInfo manifestCheckResultInfo; + + failedReferences = + buildFailedReferences(dsigManifest.getReferenceDataList()); + manifestCheckResultInfo = + factory.createManifestRefsCheckResultInfo( + null, + failedReferences, + refIndex); + xmlDsigManifestChecks.add( + factory.createManifestRefsCheckResult( + dsigManifest.getManifestVerificationResult().intValue(), + manifestCheckResultInfo)); + } + } + + // create the certificate check + this.certificateCheck = certificateCheck; + } + + /** + * Adds {@link InputData} entries to the specified inputDatas list. The content of the entry will + * be created from {@link ReferenceData#getHashInputData()}. + * + * @param inputDatas The list to be amended. + * + * @param referenceDataList The list of {@link ReferenceData} objects to be investigated. + * + * @param containerType The type of container of the {@link InputData} objects to be created. + * + * @param refererNumber The number of the referring reference for the {@link InputData} objects to be created. + * + * @throws MOAApplicationException if creating an {@link InputData} fails. + */ + private void addHashInputDatas(List inputDatas, List referenceDataList, String containerType, int refererNumber) + throws MOAApplicationException + { + for (Iterator iter = referenceDataList.iterator(); iter.hasNext();) + { + ReferenceData referenceData = (ReferenceData) iter.next(); + inputDatas.add(buildInputData( + referenceData.getHashInputData(), + containerType, + refererNumber)); + } + } + + /** + * Adds {@link InputData} entries to the specified inputDatas list. The content of the entry will + * be created from {@link ReferenceData#getReferenceInputData()}. + * + * @param inputDatas The list to be amended. + * + * @param referenceDataList The list of {@link ReferenceData} objects to be investigated. + * + * @param containerType The type of container of the {@link InputData} objects to be created. + * + * @param refererNumber The number of the referring reference for the {@link InputData} objects to be created. + * + * @throws MOAApplicationException if creating an {@link InputData} fails. + */ + private void addReferenceInputDatas(List inputDatas, List referenceDataList, String containerType, int refererNumber) + throws MOAApplicationException + { + for (Iterator iter = referenceDataList.iterator(); iter.hasNext();) + { + ReferenceData referenceData = (ReferenceData) iter.next(); + inputDatas.add(buildInputData( + referenceData.getReferenceInputData(), + containerType, + refererNumber)); + } + } + + /** + * Build a InputDataBinaryImpl or an InputDataXMLImpl + * object from the given DataObject and the given attributes. + * + * @param dataObject The DataObject from which to build the result. + * Based on the type of this parameter, the type of the result will either be + * InputDataBinaryImpl or InputDataXMLImpl. + * + * @param partof see {@link InputData} + * + * @param referringReferenceNumber see {@link InputData} + * + * @return The corresponinding input data implementation. + * + * @throws MOAApplicationException An error occurred creating the result. + */ + private Content buildInputData(DataObject dataObject, String partOf, int referringReferenceNumber) + throws MOAApplicationException { + + if (dataObject instanceof BinaryDataObject) { + BinaryDataObject binaryData = (BinaryDataObject) dataObject; + return new InputDataBinaryImpl( + factory.createContent(binaryData.getInputStream(), null), + partOf, + referringReferenceNumber); + } else if (dataObject instanceof XMLDataObject) { + XMLDataObject xmlData = (XMLDataObject) dataObject; + List nodes = new ArrayList(); + + nodes.add(xmlData.getElement()); + return new InputDataXMLImpl( + factory.createContent(new NodeListAdapter(nodes), null), + partOf, + referringReferenceNumber); + } else { // dataObject instanceof XMLNodeListDataObject + // if the data in the NodeList can be converted back to valid XML, + // write it as XMLContent; otherwise, write it as Base64Content + XMLNodeListDataObject nodeData = (XMLNodeListDataObject) dataObject; + NodeList nodes = nodeData.getNodeList(); + + if (DOMUtils.checkAttributeParentsInNodeList(nodes)) { + // insert as XMLContent + try { + DocumentFragment fragment = DOMUtils.nodeList2DocumentFragment(nodes); + + return new InputDataXMLImpl( + factory.createContent(fragment.getChildNodes(), null), + partOf, + referringReferenceNumber); + } catch (Exception e) { + // not successful -> fall through to the Base64Content + } + } + + // insert canonicalized NodeList as binary content + try { + CanonicalizationAlgorithm c14n = + new CanonicalizationAlgorithmImplExclusiveCanonicalXMLWithComments(); + InputStream is; + + c14n.setInput(nodes); + is = c14n.canonicalize(); + return new InputDataBinaryImpl( + factory.createContent(is, null), + partOf, + referringReferenceNumber); + } catch (Exception e) { + throw new MOAApplicationException("2200", null); + } + } + } + + /** + * Build the failed references. + * + * Failed references are references for which the isHashValid() + * method returns false. + * + * @param refInfos A List containing the + * ReferenceInfo objects to be checked. + * @return The indexes of the failed references. + */ + private int[] buildFailedReferences(List refInfos) { + List failedReferencesList = new ArrayList(); + int i; + + // find out the failed references + for (i = 0; i < refInfos.size(); i++) { + ReferenceInfo refInfo = (ReferenceInfo) refInfos.get(i); + + try { + if (refInfo.isHashCalculated() && !refInfo.isHashValid()) { + failedReferencesList.add(new Integer(i + 1)); + } + } catch (HashUnavailableException e) { + // nothing to do here because we called refInfo.isHashCalculated first + } + } + + // convert to an int array + if (failedReferencesList.isEmpty()) { + return null; + } else { + int[] failedReferences = CollectionUtils.toIntArray(failedReferencesList); + + return failedReferences; + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java new file mode 100644 index 000000000..fd207ddea --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java @@ -0,0 +1,545 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import iaik.IAIKException; +import iaik.IAIKRuntimeException; +import iaik.server.modules.xml.DataObject; +import iaik.server.modules.xml.XMLDataObject; +import iaik.server.modules.xml.XMLSignature; +import iaik.server.modules.xmlsign.XMLSignatureCreationModule; +import iaik.server.modules.xmlsign.XMLSignatureCreationModuleFactory; +import iaik.server.modules.xmlsign.XMLSignatureCreationProfile; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.MOASystemException; +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.CreateSignatureEnvironmentProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit; +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.SingleSignatureInfo; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLDataObjectImpl; +import at.gv.egovernment.moa.spss.server.logging.IaikLog; +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.server.util.IdGenerator; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.XPathUtils; + +/** + * A class providing an API based interface to the + * XMLSignatureCreationModule. + * + * This class performs the invocation of the + * iaik.server.modules.xmlsign.XMLSignatureCreationModule from a + * CreateXMLSignatureRequest given as an API object. The result of + * the invocation is integrated into a CreateXMLSignatureResponse + * and returned. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureCreationInvoker { + + /** The single instance of this class. */ + private static XMLSignatureCreationInvoker instance = null; + + /** + * Get the only instance of this class. + * + * @return The only instance of this class. + */ + public static synchronized XMLSignatureCreationInvoker getInstance() { + if (instance == null) { + instance = new XMLSignatureCreationInvoker(); + } + return instance; + } + + /** + * Create a new XMLSignatureCreationInvoker. + * + * Protected to disallow multiple instances. + */ + protected XMLSignatureCreationInvoker() { + } + + /** + * Process the CreateXMLSignatureRequest message and invoke the + * XMLSignatureCreationModule for every + * SingleSignatureInfo contained in the request. + * + * @param request A CreateXMLSignatureRequest API object + * containing the information for creating the signature(s). + * @param reserved A Set of reserved object IDs. + * + * @return A CreateXMLSignatureResponse API object containing + * the created signature(s). The response contains either a + * SignatureEnvironment or a ErrorResponse + * for each SingleSignatureInfo in the request. + * @throws MOAException An error occurred during signature creation. + */ + public CreateXMLSignatureResponse createXMLSignature( + CreateXMLSignatureRequest request, + Set reserved) + throws MOAException { + + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + LoggingContext loggingCtx = + LoggingContextManager.getInstance().getLoggingContext(); + reserved = new HashSet(reserved); + XMLSignatureCreationProfileFactory profileFactory = + new XMLSignatureCreationProfileFactory(request, reserved); + CreateXMLSignatureResponseBuilder responseBuilder = + new CreateXMLSignatureResponseBuilder(); + int createCount = 1; + IdGenerator refIdGen; + XMLSignatureCreationModule module; + Iterator singleSignatureInfoIter; + + // create the XMLSignatureCreationModule and configure it + module = XMLSignatureCreationModuleFactory.getInstance(); + module.setLog(new IaikLog(loggingCtx.getNodeID())); + + // select the SingleSignatureInfo elements + singleSignatureInfoIter = request.getSingleSignatureInfos().iterator(); + + // iterate over all the SingleSignatureInfo elements in the request + while (singleSignatureInfoIter.hasNext()) { + SingleSignatureInfo singleSignatureInfo = + (SingleSignatureInfo) singleSignatureInfoIter.next(); + CreateSignatureInfo createSignatureInfo; + List dataObjectList; + XMLSignatureCreationProfile profile; + XMLDataObject signatureEnvironment; + XMLDataObject signatureParent; + XMLSignature signature; + List additionalSignedProperties; + Node signatureEnvironmentParent = null; + Element requestElement = null; + + try { + + // build the signature environment + createSignatureInfo = singleSignatureInfo.getCreateSignatureInfo(); + if (createSignatureInfo != null) { + DataObjectFactory dataObjFactory = DataObjectFactory.getInstance(); + + signatureEnvironment = + dataObjFactory.createSignatureEnvironment( + createSignatureInfo.getCreateSignatureEnvironment(), + getCreateSignatureEnvironmentProfileSupplements(singleSignatureInfo)); + } else { + signatureEnvironment = null; + } + + HashSet sigInfoReservedIDs = new HashSet(); + if (signatureEnvironment != null) + { + // Find Id attributes of existing XML signatures in signature environment + HashMap nSMap = new HashMap(); + String dsp = Constants.DSIG_PREFIX; + nSMap.put(dsp, Constants.DSIG_NS_URI); + String xPathExpr = "//" + dsp + ":Signature/@Id | //" + dsp + ":Reference/@Id | //" + + dsp + ":Object/@Id | //" + dsp + ":Manifest/@Id"; + NodeList idAttrs = XPathUtils.selectNodeList(signatureEnvironment.getElement(), nSMap, xPathExpr); + + // Add found Id attributes to set of reserved IDs + for (int i = 0; i < idAttrs.getLength(); i++) sigInfoReservedIDs.add(idAttrs.item(i).getNodeValue()); + } + + // create the reference id generator + HashSet allReservedIDs = new HashSet(reserved); + allReservedIDs.addAll(sigInfoReservedIDs); + refIdGen = new IdGenerator("reference-" + createCount++, allReservedIDs); + + // build the list of DataObjects + List createTransformsProfiles = profileFactory.getCreateTransformsInfoProfiles(singleSignatureInfo); + dataObjectList = + buildDataObjectList( + singleSignatureInfo, + createTransformsProfiles, + signatureEnvironment, + refIdGen); + + // build the XMLSignatureCreationProfile + profile = profileFactory.createProfile(singleSignatureInfo, sigInfoReservedIDs); + + // build the additionalSignedProperties + additionalSignedProperties = buildAdditionalSignedProperties(); + + // build the signatureParentElement + if (signatureEnvironment != null) { + signatureParent = + buildSignatureParentElement( + signatureEnvironment.getElement(), + singleSignatureInfo); + } else { + signatureParent = null; + } + + // make the signature environment the root of the document, if it is + // not a separate document anyway; this is done to assure that + // canonicalization of the signature environment contains the correct + // namespace declarations + if (signatureEnvironment != null) { + Document requestDoc = + signatureEnvironment.getElement().getOwnerDocument(); + requestElement = requestDoc.getDocumentElement(); + if (requestElement != signatureEnvironment.getElement()) { + signatureEnvironmentParent = + signatureEnvironment.getElement().getParentNode(); + requestElement.getOwnerDocument().replaceChild( + signatureEnvironment.getElement(), + requestElement); + } + } + + try { + // create the signature + signature = + module.createSignature( + dataObjectList, + profile, + additionalSignedProperties, + signatureParent, + new TransactionId(context.getTransactionID())); + + // insert the result into the response + if (signatureParent != null) { + responseBuilder.addSignatureEnvironment( + signatureEnvironment.getElement()); + } else { + responseBuilder.addSignatureEnvironment(signature.getElement()); + } + + } catch (IAIKException e) { + MOAException moaException = IaikExceptionMapper.getInstance().map(e); + + responseBuilder.addError( + moaException.getMessageId(), + moaException.getMessage()); + Logger.warn(moaException.getMessage(), e); + } catch (IAIKRuntimeException e) { + MOAException moaException = IaikExceptionMapper.getInstance().map(e); + + responseBuilder.addError( + moaException.getMessageId(), + moaException.getMessage()); + Logger.warn(moaException.getMessage(), e); + } + + // swap back in the request as root document + if (signatureEnvironment != null) { + if (requestElement != signatureEnvironment.getElement()) { + requestElement.getOwnerDocument().replaceChild( + requestElement, + signatureEnvironment.getElement()); + signatureEnvironmentParent.appendChild( + signatureEnvironment.getElement()); + } + } + + } catch (MOAException e) { + responseBuilder.addError(e.getMessageId(), e.getMessage()); + Logger.warn(e.getMessage(), e); + } + + } + + return responseBuilder.getResponse(); + } + + /** + * Build the list of DataObjects from the given + * SingleSignatureInfo object. + * + *

+ * Only the following cases of DataObjects are + * valid in case of an enveloping signature: + * + *

    + *
  • Reference == null && Content != null: The + * Content will be used in the DataObject.
  • + *
  • Reference != null && Content == null: Resolve the + * Reference and use it as DataObject. + * Set the Reference in the DataObject as well.
  • + *
+ *

+ * + *

+ * Only the following cases of DataObjects are valid in case + * of a detached signature: + * + *

    + *
  • Reference != null && Content == null: Resolve the + * Reference and use it as DataObject. + * Set the Reference in the DataObject as well.
  • + *
  • Reference != null && Content != null: The + * Content will be used in the DataObject. + * Set the Reference in the DataObject as well.
  • + *
+ *

+ * + *

+ * All other cases will lead to an error. + *

+ * + * @param singleSignatureInfo The SingleSignatureInfo object + * containing the DataObjectInfo objects. + * @param createTransformsProfiles A list of objects of type {@link CreateTransformsInfoProfileExplicit}, + * each representing the transforms info profile information for the corresponding DataObject. + * @param signatureEnvironment The + * @param idGen The ID generator for DataObject references. + * @return The List of DataObjects contained in the + * given singleSignatureInfo. + * @throws MOASystemException A system error occurred building the data + * objects. + * @throws MOAApplicationException An error occurred building the data + * objects. + */ + private List buildDataObjectList( + SingleSignatureInfo singleSignatureInfo, + List createTransformsProfiles, + XMLDataObject signatureEnvironment, + IdGenerator idGen) + throws MOASystemException, MOAApplicationException { + + List dataObjInfos = singleSignatureInfo.getDataObjectInfos(); + List dataObjects = new ArrayList(); + Iterator dtIter; + Iterator ctpIter = createTransformsProfiles.iterator(); + + for (dtIter = dataObjInfos.iterator(); dtIter.hasNext();) + { + DataObjectInfo dataObjInfo = (DataObjectInfo) dtIter.next(); + String structure = dataObjInfo.getStructure(); + + CreateTransformsInfoProfileExplicit transformsProfile = + (CreateTransformsInfoProfileExplicit) ctpIter.next(); + MetaInfo finalDataMetaInfo = transformsProfile.getCreateTransformsInfo().getFinalDataMetaInfo(); + + if (DataObjectInfo.STRUCTURE_ENVELOPING.equals(structure)) { + dataObjects.add( + buildEnvelopingDataObject( + dataObjInfo.getDataObject(), + finalDataMetaInfo, + idGen.uniqueId())); + } else if (DataObjectInfo.STRUCTURE_DETACHED.equals(structure)) { + dataObjects.add( + buildDetachedDataObject( + dataObjInfo.getDataObject(), + finalDataMetaInfo, + signatureEnvironment, + idGen.uniqueId())); + } else { + throw new MOAApplicationException("1103", new Object[] { structure }); + } + } + + return dataObjects; + + } + + /** + * Build a DataObject to be used in an enveloping + * signature. + * + * @param content The Content object containing the data object. + * ContentOptionalRefType. + * @param finalDataMetaInfo The meta information corresponding with content. + * @param referenceID The reference ID to use in the signature for the + * DataObject created. + * @return The DataObject representing the data contained in + * dataObjectElem. + * @throws MOAApplicationException An error occurred during the creation of + * the DataObject. + * @throws MOASystemException A system error occurred during the creation of + * the DataObject. + */ + private DataObject buildEnvelopingDataObject( + Content content, + MetaInfo finalDataMetaInfo, + String referenceID) + throws MOASystemException, MOAApplicationException { + + DataObjectFactory factory = DataObjectFactory.getInstance(); + DataObject dataObject; + + dataObject = + factory.createFromContentOptionalRefType( + content, + finalDataMetaInfo, + referenceID, + false, + false, + true, + false); + + return dataObject; + } + + /** + * Build a DataObject to be used in a detached signature. + * + * @param content The Content object containing an the data. + * @param finalDataMetaInfo The meta information corresponding with content. + * @param signatureEnvironment The signature environment where the signature + * will be inserted. + * @param referenceID The reference ID to use in the signature for the + * DataObject created. + * @return The DataObject representing the data contained in + * dataObjectElem. + * @throws MOAApplicationException An error occurred during the creation of + * the DataObject. + * @throws MOASystemException A system error occurred during the creation of + * the DataObject. + */ + private DataObject buildDetachedDataObject( + Content content, + MetaInfo finalDataMetaInfo, + XMLDataObject signatureEnvironment, + String referenceID) + throws MOASystemException, MOAApplicationException { + + String reference = content.getReference(); + DataObjectFactory factory = DataObjectFactory.getInstance(); + DataObject dataObject; + + if (reference == null) { + throw new MOAApplicationException("1102", null); + } else if ("".equals(reference) || reference.startsWith("#")) { + dataObject = + factory.createFromSignatureEnvironment( + signatureEnvironment.getElement(), + reference, + referenceID); + } else { + dataObject = + factory.createFromContentOptionalRefType( + content, + finalDataMetaInfo, + referenceID, + true, + false, + true, + false); + } + return dataObject; + } + + /** + * Build the signature parent element. + * + * @param signatureEnvironment The signature environment containing the + * document in which to insert the signature. + * @param singleSignatureInfo The SingleSignatureInfo + * containing the signature parent element. + * @return An XMLDataObject containing the signature parent + * element or null, if the CreateSignatureInfo is + * null. + * @throws MOAApplicationException An error occurred during the creation of + * the signature parent. + */ + private XMLDataObject buildSignatureParentElement( + Element signatureEnvironment, + SingleSignatureInfo singleSignatureInfo) + throws MOAApplicationException { + + CreateSignatureInfo createInfo = + singleSignatureInfo.getCreateSignatureInfo(); + + // evaluate the CreateSignatureLocation + if (createInfo != null) { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + CreateSignatureEnvironmentProfileExplicit createProfile = + ProfileMapper.mapCreateSignatureEnvironmentProfile( + createInfo.getCreateSignatureEnvironmentProfile(), + config); + CreateSignatureLocation location = + createProfile.getCreateSignatureLocation(); + Element signatureParent = + InvokerUtils.evaluateSignatureLocation(signatureEnvironment, location); + + return new XMLDataObjectImpl(signatureParent); + } else { + return null; + } + } + + /** + * Get the supplements contained in the + * CreateSignatureEnvironmentProfile of the given + * SingleSignatureInfo. + * + * @param singleSigInfo The SingleSignatureInfo from which + * to extract the supplements. + * @return A List of XMLDataObjectAssociations + * or null, if the singleSigInfo does not contain + * supplements. + * @throws MOAApplicationException An error occurred parsing the + * CreateSignatureEnvironmentProfile. + */ + private List getCreateSignatureEnvironmentProfileSupplements(SingleSignatureInfo singleSigInfo) + throws MOAApplicationException { + CreateSignatureInfo sigInfo = singleSigInfo.getCreateSignatureInfo(); + + if (sigInfo != null) { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + CreateSignatureEnvironmentProfileExplicit profile = + ProfileMapper.mapCreateSignatureEnvironmentProfile( + sigInfo.getCreateSignatureEnvironmentProfile(), + config); + List supplements = profile.getSupplements(); + + return supplements; + } + return null; + } + + /** + * Build the list of additional signed properties. + * + * Based on the generic configuration setting + * ConfigurationProvider.TEST_SIGNING_TIME_PROPERTY, a + * constant SigningTime will be added to the properties. + * + * @return The List of additional signed properties. + */ + private List buildAdditionalSignedProperties() { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + List additionalSignedProperties = Collections.EMPTY_LIST; + + return additionalSignedProperties; + } + +} \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java new file mode 100644 index 000000000..7ac971da8 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java @@ -0,0 +1,455 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import iaik.server.modules.algorithms.HashAlgorithms; +import iaik.server.modules.keys.KeyEntryID; +import iaik.server.modules.keys.KeyModule; +import iaik.server.modules.keys.KeyModuleFactory; +import iaik.server.modules.xmlsign.SignatureStructureTypes; +import iaik.server.modules.xmlsign.XMLSignatureCreationProfile; +import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation; + +import java.math.BigInteger; +import java.security.Principal; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.config.KeyGroupEntry; +import at.gv.egovernment.moa.spss.server.iaik.xml.CanonicalizationImpl; +import at.gv.egovernment.moa.spss.server.iaik.xmlsign.DataObjectTreatmentImpl; +import at.gv.egovernment.moa.spss.server.iaik.xmlsign.XMLSignatureCreationProfileImpl; +import at.gv.egovernment.moa.spss.server.iaik.xmlsign.XMLSignatureInsertionLocationImpl; +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.server.util.IdGenerator; +import at.gv.egovernment.moa.spss.util.MessageProvider; +import at.gv.egovernment.moa.util.Constants; + +/** + * A factory to create XMLSignatureCreationProfiles from a + * CreateXMLSignatureRequest, based on the current MOA + * configuration. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureCreationProfileFactory { + + private static Map HASH_ALGORITHM_MAPPING; + + static { + HASH_ALGORITHM_MAPPING = new HashMap(); + HASH_ALGORITHM_MAPPING.put(Constants.SHA1_URI, HashAlgorithms.SHA1); + } + + /** The CreateXMLSignatureRequest for which to create the + * profile.*/ + private CreateXMLSignatureRequest request; + /** How many profiles have been created based on the same request. */ + private int createProfileCount; + /** The Set of reserved object IDs.*/ + private Set reserved; + + /** + * Create a new XMLSignatureCreationProfileFactory. + * + * @param request The request for which to create profiles. + * @param reserved The Set of reserved object IDs. IDs will + * be added during signature creation. + */ + public XMLSignatureCreationProfileFactory( + CreateXMLSignatureRequest request, + Set reserved) { + this.request = request; + this.reserved = reserved; + createProfileCount = 1; + } + + /** + * Create a XMLSignatureCreationProfile for the given + * SingleSignatureInfo object.. + * + * @param singleSignatureInfo The SingleSignatureInfo object + * containing information about the creation of a signature. + * @param sigInfoReservedIDs The Set of reserved ID attribue values + * for the particular singleSignatureInfo. + * @return The XMLSignatureCreationProfile containing additional + * information for creating an XML signature. + * @throws MOASystemException A system error occurred during creation of the + * profile. See message for details + * @throws MOAApplicationException An application error occurred during + * creation of the profile. See message for details. + */ + public XMLSignatureCreationProfile createProfile(SingleSignatureInfo singleSignatureInfo, + Set sigInfoReservedIDs) throws MOASystemException, MOAApplicationException { + + HashSet allReservedIDs = new HashSet(reserved); + allReservedIDs.addAll(sigInfoReservedIDs); + + XMLSignatureCreationProfileImpl profile = + new XMLSignatureCreationProfileImpl(createProfileCount, allReservedIDs); + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + CanonicalizationImpl canonicalization; + List dataObjectTreatmentList; + String keyGroupID; + Set keySet; + List transformationSupplements; + List createTransformsProfiles; + + // build the transformation supplements + createTransformsProfiles = + getCreateTransformsInfoProfiles(singleSignatureInfo); + transformationSupplements = + buildTransformationSupplements(createTransformsProfiles); + + // build and set the data object treatment list + dataObjectTreatmentList = + buildDataObjectTreatmentList( + singleSignatureInfo, + createTransformsProfiles, + transformationSupplements, + allReservedIDs); + profile.setDataObjectTreatmentList(dataObjectTreatmentList); + + // set the key set + keyGroupID = request.getKeyIdentifier(); + keySet = buildKeySet(keyGroupID); + if (keySet == null) { + throw new MOAApplicationException("2231", null); + } else if (keySet.size() == 0) { + throw new MOAApplicationException("2232", null); + } + profile.setKeySet(keySet); + + // set the Security Layer manifest algorithm name + profile.setSecurityLayerManifestTypeURI(Constants.SL_MANIFEST_TYPE_URI); + + // set the structure type + if (singleSignatureInfo.getCreateSignatureInfo() != null) { + profile.setSignatureStructureType(SignatureStructureTypes.ENVELOPED); + } else { + profile.setSignatureStructureType(SignatureStructureTypes.DETACHED); + } + + // set insertion location + profile.setSignatureInsertionLocation( + getSignatureInsertionLocationIndex(singleSignatureInfo)); + + // set the canonicalization algorithm + canonicalization = + new CanonicalizationImpl(config.getCanonicalizationAlgorithmName()); + profile.setSignedInfoCanonicalization(canonicalization); + + // set the signed properties + profile.setSignedProperties(Collections.EMPTY_LIST); + + // set security layer conformity + profile.setSecurityLayerConform( + singleSignatureInfo.isSecurityLayerConform()); + + // update the createProfileCount + createProfileCount++; + + return profile; + } + + /** + * Get the List of all CreateTransformsInfoProfiles + * contained in all the DataObjectInfos of the given + * SingleSignatureInfo. + * + * @param singleSignatureInfo The SingleSignatureInfo object from + * which to extract the CreateTransformsInfoProfiles. + * @return All CreateTransformsInfoProfiles of all + * DataObjectInfos of singleSignatureInfo. + * @throws MOAApplicationException An error occurred creating one of the + * profiles. + */ + List getCreateTransformsInfoProfiles(SingleSignatureInfo singleSignatureInfo) + throws MOAApplicationException { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + List dataObjInfos = singleSignatureInfo.getDataObjectInfos(); + List profiles = new ArrayList(); + Iterator dtIter; + + for (dtIter = dataObjInfos.iterator(); dtIter.hasNext();) { + DataObjectInfo dataObjInfo = (DataObjectInfo) dtIter.next(); + CreateTransformsInfoProfileExplicit profile = + ProfileMapper.mapCreateTransformsInfoProfile( + dataObjInfo.getCreateTransformsInfoProfile(), + config); + profiles.add(profile); + } + + return profiles; + } + + /** + * Build the List of transformation supplements contained in a + * SingleSignatureInfo object. + * + * @param createTransformsInfoProfiles The + * CreateTransformsInfoProfile object from which to extract the + * transformation supplements. + * @return A List of DataObjects containing the + * transformation supplements. + * @throws MOASystemException A system error occurred creating one of the + * transformation supplements. + * @throws MOAApplicationException An error occurred creating one of the + * transformation supplements. + */ + private List buildTransformationSupplements(List createTransformsInfoProfiles) + throws MOASystemException, MOAApplicationException { + + List transformationSupplements = new ArrayList(); + DataObjectFactory factory = DataObjectFactory.getInstance(); + Iterator iter; + + for (iter = createTransformsInfoProfiles.iterator(); iter.hasNext();) { + CreateTransformsInfoProfileExplicit profile = + (CreateTransformsInfoProfileExplicit) iter.next(); + List supplements = profile.getSupplements(); + + if (supplements != null) { + Iterator supplIter; + + for (supplIter = supplements.iterator(); supplIter.hasNext();) { + XMLDataObjectAssociation supplement = + (XMLDataObjectAssociation) supplIter.next(); + + transformationSupplements.add( + factory.createFromXmlDataObjectAssociation( + supplement, + false, + true)); + } + } + } + + return transformationSupplements; + } + + /** + * Build the List of DataObjectTreatments for the + * given SingleSignatureInfo object.. + * + * @param singleSignatureInfo The SingleSignatureInfo object + * from which to exctract the CreateTransformsInfoProfiles + * containing the data for the DataObjectTreatments. + * @param createTransformsInfoProfiles The + * CreateTransformsInfoProfiles contained in the + * singleSignatureInfo. + * @param transformationSupplements Additional parameters for + * transformations contained in DataObjectTreatments. + * @param reservedIDs The Set of reserved object IDs. + * @return A List of DataObjectTreatment objects. + * @throws MOAApplicationException An error occurred building one of the + * DataObjectTreatments. + * @throws MOASystemException A system error occurred building one of the + * DataObjectTreatments. + */ + private List buildDataObjectTreatmentList( + SingleSignatureInfo singleSignatureInfo, + List createTransformsInfoProfiles, + List transformationSupplements, + Set reservedIDs) + throws MOASystemException, MOAApplicationException { + + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + List treatments = new ArrayList(); + List dataObjInfos = singleSignatureInfo.getDataObjectInfos(); + int dataObjectTreatmentCount = 1; + String hashAlgorithmName; + Iterator dtIter; + Iterator prIter; + + prIter = createTransformsInfoProfiles.iterator(); + for (dtIter = dataObjInfos.iterator(); dtIter.hasNext();) { + CreateTransformsInfoProfileExplicit profile = + (CreateTransformsInfoProfileExplicit) prIter.next(); + DataObjectInfo dataObjInfo = (DataObjectInfo) dtIter.next(); + IdGenerator objIdGen = + new IdGenerator( + ("signed-data-" + createProfileCount) + + ("-" + dataObjectTreatmentCount++), + reservedIDs); + DataObjectTreatmentImpl treatment = new DataObjectTreatmentImpl(objIdGen); + + treatment.setFinalContentType( + profile.getCreateTransformsInfo().getFinalDataMetaInfo().getMimeType()); + treatment.setTransformationList(buildTransformationList(profile)); + treatment.setReferenceInManifest(dataObjInfo.isChildOfManifest()); + + hashAlgorithmName = + (String) HASH_ALGORITHM_MAPPING.get( + config.getDigestMethodAlgorithmName()); + if (hashAlgorithmName == null) { + error( + "config.17", + new Object[] { config.getDigestMethodAlgorithmName()}); + throw new MOASystemException("2900", null); + } + + treatment.setHashAlgorithmName(hashAlgorithmName); + treatment.setIncludedInSignature( + DataObjectInfo.STRUCTURE_ENVELOPING.equals(dataObjInfo.getStructure())); + treatment.setTransformationSupplements(transformationSupplements); + + treatments.add(treatment); + + } + + return treatments; + } + + /** + * Build the List of transformations contained in a + * CreateTransformsInfoProfile object. + * + * @param profile The CreateTransformsInfoProfile object + * from which to extract the Transforms. + * @return A List of Transformations contained in + * the given CreateTransformsInfoProfile. + * @throws MOAApplicationException An error occurred building one of the + * Transformations. + */ + private List buildTransformationList(CreateTransformsInfoProfileExplicit profile) + throws MOAApplicationException { + + TransformationFactory factory = TransformationFactory.getInstance(); + List transforms = profile.getCreateTransformsInfo().getTransforms(); + + return transforms != null + ? factory.createTransformationList(transforms) + : Collections.EMPTY_LIST; + } + + /** + * Build the set of KeyEntryIDs available to the given + * keyGroupID. + * + * @param keyGroupID The keygroup ID for which the available keys should be + * returned. + * @return The Set of KeyEntryIDs + * identifying the available keys. + */ + private Set buildKeySet(String keyGroupID) { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + Set keyGroupEntries; + + // get the KeyGroup entries from the configuration + if (context.getClientCertificate() != null) { + X509Certificate cert = context.getClientCertificate()[0]; + Principal issuer = cert.getIssuerDN(); + BigInteger serialNumber = cert.getSerialNumber(); + + keyGroupEntries = + config.getKeyGroupEntries(issuer, serialNumber, keyGroupID); + } else { + keyGroupEntries = config.getKeyGroupEntries(null, null, keyGroupID); + } + + // map the KeyGroup entries to a set of KeyEntryIDs + if (keyGroupEntries == null) { + return null; + } else if (keyGroupEntries.size() == 0) { + return Collections.EMPTY_SET; + } else { + KeyModule module = + KeyModuleFactory.getInstance( + new TransactionId(context.getTransactionID())); + Set keyEntryIDs = module.getPrivateKeyEntryIDs(); + Set keySet = new HashSet(); + Iterator iter; + + // filter out the keys that do not exist in the IAIK configuration + // by walking through the key entries and checking if the exist in the + // keyGroupEntries + for (iter = keyEntryIDs.iterator(); iter.hasNext();) { + KeyEntryID entryID = (KeyEntryID) iter.next(); + KeyGroupEntry entry = + new KeyGroupEntry( + entryID.getModuleID(), + entryID.getCertificateIssuer(), + entryID.getCertificateSerialNumber()); + if (keyGroupEntries.contains(entry)) { + keySet.add(entryID); + } + } + return keySet; + } + } + + /** + * Get the signature location index where the signature will be inserted into + * the signature parent element. + * + * @param singleSignatureInfo The SingleSignatureInfo object + * containing the CreateSignatureLocation. + * @return The index at which to insert the signature into the signature + * environment. + * @throws MOAApplicationException An error occurred parsing the + * CreateSignatureEnvironmentProfile. + */ + private XMLSignatureInsertionLocation getSignatureInsertionLocationIndex(SingleSignatureInfo singleSignatureInfo) + throws MOAApplicationException { + + CreateSignatureInfo createInfo = + singleSignatureInfo.getCreateSignatureInfo(); + + if (createInfo != null) { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + CreateSignatureEnvironmentProfileExplicit profile = + ProfileMapper.mapCreateSignatureEnvironmentProfile( + createInfo.getCreateSignatureEnvironmentProfile(), + config); + int index = profile.getCreateSignatureLocation().getIndex(); + + return new XMLSignatureInsertionLocationImpl(index); + } else { + return new XMLSignatureInsertionLocationImpl(0); + } + } + + /** + * Utility function to issue an error message to the log. + * + * @param messageId The ID of the message to log. + * @param parameters Additional message parameters. + */ + private static void error(String messageId, Object[] parameters) { + MessageProvider msg = MessageProvider.getInstance(); + + Logger.error(new LogMsg(msg.getMessage(messageId, parameters))); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java new file mode 100644 index 000000000..4642593eb --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java @@ -0,0 +1,675 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import iaik.IAIKException; +import iaik.IAIKRuntimeException; +import iaik.ixsil.exceptions.URIException; +import iaik.ixsil.util.URI; +import iaik.server.modules.xml.DataObject; +import iaik.server.modules.xml.XMLDataObject; +import iaik.server.modules.xml.XMLSignature; +import iaik.server.modules.xmlsign.XMLConstants; +import iaik.server.modules.xmlverify.DsigManifest; +import iaik.server.modules.xmlverify.ReferenceData; +import iaik.server.modules.xmlverify.SecurityLayerManifest; +import iaik.server.modules.xmlverify.XMLSignatureVerificationModule; +import iaik.server.modules.xmlverify.XMLSignatureVerificationModuleFactory; +import iaik.server.modules.xmlverify.XMLSignatureVerificationProfile; +import iaik.server.modules.xmlverify.XMLSignatureVerificationResult; +import iaik.x509.X509Certificate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter; +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterHash; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureLocation; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.config.TrustProfile; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLSignatureImpl; +import at.gv.egovernment.moa.spss.server.logging.IaikLog; +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.util.MessageProvider; +import at.gv.egovernment.moa.util.CollectionUtils; +import at.gv.egovernment.moa.util.Constants; + +/** + * A class providing a DOM based interface to the + * XMLSignatureVerificationModule. + * + * This class performs the invocation of the + * iaik.server.modules.xmlverify.XMLSignatureVerificationModule + * from a VerifyXMLSignatureRequest given as a DOM element. The + * result of the invocation is integrated into a + * VerifyXMLSignatureResponse and returned. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureVerificationInvoker { + + /** The single instance of this class. */ + private static XMLSignatureVerificationInvoker instance = null; + + private static Set FILTERED_REF_TYPES; + + static { + FILTERED_REF_TYPES = new HashSet(); + FILTERED_REF_TYPES.add(DsigManifest.XML_DSIG_MANIFEST_TYPE); + FILTERED_REF_TYPES.add(SecurityLayerManifest.SECURITY_LAYER_MANIFEST_TYPE); + FILTERED_REF_TYPES.add( + SecurityLayerManifest.SECURITY_LAYER_MANIFEST_TYPE_OLD); + FILTERED_REF_TYPES.add( + XMLConstants.NAMESPACE_ETSI_STRING + "SignedProperties"); + } + + /** + * Get the single instance of this class. + * + * @return The single instance of this class. + */ + public static synchronized XMLSignatureVerificationInvoker getInstance() { + if (instance == null) { + instance = new XMLSignatureVerificationInvoker(); + } + return instance; + } + + /** + * Create a new XMLSignatureCreationInvoker. + * + * Protected to disallow multiple instances. + */ + protected XMLSignatureVerificationInvoker() { + } + + /** + * Process the VerifyXMLSignatureRequest message and invoke the + * XMLSignatureVerificationModule. + * + * @param request A VerifyXMLSignatureRequest API object + * containing the data for verifying an XML signature. + * @return A VerifyXMLSignatureResponse containing the + * answert to the VerifyXMLSignatureRequest. + * MOA schema definition. + * @throws MOAException An error occurred during signature verification. + */ + public VerifyXMLSignatureResponse verifyXMLSignature(VerifyXMLSignatureRequest request) + throws MOAException { + + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + LoggingContext loggingCtx = + LoggingContextManager.getInstance().getLoggingContext(); + XMLSignatureVerificationProfileFactory profileFactory = + new XMLSignatureVerificationProfileFactory(request); + VerifyXMLSignatureResponseBuilder responseBuilder = + new VerifyXMLSignatureResponseBuilder(); + XMLSignatureVerificationResult result; + XMLSignatureVerificationProfile profile; + ReferencesCheckResult signatureManifestCheck; + DataObjectFactory dataObjFactory; + XMLDataObject signatureEnvironment; + Node signatureEnvironmentParent = null; + Element requestElement = null; + XMLSignature xmlSignature; + Date signingTime; + List supplements; + List dataObjectList; + + // get the supplements + supplements = getSupplements(request); + + // build XMLSignature + dataObjFactory = DataObjectFactory.getInstance(); + signatureEnvironment = + dataObjFactory.createSignatureEnvironment( + request.getSignatureInfo().getVerifySignatureEnvironment(), + supplements); + xmlSignature = buildXMLSignature(signatureEnvironment, request); + + // build the list of DataObjects + dataObjectList = buildDataObjectList(supplements); + + // build profile + profile = profileFactory.createProfile(); + + // get the signingTime + signingTime = request.getDateTime(); + + // make the signature environment the root of the document, if it is not a + // separate document anyway; this is done to assure that canonicalization + // of the signature environment contains the correct namespace declarations + requestElement = + signatureEnvironment.getElement().getOwnerDocument().getDocumentElement(); + if (requestElement != signatureEnvironment.getElement()) { + signatureEnvironmentParent = + signatureEnvironment.getElement().getParentNode(); + requestElement.getOwnerDocument().replaceChild( + signatureEnvironment.getElement(), + requestElement); + } + + // verify the signature + try { + XMLSignatureVerificationModule module = + XMLSignatureVerificationModuleFactory.getInstance(); + + module.setLog(new IaikLog(loggingCtx.getNodeID())); + + result = + module.verifySignature( + xmlSignature, + dataObjectList, + profile, + signingTime, + new TransactionId(context.getTransactionID())); + } catch (IAIKException e) { + MOAException moaException = IaikExceptionMapper.getInstance().map(e); + throw moaException; + } catch (IAIKRuntimeException e) { + MOAException moaException = IaikExceptionMapper.getInstance().map(e); + throw moaException; + } + + // swap back in the request as root document + if (requestElement != signatureEnvironment.getElement()) { + requestElement.getOwnerDocument().replaceChild( + requestElement, + signatureEnvironment.getElement()); + signatureEnvironmentParent.appendChild(signatureEnvironment.getElement()); + } + + // check the result + signatureManifestCheck = + validateSignatureManifest(request, result, profile); + + // Check if signer certificate is in trust profile's allowed signer certificates pool + TrustProfile trustProfile = context.getConfiguration().getTrustProfile(request.getTrustProfileId()); + CheckResult certificateCheck = validateSignerCertificate(result, trustProfile); + + // build the response + responseBuilder.setResult(result, profile, signatureManifestCheck, certificateCheck); + + return responseBuilder.getResponse(); + } + + /** + * Checks if the signer certificate matches one of the allowed signer certificates specified + * in the provided trustProfile. + * + * @param result The result produced by the XMLSignatureVerificationModule. + * + * @param trustProfile The trust profile the signer certificate is validated against. + * + * @return The overal result of the certificate validation for the signer certificate. + * + * @throws MOAException if one of the signer certificates specified in the trustProfile + * cannot be read from the file system. + */ + private CheckResult validateSignerCertificate(XMLSignatureVerificationResult result, TrustProfile trustProfile) + throws MOAException + { + MessageProvider msg = MessageProvider.getInstance(); + + int resultCode = result.getCertificateValidationResult().getValidationResultCode().intValue(); + if (resultCode == 0 && trustProfile.getSignerCertsUri() != null) + { + X509Certificate signerCertificate = (X509Certificate) result.getCertificateValidationResult().getCertificateChain().get(0); + + File signerCertsDir = null; + try + { + signerCertsDir = new File(new URI(trustProfile.getSignerCertsUri()).getPath()); + } + catch (URIException e) + { + throw new MOASystemException("2900", null, e); // Should not happen, already checked at loading the MOA configuration + } + + File[] files = signerCertsDir.listFiles(); + if (files == null) resultCode = 1; + int i; + for (i = 0; i < files.length; i++) + { + if (!files[i].isDirectory()) + { + FileInputStream currentFIS = null; + try + { + currentFIS = new FileInputStream(files[i]); + } + catch (FileNotFoundException e) { + throw new MOASystemException("2900", null, e); + } + + try + { + X509Certificate currentCert = new X509Certificate(currentFIS); + currentFIS.close(); + if (currentCert.equals(signerCertificate)) break; + } + catch (Exception e) + { + // Simply ignore file if it cannot be interpreted as certificate + String logMsg = msg.getMessage("invoker.03", new Object[]{trustProfile.getId(), files[i].getName()}); + Logger.warn(logMsg); + try + { + currentFIS.close(); + } + catch (IOException e1) { + // If clean-up fails, do nothing + } + } + } + } + if (i >= files.length) + { + resultCode = 1; // No signer certificate from the trustprofile pool matches the actual signer certificate + } + } + + SPSSFactory factory = SPSSFactory.getInstance(); + return factory.createCheckResult(resultCode, null); + } + + /** + * Select the dsig:Signature DOM element within the signature + * environment. + * + * @param signatureEnvironment The signature environment containing the + * dsig:Signature. + * @param request The VerifyXMLSignatureRequest containing the + * signature environment. + * @return The dsig:Signature element wrapped in a + * XMLSignature object. + * @throws MOAApplicationException An error occurred locating the + * dsig:Signature. + */ + private XMLSignature buildXMLSignature( + XMLDataObject signatureEnvironment, + VerifyXMLSignatureRequest request) + throws MOAApplicationException { + + VerifySignatureLocation signatureLocation = + request.getSignatureInfo().getVerifySignatureLocation(); + Element signatureParent; + + // evaluate the VerifySignatureLocation to get the signature parent + signatureParent = + InvokerUtils.evaluateSignatureLocation( + signatureEnvironment.getElement(), + signatureLocation); + + // check for signatureParent to be a dsig:Signature element + if (!"Signature".equals(signatureParent.getLocalName()) + || !Constants.DSIG_NS_URI.equals(signatureParent.getNamespaceURI())) { + throw new MOAApplicationException("2266", null); + } + + return new XMLSignatureImpl(signatureParent); + } + + /** + * Build the supplemental data objects contained in the + * VerifyXMLSignatureRequest. + * + * @param supplements A List of + * XMLDataObjectAssociations containing the supplement data. + * @return A List of DataObjects representing the + * supplemental data objects. + * @throws MOASystemException A system error occurred building one of the data + * objects. + * @throws MOAApplicationException An error occurred building one of the data + * objects. + */ + private List buildDataObjectList(List supplements) + throws MOASystemException, MOAApplicationException { + List dataObjectList = new ArrayList(); + + DataObjectFactory factory = DataObjectFactory.getInstance(); + DataObject dataObject; + Iterator iter; + + if (supplements != null) { + for (iter = supplements.iterator(); iter.hasNext();) { + XMLDataObjectAssociation supplement = + (XMLDataObjectAssociation) iter.next(); + dataObject = + factory.createFromXmlDataObjectAssociation(supplement, true, false); + dataObjectList.add(dataObject); + } + } + + return dataObjectList; + + } + + /** + * Get the supplemental data contained in the + * VerifyXMLSignatureRequest. + * + * @param request The VerifyXMLSignatureRequest containing the + * supplemental data. + * @return A List of XMLDataObjectAssociation + * objects containing the supplemental data. + * @throws MOAApplicationException An error occurred resolving one of the + * supplement profiles. + */ + private List getSupplements(VerifyXMLSignatureRequest request) + throws MOAApplicationException { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + List supplementProfiles = request.getSupplementProfiles(); + + List supplements = new ArrayList(); + + if (supplementProfiles != null) { + + List mappedProfiles = + ProfileMapper.mapSupplementProfiles(supplementProfiles, config); + Iterator iter; + + for (iter = mappedProfiles.iterator(); iter.hasNext();) { + SupplementProfileExplicit profile = + (SupplementProfileExplicit) iter.next(); + supplements.add(profile.getSupplementProfile()); + } + + } + return supplements; + } + + /** + * Perform additional validations of the + * XMLSignatureVerificationResult. + * + *

In particular, it is verified that: + *

    + *
  • Each ReferenceData object contains transformation + * chain that matches one of the Transforms given in the + * corresponding SignatureManifestCheckParams/ReferenceInfo
  • + *
  • The hash values of the TransformParameters are valid. + *
  • + *
+ *

+ * + * @param request The VerifyXMLSignatureRequest containing the + * signature to verify. + * @param result The result produced by + * XMLSignatureVerificationModule. + * @param profile The profile used for validating the request. + * @return The result of additional validations of the signature manifest. + * @throws MOAApplicationException Post-validation of the + * XMLSignatureVerificaitonResult failed. + */ + private ReferencesCheckResult validateSignatureManifest( + VerifyXMLSignatureRequest request, + XMLSignatureVerificationResult result, + XMLSignatureVerificationProfile profile) + throws MOAApplicationException { + + SPSSFactory factory = SPSSFactory.getInstance(); + MessageProvider msg = MessageProvider.getInstance(); + + // validate that each ReferenceData object contains transforms specified + // in the corresponding SignatureManifestCheckParams/ReferenceInfo + if (request.getSignatureManifestCheckParams() != null) { + List refInfos = + request.getSignatureManifestCheckParams().getReferenceInfos(); + List refDatas = filterReferenceInfos(result.getReferenceDataList()); + List failedReferencesList = new ArrayList(); + Iterator refInfoIter; + Iterator refDataIter; + + if (refInfos.size() != refDatas.size()) { + return factory.createReferencesCheckResult(1, null); + } + + refInfoIter = refInfos.iterator(); + refDataIter = + filterReferenceInfos(result.getReferenceDataList()).iterator(); + + while (refInfoIter.hasNext()) { + ReferenceInfo refInfo = (ReferenceInfo) refInfoIter.next(); + ReferenceData refData = (ReferenceData) refDataIter.next(); + List transforms = buildTransformsList(refInfo); + boolean found = false; + Iterator trIter; + + for (trIter = transforms.iterator(); trIter.hasNext() && !found;) { + found = trIter.next().equals(refData.getTransformationList()); + } + + if (!found) { + Integer refIndex = new Integer(refData.getReferenceIndex()); + String logMsg = + msg.getMessage("invoker.01", new Object[] { refIndex }); + + failedReferencesList.add(refIndex); + Logger.debug(new LogMsg(logMsg)); + } + } + + if (!failedReferencesList.isEmpty()) { + // at least one reference failed - return their indexes and check code 1 + int[] failedReferences = + CollectionUtils.toIntArray(failedReferencesList); + ReferencesCheckResultInfo checkInfo = + factory.createReferencesCheckResultInfo(null, failedReferences); + + return factory.createReferencesCheckResult(1, checkInfo); + } + } + + // validate the hashes contained in all the ReferenceInfo objects of the + // security layer manifest + if (request.getSignatureManifestCheckParams() != null + && result.containsSecurityLayerManifest()) { + Map hashValues = buildTransformParameterHashValues(request); + Set transformParameterURIs = + buildTransformParameterURIs(profile.getTransformationSupplements()); + List referenceInfoList = + result.getSecurityLayerManifest().getReferenceDataList(); + Iterator refIter; + + for (refIter = referenceInfoList.iterator(); refIter.hasNext();) { + iaik.server.modules.xmlverify.ReferenceInfo ref = + (iaik.server.modules.xmlverify.ReferenceInfo) refIter.next(); + byte[] hash = (byte[]) hashValues.get(ref.getURI()); + + if (!transformParameterURIs.contains(ref.getURI()) + || (hash != null && !Arrays.equals(hash, ref.getHashValue()))) { + + // the transform parameter doesn't exist or the hashs do not match + // return the index of the failed reference and check code 1 + int[] failedReferences = new int[] { ref.getReferenceIndex()}; + ReferencesCheckResultInfo checkInfo = + factory.createReferencesCheckResultInfo(null, failedReferences); + String logMsg = + msg.getMessage( + "invoker.02", + new Object[] { new Integer(ref.getReferenceIndex())}); + + Logger.debug(new LogMsg(logMsg)); + + return factory.createReferencesCheckResult(1, checkInfo); + } + } + } + + return factory.createReferencesCheckResult(0, null); + } + + /** + * Get all Transforms contained in all the + * VerifyTransformsInfoProfiles of the given + * ReferenceInfo. + * + * @param refInfo The ReferenceInfo object containing + * the transformations. + * @return A List of Lists. Each of the + * Lists contains Transformation objects. + * @throws MOAApplicationException An error occurred building one of the + * Transformations. + */ + private List buildTransformsList(ReferenceInfo refInfo) + throws MOAApplicationException { + + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + List profiles = refInfo.getVerifyTransformsInfoProfiles(); + List mappedProfiles = + ProfileMapper.mapVerifyTransformsInfoProfiles(profiles, config); + List transformsList = new ArrayList(); + TransformationFactory factory = TransformationFactory.getInstance(); + Iterator iter; + + for (iter = mappedProfiles.iterator(); iter.hasNext();) { + VerifyTransformsInfoProfileExplicit profile = + (VerifyTransformsInfoProfileExplicit) iter.next(); + List transforms = profile.getTransforms(); + + if (transforms != null) { + transformsList.add(factory.createTransformationList(transforms)); + } + } + + return transformsList; + } + + /** + * Build the Set of all TransformParameter URIs. + * + * @param transformParameters The List of + * TransformParameters, as provided to the verification. + * @return The Set of all TransformParameter URIs. + */ + private Set buildTransformParameterURIs(List transformParameters) { + Set uris = new HashSet(); + Iterator iter; + + for (iter = transformParameters.iterator(); iter.hasNext();) { + DataObject transformParameter = (DataObject) iter.next(); + uris.add(transformParameter.getURI()); + } + + return uris; + } + + /** + * Build a mapping between TransformParameter URIs (a + * String and dsig:HashValue (a + * byte[]). + * + * @param request The VerifyXMLSignatureRequest. + * @return Map The resulting mapping. + * @throws MOAApplicationException An error occurred accessing one of + * the profiles. + */ + private Map buildTransformParameterHashValues(VerifyXMLSignatureRequest request) + throws MOAApplicationException { + + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + Map hashValues = new HashMap(); + List refInfos = + request.getSignatureManifestCheckParams().getReferenceInfos(); + Iterator refIter; + + for (refIter = refInfos.iterator(); refIter.hasNext();) { + ReferenceInfo refInfo = (ReferenceInfo) refIter.next(); + List profiles = refInfo.getVerifyTransformsInfoProfiles(); + List mappedProfiles = + ProfileMapper.mapVerifyTransformsInfoProfiles(profiles, config); + Iterator prIter; + + for (prIter = mappedProfiles.iterator(); prIter.hasNext();) { + VerifyTransformsInfoProfileExplicit profile = + (VerifyTransformsInfoProfileExplicit) prIter.next(); + List trParameters = profile.getTransformParameters(); + Iterator trIter; + + for (trIter = trParameters.iterator(); trIter.hasNext();) { + TransformParameter transformParameter = + (TransformParameter) trIter.next(); + String uri = transformParameter.getURI(); + + if (transformParameter.getTransformParameterType() + == TransformParameter.HASH_TRANSFORMPARAMETER) { + hashValues.put( + uri, + ((TransformParameterHash) transformParameter).getDigestValue()); + } + + } + } + } + return hashValues; + } + + /** + * Filter the ReferenceInfos returned by the + * VerifyXMLSignatureResult for comparison with the + * ReferenceInfo elements in the request. + * + * @param referenceInfos The ReferenceInfos from the + * VerifyXMLSignatureResult. + * @return A List of all ReferenceInfos whose type + * is not a XMLDsig manifest, Security Layer manifest, or ETSI signed + * property. + */ + private List filterReferenceInfos(List referenceInfos) { + List filtered = new ArrayList(); + Iterator iter; + + for (iter = referenceInfos.iterator(); iter.hasNext();) { + iaik.server.modules.xmlverify.ReferenceInfo refInfo = + (iaik.server.modules.xmlverify.ReferenceInfo) iter.next(); + String refType = refInfo.getReferenceType(); + + if (refType == null || !FILTERED_REF_TYPES.contains(refType)) { + filtered.add(refInfo); + } + } + + return filtered; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java new file mode 100644 index 000000000..5df13a337 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java @@ -0,0 +1,144 @@ +package at.gv.egovernment.moa.spss.server.invoke; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import iaik.server.modules.xmlverify.XMLSignatureVerificationProfile; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; +import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.iaik.pki.PKIProfileImpl; +import at.gv.egovernment.moa.spss.server.iaik.xmlverify.XMLSignatureVerificationProfileImpl; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * A factory to create a XMLSignatureVerificationProfile from a + * VerifyXMLSignatureRequest, based on the current MOA + * configuration. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureVerificationProfileFactory { + + /** The VerifyXMLSignatureRequest for which to create profile + * information. */ + private VerifyXMLSignatureRequest request; + + /** + * Create a new XMLSignatureVerificationProfileFactory. + * + * @param request The VerifyXMLSignatureRequest to extract + * profile data from. + */ + public XMLSignatureVerificationProfileFactory(VerifyXMLSignatureRequest request) { + this.request = request; + } + + /** + * Create a XMLSignatureCreationProfile from the + * VerifyXMLSignaturesRequest and the current MOA configuration. + * + * @return The XMLSignatureVerificationProfile containing + * additional information for verifying an XML signature. + * @throws MOASystemException A system error occurred building the profile. + * @throws MOAApplicationException An error occurred building the profile. + */ + public XMLSignatureVerificationProfile createProfile() + throws MOASystemException, MOAApplicationException { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + XMLSignatureVerificationProfileImpl profile = + new XMLSignatureVerificationProfileImpl(); + SignatureManifestCheckParams checkParams; + String trustProfileID; + + // set whether to check XMLDsig manifests + profile.setCheckXMLDsigManifests(true); + + // set the certificate validation profile + trustProfileID = request.getTrustProfileId(); + profile.setCertificateValidationProfile( + new PKIProfileImpl(config, trustProfileID)); + + // set whether hash input data is to be included + profile.setIncludeHashInputData(request.getReturnHashInputData()); + + // set the security layer manifest check parameters + // and transformation supplements (if present) + checkParams = request.getSignatureManifestCheckParams(); + profile.setCheckSecurityLayerManifest(true); + profile.setIncludeReferenceInputData(checkParams != null ? checkParams.getReturnReferenceInputData() : false); + if (checkParams != null) { + List transformationSupplements; + transformationSupplements = buildTransformationSupplements(); + profile.setTransformationSupplements(transformationSupplements); + } else { + profile.setTransformationSupplements(Collections.EMPTY_LIST); + } + + return profile; + } + + /** + * Build supplemental data objects used in the transformations. + * + * @return A List of DataObjects providing + * supplemental data to the transformations. + * @throws MOASystemException A system error occurred building one of the + * transformations. + * @throws MOAApplicationException An error occurred building one of the + * transformations. + */ + public List buildTransformationSupplements() + throws MOASystemException, MOAApplicationException { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ConfigurationProvider config = context.getConfiguration(); + SignatureManifestCheckParams checkParams = + request.getSignatureManifestCheckParams(); + List transformsProfiles = new ArrayList(); + List transformationSupplements = new ArrayList(); + DataObjectFactory factory = DataObjectFactory.getInstance(); + List refInfos = checkParams.getReferenceInfos(); + Iterator refIter; + Iterator prIter; + Iterator trIter; + + // build the list of all VerifyTransformsInfoProfiles in all ReferenceInfos + refInfos = checkParams.getReferenceInfos(); + for (refIter = refInfos.iterator(); refIter.hasNext();) { + ReferenceInfo refInfo = (ReferenceInfo) refIter.next(); + List profiles = refInfo.getVerifyTransformsInfoProfiles(); + + transformsProfiles.addAll( + ProfileMapper.mapVerifyTransformsInfoProfiles(profiles, config)); + } + + // build the DataObjects + for (prIter = transformsProfiles.iterator(); prIter.hasNext();) { + VerifyTransformsInfoProfileExplicit profile = + (VerifyTransformsInfoProfileExplicit) prIter.next(); + List transformParameters = profile.getTransformParameters(); + + for (trIter = transformParameters.iterator(); trIter.hasNext();) { + TransformParameter trParam = (TransformParameter) trIter.next(); + transformationSupplements.add( + factory.createFromTransformParameter(trParam)); + } + } + + return transformationSupplements; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java new file mode 100644 index 000000000..068fab5ca --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java @@ -0,0 +1,126 @@ +package at.gv.egovernment.moa.spss.server.logging; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import iaik.logging.TransactionId; + +/** + * An implementation of the iaik.logging.Log + * interface that is based on Jakarta Commons-Logging. + * + * @author Fatemeh Philippi + * @version $Id$ + */ +public class IaikLog implements iaik.logging.Log { + /** The hierarchy to log all IAIK output to. */ + public static final String IAIK_LOG_HIERARCHY = "iaik.server"; + /** The commons-loggin Log to use for logging the messages. */ + private static Log log = LogFactory.getLog(IAIK_LOG_HIERARCHY); + /** The node ID to use. */ + private String nodeId; + + /** + * Create a new IaikLog. + * + * @param nodeId The node ID for this Log object. + */ + public IaikLog(String nodeId) { + this.nodeId = nodeId; + } + + /** + * @see iaik.logging.Log#isDebugEnabled() + */ + public boolean isDebugEnabled() { + return log.isDebugEnabled(); + } + + /** + * @see iaik.logging.Log#debug(TransactionId, Object, Throwable) + */ + public void debug(TransactionId transactionId, Object message, Throwable t) { + IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + + log.debug(msg, t); + } + + /** + * @see iaik.logging.Log#isInfoEnabled() + */ + public boolean isInfoEnabled() { + return log.isInfoEnabled(); + } + + /** + * @see iaik.logging.Log#info(TransactionId, Object, Throwable) + */ + public void info(TransactionId transactionId, Object message, Throwable t) { + IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + + log.info(msg, t); + } + + /** + * @see iaik.logging.Log#isWarnEnabled() + */ + public boolean isWarnEnabled() { + return log.isWarnEnabled(); + } + + /** + * @see iaik.logging.Log#warn(TransactionId, Object, Throwable) + */ + public void warn(TransactionId transactionId, Object message, Throwable t) { + IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + + log.warn(msg, t); + } + + /** + * @see iaik.logging.Log#isErrorEnabled() + */ + public boolean isErrorEnabled() { + return log.isErrorEnabled(); + } + + /** + * @see iaik.logging.Log#error(TransactionId, Object, Throwable) + */ + public void error(TransactionId transactionId, Object message, Throwable t) { + IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + + log.error(msg, t); + } + + /** + * @see iaik.logging.Log#isFatalEnabled() + */ + public boolean isFatalEnabled() { + return log.isFatalEnabled(); + } + + /** + * @see iaik.logging.Log#fatal(TransactionId, Object, Throwable) + */ + public void fatal(TransactionId transactionId, Object message, Throwable t) { + IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + + log.fatal(msg, t); + } + + /** + * @see iaik.logging.Log#setNodeId(String) + */ + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + /** + * @see iaik.logging.Log#getNodeId() + */ + public String getNodeId() { + return nodeId; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java new file mode 100644 index 000000000..a0e4def86 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java @@ -0,0 +1,42 @@ +package at.gv.egovernment.moa.spss.server.logging; + +import iaik.logging.Log; +import iaik.logging.LogConfigurationException; +import iaik.logging.LogFactory; + +import at.gv.egovernment.moa.logging.LoggingContextManager; + +/** + * An implementation of the iaik.logging.LogFactory abstract + * class to log messages to the MOA logging subsystem. + * + * @author Patrick Peck + * @version $Id$ + */ +public class IaikLogFactory extends LogFactory { + + public Log getInstance(Class clazz) throws LogConfigurationException { + return getInstanceImpl(); + } + + public Log getInstance(String name) throws LogConfigurationException { + return getInstanceImpl(); + } + + /** + * Return an instance of iaik.logging.Log. + * + * @return The iaik.logging.Log object to log messages to. + */ + private Log getInstanceImpl() { + String nodeID = + LoggingContextManager.getInstance().getLoggingContext().getNodeID(); + + return new IaikLog(nodeID); + } + + public void release() { + // we do not hold any resources + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java new file mode 100644 index 000000000..75fb388a9 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java @@ -0,0 +1,54 @@ +package at.gv.egovernment.moa.spss.server.logging; + +import iaik.logging.TransactionId; + +/** + * A unified message type to log messages from the IAIK subsystem. + * + * @author Patrick Peck + * @version $Id$ + */ +public class IaikLogMsg { + + /** The transaction ID of this message. */ + private TransactionId transactionId; + /** The node ID of this message. */ + private String nodeId; + /** The message to log. */ + private Object message; + + /** + * Create a IaikLogMsg object. + * + * @param transactionId The transaction id of the transaction which + * generated this log message. May be null. + * @param nodeId The node id where this message was generated. May be + * null. + * @param message The actual message to log. May be null. + */ + public IaikLogMsg(TransactionId transactionId, String nodeId, Object message) { + this.transactionId = transactionId; + this.nodeId = nodeId; + this.message = message; + } + + + /** + * Convert this log message to a String. + * + * @return The String representation of this log message. + */ + public String toString() { + StringBuffer msg = new StringBuffer(); + + msg.append("TID="); + msg.append(transactionId != null ? transactionId.getLogID() : ""); + msg.append(" NID="); + msg.append(nodeId != null ? nodeId : ""); + msg.append(" MSG="); + msg.append(message != null ? message.toString() : ""); + + return msg.toString(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java new file mode 100644 index 000000000..9e0239464 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java @@ -0,0 +1,38 @@ +package at.gv.egovernment.moa.spss.server.logging; + +/** + * An implementation of the iaik.logging.TransactionId interface. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TransactionId implements iaik.logging.TransactionId { + + /** The String representation for logging the transaction ID. */ + private String logID; + + /** + * Create a TransactionId object. + * + * @param logID The transaction id as it should be presented to the logging + * subsystem. + */ + public TransactionId(String logID) { + this.logID = logID; + } + + /** + * @see iaik.logging.TransactionId#getLogID() + */ + public String getLogID() { + return logID; + } + + /** + * @see java.lang.Object#toString() + */ + public String toString() { + return getLogID(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java new file mode 100644 index 000000000..befbd58dd --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -0,0 +1,382 @@ +package at.gv.egovernment.moa.spss.server.service; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.cert.X509Certificate; +import java.util.Iterator; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.axis.AxisFault; +import org.apache.axis.Message; +import org.apache.axis.MessageContext; +import org.apache.axis.attachments.AttachmentPart; +import org.apache.axis.handlers.BasicHandler; +import org.apache.axis.transport.http.HTTPConstants; +import org.apache.axis.utils.Messages; +import org.apache.axis.utils.XMLUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; +import at.gv.egovernment.moa.spss.server.transaction.TransactionIDGenerator; +import at.gv.egovernment.moa.spss.util.MessageProvider; +import at.gv.egovernment.moa.util.DOMUtils; + +/** + * An handler that is invoked on each web service request and performs some + * central message handling. + * + * Mainly sets up the TransactionContext for the current + * transaction (i.e. web service request). + * + * @author Patrick Peck + * @author Stefan Knirsch + * @version $Id$ + */ +public class AxisHandler extends BasicHandler { + + /** The resource names of the messages to load. */ + private static final String MOA_SPSS_WSDL_RESOURCE_ = "/resources/wsdl/MOA-SPSS-1.3.wsdl"; + + /** The property name for accessing the HTTP request. */ + private static final String REQUEST_PROPERTY = HTTPConstants.MC_HTTP_SERVLETREQUEST; + + /** The property name for accessing the X509 client certificate chain. */ + private static final String X509_CERTIFICATE_PROPERTY = "javax.servlet.request.X509Certificate"; + + /** The property name for accessing the SOAP action header. */ + private static final String SOAP_ACTION_HEADER = "soapaction"; + + /** URI of the SOAP XML namespace. */ + public static final String SOAP_NS_URI = "http://schemas.xmlsoap.org/soap/envelope/"; + + /** Prefix used for the SOAP XML namespace */ + public static final String SOAP_PREFIX = "soapenv"; + + /** Simple string contains the front part of the enveloping SOAP wrapping */ + private static final String SOAP_PART_PRE = ""; + + /** Simple string contains the post part of the enveloping SOAP wrapping */ + private static final String SOAP_PART_POST = ""; + + /** + * Handle an invocation of this handler. + * + * @param msgContext Information about this request/response. + * @throws AxisFault An error occurred during processing of the request. + * @see org.apache.axis.Handler#invoke(MessageContext) + */ + public void invoke(MessageContext msgContext) throws AxisFault { + if (!msgContext.getPastPivot()) { + handleRequest(msgContext); + } else { + handleResponse(msgContext); + } + } + + /** + * This method is called by invoke to handle incoming requests. + * + * @param msgContext The context as provided to invoke. + * @throws AxisFault An error occurred during processing of the request. + */ + private void handleRequest(MessageContext msgContext) throws AxisFault { + try { + // generate a unique transaction id and build the TransactionContext + // for this request + HttpServletRequest request = + (HttpServletRequest) msgContext.getProperty(REQUEST_PROPERTY); + + X509Certificate[] clientCert = + (X509Certificate[]) request.getAttribute(X509_CERTIFICATE_PROPERTY); + + //Configure Axis + //msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE); + + Message soapMessage = msgContext.getCurrentMessage(); + + ConfigurationProvider configuration = + ConfigurationProvider.getInstance(); + + Element xmlRequest = null; + Element soapPart = DOMUtils.parseDocument(new ByteArrayInputStream(soapMessage.getSOAPPartAsBytes()), false, null, null).getDocumentElement(); + if (soapPart!=null) { + NodeList soapBodies = soapPart.getElementsByTagNameNS(SOAP_NS_URI, "Body"); + if (soapBodies!=null && soapBodies.getLength()>0) { + xmlRequest = (Element) soapBodies.item(0).getFirstChild(); + } + //oder TODO: Evaluierung ob XPATH schneller + /* + HashMap nSMap = new HashMap(); + nSMap.put((String)SOAP_PREFIX, SOAP_NS_URI); + Element soapBody = (Element) XPathUtils.selectSingleNode(soapPart, nSMap, "/"+SOAP_PREFIX+":Envelope/"+SOAP_PREFIX+":Body"); + if (soapBody!=null) { + xmlRequest= (Element) soapBody.getFirstChild(); + } + */ + } + + TransactionContext context = + new TransactionContext( + TransactionIDGenerator.nextID(), + clientCert, + configuration, + xmlRequest, + null); + + String soapAction = (String) request.getHeader(SOAP_ACTION_HEADER); + if ("\"\"".equals(soapAction)) { + // if http soap action header is empty + soapAction = msgContext.getTargetService(); + } + context.setRequestName(soapAction); + + int attachmentCount = soapMessage.getAttachmentsImpl().getAttachmentCount(); + if (attachmentCount>0) { + + // add SOAP attachments to transaction context + Iterator iterator = soapMessage.getAttachments(); + while (iterator.hasNext()) { + AttachmentPart attachment = (AttachmentPart)iterator.next(); + String id = attachment.getContentId(); + String type = attachment.getContentType(); + + //Now get the InputStream (note: we could also get the content with Object content = attachment.getContent();) + InputStream is = null; + javax.activation.DataHandler datahandler = attachment.getDataHandler(); + org.apache.axis.attachments.ManagedMemoryDataSource mmds = (org.apache.axis.attachments.ManagedMemoryDataSource)datahandler.getDataSource(); + if (mmds!=null){ + is = mmds.getInputStream(); + } + debug("handler.06", new Object[] {id, type}); + context.addAttachment(id, type, mmds); + } + } + + setUpContexts(context); + + // log some information about the request + info( + "handler.00", + new Object[] { + context.getTransactionID(), + msgContext.getTargetService()}); + info("handler.01", new Object[] { request.getRemoteAddr()}); + if (clientCert != null) { + info( + "handler.02", + new Object[] { + clientCert[0].getSubjectDN(), + clientCert[0].getSerialNumber(), + clientCert[0].getIssuerDN()}); + + } else { + info("handler.03", null); + } + if (Logger.isDebugEnabled()) { + String msg = soapMessage.getSOAPPartAsString(); + Logger.debug(new LogMsg(msg)); + } + } catch (MOASystemException e) { + MOASystemException se = new MOASystemException("2900", null, e); + AxisFault fault = AxisFault.makeFault(se); + fault.setFaultDetail(new Element[] { se.toErrorResponse()}); + throw fault; + } catch (Throwable t) { + t.printStackTrace(); + Logger.info(new LogMsg(t.getStackTrace())); + MOASystemException e = new MOASystemException("2900", null, t); + AxisFault fault = AxisFault.makeFault(e); + fault.setFaultDetail(new Element[] { e.toErrorResponse()}); + throw fault; + } + } + + /** + * This method is called by invoke to handle outgoing + * responses. + * + * @param msgContext The context as provided to invoke. + * @throws AxisFault An error occurred during processing of the response. + */ + private void handleResponse(MessageContext msgContext) throws AxisFault { + String xmlResponseString = null; + String soapResponseString = null; + + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); + Element xmlResponse = context.getResponse(); + + if (xmlResponse!=null) { + try { + xmlResponseString = DOMUtils.serializeNode(xmlResponse, true); + /* + Soll die Antwort nur \n enthalten, so gibt es 2 Möglichkeiten: + 1.) höhere Xalan Version und + xmlResponseString = DOMUtils.serializeNode(xmlResponse, true, "\n"); + 2.) + OutputFormat serializerFormat = new OutputFormat((Document) xmlResponse.getOwnerDocument()); + serializerFormat.setLineSeparator("\n"); + serializerFormat.setIndenting(false); + serializerFormat.setPreserveSpace(true); + serializerFormat.setOmitXMLDeclaration(true); + serializerFormat.setEncoding("UTF-8"); + ByteArrayOutputStream serializedBytes = new ByteArrayOutputStream(); + XMLSerializer serializer = new XMLSerializer(serializedBytes, serializerFormat); + serializer.serialize(xmlResponse); + serializedBytes.close(); + xmlResponseString = serializedBytes.toString("UTF-8"); + */ + soapResponseString = SOAP_PART_PRE + xmlResponseString + SOAP_PART_POST; + //override axis response-message + msgContext.setResponseMessage(new Message(soapResponseString)); + } catch (Throwable t) { + t.printStackTrace(); + Logger.info(new LogMsg(t.getStackTrace())); + MOASystemException e = new MOASystemException("2900", null, t); + AxisFault fault = AxisFault.makeFault(e); + fault.setFaultDetail(new Element[] { e.toErrorResponse()}); + throw fault; + } + + } else { + //Fallback: if functions do not set the resulting response in the transaction, the original one from axis will be used + soapResponseString = msgContext.getCurrentMessage().getSOAPPartAsString(); + } + + info("handler.04", null); + if (Logger.isDebugEnabled()) { + Logger.debug(new LogMsg(soapResponseString)); + } + tearDownContexts(); + } + + /** + * Called, when the processing of the web service fails. + * + * @param msgContext Information about the current request. + * @see org.apache.axis.Handler#onFault(org.apache.axis.MessageContext) + */ + public void onFault(MessageContext msgContext) { + info("handler.05", null); + tearDownContexts(); + } + + /** + * Set up the thread-local contexts (TransactionContext and + * LoggingContext). + * + * @param context The TransactionContext to set for the current + * request. + */ + private void setUpContexts(TransactionContext context) { + // set the transaction context in the TransactionContextManager + TransactionContextManager tcm = TransactionContextManager.getInstance(); + tcm.setTransactionContext(context); + + // set the logging context in the LoggingContextManager + LoggingContextManager lcm = LoggingContextManager.getInstance(); + LoggingContext lc = new LoggingContext(context.getTransactionID()); + lcm.setLoggingContext(lc); + } + + /** + * Tear down the thread-local contexts. + */ + private void tearDownContexts() { + TransactionContextManager tcm = TransactionContextManager.getInstance(); + + //delete temporary files + TransactionContext context = tcm.getTransactionContext(); + context.cleanAttachmentCache(); + + // unset the transaction context + tcm.setTransactionContext(null); + + // unset the logging context + LoggingContextManager lcm = LoggingContextManager.getInstance(); + lcm.setLoggingContext(null); + } + + /** + * Generate the WSDL into the msgContext. + * + * The code of this method is more or less copied from the + * org.apache.axis.handlers.soap.SOAPService class contained in + * the 1.1 release of Axis to allow for a missing wsdlFile (so + * that a resource by the same name is searched for in the classpath). The + * implementation of this method should be obsolete if Axis 1.1 or higher is + * used. + * + * @param msgContext The MessageContext that will contain the + * WSDL description of the current web service. + * @throws AxisFault An error occurred producing the WSDL. + */ + public void generateWSDL(MessageContext msgContext) throws AxisFault { + InputStream instream = null; + + try { + String filename = MOA_SPSS_WSDL_RESOURCE_; + File file = new File(filename); + if (file.exists()) { + //if this resolves to a file, load it + instream = new FileInputStream(filename); + } else { + //else load a named resource in our classloader. + instream = this.getClass().getResourceAsStream(filename); + if (instream == null) { + String errorText = Messages.getMessage("wsdlFileMissing", filename); + throw new AxisFault(errorText); + } + } + Document doc = XMLUtils.newDocument(instream); + msgContext.setProperty("WSDL", doc); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } finally { + if (instream != null) { + try { + instream.close(); + } catch (IOException e) { + // ok to do nothing here + } + } + } + } + + /** + * Utility function to issue an info message to the log. + * + * @param messageId The ID of the message to log. + * @param parameters Additional message parameters. + */ + private static void info(String messageId, Object[] parameters) { + MessageProvider msg = MessageProvider.getInstance(); + + Logger.info(new LogMsg(msg.getMessage(messageId, parameters))); + } + + /** + * Utility function to issue an debug message to the log. + * + * @param messageId The ID of the message to log. + * @param parameters Additional message parameters. + */ + private static void debug(String messageId, Object[] parameters) { + MessageProvider msg = MessageProvider.getInstance(); + + Logger.debug(new LogMsg(msg.getMessage(messageId, parameters))); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java new file mode 100644 index 000000000..7783ed3f6 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java @@ -0,0 +1,120 @@ +package at.gv.egovernment.moa.spss.server.service; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; +import at.gv.egovernment.moa.spss.server.init.*; +import at.gv.egovernment.moa.spss.util.MessageProvider; + +/** + * A servlet to initialize and update the MOA configuration. + * + * @author Fatemeh Philippi + * @author Patrick Peck + * @version $Id$ + */ +public class ConfigurationServlet extends HttpServlet { + /** The document type of the HTML to generate. */ + private static final String DOC_TYPE = + "\n"; + + /** + * Handle a HTTP GET request, used to indicated that the MOA + * configuration needs to be updated (reloaded). + * + * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest, HttpServletResponse) + */ + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + MessageProvider msg = MessageProvider.getInstance(); + PrintWriter out; + + // set up a logging context for logging the reconfiguration + LoggingContextManager.getInstance().setLoggingContext( + new LoggingContext("configuration update")); + + response.setContentType("text/html"); + out = response.getWriter(); + out.println(DOC_TYPE); + out.println("MOA configuration update"); + out.println(""); + try { + // reconfigure the system + ConfigurationProvider config = ConfigurationProvider.reload(); + IaikConfigurator iaikConfigurator = new IaikConfigurator(); + + iaikConfigurator.configure(config); + + // print a status message + out.println("

" + msg.getMessage("config.06", null) + "

"); + Logger.info(new LogMsg(msg.getMessage("config.06", null))); + + if (!config.getWarnings().isEmpty()) { + // print the warnings + List allWarnings = new ArrayList(); + Iterator iter; + + allWarnings.addAll(config.getWarnings()); + allWarnings.addAll(iaikConfigurator.getWarnings()); + + out.println("

" + msg.getMessage("config.29", null) + "

"); + for (iter = allWarnings.iterator(); iter.hasNext();) { + out.println(iter.next() + "
"); + } + out.println("

" + msg.getMessage("config.28", null) + "

"); + } + + } catch (Throwable t) { + out.println("

" + msg.getMessage("config.20", null) + "

"); + out.println("

" + msg.getMessage("config.28", null) + "

"); + Logger.warn(new LogMsg(msg.getMessage("config.20", null)), t); + } + out.println(""); + + out.flush(); + out.close(); + + // tear down the logging context + LoggingContextManager.getInstance().setLoggingContext(null); + } + + /** + * Do the same as doGet. + * + * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest, HttpServletResponse) + */ + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + doGet(request, response); + } + + /** + * Perform some initial initialization tasks for the MOA web services + * application. + * + * Does an initial load of the MOA configuration to test if a working web + * service can be provided. + * + * @see javax.servlet.GenericServlet#init() + */ + public void init() throws ServletException { + SystemInitializer.init(); + } + +} \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java new file mode 100644 index 000000000..26d79dbd8 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java @@ -0,0 +1,78 @@ +package at.gv.egovernment.moa.spss.server.service; + +import iaik.pki.revocation.RevocationSourceTypes; +import iaik.pki.store.revocation.archive.Archive; +import iaik.pki.store.revocation.archive.ArchiveFactory; + +import java.util.Date; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.logging.TransactionId; +import at.gv.egovernment.moa.spss.util.MessageProvider; + +/** + * A Runnable for periodically cleaning up the revocation archive. + * @author Patrick Peck + * @version $Id$ + */ +public class RevocationArchiveCleaner implements Runnable { + + /** The inverval between two clean-ups of the revocation archive. */ + private long archiveCleanupInterval; + + /** + * Create a new RevocationArchiveCleaner. + * + * @param archiveCleanupInterval The interval between two clean-ups of the + * revocation archive. + */ + public RevocationArchiveCleaner(long archiveCleanupInterval) { + this.archiveCleanupInterval = archiveCleanupInterval; + } + + /** + * Run the RevocationArchiveCleaner in its own + * Thread. + */ + public void run() { + while (true) { + try { + ConfigurationProvider config = ConfigurationProvider.getInstance(); + boolean enableArchiving = config.getEnableRevocationArchiving(); + + if (enableArchiving) + { + Archive archive = ArchiveFactory.getInstance().getArchive(); + long archiveDurationMillis = + (long) config.getCRLArchiveDuration() * 86400000; + + // delete old archive data + if (archiveDurationMillis > 0) { + Date olderThan = + new Date(System.currentTimeMillis() - archiveDurationMillis); + + archive.deleteOldArchiveEntries( + RevocationSourceTypes.CRL, + olderThan, + new TransactionId("RevocationArchiveCleaner")); + } + } + + } catch (Exception e) { + MessageProvider msg = MessageProvider.getInstance(); + Logger.error(new LogMsg(msg.getMessage("init.02", null)), e); + } + + // sleep + try { + Thread.sleep(archiveCleanupInterval * 1000); + } catch (InterruptedException e) { + // ok to do nothing here + } + + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java new file mode 100644 index 000000000..4224f5665 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java @@ -0,0 +1,72 @@ +package at.gv.egovernment.moa.spss.server.service; + +import java.io.ByteArrayInputStream; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.MOAApplicationException; + +/** + * Helper methods for the Service classes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ServiceUtils { + + /** + * Schema-validate a request. + * + * @param request The request to validate. + * @throws MOAApplicationException An error occurred validating the requst. + */ + public static void validateRequest(Element[] request) + throws MOAApplicationException { + + // validate the request + try { + DOMUtils.validateElement( + request[0], + Constants.ALL_SCHEMA_LOCATIONS, + null); + } catch (Exception e) { + throw new MOAApplicationException( + "1100", + new Object[] { e.getMessage()}, + e); + } + } + + /** + * Reparse the request with schema-validation turned on so that ID references + * are resolved. + * + * @param request The request to reparse. + * @return The reparsed request. + * @throws MOAApplicationException An error occurred parsing the request. + */ + public static Element reparseRequest(Element request) + throws MOAApplicationException { + + try { + byte[] requestBytes = DOMUtils.serializeNode(request, "UTF-8"); + Document validatedRequest = + DOMUtils.parseDocument( + new ByteArrayInputStream(requestBytes), + true, + Constants.ALL_SCHEMA_LOCATIONS, + null); + return validatedRequest.getDocumentElement(); + } catch (Exception e) { + throw new MOAApplicationException( + "1100", + new Object[] { e.getMessage()}, + e); + } + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java new file mode 100644 index 000000000..2d548ea3a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java @@ -0,0 +1,104 @@ +package at.gv.egovernment.moa.spss.server.service; + +import java.util.Collections; + +import javax.xml.namespace.QName; + +import org.apache.axis.AxisFault; +import org.apache.axis.i18n.Messages; +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureCreationInvoker; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.StreamUtils; + +/** + * The service endpoint for the SignatureCreation web service. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SignatureCreationService { + + /** + * Handle a CreateXMLSignatureRequest. + * + * @param request The CreateXMLSignatureRequest to work on + * (contained in the 0th element of the array). + * @return A CreateXMLSignatureResponse as the only element of + * the Element array. + * @throws AxisFault An error occurred during handling of the message. + */ + public Element[] CreateXMLSignatureRequest(Element[] request) + throws AxisFault { + XMLSignatureCreationInvoker invoker = + XMLSignatureCreationInvoker.getInstance(); + Element[] response = new Element[1]; + + // check that we have a CreateXMLSignatureRequest; if not, create an + // AxisFault, just like the org.apache.axis.providers.java.MsgProvider + if (!Constants.MOA_SPSS_CREATE_XML_REQUEST.equals(request[0].getLocalName()) || + !Constants.MOA_NS_URI.equals(request[0].getNamespaceURI())) + { + QName qname = + new QName(request[0].getNamespaceURI(), request[0].getLocalName()); + throw new AxisFault( + Messages.getMessage("noOperationForQName", qname.toString())); // TODO GK Operation name does not make it into the error repsonse + } + + // handle the request + try { + // create a parser and builder for binding API objects to/from XML + CreateXMLSignatureRequestParser requestParser = + new CreateXMLSignatureRequestParser(); + CreateXMLSignatureResponseBuilder responseBuilder = + new CreateXMLSignatureResponseBuilder(); + Element reparsedReq; + CreateXMLSignatureRequest requestObj; + CreateXMLSignatureResponse responseObj; + + //since Axis (1.1 ff) has problem with namespaces we take the raw request stored by the Axishandler. + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); + // validate the request + reparsedReq = ServiceUtils.reparseRequest(context.getRequest()); + + // convert to API objects + requestObj = requestParser.parse(reparsedReq); + + // invoke the core logic + responseObj = + invoker.createXMLSignature(requestObj, Collections.EMPTY_SET); + + // map back to XML + response[0] = responseBuilder.build(responseObj).getDocumentElement(); + + // save response in transaction + context.setResponse(response[0]); + + } catch (MOAException e) { + AxisFault fault = AxisFault.makeFault(e); + fault.setFaultDetail(new Element[] { e.toErrorResponse()}); + Logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + throw fault; + } catch (Throwable t) { + MOASystemException e = new MOASystemException("2900", null, t); + AxisFault fault = AxisFault.makeFault(e); + fault.setFaultDetail(new Element[] { e.toErrorResponse()}); + Logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + throw fault; + } + + return response; + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java new file mode 100644 index 000000000..b335a6e23 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java @@ -0,0 +1,151 @@ +package at.gv.egovernment.moa.spss.server.service; + +import org.apache.axis.AxisFault; +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; +import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureVerificationInvoker; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; +import at.gv.egovernment.moa.util.StreamUtils; + +/** + * The service endpoint for the SignatureVerification web service. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SignatureVerificationService { + + /** + * Handle a VerifyCMSSignatureRequest. + * + * @param request The VerifyCMSSignatureRequest to work on + * (contained in the 0th element of the array). + * @return A VerifyCMSSignatureResponse as the only element of + * the Element array. + * @throws AxisFault An error occurred during handling of the message. + */ + public Element[] VerifyCMSSignatureRequest(Element[] request) + throws AxisFault { + CMSSignatureVerificationInvoker invoker = + CMSSignatureVerificationInvoker.getInstance(); + Element[] response = new Element[1]; + + try { + // create a parser and builder for binding API objects to/from XML + VerifyCMSSignatureRequestParser requestParser = + new VerifyCMSSignatureRequestParser(); + VerifyCMSSignatureResponseBuilder responseBuilder = + new VerifyCMSSignatureResponseBuilder(); + Element reparsedReq; + VerifyCMSSignatureRequest requestObj; + VerifyCMSSignatureResponse responseObj; + + //since Axis (1.1 ff) has problem with namespaces we take the raw request stored by the Axishandler. + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); + // validate the request + reparsedReq = ServiceUtils.reparseRequest(context.getRequest()); + + // convert to API objects + requestObj = requestParser.parse(reparsedReq); + + // invoke the core logic + responseObj = invoker.verifyCMSSignature(requestObj); + + // map back to XML + response[0] = responseBuilder.build(responseObj).getDocumentElement(); + + // save response in transaction + context.setResponse(response[0]); + + } catch (MOAException e) { + AxisFault fault = AxisFault.makeFault(e); + fault.setFaultDetail(new Element[] { e.toErrorResponse()}); + Logger.debug("Anfrage zur Signaturpruefung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + throw fault; + } catch (Throwable t) { + MOASystemException e = new MOASystemException("2900", null, t); + AxisFault fault = AxisFault.makeFault(e); + fault.setFaultDetail(new Element[] { e.toErrorResponse()}); + Logger.debug("Anfrage zur Signaturpruefung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + throw fault; + } + + return response; + } + + /** + * Handle a VerifyXMLSignatureRequest. + * + * @param request The VerifyXMLSignatureRequest to work on + * (contained in the 0th element of the array). + * @return A VerifyXMLSignatureResponse as the only element of + * the Element array. + * @throws AxisFault An error occurred during handling of the message. + */ + public Element[] VerifyXMLSignatureRequest(Element[] request) + throws AxisFault { + XMLSignatureVerificationInvoker invoker = + XMLSignatureVerificationInvoker.getInstance(); + Element[] response = new Element[1]; + + try { + // create a parser and builder for binding API objects to/from XML + VerifyXMLSignatureRequestParser requestParser = + new VerifyXMLSignatureRequestParser(); + VerifyXMLSignatureResponseBuilder responseBuilder = + new VerifyXMLSignatureResponseBuilder(); + Element reparsedReq; + VerifyXMLSignatureRequest requestObj; + VerifyXMLSignatureResponse responseObj; + + //since Axis (1.1 ff) has problem with namespaces we take the raw request stored by the Axishandler. + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); + // validate the request + reparsedReq = ServiceUtils.reparseRequest(context.getRequest()); + + // convert to API objects + requestObj = requestParser.parse(reparsedReq); + + // invoke the core logic + responseObj = invoker.verifyXMLSignature(requestObj); + + // map back to XML + response[0] = responseBuilder.build(responseObj).getDocumentElement(); + + // save response in transaction + context.setResponse(response[0]); + + } catch (MOAException e) { + AxisFault fault = AxisFault.makeFault(e); + fault.setFaultDetail(new Element[] { e.toErrorResponse()}); + Logger.debug("Anfrage zur Signaturpruefung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + throw fault; + } catch (Throwable t) { + MOASystemException e = new MOASystemException("2900", null, t); + AxisFault fault = AxisFault.makeFault(e); + fault.setFaultDetail(new Element[] { e.toErrorResponse()}); + Logger.debug("Anfrage zur Signaturpruefung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + throw fault; + } + + return response; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java new file mode 100644 index 000000000..9fe17eae2 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java @@ -0,0 +1,242 @@ +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: + *
    + *
  • printing certificate information
  • + *
  • adding certificates to the cert store
  • + *
+ * + * @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 PrintStream to print to. + */ + private void printUsage(PrintStream out) { + out.println("\nCerttool-Syntax:\n"); + out.println("-info "); + out.println("\n"); + } + +} + +/** + * Simple implementation of the DirectoryCertStoreParameters + * interface intelligent enough for setting up a simple + * DirectoryCertStore in the CertTool. + * + * @author Patrick Peck + * @version $Id$ + */ +class SimpleDirectoryCertStoreParameters + implements DirectoryCertStoreParameters { + + /** The cert store root directory. */ + private String rootDirectory; + + /** + * Create a new SimpleDirectoryCertStoreParameters object. + * + * @param rootDirectory The root directory of the cert store. + */ + public SimpleDirectoryCertStoreParameters(String rootDirectory) { + this.rootDirectory = rootDirectory; + } + + /** + * @return "MOA Directory CertStore" + * @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 false + * @see iaik.pki.store.certstore.CertStoreParameters#isReadOnly() + */ + public boolean isReadOnly() { + return false; + } + + /** + * @return false + * @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/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java new file mode 100644 index 000000000..d5c3b48c1 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java @@ -0,0 +1,59 @@ +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 "); + System.out.println(" ... Old config file to be transformed"); + System.out.println(" ... 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()); + } + } +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java new file mode 100644 index 000000000..774880d26 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java @@ -0,0 +1,264 @@ +package at.gv.egovernment.moa.spss.server.transaction; + +import iaik.ixsil.util.URI; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Vector; +import java.util.Map.Entry; + +import org.apache.axis.attachments.ManagedMemoryDataSource; +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; + +/** + * Contains information about the current request. + * + * @author Stefan Knirsch + * @author Patrick Peck + */ +public class TransactionContext { + + /** The client certificate. */ + private X509Certificate[] clientCertificate = null; + /** The transaction ID. */ + private String transactionID = null; + /** The name of the request. */ + private String requestName = null; + /** The SOAP embedded request */ + private Element request; + /** The response which is to embed by SOAP */ + private Element response; + /** The map pointing to SOAP attachments needed by the request. */ + private HashMap attachments = null; + /** The configuration to use throughout the request. */ + private ConfigurationProvider configuration = null; + + /** + * Create a TransactionContext object. + * + * @param transactionID A unique ID for this TransactionContext. + * @param clientCertificate The client certificate chain. + * @param configuration The MOA configuration to use for this transaction. + */ + public TransactionContext( + String transactionID, + X509Certificate[] clientCertificate, + ConfigurationProvider configuration) { + + this.transactionID = transactionID; + this.clientCertificate = clientCertificate; + this.configuration = configuration; + } + + /** + * Create a TransactionContext object. + * + * @param transactionID A unique ID for this TransactionContext. + * @param clientCertificate The client certificate chain. + * @param configuration The MOA configuration to use for this transaction. + * @param attachments to use for this transaction. + */ + public TransactionContext( + String transactionID, + X509Certificate[] clientCertificate, + ConfigurationProvider configuration, + Element request, + HashMap attachments) { + + this.transactionID = transactionID; + this.clientCertificate = clientCertificate; + this.configuration = configuration; + this.request = request; + this.attachments = attachments; + } + + /** + * Returns the client certificate. + * + * @return The client certificate chain, if SSL client authentication has been + * configured in the web server and has been used by the client. The 0th + * element of the array contains the client certificate. null + * otherwise. + */ + public X509Certificate[] getClientCertificate() { + return clientCertificate; + } + + /** + * Returns the unique transaction ID. + * + * @return The transaction ID. + */ + public String getTransactionID() { + return transactionID; + } + + /** + * Returns the name of the request. + * + * @return The name of the request. + */ + public String getRequestName() { + return requestName; + } + + /** + * Sets the name of the request. + * + * @param requestName The request name to set. + */ + public void setRequestName(String requestName) { + this.requestName = requestName; + } + + /** + * Sets the the request. + * + * @param request The request to set. + */ + public void setRequest(Element request) { + this.request = request; + } + + /** + * Returns the request. + * + * @return The request. + */ + public Element getRequest() { + return request; + } + + /** + * Sets the the response. + * + * @param response The response to set. + */ + public void setResponse(Element response) { + this.response = response; + } + + /** + * Returns the response. + * + * @return The response. + */ + public Element getResponse() { + return response; + } + + /** + * Adds an attachment to the transactions list of SOAP attachments. + * + * @param referenceId Identification value for the SOAP attachment. + * @param contentType MIME type of the SOAP attachment. + * @param is Handle to the ManagedMemoryDataSource of the SOAP attachment. + */ + public void addAttachment(String referenceId, String contentType, ManagedMemoryDataSource is) { + if (this.attachments == null) this.attachments = new HashMap(); + Vector entry = new Vector(2); + entry.add(contentType); + entry.add(is); + this.attachments.put(referenceId, entry); + } + + /** + * Returns the ManagedMemoryDataSource to a specific SOAP attachment identified by referenceId. + * + * @param referenceId Identification value for the SOAP attachment. + */ + public ManagedMemoryDataSource getAttachment(String referenceId) { + if (attachments==null) { + return null; + } + Vector entry = (Vector) attachments.get(referenceId); + if (entry==null) { + return null; + } + //return (InputStream) ( ((ManagedMemoryDataSource)entry.get(1)).getInputStream()); + return (ManagedMemoryDataSource) entry.get(1); + } + + /** + * Returns the InputStream to a specific SOAP attachment identified by uri. + * + * @param uri Identification value for the SOAP attachment. + */ + public InputStream getAttachmentInputStream(URI uri) throws MOAApplicationException { + if (attachments==null) { + return null; + } + String referenceId = uri.getPath(); + Vector entry = (Vector) attachments.get(referenceId); + if (entry==null) { + return null; + } + + InputStream attachmentIs = null; + try { + attachmentIs = (InputStream) ( ((ManagedMemoryDataSource)entry.get(1)).getInputStream()); + } catch (IOException e) { + throw new MOAApplicationException("2208", new Object[] { uri }, e); + } + + return attachmentIs; + //If we would return the whole mmds: return (ManagedMemoryDataSource) entry.get(1); + } + + /** + * Returns the content type to a specific SOAP attachment identified by referenceId. + * + * @param referenceId Identification value for the SOAP attachment. + */ + public String getAttachmentContentType(String referenceId) { + Vector entry = (Vector) attachments.get(referenceId); + if (entry==null) { + return null; + } + return (String) entry.get(0); + } + + /** + * Delete the temporary attachment files. + */ +public void cleanAttachmentCache() { + if (null==attachments) { + return; + } + Iterator iterator = attachments.entrySet().iterator(); + while (iterator.hasNext()) { + Entry hmEntry = (Entry) iterator.next(); + Vector entry = (Vector)hmEntry.getValue(); + ManagedMemoryDataSource mmds = (ManagedMemoryDataSource)entry.get(1); + try { + if (mmds!=null) { + InputStream is = mmds.getInputStream(); + if (is!=null) is.close(); + File f = mmds.getDiskCacheFile(); + if (f!=null) f.delete(); + mmds.delete(); + } + } catch (IOException e) { + // ok to do nothing here + } + } + } + + /** + * Returns the ConfigurationProvider associated with this + * transaction. + * + * @return The ConfigurationProvider associated with this transaction. + */ + public ConfigurationProvider getConfiguration() { + return configuration; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java new file mode 100644 index 000000000..13127c3ae --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java @@ -0,0 +1,62 @@ +package at.gv.egovernment.moa.spss.server.transaction; + +/** + * Provides each thread with an instance of TransactionContext. + * + * The single instance of the TransactionContextManager should be + * used to access contextual information for each web service transaction, e.g. + * the transaction ID, MOA configuration, client certificate, etc. + * + * @author Stefan Knirsch + * @author Patrick Peck + */ +public class TransactionContextManager { + + /** The single instance of TransactionContextManager */ + private static TransactionContextManager instance = null; + + /** Contains a single TransactionContext for each thread. */ + private ThreadLocal context = null; + + /** + * Get the single instance of TransactionContextManager. + * + * @return The single instanc of TransactionContextManager. + */ + public static synchronized TransactionContextManager getInstance() { + if (instance == null) { + instance = new TransactionContextManager(); + } + return instance; + } + + /** + * Creates a new TransactionContextManager. + * + * Protected to disallow direct instantiation. + */ + protected TransactionContextManager() { + context = new ThreadLocal(); + } + + /** + * Set the TransactionContext for the current thread. + * + * @param txContext The TransactionContext for this thread. + */ + public void setTransactionContext(TransactionContext txContext) { + context.set(txContext); + } + + /** + * Get the TransactionContext for the current thread. + * + * @return The TransactionContext for the current thread or + * null, if none has been set (or if this method is being invoked + * outside the bounds of a transaction). + */ + public TransactionContext getTransactionContext() { + return (TransactionContext) context.get(); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java new file mode 100644 index 000000000..6eb07defe --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java @@ -0,0 +1,51 @@ +package at.gv.egovernment.moa.spss.server.transaction; + + +/** + * A generator for unique transaction IDs. + * + *

The transaction IDs are of the form "-", where: + *

    + *
  • base is initialized with the system time when this class is + * being loaded
  • + *
  • counter is incremented sequentially on each call to + * nextID()
  • + *
+ *

+ * + *

Assuming that it is highly unlikely that MOA servers are started at + * exactly the same time instant, the mechanism provided by this class should + * guarantee unique transaction IDs across multiple restarts and/or instances of + * the server.

+ * + * @author Patrick Peck + * @author Stefan Knirsch + */ +public class TransactionIDGenerator { + + /** Request sequence number. */ + private static long counter = 0; + /** The base value to which to append the sequence number. */ + private static String base = null; + + /** + * Set up the initial base value. + */ + static { + synchronized (TransactionIDGenerator.class) { + base = Long.toString(System.currentTimeMillis()); + } + } + + /** + * Returns the next transaction ID. + * + * @return The next transaction ID. + */ + public static synchronized String nextID() { + counter++; + + return (base + "-" + counter); + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java new file mode 100644 index 000000000..2dfd22140 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java @@ -0,0 +1,61 @@ +package at.gv.egovernment.moa.spss.server.util; + +import java.util.Set; + +/** + * Generate unique ID values for various objects in the response. + * + * @author Patrick Peck + * @version $Id$ + */ +public class IdGenerator { + /** The base value to append the counter to. */ + private String base; + /** The Set of reserved ID values. */ + private Set reserved; + /** The sequence number. */ + private int count; + + /** + * Create a new IdGenerator. + * + * @param base A base value to append the IDs to. The creator of this object + * should provide a base value, so that appending the counter leads to unique + * IDs. + * @param reserved The Set of reserved IDs. A call to + * uniqueId() will respect the reserved IDs. + */ + public IdGenerator(String base, Set reserved) { + this.base = base; + this.reserved = reserved; + count = 1; + } + + /** + * Create the next ID value in the sequence. + * + * @return The next ID value in the sequence. + */ + protected String nextId() { + return base + "-" + count++; + } + + /** + * Create the next unique ID value which is unique in the reserved ID set. + * + * The created ID is added to the set of reserved IDs. + * + * @return The next ID value. + */ + public String uniqueId() { + String nextId; + + while (reserved.contains(nextId = nextId())); + + reserved.add(nextId); + + return nextId; + + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java new file mode 100644 index 000000000..a6f6c1d4a --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java @@ -0,0 +1,65 @@ +package at.gv.egovernment.moa.spss.util; + +import java.util.Locale; + +import at.gv.egovernment.moa.util.Messages; + +/** + * Singleton wrapper around a Messages object. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MessageProvider { + + /** The resource names of the messages to load. */ + private static final String[] DEFAULT_MESSAGE_RESOURCES = + { "resources/properties/spss_messages" }; + /** The corresponding message locales. */ + private static final Locale[] DEFAULT_MESSAGE_LOCALES = + new Locale[] { new Locale("de", "AT") }; + /** The single instance of this class. */ + private static MessageProvider instance; + + /** The messages provided by the MessageProvider. */ + private Messages messages; + + /** + * Return the single instance of the MessageProvider. + * + * Intialilizes the MessageProvider with the default message + * locations: /resources/properties/spss_messages. + * + * @return The single MessageProvider. + */ + public static synchronized MessageProvider getInstance() { + if (instance == null) { + instance = + new MessageProvider(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES); + } + return instance; + } + + /** + * Create a MessageProvider. + * + * @param resourceNames The names of the resources containing the messages. + * @param locales The corresponding locales. + */ + protected MessageProvider(String[] resourceNames, Locale[] locales) { + this.messages = new Messages(resourceNames, locales); + } + + /** + * Get the message corresponding to a given message ID. + * + * @param messageId The ID of the message. + * @param parameters The parameters to fill in into the message arguments. + * @return The formatted message. + */ + public String getMessage(String messageId, Object[] parameters) { + return messages.getMessage(messageId, parameters); + } + + +} diff --git a/spss/server/serverlib/src/main/resources/properties/spss_messages_de.properties b/spss/server/serverlib/src/main/resources/properties/spss_messages_de.properties new file mode 100644 index 000000000..febcf01a9 --- /dev/null +++ b/spss/server/serverlib/src/main/resources/properties/spss_messages_de.properties @@ -0,0 +1,151 @@ +# This file contains exception messages in the standard Java properties +# format. The messages may contain formatting patterns as definied in the +# java.text.MessageFormat class. + +# +# Error messages: the key corresponds to the error code +# + +1100=Fehler beim Validieren der Anfrage: {0} +1101=Bei enveloping Datenobjekten muss entweder Content oder Reference übergeben werden +1102=Bei detached Datenobjekten darf das Attribut Reference nicht leer sein +1103=Ungültiger Wert für Attribut Structure im Element DataObjectInfo: {0} +1104=Ungültiger Wert für DateTime: {0} +1105=Ungültiger Wert für Attribut Index in Element CreateSignatureLocation: {0} +1106=Interner Fehler beim Parsen der XML-Daten +1107=Kein Kind-Element im Element XMLContent gefunden +1108=Ungültiger Wert für dsig:Algorithm: {0} +1109=XMLContent darf nur ein Kind-Element enthalten +1110=Entweder Content oder Reference muss gesetzt sein +1111=Reference muss gesetzt sein, wenn kein Content angegeben ist +1112=Bei leerer Reference muss CreateSignatureEnvironment vorhanden sein +1113=Der Endpunkt akzeptiert keine Anfragen vom Typ: {0} + +2200=Fehler beim Erzeugen der Antwort +2201=Transformations-Algorithmus unbekannt: {0} +2202=Kein XPath-Element für XPath-Transformation gefunden +2203=TrustProfileID unbekannt: {0} +2207=Ungültiges URI-Format: {0} +2208=Fehler beim Öffnen des Datenobjekts (URI={0}) +2209=Fehler beim Parsen der XML-Daten +2210=Fehler beim Lesen des Datenobjekts +2211=Referenzierte Daten können nicht als XML interpretiert werden (URI={0}) +2212=Fehler beim Auswerten des XPath-Ausdrucks: {0} +2213=Zugriff auf das Dateisystem verweigert (URI={0}) +2214=Ungültiges URL-Format: {0} +2215=Kein Stylesheet für XSLT-Transformation gefunden +2216=Kein XPath-Filter2 Element für XPath-Filter2-Transform gefunden +2217=Kein InclusiveNamespaces Element für Exclusive Canonicalization Transform gefunden +2218=Das Signature Environment enthält keine validen XML-Daten +2219=Fehler beim Lesen des Signature Environment +2220=Allgemeiner Fehler beim Erzeugen der Signatur [{0}] +2221=Fehler bei der Behandlung des Schlüssels [{0}] +2222=Fehler beim Erstellen des Manifests [{0}] +2223=Fehler beim Erstellen der Referenz [{0}] +2224=Hashwert nicht verfügbar [{0}] +2225=Signier-Algorithmus wird nicht unterstützt [{0}] +2226=Fehler beim Einbetten der Signatur [{0}] +2227=Fehler beim Berechnen des Signaturwertes [{0}] +2228=Fehler beim Behandeln der SignedProperties [{0}] +2229=Signator-Zertifikat nicht verfügbar [{0}] +2230=Fehler beim Auflösen eines Supplements [{0}] +2231=Die Schlüsselgruppe ist nicht verfügbar +2232=Die Schlüsselgruppe ist leer +2233=Fehler beim Durchführen der Transformation [{0}] +2234=CreateTransformsInfoProfileID nicht vorhanden (ID={0}) +2235=CreateSignatureEnvironment muss entweder Reference oder Content enthalten +2236=CreateSignatureEnvironmentProfileID nicht vorhanden (ID={0}) +2237=Fehler beim Auflösen der internen Referenz (URI={0}) +2238=Fehler beim Auflösen des Transformationsparameters (URI={0}) +2240=Allgemeiner Fehler beim Verifizieren der Signatur [{0}] +2241=Algorithmus wird nicht unterstützt [{0}] +2242=Fehler beim Parsen der CMS Signatur [{0}] +2243=Signator-Zertifikat nicht verfügbar [{0}] +2244=Fehler beim Lesen der Signatur-Daten +2245=Fehler beim Codieren des Signator-Zertifikats +2246=Fehler beim Umwandeln des SubjectDN des Signator-Zertifikats nach RFC2253: {0} +2247=Allgemeiner Fehler beim Verifizieren der Signatur [{0}] +2248=Fehler beim Vorbereiten der Daten [{0}] +2249=Das Attribut Signatories enthält einen ungültigen Index (Index={0}) +2262=Fehler beim Behandeln des Manifests [{0}] +2263=Fehler beim Parsen der Properties [{0}] +2264=Fehler beim Behandeln der Referenz [{0}] +2265=Fehler beim Durchführen der Transformation [{0}] +2266=Signatur ist kein dsig:Signature-Element +2267=SupplementProfileID nicht vorhanden (ID={0}) +2268=VerifyTransformsInfoProfileID nicht vorhanden (ID={0}) +2269=Fehler beim Parsen der Transformation [{0}] +2270=Fehler beim Decodieren des Hash-Wertes +2271=Falsche Anzahl an ReferenceInfo Elementen in SignatureManfestCheckParams +2280=Die Angabe XMLContent wird derzeit nicht unterstützt +2281=XML-Supplement kann nicht serialisiert werden (Reference="{0}") +2282=Datenobjekt mit der URI={0} wurde dem Request nicht bereit gestellt + + +2900=Interner Server-Fehler + +3201=Objekt kann nicht geladen werden (Reference="{0}", LocRef-URI="{1}") +3202=Supplement für Signaturumgebung kann nicht geladen werden (Reference="{0}", LocRef-URI="{1}") +3203=Signaturumgebung kann nicht geladen werden (Reference="{0}", LocRef-URI="{1}") + +9900=Nicht klassifizierter Fehler in Subsystem +9901=Nicht klassifizierter Laufzeitfehler in Subsystem +9999=Nicht klassifizierter Fehler + + +# +# Server internal messages +# + +init.00=Fehler beim Lesen der MOA SP/SS Konfiguration: das Service steht nicht zur Verfügung +init.01=MOA SP/SS Konfiguration erfolgreich geladen +init.02=Fehler beim Löschen der Archivdaten +init.03=Fehler beim Aktivieren des IAIK-JCE/JSSE/JDK1.3 Workaround: SSL ist möglicherweise nicht verfügbar +init.04=Fehler beim Initialisieren des Schema Pools + +config.00=Fehler beim Erstellen des KeyGroupMapping: KeyGroup mit id={0} unbekannt - die Erstellung des KeyGroupMapping wird fortgeführt +config.01=Fehler in der Konfiguration: Wert für maximale Archivierungsdauer von Widerrufsinformationen (ArchiveDuration) nicht konfiguriert oder ungültig +config.02=Fehler in der Konfiguration: {0} mit id={1}: falscher Profiltyp in Datei {2} +config.03=Fehler in der Konfiguration: {0} mit id={1} konnte nicht geladen werden +config.04=Fehler in der Konfiguration: {0} mit id={1} existiert bereits +config.05=Umgebungsvariable {0} nicht gesetzt: benutze Default-Konfiguration +config.06=Die MOA SP/SS Konfiguration wurde erfolgreich aktualisiert. +config.07=Fehler in der Konfiguration: Reason code {0} unbekannt +config.08=Fehler beim Konfigurieren der IAIK-Module +config.09=Fehler beim Öffnen der Schlüssel-Datei {0} +config.10=Fehler beim Einlesen der Konfiguration (siehe Log-Datei für Details) +config.11=Fehler biem Erstellen der Konfiguration (siehe Log-Datei für Details) +config.12=Fehler beim Einlesen des Profils +config.13=Fehler beim Erstellen des CRLDistributionPoint: CAIssuerDN={0} ungültig +config.14=Das Attribut {0} für das TrustProfile mit id={1} ist ungültig (Wert={2}) +config.15=Fehler beim Erstellen des TrustProfile id={0}: Name des Konfigurations-Verzeichnisses konnte nicht in eine URL umgewandet werden +config.16=Fehler beim Erstellen von X509IssuerSerial (IssuerName={0}, SerialNumber={1}) +config.17=DigestAlgorithmName unbekannt (AlgorithmName={0}) +config.18=Lade Keystore: {0} +config.19=Key ID={0} +config.20=Fehler beim Aktualisieren der MOA SP/SS Konfiguration. Die bestehende Konfiguration wird beibehalten +config.21=Lade Konfiguration von {0} +config.22=Lade {0} mit id={1} von Datei {2} +config.23=MOA SP/SS Konfiguration: {0} nicht gesetzt oder ungültiger Wert, verwende den Default-Wert: {1} +config.25=Fehler in der Konfiguration: Das SoftwareKeyModule mit id={0} konnte nicht geladen werden, da die Datei {1} nicht existiert oder ein Verzeichnis bezeichnet +config.26=Fehler beim Erstellen der KeyGroup mit id={0}: KeyModule mit id={1} unbekannt +config.27=Fehler in der Konfiguration: Das Attribut {0} des TrustProfiles mit id={1} zeigt nicht auf ein existierendes Verzeichnis +config.28=Einen detaillierten Fehlerbericht entnehmen Sie bitte der Log-Datei. +config.29=Es sind folgende leichte Fehler aufgetreten: +config.31=Fehler in der Konfiguration der KeyGroup mit id={0}: Der Schlüssel im KeyModule id={1} mit IssuerName={2} und SerialNumber={3} konnte nicht geladen werden +config.32=Fehler in der Konfiguration: Verzeichnisangabe für den Zertifikatsspeicher ist ungültig ({0}). + + +handler.00=Starte neue Transaktion: TID={0}, Service={1} +handler.01=Aufruf von Adresse={0} +handler.02=Client-Zertifikat: Subject={0}, Serial={1}, Issuer={2} +handler.03=Client-Zertifikat nicht verfügbar +handler.04=Anfrage erfolgreich abgearbeitet +handler.05=Fehler beim Abarbeiten der Anfrage +handler.06=SOAP Attachment mit der id={0} für Request hinterlegt (MIME Type des Attachments={1}) +handler.07=SOAP Request empfangen: Request={0} + +invoker.00=Das Signature Environment konnte nicht validierend geparst werden +invoker.01=Keine passende Transformationskette gefunden (Index={0}) +invoker.02=Der Hashwert der Transformation stimmt nicht überein (Index={0}) +invoker.03=Signatorzertifikat aus Trustprofile mit id={0} konnte nicht geparst werden (Dateiname={1}) diff --git a/spss/server/serverlib/src/main/resources/security/cacerts b/spss/server/serverlib/src/main/resources/security/cacerts new file mode 100644 index 000000000..6eeaba418 Binary files /dev/null and b/spss/server/serverlib/src/main/resources/security/cacerts differ diff --git a/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.wsdl b/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.wsdl new file mode 100644 index 000000000..c5cd8fc0f --- /dev/null +++ b/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.wsdl @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.xsd b/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.xsd new file mode 100644 index 000000000..756b51279 --- /dev/null +++ b/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.xsd @@ -0,0 +1,469 @@ + + + + + + + + + + + + + + + + + + + + Ermöglichung der Stapelsignatur durch wiederholte Angabe dieses Elements + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe des Signaturorts sowie ggf. sinnvoller Supplements im Zshg. mit der Signaturumgebung, oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + Kardinalität 1..oo erlaubt die Antwort auf eine Stapelsignatur-Anfrage + + + + Resultat, falls die Signaturerstellung erfolgreich war + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any;publicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pro dsig:Reference-Element in der zu überprüfenden XML-Signatur muss hier ein ReferenceInfo-Element erscheinen. Die Reihenfolge der einzelnen ReferenceInfo Elemente entspricht jener der dsig:Reference Elemente in der XML-Signatur. + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and ds:RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any; PublicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe EINER Transformationskette inklusive ggf. sinnvoller Supplements oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Resultat, falls die Signaturerstellung gescheitert ist + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ein oder mehrere Transformationswege können von der Applikation an MOA mitgeteilt werden. Die zu prüfende Signatur hat zumindest einem dieser Transformationswege zu entsprechen. Die Angabe kann explizit oder als Profilbezeichner erfolgen. + + + + + Profilbezeichner für einen Transformationsweg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Die Angabe des Transformationsparameters (explizit oder als Hashwert) kann unterlassen werden, wenn die Applikation von der Unveränderlichkeit des Inhalts der in "Transformationsparamter", Attribut "URI" angegebenen URI ausgehen kann. + + + + Der Transformationsparameter explizit angegeben. + + + + + Der Hashwert des Transformationsparameters. + + + + + + + + + + + + + + + + + + + + + + Explizite Angabe des Transformationswegs + + + + + + + Alle impliziten Transformationsparameter, die zum Durchlaufen der oben angeführten Transformationskette bekannt sein müssen, müssen hier angeführt werden. Das Attribut "URI" bezeichnet den Transformationsparameter in exakt jener Weise, wie er in der zu überprüfenden Signatur gebraucht wird. + + + + + + + + + + + + + + + + diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/AllTests.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/AllTests.java new file mode 100644 index 000000000..c670b5e55 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/AllTests.java @@ -0,0 +1,40 @@ +package test.at.gv.egovernment.moa.spss; + +import test.at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImplTest; +import test.at.gv.egovernment.moa.spss.server.iaik.config.IaikConfiguratorTest; +import test.at.gv.egovernment.moa.spss.server.tools.CertToolTest; + +import junit.awtui.TestRunner; +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Test suite for all unit tests. + * + * @author Patrick Peck + * @version $Id$ + */ +public class AllTests { + + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(test.at.gv.egovernment.moa.spss.server.config.AllTests.class); + suite.addTestSuite(ConfigurationDataImplTest.class); + suite.addTestSuite(IaikConfiguratorTest.class); + suite.addTest( + test.at.gv.egovernment.moa.spss.server.invoke.AllTests.suite()); + suite.addTest(test.at.gv.egovernment.moa.spss.api.xmlbind.AllTests.suite()); + suite.addTestSuite(CertToolTest.class); + + return suite; + } + + public static void main(String[] args) { + try { + TestRunner.run(AllTests.class); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/SPSSTestCase.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/SPSSTestCase.java new file mode 100644 index 000000000..a585e30a0 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/SPSSTestCase.java @@ -0,0 +1,82 @@ +package test.at.gv.egovernment.moa.spss; + +import java.security.Security; + +import test.at.gv.egovernment.moa.MOATestCase; + +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; +import at.gv.egovernment.moa.util.MessageProvider; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Base class for MOA test cases. + * + * Provides some utility functions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SPSSTestCase extends MOATestCase { + + protected static final String TESTDATA_ROOT = "data/test/"; + + /** + * Constructor for MOATestCase. + * @param arg0 + */ + public SPSSTestCase(String name) { + super(name); + } + + /** + * Set up a transaction context with a test configuration. + */ + protected void setUpTransactionContext() throws Exception { + System.setProperty( + ConfigurationProvider.CONFIG_PROPERTY_NAME, + "data/test/conf/moa-spss/MOA-SPSSConfiguration.xml"); + ConfigurationProvider config = ConfigurationProvider.getInstance(); + TransactionContext context = new TransactionContext("test", null, config); + TransactionContextManager.getInstance().setTransactionContext(context); + } + + protected void setUpLoggingContext() throws Exception { + LoggingContext context = new LoggingContext("test"); + LoggingContextManager.getInstance().setLoggingContext(context); + } + + /** + * Configure the IAIK modules with the current configuration. + * + * A TransactionContext must have been set up before. + */ + protected void setUpIaikConfiguration() throws Exception { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ClassLoader cl = getClass().getClassLoader(); + MessageProvider msg = MessageProvider.getInstance(); + + try { + cl.loadClass("javax.security.cert.Certificate"); // from jcert.jar + } catch (ClassNotFoundException e) { + Logger.warn(msg.getMessage("init.03", null), e); + } + + new IaikConfigurator().configure(context.getConfiguration()); + } + + protected void setUpSSL() throws Exception { + //System.setProperty("javax.net.debug", "all"); + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + System.setProperty( + "java.protocol.handler.pkgs", + "com.sun.net.ssl.internal.www.protocol"); + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java new file mode 100644 index 000000000..28f79729e --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java @@ -0,0 +1,24 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Runs all tests in this package. + * + * @author Patrick Peck + * @version $Id$ + */ +public class AllTests { + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(CreateXMLSignatureRequestParserTest.class); + suite.addTestSuite(TransformParserTest.class); + suite.addTestSuite(VerifyCMSSignatureRequestParserTest.class); + suite.addTestSuite(VerifyXMLSignatureRequestParserTest.class); + + return suite; + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java new file mode 100644 index 000000000..7ce705b01 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java @@ -0,0 +1,71 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; + +/** + * Test the CreateXMLSignatureRequestParser. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CreateXMLSignatureRequestParserTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/CreateXMLSignature/"; + + private CreateXMLSignatureRequestParser requestParser; + + public CreateXMLSignatureRequestParserTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + requestParser = new CreateXMLSignatureRequestParser(); + } + + public void testParse() throws Exception { + Element requestElem = + parseXml(TESTDATA_BASE + "TestGeneratorCX2.001.Req.xml") + .getDocumentElement(); + CreateXMLSignatureRequest request = requestParser.parse(requestElem); + SingleSignatureInfo sigInfo; + DataObjectInfo dataObjInfo; + CreateTransformsInfoProfileExplicit transProfile; + CreateSignatureEnvironmentProfileExplicit envProfile; + + assertNotNull(request); + assertEquals("PKCS12RSAKey1", request.getKeyIdentifier()); + assertEquals(1, request.getSingleSignatureInfos().size()); + + sigInfo = (SingleSignatureInfo) request.getSingleSignatureInfos().get(0); + assertEquals(1, sigInfo.getDataObjectInfos().size()); + assertFalse(sigInfo.isSecurityLayerConform()); + + dataObjInfo = (DataObjectInfo) sigInfo.getDataObjectInfos().get(0); + assertNotNull(dataObjInfo.getDataObject()); + + transProfile = + (CreateTransformsInfoProfileExplicit) dataObjInfo + .getCreateTransformsInfoProfile(); + assertNotNull( + transProfile.getCreateTransformsInfo().getFinalDataMetaInfo()); + + envProfile = + (CreateSignatureEnvironmentProfileExplicit) sigInfo + .getCreateSignatureInfo() + .getCreateSignatureEnvironmentProfile(); + assertEquals( + "//data:Document", + envProfile.getCreateSignatureLocation().getXPathExpression()); + assertEquals(0, envProfile.getCreateSignatureLocation().getIndex()); + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java new file mode 100644 index 000000000..f580f86bc --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java @@ -0,0 +1,113 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import java.util.List; + +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform; +import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform; +import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform; +import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform; +import at.gv.egovernment.moa.spss.api.common.XPathTransform; +import at.gv.egovernment.moa.spss.api.common.XSLTTransform; +import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; + +/** + * Test the TransformParser. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TransformParserTest extends SPSSTestCase { + private static String TESTDATA_BASE = TESTDATA_ROOT + "xml/dsigTransform/"; + + private TransformParser transformParser; + + public TransformParserTest(String name) { + super(name); + } + + protected void setUp() { + transformParser = new TransformParser(); + } + + public void testParseTransforms() throws Exception { + Element transformsElem = + parseXml(TESTDATA_BASE + "transforms.xml").getDocumentElement(); + List transforms = transformParser.parseTransforms(transformsElem); + + assertNotNull(transforms); + assertEquals(3, transforms.size()); + + } + + public void testParseCanonicalizationTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "canonicalization.xml").getDocumentElement(); + CanonicalizationTransform transform = + (CanonicalizationTransform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + assertEquals( + CanonicalizationTransform.CANONICAL_XML, + transform.getAlgorithmURI()); + } + + public void testParseExclCanonicalizationTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "exclusiveCanonicalization.xml") + .getDocumentElement(); + ExclusiveCanonicalizationTransform transform = + (ExclusiveCanonicalizationTransform) transformParser.parseTransform( + transformElem); + + assertNotNull(transform); + assertEquals( + ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML, + transform.getAlgorithmURI()); + assertEquals(3, transform.getInclusiveNamespacePrefixes().size()); + } + + public void testParseEnvelopedTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "enveloped.xml").getDocumentElement(); + EnvelopedSignatureTransform transform = + (EnvelopedSignatureTransform) transformParser.parseTransform( + transformElem); + + assertNotNull(transform); + } + + public void testParseXPathTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "xpath.xml").getDocumentElement(); + XPathTransform transform = + (XPathTransform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + assertEquals("//ToBeSigned/Data", transform.getXPathExpression()); + assertEquals(1, transform.getNamespaceDeclarations().size()); + } + + public void testParseXPathFilter2Transform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "xpath2.xml").getDocumentElement(); + XPathFilter2Transform transform = + (XPathFilter2Transform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + assertEquals(3, transform.getFilters().size()); + } + + public void testParseXSLTTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "xslt.xml").getDocumentElement(); + XSLTTransform transform = + (XSLTTransform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java new file mode 100644 index 000000000..4be7667eb --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java @@ -0,0 +1,61 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.util.DateTimeUtils; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentExcplicit; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.common.MetaInfo; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; + +/** + * Test the VerifyCMSSignatureRequestParserTest. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyCMSSignatureRequestParserTest extends SPSSTestCase { + private static String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyCMSSignature/"; + + private VerifyCMSSignatureRequestParser requestParser; + + public VerifyCMSSignatureRequestParserTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + requestParser = new VerifyCMSSignatureRequestParser(); + } + + public void testParse() throws Exception { + Element requestElem = + parseXml(TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml") + .getDocumentElement(); + VerifyCMSSignatureRequest request = requestParser.parse(requestElem); + MetaInfo metaInfo; + CMSContentExcplicit content; + + assertNotNull(request); + assertEquals(1, request.getSignatories()[0]); + assertEquals( + DateTimeUtils.parseDateTime("2003-04-04T09:30:47-05:00"), + request.getDateTime()); + assertNotNull(request.getCMSSignature()); + assertNotNull(request.getDataObject()); + assertEquals("TrustProfile1", request.getTrustProfileId()); + + metaInfo = request.getDataObject().getMetaInfo(); + assertNotNull(metaInfo); + assertEquals("text/plain", metaInfo.getMimeType()); + assertEquals("http://10.16.46.109/TestDatenGenerator/resources/testDaten.txt", metaInfo.getDescription()); + + content = (CMSContentExcplicit) request.getDataObject().getContent(); + assertNotNull(content.getBinaryContent()); + + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java new file mode 100644 index 000000000..3b8e8b00e --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java @@ -0,0 +1,81 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DateTimeUtils; + +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; +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.VerifyTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; + +/** + * Test the VerifyXMLSignatureRequestParserTest. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyXMLSignatureRequestParserTest extends SPSSTestCase { + private static String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyXMLSignature/"; + + private VerifyXMLSignatureRequestParser parser; + + public VerifyXMLSignatureRequestParserTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + parser = new VerifyXMLSignatureRequestParser(); + } + + public void testParse() throws Exception { + Element requestElem = + parseXml(TESTDATA_BASE + "TestGeneratorVX.201.Req.xml") + .getDocumentElement(); + VerifyXMLSignatureRequest request = parser.parse(requestElem); + VerifySignatureInfo verifySignatureInfo; + VerifySignatureLocation verifyLocation; + SignatureManifestCheckParams checkParams; + ReferenceInfo refInfo; + VerifyTransformsInfoProfileExplicit transformsProfile; + + assertNotNull(request); + assertEquals( + DateTimeUtils.parseDateTime("2003-04-01T12:53:57+01:00"), + request.getDateTime()); + assertFalse(request.getReturnHashInputData()); + assertEquals("TrustProfile1", request.getTrustProfileId()); + + verifySignatureInfo = request.getSignatureInfo(); + assertNotNull(verifySignatureInfo); + assertNotNull(verifySignatureInfo.getVerifySignatureEnvironment()); + + verifyLocation = verifySignatureInfo.getVerifySignatureLocation(); + assertNotNull(verifyLocation); + assertEquals("//dsig:Signature", verifyLocation.getXPathExpression()); + assertEquals(3, verifyLocation.getNamespaceDeclarations().size()); + + checkParams = request.getSignatureManifestCheckParams(); + assertNotNull(checkParams); + assertEquals(true, checkParams.getReturnReferenceInputData()); + assertEquals(1, checkParams.getReferenceInfos().size()); + + refInfo = (ReferenceInfo) checkParams.getReferenceInfos().get(0); + assertEquals(1, refInfo.getVerifyTransformsInfoProfiles().size()); + + transformsProfile = + (VerifyTransformsInfoProfileExplicit) refInfo + .getVerifyTransformsInfoProfiles() + .get(0); + assertEquals(1, transformsProfile.getTransforms().size()); + assertEquals(1, transformsProfile.getTransformParameters().size()); + + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java new file mode 100644 index 000000000..131f38c19 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java @@ -0,0 +1,20 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class AllTests +{ + public static Test suite() + { + TestSuite suite = new TestSuite(); + suite.addTestSuite(ConfigurationProviderTest1.class); + suite.addTestSuite(ConfigurationProviderTest2.class); + suite.addTestSuite(ConfigurationProviderTest3.class); + return suite; + } +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java new file mode 100644 index 000000000..474a387ad --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java @@ -0,0 +1,377 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import iaik.asn1.structures.Name; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; +import iaik.x509.X509Certificate; + +import java.math.BigInteger; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import junit.framework.TestCase; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.server.config.CRLDistributionPoint; +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.config.HardwareCryptoModule; +import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule; +import at.gv.egovernment.moa.spss.server.config.KeyGroup; +import at.gv.egovernment.moa.spss.server.config.KeyGroupEntry; +import at.gv.egovernment.moa.spss.server.config.OCSPDistributionPoint; +import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule; +import at.gv.egovernment.moa.spss.server.config.TrustProfile; +import at.gv.egovernment.moa.util.Constants; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class ConfigurationProviderTest1 extends TestCase +{ + private static final String CONFIG_BASE_ = + "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; + + static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; + + static + { + System.setProperty( + "log4j.configuration", + "file:/" + CONFIG_BASE_ + "log4j.properties"); + System.setProperty( + at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, + CONFIG_BASE_ + "moa.spss.complete-config.xml"); + try + { + ConfigurationProvider.reload(); + provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); + } + catch (ConfigurationException e) + { + throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); + } + } + + /** + * Constructor for ConfigurationProvider. + * @param arg0 + */ + public ConfigurationProviderTest1() throws MOAException + { + super("ConfigurationProvider"); + } + + public void testGetWarnings() + { + assertEquals(0, provider_.getWarnings().size()); + } + + public void testGetDigestMethodAlgorithmName() + { + assertEquals( + Constants.SHA1_URI, + provider_.getDigestMethodAlgorithmName()); + } + + public void testGetCanonicalizationAlgorithmName() + { + assertEquals( + Constants.C14N_WITH_COMMENTS_URI, + provider_.getCanonicalizationAlgorithmName()); + } + + public void testGetHardwareCryptoModules() + { + List hwcms = provider_.getHardwareCryptoModules(); + assertEquals(2, hwcms.size()); + + HardwareCryptoModule hwc1 = (HardwareCryptoModule) hwcms.get(0); + assertEquals("HWC1_Name", hwc1.getName()); + assertEquals("HWC1_SlotId", hwc1.getSlotID()); + assertEquals("HWC1_UserPIN", hwc1.getUserPIN()); + + HardwareCryptoModule hwc2 = (HardwareCryptoModule) hwcms.get(1); + assertEquals("HWC2_Name", hwc2.getName()); + assertNull(hwc2.getSlotID()); + assertEquals("HWC2_UserPIN", hwc2.getUserPIN()); + } + + public void testGetHardwareKeyModules() + { + List hwkms = provider_.getHardwareKeyModules(); + assertEquals(2, hwkms.size()); + + HardwareKeyModule hwk1 = (HardwareKeyModule) hwkms.get(0); + assertEquals("HWK1_Id", hwk1.getId()); + assertEquals("HWK1_Name", hwk1.getName()); + assertEquals("HWK1_SlotId", hwk1.getSlotID()); + assertEquals("HWK1_UserPIN", hwk1.getUserPIN()); + + HardwareKeyModule hwk2 = (HardwareKeyModule) hwkms.get(1); + assertEquals("HWK2_Id", hwk2.getId()); + assertEquals("HWK2_Name", hwk2.getName()); + assertNull(hwk2.getSlotID()); + assertEquals("HWK2_UserPIN", hwk2.getUserPIN()); + } + + public void testGetSoftwareKeyModules() + { + List swkms = provider_.getSoftwareKeyModules(); + assertEquals(2, swkms.size()); + + SoftwareKeyModule swk1 = (SoftwareKeyModule) swkms.get(0); + assertEquals("SWK1_Id", swk1.getId()); + assertEquals(CONFIG_BASE_ + "swk/SWK1_FileName.txt", swk1.getFileName().replace('\\', '/')); + assertEquals("SWK1_Password", swk1.getPassWord()); + + SoftwareKeyModule swk2 = (SoftwareKeyModule) swkms.get(1); + assertEquals("SWK2_Id", swk2.getId()); + assertEquals(CONFIG_BASE_ + "swk/SWK2_FileName.txt", swk2.getFileName().replace('\\', '/')); + assertNull(swk2.getPassWord()); + } + + public void testGetKeyGroups() + { + Map keyGroups = provider_.getKeyGroups(); + assertEquals(2, keyGroups.size()); + + KeyGroup kg1 = (KeyGroup) keyGroups.get("KG1_Id"); + assertNotNull(kg1); + assertEquals("KG1_Id", kg1.getId()); + + Set kg1Entries = kg1.getKeyGroupEntries(); + assertEquals(2, kg1Entries.size()); + + Iterator kg1EntriesIt = kg1Entries.iterator(); + while(kg1EntriesIt.hasNext()) + { + KeyGroupEntry currentEntry = (KeyGroupEntry)kg1EntriesIt.next(); + if ("HWK1_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=HWK1_Issuer", currentEntry.getIssuerDN()); + assertEquals(0, currentEntry.getSerialNumber().intValue()); + } + else if ("HWK2_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=HWK2_Issuer", currentEntry.getIssuerDN()); + assertEquals(1, currentEntry.getSerialNumber().intValue()); + } + else fail("Invalid module identifer found."); + } + + KeyGroup kg2 = (KeyGroup) keyGroups.get("KG2_Id"); + assertNotNull(kg2); + assertEquals("KG2_Id", kg2.getId()); + + Set kg2Entries = kg2.getKeyGroupEntries(); + assertEquals(2, kg2Entries.size()); + + Iterator kg2EntriesIt = kg1Entries.iterator(); + while(kg1EntriesIt.hasNext()) + { + KeyGroupEntry currentEntry = (KeyGroupEntry)kg2EntriesIt.next(); + if ("SWK1_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=CN=SWK1_Issuer", currentEntry.getIssuerDN()); + assertEquals(2, currentEntry.getSerialNumber().intValue()); + } + else if ("SWK2_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=SWK2_Issuer", currentEntry.getIssuerDN()); + assertEquals(3, currentEntry.getSerialNumber().intValue()); + } + else fail("Invalid module identifer found."); + } + } + + public void testGetKeyGroupEntries() throws RFC2253NameParserException + { + RFC2253NameParser parser = new RFC2253NameParser("CN=Customer1_Issuer"); + Name name = parser.parse(); + Set kgEntries = provider_.getKeyGroupEntries(name, BigInteger.valueOf(4), "KG1_Id"); + assertEquals(2, kgEntries.size()); + + Iterator kgEntriesIt = kgEntries.iterator(); + while (kgEntriesIt.hasNext()) + { + KeyGroupEntry currentEntry = (KeyGroupEntry) kgEntriesIt.next(); + if (!"HWK1_Id".equals(currentEntry.getModuleID()) && !"HWK2_Id".equals(currentEntry.getModuleID())) + { + fail("Invalid module identifier found."); + } + } + } + + public void testGetChainingMode() throws RFC2253NameParserException + { + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); + Name name = parser.parse(); + cert.setIssuerDN(name); + cert.setSerialNumber(BigInteger.valueOf(0)); + assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); // Default chaining mode + + parser = new RFC2253NameParser("CN=TA1_Issuer"); + name = parser.parse(); + cert.setIssuerDN(name); + cert.setSerialNumber(BigInteger.valueOf(5)); + assertEquals(ChainingModes.CHAIN_MODE, provider_.getChainingMode(cert)); + } + + public void testGetDistributionPoints() throws RFC2253NameParserException + { + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); + Name name = parser.parse(); + cert.setIssuerDN(name); + + Set dps = provider_.getDistributionPoints(cert); + assertEquals(2, dps.size()); + + Iterator dpIt = dps.iterator(); + while (dpIt.hasNext()) + { + CRLDistributionPoint currentDP = (CRLDistributionPoint)dpIt.next(); + if ("http://crl.myca.org".equals(currentDP.getUri())) + { + int reasonCodes = + iaik.asn1.structures.DistributionPoint.unused | + iaik.asn1.structures.DistributionPoint.keyCompromise | + iaik.asn1.structures.DistributionPoint.cACompromise | + iaik.asn1.structures.DistributionPoint.affiliationChanged | + iaik.asn1.structures.DistributionPoint.superseded | + iaik.asn1.structures.DistributionPoint.cessationOfOperation | + iaik.asn1.structures.DistributionPoint.certificateHold | + iaik.asn1.structures.DistributionPoint.privilegeWithdrawn | + iaik.asn1.structures.DistributionPoint.aACompromise; + assertEquals(reasonCodes, currentDP.getReasonCodes()); + } + else if ("http://crl.myotherca.org".equals(currentDP.getUri())) + { + int reasonCodes = + iaik.asn1.structures.DistributionPoint.aACompromise | + iaik.asn1.structures.DistributionPoint.affiliationChanged; + assertEquals(reasonCodes, currentDP.getReasonCodes()); + } + else fail("Invalid CRL DP URI found: " + currentDP.getUri()); + } + + parser = new RFC2253NameParser("CN=DP2_Issuer"); + name = parser.parse(); + cert.setIssuerDN(name); + + dps = provider_.getDistributionPoints(cert); + assertEquals(1, dps.size()); + + OCSPDistributionPoint dpo = (OCSPDistributionPoint) dps.toArray()[0]; + assertEquals("http://crl.yetanotherca.org", dpo.getUri()); + } + + public void testGetCRLArchiveDuration() + { + assertEquals(730, provider_.getCRLArchiveDuration()); + } + + public void testGetEnableRevocationArchiving() + { + assertFalse(provider_.getEnableRevocationArchiving()); + } + + public void testGetCertStoreLocation() + { + assertEquals( + CONFIG_BASE_ + "certstore_test", + provider_.getCertStoreLocation().replace('\\', '/')); + } + + public void testGetCreateTransformsInfoProfile() + { + Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); + assertEquals("CreateTransformsInfoProfile", ctip1.getLocalName()); + + Element ctip2 = provider_.getCreateTransformsInfoProfile("CTIP_2"); + assertEquals("CreateTransformsInfoProfile", ctip2.getLocalName()); + } + + public void testGetCreateSignatureEnvironmentProfile() + { + Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); + assertEquals("CreateSignatureEnvironmentProfile", csep.getLocalName()); + } + + public void testGetVerifyTransformsInfoProfile() + { + Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); + assertEquals("VerifyTransformsInfoProfile", vtip.getLocalName()); + } + + public void testGetSupplementProfile() + { + Element sp = provider_.getSupplementProfile("SP_1"); + assertEquals("SupplementProfile", sp.getLocalName()); + } + + public void testGetTrustProfile() + { + TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); + assertEquals( + "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/anchors", + tp1.getUri()); + assertEquals( + "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/signercerts", + tp1.getSignerCertsUri()); + + TrustProfile tp2 = provider_.getTrustProfile("TP2_Id"); + assertEquals( + "file:" + CONFIG_BASE_ + "trustprofiles/tp2/anchors", + tp2.getUri()); + assertEquals( + "file:" + CONFIG_BASE_ + "trustprofiles/tp2/signercerts", + tp2.getSignerCertsUri()); + } + + public void testGetRevocationArchiveJDBCURL() + { + assertEquals("jdbc://dummy", provider_.getRevocationArchiveJDBCURL()); + } + + public void testGetRevocationArchiveJDBCDriverClass() + { + assertEquals("fully.qualified.classname", provider_.getRevocationArchiveJDBCDriverClass()); + } + + public void testGetEnableRevocationChecking() + { + assertFalse(provider_.getEnableRevocationChecking()); + } + + public void testGetMaxRevocationAge() + { + assertEquals(10000, provider_.getMaxRevocationAge()); + } + + public void testGetServiceOrder() + { + String[] serviceOrder = provider_.getServiceOrder(); + assertEquals(2, serviceOrder.length); + assertEquals("crl", serviceOrder[0]); + assertEquals("ocsp", serviceOrder[1]); + } + + public void testGetAutoAddCertificates() + { + assertFalse(provider_.getAutoAddCertificates()); + } + + public void testGetUseAuthorityInfoAccess() + { + assertFalse(provider_.getUseAuthorityInfoAccess()); + } +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java new file mode 100644 index 000000000..adf02809b --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java @@ -0,0 +1,225 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import iaik.asn1.structures.Name; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; +import iaik.x509.X509Certificate; + +import java.math.BigInteger; +import java.util.List; +import java.util.Set; + +import junit.framework.TestCase; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAException; +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.config.TrustProfile; +import at.gv.egovernment.moa.util.Constants; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class ConfigurationProviderTest2 extends TestCase +{ + private static final String CONFIG_BASE_ = + "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; + + static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; + + static + { + System.setProperty( + "log4j.configuration", + "file:/" + CONFIG_BASE_ + "log4j.properties"); + System.setProperty( + at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, + CONFIG_BASE_ + "moa.ss.noopts-config.xml"); + try + { + ConfigurationProvider.reload(); + provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); + } + catch (ConfigurationException e) + { + throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); + } + } + + + /** + * Constructor for ConfigurationProvider. + * @param arg0 + */ + public ConfigurationProviderTest2() throws MOAException + { + super("ConfigurationProvider"); + } + + public void testGetWarnings() + { + // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found + assertEquals(3, provider_.getWarnings().size()); + } + + public void testGetDigestMethodAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.SHA1_URI, + provider_.getDigestMethodAlgorithmName()); + } + + public void testGetCanonicalizationAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.C14N_URI, + provider_.getCanonicalizationAlgorithmName()); + } + + public void testGetHardwareCryptoModules() + { + // No hardware crypto modules in config file, check for empty list + List hwcms = provider_.getHardwareCryptoModules(); + assertEquals(0, hwcms.size()); + } + + public void testGetHardwareKeyModules() + { + List hwkms = provider_.getHardwareKeyModules(); + assertEquals(1, hwkms.size()); + } + + public void testGetSoftwareKeyModules() + { + // No software key modules in config file, check for empty list + List swkms = provider_.getSoftwareKeyModules(); + assertEquals(0, swkms.size()); + } + + public void testGetChainingMode() throws RFC2253NameParserException + { + // Default Chaining Mode not set in configuration, check for default value + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); + Name name = parser.parse(); + cert.setIssuerDN(name); + cert.setSerialNumber(BigInteger.valueOf(0)); + assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); + } + + public void testGetDistributionPoints() throws RFC2253NameParserException + { + // Element is missing in config file, check if emty list is returned + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); + Name name = parser.parse(); + cert.setIssuerDN(name); + + Set dps = provider_.getDistributionPoints(cert); + assertEquals(0, dps.size()); + } + + public void testGetCRLArchiveDuration() + { + // Element is missing in config file, check if default value is returned + assertEquals(0, provider_.getCRLArchiveDuration()); + } + + public void testGetEnableRevocationArchiving() + { + // Element is missing in config file, check if default value is returned + assertFalse(provider_.getEnableRevocationArchiving()); + } + + public void testGetCertStoreLocation() + { + // Element is missing in config file, check if default value is returned + assertEquals( + CONFIG_BASE_ + "certstore", + provider_.getCertStoreLocation().replace('\\', '/')); + } + + public void testGetCreateTransformsInfoProfile() + { + // No profile in config file, check for null + Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); + assertNull(ctip1); + } + + public void testGetCreateSignatureEnvironmentProfile() + { + // No profile in config file, check for null + Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); + assertNull(csep); + } + + public void testGetVerifyTransformsInfoProfile() + { + // No profile in config file, check for null + Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); + assertNull(vtip); + } + + public void testGetSupplementProfile() + { + // No profile in config file, check for null + Element sp = provider_.getSupplementProfile("SP_1"); + assertNull(sp); + } + + public void testGetTrustProfile() + { + // No trust profiles config file, check for null + TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); + assertNull(tp1); + } + + public void testGetRevocationArchiveJDBCURL() + { + // Element is missing in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCURL()); + } + + public void testGetRevocationArchiveJDBCDriverClass() + { + // Element is missing in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCDriverClass()); + } + + public void testGetEnableRevocationChecking() + { + // Element is missing in config file, check for default value + assertFalse(provider_.getEnableRevocationChecking()); + } + + public void testGetMaxRevocationAge() + { + // Element is missing in config file, check for default value + assertEquals(0, provider_.getMaxRevocationAge()); + } + + public void testGetServiceOrder() + { + // Element is missing in config file, check for empty array + String[] serviceOrder = provider_.getServiceOrder(); + assertEquals(0, serviceOrder.length); + } + + public void testGetAutoAddCertificates() + { + // Element is missing in config file, check for default value + assertFalse(provider_.getAutoAddCertificates()); + } + + public void testGetUseAuthorityInfoAccess() + { + // Element is missing in config file, check for default value + assertFalse(provider_.getUseAuthorityInfoAccess()); + } +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java new file mode 100644 index 000000000..7da2165cb --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java @@ -0,0 +1,166 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import iaik.asn1.structures.Name; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; +import iaik.x509.X509Certificate; + +import java.util.List; +import java.util.Set; + +import junit.framework.TestCase; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.util.Constants; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class ConfigurationProviderTest3 extends TestCase +{ + private static final String CONFIG_BASE_ = + "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; + + static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; + + static + { + System.setProperty( + "log4j.configuration", + "file:/" + CONFIG_BASE_ + "log4j.properties"); + System.setProperty( + at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, + CONFIG_BASE_ + "moa.sp.noopts-config.xml"); + try + { + ConfigurationProvider.reload(); + provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); + } + catch (ConfigurationException e) + { + throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); + } + } + + /** + * Constructor for ConfigurationProvider. + * @param arg0 + */ + public ConfigurationProviderTest3() throws MOAException + { + super("ConfigurationProvider"); + } + + public void testGetWarnings() + { + // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found + assertEquals(3, provider_.getWarnings().size()); + } + + public void testGetDigestMethodAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.SHA1_URI, + provider_.getDigestMethodAlgorithmName()); + } + + public void testGetCanonicalizationAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.C14N_URI, + provider_.getCanonicalizationAlgorithmName()); + } + + public void testGetHardwareCryptoModules() + { + // No hardware crypto modules in config file, check for empty list + List hwcms = provider_.getHardwareCryptoModules(); + assertEquals(0, hwcms.size()); + } + + public void testGetHardwareKeyModules() + { + // No hardware key modules in config file, check for empty list + List hwkms = provider_.getHardwareKeyModules(); + assertEquals(0, hwkms.size()); + } + + public void testGetSoftwareKeyModules() + { + // No software key modules in config file, check for empty list + List swkms = provider_.getSoftwareKeyModules(); + assertEquals(0, swkms.size()); + } + + public void testGetDistributionPoints() throws RFC2253NameParserException + { + // No distribution points in config file, check for emtpy set + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); + Name name = parser.parse(); + cert.setIssuerDN(name); + + Set dps = provider_.getDistributionPoints(cert); + assertEquals(0, dps.size()); + } + + public void testGetCRLArchiveDuration() + { + // No archive duration in config file, check for default value + assertEquals(0, provider_.getCRLArchiveDuration()); + } + + public void testGetCreateTransformsInfoProfile() + { + // No profile in config file, check for null + Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); + assertNull(ctip1); + } + + public void testGetCreateSignatureEnvironmentProfile() + { + // No profile in config file, check for null + Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); + assertNull(csep); + } + + public void testGetVerifyTransformsInfoProfile() + { + // No profile in config file, check for null + Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); + assertNull(vtip); + } + + public void testGetSupplementProfile() + { + // No profile in config file, check for null + Element sp = provider_.getSupplementProfile("SP_1"); + assertNull(sp); + } + + public void testGetRevocationArchiveJDBCURL() + { + // No archive in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCURL()); + } + + public void testGetRevocationArchiveJDBCDriverClass() + { + // No archive in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCDriverClass()); + } + + public void testGetServiceOrder() + { + // Element is missing in config file, check for empty array + String[] serviceOrder = provider_.getServiceOrder(); + assertEquals(0, serviceOrder.length); + } +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java new file mode 100644 index 000000000..be1090e4a --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java @@ -0,0 +1,149 @@ +package test.at.gv.egovernment.moa.spss.server.iaik.config; + +import java.io.FileInputStream; +import java.security.KeyStore; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import iaik.asn1.structures.DistributionPoint; +import iaik.pki.PKIConfiguration; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.pki.pathvalidation.ValidationConfiguration; +import iaik.pki.revocation.CRLDistributionPoint; +import iaik.pki.revocation.RevocationConfiguration; +import iaik.pki.store.certstore.CertStoreConfiguration; +import iaik.pki.store.certstore.CertStoreTypes; +import iaik.pki.store.revocation.archive.ArchiveConfiguration; +import iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter; +import iaik.server.ConfigurationData; +import iaik.server.modules.keys.HardwareKeyModuleConfiguration; +import iaik.server.modules.keys.SoftwareKeyModuleConfiguration; + +import at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImpl; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Tests the ConfigurationDataImpl. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ConfigurationDataImplTest extends SPSSTestCase { + + private ConfigurationData config; + private X509Certificate iaikCert; + + public ConfigurationDataImplTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + TransactionContext context; + + setUpTransactionContext(); + context = TransactionContextManager.getInstance().getTransactionContext(); + + config = new ConfigurationDataImpl(context.getConfiguration()); + + KeyStore ks = KeyStore.getInstance("JKS", "SUN"); + ks.load( + new FileInputStream(TESTDATA_ROOT + "security/server.keystore"), + "changeit".toCharArray()); + + CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); + Collection certs = + certFactory.generateCertificates( + new FileInputStream( + TESTDATA_ROOT + + "conf/moa-spss/trustprofiles/TrustProfile1/IAIKRoot.cer")); + iaikCert = (X509Certificate) certs.toArray()[0]; + + } + + public void testGetPKIConfiguration() { + PKIConfiguration pkiConfig = config.getPKIConfiguration(); + ArchiveConfiguration archiveConfig = pkiConfig.getArchiveConfiguration(); + CertStoreConfiguration certStoreConfig = + pkiConfig.getCertStoreConfiguration(); + RevocationConfiguration revocationConfig = + pkiConfig.getRevocationConfiguration(); + ValidationConfiguration validationConfig = + pkiConfig.getValidationConfiguration(); + DataBaseArchiveParameter archiveParam; + Set distributionPoints; + Iterator iter; + boolean found; + + // test archive parameters + archiveParam = + (DataBaseArchiveParameter) archiveConfig.getArchiveParameters(); + assertEquals( + archiveParam.getJDBCUrl(), + "jdbc:postgresql://10.16.46.108/moa?user=moa&password=moatest"); + + // test cert store configuration + assertEquals(1, certStoreConfig.getParameters().length); + assertEquals( + CertStoreTypes.DIRECTORY, + certStoreConfig.getParameters()[0].getType()); + + // test revocation configuration + distributionPoints = + revocationConfig.getAlternativeDistributionPoints(iaikCert, null, new Date()); + assertEquals(3, distributionPoints.size()); + found = false; + for (iter = distributionPoints.iterator(); iter.hasNext();) { + CRLDistributionPoint dp = (CRLDistributionPoint) iter.next(); + if (dp.getUri().equals("http://www.iaik.at/testCA/iaik_test_sig.crl")) { + found = + dp.getReasonCodes() + == (DistributionPoint.keyCompromise + | DistributionPoint.affiliationChanged); + } + } + assertTrue(found); + + // test validation configuration + assertEquals( + ChainingModes.PKIX_MODE, + validationConfig.getChainingMode(iaikCert)); + } + + /* + public void testGetCryptoModuleConfigurations() { + List cryptoConfigs = config.getCryptoModuleConfigurations(); + HardwareCryptoModuleConfiguration moduleConfig; + + assertEquals(2, cryptoConfigs.size()); + moduleConfig = (HardwareCryptoModuleConfiguration) cryptoConfigs.get(0); + assertEquals("Module1", moduleConfig.getModuleName()); + assertEquals("Slot1", moduleConfig.getSlotID()); + assertEquals("PIN1", new String(moduleConfig.getUserPIN())); + } + */ + + public void testGetKeyModuleConfigurations() { + List keyConfigs = config.getKeyModuleConfigurations(); + HardwareKeyModuleConfiguration hwKey; + SoftwareKeyModuleConfiguration swKey; + + assertEquals(7, keyConfigs.size()); + hwKey = (HardwareKeyModuleConfiguration) keyConfigs.get(0); + assertEquals("cryptoki.dll", hwKey.getModuleName()); + assertEquals("0", hwKey.getSlotID()); + assertEquals("0000", new String(hwKey.getUserPIN())); + swKey = (SoftwareKeyModuleConfiguration) keyConfigs.get(1); + assertEquals( + "buergerkarte", + new String(swKey.getKeyStoreAuthenticationData())); + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java new file mode 100644 index 000000000..3b403dc19 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java @@ -0,0 +1,36 @@ +package test.at.gv.egovernment.moa.spss.server.iaik.config; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Tests the IaikConfigurator. + * + * @author Patrick Peck + * @version $Id$ + */ +public class IaikConfiguratorTest extends SPSSTestCase { + + public IaikConfiguratorTest(String name) { + super(name); + } + + /** + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUpTransactionContext(); + } + + public void testConfigure() throws Exception { + IaikConfigurator configurator = new IaikConfigurator(); + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + + configurator.configure(context.getConfiguration()); + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java new file mode 100644 index 000000000..65fa2bf72 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java @@ -0,0 +1,25 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Runs all tests in this package. + * + * @author Patrick Peck + * @version $Id$ + */ +public class AllTests { + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(DataObjectFactoryTest.class); + suite.addTestSuite(TransformationFactoryTest.class); + suite.addTestSuite(XMLSignatureCreationInvokerTest.class); + suite.addTestSuite(CMSSignatureVerificationInvokerTest.class); + suite.addTestSuite(XMLSignatureVerificationInvokerTest.class); + + return suite; + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java new file mode 100644 index 000000000..3024730f4 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java @@ -0,0 +1,63 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; + +/** + * Mainly a smoke test for debugging the CMSSignatureVerificationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CMSSignatureVerificationInvokerTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyCMSSignature/"; + + /** + * Constructor for CMSSignatureVerificationInvokerTest. + * @param name + */ + public CMSSignatureVerificationInvokerTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + setUpTransactionContext(); + setUpLoggingContext(); + setUpIaikConfiguration(); + } + + public void testVerifyCMSSignature() throws Exception { + try { + CMSSignatureVerificationInvoker invoker = + CMSSignatureVerificationInvoker.getInstance(); + VerifyCMSSignatureRequestParser requestParser = + new VerifyCMSSignatureRequestParser(); + Document doc = + SPSSTestCase.parseXmlValidating( + TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml"); + VerifyCMSSignatureRequest request = + requestParser.parse(doc.getDocumentElement()); + VerifyCMSSignatureResponse response = invoker.verifyCMSSignature(request); + VerifyCMSSignatureResponseBuilder responseBuilder = + new VerifyCMSSignatureResponseBuilder(); + Element result = responseBuilder.build(response).getDocumentElement(); + + System.out.println(DOMUtils.serializeNode(result)); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java new file mode 100644 index 000000000..7de2add33 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java @@ -0,0 +1,180 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import java.io.InputStream; +import java.security.Security; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import iaik.server.modules.xml.BinaryDataObject; +import iaik.server.modules.xml.DataObject; +import iaik.server.modules.xml.XMLDataObject; + +import at.gv.egovernment.moa.util.Base64Utils; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.server.iaik.xml.ByteArrayDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.ByteStreamDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLNodeListDataObjectImpl; +import at.gv.egovernment.moa.spss.server.invoke.DataObjectFactory; + +/** + * Test cases for the DataObjectFactory class. + * + * @author Patrick Peck + * @version $Id$ + */ +public class DataObjectFactoryTest extends SPSSTestCase { + + private static final String HTTP_BINARY_CONTENT_URL = "http://www.google.com"; + private static final String HTTP_XML_CONTENT_URL = + "http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"; + private static final String HTTPS_BINARY_CONTENT_URL = + "https://businessnet.ba-ca.com"; + private static final String HTTPS_UNTRUSTED_URL = + "https://heribert.anecon.com"; + private static final String HTTP_UNKNOWN_HOST_URL = "http://uurjmjmruuw.com"; + private static final String MALFORMED_URL = "//hsld///ddd"; + private static final String FILE_BINARY_CONTENT_URL = "file:/C:/boot.ini"; + private static final String XML_CONTENT = + "" + + " " + + " " + + ""; + private static final String BASE64_CONTENT = "U3Zlbg=="; + + private SPSSFactory spssFactory = SPSSFactory.getInstance(); + private DataObjectFactory factory; + + /** + * Constructor for DataObjectFactoryTest. + * @param name + */ + public DataObjectFactoryTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + factory = DataObjectFactory.getInstance(); + + // set up SSL + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + System.setProperty( + "java.protocol.handler.pkgs", + "com.sun.net.ssl.internal.www.protocol"); + /* + System.setProperty( + "javax.net.ssl.keyStore", + "data/test/security/client.keystore"); + System.setProperty("javax.net.ssl.keyStorePassword", "changeit"); + System.setProperty( + "javax.net.ssl.trustStore", + "data/test/security/client.keystore"); + System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); + */ + } + + public void testCreateFromURIWithBinaryHttp() throws Exception { + DataObject dataObject = + factory.createFromURI(HTTP_BINARY_CONTENT_URL, false); + + assertNotNull(dataObject); + assertTrue(dataObject instanceof ByteStreamDataObjectImpl); + assertNotNull(((BinaryDataObject) dataObject).getInputStream()); + } + + public void testCreateFromURIWithXmlHttp() throws Exception { + DataObject dataObject = factory.createFromURI(HTTP_XML_CONTENT_URL, false); + Element element; + + assertNotNull(dataObject); + assertTrue(dataObject instanceof XMLDataObjectImpl); + element = ((XMLDataObject) dataObject).getElement(); + assertNotNull(element); + assertEquals("schema", element.getTagName()); + } + + public void testCreateFromURIWithMalformedURI() throws Exception { + try { + factory.createFromURI(MALFORMED_URL, false); + fail(); + } catch (MOAException e) { + } + } + + public void testCreateFromURIWithNonExistingHttpURL() throws Exception { + try { + factory.createFromURI(HTTP_UNKNOWN_HOST_URL, false); + fail(); + } catch (MOAException e) { + } + } + + public void testCreateFromURIWithHttps() throws Exception { + DataObject dataObject = + factory.createFromURI(HTTPS_BINARY_CONTENT_URL, false); + assertNotNull(dataObject); + assertTrue(dataObject instanceof BinaryDataObject); + } + + public void testCreateFromURIWithUntrustedHttps() throws Exception { + try { + factory.createFromURI(HTTPS_UNTRUSTED_URL, false); + fail(); + } catch (MOAException e) { + + } + } + + public void testCreateFromURIWithFile() throws Exception { + try { + factory.createFromURI(FILE_BINARY_CONTENT_URL, false); + fail(); + } catch (MOAException e) { + } + } + + public void testCreateFromContentOptionalRefTypeWithXmlContent() + throws Exception { + Document doc = parseXmlString(XML_CONTENT); + Content content = + spssFactory.createContent( + doc.getDocumentElement().getChildNodes(), + "http://data"); + DataObject dataObject = + factory.createFromContentOptionalRefType( + content, + null, + null, + true, + false, + true, + false); + + assertTrue(dataObject instanceof XMLNodeListDataObjectImpl); + } + + public void testCreateFromContentOptionalRefTypeWithBase64Content() + throws Exception { + InputStream is = Base64Utils.decodeToStream(BASE64_CONTENT, true); + Content content = spssFactory.createContent(is, "http://data"); + DataObject dataObject = + factory.createFromContentOptionalRefType( + content, + null, + null, + false, + false, + true, + false); + + assertNotNull(dataObject); + assertTrue(dataObject instanceof ByteArrayDataObjectImpl); + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java new file mode 100644 index 000000000..13a80cbf1 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java @@ -0,0 +1,201 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Document; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import iaik.ixsil.init.IXSILInit; +import iaik.ixsil.util.URI; +import iaik.server.modules.xml.Base64Transformation; +import iaik.server.modules.xml.Canonicalization; +import iaik.server.modules.xml.EnvelopedSignatureTransformation; +import iaik.server.modules.xml.Transformation; +import iaik.server.modules.xml.XPath2Transformation; +import iaik.server.modules.xml.XPathTransformation; +import iaik.server.modules.xml.XSLTTransformation; + +import at.gv.egovernment.moa.util.Constants; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.common.Transform; +import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; +import at.gv.egovernment.moa.spss.server.invoke.TransformationFactory; + +/** + * Test cases for the TransformationFactory class. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TransformationFactoryTest extends SPSSTestCase { + + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/dsigTransform/"; + private TransformationFactory factory = TransformationFactory.getInstance(); + private TransformParser transformParser = new TransformParser(); + + /** + * Constructor for TransformationFactoryTest. + * @param name + */ + public TransformationFactoryTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + IXSILInit.init(new URI("init/properties/init.properties")); + //IXSILInit.init(new URI("file:data/deploy/ixsil/init/properties/init.properties")); + + } + + public void testCreateCanonicalization() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "canonicalization.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + + assertTrue(t instanceof Canonicalization); + assertEquals( + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", + t.getAlgorithmURI()); + } + + public void testCreateCanonicalizationWithComments() throws Exception { + Document transform = + parseXml(TESTDATA_BASE + "canonicalizationWithComments.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + + assertTrue(t instanceof Canonicalization); + assertEquals( + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", + t.getAlgorithmURI()); + } + + public void testCreateBase64Decode() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "base64.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + assertTrue(t instanceof Base64Transformation); + } + + public void testCreateEnvelopedSignature() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "enveloped.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + assertTrue(t instanceof EnvelopedSignatureTransformation); + } + + public void testXPathTransformation() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "xpath.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + Map nsDecls; + + assertTrue(t instanceof XPathTransformation); + nsDecls = ((XPathTransformation) t).getNamespaceDeclarations(); + assertEquals(1, nsDecls.size()); + assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); + } + + public void testCreateXPath2Transformation() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "xpath2.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + assertTrue(t instanceof XPath2Transformation); + } + + public void testCreateXSLTTransformation() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "xslt.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + XSLTTransformation t = + (XSLTTransformation) factory.createTransformation(tr); + assertNotNull(t.getStylesheetElement()); + } + + public void testCreateWithIllegalAlgorithm() throws Exception { + try { + Document transform = parseXml(TESTDATA_BASE + "illegalAlgorithm.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + factory.createTransformation(tr); + fail(); + } catch (MOAApplicationException e) { + } + } + + public void testEqualsXslt() throws Exception { + Document xslt = parseXml(TESTDATA_BASE + "xslt.xml"); + Transform tr = transformParser.parseTransform(xslt.getDocumentElement()); + Transformation trXslt = factory.createTransformation(tr); + + Document xsltEqu = parseXml(TESTDATA_BASE + "xsltEqual.xml"); + tr = transformParser.parseTransform(xsltEqu.getDocumentElement()); + Transformation trXsltEqu = factory.createTransformation(tr); + + Document xsltDiff = parseXml(TESTDATA_BASE + "xsltDifferent.xml"); + tr = transformParser.parseTransform(xsltDiff.getDocumentElement()); + Transformation trXsltDiff = factory.createTransformation(tr); + + Document canonicalization = + parseXml(TESTDATA_BASE + "canonicalization.xml"); + + assertTrue(trXslt.equals(trXsltEqu)); + assertFalse(trXslt.equals(trXsltDiff)); + assertFalse(trXsltEqu.equals(trXsltDiff)); + assertEquals(trXslt.hashCode(), trXsltEqu.hashCode()); + assertFalse(trXslt.hashCode() == trXsltDiff.hashCode()); + assertFalse(trXsltEqu.hashCode() == trXsltDiff.hashCode()); + assertFalse(trXslt.equals(canonicalization)); + } + + public void testEqualsXPath() throws Exception { + Document xpath = parseXml(TESTDATA_BASE + "xpath.xml"); + Transform tr = transformParser.parseTransform(xpath.getDocumentElement()); + Transformation trXpath = factory.createTransformation(tr); + Transformation trXpathEqu = factory.createTransformation(tr); + + Document xpathDiff = parseXml(TESTDATA_BASE + "xpathDifferent.xml"); + tr = transformParser.parseTransform(xpathDiff.getDocumentElement()); + Transformation trXpathDiff = factory.createTransformation(tr); + + assertTrue(trXpath.equals(trXpathEqu)); + assertEquals(trXpath.hashCode(), trXpathEqu.hashCode()); + assertFalse(trXpath.equals(trXpathDiff)); + assertFalse(trXpath.hashCode() == trXpathDiff.hashCode()); + } + + public void testEqualsXPath2() throws Exception { + Document xpath2 = parseXml(TESTDATA_BASE + "xpath2.xml"); + Transform tr = transformParser.parseTransform(xpath2.getDocumentElement()); + Transformation trXpath2 = factory.createTransformation(tr); + Transformation trXpath2Equ = factory.createTransformation(tr); + + Document xpath2Diff = parseXml(TESTDATA_BASE + "xpath2Different.xml"); + tr = transformParser.parseTransform(xpath2Diff.getDocumentElement()); + Transformation trXpath2Diff = factory.createTransformation(tr); + + assertTrue(trXpath2.equals(trXpath2Equ)); + assertEquals(trXpath2.hashCode(), trXpath2Equ.hashCode()); + assertFalse(trXpath2.equals(trXpath2Diff)); + assertFalse(trXpath2.hashCode() == trXpath2Diff.hashCode()); + } + + public void testCreateTransformationList() throws Exception { + Document transforms = parseXml(TESTDATA_BASE + "transforms.xml"); + List trs = transformParser.parseTransforms(transforms.getDocumentElement()); + List transformationList = factory.createTransformationList(trs); + + assertEquals(3, transformationList.size()); + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java new file mode 100644 index 000000000..28cd3805a --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java @@ -0,0 +1,63 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import java.util.Collections; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureCreationInvoker; + +/** + * Mainly a smoke test for debugging the XMLSignatureCreationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureCreationInvokerTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/CreateXMLSignature/"; + + public XMLSignatureCreationInvokerTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + setUpTransactionContext(); + setUpLoggingContext(); + setUpIaikConfiguration(); + setUpSSL(); + } + + public void testCreateXMLSignature() throws Exception { + try { + XMLSignatureCreationInvoker invoker = + XMLSignatureCreationInvoker.getInstance(); + CreateXMLSignatureRequestParser requestParser = + new CreateXMLSignatureRequestParser(); + Document doc = + SPSSTestCase.parseXmlValidating( + TESTDATA_BASE + "TestGeneratorCX2.004.Req.xml"); + CreateXMLSignatureRequest request = + requestParser.parse(doc.getDocumentElement()); + CreateXMLSignatureResponse response = + invoker.createXMLSignature(request, Collections.EMPTY_SET); + CreateXMLSignatureResponseBuilder responseBuilder = + new CreateXMLSignatureResponseBuilder(); + Element result = responseBuilder.build(response).getDocumentElement(); + + System.out.println(DOMUtils.serializeNode(result)); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java new file mode 100644 index 000000000..56e3d541b --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java @@ -0,0 +1,61 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import org.w3c.dom.Document; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureVerificationInvoker; + +/** + * Mainly a smoke test for debugging the XMLSignatureVerificationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureVerificationInvokerTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyXMLSignature/"; + + public XMLSignatureVerificationInvokerTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + setUpTransactionContext(); + setUpLoggingContext(); + setUpIaikConfiguration(); + } + + public void testVerifyXMLSignature() throws Exception { + try { + XMLSignatureVerificationInvoker invoker = + XMLSignatureVerificationInvoker.getInstance(); + VerifyXMLSignatureRequestParser requestParser = + new VerifyXMLSignatureRequestParser(); + VerifyXMLSignatureResponseBuilder responseBuilder = + new VerifyXMLSignatureResponseBuilder(); + Document doc = + SPSSTestCase.parseXmlValidating( + TESTDATA_BASE + "TestGeneratorVX.201.Req.xml"); + + VerifyXMLSignatureRequest request = + requestParser.parse(doc.getDocumentElement()); + VerifyXMLSignatureResponse response; + + response = invoker.verifyXMLSignature(request); + System.out.println( + DOMUtils.serializeNode(responseBuilder.build(response))); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + +} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java new file mode 100644 index 000000000..b46c20086 --- /dev/null +++ b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java @@ -0,0 +1,50 @@ +package test.at.gv.egovernment.moa.spss.server.tools; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import at.gv.egovernment.moa.spss.server.tools.CertTool; + +import test.at.gv.egovernment.moa.MOATestCase; + +/** + * Tests for the CertTool. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CertToolTest extends MOATestCase { + + private static final String EXPECTED_RESULT = + "SubjectDN (RFC2253):" + + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" + + "IssuerDN (RFC2253) :" + + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" + + "Serial Number :" + + " 1047548672\r\n"; + private CertTool certTool; + + /** + * Constructor for CertToolTest. + * @param name + */ + public CertToolTest(String name) { + super(name); + } + + protected void setUp() { + certTool = new CertTool(); + } + + public void testPrintCertInfo() { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PrintStream ps = new PrintStream(bos); + String result; + + certTool.printCertInfo(TESTDATA_ROOT + "security/server.cer", ps); + result = new String(bos.toByteArray()); + System.out.println(result); + assertEquals(EXPECTED_RESULT, result); + } + +} -- cgit v1.2.3 From 4e47325e1cda70ad8b42aa78837e19f2ed077e38 Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 8 Aug 2007 11:30:00 +0000 Subject: spss mavenized git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@914 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 158 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 spss/server/serverlib/pom.xml (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml new file mode 100644 index 000000000..50b6fc411 --- /dev/null +++ b/spss/server/serverlib/pom.xml @@ -0,0 +1,158 @@ + + + MOA.spss + server + 1.4.0 + + + 4.0.0 + MOA.spss.server + serverlib + jar + 1.4.0 + MOA SPSS Serverlibrary + + + ${basedir}/../../../buildhelper + + + + + axis + axis + + + saaj + saaj + + + commons-discovery + commons-discovery + + + commons-logging + commons-logging + + + + + + + javax.activation + activation + + + jaxen + jaxen + + + jaxp + dom + + + jaxp + jaxp-api + + + jaxp + sax + + + + + + + org.w3c.dom + dom + + + sax + sax + + + jsse + jsse + + + jsse + jnet + + + jsse + jcert + + + junit + junit + + + log4j + log4j + + + postgresql + postgresql + + + javax.servlet + servlet-api + + + xalan + xalan + + + xerces + xercesImpl + + + xerces + xmlParserAPIs + + + iaik.prod + iaik_moa_full + + + iaik.prod + iaik_ixsil + + + iaik.prod + iaik_jce_full + compile + + + iaik.prod + iaik_ecc + + + iaik.prod + iaik_Pkcs11Provider + + + iaik.prod + iaik_Pkcs11Wrapper + + + iaik.win32 + Pkcs11Wrapper + dll + 1.0 + + + MOA + common + + + + + MOA + common-test + system + ${basedir}/../../../common-test/target + + + + -- cgit v1.2.3 From 9b787d3409e629f292a98d0b5a0aad036b7421c7 Mon Sep 17 00:00:00 2001 From: mcentner Date: Fri, 17 Aug 2007 08:47:35 +0000 Subject: Improved and updated maven build process. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@919 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 197 +++++++++++------ .../resources/data/deploy/tools/certtool.bat | 25 --- .../resources/data/deploy/tools/certtool.sh | 20 -- .../resources/data/deploy/tools/configtool.bat | 25 --- .../resources/data/deploy/tools/configtool.sh | 20 -- .../java/at/gv/egovernment/moa/spss/overview.htm | 155 ------------- .../moa/spss/server/tools/CertTool.java | 242 --------------------- .../moa/spss/server/tools/ConfigTool.java | 59 ----- .../serverlib/src/main/javadoc/overview.html | 155 +++++++++++++ 9 files changed, 282 insertions(+), 616 deletions(-) delete mode 100644 spss/server/serverlib/resources/data/deploy/tools/certtool.bat delete mode 100644 spss/server/serverlib/resources/data/deploy/tools/certtool.sh delete mode 100644 spss/server/serverlib/resources/data/deploy/tools/configtool.bat delete mode 100644 spss/server/serverlib/resources/data/deploy/tools/configtool.sh delete mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/overview.htm delete mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java delete mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java create mode 100644 spss/server/serverlib/src/main/javadoc/overview.html (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 50b6fc411..edf27d123 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -2,86 +2,70 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> MOA.spss - server + moa-spss 1.4.0 4.0.0 MOA.spss.server - serverlib + moa-spss-lib jar 1.4.0 - MOA SPSS Serverlibrary + MOA SP/SS API - - ${basedir}/../../../buildhelper - + + ${basedir}/../../../repository + axis axis - - saaj - saaj - - - commons-discovery - commons-discovery - + + + + + + + + commons-logging commons-logging - - - - javax.activation activation - - jaxen - jaxen - - - jaxp - dom - - - jaxp - jaxp-api - - - jaxp - sax - + + + + + + + + + + + + + + + + - - org.w3c.dom - dom - - - sax - sax - - - jsse - jsse - - - jsse - jnet - - - jsse - jcert - + + + + + + + + junit junit @@ -112,7 +96,7 @@ iaik.prod - iaik_moa_full + iaik_moa iaik.prod @@ -126,33 +110,106 @@ iaik.prod iaik_ecc + compile iaik.prod iaik_Pkcs11Provider + runtime iaik.prod iaik_Pkcs11Wrapper + runtime - - iaik.win32 - Pkcs11Wrapper - dll - 1.0 - - - MOA - common - - - + + + + + + + MOA - common-test - system - ${basedir}/../../../common-test/target + moa-common + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.2 + + true + false + false + true + at.gv.egovernment.moa.spss.server.*;at.gv.egovernment.moa.spss.api.impl.*;at.gv.egovernment.moa.spss.impl.* + + + pre + a + Preconditions: + + + post + a + Postconfitions: + + + + + API Factory and Services + at.gv.egovernment.moa.spss.api + + + Exceptions + at.gv.egovernment.moa.spss + + + API Objects for Signature Creation + at.gv.egovernment.moa.spss.api.xmlsign + + + API Objects for CMS Signature Verification + at.gv.egovernment.moa.spss.api.cmsverify + + + API Objects for XML Signature Verification + at.gv.egovernment.moa.spss.api.xmlverify + + + Common API Objects + at.gv.egovernment.moa.spss.api.common + + + Builders and Parsers to convert API Objects to and from XML + at.gv.egovernment.moa.spss.api.xmlbind + + + Utilities + at.gv.egovernment.moa.util + at.gv.egovernment.moa.spss.util + + + Logging + at.gv.egovernment.moa.logging + + + http://java.sun.com/j2se/1.4/docs/api/ + + + + generate-javadoc + package + + jar + + + + + + diff --git a/spss/server/serverlib/resources/data/deploy/tools/certtool.bat b/spss/server/serverlib/resources/data/deploy/tools/certtool.bat deleted file mode 100644 index 0504211b8..000000000 --- a/spss/server/serverlib/resources/data/deploy/tools/certtool.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off - -rem -rem Script to invoke the CertTool class -rem -rem Author: Patrick Peck -rem Version: $Id: certtool.bat,v 1.6 2003/05/08 11:46:29 peck Exp $ -rem - - -if %OS%=="Windows_NT" @setlocal - -set CERTTOOL=at.gv.egovernment.moa.spss.server.tools.CertTool -set TOOLSPATH=%~p0 -set CLASSPATH=%TOOLSPATH%tools.jar;%TOOLSPATH%iaik_moa_full.jar;%TOOLSPATH%iaik_jce_full.jar;%TOOLSPATH%iaik_ecc.jar;%TOOLSPATH%log4j-1.2.7.jar - -if "%JAVA_HOME%"=="" goto noJavaHome -%JAVA_HOME%\bin\java.exe -classpath %CLASSPATH% %CERTTOOL% %1 %2 %3 %4 %5 %6 %7 %8 %9 -goto end - -:noJavaHome -echo error: JAVA_HOME not defined - -:end -if %OS%=="Windows_NT" @endlocal \ No newline at end of file diff --git a/spss/server/serverlib/resources/data/deploy/tools/certtool.sh b/spss/server/serverlib/resources/data/deploy/tools/certtool.sh deleted file mode 100644 index c7ff374f4..000000000 --- a/spss/server/serverlib/resources/data/deploy/tools/certtool.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# -# Script to invoke the CertTool class -# -# Author:Patrick Peck -# Version: $Id: certtool.sh,v 1.9 2003/06/23 16:01:27 peck Exp $ -# - - -if [ -z "$JAVA_HOME" ]; then - echo "error: JAVA_HOME not defined"; - exit; -fi - -CERTOOL=at.gv.egovernment.moa.spss.server.tools.CertTool -TOOLSPATH=`dirname $PWD/$0` -CLASSPATH=$TOOLSPATH/tools.jar:$TOOLSPATH/iaik_moa_full.jar:$TOOLSPATH/iaik_jce_full.jar:$TOOLSPATH/iaik_ecc.jar:$TOOLSPATH/log4j-1.2.7.jar - -$JAVA_HOME/bin/java -classpath $CLASSPATH $CERTOOL $* diff --git a/spss/server/serverlib/resources/data/deploy/tools/configtool.bat b/spss/server/serverlib/resources/data/deploy/tools/configtool.bat deleted file mode 100644 index 868df11f0..000000000 --- a/spss/server/serverlib/resources/data/deploy/tools/configtool.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off - -rem -rem Script to invoke the ConfigTool class -rem -rem Author: Gregor Karlinger -rem Version: $Id: $ -rem - - -if %OS%=="Windows_NT" @setlocal - -set CONFIGTOOL=at.gv.egovernment.moa.spss.server.tools.ConfigTool -set TOOLSPATH=%~p0 -set CLASSPATH=%TOOLSPATH%tools.jar;%TOOLSPATH%xalan.jar; - -if "%JAVA_HOME%"=="" goto noJavaHome -%JAVA_HOME%\bin\java.exe -classpath %CLASSPATH% %CONFIGTOOL% %1 %2 %3 %4 %5 %6 %7 %8 %9 -goto end - -:noJavaHome -echo error: JAVA_HOME not defined - -:end -if %OS%=="Windows_NT" @endlocal \ No newline at end of file diff --git a/spss/server/serverlib/resources/data/deploy/tools/configtool.sh b/spss/server/serverlib/resources/data/deploy/tools/configtool.sh deleted file mode 100644 index f7f29bae1..000000000 --- a/spss/server/serverlib/resources/data/deploy/tools/configtool.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# -# Script to invoke the ConfigTool class -# -# Author: Gregor Karlinger -# Version: $Id: $ -# - - -if [ -z "$JAVA_HOME" ]; then - echo "error: JAVA_HOME not defined"; - exit; -fi - -CONFIGTOOL=at.gv.egovernment.moa.spss.server.tools.ConfigTool -TOOLSPATH=`dirname $PWD/$0` -CLASSPATH=$TOOLSPATH/tools.jar:$TOOLSPATH/xalan.jar - -$JAVA_HOME/bin/java -classpath $CLASSPATH $CONFIGTOOL $* diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/overview.htm b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/overview.htm deleted file mode 100644 index 9b17bbf91..000000000 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/overview.htm +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - -MOA SP/SS API documentation overview. - - -

Using the MOA SP/SS API

- -

Invoking the services

-In general, invoking the MOA SP/SS API involves the following steps: -
    -
  1. Set the moa.spss.server.configuration system property to point -to the main MOA SP/SS configuration file. This needs to be done only once per -JVM instance. You may also call -{@link at.gv.egovernment.moa.spss.api.Configurator#init} at this point to -pre-initialize MOA SP/SS (if not, it is done automatically upon service -invocation).
  2. -
  3. Create an instance of the service to be used -({@link at.gv.egovernment.moa.spss.api.SignatureCreationService} or -{@link at.gv.egovernment.moa.spss.api.SignatureVerificationService}), -via its getInstance() method.
  4. -
  5. Create an instance of the -{@link at.gv.egovernment.moa.spss.api.SPSSFactory}, via its -{@link at.gv.egovernment.moa.spss.api.SPSSFactory#getInstance} method.
  6. -
  7. Use the create... methods of the SPSSFactory to -create the desired {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest}, -{@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest} or -{@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest} object. -
  8. -
  9. Call one of the service methods: -{@link at.gv.egovernment.moa.spss.api.SignatureCreationService#createXMLSignature(at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest) createXMLSignature()}, -{@link at.gv.egovernment.moa.spss.api.SignatureVerificationService#verifyCMSSignature(at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest) verifyCMSSignature()} or -{@link at.gv.egovernment.moa.spss.api.SignatureVerificationService#verifyXMLSignature(at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest) verifyXMLSignature()}. -
  10. -
  11. Analyze the result of the service call, given as a -{@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse}, -{@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse} or -{@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse}. -In case of an error, a {@link at.gv.egovernment.moa.spss.MOAException} -is thrown by the service. Please be aware that errors during signature creation -are reported as part of a CreateXMLSignatureResponse. -
- -

Creating MOA SP/SS API objects

-

-Invoking the MOA SP/SS API Service classes involves creating -a Request object using the {@link at.gv.egovernment.moa.spss.api.SPSSFactory SPSSFactory}. -Object creation using the SPSSFactory is always bottom-up, meaning -that in order to create an object all of its components must have been created -before. -

-

-The names of the MOA SP/SS API classes have been chosen to correspond to the -MOA SP/SS schema elements. The structure of the classes (i.e., their fields) -also corresponds to the structure of the respective MOA SP/SS schema elements. -However, a few classes escape this naming convention, mainly because the -corresponding schema elements contain xsd:choice components: -

    -
  • The various Profile classes have subclasses called -ProfileID and ProfileExplicit -(e.g., {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileID} and -{@link at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit}), -so that the profile can be given either as an ID (which is to be resolved from the -MOA SP/SS configuration) or explicitly.
  • -
  • The classes {@link at.gv.egovernment.moa.spss.api.common.Content}, -{@link at.gv.egovernment.moa.spss.api.cmsverify.CMSContent} and -{@link at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter} have -subclasses specifying the type of content they actually contain. E.g., -{@link at.gv.egovernment.moa.spss.api.common.ContentBinary} will contain -a byte stream.
  • -
- -

-

-For clarity, the MOA SP/SS API classes have been organized in several packages -listed in the following table: -

- - - - - - - - - - - - - - - - - - - - - -
PackagePurpose
{@link at.gv.egovernment.moa.spss.api.xmlsign}Components of the {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest} and - {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse}
{@link at.gv.egovernment.moa.spss.api.cmsverify}Components of the - {@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest} and - {@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse}
{@link at.gv.egovernment.moa.spss.api.xmlverify}Components of the - {@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest} and - {@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse}
{@link at.gv.egovernment.moa.spss.api.common}Common components used across the classes of the above packages
- -

Converting MOA SP/SS API objects to and from DOM trees

-The package {@link at.gv.egovernment.moa.spss.api.xmlbind} contains helper -classes to: -
    -
  • Parse a DOM tree containing a CreateXMLSignatureRequest, -VerifyCMSSignatureRequest or -VerifyCMSSignatureRequest into its respective MOA SP/SS API object -representation. For example, to parse a CreateXMLSignatureRequest -DOM tree, the {@link at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser#parse(org.w3c.dom.Element) CreateXMLSignatureRequestParser.parse()} -method can be used.
    -Note: The DOM tree of the request must be derived from a schema valid -XML document. Otherwise, unexpected behaviour will almost certainly result.
  • -
  • Build a CreateXMLSignatureResponse, -VerifyCMSSignatureResponse or a -VerifyXMLSignatureResponse DOM tree from the respective MOA SP/SS -API object. For example, to build a VerifyXMLSignatureResponse -DOM tree, the {@link at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureResponseBuilder#build(at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse) VerifyXMLSignatureResponseBuilder.build()} -can be used.
    -Note:The serialized DOM tree will be schema valid. -
  • -
-The DOM trees can easily be read from and written to XML byte streams using -the methods in the {@link at.gv.egovernment.moa.util.DOMUtils} class. -
- -

Utilities and Logging

-

The packages {@link at.gv.egovernment.moa.util} and -{@link at.gv.egovernment.moa.spss.util} contain utility classes developed for -the MOA SP/SS implementation. Since the classes contained in these packages are -tailored towards the MOA SP/SS implementation, they are far from being complete -in the sense of providing a utility class library. Therefore, they may or may -not prove useful in the context of your application. Their interfaces may also -change in future releases. -

- -

The package {@link at.gv.egovernment.moa.logging} contains classes for -logging messages to the MOA SP/SS log hierarchy via the -{@link at.gv.egovernment.moa.logging.Logger} class. -

- -

Related Documentation

- -See also the API example in the -MOA SP/SS documentation. - - - \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java deleted file mode 100644 index 9fe17eae2..000000000 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/CertTool.java +++ /dev/null @@ -1,242 +0,0 @@ -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: - *
    - *
  • printing certificate information
  • - *
  • adding certificates to the cert store
  • - *
- * - * @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 PrintStream to print to. - */ - private void printUsage(PrintStream out) { - out.println("\nCerttool-Syntax:\n"); - out.println("-info "); - out.println("\n"); - } - -} - -/** - * Simple implementation of the DirectoryCertStoreParameters - * interface intelligent enough for setting up a simple - * DirectoryCertStore in the CertTool. - * - * @author Patrick Peck - * @version $Id$ - */ -class SimpleDirectoryCertStoreParameters - implements DirectoryCertStoreParameters { - - /** The cert store root directory. */ - private String rootDirectory; - - /** - * Create a new SimpleDirectoryCertStoreParameters object. - * - * @param rootDirectory The root directory of the cert store. - */ - public SimpleDirectoryCertStoreParameters(String rootDirectory) { - this.rootDirectory = rootDirectory; - } - - /** - * @return "MOA Directory CertStore" - * @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 false - * @see iaik.pki.store.certstore.CertStoreParameters#isReadOnly() - */ - public boolean isReadOnly() { - return false; - } - - /** - * @return false - * @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/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java deleted file mode 100644 index d5c3b48c1..000000000 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java +++ /dev/null @@ -1,59 +0,0 @@ -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 "); - System.out.println(" ... Old config file to be transformed"); - System.out.println(" ... 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()); - } - } -} diff --git a/spss/server/serverlib/src/main/javadoc/overview.html b/spss/server/serverlib/src/main/javadoc/overview.html new file mode 100644 index 000000000..9b17bbf91 --- /dev/null +++ b/spss/server/serverlib/src/main/javadoc/overview.html @@ -0,0 +1,155 @@ + + + + + + +MOA SP/SS API documentation overview. + + +

Using the MOA SP/SS API

+ +

Invoking the services

+In general, invoking the MOA SP/SS API involves the following steps: +
    +
  1. Set the moa.spss.server.configuration system property to point +to the main MOA SP/SS configuration file. This needs to be done only once per +JVM instance. You may also call +{@link at.gv.egovernment.moa.spss.api.Configurator#init} at this point to +pre-initialize MOA SP/SS (if not, it is done automatically upon service +invocation).
  2. +
  3. Create an instance of the service to be used +({@link at.gv.egovernment.moa.spss.api.SignatureCreationService} or +{@link at.gv.egovernment.moa.spss.api.SignatureVerificationService}), +via its getInstance() method.
  4. +
  5. Create an instance of the +{@link at.gv.egovernment.moa.spss.api.SPSSFactory}, via its +{@link at.gv.egovernment.moa.spss.api.SPSSFactory#getInstance} method.
  6. +
  7. Use the create... methods of the SPSSFactory to +create the desired {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest}, +{@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest} or +{@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest} object. +
  8. +
  9. Call one of the service methods: +{@link at.gv.egovernment.moa.spss.api.SignatureCreationService#createXMLSignature(at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest) createXMLSignature()}, +{@link at.gv.egovernment.moa.spss.api.SignatureVerificationService#verifyCMSSignature(at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest) verifyCMSSignature()} or +{@link at.gv.egovernment.moa.spss.api.SignatureVerificationService#verifyXMLSignature(at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest) verifyXMLSignature()}. +
  10. +
  11. Analyze the result of the service call, given as a +{@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse}, +{@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse} or +{@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse}. +In case of an error, a {@link at.gv.egovernment.moa.spss.MOAException} +is thrown by the service. Please be aware that errors during signature creation +are reported as part of a CreateXMLSignatureResponse. +
+ +

Creating MOA SP/SS API objects

+

+Invoking the MOA SP/SS API Service classes involves creating +a Request object using the {@link at.gv.egovernment.moa.spss.api.SPSSFactory SPSSFactory}. +Object creation using the SPSSFactory is always bottom-up, meaning +that in order to create an object all of its components must have been created +before. +

+

+The names of the MOA SP/SS API classes have been chosen to correspond to the +MOA SP/SS schema elements. The structure of the classes (i.e., their fields) +also corresponds to the structure of the respective MOA SP/SS schema elements. +However, a few classes escape this naming convention, mainly because the +corresponding schema elements contain xsd:choice components: +

    +
  • The various Profile classes have subclasses called +ProfileID and ProfileExplicit +(e.g., {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileID} and +{@link at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit}), +so that the profile can be given either as an ID (which is to be resolved from the +MOA SP/SS configuration) or explicitly.
  • +
  • The classes {@link at.gv.egovernment.moa.spss.api.common.Content}, +{@link at.gv.egovernment.moa.spss.api.cmsverify.CMSContent} and +{@link at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter} have +subclasses specifying the type of content they actually contain. E.g., +{@link at.gv.egovernment.moa.spss.api.common.ContentBinary} will contain +a byte stream.
  • +
+ +

+

+For clarity, the MOA SP/SS API classes have been organized in several packages +listed in the following table: +

+ + + + + + + + + + + + + + + + + + + + + +
PackagePurpose
{@link at.gv.egovernment.moa.spss.api.xmlsign}Components of the {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest} and + {@link at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse}
{@link at.gv.egovernment.moa.spss.api.cmsverify}Components of the + {@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest} and + {@link at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse}
{@link at.gv.egovernment.moa.spss.api.xmlverify}Components of the + {@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest} and + {@link at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse}
{@link at.gv.egovernment.moa.spss.api.common}Common components used across the classes of the above packages
+ +

Converting MOA SP/SS API objects to and from DOM trees

+The package {@link at.gv.egovernment.moa.spss.api.xmlbind} contains helper +classes to: +
    +
  • Parse a DOM tree containing a CreateXMLSignatureRequest, +VerifyCMSSignatureRequest or +VerifyCMSSignatureRequest into its respective MOA SP/SS API object +representation. For example, to parse a CreateXMLSignatureRequest +DOM tree, the {@link at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser#parse(org.w3c.dom.Element) CreateXMLSignatureRequestParser.parse()} +method can be used.
    +Note: The DOM tree of the request must be derived from a schema valid +XML document. Otherwise, unexpected behaviour will almost certainly result.
  • +
  • Build a CreateXMLSignatureResponse, +VerifyCMSSignatureResponse or a +VerifyXMLSignatureResponse DOM tree from the respective MOA SP/SS +API object. For example, to build a VerifyXMLSignatureResponse +DOM tree, the {@link at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureResponseBuilder#build(at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse) VerifyXMLSignatureResponseBuilder.build()} +can be used.
    +Note:The serialized DOM tree will be schema valid. +
  • +
+The DOM trees can easily be read from and written to XML byte streams using +the methods in the {@link at.gv.egovernment.moa.util.DOMUtils} class. +
+ +

Utilities and Logging

+

The packages {@link at.gv.egovernment.moa.util} and +{@link at.gv.egovernment.moa.spss.util} contain utility classes developed for +the MOA SP/SS implementation. Since the classes contained in these packages are +tailored towards the MOA SP/SS implementation, they are far from being complete +in the sense of providing a utility class library. Therefore, they may or may +not prove useful in the context of your application. Their interfaces may also +change in future releases. +

+ +

The package {@link at.gv.egovernment.moa.logging} contains classes for +logging messages to the MOA SP/SS log hierarchy via the +{@link at.gv.egovernment.moa.logging.Logger} class. +

+ +

Related Documentation

+ +See also the API example in the +MOA SP/SS documentation. + + + \ No newline at end of file -- cgit v1.2.3 From 6ab1a1abbb18a77e954e4f5ac6fe39f63ea83dd1 Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 22 Aug 2007 14:16:50 +0000 Subject: set right directory position git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@927 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../properties/spss_messages_de.properties | 151 ------- .../serverlib/src/main/resources/security/cacerts | Bin 7365 -> 0 bytes .../src/main/resources/wsdl/MOA-SPSS-1.3.wsdl | 105 ----- .../src/main/resources/wsdl/MOA-SPSS-1.3.xsd | 469 --------------------- 4 files changed, 725 deletions(-) delete mode 100644 spss/server/serverlib/src/main/resources/properties/spss_messages_de.properties delete mode 100644 spss/server/serverlib/src/main/resources/security/cacerts delete mode 100644 spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.wsdl delete mode 100644 spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.xsd (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/resources/properties/spss_messages_de.properties b/spss/server/serverlib/src/main/resources/properties/spss_messages_de.properties deleted file mode 100644 index febcf01a9..000000000 --- a/spss/server/serverlib/src/main/resources/properties/spss_messages_de.properties +++ /dev/null @@ -1,151 +0,0 @@ -# This file contains exception messages in the standard Java properties -# format. The messages may contain formatting patterns as definied in the -# java.text.MessageFormat class. - -# -# Error messages: the key corresponds to the error code -# - -1100=Fehler beim Validieren der Anfrage: {0} -1101=Bei enveloping Datenobjekten muss entweder Content oder Reference übergeben werden -1102=Bei detached Datenobjekten darf das Attribut Reference nicht leer sein -1103=Ungültiger Wert für Attribut Structure im Element DataObjectInfo: {0} -1104=Ungültiger Wert für DateTime: {0} -1105=Ungültiger Wert für Attribut Index in Element CreateSignatureLocation: {0} -1106=Interner Fehler beim Parsen der XML-Daten -1107=Kein Kind-Element im Element XMLContent gefunden -1108=Ungültiger Wert für dsig:Algorithm: {0} -1109=XMLContent darf nur ein Kind-Element enthalten -1110=Entweder Content oder Reference muss gesetzt sein -1111=Reference muss gesetzt sein, wenn kein Content angegeben ist -1112=Bei leerer Reference muss CreateSignatureEnvironment vorhanden sein -1113=Der Endpunkt akzeptiert keine Anfragen vom Typ: {0} - -2200=Fehler beim Erzeugen der Antwort -2201=Transformations-Algorithmus unbekannt: {0} -2202=Kein XPath-Element für XPath-Transformation gefunden -2203=TrustProfileID unbekannt: {0} -2207=Ungültiges URI-Format: {0} -2208=Fehler beim Öffnen des Datenobjekts (URI={0}) -2209=Fehler beim Parsen der XML-Daten -2210=Fehler beim Lesen des Datenobjekts -2211=Referenzierte Daten können nicht als XML interpretiert werden (URI={0}) -2212=Fehler beim Auswerten des XPath-Ausdrucks: {0} -2213=Zugriff auf das Dateisystem verweigert (URI={0}) -2214=Ungültiges URL-Format: {0} -2215=Kein Stylesheet für XSLT-Transformation gefunden -2216=Kein XPath-Filter2 Element für XPath-Filter2-Transform gefunden -2217=Kein InclusiveNamespaces Element für Exclusive Canonicalization Transform gefunden -2218=Das Signature Environment enthält keine validen XML-Daten -2219=Fehler beim Lesen des Signature Environment -2220=Allgemeiner Fehler beim Erzeugen der Signatur [{0}] -2221=Fehler bei der Behandlung des Schlüssels [{0}] -2222=Fehler beim Erstellen des Manifests [{0}] -2223=Fehler beim Erstellen der Referenz [{0}] -2224=Hashwert nicht verfügbar [{0}] -2225=Signier-Algorithmus wird nicht unterstützt [{0}] -2226=Fehler beim Einbetten der Signatur [{0}] -2227=Fehler beim Berechnen des Signaturwertes [{0}] -2228=Fehler beim Behandeln der SignedProperties [{0}] -2229=Signator-Zertifikat nicht verfügbar [{0}] -2230=Fehler beim Auflösen eines Supplements [{0}] -2231=Die Schlüsselgruppe ist nicht verfügbar -2232=Die Schlüsselgruppe ist leer -2233=Fehler beim Durchführen der Transformation [{0}] -2234=CreateTransformsInfoProfileID nicht vorhanden (ID={0}) -2235=CreateSignatureEnvironment muss entweder Reference oder Content enthalten -2236=CreateSignatureEnvironmentProfileID nicht vorhanden (ID={0}) -2237=Fehler beim Auflösen der internen Referenz (URI={0}) -2238=Fehler beim Auflösen des Transformationsparameters (URI={0}) -2240=Allgemeiner Fehler beim Verifizieren der Signatur [{0}] -2241=Algorithmus wird nicht unterstützt [{0}] -2242=Fehler beim Parsen der CMS Signatur [{0}] -2243=Signator-Zertifikat nicht verfügbar [{0}] -2244=Fehler beim Lesen der Signatur-Daten -2245=Fehler beim Codieren des Signator-Zertifikats -2246=Fehler beim Umwandeln des SubjectDN des Signator-Zertifikats nach RFC2253: {0} -2247=Allgemeiner Fehler beim Verifizieren der Signatur [{0}] -2248=Fehler beim Vorbereiten der Daten [{0}] -2249=Das Attribut Signatories enthält einen ungültigen Index (Index={0}) -2262=Fehler beim Behandeln des Manifests [{0}] -2263=Fehler beim Parsen der Properties [{0}] -2264=Fehler beim Behandeln der Referenz [{0}] -2265=Fehler beim Durchführen der Transformation [{0}] -2266=Signatur ist kein dsig:Signature-Element -2267=SupplementProfileID nicht vorhanden (ID={0}) -2268=VerifyTransformsInfoProfileID nicht vorhanden (ID={0}) -2269=Fehler beim Parsen der Transformation [{0}] -2270=Fehler beim Decodieren des Hash-Wertes -2271=Falsche Anzahl an ReferenceInfo Elementen in SignatureManfestCheckParams -2280=Die Angabe XMLContent wird derzeit nicht unterstützt -2281=XML-Supplement kann nicht serialisiert werden (Reference="{0}") -2282=Datenobjekt mit der URI={0} wurde dem Request nicht bereit gestellt - - -2900=Interner Server-Fehler - -3201=Objekt kann nicht geladen werden (Reference="{0}", LocRef-URI="{1}") -3202=Supplement für Signaturumgebung kann nicht geladen werden (Reference="{0}", LocRef-URI="{1}") -3203=Signaturumgebung kann nicht geladen werden (Reference="{0}", LocRef-URI="{1}") - -9900=Nicht klassifizierter Fehler in Subsystem -9901=Nicht klassifizierter Laufzeitfehler in Subsystem -9999=Nicht klassifizierter Fehler - - -# -# Server internal messages -# - -init.00=Fehler beim Lesen der MOA SP/SS Konfiguration: das Service steht nicht zur Verfügung -init.01=MOA SP/SS Konfiguration erfolgreich geladen -init.02=Fehler beim Löschen der Archivdaten -init.03=Fehler beim Aktivieren des IAIK-JCE/JSSE/JDK1.3 Workaround: SSL ist möglicherweise nicht verfügbar -init.04=Fehler beim Initialisieren des Schema Pools - -config.00=Fehler beim Erstellen des KeyGroupMapping: KeyGroup mit id={0} unbekannt - die Erstellung des KeyGroupMapping wird fortgeführt -config.01=Fehler in der Konfiguration: Wert für maximale Archivierungsdauer von Widerrufsinformationen (ArchiveDuration) nicht konfiguriert oder ungültig -config.02=Fehler in der Konfiguration: {0} mit id={1}: falscher Profiltyp in Datei {2} -config.03=Fehler in der Konfiguration: {0} mit id={1} konnte nicht geladen werden -config.04=Fehler in der Konfiguration: {0} mit id={1} existiert bereits -config.05=Umgebungsvariable {0} nicht gesetzt: benutze Default-Konfiguration -config.06=Die MOA SP/SS Konfiguration wurde erfolgreich aktualisiert. -config.07=Fehler in der Konfiguration: Reason code {0} unbekannt -config.08=Fehler beim Konfigurieren der IAIK-Module -config.09=Fehler beim Öffnen der Schlüssel-Datei {0} -config.10=Fehler beim Einlesen der Konfiguration (siehe Log-Datei für Details) -config.11=Fehler biem Erstellen der Konfiguration (siehe Log-Datei für Details) -config.12=Fehler beim Einlesen des Profils -config.13=Fehler beim Erstellen des CRLDistributionPoint: CAIssuerDN={0} ungültig -config.14=Das Attribut {0} für das TrustProfile mit id={1} ist ungültig (Wert={2}) -config.15=Fehler beim Erstellen des TrustProfile id={0}: Name des Konfigurations-Verzeichnisses konnte nicht in eine URL umgewandet werden -config.16=Fehler beim Erstellen von X509IssuerSerial (IssuerName={0}, SerialNumber={1}) -config.17=DigestAlgorithmName unbekannt (AlgorithmName={0}) -config.18=Lade Keystore: {0} -config.19=Key ID={0} -config.20=Fehler beim Aktualisieren der MOA SP/SS Konfiguration. Die bestehende Konfiguration wird beibehalten -config.21=Lade Konfiguration von {0} -config.22=Lade {0} mit id={1} von Datei {2} -config.23=MOA SP/SS Konfiguration: {0} nicht gesetzt oder ungültiger Wert, verwende den Default-Wert: {1} -config.25=Fehler in der Konfiguration: Das SoftwareKeyModule mit id={0} konnte nicht geladen werden, da die Datei {1} nicht existiert oder ein Verzeichnis bezeichnet -config.26=Fehler beim Erstellen der KeyGroup mit id={0}: KeyModule mit id={1} unbekannt -config.27=Fehler in der Konfiguration: Das Attribut {0} des TrustProfiles mit id={1} zeigt nicht auf ein existierendes Verzeichnis -config.28=Einen detaillierten Fehlerbericht entnehmen Sie bitte der Log-Datei. -config.29=Es sind folgende leichte Fehler aufgetreten: -config.31=Fehler in der Konfiguration der KeyGroup mit id={0}: Der Schlüssel im KeyModule id={1} mit IssuerName={2} und SerialNumber={3} konnte nicht geladen werden -config.32=Fehler in der Konfiguration: Verzeichnisangabe für den Zertifikatsspeicher ist ungültig ({0}). - - -handler.00=Starte neue Transaktion: TID={0}, Service={1} -handler.01=Aufruf von Adresse={0} -handler.02=Client-Zertifikat: Subject={0}, Serial={1}, Issuer={2} -handler.03=Client-Zertifikat nicht verfügbar -handler.04=Anfrage erfolgreich abgearbeitet -handler.05=Fehler beim Abarbeiten der Anfrage -handler.06=SOAP Attachment mit der id={0} für Request hinterlegt (MIME Type des Attachments={1}) -handler.07=SOAP Request empfangen: Request={0} - -invoker.00=Das Signature Environment konnte nicht validierend geparst werden -invoker.01=Keine passende Transformationskette gefunden (Index={0}) -invoker.02=Der Hashwert der Transformation stimmt nicht überein (Index={0}) -invoker.03=Signatorzertifikat aus Trustprofile mit id={0} konnte nicht geparst werden (Dateiname={1}) diff --git a/spss/server/serverlib/src/main/resources/security/cacerts b/spss/server/serverlib/src/main/resources/security/cacerts deleted file mode 100644 index 6eeaba418..000000000 Binary files a/spss/server/serverlib/src/main/resources/security/cacerts and /dev/null differ diff --git a/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.wsdl b/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.wsdl deleted file mode 100644 index c5cd8fc0f..000000000 --- a/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.wsdl +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.xsd b/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.xsd deleted file mode 100644 index 756b51279..000000000 --- a/spss/server/serverlib/src/main/resources/wsdl/MOA-SPSS-1.3.xsd +++ /dev/null @@ -1,469 +0,0 @@ - - - - - - - - - - - - - - - - - - - - Ermöglichung der Stapelsignatur durch wiederholte Angabe dieses Elements - - - - - - - - - - - - - - - - - - - Auswahl: Entweder explizite Angabe des Signaturorts sowie ggf. sinnvoller Supplements im Zshg. mit der Signaturumgebung, oder Verweis auf ein benanntes Profil - - - - - - - - - - - - - - - - - - Kardinalität 1..oo erlaubt die Antwort auf eine Stapelsignatur-Anfrage - - - - Resultat, falls die Signaturerstellung erfolgreich war - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert - - - - - - - - - - - only ds:X509Data and RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any;publicAuthority is included as X509Data/any - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pro dsig:Reference-Element in der zu überprüfenden XML-Signatur muss hier ein ReferenceInfo-Element erscheinen. Die Reihenfolge der einzelnen ReferenceInfo Elemente entspricht jener der dsig:Reference Elemente in der XML-Signatur. - - - - - - - - - - mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert - - - - - - - - - - - only ds:X509Data and ds:RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any; PublicAuthority is included as X509Data/any - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Auswahl: Entweder explizite Angabe EINER Transformationskette inklusive ggf. sinnvoller Supplements oder Verweis auf ein benanntes Profil - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Resultat, falls die Signaturerstellung gescheitert ist - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ein oder mehrere Transformationswege können von der Applikation an MOA mitgeteilt werden. Die zu prüfende Signatur hat zumindest einem dieser Transformationswege zu entsprechen. Die Angabe kann explizit oder als Profilbezeichner erfolgen. - - - - - Profilbezeichner für einen Transformationsweg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Die Angabe des Transformationsparameters (explizit oder als Hashwert) kann unterlassen werden, wenn die Applikation von der Unveränderlichkeit des Inhalts der in "Transformationsparamter", Attribut "URI" angegebenen URI ausgehen kann. - - - - Der Transformationsparameter explizit angegeben. - - - - - Der Hashwert des Transformationsparameters. - - - - - - - - - - - - - - - - - - - - - - Explizite Angabe des Transformationswegs - - - - - - - Alle impliziten Transformationsparameter, die zum Durchlaufen der oben angeführten Transformationskette bekannt sein müssen, müssen hier angeführt werden. Das Attribut "URI" bezeichnet den Transformationsparameter in exakt jener Weise, wie er in der zu überprüfenden Signatur gebraucht wird. - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 1872ac885a2556bce3d96fd325422e050f094a6f Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 22 Aug 2007 14:34:16 +0000 Subject: set right directory position git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@929 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../properties/spss_messages_de.properties | 151 +++++++ .../src/main/resources/resources/security/cacerts | Bin 0 -> 7365 bytes .../resources/resources/wsdl/MOA-SPSS-1.3.wsdl | 105 +++++ .../main/resources/resources/wsdl/MOA-SPSS-1.3.xsd | 469 +++++++++++++++++++++ 4 files changed, 725 insertions(+) create mode 100644 spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties create mode 100644 spss/server/serverlib/src/main/resources/resources/security/cacerts create mode 100644 spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.3.wsdl create mode 100644 spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.3.xsd (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties b/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties new file mode 100644 index 000000000..19a4a89af --- /dev/null +++ b/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties @@ -0,0 +1,151 @@ +# This file contains exception messages in the standard Java properties +# format. The messages may contain formatting patterns as definied in the +# java.text.MessageFormat class. + +# +# Error messages: the key corresponds to the error code +# + +1100=Fehler beim Validieren der Anfrage: {0} +1101=Bei enveloping Datenobjekten muss entweder Content oder Reference übergeben werden +1102=Bei detached Datenobjekten darf das Attribut Reference nicht leer sein +1103=Ungültiger Wert für Attribut Structure im Element DataObjectInfo: {0} +1104=Ungültiger Wert für DateTime: {0} +1105=Ungültiger Wert für Attribut Index in Element CreateSignatureLocation: {0} +1106=Interner Fehler beim Parsen der XML-Daten +1107=Kein Kind-Element im Element XMLContent gefunden +1108=Ungültiger Wert für dsig:Algorithm: {0} +1109=XMLContent darf nur ein Kind-Element enthalten +1110=Entweder Content oder Reference muss gesetzt sein +1111=Reference muss gesetzt sein, wenn kein Content angegeben ist +1112=Bei leerer Reference muss CreateSignatureEnvironment vorhanden sein +1113=Der Endpunkt akzeptiert keine Anfragen vom Typ: {0} + +2200=Fehler beim Erzeugen der Antwort +2201=Transformations-Algorithmus unbekannt: {0} +2202=Kein XPath-Element für XPath-Transformation gefunden +2203=TrustProfileID unbekannt: {0} +2207=Ungültiges URI-Format: {0} +2208=Fehler beim Öffnen des Datenobjekts (URI={0}) +2209=Fehler beim Parsen der XML-Daten +2210=Fehler beim Lesen des Datenobjekts +2211=Referenzierte Daten können nicht als XML interpretiert werden (URI={0}) +2212=Fehler beim Auswerten des XPath-Ausdrucks: {0} +2213=Zugriff auf das Dateisystem verweigert (URI={0}) +2214=Ungültiges URL-Format: {0} +2215=Kein Stylesheet für XSLT-Transformation gefunden +2216=Kein XPath-Filter2 Element für XPath-Filter2-Transform gefunden +2217=Kein InclusiveNamespaces Element für Exclusive Canonicalization Transform gefunden +2218=Das Signature Environment enthält keine validen XML-Daten +2219=Fehler beim Lesen des Signature Environment +2220=Allgemeiner Fehler beim Erzeugen der Signatur [{0}] +2221=Fehler bei der Behandlung des Schlüssels [{0}] +2222=Fehler beim Erstellen des Manifests [{0}] +2223=Fehler beim Erstellen der Referenz [{0}] +2224=Hashwert nicht verfügbar [{0}] +2225=Signier-Algorithmus wird nicht unterstützt [{0}] +2226=Fehler beim Einbetten der Signatur [{0}] +2227=Fehler beim Berechnen des Signaturwertes [{0}] +2228=Fehler beim Behandeln der SignedProperties [{0}] +2229=Signator-Zertifikat nicht verfügbar [{0}] +2230=Fehler beim Auflösen eines Supplements [{0}] +2231=Die Schlüsselgruppe ist nicht verfügbar +2232=Die Schlüsselgruppe ist leer +2233=Fehler beim Durchführen der Transformation [{0}] +2234=CreateTransformsInfoProfileID nicht vorhanden (ID={0}) +2235=CreateSignatureEnvironment muss entweder Reference oder Content enthalten +2236=CreateSignatureEnvironmentProfileID nicht vorhanden (ID={0}) +2237=Fehler beim Auflösen der internen Referenz (URI={0}) +2238=Fehler beim Auflösen des Transformationsparameters (URI={0}) +2240=Allgemeiner Fehler beim Verifizieren der Signatur [{0}] +2241=Algorithmus wird nicht unterstützt [{0}] +2242=Fehler beim Parsen der CMS Signatur [{0}] +2243=Signator-Zertifikat nicht verfügbar [{0}] +2244=Fehler beim Lesen der Signatur-Daten +2245=Fehler beim Codieren des Signator-Zertifikats +2246=Fehler beim Umwandeln des SubjectDN des Signator-Zertifikats nach RFC2253: {0} +2247=Allgemeiner Fehler beim Verifizieren der Signatur [{0}] +2248=Fehler beim Vorbereiten der Daten [{0}] +2249=Das Attribut Signatories enthält einen ungültigen Index (Index={0}) +2262=Fehler beim Behandeln des Manifests [{0}] +2263=Fehler beim Parsen der Properties [{0}] +2264=Fehler beim Behandeln der Referenz [{0}] +2265=Fehler beim Durchführen der Transformation [{0}] +2266=Signatur ist kein dsig:Signature-Element +2267=SupplementProfileID nicht vorhanden (ID={0}) +2268=VerifyTransformsInfoProfileID nicht vorhanden (ID={0}) +2269=Fehler beim Parsen der Transformation [{0}] +2270=Fehler beim Decodieren des Hash-Wertes +2271=Falsche Anzahl an ReferenceInfo Elementen in SignatureManfestCheckParams +2280=Die Angabe XMLContent wird derzeit nicht unterstützt +2281=XML-Supplement kann nicht serialisiert werden (Reference="{0}") +2282=Datenobjekt mit der URI={0} wurde dem Request nicht bereit gestellt + + +2900=Interner Server-Fehler + +3201=Objekt kann nicht geladen werden (Reference="{0}", LocRef-URI="{1}") +3202=Supplement für Signaturumgebung kann nicht geladen werden (Reference="{0}", LocRef-URI="{1}") +3203=Signaturumgebung kann nicht geladen werden (Reference="{0}", LocRef-URI="{1}") + +9900=Nicht klassifizierter Fehler in Subsystem +9901=Nicht klassifizierter Laufzeitfehler in Subsystem +9999=Nicht klassifizierter Fehler + + +# +# Server internal messages +# + +init.00=Fehler beim Lesen der MOA SP/SS Konfiguration: das Service steht nicht zur Verfügung +init.01=MOA SP/SS Konfiguration erfolgreich geladen +init.02=Fehler beim Löschen der Archivdaten +init.03=Fehler beim Aktivieren des IAIK-JCE/JSSE/JDK1.3 Workaround: SSL ist möglicherweise nicht verfügbar +init.04=Fehler beim Initialisieren des Schema Pools + +config.00=Fehler beim Erstellen des KeyGroupMapping: KeyGroup mit id={0} unbekannt - die Erstellung des KeyGroupMapping wird fortgeführt +config.01=Fehler in der Konfiguration: Wert für maximale Archivierungsdauer von Widerrufsinformationen (ArchiveDuration) nicht konfiguriert oder ungültig +config.02=Fehler in der Konfiguration: {0} mit id={1}: falscher Profiltyp in Datei {2} +config.03=Fehler in der Konfiguration: {0} mit id={1} konnte nicht geladen werden +config.04=Fehler in der Konfiguration: {0} mit id={1} existiert bereits +config.05=Umgebungsvariable {0} nicht gesetzt: benutze Default-Konfiguration +config.06=Die MOA SP/SS Konfiguration wurde erfolgreich aktualisiert. +config.07=Fehler in der Konfiguration: Reason code {0} unbekannt +config.08=Fehler beim Konfigurieren der IAIK-Module +config.09=Fehler beim Öffnen der Schlüssel-Datei {0} +config.10=Fehler beim Einlesen der Konfiguration (siehe Log-Datei für Details) +config.11=Fehler biem Erstellen der Konfiguration (siehe Log-Datei für Details) +config.12=Fehler beim Einlesen des Profils +config.13=Fehler beim Erstellen des CRLDistributionPoint: CAIssuerDN={0} ungültig +config.14=Das Attribut {0} für das TrustProfile mit id={1} ist ungültig (Wert={2}) +config.15=Fehler beim Erstellen des TrustProfile id={0}: Name des Konfigurations-Verzeichnisses konnte nicht in eine URL umgewandet werden +config.16=Fehler beim Erstellen von X509IssuerSerial (IssuerName={0}, SerialNumber={1}) +config.17=DigestAlgorithmName unbekannt (AlgorithmName={0}) +config.18=Lade Keystore: {0} +config.19=Key ID={0} +config.20=Fehler beim Aktualisieren der MOA SP/SS Konfiguration. Die bestehende Konfiguration wird beibehalten +config.21=Lade Konfiguration von {0} +config.22=Lade {0} mit id={1} von Datei {2} +config.23=MOA SP/SS Konfiguration: {0} nicht gesetzt oder ungültiger Wert, verwende den Default-Wert: {1} +config.25=Fehler in der Konfiguration: Das SoftwareKeyModule mit id={0} konnte nicht geladen werden, da die Datei {1} nicht existiert oder ein Verzeichnis bezeichnet +config.26=Fehler beim Erstellen der KeyGroup mit id={0}: KeyModule mit id={1} unbekannt +config.27=Fehler in der Konfiguration: Das Attribut {0} des TrustProfiles mit id={1} zeigt nicht auf ein existierendes Verzeichnis +config.28=Einen detaillierten Fehlerbericht entnehmen Sie bitte der Log-Datei. +config.29=Es sind folgende leichte Fehler aufgetreten: +config.31=Fehler in der Konfiguration der KeyGroup mit id={0}: Der Schlüssel im KeyModule id={1} mit IssuerName={2} und SerialNumber={3} konnte nicht geladen werden +config.32=Fehler in der Konfiguration: Verzeichnisangabe für den Zertifikatsspeicher ist ungültig ({0}). + + +handler.00=Starte neue Transaktion: TID={0}, Service={1} +handler.01=Aufruf von Adresse={0} +handler.02=Client-Zertifikat: Subject={0}, Serial={1}, Issuer={2} +handler.03=Client-Zertifikat nicht verfügbar +handler.04=Anfrage erfolgreich abgearbeitet +handler.05=Fehler beim Abarbeiten der Anfrage +handler.06=SOAP Attachment mit der id={0} für Request hinterlegt (MIME Type des Attachments={1}) +handler.07=SOAP Request empfangen: Request={0} + +invoker.00=Das Signature Environment konnte nicht validierend geparst werden +invoker.01=Keine passende Transformationskette gefunden (Index={0}) +invoker.02=Der Hashwert der Transformation stimmt nicht überein (Index={0}) +invoker.03=Signatorzertifikat aus Trustprofile mit id={0} konnte nicht geparst werden (Dateiname={1}) diff --git a/spss/server/serverlib/src/main/resources/resources/security/cacerts b/spss/server/serverlib/src/main/resources/resources/security/cacerts new file mode 100644 index 000000000..6eeaba418 Binary files /dev/null and b/spss/server/serverlib/src/main/resources/resources/security/cacerts differ diff --git a/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.3.wsdl b/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.3.wsdl new file mode 100644 index 000000000..c5cd8fc0f --- /dev/null +++ b/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.3.wsdl @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.3.xsd b/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.3.xsd new file mode 100644 index 000000000..756b51279 --- /dev/null +++ b/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.3.xsd @@ -0,0 +1,469 @@ + + + + + + + + + + + + + + + + + + + + Ermöglichung der Stapelsignatur durch wiederholte Angabe dieses Elements + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe des Signaturorts sowie ggf. sinnvoller Supplements im Zshg. mit der Signaturumgebung, oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + Kardinalität 1..oo erlaubt die Antwort auf eine Stapelsignatur-Anfrage + + + + Resultat, falls die Signaturerstellung erfolgreich war + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any;publicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pro dsig:Reference-Element in der zu überprüfenden XML-Signatur muss hier ein ReferenceInfo-Element erscheinen. Die Reihenfolge der einzelnen ReferenceInfo Elemente entspricht jener der dsig:Reference Elemente in der XML-Signatur. + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and ds:RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any; PublicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe EINER Transformationskette inklusive ggf. sinnvoller Supplements oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Resultat, falls die Signaturerstellung gescheitert ist + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ein oder mehrere Transformationswege können von der Applikation an MOA mitgeteilt werden. Die zu prüfende Signatur hat zumindest einem dieser Transformationswege zu entsprechen. Die Angabe kann explizit oder als Profilbezeichner erfolgen. + + + + + Profilbezeichner für einen Transformationsweg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Die Angabe des Transformationsparameters (explizit oder als Hashwert) kann unterlassen werden, wenn die Applikation von der Unveränderlichkeit des Inhalts der in "Transformationsparamter", Attribut "URI" angegebenen URI ausgehen kann. + + + + Der Transformationsparameter explizit angegeben. + + + + + Der Hashwert des Transformationsparameters. + + + + + + + + + + + + + + + + + + + + + + Explizite Angabe des Transformationswegs + + + + + + + Alle impliziten Transformationsparameter, die zum Durchlaufen der oben angeführten Transformationskette bekannt sein müssen, müssen hier angeführt werden. Das Attribut "URI" bezeichnet den Transformationsparameter in exakt jener Weise, wie er in der zu überprüfenden Signatur gebraucht wird. + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 7537351b14d0738d9e16bef4fad8380c3a0b0f21 Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 22 Aug 2007 18:54:53 +0000 Subject: minor build fixes/improvements git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@934 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index edf27d123..25cb8bade 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -26,10 +26,10 @@ - - - - + + commons-discovery + commons-discovery + commons-logging commons-logging @@ -81,18 +81,22 @@ javax.servlet servlet-api + true xalan xalan + true xerces xercesImpl + true xerces xmlParserAPIs + true iaik.prod @@ -106,21 +110,25 @@ iaik.prod iaik_jce_full compile + true iaik.prod iaik_ecc compile + true iaik.prod iaik_Pkcs11Provider runtime + true iaik.prod iaik_Pkcs11Wrapper runtime + true @@ -155,7 +163,7 @@ post a - Postconfitions: + Postconditions: -- cgit v1.2.3 From fd99a8b31a752135c8e2f16041ba35da70c7b2dc Mon Sep 17 00:00:00 2001 From: mcentner Date: Thu, 23 Aug 2007 08:38:49 +0000 Subject: Updated dependency declarations to omit certain transitive dependencies from being included into war-files. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@936 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 46 ++++++------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 25cb8bade..5264b0a86 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -22,10 +22,6 @@ axis axis - - - - commons-discovery commons-discovery @@ -38,34 +34,6 @@ javax.activation activation - - - - - - - - - - - - - - - - - - - - - - - - - - - - junit junit @@ -81,22 +49,19 @@ javax.servlet servlet-api - true + provided xalan xalan - true xerces xercesImpl - true xerces xmlParserAPIs - true iaik.prod @@ -110,25 +75,26 @@ iaik.prod iaik_jce_full compile - true iaik.prod iaik_ecc compile - true + + + iaik.prod + iaik_cms + runtime iaik.prod iaik_Pkcs11Provider runtime - true iaik.prod iaik_Pkcs11Wrapper runtime - true -- cgit v1.2.3 From b091c998ee43384feddbbfe868953a3bb9f5dbf8 Mon Sep 17 00:00:00 2001 From: mcentner Date: Fri, 24 Aug 2007 13:20:32 +0000 Subject: Added missing dependency to spss/server/serverlib project. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@957 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 5264b0a86..d9812f70d 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -34,6 +34,10 @@ javax.activation activation + + javax.mail + mail + junit junit -- cgit v1.2.3 From c6811385cd22e50ebce90900c23dcab79286bdf3 Mon Sep 17 00:00:00 2001 From: mcentner Date: Mon, 27 Aug 2007 13:10:08 +0000 Subject: Added a new assembly for the moa-spss library edition distribution. Fixed issue with the inclusion of the pcks11Wrapper.dll in assemblies. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@964 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index d9812f70d..620d3ebd4 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -100,13 +100,14 @@ iaik_Pkcs11Wrapper runtime - - - - - - - + + iaik.prod + iaik_Pkcs11Wrapper + win32 + dll + runtime + true + MOA moa-common -- cgit v1.2.3 From ef5f57de87191f8296359c4141d562453d15ca20 Mon Sep 17 00:00:00 2001 From: mcentner Date: Tue, 28 Aug 2007 07:35:22 +0000 Subject: The xalan.jar of the official xalan distribution and the one in the central repository differ. So, we are going to include the official one in our own distribution to prevent from problems with different versions in the endorsed directory of the servlet container or jre. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@966 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 620d3ebd4..1a169b357 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -56,8 +56,9 @@ provided - xalan + xalan-bin-dist xalan + compile xerces -- cgit v1.2.3 From 6be52df44678056f95d36f08361b94e2befeb044 Mon Sep 17 00:00:00 2001 From: mcentner Date: Tue, 28 Aug 2007 11:53:33 +0000 Subject: Xalan artifact serializer.jar added. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@968 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 1a169b357..c71b4708d 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -65,8 +65,12 @@ xercesImpl - xerces - xmlParserAPIs + xalan-bin-dist + xml-apis + + + xalan-bin-dist + serializer iaik.prod -- cgit v1.2.3 From 29866bdc9e8b2cab619cd151f32b036c35debbfe Mon Sep 17 00:00:00 2001 From: pdanner Date: Tue, 4 Sep 2007 09:02:22 +0000 Subject: removed maven project output from jars git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@979 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index c71b4708d..ae9c88171 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -119,7 +119,16 @@ - + + + org.apache.maven.plugins + maven-jar-plugin + + + false + + + org.apache.maven.plugins maven-javadoc-plugin @@ -183,15 +192,15 @@ http://java.sun.com/j2se/1.4/docs/api/ - - - generate-javadoc - package - - jar - - - + + + generate-javadoc + package + + jar + + + -- cgit v1.2.3 From 74a6925a47adaac292b3e2da326b08adc0239235 Mon Sep 17 00:00:00 2001 From: pdanner Date: Tue, 4 Sep 2007 13:55:12 +0000 Subject: version change to 1.4.1 git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@985 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index ae9c88171..49bc37ceb 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -1,21 +1,21 @@ - MOA.spss - moa-spss - 1.4.0 + MOA.spss + moa-spss + 1.4.1 4.0.0 MOA.spss.server moa-spss-lib jar - 1.4.0 + 1.4.1 MOA SP/SS API - - ${basedir}/../../../repository - + + ${basedir}/../../../repository + -- cgit v1.2.3 From 4e12d1df5daab1f7600fa3a58e6fc535375224ff Mon Sep 17 00:00:00 2001 From: pdanner Date: Mon, 10 Sep 2007 15:16:34 +0000 Subject: moved test classes, cashing of resolved entities git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1002 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 4 +- .../moa/spss/server/invoke/DataObjectFactory.java | 119 +++++-- .../spss/server/invoke/ExternalURIResolver.java | 15 - .../invoke/XMLSignatureVerificationInvoker.java | 6 +- .../moa/spss/server/service/AxisHandler.java | 43 ++- .../server/service/SignatureCreationService.java | 13 +- .../server/transaction/TransactionContext.java | 131 +++++-- .../test/at/gv/egovernment/moa/spss/AllTests.java | 40 --- .../at/gv/egovernment/moa/spss/SPSSTestCase.java | 82 ----- .../egovernment/moa/spss/api/xmlbind/AllTests.java | 24 -- .../CreateXMLSignatureRequestParserTest.java | 71 ---- .../moa/spss/api/xmlbind/TransformParserTest.java | 113 ------ .../VerifyCMSSignatureRequestParserTest.java | 61 ---- .../VerifyXMLSignatureRequestParserTest.java | 81 ----- .../moa/spss/server/config/AllTests.java | 20 -- .../server/config/ConfigurationProviderTest1.java | 377 --------------------- .../server/config/ConfigurationProviderTest2.java | 225 ------------ .../server/config/ConfigurationProviderTest3.java | 166 --------- .../iaik/config/ConfigurationDataImplTest.java | 149 -------- .../server/iaik/config/IaikConfiguratorTest.java | 36 -- .../moa/spss/server/invoke/AllTests.java | 25 -- .../CMSSignatureVerificationInvokerTest.java | 63 ---- .../spss/server/invoke/DataObjectFactoryTest.java | 180 ---------- .../server/invoke/TransformationFactoryTest.java | 201 ----------- .../invoke/XMLSignatureCreationInvokerTest.java | 63 ---- .../XMLSignatureVerificationInvokerTest.java | 61 ---- .../moa/spss/server/tools/CertToolTest.java | 50 --- .../java/at/gv/egovernment/moa/spss/AllTests.java | 40 +++ .../at/gv/egovernment/moa/spss/SPSSTestCase.java | 82 +++++ .../egovernment/moa/spss/api/xmlbind/AllTests.java | 24 ++ .../CreateXMLSignatureRequestParserTest.java | 71 ++++ .../moa/spss/api/xmlbind/TransformParserTest.java | 113 ++++++ .../VerifyCMSSignatureRequestParserTest.java | 61 ++++ .../VerifyXMLSignatureRequestParserTest.java | 81 +++++ .../moa/spss/server/config/AllTests.java | 20 ++ .../server/config/ConfigurationProviderTest1.java | 377 +++++++++++++++++++++ .../server/config/ConfigurationProviderTest2.java | 225 ++++++++++++ .../server/config/ConfigurationProviderTest3.java | 166 +++++++++ .../iaik/config/ConfigurationDataImplTest.java | 149 ++++++++ .../server/iaik/config/IaikConfiguratorTest.java | 36 ++ .../moa/spss/server/invoke/AllTests.java | 25 ++ .../CMSSignatureVerificationInvokerTest.java | 63 ++++ .../spss/server/invoke/DataObjectFactoryTest.java | 180 ++++++++++ .../server/invoke/TransformationFactoryTest.java | 201 +++++++++++ .../invoke/XMLSignatureCreationInvokerTest.java | 63 ++++ .../XMLSignatureVerificationInvokerTest.java | 61 ++++ .../moa/spss/server/tools/CertToolTest.java | 50 +++ 47 files changed, 2333 insertions(+), 2174 deletions(-) delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/AllTests.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/SPSSTestCase.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java delete mode 100644 spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/AllTests.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/SPSSTestCase.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/AllTests.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/AllTests.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java create mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 49bc37ceb..c49a234a1 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -3,14 +3,14 @@ MOA.spss moa-spss - 1.4.1 + 1.4.x 4.0.0 MOA.spss.server moa-spss-lib jar - 1.4.1 + 1.4.2 MOA SP/SS API diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java index 1386d5c2d..ad0da28f4 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -1,5 +1,10 @@ package at.gv.egovernment.moa.spss.server.invoke; +import iaik.ixsil.util.URI; +import iaik.ixsil.util.XPointerReferenceResolver; +import iaik.server.modules.xml.DataObject; +import iaik.server.modules.xml.XMLDataObject; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -7,6 +12,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Vector; import javax.xml.parsers.ParserConfigurationException; @@ -14,25 +20,11 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; - import org.xml.sax.EntityResolver; import org.xml.sax.SAXException; -import iaik.ixsil.util.URI; -import iaik.ixsil.util.XPointerReferenceResolver; -import iaik.server.modules.xml.DataObject; -import iaik.server.modules.xml.XMLDataObject; - import at.gv.egovernment.moa.logging.LogMsg; import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.util.Constants; -import at.gv.egovernment.moa.util.DOMUtils; -import at.gv.egovernment.moa.util.EntityResolverChain; -import at.gv.egovernment.moa.util.MOAEntityResolver; -import at.gv.egovernment.moa.util.MOAErrorHandler; -import at.gv.egovernment.moa.util.StreamEntityResolver; -import at.gv.egovernment.moa.util.StreamUtils; - import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.MOASystemException; import at.gv.egovernment.moa.spss.api.common.Content; @@ -48,7 +40,16 @@ import at.gv.egovernment.moa.spss.server.iaik.xml.ByteStreamDataObjectImpl; import at.gv.egovernment.moa.spss.server.iaik.xml.DataObjectImpl; import at.gv.egovernment.moa.spss.server.iaik.xml.XMLDataObjectImpl; import at.gv.egovernment.moa.spss.server.iaik.xml.XMLNodeListDataObjectImpl; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; import at.gv.egovernment.moa.spss.util.MessageProvider; +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.EntityResolverChain; +import at.gv.egovernment.moa.util.MOAEntityResolver; +import at.gv.egovernment.moa.util.MOAErrorHandler; +import at.gv.egovernment.moa.util.StreamEntityResolver; +import at.gv.egovernment.moa.util.StreamUtils; /** * A class to create DataObjects contained in different @@ -132,12 +133,16 @@ public class DataObjectFactory { } case Content.LOCREF_CONTENT: { - ExternalURIResolver uriResolver = new ExternalURIResolver(); String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); InputStream is = null; try { - is = uriResolver.resolve(locRefURI); + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); + is = context.ResolveURI(locRefURI); + if (is == null) { + ExternalURIResolver uriResolver = new ExternalURIResolver(); + is = uriResolver.resolve(locRefURI); + } contentBytes = StreamUtils.readStream(is); } catch (MOAApplicationException e) @@ -299,25 +304,39 @@ public class DataObjectFactory { } case Content.LOCREF_CONTENT: { - ExternalURIResolver uriResolver = new ExternalURIResolver(); - String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); InputStream contentIS = null; - InputStream uriStream = null; - try - { - uriStream = uriResolver.resolve(locRefURI); - byte[] contentBytes = StreamUtils.readStream(uriStream); - contentIS = new ByteArrayInputStream(contentBytes); - } - catch (Exception e) - { - throw new MOAApplicationException("3202", new Object[]{reference, locRefURI}, e); - } - finally - { - closeInputStream(uriStream); - } - entities.put(reference, contentIS); + String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); + + + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); + Vector entity = context.FindResolvedEntity(locRefURI); + if (entity!=null) { + contentIS = (InputStream) entity.get(0); + } else { + + ExternalURIResolver uriResolver = new ExternalURIResolver(); + + InputStream uriStream = null; + byte[] contentBytes; + String contentType = null; + try + { + uriStream = uriResolver.resolve(locRefURI); + contentBytes = StreamUtils.readStream(uriStream); + contentIS = new ByteArrayInputStream(contentBytes); + contentType = uriResolver.getContentType(); + } + catch (Exception e) + { + throw new MOAApplicationException("3202", new Object[]{reference, locRefURI}, e); + } + finally + { + closeInputStream(uriStream); + } + entities.put(locRefURI, contentIS); + context.PutResolvedEntity(locRefURI, contentBytes, contentType); + } break; } case Content.XML_CONTENT : @@ -648,9 +667,23 @@ public class DataObjectFactory { private DataObjectImpl createFromURIImpl(String uri, boolean asXml) throws MOASystemException, MOAApplicationException { + Logger.trace(">>> resolving uri \"" + uri + "\""); + ExternalURIResolver resolver = new ExternalURIResolver(); - InputStream is = resolver.resolve(uri); - String contentType = resolver.getContentType(); + + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); + InputStream is = context.ResolveURI(uri); + String contentType = null; + boolean foundURI = false; + if (is == null) { + is = resolver.resolve(uri); + contentType = resolver.getContentType(); + } else { + foundURI = true; + contentType = (String) context.FindResolvedEntity(uri).get(1); + Logger.trace("found \"" + uri + "\" InputStream in preread Supplements!, do not read any more. Content=" + contentType); + } + DataObjectImpl dataObject; // read the content @@ -684,6 +717,7 @@ public class DataObjectFactory { dataObject = new XMLDataObjectImpl(doc.getDocumentElement()); } catch (Exception e) { // this is the last chance: return the data as a byte stream + Logger.trace(">>> reading stream for \"" + uri + "\""); is = resolver.resolve(uri); ByteArrayInputStream bis; try @@ -699,9 +733,11 @@ public class DataObjectFactory { { closeInputStream(is); } + Logger.trace(">>> read stream for \"" + uri + "\""); } } } + else if (asXml) { // if we need XML data, we're in the wrong place here @@ -711,10 +747,13 @@ public class DataObjectFactory { else { // content is binary: make it available as a binary input stream + Logger.trace(">>> getting binary input for \"" + uri + "\""); + byte[] contentBytes; ByteArrayInputStream bis; try { - bis = new ByteArrayInputStream(StreamUtils.readStream(is)); + contentBytes = StreamUtils.readStream(is); + bis = new ByteArrayInputStream(contentBytes); } catch (IOException e) { @@ -724,12 +763,18 @@ public class DataObjectFactory { { closeInputStream(is); } + if (!foundURI) { + context.PutResolvedEntity(uri, contentBytes, contentType); + } dataObject = new ByteStreamDataObjectImpl(bis); + Logger.trace("<<< got binary input for \"" + uri + "\""); } dataObject.setMimeType(contentType); dataObject.setURI(uri); + Logger.trace("<<< resolved uri \"" + uri + "\""); + return dataObject; } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java index 106742067..cbd88f7f3 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java @@ -61,7 +61,6 @@ public class ExternalURIResolver { //no transaction throw new MOAApplicationException("2282", new Object[] { uri }); } else { - InputStream attachmentIs = context.getAttachmentInputStream(uri); if (attachmentIs != null) { setContentType(context.getAttachmentContentType(uri.getPath())); @@ -70,20 +69,6 @@ public class ExternalURIResolver { //maybe attachments provided but no suiting attachment found throw new MOAApplicationException("2282", new Object[] { uri }); } -/* - try { - InputStream attachmentIs = context.getAttachment(uri).getInputStream(); - if (attachmentIs != null) { - setContentType(context.getAttachmentContentType(uri.getPath())); - return attachmentIs; - } else { - //maybe attachments provided but no suiting attachment found - throw new MOAApplicationException("2282", new Object[] { uri }); - } - } catch (IOException e) { - throw new MOAApplicationException("2208", new Object[] { uri }, e); - } -*/ } } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java index 4642593eb..3dd7ecf11 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java @@ -89,10 +89,8 @@ public class XMLSignatureVerificationInvoker { FILTERED_REF_TYPES = new HashSet(); FILTERED_REF_TYPES.add(DsigManifest.XML_DSIG_MANIFEST_TYPE); FILTERED_REF_TYPES.add(SecurityLayerManifest.SECURITY_LAYER_MANIFEST_TYPE); - FILTERED_REF_TYPES.add( - SecurityLayerManifest.SECURITY_LAYER_MANIFEST_TYPE_OLD); - FILTERED_REF_TYPES.add( - XMLConstants.NAMESPACE_ETSI_STRING + "SignedProperties"); + FILTERED_REF_TYPES.add(SecurityLayerManifest.SECURITY_LAYER_MANIFEST_TYPE_OLD); + FILTERED_REF_TYPES.add(XMLConstants.NAMESPACE_ETSI_STRING + "SignedProperties"); } /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java index befbd58dd..f5f77ff50 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -27,6 +27,7 @@ import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.logging.LoggingContext; import at.gv.egovernment.moa.logging.LoggingContextManager; import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.api.common.Content; import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; @@ -94,6 +95,7 @@ public class AxisHandler extends BasicHandler { */ private void handleRequest(MessageContext msgContext) throws AxisFault { try { + Logger.trace("---- Entering Axishandler"); // generate a unique transaction id and build the TransactionContext // for this request HttpServletRequest request = @@ -143,7 +145,9 @@ public class AxisHandler extends BasicHandler { } context.setRequestName(soapAction); + Logger.trace(">>> Get AttachmentCount"); int attachmentCount = soapMessage.getAttachmentsImpl().getAttachmentCount(); + Logger.trace("<<< Finished Get AttachmentCount"); if (attachmentCount>0) { // add SOAP attachments to transaction context @@ -156,12 +160,23 @@ public class AxisHandler extends BasicHandler { //Now get the InputStream (note: we could also get the content with Object content = attachment.getContent();) InputStream is = null; javax.activation.DataHandler datahandler = attachment.getDataHandler(); - org.apache.axis.attachments.ManagedMemoryDataSource mmds = (org.apache.axis.attachments.ManagedMemoryDataSource)datahandler.getDataSource(); - if (mmds!=null){ - is = mmds.getInputStream(); + + int TYPE = 2; + switch (TYPE) { + case 1: + { + org.apache.axis.attachments.ManagedMemoryDataSource mmds = (org.apache.axis.attachments.ManagedMemoryDataSource)datahandler.getDataSource(); + context.addAttachment(id, type, mmds); + break; + } + case 2: + { + is = datahandler.getDataSource().getInputStream(); + context.addAttachment(id, type, is, datahandler.getDataSource().getName()); + break; + } } debug("handler.06", new Object[] {id, type}); - context.addAttachment(id, type, mmds); } } @@ -202,6 +217,7 @@ public class AxisHandler extends BasicHandler { fault.setFaultDetail(new Element[] { e.toErrorResponse()}); throw fault; } + Logger.trace("---- Leaving Axishandler"); } /** @@ -379,4 +395,21 @@ public class AxisHandler extends BasicHandler { Logger.debug(new LogMsg(msg.getMessage(messageId, parameters))); } -} + + +// private byte[] toByteArray(AttachmentPart attachment) throws SOAPException, IOException +// { +// ByteArrayOutputStream outputStream = new ByteArrayOutputStream(attachment.getSize()); +// InputStream inputStream = (InputStream) attachment.getContent(); +// int currentByte = -1; +// while ((currentByte = inputStream.read()) != -1) +// outputStream.write(currentByte); +// +// inputStream.close(); +// outputStream.close(); +// +// return outputStream.toByteArray(); +// +//} + +} \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java index 2d548ea3a..c173625f8 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java @@ -40,6 +40,7 @@ public class SignatureCreationService { */ public Element[] CreateXMLSignatureRequest(Element[] request) throws AxisFault { + Logger.trace("---- Entering SignatureCreationService"); XMLSignatureCreationInvoker invoker = XMLSignatureCreationInvoker.getInstance(); Element[] response = new Element[1]; @@ -72,17 +73,23 @@ public class SignatureCreationService { reparsedReq = ServiceUtils.reparseRequest(context.getRequest()); // convert to API objects + Logger.trace(">>> preparsing Request"); requestObj = requestParser.parse(reparsedReq); - + Logger.trace("<<< preparsed Request"); + + Logger.trace(">>> creating Signature"); // invoke the core logic - responseObj = - invoker.createXMLSignature(requestObj, Collections.EMPTY_SET); + responseObj = invoker.createXMLSignature(requestObj, Collections.EMPTY_SET); + Logger.trace("<<< created Signature"); + Logger.trace(">>> building Response"); // map back to XML response[0] = responseBuilder.build(responseObj).getDocumentElement(); + Logger.trace("<<< built Response"); // save response in transaction context.setResponse(response[0]); + Logger.trace("---- Leaving SignatureCreationService"); } catch (MOAException e) { AxisFault fault = AxisFault.makeFault(e); diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java index 774880d26..5c1e35a95 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java @@ -2,6 +2,7 @@ package at.gv.egovernment.moa.spss.server.transaction; import iaik.ixsil.util.URI; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -14,6 +15,7 @@ import java.util.Map.Entry; import org.apache.axis.attachments.ManagedMemoryDataSource; import org.w3c.dom.Element; +import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; @@ -37,9 +39,11 @@ public class TransactionContext { private Element response; /** The map pointing to SOAP attachments needed by the request. */ private HashMap attachments = null; + /** The map containing cashed entities used in DataObjectFactory. */ + private HashMap resolvedEntities = null; /** The configuration to use throughout the request. */ private ConfigurationProvider configuration = null; - + /** * Create a TransactionContext object. * @@ -169,6 +173,23 @@ public class TransactionContext { this.attachments.put(referenceId, entry); } + /** + * Adds an attachment to the transactions list of SOAP attachments. + * + * @param referenceId Identification value for the SOAP attachment. + * @param contentType MIME type of the SOAP attachment. + * @param is Handle to the InputStream of the SOAP attachment. + * @param filename Filename of the temporary file the InputStream belongs to + */ + public void addAttachment(String referenceId, String contentType, InputStream is, String filename) { + if (this.attachments == null) this.attachments = new HashMap(); + Vector entry = new Vector(3); + entry.add(contentType); + entry.add(is); + entry.add(filename); + this.attachments.put(referenceId, entry); + } + /** * Returns the ManagedMemoryDataSource to a specific SOAP attachment identified by referenceId. * @@ -182,10 +203,14 @@ public class TransactionContext { if (entry==null) { return null; } - //return (InputStream) ( ((ManagedMemoryDataSource)entry.get(1)).getInputStream()); - return (ManagedMemoryDataSource) entry.get(1); + Object object = entry.get(1); + if (object instanceof ManagedMemoryDataSource) { + return (ManagedMemoryDataSource) object; + } else { + return null; + } } - + /** * Returns the InputStream to a specific SOAP attachment identified by uri. * @@ -202,12 +227,17 @@ public class TransactionContext { } InputStream attachmentIs = null; - try { - attachmentIs = (InputStream) ( ((ManagedMemoryDataSource)entry.get(1)).getInputStream()); - } catch (IOException e) { - throw new MOAApplicationException("2208", new Object[] { uri }, e); + Object object = entry.get(1); + + if (object instanceof ManagedMemoryDataSource) { + try { + attachmentIs = (InputStream) ( ((ManagedMemoryDataSource)object).getInputStream()); + } catch (IOException e) { + throw new MOAApplicationException("2208", new Object[] { uri }, e); + } + } else { + attachmentIs = (InputStream) object; } - return attachmentIs; //If we would return the whole mmds: return (ManagedMemoryDataSource) entry.get(1); } @@ -236,17 +266,32 @@ public void cleanAttachmentCache() { while (iterator.hasNext()) { Entry hmEntry = (Entry) iterator.next(); Vector entry = (Vector)hmEntry.getValue(); - ManagedMemoryDataSource mmds = (ManagedMemoryDataSource)entry.get(1); - try { - if (mmds!=null) { - InputStream is = mmds.getInputStream(); - if (is!=null) is.close(); - File f = mmds.getDiskCacheFile(); - if (f!=null) f.delete(); - mmds.delete(); - } - } catch (IOException e) { - // ok to do nothing here + Object object = entry.get(1); + if (object instanceof ManagedMemoryDataSource) { + ManagedMemoryDataSource mmds = (ManagedMemoryDataSource)object; + try { + if (mmds!=null) { + InputStream is = mmds.getInputStream(); + if (is!=null) is.close(); + File f = mmds.getDiskCacheFile(); + if (f!=null) f.delete(); + mmds.delete(); + } + } catch (IOException e) { + // ok to do nothing here + } + } else if (object instanceof InputStream) { + InputStream is = (InputStream)object; + try { + if (is!=null) is.close(); + String tempFile = (String) entry.get(2); + if (tempFile!=null){ + File f = new File(tempFile); + f.delete(); + } + } catch (IOException e) { + // ok to do nothing here + } } } } @@ -261,4 +306,50 @@ public void cleanAttachmentCache() { return configuration; } + /** + * Search an uri content in cashed map. + * + * @param uri The value to look for. + * @return If found the cached entity, null otherwise. + */ + public Vector FindResolvedEntity(String uri) { + if (resolvedEntities==null) return null; + return (Vector) resolvedEntities.get(uri); + } + + /** + * Get a new InputStream of a cached entity. + * + * @param uri The value to look for. + * @return A new InputStream of the cached entity. + */ + public InputStream ResolveURI(String uri) { + InputStream is = null; + Vector entity = FindResolvedEntity(uri); + if (entity!=null) { + byte[] contentBytes = (byte[]) entity.get(0); + if (contentBytes!=null) { + is = new ByteArrayInputStream(contentBytes); + } + } + return is; + } + + /** + * Put a read entity (supplement, detached content, data object) on + * transactions entity cash, to prevent repeated reading on slower channels. + * + * @param uri A transaction-wide unique URI used as key of the entity cash + * table. + * @param contentBytes The cached content belonging to the uri. + * @param contentType If known, the MIME-type of the cashed content. + */ + public void PutResolvedEntity(String uri, byte[] contentBytes, String contentType) { + Logger.trace(" storing uri content of uri \"" + uri + "\" for future references"); + if (resolvedEntities==null) resolvedEntities = new HashMap(); + Vector entity = new Vector(); + entity.add(contentBytes); + entity.add(contentType); + resolvedEntities.put(uri, entity); + } } diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/AllTests.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/AllTests.java deleted file mode 100644 index c670b5e55..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/AllTests.java +++ /dev/null @@ -1,40 +0,0 @@ -package test.at.gv.egovernment.moa.spss; - -import test.at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImplTest; -import test.at.gv.egovernment.moa.spss.server.iaik.config.IaikConfiguratorTest; -import test.at.gv.egovernment.moa.spss.server.tools.CertToolTest; - -import junit.awtui.TestRunner; -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Test suite for all unit tests. - * - * @author Patrick Peck - * @version $Id$ - */ -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(test.at.gv.egovernment.moa.spss.server.config.AllTests.class); - suite.addTestSuite(ConfigurationDataImplTest.class); - suite.addTestSuite(IaikConfiguratorTest.class); - suite.addTest( - test.at.gv.egovernment.moa.spss.server.invoke.AllTests.suite()); - suite.addTest(test.at.gv.egovernment.moa.spss.api.xmlbind.AllTests.suite()); - suite.addTestSuite(CertToolTest.class); - - return suite; - } - - public static void main(String[] args) { - try { - TestRunner.run(AllTests.class); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/SPSSTestCase.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/SPSSTestCase.java deleted file mode 100644 index a585e30a0..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/SPSSTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -package test.at.gv.egovernment.moa.spss; - -import java.security.Security; - -import test.at.gv.egovernment.moa.MOATestCase; - -import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.logging.LoggingContext; -import at.gv.egovernment.moa.logging.LoggingContextManager; -import at.gv.egovernment.moa.util.MessageProvider; - -import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; -import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; - -/** - * Base class for MOA test cases. - * - * Provides some utility functions. - * - * @author Patrick Peck - * @version $Id$ - */ -public class SPSSTestCase extends MOATestCase { - - protected static final String TESTDATA_ROOT = "data/test/"; - - /** - * Constructor for MOATestCase. - * @param arg0 - */ - public SPSSTestCase(String name) { - super(name); - } - - /** - * Set up a transaction context with a test configuration. - */ - protected void setUpTransactionContext() throws Exception { - System.setProperty( - ConfigurationProvider.CONFIG_PROPERTY_NAME, - "data/test/conf/moa-spss/MOA-SPSSConfiguration.xml"); - ConfigurationProvider config = ConfigurationProvider.getInstance(); - TransactionContext context = new TransactionContext("test", null, config); - TransactionContextManager.getInstance().setTransactionContext(context); - } - - protected void setUpLoggingContext() throws Exception { - LoggingContext context = new LoggingContext("test"); - LoggingContextManager.getInstance().setLoggingContext(context); - } - - /** - * Configure the IAIK modules with the current configuration. - * - * A TransactionContext must have been set up before. - */ - protected void setUpIaikConfiguration() throws Exception { - TransactionContext context = - TransactionContextManager.getInstance().getTransactionContext(); - ClassLoader cl = getClass().getClassLoader(); - MessageProvider msg = MessageProvider.getInstance(); - - try { - cl.loadClass("javax.security.cert.Certificate"); // from jcert.jar - } catch (ClassNotFoundException e) { - Logger.warn(msg.getMessage("init.03", null), e); - } - - new IaikConfigurator().configure(context.getConfiguration()); - } - - protected void setUpSSL() throws Exception { - //System.setProperty("javax.net.debug", "all"); - Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - System.setProperty( - "java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java deleted file mode 100644 index 28f79729e..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java +++ /dev/null @@ -1,24 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Runs all tests in this package. - * - * @author Patrick Peck - * @version $Id$ - */ -public class AllTests { - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(CreateXMLSignatureRequestParserTest.class); - suite.addTestSuite(TransformParserTest.class); - suite.addTestSuite(VerifyCMSSignatureRequestParserTest.class); - suite.addTestSuite(VerifyXMLSignatureRequestParserTest.class); - - return suite; - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java deleted file mode 100644 index 7ce705b01..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileExplicit; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo; -import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; - -/** - * Test the CreateXMLSignatureRequestParser. - * - * @author Patrick Peck - * @version $Id$ - */ -public class CreateXMLSignatureRequestParserTest extends SPSSTestCase { - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/CreateXMLSignature/"; - - private CreateXMLSignatureRequestParser requestParser; - - public CreateXMLSignatureRequestParserTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - requestParser = new CreateXMLSignatureRequestParser(); - } - - public void testParse() throws Exception { - Element requestElem = - parseXml(TESTDATA_BASE + "TestGeneratorCX2.001.Req.xml") - .getDocumentElement(); - CreateXMLSignatureRequest request = requestParser.parse(requestElem); - SingleSignatureInfo sigInfo; - DataObjectInfo dataObjInfo; - CreateTransformsInfoProfileExplicit transProfile; - CreateSignatureEnvironmentProfileExplicit envProfile; - - assertNotNull(request); - assertEquals("PKCS12RSAKey1", request.getKeyIdentifier()); - assertEquals(1, request.getSingleSignatureInfos().size()); - - sigInfo = (SingleSignatureInfo) request.getSingleSignatureInfos().get(0); - assertEquals(1, sigInfo.getDataObjectInfos().size()); - assertFalse(sigInfo.isSecurityLayerConform()); - - dataObjInfo = (DataObjectInfo) sigInfo.getDataObjectInfos().get(0); - assertNotNull(dataObjInfo.getDataObject()); - - transProfile = - (CreateTransformsInfoProfileExplicit) dataObjInfo - .getCreateTransformsInfoProfile(); - assertNotNull( - transProfile.getCreateTransformsInfo().getFinalDataMetaInfo()); - - envProfile = - (CreateSignatureEnvironmentProfileExplicit) sigInfo - .getCreateSignatureInfo() - .getCreateSignatureEnvironmentProfile(); - assertEquals( - "//data:Document", - envProfile.getCreateSignatureLocation().getXPathExpression()); - assertEquals(0, envProfile.getCreateSignatureLocation().getIndex()); - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java deleted file mode 100644 index f580f86bc..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import java.util.List; - -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform; -import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform; -import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform; -import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform; -import at.gv.egovernment.moa.spss.api.common.XPathTransform; -import at.gv.egovernment.moa.spss.api.common.XSLTTransform; -import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; - -/** - * Test the TransformParser. - * - * @author Patrick Peck - * @version $Id$ - */ -public class TransformParserTest extends SPSSTestCase { - private static String TESTDATA_BASE = TESTDATA_ROOT + "xml/dsigTransform/"; - - private TransformParser transformParser; - - public TransformParserTest(String name) { - super(name); - } - - protected void setUp() { - transformParser = new TransformParser(); - } - - public void testParseTransforms() throws Exception { - Element transformsElem = - parseXml(TESTDATA_BASE + "transforms.xml").getDocumentElement(); - List transforms = transformParser.parseTransforms(transformsElem); - - assertNotNull(transforms); - assertEquals(3, transforms.size()); - - } - - public void testParseCanonicalizationTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "canonicalization.xml").getDocumentElement(); - CanonicalizationTransform transform = - (CanonicalizationTransform) transformParser.parseTransform(transformElem); - - assertNotNull(transform); - assertEquals( - CanonicalizationTransform.CANONICAL_XML, - transform.getAlgorithmURI()); - } - - public void testParseExclCanonicalizationTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "exclusiveCanonicalization.xml") - .getDocumentElement(); - ExclusiveCanonicalizationTransform transform = - (ExclusiveCanonicalizationTransform) transformParser.parseTransform( - transformElem); - - assertNotNull(transform); - assertEquals( - ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML, - transform.getAlgorithmURI()); - assertEquals(3, transform.getInclusiveNamespacePrefixes().size()); - } - - public void testParseEnvelopedTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "enveloped.xml").getDocumentElement(); - EnvelopedSignatureTransform transform = - (EnvelopedSignatureTransform) transformParser.parseTransform( - transformElem); - - assertNotNull(transform); - } - - public void testParseXPathTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "xpath.xml").getDocumentElement(); - XPathTransform transform = - (XPathTransform) transformParser.parseTransform(transformElem); - - assertNotNull(transform); - assertEquals("//ToBeSigned/Data", transform.getXPathExpression()); - assertEquals(1, transform.getNamespaceDeclarations().size()); - } - - public void testParseXPathFilter2Transform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "xpath2.xml").getDocumentElement(); - XPathFilter2Transform transform = - (XPathFilter2Transform) transformParser.parseTransform(transformElem); - - assertNotNull(transform); - assertEquals(3, transform.getFilters().size()); - } - - public void testParseXSLTTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "xslt.xml").getDocumentElement(); - XSLTTransform transform = - (XSLTTransform) transformParser.parseTransform(transformElem); - - assertNotNull(transform); - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java deleted file mode 100644 index 4be7667eb..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.util.DateTimeUtils; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentExcplicit; -import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; -import at.gv.egovernment.moa.spss.api.common.MetaInfo; -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; - -/** - * Test the VerifyCMSSignatureRequestParserTest. - * - * @author Patrick Peck - * @version $Id$ - */ -public class VerifyCMSSignatureRequestParserTest extends SPSSTestCase { - private static String TESTDATA_BASE = - TESTDATA_ROOT + "xml/VerifyCMSSignature/"; - - private VerifyCMSSignatureRequestParser requestParser; - - public VerifyCMSSignatureRequestParserTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - requestParser = new VerifyCMSSignatureRequestParser(); - } - - public void testParse() throws Exception { - Element requestElem = - parseXml(TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml") - .getDocumentElement(); - VerifyCMSSignatureRequest request = requestParser.parse(requestElem); - MetaInfo metaInfo; - CMSContentExcplicit content; - - assertNotNull(request); - assertEquals(1, request.getSignatories()[0]); - assertEquals( - DateTimeUtils.parseDateTime("2003-04-04T09:30:47-05:00"), - request.getDateTime()); - assertNotNull(request.getCMSSignature()); - assertNotNull(request.getDataObject()); - assertEquals("TrustProfile1", request.getTrustProfileId()); - - metaInfo = request.getDataObject().getMetaInfo(); - assertNotNull(metaInfo); - assertEquals("text/plain", metaInfo.getMimeType()); - assertEquals("http://10.16.46.109/TestDatenGenerator/resources/testDaten.txt", metaInfo.getDescription()); - - content = (CMSContentExcplicit) request.getDataObject().getContent(); - assertNotNull(content.getBinaryContent()); - - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java deleted file mode 100644 index 3b8e8b00e..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.util.DateTimeUtils; - -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; -import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; -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.VerifyTransformsInfoProfileExplicit; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; - -/** - * Test the VerifyXMLSignatureRequestParserTest. - * - * @author Patrick Peck - * @version $Id$ - */ -public class VerifyXMLSignatureRequestParserTest extends SPSSTestCase { - private static String TESTDATA_BASE = - TESTDATA_ROOT + "xml/VerifyXMLSignature/"; - - private VerifyXMLSignatureRequestParser parser; - - public VerifyXMLSignatureRequestParserTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - parser = new VerifyXMLSignatureRequestParser(); - } - - public void testParse() throws Exception { - Element requestElem = - parseXml(TESTDATA_BASE + "TestGeneratorVX.201.Req.xml") - .getDocumentElement(); - VerifyXMLSignatureRequest request = parser.parse(requestElem); - VerifySignatureInfo verifySignatureInfo; - VerifySignatureLocation verifyLocation; - SignatureManifestCheckParams checkParams; - ReferenceInfo refInfo; - VerifyTransformsInfoProfileExplicit transformsProfile; - - assertNotNull(request); - assertEquals( - DateTimeUtils.parseDateTime("2003-04-01T12:53:57+01:00"), - request.getDateTime()); - assertFalse(request.getReturnHashInputData()); - assertEquals("TrustProfile1", request.getTrustProfileId()); - - verifySignatureInfo = request.getSignatureInfo(); - assertNotNull(verifySignatureInfo); - assertNotNull(verifySignatureInfo.getVerifySignatureEnvironment()); - - verifyLocation = verifySignatureInfo.getVerifySignatureLocation(); - assertNotNull(verifyLocation); - assertEquals("//dsig:Signature", verifyLocation.getXPathExpression()); - assertEquals(3, verifyLocation.getNamespaceDeclarations().size()); - - checkParams = request.getSignatureManifestCheckParams(); - assertNotNull(checkParams); - assertEquals(true, checkParams.getReturnReferenceInputData()); - assertEquals(1, checkParams.getReferenceInfos().size()); - - refInfo = (ReferenceInfo) checkParams.getReferenceInfos().get(0); - assertEquals(1, refInfo.getVerifyTransformsInfoProfiles().size()); - - transformsProfile = - (VerifyTransformsInfoProfileExplicit) refInfo - .getVerifyTransformsInfoProfiles() - .get(0); - assertEquals(1, transformsProfile.getTransforms().size()); - assertEquals(1, transformsProfile.getTransformParameters().size()); - - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java deleted file mode 100644 index 131f38c19..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java +++ /dev/null @@ -1,20 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.config; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author Gregor Karlinger - * @version $Id$ - */ -public class AllTests -{ - public static Test suite() - { - TestSuite suite = new TestSuite(); - suite.addTestSuite(ConfigurationProviderTest1.class); - suite.addTestSuite(ConfigurationProviderTest2.class); - suite.addTestSuite(ConfigurationProviderTest3.class); - return suite; - } -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java deleted file mode 100644 index 474a387ad..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java +++ /dev/null @@ -1,377 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.config; - -import iaik.asn1.structures.Name; -import iaik.pki.pathvalidation.ChainingModes; -import iaik.utils.RFC2253NameParser; -import iaik.utils.RFC2253NameParserException; -import iaik.x509.X509Certificate; - -import java.math.BigInteger; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import junit.framework.TestCase; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.spss.MOAException; -import at.gv.egovernment.moa.spss.server.config.CRLDistributionPoint; -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.config.HardwareCryptoModule; -import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule; -import at.gv.egovernment.moa.spss.server.config.KeyGroup; -import at.gv.egovernment.moa.spss.server.config.KeyGroupEntry; -import at.gv.egovernment.moa.spss.server.config.OCSPDistributionPoint; -import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule; -import at.gv.egovernment.moa.spss.server.config.TrustProfile; -import at.gv.egovernment.moa.util.Constants; - -/** - * @author Gregor Karlinger - * @version $Id$ - */ -public class ConfigurationProviderTest1 extends TestCase -{ - private static final String CONFIG_BASE_ = - "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; - - static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; - - static - { - System.setProperty( - "log4j.configuration", - "file:/" + CONFIG_BASE_ + "log4j.properties"); - System.setProperty( - at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, - CONFIG_BASE_ + "moa.spss.complete-config.xml"); - try - { - ConfigurationProvider.reload(); - provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); - } - catch (ConfigurationException e) - { - throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); - } - } - - /** - * Constructor for ConfigurationProvider. - * @param arg0 - */ - public ConfigurationProviderTest1() throws MOAException - { - super("ConfigurationProvider"); - } - - public void testGetWarnings() - { - assertEquals(0, provider_.getWarnings().size()); - } - - public void testGetDigestMethodAlgorithmName() - { - assertEquals( - Constants.SHA1_URI, - provider_.getDigestMethodAlgorithmName()); - } - - public void testGetCanonicalizationAlgorithmName() - { - assertEquals( - Constants.C14N_WITH_COMMENTS_URI, - provider_.getCanonicalizationAlgorithmName()); - } - - public void testGetHardwareCryptoModules() - { - List hwcms = provider_.getHardwareCryptoModules(); - assertEquals(2, hwcms.size()); - - HardwareCryptoModule hwc1 = (HardwareCryptoModule) hwcms.get(0); - assertEquals("HWC1_Name", hwc1.getName()); - assertEquals("HWC1_SlotId", hwc1.getSlotID()); - assertEquals("HWC1_UserPIN", hwc1.getUserPIN()); - - HardwareCryptoModule hwc2 = (HardwareCryptoModule) hwcms.get(1); - assertEquals("HWC2_Name", hwc2.getName()); - assertNull(hwc2.getSlotID()); - assertEquals("HWC2_UserPIN", hwc2.getUserPIN()); - } - - public void testGetHardwareKeyModules() - { - List hwkms = provider_.getHardwareKeyModules(); - assertEquals(2, hwkms.size()); - - HardwareKeyModule hwk1 = (HardwareKeyModule) hwkms.get(0); - assertEquals("HWK1_Id", hwk1.getId()); - assertEquals("HWK1_Name", hwk1.getName()); - assertEquals("HWK1_SlotId", hwk1.getSlotID()); - assertEquals("HWK1_UserPIN", hwk1.getUserPIN()); - - HardwareKeyModule hwk2 = (HardwareKeyModule) hwkms.get(1); - assertEquals("HWK2_Id", hwk2.getId()); - assertEquals("HWK2_Name", hwk2.getName()); - assertNull(hwk2.getSlotID()); - assertEquals("HWK2_UserPIN", hwk2.getUserPIN()); - } - - public void testGetSoftwareKeyModules() - { - List swkms = provider_.getSoftwareKeyModules(); - assertEquals(2, swkms.size()); - - SoftwareKeyModule swk1 = (SoftwareKeyModule) swkms.get(0); - assertEquals("SWK1_Id", swk1.getId()); - assertEquals(CONFIG_BASE_ + "swk/SWK1_FileName.txt", swk1.getFileName().replace('\\', '/')); - assertEquals("SWK1_Password", swk1.getPassWord()); - - SoftwareKeyModule swk2 = (SoftwareKeyModule) swkms.get(1); - assertEquals("SWK2_Id", swk2.getId()); - assertEquals(CONFIG_BASE_ + "swk/SWK2_FileName.txt", swk2.getFileName().replace('\\', '/')); - assertNull(swk2.getPassWord()); - } - - public void testGetKeyGroups() - { - Map keyGroups = provider_.getKeyGroups(); - assertEquals(2, keyGroups.size()); - - KeyGroup kg1 = (KeyGroup) keyGroups.get("KG1_Id"); - assertNotNull(kg1); - assertEquals("KG1_Id", kg1.getId()); - - Set kg1Entries = kg1.getKeyGroupEntries(); - assertEquals(2, kg1Entries.size()); - - Iterator kg1EntriesIt = kg1Entries.iterator(); - while(kg1EntriesIt.hasNext()) - { - KeyGroupEntry currentEntry = (KeyGroupEntry)kg1EntriesIt.next(); - if ("HWK1_Id".equals(currentEntry.getModuleID())) - { - assertEquals("CN=HWK1_Issuer", currentEntry.getIssuerDN()); - assertEquals(0, currentEntry.getSerialNumber().intValue()); - } - else if ("HWK2_Id".equals(currentEntry.getModuleID())) - { - assertEquals("CN=HWK2_Issuer", currentEntry.getIssuerDN()); - assertEquals(1, currentEntry.getSerialNumber().intValue()); - } - else fail("Invalid module identifer found."); - } - - KeyGroup kg2 = (KeyGroup) keyGroups.get("KG2_Id"); - assertNotNull(kg2); - assertEquals("KG2_Id", kg2.getId()); - - Set kg2Entries = kg2.getKeyGroupEntries(); - assertEquals(2, kg2Entries.size()); - - Iterator kg2EntriesIt = kg1Entries.iterator(); - while(kg1EntriesIt.hasNext()) - { - KeyGroupEntry currentEntry = (KeyGroupEntry)kg2EntriesIt.next(); - if ("SWK1_Id".equals(currentEntry.getModuleID())) - { - assertEquals("CN=CN=SWK1_Issuer", currentEntry.getIssuerDN()); - assertEquals(2, currentEntry.getSerialNumber().intValue()); - } - else if ("SWK2_Id".equals(currentEntry.getModuleID())) - { - assertEquals("CN=SWK2_Issuer", currentEntry.getIssuerDN()); - assertEquals(3, currentEntry.getSerialNumber().intValue()); - } - else fail("Invalid module identifer found."); - } - } - - public void testGetKeyGroupEntries() throws RFC2253NameParserException - { - RFC2253NameParser parser = new RFC2253NameParser("CN=Customer1_Issuer"); - Name name = parser.parse(); - Set kgEntries = provider_.getKeyGroupEntries(name, BigInteger.valueOf(4), "KG1_Id"); - assertEquals(2, kgEntries.size()); - - Iterator kgEntriesIt = kgEntries.iterator(); - while (kgEntriesIt.hasNext()) - { - KeyGroupEntry currentEntry = (KeyGroupEntry) kgEntriesIt.next(); - if (!"HWK1_Id".equals(currentEntry.getModuleID()) && !"HWK2_Id".equals(currentEntry.getModuleID())) - { - fail("Invalid module identifier found."); - } - } - } - - public void testGetChainingMode() throws RFC2253NameParserException - { - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); - Name name = parser.parse(); - cert.setIssuerDN(name); - cert.setSerialNumber(BigInteger.valueOf(0)); - assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); // Default chaining mode - - parser = new RFC2253NameParser("CN=TA1_Issuer"); - name = parser.parse(); - cert.setIssuerDN(name); - cert.setSerialNumber(BigInteger.valueOf(5)); - assertEquals(ChainingModes.CHAIN_MODE, provider_.getChainingMode(cert)); - } - - public void testGetDistributionPoints() throws RFC2253NameParserException - { - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); - Name name = parser.parse(); - cert.setIssuerDN(name); - - Set dps = provider_.getDistributionPoints(cert); - assertEquals(2, dps.size()); - - Iterator dpIt = dps.iterator(); - while (dpIt.hasNext()) - { - CRLDistributionPoint currentDP = (CRLDistributionPoint)dpIt.next(); - if ("http://crl.myca.org".equals(currentDP.getUri())) - { - int reasonCodes = - iaik.asn1.structures.DistributionPoint.unused | - iaik.asn1.structures.DistributionPoint.keyCompromise | - iaik.asn1.structures.DistributionPoint.cACompromise | - iaik.asn1.structures.DistributionPoint.affiliationChanged | - iaik.asn1.structures.DistributionPoint.superseded | - iaik.asn1.structures.DistributionPoint.cessationOfOperation | - iaik.asn1.structures.DistributionPoint.certificateHold | - iaik.asn1.structures.DistributionPoint.privilegeWithdrawn | - iaik.asn1.structures.DistributionPoint.aACompromise; - assertEquals(reasonCodes, currentDP.getReasonCodes()); - } - else if ("http://crl.myotherca.org".equals(currentDP.getUri())) - { - int reasonCodes = - iaik.asn1.structures.DistributionPoint.aACompromise | - iaik.asn1.structures.DistributionPoint.affiliationChanged; - assertEquals(reasonCodes, currentDP.getReasonCodes()); - } - else fail("Invalid CRL DP URI found: " + currentDP.getUri()); - } - - parser = new RFC2253NameParser("CN=DP2_Issuer"); - name = parser.parse(); - cert.setIssuerDN(name); - - dps = provider_.getDistributionPoints(cert); - assertEquals(1, dps.size()); - - OCSPDistributionPoint dpo = (OCSPDistributionPoint) dps.toArray()[0]; - assertEquals("http://crl.yetanotherca.org", dpo.getUri()); - } - - public void testGetCRLArchiveDuration() - { - assertEquals(730, provider_.getCRLArchiveDuration()); - } - - public void testGetEnableRevocationArchiving() - { - assertFalse(provider_.getEnableRevocationArchiving()); - } - - public void testGetCertStoreLocation() - { - assertEquals( - CONFIG_BASE_ + "certstore_test", - provider_.getCertStoreLocation().replace('\\', '/')); - } - - public void testGetCreateTransformsInfoProfile() - { - Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); - assertEquals("CreateTransformsInfoProfile", ctip1.getLocalName()); - - Element ctip2 = provider_.getCreateTransformsInfoProfile("CTIP_2"); - assertEquals("CreateTransformsInfoProfile", ctip2.getLocalName()); - } - - public void testGetCreateSignatureEnvironmentProfile() - { - Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); - assertEquals("CreateSignatureEnvironmentProfile", csep.getLocalName()); - } - - public void testGetVerifyTransformsInfoProfile() - { - Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); - assertEquals("VerifyTransformsInfoProfile", vtip.getLocalName()); - } - - public void testGetSupplementProfile() - { - Element sp = provider_.getSupplementProfile("SP_1"); - assertEquals("SupplementProfile", sp.getLocalName()); - } - - public void testGetTrustProfile() - { - TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); - assertEquals( - "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/anchors", - tp1.getUri()); - assertEquals( - "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/signercerts", - tp1.getSignerCertsUri()); - - TrustProfile tp2 = provider_.getTrustProfile("TP2_Id"); - assertEquals( - "file:" + CONFIG_BASE_ + "trustprofiles/tp2/anchors", - tp2.getUri()); - assertEquals( - "file:" + CONFIG_BASE_ + "trustprofiles/tp2/signercerts", - tp2.getSignerCertsUri()); - } - - public void testGetRevocationArchiveJDBCURL() - { - assertEquals("jdbc://dummy", provider_.getRevocationArchiveJDBCURL()); - } - - public void testGetRevocationArchiveJDBCDriverClass() - { - assertEquals("fully.qualified.classname", provider_.getRevocationArchiveJDBCDriverClass()); - } - - public void testGetEnableRevocationChecking() - { - assertFalse(provider_.getEnableRevocationChecking()); - } - - public void testGetMaxRevocationAge() - { - assertEquals(10000, provider_.getMaxRevocationAge()); - } - - public void testGetServiceOrder() - { - String[] serviceOrder = provider_.getServiceOrder(); - assertEquals(2, serviceOrder.length); - assertEquals("crl", serviceOrder[0]); - assertEquals("ocsp", serviceOrder[1]); - } - - public void testGetAutoAddCertificates() - { - assertFalse(provider_.getAutoAddCertificates()); - } - - public void testGetUseAuthorityInfoAccess() - { - assertFalse(provider_.getUseAuthorityInfoAccess()); - } -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java deleted file mode 100644 index adf02809b..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java +++ /dev/null @@ -1,225 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.config; - -import iaik.asn1.structures.Name; -import iaik.pki.pathvalidation.ChainingModes; -import iaik.utils.RFC2253NameParser; -import iaik.utils.RFC2253NameParserException; -import iaik.x509.X509Certificate; - -import java.math.BigInteger; -import java.util.List; -import java.util.Set; - -import junit.framework.TestCase; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.spss.MOAException; -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.config.TrustProfile; -import at.gv.egovernment.moa.util.Constants; - -/** - * @author Gregor Karlinger - * @version $Id$ - */ -public class ConfigurationProviderTest2 extends TestCase -{ - private static final String CONFIG_BASE_ = - "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; - - static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; - - static - { - System.setProperty( - "log4j.configuration", - "file:/" + CONFIG_BASE_ + "log4j.properties"); - System.setProperty( - at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, - CONFIG_BASE_ + "moa.ss.noopts-config.xml"); - try - { - ConfigurationProvider.reload(); - provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); - } - catch (ConfigurationException e) - { - throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); - } - } - - - /** - * Constructor for ConfigurationProvider. - * @param arg0 - */ - public ConfigurationProviderTest2() throws MOAException - { - super("ConfigurationProvider"); - } - - public void testGetWarnings() - { - // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found - assertEquals(3, provider_.getWarnings().size()); - } - - public void testGetDigestMethodAlgorithmName() - { - // Element is missing in config file, check if default value is returned - assertEquals( - Constants.SHA1_URI, - provider_.getDigestMethodAlgorithmName()); - } - - public void testGetCanonicalizationAlgorithmName() - { - // Element is missing in config file, check if default value is returned - assertEquals( - Constants.C14N_URI, - provider_.getCanonicalizationAlgorithmName()); - } - - public void testGetHardwareCryptoModules() - { - // No hardware crypto modules in config file, check for empty list - List hwcms = provider_.getHardwareCryptoModules(); - assertEquals(0, hwcms.size()); - } - - public void testGetHardwareKeyModules() - { - List hwkms = provider_.getHardwareKeyModules(); - assertEquals(1, hwkms.size()); - } - - public void testGetSoftwareKeyModules() - { - // No software key modules in config file, check for empty list - List swkms = provider_.getSoftwareKeyModules(); - assertEquals(0, swkms.size()); - } - - public void testGetChainingMode() throws RFC2253NameParserException - { - // Default Chaining Mode not set in configuration, check for default value - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); - Name name = parser.parse(); - cert.setIssuerDN(name); - cert.setSerialNumber(BigInteger.valueOf(0)); - assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); - } - - public void testGetDistributionPoints() throws RFC2253NameParserException - { - // Element is missing in config file, check if emty list is returned - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); - Name name = parser.parse(); - cert.setIssuerDN(name); - - Set dps = provider_.getDistributionPoints(cert); - assertEquals(0, dps.size()); - } - - public void testGetCRLArchiveDuration() - { - // Element is missing in config file, check if default value is returned - assertEquals(0, provider_.getCRLArchiveDuration()); - } - - public void testGetEnableRevocationArchiving() - { - // Element is missing in config file, check if default value is returned - assertFalse(provider_.getEnableRevocationArchiving()); - } - - public void testGetCertStoreLocation() - { - // Element is missing in config file, check if default value is returned - assertEquals( - CONFIG_BASE_ + "certstore", - provider_.getCertStoreLocation().replace('\\', '/')); - } - - public void testGetCreateTransformsInfoProfile() - { - // No profile in config file, check for null - Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); - assertNull(ctip1); - } - - public void testGetCreateSignatureEnvironmentProfile() - { - // No profile in config file, check for null - Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); - assertNull(csep); - } - - public void testGetVerifyTransformsInfoProfile() - { - // No profile in config file, check for null - Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); - assertNull(vtip); - } - - public void testGetSupplementProfile() - { - // No profile in config file, check for null - Element sp = provider_.getSupplementProfile("SP_1"); - assertNull(sp); - } - - public void testGetTrustProfile() - { - // No trust profiles config file, check for null - TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); - assertNull(tp1); - } - - public void testGetRevocationArchiveJDBCURL() - { - // Element is missing in config file, check for null - assertNull(provider_.getRevocationArchiveJDBCURL()); - } - - public void testGetRevocationArchiveJDBCDriverClass() - { - // Element is missing in config file, check for null - assertNull(provider_.getRevocationArchiveJDBCDriverClass()); - } - - public void testGetEnableRevocationChecking() - { - // Element is missing in config file, check for default value - assertFalse(provider_.getEnableRevocationChecking()); - } - - public void testGetMaxRevocationAge() - { - // Element is missing in config file, check for default value - assertEquals(0, provider_.getMaxRevocationAge()); - } - - public void testGetServiceOrder() - { - // Element is missing in config file, check for empty array - String[] serviceOrder = provider_.getServiceOrder(); - assertEquals(0, serviceOrder.length); - } - - public void testGetAutoAddCertificates() - { - // Element is missing in config file, check for default value - assertFalse(provider_.getAutoAddCertificates()); - } - - public void testGetUseAuthorityInfoAccess() - { - // Element is missing in config file, check for default value - assertFalse(provider_.getUseAuthorityInfoAccess()); - } -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java deleted file mode 100644 index 7da2165cb..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java +++ /dev/null @@ -1,166 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.config; - -import iaik.asn1.structures.Name; -import iaik.utils.RFC2253NameParser; -import iaik.utils.RFC2253NameParserException; -import iaik.x509.X509Certificate; - -import java.util.List; -import java.util.Set; - -import junit.framework.TestCase; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.spss.MOAException; -import at.gv.egovernment.moa.spss.server.config.ConfigurationException; -import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; -import at.gv.egovernment.moa.util.Constants; - -/** - * @author Gregor Karlinger - * @version $Id$ - */ -public class ConfigurationProviderTest3 extends TestCase -{ - private static final String CONFIG_BASE_ = - "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; - - static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; - - static - { - System.setProperty( - "log4j.configuration", - "file:/" + CONFIG_BASE_ + "log4j.properties"); - System.setProperty( - at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, - CONFIG_BASE_ + "moa.sp.noopts-config.xml"); - try - { - ConfigurationProvider.reload(); - provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); - } - catch (ConfigurationException e) - { - throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); - } - } - - /** - * Constructor for ConfigurationProvider. - * @param arg0 - */ - public ConfigurationProviderTest3() throws MOAException - { - super("ConfigurationProvider"); - } - - public void testGetWarnings() - { - // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found - assertEquals(3, provider_.getWarnings().size()); - } - - public void testGetDigestMethodAlgorithmName() - { - // Element is missing in config file, check if default value is returned - assertEquals( - Constants.SHA1_URI, - provider_.getDigestMethodAlgorithmName()); - } - - public void testGetCanonicalizationAlgorithmName() - { - // Element is missing in config file, check if default value is returned - assertEquals( - Constants.C14N_URI, - provider_.getCanonicalizationAlgorithmName()); - } - - public void testGetHardwareCryptoModules() - { - // No hardware crypto modules in config file, check for empty list - List hwcms = provider_.getHardwareCryptoModules(); - assertEquals(0, hwcms.size()); - } - - public void testGetHardwareKeyModules() - { - // No hardware key modules in config file, check for empty list - List hwkms = provider_.getHardwareKeyModules(); - assertEquals(0, hwkms.size()); - } - - public void testGetSoftwareKeyModules() - { - // No software key modules in config file, check for empty list - List swkms = provider_.getSoftwareKeyModules(); - assertEquals(0, swkms.size()); - } - - public void testGetDistributionPoints() throws RFC2253NameParserException - { - // No distribution points in config file, check for emtpy set - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); - Name name = parser.parse(); - cert.setIssuerDN(name); - - Set dps = provider_.getDistributionPoints(cert); - assertEquals(0, dps.size()); - } - - public void testGetCRLArchiveDuration() - { - // No archive duration in config file, check for default value - assertEquals(0, provider_.getCRLArchiveDuration()); - } - - public void testGetCreateTransformsInfoProfile() - { - // No profile in config file, check for null - Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); - assertNull(ctip1); - } - - public void testGetCreateSignatureEnvironmentProfile() - { - // No profile in config file, check for null - Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); - assertNull(csep); - } - - public void testGetVerifyTransformsInfoProfile() - { - // No profile in config file, check for null - Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); - assertNull(vtip); - } - - public void testGetSupplementProfile() - { - // No profile in config file, check for null - Element sp = provider_.getSupplementProfile("SP_1"); - assertNull(sp); - } - - public void testGetRevocationArchiveJDBCURL() - { - // No archive in config file, check for null - assertNull(provider_.getRevocationArchiveJDBCURL()); - } - - public void testGetRevocationArchiveJDBCDriverClass() - { - // No archive in config file, check for null - assertNull(provider_.getRevocationArchiveJDBCDriverClass()); - } - - public void testGetServiceOrder() - { - // Element is missing in config file, check for empty array - String[] serviceOrder = provider_.getServiceOrder(); - assertEquals(0, serviceOrder.length); - } -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java deleted file mode 100644 index be1090e4a..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java +++ /dev/null @@ -1,149 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.iaik.config; - -import java.io.FileInputStream; -import java.security.KeyStore; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import iaik.asn1.structures.DistributionPoint; -import iaik.pki.PKIConfiguration; -import iaik.pki.pathvalidation.ChainingModes; -import iaik.pki.pathvalidation.ValidationConfiguration; -import iaik.pki.revocation.CRLDistributionPoint; -import iaik.pki.revocation.RevocationConfiguration; -import iaik.pki.store.certstore.CertStoreConfiguration; -import iaik.pki.store.certstore.CertStoreTypes; -import iaik.pki.store.revocation.archive.ArchiveConfiguration; -import iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter; -import iaik.server.ConfigurationData; -import iaik.server.modules.keys.HardwareKeyModuleConfiguration; -import iaik.server.modules.keys.SoftwareKeyModuleConfiguration; - -import at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImpl; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; - -/** - * Tests the ConfigurationDataImpl. - * - * @author Patrick Peck - * @version $Id$ - */ -public class ConfigurationDataImplTest extends SPSSTestCase { - - private ConfigurationData config; - private X509Certificate iaikCert; - - public ConfigurationDataImplTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - TransactionContext context; - - setUpTransactionContext(); - context = TransactionContextManager.getInstance().getTransactionContext(); - - config = new ConfigurationDataImpl(context.getConfiguration()); - - KeyStore ks = KeyStore.getInstance("JKS", "SUN"); - ks.load( - new FileInputStream(TESTDATA_ROOT + "security/server.keystore"), - "changeit".toCharArray()); - - CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); - Collection certs = - certFactory.generateCertificates( - new FileInputStream( - TESTDATA_ROOT - + "conf/moa-spss/trustprofiles/TrustProfile1/IAIKRoot.cer")); - iaikCert = (X509Certificate) certs.toArray()[0]; - - } - - public void testGetPKIConfiguration() { - PKIConfiguration pkiConfig = config.getPKIConfiguration(); - ArchiveConfiguration archiveConfig = pkiConfig.getArchiveConfiguration(); - CertStoreConfiguration certStoreConfig = - pkiConfig.getCertStoreConfiguration(); - RevocationConfiguration revocationConfig = - pkiConfig.getRevocationConfiguration(); - ValidationConfiguration validationConfig = - pkiConfig.getValidationConfiguration(); - DataBaseArchiveParameter archiveParam; - Set distributionPoints; - Iterator iter; - boolean found; - - // test archive parameters - archiveParam = - (DataBaseArchiveParameter) archiveConfig.getArchiveParameters(); - assertEquals( - archiveParam.getJDBCUrl(), - "jdbc:postgresql://10.16.46.108/moa?user=moa&password=moatest"); - - // test cert store configuration - assertEquals(1, certStoreConfig.getParameters().length); - assertEquals( - CertStoreTypes.DIRECTORY, - certStoreConfig.getParameters()[0].getType()); - - // test revocation configuration - distributionPoints = - revocationConfig.getAlternativeDistributionPoints(iaikCert, null, new Date()); - assertEquals(3, distributionPoints.size()); - found = false; - for (iter = distributionPoints.iterator(); iter.hasNext();) { - CRLDistributionPoint dp = (CRLDistributionPoint) iter.next(); - if (dp.getUri().equals("http://www.iaik.at/testCA/iaik_test_sig.crl")) { - found = - dp.getReasonCodes() - == (DistributionPoint.keyCompromise - | DistributionPoint.affiliationChanged); - } - } - assertTrue(found); - - // test validation configuration - assertEquals( - ChainingModes.PKIX_MODE, - validationConfig.getChainingMode(iaikCert)); - } - - /* - public void testGetCryptoModuleConfigurations() { - List cryptoConfigs = config.getCryptoModuleConfigurations(); - HardwareCryptoModuleConfiguration moduleConfig; - - assertEquals(2, cryptoConfigs.size()); - moduleConfig = (HardwareCryptoModuleConfiguration) cryptoConfigs.get(0); - assertEquals("Module1", moduleConfig.getModuleName()); - assertEquals("Slot1", moduleConfig.getSlotID()); - assertEquals("PIN1", new String(moduleConfig.getUserPIN())); - } - */ - - public void testGetKeyModuleConfigurations() { - List keyConfigs = config.getKeyModuleConfigurations(); - HardwareKeyModuleConfiguration hwKey; - SoftwareKeyModuleConfiguration swKey; - - assertEquals(7, keyConfigs.size()); - hwKey = (HardwareKeyModuleConfiguration) keyConfigs.get(0); - assertEquals("cryptoki.dll", hwKey.getModuleName()); - assertEquals("0", hwKey.getSlotID()); - assertEquals("0000", new String(hwKey.getUserPIN())); - swKey = (SoftwareKeyModuleConfiguration) keyConfigs.get(1); - assertEquals( - "buergerkarte", - new String(swKey.getKeyStoreAuthenticationData())); - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java deleted file mode 100644 index 3b403dc19..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.iaik.config; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; - -/** - * Tests the IaikConfigurator. - * - * @author Patrick Peck - * @version $Id$ - */ -public class IaikConfiguratorTest extends SPSSTestCase { - - public IaikConfiguratorTest(String name) { - super(name); - } - - /** - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUpTransactionContext(); - } - - public void testConfigure() throws Exception { - IaikConfigurator configurator = new IaikConfigurator(); - TransactionContext context = - TransactionContextManager.getInstance().getTransactionContext(); - - configurator.configure(context.getConfiguration()); - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java deleted file mode 100644 index 65fa2bf72..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java +++ /dev/null @@ -1,25 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Runs all tests in this package. - * - * @author Patrick Peck - * @version $Id$ - */ -public class AllTests { - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(DataObjectFactoryTest.class); - suite.addTestSuite(TransformationFactoryTest.class); - suite.addTestSuite(XMLSignatureCreationInvokerTest.class); - suite.addTestSuite(CMSSignatureVerificationInvokerTest.class); - suite.addTestSuite(XMLSignatureVerificationInvokerTest.class); - - return suite; - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java deleted file mode 100644 index 3024730f4..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.util.DOMUtils; - -import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; -import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureResponseBuilder; -import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; - -/** - * Mainly a smoke test for debugging the CMSSignatureVerificationInvoker. - * - * @author Patrick Peck - * @version $Id$ - */ -public class CMSSignatureVerificationInvokerTest extends SPSSTestCase { - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/VerifyCMSSignature/"; - - /** - * Constructor for CMSSignatureVerificationInvokerTest. - * @param name - */ - public CMSSignatureVerificationInvokerTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - setUpTransactionContext(); - setUpLoggingContext(); - setUpIaikConfiguration(); - } - - public void testVerifyCMSSignature() throws Exception { - try { - CMSSignatureVerificationInvoker invoker = - CMSSignatureVerificationInvoker.getInstance(); - VerifyCMSSignatureRequestParser requestParser = - new VerifyCMSSignatureRequestParser(); - Document doc = - SPSSTestCase.parseXmlValidating( - TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml"); - VerifyCMSSignatureRequest request = - requestParser.parse(doc.getDocumentElement()); - VerifyCMSSignatureResponse response = invoker.verifyCMSSignature(request); - VerifyCMSSignatureResponseBuilder responseBuilder = - new VerifyCMSSignatureResponseBuilder(); - Element result = responseBuilder.build(response).getDocumentElement(); - - System.out.println(DOMUtils.serializeNode(result)); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java deleted file mode 100644 index 7de2add33..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java +++ /dev/null @@ -1,180 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import java.io.InputStream; -import java.security.Security; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import iaik.server.modules.xml.BinaryDataObject; -import iaik.server.modules.xml.DataObject; -import iaik.server.modules.xml.XMLDataObject; - -import at.gv.egovernment.moa.util.Base64Utils; - -import at.gv.egovernment.moa.spss.MOAException; -import at.gv.egovernment.moa.spss.api.SPSSFactory; -import at.gv.egovernment.moa.spss.api.common.Content; -import at.gv.egovernment.moa.spss.server.iaik.xml.ByteArrayDataObjectImpl; -import at.gv.egovernment.moa.spss.server.iaik.xml.ByteStreamDataObjectImpl; -import at.gv.egovernment.moa.spss.server.iaik.xml.XMLDataObjectImpl; -import at.gv.egovernment.moa.spss.server.iaik.xml.XMLNodeListDataObjectImpl; -import at.gv.egovernment.moa.spss.server.invoke.DataObjectFactory; - -/** - * Test cases for the DataObjectFactory class. - * - * @author Patrick Peck - * @version $Id$ - */ -public class DataObjectFactoryTest extends SPSSTestCase { - - private static final String HTTP_BINARY_CONTENT_URL = "http://www.google.com"; - private static final String HTTP_XML_CONTENT_URL = - "http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"; - private static final String HTTPS_BINARY_CONTENT_URL = - "https://businessnet.ba-ca.com"; - private static final String HTTPS_UNTRUSTED_URL = - "https://heribert.anecon.com"; - private static final String HTTP_UNKNOWN_HOST_URL = "http://uurjmjmruuw.com"; - private static final String MALFORMED_URL = "//hsld///ddd"; - private static final String FILE_BINARY_CONTENT_URL = "file:/C:/boot.ini"; - private static final String XML_CONTENT = - "" - + " " - + " " - + ""; - private static final String BASE64_CONTENT = "U3Zlbg=="; - - private SPSSFactory spssFactory = SPSSFactory.getInstance(); - private DataObjectFactory factory; - - /** - * Constructor for DataObjectFactoryTest. - * @param name - */ - public DataObjectFactoryTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - factory = DataObjectFactory.getInstance(); - - // set up SSL - Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - System.setProperty( - "java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); - /* - System.setProperty( - "javax.net.ssl.keyStore", - "data/test/security/client.keystore"); - System.setProperty("javax.net.ssl.keyStorePassword", "changeit"); - System.setProperty( - "javax.net.ssl.trustStore", - "data/test/security/client.keystore"); - System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); - */ - } - - public void testCreateFromURIWithBinaryHttp() throws Exception { - DataObject dataObject = - factory.createFromURI(HTTP_BINARY_CONTENT_URL, false); - - assertNotNull(dataObject); - assertTrue(dataObject instanceof ByteStreamDataObjectImpl); - assertNotNull(((BinaryDataObject) dataObject).getInputStream()); - } - - public void testCreateFromURIWithXmlHttp() throws Exception { - DataObject dataObject = factory.createFromURI(HTTP_XML_CONTENT_URL, false); - Element element; - - assertNotNull(dataObject); - assertTrue(dataObject instanceof XMLDataObjectImpl); - element = ((XMLDataObject) dataObject).getElement(); - assertNotNull(element); - assertEquals("schema", element.getTagName()); - } - - public void testCreateFromURIWithMalformedURI() throws Exception { - try { - factory.createFromURI(MALFORMED_URL, false); - fail(); - } catch (MOAException e) { - } - } - - public void testCreateFromURIWithNonExistingHttpURL() throws Exception { - try { - factory.createFromURI(HTTP_UNKNOWN_HOST_URL, false); - fail(); - } catch (MOAException e) { - } - } - - public void testCreateFromURIWithHttps() throws Exception { - DataObject dataObject = - factory.createFromURI(HTTPS_BINARY_CONTENT_URL, false); - assertNotNull(dataObject); - assertTrue(dataObject instanceof BinaryDataObject); - } - - public void testCreateFromURIWithUntrustedHttps() throws Exception { - try { - factory.createFromURI(HTTPS_UNTRUSTED_URL, false); - fail(); - } catch (MOAException e) { - - } - } - - public void testCreateFromURIWithFile() throws Exception { - try { - factory.createFromURI(FILE_BINARY_CONTENT_URL, false); - fail(); - } catch (MOAException e) { - } - } - - public void testCreateFromContentOptionalRefTypeWithXmlContent() - throws Exception { - Document doc = parseXmlString(XML_CONTENT); - Content content = - spssFactory.createContent( - doc.getDocumentElement().getChildNodes(), - "http://data"); - DataObject dataObject = - factory.createFromContentOptionalRefType( - content, - null, - null, - true, - false, - true, - false); - - assertTrue(dataObject instanceof XMLNodeListDataObjectImpl); - } - - public void testCreateFromContentOptionalRefTypeWithBase64Content() - throws Exception { - InputStream is = Base64Utils.decodeToStream(BASE64_CONTENT, true); - Content content = spssFactory.createContent(is, "http://data"); - DataObject dataObject = - factory.createFromContentOptionalRefType( - content, - null, - null, - false, - false, - true, - false); - - assertNotNull(dataObject); - assertTrue(dataObject instanceof ByteArrayDataObjectImpl); - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java deleted file mode 100644 index 13a80cbf1..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import java.util.List; -import java.util.Map; - -import org.w3c.dom.Document; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import iaik.ixsil.init.IXSILInit; -import iaik.ixsil.util.URI; -import iaik.server.modules.xml.Base64Transformation; -import iaik.server.modules.xml.Canonicalization; -import iaik.server.modules.xml.EnvelopedSignatureTransformation; -import iaik.server.modules.xml.Transformation; -import iaik.server.modules.xml.XPath2Transformation; -import iaik.server.modules.xml.XPathTransformation; -import iaik.server.modules.xml.XSLTTransformation; - -import at.gv.egovernment.moa.util.Constants; - -import at.gv.egovernment.moa.spss.MOAApplicationException; -import at.gv.egovernment.moa.spss.api.common.Transform; -import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; -import at.gv.egovernment.moa.spss.server.invoke.TransformationFactory; - -/** - * Test cases for the TransformationFactory class. - * - * @author Patrick Peck - * @version $Id$ - */ -public class TransformationFactoryTest extends SPSSTestCase { - - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/dsigTransform/"; - private TransformationFactory factory = TransformationFactory.getInstance(); - private TransformParser transformParser = new TransformParser(); - - /** - * Constructor for TransformationFactoryTest. - * @param name - */ - public TransformationFactoryTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - IXSILInit.init(new URI("init/properties/init.properties")); - //IXSILInit.init(new URI("file:data/deploy/ixsil/init/properties/init.properties")); - - } - - public void testCreateCanonicalization() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "canonicalization.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - - assertTrue(t instanceof Canonicalization); - assertEquals( - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", - t.getAlgorithmURI()); - } - - public void testCreateCanonicalizationWithComments() throws Exception { - Document transform = - parseXml(TESTDATA_BASE + "canonicalizationWithComments.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - - assertTrue(t instanceof Canonicalization); - assertEquals( - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", - t.getAlgorithmURI()); - } - - public void testCreateBase64Decode() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "base64.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof Base64Transformation); - } - - public void testCreateEnvelopedSignature() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "enveloped.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof EnvelopedSignatureTransformation); - } - - public void testXPathTransformation() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "xpath.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - Map nsDecls; - - assertTrue(t instanceof XPathTransformation); - nsDecls = ((XPathTransformation) t).getNamespaceDeclarations(); - assertEquals(1, nsDecls.size()); - assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); - } - - public void testCreateXPath2Transformation() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "xpath2.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof XPath2Transformation); - } - - public void testCreateXSLTTransformation() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "xslt.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - XSLTTransformation t = - (XSLTTransformation) factory.createTransformation(tr); - assertNotNull(t.getStylesheetElement()); - } - - public void testCreateWithIllegalAlgorithm() throws Exception { - try { - Document transform = parseXml(TESTDATA_BASE + "illegalAlgorithm.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - factory.createTransformation(tr); - fail(); - } catch (MOAApplicationException e) { - } - } - - public void testEqualsXslt() throws Exception { - Document xslt = parseXml(TESTDATA_BASE + "xslt.xml"); - Transform tr = transformParser.parseTransform(xslt.getDocumentElement()); - Transformation trXslt = factory.createTransformation(tr); - - Document xsltEqu = parseXml(TESTDATA_BASE + "xsltEqual.xml"); - tr = transformParser.parseTransform(xsltEqu.getDocumentElement()); - Transformation trXsltEqu = factory.createTransformation(tr); - - Document xsltDiff = parseXml(TESTDATA_BASE + "xsltDifferent.xml"); - tr = transformParser.parseTransform(xsltDiff.getDocumentElement()); - Transformation trXsltDiff = factory.createTransformation(tr); - - Document canonicalization = - parseXml(TESTDATA_BASE + "canonicalization.xml"); - - assertTrue(trXslt.equals(trXsltEqu)); - assertFalse(trXslt.equals(trXsltDiff)); - assertFalse(trXsltEqu.equals(trXsltDiff)); - assertEquals(trXslt.hashCode(), trXsltEqu.hashCode()); - assertFalse(trXslt.hashCode() == trXsltDiff.hashCode()); - assertFalse(trXsltEqu.hashCode() == trXsltDiff.hashCode()); - assertFalse(trXslt.equals(canonicalization)); - } - - public void testEqualsXPath() throws Exception { - Document xpath = parseXml(TESTDATA_BASE + "xpath.xml"); - Transform tr = transformParser.parseTransform(xpath.getDocumentElement()); - Transformation trXpath = factory.createTransformation(tr); - Transformation trXpathEqu = factory.createTransformation(tr); - - Document xpathDiff = parseXml(TESTDATA_BASE + "xpathDifferent.xml"); - tr = transformParser.parseTransform(xpathDiff.getDocumentElement()); - Transformation trXpathDiff = factory.createTransformation(tr); - - assertTrue(trXpath.equals(trXpathEqu)); - assertEquals(trXpath.hashCode(), trXpathEqu.hashCode()); - assertFalse(trXpath.equals(trXpathDiff)); - assertFalse(trXpath.hashCode() == trXpathDiff.hashCode()); - } - - public void testEqualsXPath2() throws Exception { - Document xpath2 = parseXml(TESTDATA_BASE + "xpath2.xml"); - Transform tr = transformParser.parseTransform(xpath2.getDocumentElement()); - Transformation trXpath2 = factory.createTransformation(tr); - Transformation trXpath2Equ = factory.createTransformation(tr); - - Document xpath2Diff = parseXml(TESTDATA_BASE + "xpath2Different.xml"); - tr = transformParser.parseTransform(xpath2Diff.getDocumentElement()); - Transformation trXpath2Diff = factory.createTransformation(tr); - - assertTrue(trXpath2.equals(trXpath2Equ)); - assertEquals(trXpath2.hashCode(), trXpath2Equ.hashCode()); - assertFalse(trXpath2.equals(trXpath2Diff)); - assertFalse(trXpath2.hashCode() == trXpath2Diff.hashCode()); - } - - public void testCreateTransformationList() throws Exception { - Document transforms = parseXml(TESTDATA_BASE + "transforms.xml"); - List trs = transformParser.parseTransforms(transforms.getDocumentElement()); - List transformationList = factory.createTransformationList(trs); - - assertEquals(3, transformationList.size()); - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java deleted file mode 100644 index 28cd3805a..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import java.util.Collections; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.util.DOMUtils; - -import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureResponseBuilder; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; -import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureCreationInvoker; - -/** - * Mainly a smoke test for debugging the XMLSignatureCreationInvoker. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XMLSignatureCreationInvokerTest extends SPSSTestCase { - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/CreateXMLSignature/"; - - public XMLSignatureCreationInvokerTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - setUpTransactionContext(); - setUpLoggingContext(); - setUpIaikConfiguration(); - setUpSSL(); - } - - public void testCreateXMLSignature() throws Exception { - try { - XMLSignatureCreationInvoker invoker = - XMLSignatureCreationInvoker.getInstance(); - CreateXMLSignatureRequestParser requestParser = - new CreateXMLSignatureRequestParser(); - Document doc = - SPSSTestCase.parseXmlValidating( - TESTDATA_BASE + "TestGeneratorCX2.004.Req.xml"); - CreateXMLSignatureRequest request = - requestParser.parse(doc.getDocumentElement()); - CreateXMLSignatureResponse response = - invoker.createXMLSignature(request, Collections.EMPTY_SET); - CreateXMLSignatureResponseBuilder responseBuilder = - new CreateXMLSignatureResponseBuilder(); - Element result = responseBuilder.build(response).getDocumentElement(); - - System.out.println(DOMUtils.serializeNode(result)); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } - } - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java deleted file mode 100644 index 56e3d541b..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import org.w3c.dom.Document; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.util.DOMUtils; - -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureResponseBuilder; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; -import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureVerificationInvoker; - -/** - * Mainly a smoke test for debugging the XMLSignatureVerificationInvoker. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XMLSignatureVerificationInvokerTest extends SPSSTestCase { - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/VerifyXMLSignature/"; - - public XMLSignatureVerificationInvokerTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - setUpTransactionContext(); - setUpLoggingContext(); - setUpIaikConfiguration(); - } - - public void testVerifyXMLSignature() throws Exception { - try { - XMLSignatureVerificationInvoker invoker = - XMLSignatureVerificationInvoker.getInstance(); - VerifyXMLSignatureRequestParser requestParser = - new VerifyXMLSignatureRequestParser(); - VerifyXMLSignatureResponseBuilder responseBuilder = - new VerifyXMLSignatureResponseBuilder(); - Document doc = - SPSSTestCase.parseXmlValidating( - TESTDATA_BASE + "TestGeneratorVX.201.Req.xml"); - - VerifyXMLSignatureRequest request = - requestParser.parse(doc.getDocumentElement()); - VerifyXMLSignatureResponse response; - - response = invoker.verifyXMLSignature(request); - System.out.println( - DOMUtils.serializeNode(responseBuilder.build(response))); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } - } - - -} diff --git a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java b/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java deleted file mode 100644 index b46c20086..000000000 --- a/spss/server/serverlib/src/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.tools; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -import at.gv.egovernment.moa.spss.server.tools.CertTool; - -import test.at.gv.egovernment.moa.MOATestCase; - -/** - * Tests for the CertTool. - * - * @author Patrick Peck - * @version $Id$ - */ -public class CertToolTest extends MOATestCase { - - private static final String EXPECTED_RESULT = - "SubjectDN (RFC2253):" - + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" - + "IssuerDN (RFC2253) :" - + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" - + "Serial Number :" - + " 1047548672\r\n"; - private CertTool certTool; - - /** - * Constructor for CertToolTest. - * @param name - */ - public CertToolTest(String name) { - super(name); - } - - protected void setUp() { - certTool = new CertTool(); - } - - public void testPrintCertInfo() { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - PrintStream ps = new PrintStream(bos); - String result; - - certTool.printCertInfo(TESTDATA_ROOT + "security/server.cer", ps); - result = new String(bos.toByteArray()); - System.out.println(result); - assertEquals(EXPECTED_RESULT, result); - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/AllTests.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/AllTests.java new file mode 100644 index 000000000..c670b5e55 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/AllTests.java @@ -0,0 +1,40 @@ +package test.at.gv.egovernment.moa.spss; + +import test.at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImplTest; +import test.at.gv.egovernment.moa.spss.server.iaik.config.IaikConfiguratorTest; +import test.at.gv.egovernment.moa.spss.server.tools.CertToolTest; + +import junit.awtui.TestRunner; +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Test suite for all unit tests. + * + * @author Patrick Peck + * @version $Id$ + */ +public class AllTests { + + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(test.at.gv.egovernment.moa.spss.server.config.AllTests.class); + suite.addTestSuite(ConfigurationDataImplTest.class); + suite.addTestSuite(IaikConfiguratorTest.class); + suite.addTest( + test.at.gv.egovernment.moa.spss.server.invoke.AllTests.suite()); + suite.addTest(test.at.gv.egovernment.moa.spss.api.xmlbind.AllTests.suite()); + suite.addTestSuite(CertToolTest.class); + + return suite; + } + + public static void main(String[] args) { + try { + TestRunner.run(AllTests.class); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/SPSSTestCase.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/SPSSTestCase.java new file mode 100644 index 000000000..a585e30a0 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/SPSSTestCase.java @@ -0,0 +1,82 @@ +package test.at.gv.egovernment.moa.spss; + +import java.security.Security; + +import test.at.gv.egovernment.moa.MOATestCase; + +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; +import at.gv.egovernment.moa.util.MessageProvider; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Base class for MOA test cases. + * + * Provides some utility functions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SPSSTestCase extends MOATestCase { + + protected static final String TESTDATA_ROOT = "data/test/"; + + /** + * Constructor for MOATestCase. + * @param arg0 + */ + public SPSSTestCase(String name) { + super(name); + } + + /** + * Set up a transaction context with a test configuration. + */ + protected void setUpTransactionContext() throws Exception { + System.setProperty( + ConfigurationProvider.CONFIG_PROPERTY_NAME, + "data/test/conf/moa-spss/MOA-SPSSConfiguration.xml"); + ConfigurationProvider config = ConfigurationProvider.getInstance(); + TransactionContext context = new TransactionContext("test", null, config); + TransactionContextManager.getInstance().setTransactionContext(context); + } + + protected void setUpLoggingContext() throws Exception { + LoggingContext context = new LoggingContext("test"); + LoggingContextManager.getInstance().setLoggingContext(context); + } + + /** + * Configure the IAIK modules with the current configuration. + * + * A TransactionContext must have been set up before. + */ + protected void setUpIaikConfiguration() throws Exception { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ClassLoader cl = getClass().getClassLoader(); + MessageProvider msg = MessageProvider.getInstance(); + + try { + cl.loadClass("javax.security.cert.Certificate"); // from jcert.jar + } catch (ClassNotFoundException e) { + Logger.warn(msg.getMessage("init.03", null), e); + } + + new IaikConfigurator().configure(context.getConfiguration()); + } + + protected void setUpSSL() throws Exception { + //System.setProperty("javax.net.debug", "all"); + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + System.setProperty( + "java.protocol.handler.pkgs", + "com.sun.net.ssl.internal.www.protocol"); + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java new file mode 100644 index 000000000..28f79729e --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java @@ -0,0 +1,24 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Runs all tests in this package. + * + * @author Patrick Peck + * @version $Id$ + */ +public class AllTests { + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(CreateXMLSignatureRequestParserTest.class); + suite.addTestSuite(TransformParserTest.class); + suite.addTestSuite(VerifyCMSSignatureRequestParserTest.class); + suite.addTestSuite(VerifyXMLSignatureRequestParserTest.class); + + return suite; + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java new file mode 100644 index 000000000..7ce705b01 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java @@ -0,0 +1,71 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; + +/** + * Test the CreateXMLSignatureRequestParser. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CreateXMLSignatureRequestParserTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/CreateXMLSignature/"; + + private CreateXMLSignatureRequestParser requestParser; + + public CreateXMLSignatureRequestParserTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + requestParser = new CreateXMLSignatureRequestParser(); + } + + public void testParse() throws Exception { + Element requestElem = + parseXml(TESTDATA_BASE + "TestGeneratorCX2.001.Req.xml") + .getDocumentElement(); + CreateXMLSignatureRequest request = requestParser.parse(requestElem); + SingleSignatureInfo sigInfo; + DataObjectInfo dataObjInfo; + CreateTransformsInfoProfileExplicit transProfile; + CreateSignatureEnvironmentProfileExplicit envProfile; + + assertNotNull(request); + assertEquals("PKCS12RSAKey1", request.getKeyIdentifier()); + assertEquals(1, request.getSingleSignatureInfos().size()); + + sigInfo = (SingleSignatureInfo) request.getSingleSignatureInfos().get(0); + assertEquals(1, sigInfo.getDataObjectInfos().size()); + assertFalse(sigInfo.isSecurityLayerConform()); + + dataObjInfo = (DataObjectInfo) sigInfo.getDataObjectInfos().get(0); + assertNotNull(dataObjInfo.getDataObject()); + + transProfile = + (CreateTransformsInfoProfileExplicit) dataObjInfo + .getCreateTransformsInfoProfile(); + assertNotNull( + transProfile.getCreateTransformsInfo().getFinalDataMetaInfo()); + + envProfile = + (CreateSignatureEnvironmentProfileExplicit) sigInfo + .getCreateSignatureInfo() + .getCreateSignatureEnvironmentProfile(); + assertEquals( + "//data:Document", + envProfile.getCreateSignatureLocation().getXPathExpression()); + assertEquals(0, envProfile.getCreateSignatureLocation().getIndex()); + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java new file mode 100644 index 000000000..f580f86bc --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java @@ -0,0 +1,113 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import java.util.List; + +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform; +import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform; +import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform; +import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform; +import at.gv.egovernment.moa.spss.api.common.XPathTransform; +import at.gv.egovernment.moa.spss.api.common.XSLTTransform; +import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; + +/** + * Test the TransformParser. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TransformParserTest extends SPSSTestCase { + private static String TESTDATA_BASE = TESTDATA_ROOT + "xml/dsigTransform/"; + + private TransformParser transformParser; + + public TransformParserTest(String name) { + super(name); + } + + protected void setUp() { + transformParser = new TransformParser(); + } + + public void testParseTransforms() throws Exception { + Element transformsElem = + parseXml(TESTDATA_BASE + "transforms.xml").getDocumentElement(); + List transforms = transformParser.parseTransforms(transformsElem); + + assertNotNull(transforms); + assertEquals(3, transforms.size()); + + } + + public void testParseCanonicalizationTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "canonicalization.xml").getDocumentElement(); + CanonicalizationTransform transform = + (CanonicalizationTransform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + assertEquals( + CanonicalizationTransform.CANONICAL_XML, + transform.getAlgorithmURI()); + } + + public void testParseExclCanonicalizationTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "exclusiveCanonicalization.xml") + .getDocumentElement(); + ExclusiveCanonicalizationTransform transform = + (ExclusiveCanonicalizationTransform) transformParser.parseTransform( + transformElem); + + assertNotNull(transform); + assertEquals( + ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML, + transform.getAlgorithmURI()); + assertEquals(3, transform.getInclusiveNamespacePrefixes().size()); + } + + public void testParseEnvelopedTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "enveloped.xml").getDocumentElement(); + EnvelopedSignatureTransform transform = + (EnvelopedSignatureTransform) transformParser.parseTransform( + transformElem); + + assertNotNull(transform); + } + + public void testParseXPathTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "xpath.xml").getDocumentElement(); + XPathTransform transform = + (XPathTransform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + assertEquals("//ToBeSigned/Data", transform.getXPathExpression()); + assertEquals(1, transform.getNamespaceDeclarations().size()); + } + + public void testParseXPathFilter2Transform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "xpath2.xml").getDocumentElement(); + XPathFilter2Transform transform = + (XPathFilter2Transform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + assertEquals(3, transform.getFilters().size()); + } + + public void testParseXSLTTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "xslt.xml").getDocumentElement(); + XSLTTransform transform = + (XSLTTransform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java new file mode 100644 index 000000000..4be7667eb --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java @@ -0,0 +1,61 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.util.DateTimeUtils; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentExcplicit; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.common.MetaInfo; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; + +/** + * Test the VerifyCMSSignatureRequestParserTest. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyCMSSignatureRequestParserTest extends SPSSTestCase { + private static String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyCMSSignature/"; + + private VerifyCMSSignatureRequestParser requestParser; + + public VerifyCMSSignatureRequestParserTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + requestParser = new VerifyCMSSignatureRequestParser(); + } + + public void testParse() throws Exception { + Element requestElem = + parseXml(TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml") + .getDocumentElement(); + VerifyCMSSignatureRequest request = requestParser.parse(requestElem); + MetaInfo metaInfo; + CMSContentExcplicit content; + + assertNotNull(request); + assertEquals(1, request.getSignatories()[0]); + assertEquals( + DateTimeUtils.parseDateTime("2003-04-04T09:30:47-05:00"), + request.getDateTime()); + assertNotNull(request.getCMSSignature()); + assertNotNull(request.getDataObject()); + assertEquals("TrustProfile1", request.getTrustProfileId()); + + metaInfo = request.getDataObject().getMetaInfo(); + assertNotNull(metaInfo); + assertEquals("text/plain", metaInfo.getMimeType()); + assertEquals("http://10.16.46.109/TestDatenGenerator/resources/testDaten.txt", metaInfo.getDescription()); + + content = (CMSContentExcplicit) request.getDataObject().getContent(); + assertNotNull(content.getBinaryContent()); + + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java new file mode 100644 index 000000000..3b8e8b00e --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java @@ -0,0 +1,81 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DateTimeUtils; + +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; +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.VerifyTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; + +/** + * Test the VerifyXMLSignatureRequestParserTest. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyXMLSignatureRequestParserTest extends SPSSTestCase { + private static String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyXMLSignature/"; + + private VerifyXMLSignatureRequestParser parser; + + public VerifyXMLSignatureRequestParserTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + parser = new VerifyXMLSignatureRequestParser(); + } + + public void testParse() throws Exception { + Element requestElem = + parseXml(TESTDATA_BASE + "TestGeneratorVX.201.Req.xml") + .getDocumentElement(); + VerifyXMLSignatureRequest request = parser.parse(requestElem); + VerifySignatureInfo verifySignatureInfo; + VerifySignatureLocation verifyLocation; + SignatureManifestCheckParams checkParams; + ReferenceInfo refInfo; + VerifyTransformsInfoProfileExplicit transformsProfile; + + assertNotNull(request); + assertEquals( + DateTimeUtils.parseDateTime("2003-04-01T12:53:57+01:00"), + request.getDateTime()); + assertFalse(request.getReturnHashInputData()); + assertEquals("TrustProfile1", request.getTrustProfileId()); + + verifySignatureInfo = request.getSignatureInfo(); + assertNotNull(verifySignatureInfo); + assertNotNull(verifySignatureInfo.getVerifySignatureEnvironment()); + + verifyLocation = verifySignatureInfo.getVerifySignatureLocation(); + assertNotNull(verifyLocation); + assertEquals("//dsig:Signature", verifyLocation.getXPathExpression()); + assertEquals(3, verifyLocation.getNamespaceDeclarations().size()); + + checkParams = request.getSignatureManifestCheckParams(); + assertNotNull(checkParams); + assertEquals(true, checkParams.getReturnReferenceInputData()); + assertEquals(1, checkParams.getReferenceInfos().size()); + + refInfo = (ReferenceInfo) checkParams.getReferenceInfos().get(0); + assertEquals(1, refInfo.getVerifyTransformsInfoProfiles().size()); + + transformsProfile = + (VerifyTransformsInfoProfileExplicit) refInfo + .getVerifyTransformsInfoProfiles() + .get(0); + assertEquals(1, transformsProfile.getTransforms().size()); + assertEquals(1, transformsProfile.getTransformParameters().size()); + + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/AllTests.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/AllTests.java new file mode 100644 index 000000000..131f38c19 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/AllTests.java @@ -0,0 +1,20 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class AllTests +{ + public static Test suite() + { + TestSuite suite = new TestSuite(); + suite.addTestSuite(ConfigurationProviderTest1.class); + suite.addTestSuite(ConfigurationProviderTest2.class); + suite.addTestSuite(ConfigurationProviderTest3.class); + return suite; + } +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java new file mode 100644 index 000000000..474a387ad --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java @@ -0,0 +1,377 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import iaik.asn1.structures.Name; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; +import iaik.x509.X509Certificate; + +import java.math.BigInteger; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import junit.framework.TestCase; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.server.config.CRLDistributionPoint; +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.config.HardwareCryptoModule; +import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule; +import at.gv.egovernment.moa.spss.server.config.KeyGroup; +import at.gv.egovernment.moa.spss.server.config.KeyGroupEntry; +import at.gv.egovernment.moa.spss.server.config.OCSPDistributionPoint; +import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule; +import at.gv.egovernment.moa.spss.server.config.TrustProfile; +import at.gv.egovernment.moa.util.Constants; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class ConfigurationProviderTest1 extends TestCase +{ + private static final String CONFIG_BASE_ = + "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; + + static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; + + static + { + System.setProperty( + "log4j.configuration", + "file:/" + CONFIG_BASE_ + "log4j.properties"); + System.setProperty( + at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, + CONFIG_BASE_ + "moa.spss.complete-config.xml"); + try + { + ConfigurationProvider.reload(); + provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); + } + catch (ConfigurationException e) + { + throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); + } + } + + /** + * Constructor for ConfigurationProvider. + * @param arg0 + */ + public ConfigurationProviderTest1() throws MOAException + { + super("ConfigurationProvider"); + } + + public void testGetWarnings() + { + assertEquals(0, provider_.getWarnings().size()); + } + + public void testGetDigestMethodAlgorithmName() + { + assertEquals( + Constants.SHA1_URI, + provider_.getDigestMethodAlgorithmName()); + } + + public void testGetCanonicalizationAlgorithmName() + { + assertEquals( + Constants.C14N_WITH_COMMENTS_URI, + provider_.getCanonicalizationAlgorithmName()); + } + + public void testGetHardwareCryptoModules() + { + List hwcms = provider_.getHardwareCryptoModules(); + assertEquals(2, hwcms.size()); + + HardwareCryptoModule hwc1 = (HardwareCryptoModule) hwcms.get(0); + assertEquals("HWC1_Name", hwc1.getName()); + assertEquals("HWC1_SlotId", hwc1.getSlotID()); + assertEquals("HWC1_UserPIN", hwc1.getUserPIN()); + + HardwareCryptoModule hwc2 = (HardwareCryptoModule) hwcms.get(1); + assertEquals("HWC2_Name", hwc2.getName()); + assertNull(hwc2.getSlotID()); + assertEquals("HWC2_UserPIN", hwc2.getUserPIN()); + } + + public void testGetHardwareKeyModules() + { + List hwkms = provider_.getHardwareKeyModules(); + assertEquals(2, hwkms.size()); + + HardwareKeyModule hwk1 = (HardwareKeyModule) hwkms.get(0); + assertEquals("HWK1_Id", hwk1.getId()); + assertEquals("HWK1_Name", hwk1.getName()); + assertEquals("HWK1_SlotId", hwk1.getSlotID()); + assertEquals("HWK1_UserPIN", hwk1.getUserPIN()); + + HardwareKeyModule hwk2 = (HardwareKeyModule) hwkms.get(1); + assertEquals("HWK2_Id", hwk2.getId()); + assertEquals("HWK2_Name", hwk2.getName()); + assertNull(hwk2.getSlotID()); + assertEquals("HWK2_UserPIN", hwk2.getUserPIN()); + } + + public void testGetSoftwareKeyModules() + { + List swkms = provider_.getSoftwareKeyModules(); + assertEquals(2, swkms.size()); + + SoftwareKeyModule swk1 = (SoftwareKeyModule) swkms.get(0); + assertEquals("SWK1_Id", swk1.getId()); + assertEquals(CONFIG_BASE_ + "swk/SWK1_FileName.txt", swk1.getFileName().replace('\\', '/')); + assertEquals("SWK1_Password", swk1.getPassWord()); + + SoftwareKeyModule swk2 = (SoftwareKeyModule) swkms.get(1); + assertEquals("SWK2_Id", swk2.getId()); + assertEquals(CONFIG_BASE_ + "swk/SWK2_FileName.txt", swk2.getFileName().replace('\\', '/')); + assertNull(swk2.getPassWord()); + } + + public void testGetKeyGroups() + { + Map keyGroups = provider_.getKeyGroups(); + assertEquals(2, keyGroups.size()); + + KeyGroup kg1 = (KeyGroup) keyGroups.get("KG1_Id"); + assertNotNull(kg1); + assertEquals("KG1_Id", kg1.getId()); + + Set kg1Entries = kg1.getKeyGroupEntries(); + assertEquals(2, kg1Entries.size()); + + Iterator kg1EntriesIt = kg1Entries.iterator(); + while(kg1EntriesIt.hasNext()) + { + KeyGroupEntry currentEntry = (KeyGroupEntry)kg1EntriesIt.next(); + if ("HWK1_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=HWK1_Issuer", currentEntry.getIssuerDN()); + assertEquals(0, currentEntry.getSerialNumber().intValue()); + } + else if ("HWK2_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=HWK2_Issuer", currentEntry.getIssuerDN()); + assertEquals(1, currentEntry.getSerialNumber().intValue()); + } + else fail("Invalid module identifer found."); + } + + KeyGroup kg2 = (KeyGroup) keyGroups.get("KG2_Id"); + assertNotNull(kg2); + assertEquals("KG2_Id", kg2.getId()); + + Set kg2Entries = kg2.getKeyGroupEntries(); + assertEquals(2, kg2Entries.size()); + + Iterator kg2EntriesIt = kg1Entries.iterator(); + while(kg1EntriesIt.hasNext()) + { + KeyGroupEntry currentEntry = (KeyGroupEntry)kg2EntriesIt.next(); + if ("SWK1_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=CN=SWK1_Issuer", currentEntry.getIssuerDN()); + assertEquals(2, currentEntry.getSerialNumber().intValue()); + } + else if ("SWK2_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=SWK2_Issuer", currentEntry.getIssuerDN()); + assertEquals(3, currentEntry.getSerialNumber().intValue()); + } + else fail("Invalid module identifer found."); + } + } + + public void testGetKeyGroupEntries() throws RFC2253NameParserException + { + RFC2253NameParser parser = new RFC2253NameParser("CN=Customer1_Issuer"); + Name name = parser.parse(); + Set kgEntries = provider_.getKeyGroupEntries(name, BigInteger.valueOf(4), "KG1_Id"); + assertEquals(2, kgEntries.size()); + + Iterator kgEntriesIt = kgEntries.iterator(); + while (kgEntriesIt.hasNext()) + { + KeyGroupEntry currentEntry = (KeyGroupEntry) kgEntriesIt.next(); + if (!"HWK1_Id".equals(currentEntry.getModuleID()) && !"HWK2_Id".equals(currentEntry.getModuleID())) + { + fail("Invalid module identifier found."); + } + } + } + + public void testGetChainingMode() throws RFC2253NameParserException + { + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); + Name name = parser.parse(); + cert.setIssuerDN(name); + cert.setSerialNumber(BigInteger.valueOf(0)); + assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); // Default chaining mode + + parser = new RFC2253NameParser("CN=TA1_Issuer"); + name = parser.parse(); + cert.setIssuerDN(name); + cert.setSerialNumber(BigInteger.valueOf(5)); + assertEquals(ChainingModes.CHAIN_MODE, provider_.getChainingMode(cert)); + } + + public void testGetDistributionPoints() throws RFC2253NameParserException + { + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); + Name name = parser.parse(); + cert.setIssuerDN(name); + + Set dps = provider_.getDistributionPoints(cert); + assertEquals(2, dps.size()); + + Iterator dpIt = dps.iterator(); + while (dpIt.hasNext()) + { + CRLDistributionPoint currentDP = (CRLDistributionPoint)dpIt.next(); + if ("http://crl.myca.org".equals(currentDP.getUri())) + { + int reasonCodes = + iaik.asn1.structures.DistributionPoint.unused | + iaik.asn1.structures.DistributionPoint.keyCompromise | + iaik.asn1.structures.DistributionPoint.cACompromise | + iaik.asn1.structures.DistributionPoint.affiliationChanged | + iaik.asn1.structures.DistributionPoint.superseded | + iaik.asn1.structures.DistributionPoint.cessationOfOperation | + iaik.asn1.structures.DistributionPoint.certificateHold | + iaik.asn1.structures.DistributionPoint.privilegeWithdrawn | + iaik.asn1.structures.DistributionPoint.aACompromise; + assertEquals(reasonCodes, currentDP.getReasonCodes()); + } + else if ("http://crl.myotherca.org".equals(currentDP.getUri())) + { + int reasonCodes = + iaik.asn1.structures.DistributionPoint.aACompromise | + iaik.asn1.structures.DistributionPoint.affiliationChanged; + assertEquals(reasonCodes, currentDP.getReasonCodes()); + } + else fail("Invalid CRL DP URI found: " + currentDP.getUri()); + } + + parser = new RFC2253NameParser("CN=DP2_Issuer"); + name = parser.parse(); + cert.setIssuerDN(name); + + dps = provider_.getDistributionPoints(cert); + assertEquals(1, dps.size()); + + OCSPDistributionPoint dpo = (OCSPDistributionPoint) dps.toArray()[0]; + assertEquals("http://crl.yetanotherca.org", dpo.getUri()); + } + + public void testGetCRLArchiveDuration() + { + assertEquals(730, provider_.getCRLArchiveDuration()); + } + + public void testGetEnableRevocationArchiving() + { + assertFalse(provider_.getEnableRevocationArchiving()); + } + + public void testGetCertStoreLocation() + { + assertEquals( + CONFIG_BASE_ + "certstore_test", + provider_.getCertStoreLocation().replace('\\', '/')); + } + + public void testGetCreateTransformsInfoProfile() + { + Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); + assertEquals("CreateTransformsInfoProfile", ctip1.getLocalName()); + + Element ctip2 = provider_.getCreateTransformsInfoProfile("CTIP_2"); + assertEquals("CreateTransformsInfoProfile", ctip2.getLocalName()); + } + + public void testGetCreateSignatureEnvironmentProfile() + { + Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); + assertEquals("CreateSignatureEnvironmentProfile", csep.getLocalName()); + } + + public void testGetVerifyTransformsInfoProfile() + { + Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); + assertEquals("VerifyTransformsInfoProfile", vtip.getLocalName()); + } + + public void testGetSupplementProfile() + { + Element sp = provider_.getSupplementProfile("SP_1"); + assertEquals("SupplementProfile", sp.getLocalName()); + } + + public void testGetTrustProfile() + { + TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); + assertEquals( + "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/anchors", + tp1.getUri()); + assertEquals( + "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/signercerts", + tp1.getSignerCertsUri()); + + TrustProfile tp2 = provider_.getTrustProfile("TP2_Id"); + assertEquals( + "file:" + CONFIG_BASE_ + "trustprofiles/tp2/anchors", + tp2.getUri()); + assertEquals( + "file:" + CONFIG_BASE_ + "trustprofiles/tp2/signercerts", + tp2.getSignerCertsUri()); + } + + public void testGetRevocationArchiveJDBCURL() + { + assertEquals("jdbc://dummy", provider_.getRevocationArchiveJDBCURL()); + } + + public void testGetRevocationArchiveJDBCDriverClass() + { + assertEquals("fully.qualified.classname", provider_.getRevocationArchiveJDBCDriverClass()); + } + + public void testGetEnableRevocationChecking() + { + assertFalse(provider_.getEnableRevocationChecking()); + } + + public void testGetMaxRevocationAge() + { + assertEquals(10000, provider_.getMaxRevocationAge()); + } + + public void testGetServiceOrder() + { + String[] serviceOrder = provider_.getServiceOrder(); + assertEquals(2, serviceOrder.length); + assertEquals("crl", serviceOrder[0]); + assertEquals("ocsp", serviceOrder[1]); + } + + public void testGetAutoAddCertificates() + { + assertFalse(provider_.getAutoAddCertificates()); + } + + public void testGetUseAuthorityInfoAccess() + { + assertFalse(provider_.getUseAuthorityInfoAccess()); + } +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java new file mode 100644 index 000000000..adf02809b --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java @@ -0,0 +1,225 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import iaik.asn1.structures.Name; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; +import iaik.x509.X509Certificate; + +import java.math.BigInteger; +import java.util.List; +import java.util.Set; + +import junit.framework.TestCase; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAException; +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.config.TrustProfile; +import at.gv.egovernment.moa.util.Constants; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class ConfigurationProviderTest2 extends TestCase +{ + private static final String CONFIG_BASE_ = + "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; + + static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; + + static + { + System.setProperty( + "log4j.configuration", + "file:/" + CONFIG_BASE_ + "log4j.properties"); + System.setProperty( + at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, + CONFIG_BASE_ + "moa.ss.noopts-config.xml"); + try + { + ConfigurationProvider.reload(); + provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); + } + catch (ConfigurationException e) + { + throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); + } + } + + + /** + * Constructor for ConfigurationProvider. + * @param arg0 + */ + public ConfigurationProviderTest2() throws MOAException + { + super("ConfigurationProvider"); + } + + public void testGetWarnings() + { + // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found + assertEquals(3, provider_.getWarnings().size()); + } + + public void testGetDigestMethodAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.SHA1_URI, + provider_.getDigestMethodAlgorithmName()); + } + + public void testGetCanonicalizationAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.C14N_URI, + provider_.getCanonicalizationAlgorithmName()); + } + + public void testGetHardwareCryptoModules() + { + // No hardware crypto modules in config file, check for empty list + List hwcms = provider_.getHardwareCryptoModules(); + assertEquals(0, hwcms.size()); + } + + public void testGetHardwareKeyModules() + { + List hwkms = provider_.getHardwareKeyModules(); + assertEquals(1, hwkms.size()); + } + + public void testGetSoftwareKeyModules() + { + // No software key modules in config file, check for empty list + List swkms = provider_.getSoftwareKeyModules(); + assertEquals(0, swkms.size()); + } + + public void testGetChainingMode() throws RFC2253NameParserException + { + // Default Chaining Mode not set in configuration, check for default value + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); + Name name = parser.parse(); + cert.setIssuerDN(name); + cert.setSerialNumber(BigInteger.valueOf(0)); + assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); + } + + public void testGetDistributionPoints() throws RFC2253NameParserException + { + // Element is missing in config file, check if emty list is returned + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); + Name name = parser.parse(); + cert.setIssuerDN(name); + + Set dps = provider_.getDistributionPoints(cert); + assertEquals(0, dps.size()); + } + + public void testGetCRLArchiveDuration() + { + // Element is missing in config file, check if default value is returned + assertEquals(0, provider_.getCRLArchiveDuration()); + } + + public void testGetEnableRevocationArchiving() + { + // Element is missing in config file, check if default value is returned + assertFalse(provider_.getEnableRevocationArchiving()); + } + + public void testGetCertStoreLocation() + { + // Element is missing in config file, check if default value is returned + assertEquals( + CONFIG_BASE_ + "certstore", + provider_.getCertStoreLocation().replace('\\', '/')); + } + + public void testGetCreateTransformsInfoProfile() + { + // No profile in config file, check for null + Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); + assertNull(ctip1); + } + + public void testGetCreateSignatureEnvironmentProfile() + { + // No profile in config file, check for null + Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); + assertNull(csep); + } + + public void testGetVerifyTransformsInfoProfile() + { + // No profile in config file, check for null + Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); + assertNull(vtip); + } + + public void testGetSupplementProfile() + { + // No profile in config file, check for null + Element sp = provider_.getSupplementProfile("SP_1"); + assertNull(sp); + } + + public void testGetTrustProfile() + { + // No trust profiles config file, check for null + TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); + assertNull(tp1); + } + + public void testGetRevocationArchiveJDBCURL() + { + // Element is missing in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCURL()); + } + + public void testGetRevocationArchiveJDBCDriverClass() + { + // Element is missing in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCDriverClass()); + } + + public void testGetEnableRevocationChecking() + { + // Element is missing in config file, check for default value + assertFalse(provider_.getEnableRevocationChecking()); + } + + public void testGetMaxRevocationAge() + { + // Element is missing in config file, check for default value + assertEquals(0, provider_.getMaxRevocationAge()); + } + + public void testGetServiceOrder() + { + // Element is missing in config file, check for empty array + String[] serviceOrder = provider_.getServiceOrder(); + assertEquals(0, serviceOrder.length); + } + + public void testGetAutoAddCertificates() + { + // Element is missing in config file, check for default value + assertFalse(provider_.getAutoAddCertificates()); + } + + public void testGetUseAuthorityInfoAccess() + { + // Element is missing in config file, check for default value + assertFalse(provider_.getUseAuthorityInfoAccess()); + } +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java new file mode 100644 index 000000000..7da2165cb --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java @@ -0,0 +1,166 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import iaik.asn1.structures.Name; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; +import iaik.x509.X509Certificate; + +import java.util.List; +import java.util.Set; + +import junit.framework.TestCase; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.util.Constants; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class ConfigurationProviderTest3 extends TestCase +{ + private static final String CONFIG_BASE_ = + "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; + + static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; + + static + { + System.setProperty( + "log4j.configuration", + "file:/" + CONFIG_BASE_ + "log4j.properties"); + System.setProperty( + at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, + CONFIG_BASE_ + "moa.sp.noopts-config.xml"); + try + { + ConfigurationProvider.reload(); + provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); + } + catch (ConfigurationException e) + { + throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); + } + } + + /** + * Constructor for ConfigurationProvider. + * @param arg0 + */ + public ConfigurationProviderTest3() throws MOAException + { + super("ConfigurationProvider"); + } + + public void testGetWarnings() + { + // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found + assertEquals(3, provider_.getWarnings().size()); + } + + public void testGetDigestMethodAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.SHA1_URI, + provider_.getDigestMethodAlgorithmName()); + } + + public void testGetCanonicalizationAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.C14N_URI, + provider_.getCanonicalizationAlgorithmName()); + } + + public void testGetHardwareCryptoModules() + { + // No hardware crypto modules in config file, check for empty list + List hwcms = provider_.getHardwareCryptoModules(); + assertEquals(0, hwcms.size()); + } + + public void testGetHardwareKeyModules() + { + // No hardware key modules in config file, check for empty list + List hwkms = provider_.getHardwareKeyModules(); + assertEquals(0, hwkms.size()); + } + + public void testGetSoftwareKeyModules() + { + // No software key modules in config file, check for empty list + List swkms = provider_.getSoftwareKeyModules(); + assertEquals(0, swkms.size()); + } + + public void testGetDistributionPoints() throws RFC2253NameParserException + { + // No distribution points in config file, check for emtpy set + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); + Name name = parser.parse(); + cert.setIssuerDN(name); + + Set dps = provider_.getDistributionPoints(cert); + assertEquals(0, dps.size()); + } + + public void testGetCRLArchiveDuration() + { + // No archive duration in config file, check for default value + assertEquals(0, provider_.getCRLArchiveDuration()); + } + + public void testGetCreateTransformsInfoProfile() + { + // No profile in config file, check for null + Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); + assertNull(ctip1); + } + + public void testGetCreateSignatureEnvironmentProfile() + { + // No profile in config file, check for null + Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); + assertNull(csep); + } + + public void testGetVerifyTransformsInfoProfile() + { + // No profile in config file, check for null + Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); + assertNull(vtip); + } + + public void testGetSupplementProfile() + { + // No profile in config file, check for null + Element sp = provider_.getSupplementProfile("SP_1"); + assertNull(sp); + } + + public void testGetRevocationArchiveJDBCURL() + { + // No archive in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCURL()); + } + + public void testGetRevocationArchiveJDBCDriverClass() + { + // No archive in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCDriverClass()); + } + + public void testGetServiceOrder() + { + // Element is missing in config file, check for empty array + String[] serviceOrder = provider_.getServiceOrder(); + assertEquals(0, serviceOrder.length); + } +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java new file mode 100644 index 000000000..be1090e4a --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java @@ -0,0 +1,149 @@ +package test.at.gv.egovernment.moa.spss.server.iaik.config; + +import java.io.FileInputStream; +import java.security.KeyStore; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import iaik.asn1.structures.DistributionPoint; +import iaik.pki.PKIConfiguration; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.pki.pathvalidation.ValidationConfiguration; +import iaik.pki.revocation.CRLDistributionPoint; +import iaik.pki.revocation.RevocationConfiguration; +import iaik.pki.store.certstore.CertStoreConfiguration; +import iaik.pki.store.certstore.CertStoreTypes; +import iaik.pki.store.revocation.archive.ArchiveConfiguration; +import iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter; +import iaik.server.ConfigurationData; +import iaik.server.modules.keys.HardwareKeyModuleConfiguration; +import iaik.server.modules.keys.SoftwareKeyModuleConfiguration; + +import at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImpl; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Tests the ConfigurationDataImpl. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ConfigurationDataImplTest extends SPSSTestCase { + + private ConfigurationData config; + private X509Certificate iaikCert; + + public ConfigurationDataImplTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + TransactionContext context; + + setUpTransactionContext(); + context = TransactionContextManager.getInstance().getTransactionContext(); + + config = new ConfigurationDataImpl(context.getConfiguration()); + + KeyStore ks = KeyStore.getInstance("JKS", "SUN"); + ks.load( + new FileInputStream(TESTDATA_ROOT + "security/server.keystore"), + "changeit".toCharArray()); + + CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); + Collection certs = + certFactory.generateCertificates( + new FileInputStream( + TESTDATA_ROOT + + "conf/moa-spss/trustprofiles/TrustProfile1/IAIKRoot.cer")); + iaikCert = (X509Certificate) certs.toArray()[0]; + + } + + public void testGetPKIConfiguration() { + PKIConfiguration pkiConfig = config.getPKIConfiguration(); + ArchiveConfiguration archiveConfig = pkiConfig.getArchiveConfiguration(); + CertStoreConfiguration certStoreConfig = + pkiConfig.getCertStoreConfiguration(); + RevocationConfiguration revocationConfig = + pkiConfig.getRevocationConfiguration(); + ValidationConfiguration validationConfig = + pkiConfig.getValidationConfiguration(); + DataBaseArchiveParameter archiveParam; + Set distributionPoints; + Iterator iter; + boolean found; + + // test archive parameters + archiveParam = + (DataBaseArchiveParameter) archiveConfig.getArchiveParameters(); + assertEquals( + archiveParam.getJDBCUrl(), + "jdbc:postgresql://10.16.46.108/moa?user=moa&password=moatest"); + + // test cert store configuration + assertEquals(1, certStoreConfig.getParameters().length); + assertEquals( + CertStoreTypes.DIRECTORY, + certStoreConfig.getParameters()[0].getType()); + + // test revocation configuration + distributionPoints = + revocationConfig.getAlternativeDistributionPoints(iaikCert, null, new Date()); + assertEquals(3, distributionPoints.size()); + found = false; + for (iter = distributionPoints.iterator(); iter.hasNext();) { + CRLDistributionPoint dp = (CRLDistributionPoint) iter.next(); + if (dp.getUri().equals("http://www.iaik.at/testCA/iaik_test_sig.crl")) { + found = + dp.getReasonCodes() + == (DistributionPoint.keyCompromise + | DistributionPoint.affiliationChanged); + } + } + assertTrue(found); + + // test validation configuration + assertEquals( + ChainingModes.PKIX_MODE, + validationConfig.getChainingMode(iaikCert)); + } + + /* + public void testGetCryptoModuleConfigurations() { + List cryptoConfigs = config.getCryptoModuleConfigurations(); + HardwareCryptoModuleConfiguration moduleConfig; + + assertEquals(2, cryptoConfigs.size()); + moduleConfig = (HardwareCryptoModuleConfiguration) cryptoConfigs.get(0); + assertEquals("Module1", moduleConfig.getModuleName()); + assertEquals("Slot1", moduleConfig.getSlotID()); + assertEquals("PIN1", new String(moduleConfig.getUserPIN())); + } + */ + + public void testGetKeyModuleConfigurations() { + List keyConfigs = config.getKeyModuleConfigurations(); + HardwareKeyModuleConfiguration hwKey; + SoftwareKeyModuleConfiguration swKey; + + assertEquals(7, keyConfigs.size()); + hwKey = (HardwareKeyModuleConfiguration) keyConfigs.get(0); + assertEquals("cryptoki.dll", hwKey.getModuleName()); + assertEquals("0", hwKey.getSlotID()); + assertEquals("0000", new String(hwKey.getUserPIN())); + swKey = (SoftwareKeyModuleConfiguration) keyConfigs.get(1); + assertEquals( + "buergerkarte", + new String(swKey.getKeyStoreAuthenticationData())); + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java new file mode 100644 index 000000000..3b403dc19 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java @@ -0,0 +1,36 @@ +package test.at.gv.egovernment.moa.spss.server.iaik.config; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Tests the IaikConfigurator. + * + * @author Patrick Peck + * @version $Id$ + */ +public class IaikConfiguratorTest extends SPSSTestCase { + + public IaikConfiguratorTest(String name) { + super(name); + } + + /** + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUpTransactionContext(); + } + + public void testConfigure() throws Exception { + IaikConfigurator configurator = new IaikConfigurator(); + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + + configurator.configure(context.getConfiguration()); + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/AllTests.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/AllTests.java new file mode 100644 index 000000000..65fa2bf72 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/AllTests.java @@ -0,0 +1,25 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Runs all tests in this package. + * + * @author Patrick Peck + * @version $Id$ + */ +public class AllTests { + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(DataObjectFactoryTest.class); + suite.addTestSuite(TransformationFactoryTest.class); + suite.addTestSuite(XMLSignatureCreationInvokerTest.class); + suite.addTestSuite(CMSSignatureVerificationInvokerTest.class); + suite.addTestSuite(XMLSignatureVerificationInvokerTest.class); + + return suite; + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java new file mode 100644 index 000000000..3024730f4 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java @@ -0,0 +1,63 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; + +/** + * Mainly a smoke test for debugging the CMSSignatureVerificationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CMSSignatureVerificationInvokerTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyCMSSignature/"; + + /** + * Constructor for CMSSignatureVerificationInvokerTest. + * @param name + */ + public CMSSignatureVerificationInvokerTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + setUpTransactionContext(); + setUpLoggingContext(); + setUpIaikConfiguration(); + } + + public void testVerifyCMSSignature() throws Exception { + try { + CMSSignatureVerificationInvoker invoker = + CMSSignatureVerificationInvoker.getInstance(); + VerifyCMSSignatureRequestParser requestParser = + new VerifyCMSSignatureRequestParser(); + Document doc = + SPSSTestCase.parseXmlValidating( + TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml"); + VerifyCMSSignatureRequest request = + requestParser.parse(doc.getDocumentElement()); + VerifyCMSSignatureResponse response = invoker.verifyCMSSignature(request); + VerifyCMSSignatureResponseBuilder responseBuilder = + new VerifyCMSSignatureResponseBuilder(); + Element result = responseBuilder.build(response).getDocumentElement(); + + System.out.println(DOMUtils.serializeNode(result)); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java new file mode 100644 index 000000000..7de2add33 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java @@ -0,0 +1,180 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import java.io.InputStream; +import java.security.Security; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import iaik.server.modules.xml.BinaryDataObject; +import iaik.server.modules.xml.DataObject; +import iaik.server.modules.xml.XMLDataObject; + +import at.gv.egovernment.moa.util.Base64Utils; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.server.iaik.xml.ByteArrayDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.ByteStreamDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLNodeListDataObjectImpl; +import at.gv.egovernment.moa.spss.server.invoke.DataObjectFactory; + +/** + * Test cases for the DataObjectFactory class. + * + * @author Patrick Peck + * @version $Id$ + */ +public class DataObjectFactoryTest extends SPSSTestCase { + + private static final String HTTP_BINARY_CONTENT_URL = "http://www.google.com"; + private static final String HTTP_XML_CONTENT_URL = + "http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"; + private static final String HTTPS_BINARY_CONTENT_URL = + "https://businessnet.ba-ca.com"; + private static final String HTTPS_UNTRUSTED_URL = + "https://heribert.anecon.com"; + private static final String HTTP_UNKNOWN_HOST_URL = "http://uurjmjmruuw.com"; + private static final String MALFORMED_URL = "//hsld///ddd"; + private static final String FILE_BINARY_CONTENT_URL = "file:/C:/boot.ini"; + private static final String XML_CONTENT = + "" + + " " + + " " + + ""; + private static final String BASE64_CONTENT = "U3Zlbg=="; + + private SPSSFactory spssFactory = SPSSFactory.getInstance(); + private DataObjectFactory factory; + + /** + * Constructor for DataObjectFactoryTest. + * @param name + */ + public DataObjectFactoryTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + factory = DataObjectFactory.getInstance(); + + // set up SSL + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + System.setProperty( + "java.protocol.handler.pkgs", + "com.sun.net.ssl.internal.www.protocol"); + /* + System.setProperty( + "javax.net.ssl.keyStore", + "data/test/security/client.keystore"); + System.setProperty("javax.net.ssl.keyStorePassword", "changeit"); + System.setProperty( + "javax.net.ssl.trustStore", + "data/test/security/client.keystore"); + System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); + */ + } + + public void testCreateFromURIWithBinaryHttp() throws Exception { + DataObject dataObject = + factory.createFromURI(HTTP_BINARY_CONTENT_URL, false); + + assertNotNull(dataObject); + assertTrue(dataObject instanceof ByteStreamDataObjectImpl); + assertNotNull(((BinaryDataObject) dataObject).getInputStream()); + } + + public void testCreateFromURIWithXmlHttp() throws Exception { + DataObject dataObject = factory.createFromURI(HTTP_XML_CONTENT_URL, false); + Element element; + + assertNotNull(dataObject); + assertTrue(dataObject instanceof XMLDataObjectImpl); + element = ((XMLDataObject) dataObject).getElement(); + assertNotNull(element); + assertEquals("schema", element.getTagName()); + } + + public void testCreateFromURIWithMalformedURI() throws Exception { + try { + factory.createFromURI(MALFORMED_URL, false); + fail(); + } catch (MOAException e) { + } + } + + public void testCreateFromURIWithNonExistingHttpURL() throws Exception { + try { + factory.createFromURI(HTTP_UNKNOWN_HOST_URL, false); + fail(); + } catch (MOAException e) { + } + } + + public void testCreateFromURIWithHttps() throws Exception { + DataObject dataObject = + factory.createFromURI(HTTPS_BINARY_CONTENT_URL, false); + assertNotNull(dataObject); + assertTrue(dataObject instanceof BinaryDataObject); + } + + public void testCreateFromURIWithUntrustedHttps() throws Exception { + try { + factory.createFromURI(HTTPS_UNTRUSTED_URL, false); + fail(); + } catch (MOAException e) { + + } + } + + public void testCreateFromURIWithFile() throws Exception { + try { + factory.createFromURI(FILE_BINARY_CONTENT_URL, false); + fail(); + } catch (MOAException e) { + } + } + + public void testCreateFromContentOptionalRefTypeWithXmlContent() + throws Exception { + Document doc = parseXmlString(XML_CONTENT); + Content content = + spssFactory.createContent( + doc.getDocumentElement().getChildNodes(), + "http://data"); + DataObject dataObject = + factory.createFromContentOptionalRefType( + content, + null, + null, + true, + false, + true, + false); + + assertTrue(dataObject instanceof XMLNodeListDataObjectImpl); + } + + public void testCreateFromContentOptionalRefTypeWithBase64Content() + throws Exception { + InputStream is = Base64Utils.decodeToStream(BASE64_CONTENT, true); + Content content = spssFactory.createContent(is, "http://data"); + DataObject dataObject = + factory.createFromContentOptionalRefType( + content, + null, + null, + false, + false, + true, + false); + + assertNotNull(dataObject); + assertTrue(dataObject instanceof ByteArrayDataObjectImpl); + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java new file mode 100644 index 000000000..13a80cbf1 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java @@ -0,0 +1,201 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Document; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import iaik.ixsil.init.IXSILInit; +import iaik.ixsil.util.URI; +import iaik.server.modules.xml.Base64Transformation; +import iaik.server.modules.xml.Canonicalization; +import iaik.server.modules.xml.EnvelopedSignatureTransformation; +import iaik.server.modules.xml.Transformation; +import iaik.server.modules.xml.XPath2Transformation; +import iaik.server.modules.xml.XPathTransformation; +import iaik.server.modules.xml.XSLTTransformation; + +import at.gv.egovernment.moa.util.Constants; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.common.Transform; +import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; +import at.gv.egovernment.moa.spss.server.invoke.TransformationFactory; + +/** + * Test cases for the TransformationFactory class. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TransformationFactoryTest extends SPSSTestCase { + + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/dsigTransform/"; + private TransformationFactory factory = TransformationFactory.getInstance(); + private TransformParser transformParser = new TransformParser(); + + /** + * Constructor for TransformationFactoryTest. + * @param name + */ + public TransformationFactoryTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + IXSILInit.init(new URI("init/properties/init.properties")); + //IXSILInit.init(new URI("file:data/deploy/ixsil/init/properties/init.properties")); + + } + + public void testCreateCanonicalization() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "canonicalization.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + + assertTrue(t instanceof Canonicalization); + assertEquals( + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", + t.getAlgorithmURI()); + } + + public void testCreateCanonicalizationWithComments() throws Exception { + Document transform = + parseXml(TESTDATA_BASE + "canonicalizationWithComments.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + + assertTrue(t instanceof Canonicalization); + assertEquals( + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", + t.getAlgorithmURI()); + } + + public void testCreateBase64Decode() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "base64.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + assertTrue(t instanceof Base64Transformation); + } + + public void testCreateEnvelopedSignature() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "enveloped.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + assertTrue(t instanceof EnvelopedSignatureTransformation); + } + + public void testXPathTransformation() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "xpath.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + Map nsDecls; + + assertTrue(t instanceof XPathTransformation); + nsDecls = ((XPathTransformation) t).getNamespaceDeclarations(); + assertEquals(1, nsDecls.size()); + assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); + } + + public void testCreateXPath2Transformation() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "xpath2.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + assertTrue(t instanceof XPath2Transformation); + } + + public void testCreateXSLTTransformation() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "xslt.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + XSLTTransformation t = + (XSLTTransformation) factory.createTransformation(tr); + assertNotNull(t.getStylesheetElement()); + } + + public void testCreateWithIllegalAlgorithm() throws Exception { + try { + Document transform = parseXml(TESTDATA_BASE + "illegalAlgorithm.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + factory.createTransformation(tr); + fail(); + } catch (MOAApplicationException e) { + } + } + + public void testEqualsXslt() throws Exception { + Document xslt = parseXml(TESTDATA_BASE + "xslt.xml"); + Transform tr = transformParser.parseTransform(xslt.getDocumentElement()); + Transformation trXslt = factory.createTransformation(tr); + + Document xsltEqu = parseXml(TESTDATA_BASE + "xsltEqual.xml"); + tr = transformParser.parseTransform(xsltEqu.getDocumentElement()); + Transformation trXsltEqu = factory.createTransformation(tr); + + Document xsltDiff = parseXml(TESTDATA_BASE + "xsltDifferent.xml"); + tr = transformParser.parseTransform(xsltDiff.getDocumentElement()); + Transformation trXsltDiff = factory.createTransformation(tr); + + Document canonicalization = + parseXml(TESTDATA_BASE + "canonicalization.xml"); + + assertTrue(trXslt.equals(trXsltEqu)); + assertFalse(trXslt.equals(trXsltDiff)); + assertFalse(trXsltEqu.equals(trXsltDiff)); + assertEquals(trXslt.hashCode(), trXsltEqu.hashCode()); + assertFalse(trXslt.hashCode() == trXsltDiff.hashCode()); + assertFalse(trXsltEqu.hashCode() == trXsltDiff.hashCode()); + assertFalse(trXslt.equals(canonicalization)); + } + + public void testEqualsXPath() throws Exception { + Document xpath = parseXml(TESTDATA_BASE + "xpath.xml"); + Transform tr = transformParser.parseTransform(xpath.getDocumentElement()); + Transformation trXpath = factory.createTransformation(tr); + Transformation trXpathEqu = factory.createTransformation(tr); + + Document xpathDiff = parseXml(TESTDATA_BASE + "xpathDifferent.xml"); + tr = transformParser.parseTransform(xpathDiff.getDocumentElement()); + Transformation trXpathDiff = factory.createTransformation(tr); + + assertTrue(trXpath.equals(trXpathEqu)); + assertEquals(trXpath.hashCode(), trXpathEqu.hashCode()); + assertFalse(trXpath.equals(trXpathDiff)); + assertFalse(trXpath.hashCode() == trXpathDiff.hashCode()); + } + + public void testEqualsXPath2() throws Exception { + Document xpath2 = parseXml(TESTDATA_BASE + "xpath2.xml"); + Transform tr = transformParser.parseTransform(xpath2.getDocumentElement()); + Transformation trXpath2 = factory.createTransformation(tr); + Transformation trXpath2Equ = factory.createTransformation(tr); + + Document xpath2Diff = parseXml(TESTDATA_BASE + "xpath2Different.xml"); + tr = transformParser.parseTransform(xpath2Diff.getDocumentElement()); + Transformation trXpath2Diff = factory.createTransformation(tr); + + assertTrue(trXpath2.equals(trXpath2Equ)); + assertEquals(trXpath2.hashCode(), trXpath2Equ.hashCode()); + assertFalse(trXpath2.equals(trXpath2Diff)); + assertFalse(trXpath2.hashCode() == trXpath2Diff.hashCode()); + } + + public void testCreateTransformationList() throws Exception { + Document transforms = parseXml(TESTDATA_BASE + "transforms.xml"); + List trs = transformParser.parseTransforms(transforms.getDocumentElement()); + List transformationList = factory.createTransformationList(trs); + + assertEquals(3, transformationList.size()); + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java new file mode 100644 index 000000000..28cd3805a --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java @@ -0,0 +1,63 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import java.util.Collections; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureCreationInvoker; + +/** + * Mainly a smoke test for debugging the XMLSignatureCreationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureCreationInvokerTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/CreateXMLSignature/"; + + public XMLSignatureCreationInvokerTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + setUpTransactionContext(); + setUpLoggingContext(); + setUpIaikConfiguration(); + setUpSSL(); + } + + public void testCreateXMLSignature() throws Exception { + try { + XMLSignatureCreationInvoker invoker = + XMLSignatureCreationInvoker.getInstance(); + CreateXMLSignatureRequestParser requestParser = + new CreateXMLSignatureRequestParser(); + Document doc = + SPSSTestCase.parseXmlValidating( + TESTDATA_BASE + "TestGeneratorCX2.004.Req.xml"); + CreateXMLSignatureRequest request = + requestParser.parse(doc.getDocumentElement()); + CreateXMLSignatureResponse response = + invoker.createXMLSignature(request, Collections.EMPTY_SET); + CreateXMLSignatureResponseBuilder responseBuilder = + new CreateXMLSignatureResponseBuilder(); + Element result = responseBuilder.build(response).getDocumentElement(); + + System.out.println(DOMUtils.serializeNode(result)); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java new file mode 100644 index 000000000..56e3d541b --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java @@ -0,0 +1,61 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import org.w3c.dom.Document; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureVerificationInvoker; + +/** + * Mainly a smoke test for debugging the XMLSignatureVerificationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureVerificationInvokerTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyXMLSignature/"; + + public XMLSignatureVerificationInvokerTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + setUpTransactionContext(); + setUpLoggingContext(); + setUpIaikConfiguration(); + } + + public void testVerifyXMLSignature() throws Exception { + try { + XMLSignatureVerificationInvoker invoker = + XMLSignatureVerificationInvoker.getInstance(); + VerifyXMLSignatureRequestParser requestParser = + new VerifyXMLSignatureRequestParser(); + VerifyXMLSignatureResponseBuilder responseBuilder = + new VerifyXMLSignatureResponseBuilder(); + Document doc = + SPSSTestCase.parseXmlValidating( + TESTDATA_BASE + "TestGeneratorVX.201.Req.xml"); + + VerifyXMLSignatureRequest request = + requestParser.parse(doc.getDocumentElement()); + VerifyXMLSignatureResponse response; + + response = invoker.verifyXMLSignature(request); + System.out.println( + DOMUtils.serializeNode(responseBuilder.build(response))); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + +} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java new file mode 100644 index 000000000..b46c20086 --- /dev/null +++ b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java @@ -0,0 +1,50 @@ +package test.at.gv.egovernment.moa.spss.server.tools; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import at.gv.egovernment.moa.spss.server.tools.CertTool; + +import test.at.gv.egovernment.moa.MOATestCase; + +/** + * Tests for the CertTool. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CertToolTest extends MOATestCase { + + private static final String EXPECTED_RESULT = + "SubjectDN (RFC2253):" + + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" + + "IssuerDN (RFC2253) :" + + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" + + "Serial Number :" + + " 1047548672\r\n"; + private CertTool certTool; + + /** + * Constructor for CertToolTest. + * @param name + */ + public CertToolTest(String name) { + super(name); + } + + protected void setUp() { + certTool = new CertTool(); + } + + public void testPrintCertInfo() { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PrintStream ps = new PrintStream(bos); + String result; + + certTool.printCertInfo(TESTDATA_ROOT + "security/server.cer", ps); + result = new String(bos.toByteArray()); + System.out.println(result); + assertEquals(EXPECTED_RESULT, result); + } + +} -- cgit v1.2.3 From b33fd8084f4ea1562c9056422ebc111b4a92f2a6 Mon Sep 17 00:00:00 2001 From: pdanner Date: Mon, 10 Sep 2007 18:08:08 +0000 Subject: moved test classes, fixed spss-tools build git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1003 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 426 +++++++++++---------- .../java/at/gv/egovernment/moa/spss/AllTests.java | 40 -- .../at/gv/egovernment/moa/spss/SPSSTestCase.java | 82 ---- .../egovernment/moa/spss/api/xmlbind/AllTests.java | 24 -- .../CreateXMLSignatureRequestParserTest.java | 71 ---- .../moa/spss/api/xmlbind/TransformParserTest.java | 113 ------ .../VerifyCMSSignatureRequestParserTest.java | 61 --- .../VerifyXMLSignatureRequestParserTest.java | 81 ---- .../moa/spss/server/config/AllTests.java | 20 - .../server/config/ConfigurationProviderTest1.java | 377 ------------------ .../server/config/ConfigurationProviderTest2.java | 225 ----------- .../server/config/ConfigurationProviderTest3.java | 166 -------- .../iaik/config/ConfigurationDataImplTest.java | 149 ------- .../server/iaik/config/IaikConfiguratorTest.java | 36 -- .../moa/spss/server/invoke/AllTests.java | 25 -- .../CMSSignatureVerificationInvokerTest.java | 63 --- .../spss/server/invoke/DataObjectFactoryTest.java | 180 --------- .../server/invoke/TransformationFactoryTest.java | 201 ---------- .../invoke/XMLSignatureCreationInvokerTest.java | 63 --- .../XMLSignatureVerificationInvokerTest.java | 61 --- .../moa/spss/server/tools/CertToolTest.java | 50 --- .../test/at/gv/egovernment/moa/spss/AllTests.java | 40 ++ .../at/gv/egovernment/moa/spss/SPSSTestCase.java | 82 ++++ .../egovernment/moa/spss/api/xmlbind/AllTests.java | 24 ++ .../CreateXMLSignatureRequestParserTest.java | 71 ++++ .../moa/spss/api/xmlbind/TransformParserTest.java | 113 ++++++ .../VerifyCMSSignatureRequestParserTest.java | 61 +++ .../VerifyXMLSignatureRequestParserTest.java | 81 ++++ .../moa/spss/server/config/AllTests.java | 20 + .../server/config/ConfigurationProviderTest1.java | 377 ++++++++++++++++++ .../server/config/ConfigurationProviderTest2.java | 225 +++++++++++ .../server/config/ConfigurationProviderTest3.java | 166 ++++++++ .../iaik/config/ConfigurationDataImplTest.java | 149 +++++++ .../server/iaik/config/IaikConfiguratorTest.java | 36 ++ .../moa/spss/server/invoke/AllTests.java | 25 ++ .../CMSSignatureVerificationInvokerTest.java | 63 +++ .../spss/server/invoke/DataObjectFactoryTest.java | 180 +++++++++ .../server/invoke/TransformationFactoryTest.java | 201 ++++++++++ .../invoke/XMLSignatureCreationInvokerTest.java | 63 +++ .../XMLSignatureVerificationInvokerTest.java | 61 +++ .../moa/spss/server/tools/CertToolTest.java | 49 +++ 41 files changed, 2305 insertions(+), 2296 deletions(-) delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/AllTests.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/SPSSTestCase.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/AllTests.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/AllTests.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java delete mode 100644 spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java create mode 100644 spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index c49a234a1..87e9b5575 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -1,208 +1,218 @@ - - - MOA.spss - moa-spss - 1.4.x - - - 4.0.0 - MOA.spss.server - moa-spss-lib - jar - 1.4.2 - MOA SP/SS API - - - ${basedir}/../../../repository - - - - - axis - axis - - - commons-discovery - commons-discovery - - - commons-logging - commons-logging - - - javax.activation - activation - - - javax.mail - mail - - - junit - junit - - - log4j - log4j - - - postgresql - postgresql - - - javax.servlet - servlet-api - provided - - - xalan-bin-dist - xalan - compile - - - xerces - xercesImpl - - - xalan-bin-dist - xml-apis - - - xalan-bin-dist - serializer - - - iaik.prod - iaik_moa - - - iaik.prod - iaik_ixsil - - - iaik.prod - iaik_jce_full - compile - - - iaik.prod - iaik_ecc - compile - - - iaik.prod - iaik_cms - runtime - - - iaik.prod - iaik_Pkcs11Provider - runtime - - - iaik.prod - iaik_Pkcs11Wrapper - runtime - - - iaik.prod - iaik_Pkcs11Wrapper - win32 - dll - runtime - true - - - MOA - moa-common - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - false - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.2 - - true - false - false - true - at.gv.egovernment.moa.spss.server.*;at.gv.egovernment.moa.spss.api.impl.*;at.gv.egovernment.moa.spss.impl.* - - - pre - a - Preconditions: - - - post - a - Postconditions: - - - - - API Factory and Services - at.gv.egovernment.moa.spss.api - - - Exceptions - at.gv.egovernment.moa.spss - - - API Objects for Signature Creation - at.gv.egovernment.moa.spss.api.xmlsign - - - API Objects for CMS Signature Verification - at.gv.egovernment.moa.spss.api.cmsverify - - - API Objects for XML Signature Verification - at.gv.egovernment.moa.spss.api.xmlverify - - - Common API Objects - at.gv.egovernment.moa.spss.api.common - - - Builders and Parsers to convert API Objects to and from XML - at.gv.egovernment.moa.spss.api.xmlbind - - - Utilities - at.gv.egovernment.moa.util - at.gv.egovernment.moa.spss.util - - - Logging - at.gv.egovernment.moa.logging - - - http://java.sun.com/j2se/1.4/docs/api/ - - - - generate-javadoc - package - - jar - - - - - - - - + + + MOA.spss + moa-spss + 1.4.x + + + 4.0.0 + MOA.spss.server + moa-spss-lib + jar + 1.4.2 + MOA SP/SS API + + + ${basedir}/../../../repository + + + + + axis + axis + + + commons-discovery + commons-discovery + + + commons-logging + commons-logging + + + javax.activation + activation + + + javax.mail + mail + + + junit + junit + + + log4j + log4j + + + postgresql + postgresql + + + javax.servlet + servlet-api + provided + + + xalan-bin-dist + xalan + compile + + + xerces + xercesImpl + + + xalan-bin-dist + xml-apis + + + xalan-bin-dist + serializer + + + iaik.prod + iaik_moa + + + iaik.prod + iaik_ixsil + + + iaik.prod + iaik_jce_full + compile + + + iaik.prod + iaik_ecc + compile + + + iaik.prod + iaik_cms + runtime + + + iaik.prod + iaik_Pkcs11Provider + runtime + + + iaik.prod + iaik_Pkcs11Wrapper + runtime + + + iaik.prod + iaik_Pkcs11Wrapper + win32 + dll + runtime + true + + + MOA + moa-common + jar + + + MOA + moa-common + test-jar + + + MOA.spss.server + moa-spss-tools + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + false + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.2 + + true + false + false + true + at.gv.egovernment.moa.spss.server.*;at.gv.egovernment.moa.spss.api.impl.*;at.gv.egovernment.moa.spss.impl.* + + + pre + a + Preconditions: + + + post + a + Postconditions: + + + + + API Factory and Services + at.gv.egovernment.moa.spss.api + + + Exceptions + at.gv.egovernment.moa.spss + + + API Objects for Signature Creation + at.gv.egovernment.moa.spss.api.xmlsign + + + API Objects for CMS Signature Verification + at.gv.egovernment.moa.spss.api.cmsverify + + + API Objects for XML Signature Verification + at.gv.egovernment.moa.spss.api.xmlverify + + + Common API Objects + at.gv.egovernment.moa.spss.api.common + + + Builders and Parsers to convert API Objects to and from XML + at.gv.egovernment.moa.spss.api.xmlbind + + + Utilities + at.gv.egovernment.moa.util + at.gv.egovernment.moa.spss.util + + + Logging + at.gv.egovernment.moa.logging + + + http://java.sun.com/j2se/1.4/docs/api/ + + + + generate-javadoc + package + + jar + + + + + + + + diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/AllTests.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/AllTests.java deleted file mode 100644 index c670b5e55..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/AllTests.java +++ /dev/null @@ -1,40 +0,0 @@ -package test.at.gv.egovernment.moa.spss; - -import test.at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImplTest; -import test.at.gv.egovernment.moa.spss.server.iaik.config.IaikConfiguratorTest; -import test.at.gv.egovernment.moa.spss.server.tools.CertToolTest; - -import junit.awtui.TestRunner; -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Test suite for all unit tests. - * - * @author Patrick Peck - * @version $Id$ - */ -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(test.at.gv.egovernment.moa.spss.server.config.AllTests.class); - suite.addTestSuite(ConfigurationDataImplTest.class); - suite.addTestSuite(IaikConfiguratorTest.class); - suite.addTest( - test.at.gv.egovernment.moa.spss.server.invoke.AllTests.suite()); - suite.addTest(test.at.gv.egovernment.moa.spss.api.xmlbind.AllTests.suite()); - suite.addTestSuite(CertToolTest.class); - - return suite; - } - - public static void main(String[] args) { - try { - TestRunner.run(AllTests.class); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/SPSSTestCase.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/SPSSTestCase.java deleted file mode 100644 index a585e30a0..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/SPSSTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -package test.at.gv.egovernment.moa.spss; - -import java.security.Security; - -import test.at.gv.egovernment.moa.MOATestCase; - -import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.logging.LoggingContext; -import at.gv.egovernment.moa.logging.LoggingContextManager; -import at.gv.egovernment.moa.util.MessageProvider; - -import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; -import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; - -/** - * Base class for MOA test cases. - * - * Provides some utility functions. - * - * @author Patrick Peck - * @version $Id$ - */ -public class SPSSTestCase extends MOATestCase { - - protected static final String TESTDATA_ROOT = "data/test/"; - - /** - * Constructor for MOATestCase. - * @param arg0 - */ - public SPSSTestCase(String name) { - super(name); - } - - /** - * Set up a transaction context with a test configuration. - */ - protected void setUpTransactionContext() throws Exception { - System.setProperty( - ConfigurationProvider.CONFIG_PROPERTY_NAME, - "data/test/conf/moa-spss/MOA-SPSSConfiguration.xml"); - ConfigurationProvider config = ConfigurationProvider.getInstance(); - TransactionContext context = new TransactionContext("test", null, config); - TransactionContextManager.getInstance().setTransactionContext(context); - } - - protected void setUpLoggingContext() throws Exception { - LoggingContext context = new LoggingContext("test"); - LoggingContextManager.getInstance().setLoggingContext(context); - } - - /** - * Configure the IAIK modules with the current configuration. - * - * A TransactionContext must have been set up before. - */ - protected void setUpIaikConfiguration() throws Exception { - TransactionContext context = - TransactionContextManager.getInstance().getTransactionContext(); - ClassLoader cl = getClass().getClassLoader(); - MessageProvider msg = MessageProvider.getInstance(); - - try { - cl.loadClass("javax.security.cert.Certificate"); // from jcert.jar - } catch (ClassNotFoundException e) { - Logger.warn(msg.getMessage("init.03", null), e); - } - - new IaikConfigurator().configure(context.getConfiguration()); - } - - protected void setUpSSL() throws Exception { - //System.setProperty("javax.net.debug", "all"); - Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - System.setProperty( - "java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java deleted file mode 100644 index 28f79729e..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java +++ /dev/null @@ -1,24 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Runs all tests in this package. - * - * @author Patrick Peck - * @version $Id$ - */ -public class AllTests { - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(CreateXMLSignatureRequestParserTest.class); - suite.addTestSuite(TransformParserTest.class); - suite.addTestSuite(VerifyCMSSignatureRequestParserTest.class); - suite.addTestSuite(VerifyXMLSignatureRequestParserTest.class); - - return suite; - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java deleted file mode 100644 index 7ce705b01..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileExplicit; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo; -import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; - -/** - * Test the CreateXMLSignatureRequestParser. - * - * @author Patrick Peck - * @version $Id$ - */ -public class CreateXMLSignatureRequestParserTest extends SPSSTestCase { - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/CreateXMLSignature/"; - - private CreateXMLSignatureRequestParser requestParser; - - public CreateXMLSignatureRequestParserTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - requestParser = new CreateXMLSignatureRequestParser(); - } - - public void testParse() throws Exception { - Element requestElem = - parseXml(TESTDATA_BASE + "TestGeneratorCX2.001.Req.xml") - .getDocumentElement(); - CreateXMLSignatureRequest request = requestParser.parse(requestElem); - SingleSignatureInfo sigInfo; - DataObjectInfo dataObjInfo; - CreateTransformsInfoProfileExplicit transProfile; - CreateSignatureEnvironmentProfileExplicit envProfile; - - assertNotNull(request); - assertEquals("PKCS12RSAKey1", request.getKeyIdentifier()); - assertEquals(1, request.getSingleSignatureInfos().size()); - - sigInfo = (SingleSignatureInfo) request.getSingleSignatureInfos().get(0); - assertEquals(1, sigInfo.getDataObjectInfos().size()); - assertFalse(sigInfo.isSecurityLayerConform()); - - dataObjInfo = (DataObjectInfo) sigInfo.getDataObjectInfos().get(0); - assertNotNull(dataObjInfo.getDataObject()); - - transProfile = - (CreateTransformsInfoProfileExplicit) dataObjInfo - .getCreateTransformsInfoProfile(); - assertNotNull( - transProfile.getCreateTransformsInfo().getFinalDataMetaInfo()); - - envProfile = - (CreateSignatureEnvironmentProfileExplicit) sigInfo - .getCreateSignatureInfo() - .getCreateSignatureEnvironmentProfile(); - assertEquals( - "//data:Document", - envProfile.getCreateSignatureLocation().getXPathExpression()); - assertEquals(0, envProfile.getCreateSignatureLocation().getIndex()); - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java deleted file mode 100644 index f580f86bc..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import java.util.List; - -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform; -import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform; -import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform; -import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform; -import at.gv.egovernment.moa.spss.api.common.XPathTransform; -import at.gv.egovernment.moa.spss.api.common.XSLTTransform; -import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; - -/** - * Test the TransformParser. - * - * @author Patrick Peck - * @version $Id$ - */ -public class TransformParserTest extends SPSSTestCase { - private static String TESTDATA_BASE = TESTDATA_ROOT + "xml/dsigTransform/"; - - private TransformParser transformParser; - - public TransformParserTest(String name) { - super(name); - } - - protected void setUp() { - transformParser = new TransformParser(); - } - - public void testParseTransforms() throws Exception { - Element transformsElem = - parseXml(TESTDATA_BASE + "transforms.xml").getDocumentElement(); - List transforms = transformParser.parseTransforms(transformsElem); - - assertNotNull(transforms); - assertEquals(3, transforms.size()); - - } - - public void testParseCanonicalizationTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "canonicalization.xml").getDocumentElement(); - CanonicalizationTransform transform = - (CanonicalizationTransform) transformParser.parseTransform(transformElem); - - assertNotNull(transform); - assertEquals( - CanonicalizationTransform.CANONICAL_XML, - transform.getAlgorithmURI()); - } - - public void testParseExclCanonicalizationTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "exclusiveCanonicalization.xml") - .getDocumentElement(); - ExclusiveCanonicalizationTransform transform = - (ExclusiveCanonicalizationTransform) transformParser.parseTransform( - transformElem); - - assertNotNull(transform); - assertEquals( - ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML, - transform.getAlgorithmURI()); - assertEquals(3, transform.getInclusiveNamespacePrefixes().size()); - } - - public void testParseEnvelopedTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "enveloped.xml").getDocumentElement(); - EnvelopedSignatureTransform transform = - (EnvelopedSignatureTransform) transformParser.parseTransform( - transformElem); - - assertNotNull(transform); - } - - public void testParseXPathTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "xpath.xml").getDocumentElement(); - XPathTransform transform = - (XPathTransform) transformParser.parseTransform(transformElem); - - assertNotNull(transform); - assertEquals("//ToBeSigned/Data", transform.getXPathExpression()); - assertEquals(1, transform.getNamespaceDeclarations().size()); - } - - public void testParseXPathFilter2Transform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "xpath2.xml").getDocumentElement(); - XPathFilter2Transform transform = - (XPathFilter2Transform) transformParser.parseTransform(transformElem); - - assertNotNull(transform); - assertEquals(3, transform.getFilters().size()); - } - - public void testParseXSLTTransform() throws Exception { - Element transformElem = - parseXml(TESTDATA_BASE + "xslt.xml").getDocumentElement(); - XSLTTransform transform = - (XSLTTransform) transformParser.parseTransform(transformElem); - - assertNotNull(transform); - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java deleted file mode 100644 index 4be7667eb..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.util.DateTimeUtils; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentExcplicit; -import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; -import at.gv.egovernment.moa.spss.api.common.MetaInfo; -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; - -/** - * Test the VerifyCMSSignatureRequestParserTest. - * - * @author Patrick Peck - * @version $Id$ - */ -public class VerifyCMSSignatureRequestParserTest extends SPSSTestCase { - private static String TESTDATA_BASE = - TESTDATA_ROOT + "xml/VerifyCMSSignature/"; - - private VerifyCMSSignatureRequestParser requestParser; - - public VerifyCMSSignatureRequestParserTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - requestParser = new VerifyCMSSignatureRequestParser(); - } - - public void testParse() throws Exception { - Element requestElem = - parseXml(TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml") - .getDocumentElement(); - VerifyCMSSignatureRequest request = requestParser.parse(requestElem); - MetaInfo metaInfo; - CMSContentExcplicit content; - - assertNotNull(request); - assertEquals(1, request.getSignatories()[0]); - assertEquals( - DateTimeUtils.parseDateTime("2003-04-04T09:30:47-05:00"), - request.getDateTime()); - assertNotNull(request.getCMSSignature()); - assertNotNull(request.getDataObject()); - assertEquals("TrustProfile1", request.getTrustProfileId()); - - metaInfo = request.getDataObject().getMetaInfo(); - assertNotNull(metaInfo); - assertEquals("text/plain", metaInfo.getMimeType()); - assertEquals("http://10.16.46.109/TestDatenGenerator/resources/testDaten.txt", metaInfo.getDescription()); - - content = (CMSContentExcplicit) request.getDataObject().getContent(); - assertNotNull(content.getBinaryContent()); - - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java deleted file mode 100644 index 3b8e8b00e..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package test.at.gv.egovernment.moa.spss.api.xmlbind; - -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.util.DateTimeUtils; - -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; -import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; -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.VerifyTransformsInfoProfileExplicit; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; - -/** - * Test the VerifyXMLSignatureRequestParserTest. - * - * @author Patrick Peck - * @version $Id$ - */ -public class VerifyXMLSignatureRequestParserTest extends SPSSTestCase { - private static String TESTDATA_BASE = - TESTDATA_ROOT + "xml/VerifyXMLSignature/"; - - private VerifyXMLSignatureRequestParser parser; - - public VerifyXMLSignatureRequestParserTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - parser = new VerifyXMLSignatureRequestParser(); - } - - public void testParse() throws Exception { - Element requestElem = - parseXml(TESTDATA_BASE + "TestGeneratorVX.201.Req.xml") - .getDocumentElement(); - VerifyXMLSignatureRequest request = parser.parse(requestElem); - VerifySignatureInfo verifySignatureInfo; - VerifySignatureLocation verifyLocation; - SignatureManifestCheckParams checkParams; - ReferenceInfo refInfo; - VerifyTransformsInfoProfileExplicit transformsProfile; - - assertNotNull(request); - assertEquals( - DateTimeUtils.parseDateTime("2003-04-01T12:53:57+01:00"), - request.getDateTime()); - assertFalse(request.getReturnHashInputData()); - assertEquals("TrustProfile1", request.getTrustProfileId()); - - verifySignatureInfo = request.getSignatureInfo(); - assertNotNull(verifySignatureInfo); - assertNotNull(verifySignatureInfo.getVerifySignatureEnvironment()); - - verifyLocation = verifySignatureInfo.getVerifySignatureLocation(); - assertNotNull(verifyLocation); - assertEquals("//dsig:Signature", verifyLocation.getXPathExpression()); - assertEquals(3, verifyLocation.getNamespaceDeclarations().size()); - - checkParams = request.getSignatureManifestCheckParams(); - assertNotNull(checkParams); - assertEquals(true, checkParams.getReturnReferenceInputData()); - assertEquals(1, checkParams.getReferenceInfos().size()); - - refInfo = (ReferenceInfo) checkParams.getReferenceInfos().get(0); - assertEquals(1, refInfo.getVerifyTransformsInfoProfiles().size()); - - transformsProfile = - (VerifyTransformsInfoProfileExplicit) refInfo - .getVerifyTransformsInfoProfiles() - .get(0); - assertEquals(1, transformsProfile.getTransforms().size()); - assertEquals(1, transformsProfile.getTransformParameters().size()); - - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/AllTests.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/AllTests.java deleted file mode 100644 index 131f38c19..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/AllTests.java +++ /dev/null @@ -1,20 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.config; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author Gregor Karlinger - * @version $Id$ - */ -public class AllTests -{ - public static Test suite() - { - TestSuite suite = new TestSuite(); - suite.addTestSuite(ConfigurationProviderTest1.class); - suite.addTestSuite(ConfigurationProviderTest2.class); - suite.addTestSuite(ConfigurationProviderTest3.class); - return suite; - } -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java deleted file mode 100644 index 474a387ad..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java +++ /dev/null @@ -1,377 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.config; - -import iaik.asn1.structures.Name; -import iaik.pki.pathvalidation.ChainingModes; -import iaik.utils.RFC2253NameParser; -import iaik.utils.RFC2253NameParserException; -import iaik.x509.X509Certificate; - -import java.math.BigInteger; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import junit.framework.TestCase; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.spss.MOAException; -import at.gv.egovernment.moa.spss.server.config.CRLDistributionPoint; -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.config.HardwareCryptoModule; -import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule; -import at.gv.egovernment.moa.spss.server.config.KeyGroup; -import at.gv.egovernment.moa.spss.server.config.KeyGroupEntry; -import at.gv.egovernment.moa.spss.server.config.OCSPDistributionPoint; -import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule; -import at.gv.egovernment.moa.spss.server.config.TrustProfile; -import at.gv.egovernment.moa.util.Constants; - -/** - * @author Gregor Karlinger - * @version $Id$ - */ -public class ConfigurationProviderTest1 extends TestCase -{ - private static final String CONFIG_BASE_ = - "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; - - static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; - - static - { - System.setProperty( - "log4j.configuration", - "file:/" + CONFIG_BASE_ + "log4j.properties"); - System.setProperty( - at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, - CONFIG_BASE_ + "moa.spss.complete-config.xml"); - try - { - ConfigurationProvider.reload(); - provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); - } - catch (ConfigurationException e) - { - throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); - } - } - - /** - * Constructor for ConfigurationProvider. - * @param arg0 - */ - public ConfigurationProviderTest1() throws MOAException - { - super("ConfigurationProvider"); - } - - public void testGetWarnings() - { - assertEquals(0, provider_.getWarnings().size()); - } - - public void testGetDigestMethodAlgorithmName() - { - assertEquals( - Constants.SHA1_URI, - provider_.getDigestMethodAlgorithmName()); - } - - public void testGetCanonicalizationAlgorithmName() - { - assertEquals( - Constants.C14N_WITH_COMMENTS_URI, - provider_.getCanonicalizationAlgorithmName()); - } - - public void testGetHardwareCryptoModules() - { - List hwcms = provider_.getHardwareCryptoModules(); - assertEquals(2, hwcms.size()); - - HardwareCryptoModule hwc1 = (HardwareCryptoModule) hwcms.get(0); - assertEquals("HWC1_Name", hwc1.getName()); - assertEquals("HWC1_SlotId", hwc1.getSlotID()); - assertEquals("HWC1_UserPIN", hwc1.getUserPIN()); - - HardwareCryptoModule hwc2 = (HardwareCryptoModule) hwcms.get(1); - assertEquals("HWC2_Name", hwc2.getName()); - assertNull(hwc2.getSlotID()); - assertEquals("HWC2_UserPIN", hwc2.getUserPIN()); - } - - public void testGetHardwareKeyModules() - { - List hwkms = provider_.getHardwareKeyModules(); - assertEquals(2, hwkms.size()); - - HardwareKeyModule hwk1 = (HardwareKeyModule) hwkms.get(0); - assertEquals("HWK1_Id", hwk1.getId()); - assertEquals("HWK1_Name", hwk1.getName()); - assertEquals("HWK1_SlotId", hwk1.getSlotID()); - assertEquals("HWK1_UserPIN", hwk1.getUserPIN()); - - HardwareKeyModule hwk2 = (HardwareKeyModule) hwkms.get(1); - assertEquals("HWK2_Id", hwk2.getId()); - assertEquals("HWK2_Name", hwk2.getName()); - assertNull(hwk2.getSlotID()); - assertEquals("HWK2_UserPIN", hwk2.getUserPIN()); - } - - public void testGetSoftwareKeyModules() - { - List swkms = provider_.getSoftwareKeyModules(); - assertEquals(2, swkms.size()); - - SoftwareKeyModule swk1 = (SoftwareKeyModule) swkms.get(0); - assertEquals("SWK1_Id", swk1.getId()); - assertEquals(CONFIG_BASE_ + "swk/SWK1_FileName.txt", swk1.getFileName().replace('\\', '/')); - assertEquals("SWK1_Password", swk1.getPassWord()); - - SoftwareKeyModule swk2 = (SoftwareKeyModule) swkms.get(1); - assertEquals("SWK2_Id", swk2.getId()); - assertEquals(CONFIG_BASE_ + "swk/SWK2_FileName.txt", swk2.getFileName().replace('\\', '/')); - assertNull(swk2.getPassWord()); - } - - public void testGetKeyGroups() - { - Map keyGroups = provider_.getKeyGroups(); - assertEquals(2, keyGroups.size()); - - KeyGroup kg1 = (KeyGroup) keyGroups.get("KG1_Id"); - assertNotNull(kg1); - assertEquals("KG1_Id", kg1.getId()); - - Set kg1Entries = kg1.getKeyGroupEntries(); - assertEquals(2, kg1Entries.size()); - - Iterator kg1EntriesIt = kg1Entries.iterator(); - while(kg1EntriesIt.hasNext()) - { - KeyGroupEntry currentEntry = (KeyGroupEntry)kg1EntriesIt.next(); - if ("HWK1_Id".equals(currentEntry.getModuleID())) - { - assertEquals("CN=HWK1_Issuer", currentEntry.getIssuerDN()); - assertEquals(0, currentEntry.getSerialNumber().intValue()); - } - else if ("HWK2_Id".equals(currentEntry.getModuleID())) - { - assertEquals("CN=HWK2_Issuer", currentEntry.getIssuerDN()); - assertEquals(1, currentEntry.getSerialNumber().intValue()); - } - else fail("Invalid module identifer found."); - } - - KeyGroup kg2 = (KeyGroup) keyGroups.get("KG2_Id"); - assertNotNull(kg2); - assertEquals("KG2_Id", kg2.getId()); - - Set kg2Entries = kg2.getKeyGroupEntries(); - assertEquals(2, kg2Entries.size()); - - Iterator kg2EntriesIt = kg1Entries.iterator(); - while(kg1EntriesIt.hasNext()) - { - KeyGroupEntry currentEntry = (KeyGroupEntry)kg2EntriesIt.next(); - if ("SWK1_Id".equals(currentEntry.getModuleID())) - { - assertEquals("CN=CN=SWK1_Issuer", currentEntry.getIssuerDN()); - assertEquals(2, currentEntry.getSerialNumber().intValue()); - } - else if ("SWK2_Id".equals(currentEntry.getModuleID())) - { - assertEquals("CN=SWK2_Issuer", currentEntry.getIssuerDN()); - assertEquals(3, currentEntry.getSerialNumber().intValue()); - } - else fail("Invalid module identifer found."); - } - } - - public void testGetKeyGroupEntries() throws RFC2253NameParserException - { - RFC2253NameParser parser = new RFC2253NameParser("CN=Customer1_Issuer"); - Name name = parser.parse(); - Set kgEntries = provider_.getKeyGroupEntries(name, BigInteger.valueOf(4), "KG1_Id"); - assertEquals(2, kgEntries.size()); - - Iterator kgEntriesIt = kgEntries.iterator(); - while (kgEntriesIt.hasNext()) - { - KeyGroupEntry currentEntry = (KeyGroupEntry) kgEntriesIt.next(); - if (!"HWK1_Id".equals(currentEntry.getModuleID()) && !"HWK2_Id".equals(currentEntry.getModuleID())) - { - fail("Invalid module identifier found."); - } - } - } - - public void testGetChainingMode() throws RFC2253NameParserException - { - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); - Name name = parser.parse(); - cert.setIssuerDN(name); - cert.setSerialNumber(BigInteger.valueOf(0)); - assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); // Default chaining mode - - parser = new RFC2253NameParser("CN=TA1_Issuer"); - name = parser.parse(); - cert.setIssuerDN(name); - cert.setSerialNumber(BigInteger.valueOf(5)); - assertEquals(ChainingModes.CHAIN_MODE, provider_.getChainingMode(cert)); - } - - public void testGetDistributionPoints() throws RFC2253NameParserException - { - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); - Name name = parser.parse(); - cert.setIssuerDN(name); - - Set dps = provider_.getDistributionPoints(cert); - assertEquals(2, dps.size()); - - Iterator dpIt = dps.iterator(); - while (dpIt.hasNext()) - { - CRLDistributionPoint currentDP = (CRLDistributionPoint)dpIt.next(); - if ("http://crl.myca.org".equals(currentDP.getUri())) - { - int reasonCodes = - iaik.asn1.structures.DistributionPoint.unused | - iaik.asn1.structures.DistributionPoint.keyCompromise | - iaik.asn1.structures.DistributionPoint.cACompromise | - iaik.asn1.structures.DistributionPoint.affiliationChanged | - iaik.asn1.structures.DistributionPoint.superseded | - iaik.asn1.structures.DistributionPoint.cessationOfOperation | - iaik.asn1.structures.DistributionPoint.certificateHold | - iaik.asn1.structures.DistributionPoint.privilegeWithdrawn | - iaik.asn1.structures.DistributionPoint.aACompromise; - assertEquals(reasonCodes, currentDP.getReasonCodes()); - } - else if ("http://crl.myotherca.org".equals(currentDP.getUri())) - { - int reasonCodes = - iaik.asn1.structures.DistributionPoint.aACompromise | - iaik.asn1.structures.DistributionPoint.affiliationChanged; - assertEquals(reasonCodes, currentDP.getReasonCodes()); - } - else fail("Invalid CRL DP URI found: " + currentDP.getUri()); - } - - parser = new RFC2253NameParser("CN=DP2_Issuer"); - name = parser.parse(); - cert.setIssuerDN(name); - - dps = provider_.getDistributionPoints(cert); - assertEquals(1, dps.size()); - - OCSPDistributionPoint dpo = (OCSPDistributionPoint) dps.toArray()[0]; - assertEquals("http://crl.yetanotherca.org", dpo.getUri()); - } - - public void testGetCRLArchiveDuration() - { - assertEquals(730, provider_.getCRLArchiveDuration()); - } - - public void testGetEnableRevocationArchiving() - { - assertFalse(provider_.getEnableRevocationArchiving()); - } - - public void testGetCertStoreLocation() - { - assertEquals( - CONFIG_BASE_ + "certstore_test", - provider_.getCertStoreLocation().replace('\\', '/')); - } - - public void testGetCreateTransformsInfoProfile() - { - Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); - assertEquals("CreateTransformsInfoProfile", ctip1.getLocalName()); - - Element ctip2 = provider_.getCreateTransformsInfoProfile("CTIP_2"); - assertEquals("CreateTransformsInfoProfile", ctip2.getLocalName()); - } - - public void testGetCreateSignatureEnvironmentProfile() - { - Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); - assertEquals("CreateSignatureEnvironmentProfile", csep.getLocalName()); - } - - public void testGetVerifyTransformsInfoProfile() - { - Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); - assertEquals("VerifyTransformsInfoProfile", vtip.getLocalName()); - } - - public void testGetSupplementProfile() - { - Element sp = provider_.getSupplementProfile("SP_1"); - assertEquals("SupplementProfile", sp.getLocalName()); - } - - public void testGetTrustProfile() - { - TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); - assertEquals( - "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/anchors", - tp1.getUri()); - assertEquals( - "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/signercerts", - tp1.getSignerCertsUri()); - - TrustProfile tp2 = provider_.getTrustProfile("TP2_Id"); - assertEquals( - "file:" + CONFIG_BASE_ + "trustprofiles/tp2/anchors", - tp2.getUri()); - assertEquals( - "file:" + CONFIG_BASE_ + "trustprofiles/tp2/signercerts", - tp2.getSignerCertsUri()); - } - - public void testGetRevocationArchiveJDBCURL() - { - assertEquals("jdbc://dummy", provider_.getRevocationArchiveJDBCURL()); - } - - public void testGetRevocationArchiveJDBCDriverClass() - { - assertEquals("fully.qualified.classname", provider_.getRevocationArchiveJDBCDriverClass()); - } - - public void testGetEnableRevocationChecking() - { - assertFalse(provider_.getEnableRevocationChecking()); - } - - public void testGetMaxRevocationAge() - { - assertEquals(10000, provider_.getMaxRevocationAge()); - } - - public void testGetServiceOrder() - { - String[] serviceOrder = provider_.getServiceOrder(); - assertEquals(2, serviceOrder.length); - assertEquals("crl", serviceOrder[0]); - assertEquals("ocsp", serviceOrder[1]); - } - - public void testGetAutoAddCertificates() - { - assertFalse(provider_.getAutoAddCertificates()); - } - - public void testGetUseAuthorityInfoAccess() - { - assertFalse(provider_.getUseAuthorityInfoAccess()); - } -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java deleted file mode 100644 index adf02809b..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java +++ /dev/null @@ -1,225 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.config; - -import iaik.asn1.structures.Name; -import iaik.pki.pathvalidation.ChainingModes; -import iaik.utils.RFC2253NameParser; -import iaik.utils.RFC2253NameParserException; -import iaik.x509.X509Certificate; - -import java.math.BigInteger; -import java.util.List; -import java.util.Set; - -import junit.framework.TestCase; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.spss.MOAException; -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.config.TrustProfile; -import at.gv.egovernment.moa.util.Constants; - -/** - * @author Gregor Karlinger - * @version $Id$ - */ -public class ConfigurationProviderTest2 extends TestCase -{ - private static final String CONFIG_BASE_ = - "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; - - static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; - - static - { - System.setProperty( - "log4j.configuration", - "file:/" + CONFIG_BASE_ + "log4j.properties"); - System.setProperty( - at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, - CONFIG_BASE_ + "moa.ss.noopts-config.xml"); - try - { - ConfigurationProvider.reload(); - provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); - } - catch (ConfigurationException e) - { - throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); - } - } - - - /** - * Constructor for ConfigurationProvider. - * @param arg0 - */ - public ConfigurationProviderTest2() throws MOAException - { - super("ConfigurationProvider"); - } - - public void testGetWarnings() - { - // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found - assertEquals(3, provider_.getWarnings().size()); - } - - public void testGetDigestMethodAlgorithmName() - { - // Element is missing in config file, check if default value is returned - assertEquals( - Constants.SHA1_URI, - provider_.getDigestMethodAlgorithmName()); - } - - public void testGetCanonicalizationAlgorithmName() - { - // Element is missing in config file, check if default value is returned - assertEquals( - Constants.C14N_URI, - provider_.getCanonicalizationAlgorithmName()); - } - - public void testGetHardwareCryptoModules() - { - // No hardware crypto modules in config file, check for empty list - List hwcms = provider_.getHardwareCryptoModules(); - assertEquals(0, hwcms.size()); - } - - public void testGetHardwareKeyModules() - { - List hwkms = provider_.getHardwareKeyModules(); - assertEquals(1, hwkms.size()); - } - - public void testGetSoftwareKeyModules() - { - // No software key modules in config file, check for empty list - List swkms = provider_.getSoftwareKeyModules(); - assertEquals(0, swkms.size()); - } - - public void testGetChainingMode() throws RFC2253NameParserException - { - // Default Chaining Mode not set in configuration, check for default value - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); - Name name = parser.parse(); - cert.setIssuerDN(name); - cert.setSerialNumber(BigInteger.valueOf(0)); - assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); - } - - public void testGetDistributionPoints() throws RFC2253NameParserException - { - // Element is missing in config file, check if emty list is returned - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); - Name name = parser.parse(); - cert.setIssuerDN(name); - - Set dps = provider_.getDistributionPoints(cert); - assertEquals(0, dps.size()); - } - - public void testGetCRLArchiveDuration() - { - // Element is missing in config file, check if default value is returned - assertEquals(0, provider_.getCRLArchiveDuration()); - } - - public void testGetEnableRevocationArchiving() - { - // Element is missing in config file, check if default value is returned - assertFalse(provider_.getEnableRevocationArchiving()); - } - - public void testGetCertStoreLocation() - { - // Element is missing in config file, check if default value is returned - assertEquals( - CONFIG_BASE_ + "certstore", - provider_.getCertStoreLocation().replace('\\', '/')); - } - - public void testGetCreateTransformsInfoProfile() - { - // No profile in config file, check for null - Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); - assertNull(ctip1); - } - - public void testGetCreateSignatureEnvironmentProfile() - { - // No profile in config file, check for null - Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); - assertNull(csep); - } - - public void testGetVerifyTransformsInfoProfile() - { - // No profile in config file, check for null - Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); - assertNull(vtip); - } - - public void testGetSupplementProfile() - { - // No profile in config file, check for null - Element sp = provider_.getSupplementProfile("SP_1"); - assertNull(sp); - } - - public void testGetTrustProfile() - { - // No trust profiles config file, check for null - TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); - assertNull(tp1); - } - - public void testGetRevocationArchiveJDBCURL() - { - // Element is missing in config file, check for null - assertNull(provider_.getRevocationArchiveJDBCURL()); - } - - public void testGetRevocationArchiveJDBCDriverClass() - { - // Element is missing in config file, check for null - assertNull(provider_.getRevocationArchiveJDBCDriverClass()); - } - - public void testGetEnableRevocationChecking() - { - // Element is missing in config file, check for default value - assertFalse(provider_.getEnableRevocationChecking()); - } - - public void testGetMaxRevocationAge() - { - // Element is missing in config file, check for default value - assertEquals(0, provider_.getMaxRevocationAge()); - } - - public void testGetServiceOrder() - { - // Element is missing in config file, check for empty array - String[] serviceOrder = provider_.getServiceOrder(); - assertEquals(0, serviceOrder.length); - } - - public void testGetAutoAddCertificates() - { - // Element is missing in config file, check for default value - assertFalse(provider_.getAutoAddCertificates()); - } - - public void testGetUseAuthorityInfoAccess() - { - // Element is missing in config file, check for default value - assertFalse(provider_.getUseAuthorityInfoAccess()); - } -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java deleted file mode 100644 index 7da2165cb..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java +++ /dev/null @@ -1,166 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.config; - -import iaik.asn1.structures.Name; -import iaik.utils.RFC2253NameParser; -import iaik.utils.RFC2253NameParserException; -import iaik.x509.X509Certificate; - -import java.util.List; -import java.util.Set; - -import junit.framework.TestCase; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.spss.MOAException; -import at.gv.egovernment.moa.spss.server.config.ConfigurationException; -import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; -import at.gv.egovernment.moa.util.Constants; - -/** - * @author Gregor Karlinger - * @version $Id$ - */ -public class ConfigurationProviderTest3 extends TestCase -{ - private static final String CONFIG_BASE_ = - "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; - - static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; - - static - { - System.setProperty( - "log4j.configuration", - "file:/" + CONFIG_BASE_ + "log4j.properties"); - System.setProperty( - at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, - CONFIG_BASE_ + "moa.sp.noopts-config.xml"); - try - { - ConfigurationProvider.reload(); - provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); - } - catch (ConfigurationException e) - { - throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); - } - } - - /** - * Constructor for ConfigurationProvider. - * @param arg0 - */ - public ConfigurationProviderTest3() throws MOAException - { - super("ConfigurationProvider"); - } - - public void testGetWarnings() - { - // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found - assertEquals(3, provider_.getWarnings().size()); - } - - public void testGetDigestMethodAlgorithmName() - { - // Element is missing in config file, check if default value is returned - assertEquals( - Constants.SHA1_URI, - provider_.getDigestMethodAlgorithmName()); - } - - public void testGetCanonicalizationAlgorithmName() - { - // Element is missing in config file, check if default value is returned - assertEquals( - Constants.C14N_URI, - provider_.getCanonicalizationAlgorithmName()); - } - - public void testGetHardwareCryptoModules() - { - // No hardware crypto modules in config file, check for empty list - List hwcms = provider_.getHardwareCryptoModules(); - assertEquals(0, hwcms.size()); - } - - public void testGetHardwareKeyModules() - { - // No hardware key modules in config file, check for empty list - List hwkms = provider_.getHardwareKeyModules(); - assertEquals(0, hwkms.size()); - } - - public void testGetSoftwareKeyModules() - { - // No software key modules in config file, check for empty list - List swkms = provider_.getSoftwareKeyModules(); - assertEquals(0, swkms.size()); - } - - public void testGetDistributionPoints() throws RFC2253NameParserException - { - // No distribution points in config file, check for emtpy set - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); - Name name = parser.parse(); - cert.setIssuerDN(name); - - Set dps = provider_.getDistributionPoints(cert); - assertEquals(0, dps.size()); - } - - public void testGetCRLArchiveDuration() - { - // No archive duration in config file, check for default value - assertEquals(0, provider_.getCRLArchiveDuration()); - } - - public void testGetCreateTransformsInfoProfile() - { - // No profile in config file, check for null - Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); - assertNull(ctip1); - } - - public void testGetCreateSignatureEnvironmentProfile() - { - // No profile in config file, check for null - Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); - assertNull(csep); - } - - public void testGetVerifyTransformsInfoProfile() - { - // No profile in config file, check for null - Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); - assertNull(vtip); - } - - public void testGetSupplementProfile() - { - // No profile in config file, check for null - Element sp = provider_.getSupplementProfile("SP_1"); - assertNull(sp); - } - - public void testGetRevocationArchiveJDBCURL() - { - // No archive in config file, check for null - assertNull(provider_.getRevocationArchiveJDBCURL()); - } - - public void testGetRevocationArchiveJDBCDriverClass() - { - // No archive in config file, check for null - assertNull(provider_.getRevocationArchiveJDBCDriverClass()); - } - - public void testGetServiceOrder() - { - // Element is missing in config file, check for empty array - String[] serviceOrder = provider_.getServiceOrder(); - assertEquals(0, serviceOrder.length); - } -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java deleted file mode 100644 index be1090e4a..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java +++ /dev/null @@ -1,149 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.iaik.config; - -import java.io.FileInputStream; -import java.security.KeyStore; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import iaik.asn1.structures.DistributionPoint; -import iaik.pki.PKIConfiguration; -import iaik.pki.pathvalidation.ChainingModes; -import iaik.pki.pathvalidation.ValidationConfiguration; -import iaik.pki.revocation.CRLDistributionPoint; -import iaik.pki.revocation.RevocationConfiguration; -import iaik.pki.store.certstore.CertStoreConfiguration; -import iaik.pki.store.certstore.CertStoreTypes; -import iaik.pki.store.revocation.archive.ArchiveConfiguration; -import iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter; -import iaik.server.ConfigurationData; -import iaik.server.modules.keys.HardwareKeyModuleConfiguration; -import iaik.server.modules.keys.SoftwareKeyModuleConfiguration; - -import at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImpl; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; - -/** - * Tests the ConfigurationDataImpl. - * - * @author Patrick Peck - * @version $Id$ - */ -public class ConfigurationDataImplTest extends SPSSTestCase { - - private ConfigurationData config; - private X509Certificate iaikCert; - - public ConfigurationDataImplTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - TransactionContext context; - - setUpTransactionContext(); - context = TransactionContextManager.getInstance().getTransactionContext(); - - config = new ConfigurationDataImpl(context.getConfiguration()); - - KeyStore ks = KeyStore.getInstance("JKS", "SUN"); - ks.load( - new FileInputStream(TESTDATA_ROOT + "security/server.keystore"), - "changeit".toCharArray()); - - CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); - Collection certs = - certFactory.generateCertificates( - new FileInputStream( - TESTDATA_ROOT - + "conf/moa-spss/trustprofiles/TrustProfile1/IAIKRoot.cer")); - iaikCert = (X509Certificate) certs.toArray()[0]; - - } - - public void testGetPKIConfiguration() { - PKIConfiguration pkiConfig = config.getPKIConfiguration(); - ArchiveConfiguration archiveConfig = pkiConfig.getArchiveConfiguration(); - CertStoreConfiguration certStoreConfig = - pkiConfig.getCertStoreConfiguration(); - RevocationConfiguration revocationConfig = - pkiConfig.getRevocationConfiguration(); - ValidationConfiguration validationConfig = - pkiConfig.getValidationConfiguration(); - DataBaseArchiveParameter archiveParam; - Set distributionPoints; - Iterator iter; - boolean found; - - // test archive parameters - archiveParam = - (DataBaseArchiveParameter) archiveConfig.getArchiveParameters(); - assertEquals( - archiveParam.getJDBCUrl(), - "jdbc:postgresql://10.16.46.108/moa?user=moa&password=moatest"); - - // test cert store configuration - assertEquals(1, certStoreConfig.getParameters().length); - assertEquals( - CertStoreTypes.DIRECTORY, - certStoreConfig.getParameters()[0].getType()); - - // test revocation configuration - distributionPoints = - revocationConfig.getAlternativeDistributionPoints(iaikCert, null, new Date()); - assertEquals(3, distributionPoints.size()); - found = false; - for (iter = distributionPoints.iterator(); iter.hasNext();) { - CRLDistributionPoint dp = (CRLDistributionPoint) iter.next(); - if (dp.getUri().equals("http://www.iaik.at/testCA/iaik_test_sig.crl")) { - found = - dp.getReasonCodes() - == (DistributionPoint.keyCompromise - | DistributionPoint.affiliationChanged); - } - } - assertTrue(found); - - // test validation configuration - assertEquals( - ChainingModes.PKIX_MODE, - validationConfig.getChainingMode(iaikCert)); - } - - /* - public void testGetCryptoModuleConfigurations() { - List cryptoConfigs = config.getCryptoModuleConfigurations(); - HardwareCryptoModuleConfiguration moduleConfig; - - assertEquals(2, cryptoConfigs.size()); - moduleConfig = (HardwareCryptoModuleConfiguration) cryptoConfigs.get(0); - assertEquals("Module1", moduleConfig.getModuleName()); - assertEquals("Slot1", moduleConfig.getSlotID()); - assertEquals("PIN1", new String(moduleConfig.getUserPIN())); - } - */ - - public void testGetKeyModuleConfigurations() { - List keyConfigs = config.getKeyModuleConfigurations(); - HardwareKeyModuleConfiguration hwKey; - SoftwareKeyModuleConfiguration swKey; - - assertEquals(7, keyConfigs.size()); - hwKey = (HardwareKeyModuleConfiguration) keyConfigs.get(0); - assertEquals("cryptoki.dll", hwKey.getModuleName()); - assertEquals("0", hwKey.getSlotID()); - assertEquals("0000", new String(hwKey.getUserPIN())); - swKey = (SoftwareKeyModuleConfiguration) keyConfigs.get(1); - assertEquals( - "buergerkarte", - new String(swKey.getKeyStoreAuthenticationData())); - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java deleted file mode 100644 index 3b403dc19..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.iaik.config; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; -import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; - -/** - * Tests the IaikConfigurator. - * - * @author Patrick Peck - * @version $Id$ - */ -public class IaikConfiguratorTest extends SPSSTestCase { - - public IaikConfiguratorTest(String name) { - super(name); - } - - /** - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUpTransactionContext(); - } - - public void testConfigure() throws Exception { - IaikConfigurator configurator = new IaikConfigurator(); - TransactionContext context = - TransactionContextManager.getInstance().getTransactionContext(); - - configurator.configure(context.getConfiguration()); - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/AllTests.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/AllTests.java deleted file mode 100644 index 65fa2bf72..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/AllTests.java +++ /dev/null @@ -1,25 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Runs all tests in this package. - * - * @author Patrick Peck - * @version $Id$ - */ -public class AllTests { - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(DataObjectFactoryTest.class); - suite.addTestSuite(TransformationFactoryTest.class); - suite.addTestSuite(XMLSignatureCreationInvokerTest.class); - suite.addTestSuite(CMSSignatureVerificationInvokerTest.class); - suite.addTestSuite(XMLSignatureVerificationInvokerTest.class); - - return suite; - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java deleted file mode 100644 index 3024730f4..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.util.DOMUtils; - -import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; -import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureResponseBuilder; -import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; - -/** - * Mainly a smoke test for debugging the CMSSignatureVerificationInvoker. - * - * @author Patrick Peck - * @version $Id$ - */ -public class CMSSignatureVerificationInvokerTest extends SPSSTestCase { - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/VerifyCMSSignature/"; - - /** - * Constructor for CMSSignatureVerificationInvokerTest. - * @param name - */ - public CMSSignatureVerificationInvokerTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - setUpTransactionContext(); - setUpLoggingContext(); - setUpIaikConfiguration(); - } - - public void testVerifyCMSSignature() throws Exception { - try { - CMSSignatureVerificationInvoker invoker = - CMSSignatureVerificationInvoker.getInstance(); - VerifyCMSSignatureRequestParser requestParser = - new VerifyCMSSignatureRequestParser(); - Document doc = - SPSSTestCase.parseXmlValidating( - TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml"); - VerifyCMSSignatureRequest request = - requestParser.parse(doc.getDocumentElement()); - VerifyCMSSignatureResponse response = invoker.verifyCMSSignature(request); - VerifyCMSSignatureResponseBuilder responseBuilder = - new VerifyCMSSignatureResponseBuilder(); - Element result = responseBuilder.build(response).getDocumentElement(); - - System.out.println(DOMUtils.serializeNode(result)); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java deleted file mode 100644 index 7de2add33..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java +++ /dev/null @@ -1,180 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import java.io.InputStream; -import java.security.Security; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import iaik.server.modules.xml.BinaryDataObject; -import iaik.server.modules.xml.DataObject; -import iaik.server.modules.xml.XMLDataObject; - -import at.gv.egovernment.moa.util.Base64Utils; - -import at.gv.egovernment.moa.spss.MOAException; -import at.gv.egovernment.moa.spss.api.SPSSFactory; -import at.gv.egovernment.moa.spss.api.common.Content; -import at.gv.egovernment.moa.spss.server.iaik.xml.ByteArrayDataObjectImpl; -import at.gv.egovernment.moa.spss.server.iaik.xml.ByteStreamDataObjectImpl; -import at.gv.egovernment.moa.spss.server.iaik.xml.XMLDataObjectImpl; -import at.gv.egovernment.moa.spss.server.iaik.xml.XMLNodeListDataObjectImpl; -import at.gv.egovernment.moa.spss.server.invoke.DataObjectFactory; - -/** - * Test cases for the DataObjectFactory class. - * - * @author Patrick Peck - * @version $Id$ - */ -public class DataObjectFactoryTest extends SPSSTestCase { - - private static final String HTTP_BINARY_CONTENT_URL = "http://www.google.com"; - private static final String HTTP_XML_CONTENT_URL = - "http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"; - private static final String HTTPS_BINARY_CONTENT_URL = - "https://businessnet.ba-ca.com"; - private static final String HTTPS_UNTRUSTED_URL = - "https://heribert.anecon.com"; - private static final String HTTP_UNKNOWN_HOST_URL = "http://uurjmjmruuw.com"; - private static final String MALFORMED_URL = "//hsld///ddd"; - private static final String FILE_BINARY_CONTENT_URL = "file:/C:/boot.ini"; - private static final String XML_CONTENT = - "" - + " " - + " " - + ""; - private static final String BASE64_CONTENT = "U3Zlbg=="; - - private SPSSFactory spssFactory = SPSSFactory.getInstance(); - private DataObjectFactory factory; - - /** - * Constructor for DataObjectFactoryTest. - * @param name - */ - public DataObjectFactoryTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - factory = DataObjectFactory.getInstance(); - - // set up SSL - Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - System.setProperty( - "java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); - /* - System.setProperty( - "javax.net.ssl.keyStore", - "data/test/security/client.keystore"); - System.setProperty("javax.net.ssl.keyStorePassword", "changeit"); - System.setProperty( - "javax.net.ssl.trustStore", - "data/test/security/client.keystore"); - System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); - */ - } - - public void testCreateFromURIWithBinaryHttp() throws Exception { - DataObject dataObject = - factory.createFromURI(HTTP_BINARY_CONTENT_URL, false); - - assertNotNull(dataObject); - assertTrue(dataObject instanceof ByteStreamDataObjectImpl); - assertNotNull(((BinaryDataObject) dataObject).getInputStream()); - } - - public void testCreateFromURIWithXmlHttp() throws Exception { - DataObject dataObject = factory.createFromURI(HTTP_XML_CONTENT_URL, false); - Element element; - - assertNotNull(dataObject); - assertTrue(dataObject instanceof XMLDataObjectImpl); - element = ((XMLDataObject) dataObject).getElement(); - assertNotNull(element); - assertEquals("schema", element.getTagName()); - } - - public void testCreateFromURIWithMalformedURI() throws Exception { - try { - factory.createFromURI(MALFORMED_URL, false); - fail(); - } catch (MOAException e) { - } - } - - public void testCreateFromURIWithNonExistingHttpURL() throws Exception { - try { - factory.createFromURI(HTTP_UNKNOWN_HOST_URL, false); - fail(); - } catch (MOAException e) { - } - } - - public void testCreateFromURIWithHttps() throws Exception { - DataObject dataObject = - factory.createFromURI(HTTPS_BINARY_CONTENT_URL, false); - assertNotNull(dataObject); - assertTrue(dataObject instanceof BinaryDataObject); - } - - public void testCreateFromURIWithUntrustedHttps() throws Exception { - try { - factory.createFromURI(HTTPS_UNTRUSTED_URL, false); - fail(); - } catch (MOAException e) { - - } - } - - public void testCreateFromURIWithFile() throws Exception { - try { - factory.createFromURI(FILE_BINARY_CONTENT_URL, false); - fail(); - } catch (MOAException e) { - } - } - - public void testCreateFromContentOptionalRefTypeWithXmlContent() - throws Exception { - Document doc = parseXmlString(XML_CONTENT); - Content content = - spssFactory.createContent( - doc.getDocumentElement().getChildNodes(), - "http://data"); - DataObject dataObject = - factory.createFromContentOptionalRefType( - content, - null, - null, - true, - false, - true, - false); - - assertTrue(dataObject instanceof XMLNodeListDataObjectImpl); - } - - public void testCreateFromContentOptionalRefTypeWithBase64Content() - throws Exception { - InputStream is = Base64Utils.decodeToStream(BASE64_CONTENT, true); - Content content = spssFactory.createContent(is, "http://data"); - DataObject dataObject = - factory.createFromContentOptionalRefType( - content, - null, - null, - false, - false, - true, - false); - - assertNotNull(dataObject); - assertTrue(dataObject instanceof ByteArrayDataObjectImpl); - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java deleted file mode 100644 index 13a80cbf1..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import java.util.List; -import java.util.Map; - -import org.w3c.dom.Document; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import iaik.ixsil.init.IXSILInit; -import iaik.ixsil.util.URI; -import iaik.server.modules.xml.Base64Transformation; -import iaik.server.modules.xml.Canonicalization; -import iaik.server.modules.xml.EnvelopedSignatureTransformation; -import iaik.server.modules.xml.Transformation; -import iaik.server.modules.xml.XPath2Transformation; -import iaik.server.modules.xml.XPathTransformation; -import iaik.server.modules.xml.XSLTTransformation; - -import at.gv.egovernment.moa.util.Constants; - -import at.gv.egovernment.moa.spss.MOAApplicationException; -import at.gv.egovernment.moa.spss.api.common.Transform; -import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; -import at.gv.egovernment.moa.spss.server.invoke.TransformationFactory; - -/** - * Test cases for the TransformationFactory class. - * - * @author Patrick Peck - * @version $Id$ - */ -public class TransformationFactoryTest extends SPSSTestCase { - - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/dsigTransform/"; - private TransformationFactory factory = TransformationFactory.getInstance(); - private TransformParser transformParser = new TransformParser(); - - /** - * Constructor for TransformationFactoryTest. - * @param name - */ - public TransformationFactoryTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - IXSILInit.init(new URI("init/properties/init.properties")); - //IXSILInit.init(new URI("file:data/deploy/ixsil/init/properties/init.properties")); - - } - - public void testCreateCanonicalization() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "canonicalization.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - - assertTrue(t instanceof Canonicalization); - assertEquals( - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", - t.getAlgorithmURI()); - } - - public void testCreateCanonicalizationWithComments() throws Exception { - Document transform = - parseXml(TESTDATA_BASE + "canonicalizationWithComments.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - - assertTrue(t instanceof Canonicalization); - assertEquals( - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", - t.getAlgorithmURI()); - } - - public void testCreateBase64Decode() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "base64.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof Base64Transformation); - } - - public void testCreateEnvelopedSignature() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "enveloped.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof EnvelopedSignatureTransformation); - } - - public void testXPathTransformation() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "xpath.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - Map nsDecls; - - assertTrue(t instanceof XPathTransformation); - nsDecls = ((XPathTransformation) t).getNamespaceDeclarations(); - assertEquals(1, nsDecls.size()); - assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); - } - - public void testCreateXPath2Transformation() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "xpath2.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof XPath2Transformation); - } - - public void testCreateXSLTTransformation() throws Exception { - Document transform = parseXml(TESTDATA_BASE + "xslt.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - XSLTTransformation t = - (XSLTTransformation) factory.createTransformation(tr); - assertNotNull(t.getStylesheetElement()); - } - - public void testCreateWithIllegalAlgorithm() throws Exception { - try { - Document transform = parseXml(TESTDATA_BASE + "illegalAlgorithm.xml"); - Transform tr = - transformParser.parseTransform(transform.getDocumentElement()); - factory.createTransformation(tr); - fail(); - } catch (MOAApplicationException e) { - } - } - - public void testEqualsXslt() throws Exception { - Document xslt = parseXml(TESTDATA_BASE + "xslt.xml"); - Transform tr = transformParser.parseTransform(xslt.getDocumentElement()); - Transformation trXslt = factory.createTransformation(tr); - - Document xsltEqu = parseXml(TESTDATA_BASE + "xsltEqual.xml"); - tr = transformParser.parseTransform(xsltEqu.getDocumentElement()); - Transformation trXsltEqu = factory.createTransformation(tr); - - Document xsltDiff = parseXml(TESTDATA_BASE + "xsltDifferent.xml"); - tr = transformParser.parseTransform(xsltDiff.getDocumentElement()); - Transformation trXsltDiff = factory.createTransformation(tr); - - Document canonicalization = - parseXml(TESTDATA_BASE + "canonicalization.xml"); - - assertTrue(trXslt.equals(trXsltEqu)); - assertFalse(trXslt.equals(trXsltDiff)); - assertFalse(trXsltEqu.equals(trXsltDiff)); - assertEquals(trXslt.hashCode(), trXsltEqu.hashCode()); - assertFalse(trXslt.hashCode() == trXsltDiff.hashCode()); - assertFalse(trXsltEqu.hashCode() == trXsltDiff.hashCode()); - assertFalse(trXslt.equals(canonicalization)); - } - - public void testEqualsXPath() throws Exception { - Document xpath = parseXml(TESTDATA_BASE + "xpath.xml"); - Transform tr = transformParser.parseTransform(xpath.getDocumentElement()); - Transformation trXpath = factory.createTransformation(tr); - Transformation trXpathEqu = factory.createTransformation(tr); - - Document xpathDiff = parseXml(TESTDATA_BASE + "xpathDifferent.xml"); - tr = transformParser.parseTransform(xpathDiff.getDocumentElement()); - Transformation trXpathDiff = factory.createTransformation(tr); - - assertTrue(trXpath.equals(trXpathEqu)); - assertEquals(trXpath.hashCode(), trXpathEqu.hashCode()); - assertFalse(trXpath.equals(trXpathDiff)); - assertFalse(trXpath.hashCode() == trXpathDiff.hashCode()); - } - - public void testEqualsXPath2() throws Exception { - Document xpath2 = parseXml(TESTDATA_BASE + "xpath2.xml"); - Transform tr = transformParser.parseTransform(xpath2.getDocumentElement()); - Transformation trXpath2 = factory.createTransformation(tr); - Transformation trXpath2Equ = factory.createTransformation(tr); - - Document xpath2Diff = parseXml(TESTDATA_BASE + "xpath2Different.xml"); - tr = transformParser.parseTransform(xpath2Diff.getDocumentElement()); - Transformation trXpath2Diff = factory.createTransformation(tr); - - assertTrue(trXpath2.equals(trXpath2Equ)); - assertEquals(trXpath2.hashCode(), trXpath2Equ.hashCode()); - assertFalse(trXpath2.equals(trXpath2Diff)); - assertFalse(trXpath2.hashCode() == trXpath2Diff.hashCode()); - } - - public void testCreateTransformationList() throws Exception { - Document transforms = parseXml(TESTDATA_BASE + "transforms.xml"); - List trs = transformParser.parseTransforms(transforms.getDocumentElement()); - List transformationList = factory.createTransformationList(trs); - - assertEquals(3, transformationList.size()); - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java deleted file mode 100644 index 28cd3805a..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import java.util.Collections; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.util.DOMUtils; - -import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureResponseBuilder; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; -import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureCreationInvoker; - -/** - * Mainly a smoke test for debugging the XMLSignatureCreationInvoker. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XMLSignatureCreationInvokerTest extends SPSSTestCase { - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/CreateXMLSignature/"; - - public XMLSignatureCreationInvokerTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - setUpTransactionContext(); - setUpLoggingContext(); - setUpIaikConfiguration(); - setUpSSL(); - } - - public void testCreateXMLSignature() throws Exception { - try { - XMLSignatureCreationInvoker invoker = - XMLSignatureCreationInvoker.getInstance(); - CreateXMLSignatureRequestParser requestParser = - new CreateXMLSignatureRequestParser(); - Document doc = - SPSSTestCase.parseXmlValidating( - TESTDATA_BASE + "TestGeneratorCX2.004.Req.xml"); - CreateXMLSignatureRequest request = - requestParser.parse(doc.getDocumentElement()); - CreateXMLSignatureResponse response = - invoker.createXMLSignature(request, Collections.EMPTY_SET); - CreateXMLSignatureResponseBuilder responseBuilder = - new CreateXMLSignatureResponseBuilder(); - Element result = responseBuilder.build(response).getDocumentElement(); - - System.out.println(DOMUtils.serializeNode(result)); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } - } - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java deleted file mode 100644 index 56e3d541b..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.invoke; - -import org.w3c.dom.Document; - -import test.at.gv.egovernment.moa.spss.SPSSTestCase; - -import at.gv.egovernment.moa.util.DOMUtils; - -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; -import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureResponseBuilder; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; -import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; -import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureVerificationInvoker; - -/** - * Mainly a smoke test for debugging the XMLSignatureVerificationInvoker. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XMLSignatureVerificationInvokerTest extends SPSSTestCase { - private static final String TESTDATA_BASE = - TESTDATA_ROOT + "xml/VerifyXMLSignature/"; - - public XMLSignatureVerificationInvokerTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - setUpTransactionContext(); - setUpLoggingContext(); - setUpIaikConfiguration(); - } - - public void testVerifyXMLSignature() throws Exception { - try { - XMLSignatureVerificationInvoker invoker = - XMLSignatureVerificationInvoker.getInstance(); - VerifyXMLSignatureRequestParser requestParser = - new VerifyXMLSignatureRequestParser(); - VerifyXMLSignatureResponseBuilder responseBuilder = - new VerifyXMLSignatureResponseBuilder(); - Document doc = - SPSSTestCase.parseXmlValidating( - TESTDATA_BASE + "TestGeneratorVX.201.Req.xml"); - - VerifyXMLSignatureRequest request = - requestParser.parse(doc.getDocumentElement()); - VerifyXMLSignatureResponse response; - - response = invoker.verifyXMLSignature(request); - System.out.println( - DOMUtils.serializeNode(responseBuilder.build(response))); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } - } - - -} diff --git a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java b/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java deleted file mode 100644 index b46c20086..000000000 --- a/spss/server/serverlib/src/test/java/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package test.at.gv.egovernment.moa.spss.server.tools; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -import at.gv.egovernment.moa.spss.server.tools.CertTool; - -import test.at.gv.egovernment.moa.MOATestCase; - -/** - * Tests for the CertTool. - * - * @author Patrick Peck - * @version $Id$ - */ -public class CertToolTest extends MOATestCase { - - private static final String EXPECTED_RESULT = - "SubjectDN (RFC2253):" - + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" - + "IssuerDN (RFC2253) :" - + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" - + "Serial Number :" - + " 1047548672\r\n"; - private CertTool certTool; - - /** - * Constructor for CertToolTest. - * @param name - */ - public CertToolTest(String name) { - super(name); - } - - protected void setUp() { - certTool = new CertTool(); - } - - public void testPrintCertInfo() { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - PrintStream ps = new PrintStream(bos); - String result; - - certTool.printCertInfo(TESTDATA_ROOT + "security/server.cer", ps); - result = new String(bos.toByteArray()); - System.out.println(result); - assertEquals(EXPECTED_RESULT, result); - } - -} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java new file mode 100644 index 000000000..c670b5e55 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java @@ -0,0 +1,40 @@ +package test.at.gv.egovernment.moa.spss; + +import test.at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImplTest; +import test.at.gv.egovernment.moa.spss.server.iaik.config.IaikConfiguratorTest; +import test.at.gv.egovernment.moa.spss.server.tools.CertToolTest; + +import junit.awtui.TestRunner; +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Test suite for all unit tests. + * + * @author Patrick Peck + * @version $Id$ + */ +public class AllTests { + + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(test.at.gv.egovernment.moa.spss.server.config.AllTests.class); + suite.addTestSuite(ConfigurationDataImplTest.class); + suite.addTestSuite(IaikConfiguratorTest.class); + suite.addTest( + test.at.gv.egovernment.moa.spss.server.invoke.AllTests.suite()); + suite.addTest(test.at.gv.egovernment.moa.spss.api.xmlbind.AllTests.suite()); + suite.addTestSuite(CertToolTest.class); + + return suite; + } + + public static void main(String[] args) { + try { + TestRunner.run(AllTests.class); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java new file mode 100644 index 000000000..a585e30a0 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java @@ -0,0 +1,82 @@ +package test.at.gv.egovernment.moa.spss; + +import java.security.Security; + +import test.at.gv.egovernment.moa.MOATestCase; + +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; +import at.gv.egovernment.moa.util.MessageProvider; + +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Base class for MOA test cases. + * + * Provides some utility functions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class SPSSTestCase extends MOATestCase { + + protected static final String TESTDATA_ROOT = "data/test/"; + + /** + * Constructor for MOATestCase. + * @param arg0 + */ + public SPSSTestCase(String name) { + super(name); + } + + /** + * Set up a transaction context with a test configuration. + */ + protected void setUpTransactionContext() throws Exception { + System.setProperty( + ConfigurationProvider.CONFIG_PROPERTY_NAME, + "data/test/conf/moa-spss/MOA-SPSSConfiguration.xml"); + ConfigurationProvider config = ConfigurationProvider.getInstance(); + TransactionContext context = new TransactionContext("test", null, config); + TransactionContextManager.getInstance().setTransactionContext(context); + } + + protected void setUpLoggingContext() throws Exception { + LoggingContext context = new LoggingContext("test"); + LoggingContextManager.getInstance().setLoggingContext(context); + } + + /** + * Configure the IAIK modules with the current configuration. + * + * A TransactionContext must have been set up before. + */ + protected void setUpIaikConfiguration() throws Exception { + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + ClassLoader cl = getClass().getClassLoader(); + MessageProvider msg = MessageProvider.getInstance(); + + try { + cl.loadClass("javax.security.cert.Certificate"); // from jcert.jar + } catch (ClassNotFoundException e) { + Logger.warn(msg.getMessage("init.03", null), e); + } + + new IaikConfigurator().configure(context.getConfiguration()); + } + + protected void setUpSSL() throws Exception { + //System.setProperty("javax.net.debug", "all"); + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + System.setProperty( + "java.protocol.handler.pkgs", + "com.sun.net.ssl.internal.www.protocol"); + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java new file mode 100644 index 000000000..28f79729e --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java @@ -0,0 +1,24 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Runs all tests in this package. + * + * @author Patrick Peck + * @version $Id$ + */ +public class AllTests { + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(CreateXMLSignatureRequestParserTest.class); + suite.addTestSuite(TransformParserTest.class); + suite.addTestSuite(VerifyCMSSignatureRequestParserTest.class); + suite.addTestSuite(VerifyXMLSignatureRequestParserTest.class); + + return suite; + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java new file mode 100644 index 000000000..7ce705b01 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java @@ -0,0 +1,71 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo; +import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo; + +/** + * Test the CreateXMLSignatureRequestParser. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CreateXMLSignatureRequestParserTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/CreateXMLSignature/"; + + private CreateXMLSignatureRequestParser requestParser; + + public CreateXMLSignatureRequestParserTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + requestParser = new CreateXMLSignatureRequestParser(); + } + + public void testParse() throws Exception { + Element requestElem = + parseXml(TESTDATA_BASE + "TestGeneratorCX2.001.Req.xml") + .getDocumentElement(); + CreateXMLSignatureRequest request = requestParser.parse(requestElem); + SingleSignatureInfo sigInfo; + DataObjectInfo dataObjInfo; + CreateTransformsInfoProfileExplicit transProfile; + CreateSignatureEnvironmentProfileExplicit envProfile; + + assertNotNull(request); + assertEquals("PKCS12RSAKey1", request.getKeyIdentifier()); + assertEquals(1, request.getSingleSignatureInfos().size()); + + sigInfo = (SingleSignatureInfo) request.getSingleSignatureInfos().get(0); + assertEquals(1, sigInfo.getDataObjectInfos().size()); + assertFalse(sigInfo.isSecurityLayerConform()); + + dataObjInfo = (DataObjectInfo) sigInfo.getDataObjectInfos().get(0); + assertNotNull(dataObjInfo.getDataObject()); + + transProfile = + (CreateTransformsInfoProfileExplicit) dataObjInfo + .getCreateTransformsInfoProfile(); + assertNotNull( + transProfile.getCreateTransformsInfo().getFinalDataMetaInfo()); + + envProfile = + (CreateSignatureEnvironmentProfileExplicit) sigInfo + .getCreateSignatureInfo() + .getCreateSignatureEnvironmentProfile(); + assertEquals( + "//data:Document", + envProfile.getCreateSignatureLocation().getXPathExpression()); + assertEquals(0, envProfile.getCreateSignatureLocation().getIndex()); + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java new file mode 100644 index 000000000..f580f86bc --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java @@ -0,0 +1,113 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import java.util.List; + +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform; +import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform; +import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform; +import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform; +import at.gv.egovernment.moa.spss.api.common.XPathTransform; +import at.gv.egovernment.moa.spss.api.common.XSLTTransform; +import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; + +/** + * Test the TransformParser. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TransformParserTest extends SPSSTestCase { + private static String TESTDATA_BASE = TESTDATA_ROOT + "xml/dsigTransform/"; + + private TransformParser transformParser; + + public TransformParserTest(String name) { + super(name); + } + + protected void setUp() { + transformParser = new TransformParser(); + } + + public void testParseTransforms() throws Exception { + Element transformsElem = + parseXml(TESTDATA_BASE + "transforms.xml").getDocumentElement(); + List transforms = transformParser.parseTransforms(transformsElem); + + assertNotNull(transforms); + assertEquals(3, transforms.size()); + + } + + public void testParseCanonicalizationTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "canonicalization.xml").getDocumentElement(); + CanonicalizationTransform transform = + (CanonicalizationTransform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + assertEquals( + CanonicalizationTransform.CANONICAL_XML, + transform.getAlgorithmURI()); + } + + public void testParseExclCanonicalizationTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "exclusiveCanonicalization.xml") + .getDocumentElement(); + ExclusiveCanonicalizationTransform transform = + (ExclusiveCanonicalizationTransform) transformParser.parseTransform( + transformElem); + + assertNotNull(transform); + assertEquals( + ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML, + transform.getAlgorithmURI()); + assertEquals(3, transform.getInclusiveNamespacePrefixes().size()); + } + + public void testParseEnvelopedTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "enveloped.xml").getDocumentElement(); + EnvelopedSignatureTransform transform = + (EnvelopedSignatureTransform) transformParser.parseTransform( + transformElem); + + assertNotNull(transform); + } + + public void testParseXPathTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "xpath.xml").getDocumentElement(); + XPathTransform transform = + (XPathTransform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + assertEquals("//ToBeSigned/Data", transform.getXPathExpression()); + assertEquals(1, transform.getNamespaceDeclarations().size()); + } + + public void testParseXPathFilter2Transform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "xpath2.xml").getDocumentElement(); + XPathFilter2Transform transform = + (XPathFilter2Transform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + assertEquals(3, transform.getFilters().size()); + } + + public void testParseXSLTTransform() throws Exception { + Element transformElem = + parseXml(TESTDATA_BASE + "xslt.xml").getDocumentElement(); + XSLTTransform transform = + (XSLTTransform) transformParser.parseTransform(transformElem); + + assertNotNull(transform); + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java new file mode 100644 index 000000000..4be7667eb --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java @@ -0,0 +1,61 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.util.DateTimeUtils; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentExcplicit; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.common.MetaInfo; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; + +/** + * Test the VerifyCMSSignatureRequestParserTest. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyCMSSignatureRequestParserTest extends SPSSTestCase { + private static String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyCMSSignature/"; + + private VerifyCMSSignatureRequestParser requestParser; + + public VerifyCMSSignatureRequestParserTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + requestParser = new VerifyCMSSignatureRequestParser(); + } + + public void testParse() throws Exception { + Element requestElem = + parseXml(TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml") + .getDocumentElement(); + VerifyCMSSignatureRequest request = requestParser.parse(requestElem); + MetaInfo metaInfo; + CMSContentExcplicit content; + + assertNotNull(request); + assertEquals(1, request.getSignatories()[0]); + assertEquals( + DateTimeUtils.parseDateTime("2003-04-04T09:30:47-05:00"), + request.getDateTime()); + assertNotNull(request.getCMSSignature()); + assertNotNull(request.getDataObject()); + assertEquals("TrustProfile1", request.getTrustProfileId()); + + metaInfo = request.getDataObject().getMetaInfo(); + assertNotNull(metaInfo); + assertEquals("text/plain", metaInfo.getMimeType()); + assertEquals("http://10.16.46.109/TestDatenGenerator/resources/testDaten.txt", metaInfo.getDescription()); + + content = (CMSContentExcplicit) request.getDataObject().getContent(); + assertNotNull(content.getBinaryContent()); + + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java new file mode 100644 index 000000000..3b8e8b00e --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java @@ -0,0 +1,81 @@ +package test.at.gv.egovernment.moa.spss.api.xmlbind; + +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DateTimeUtils; + +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; +import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams; +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.VerifyTransformsInfoProfileExplicit; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; + +/** + * Test the VerifyXMLSignatureRequestParserTest. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyXMLSignatureRequestParserTest extends SPSSTestCase { + private static String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyXMLSignature/"; + + private VerifyXMLSignatureRequestParser parser; + + public VerifyXMLSignatureRequestParserTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + parser = new VerifyXMLSignatureRequestParser(); + } + + public void testParse() throws Exception { + Element requestElem = + parseXml(TESTDATA_BASE + "TestGeneratorVX.201.Req.xml") + .getDocumentElement(); + VerifyXMLSignatureRequest request = parser.parse(requestElem); + VerifySignatureInfo verifySignatureInfo; + VerifySignatureLocation verifyLocation; + SignatureManifestCheckParams checkParams; + ReferenceInfo refInfo; + VerifyTransformsInfoProfileExplicit transformsProfile; + + assertNotNull(request); + assertEquals( + DateTimeUtils.parseDateTime("2003-04-01T12:53:57+01:00"), + request.getDateTime()); + assertFalse(request.getReturnHashInputData()); + assertEquals("TrustProfile1", request.getTrustProfileId()); + + verifySignatureInfo = request.getSignatureInfo(); + assertNotNull(verifySignatureInfo); + assertNotNull(verifySignatureInfo.getVerifySignatureEnvironment()); + + verifyLocation = verifySignatureInfo.getVerifySignatureLocation(); + assertNotNull(verifyLocation); + assertEquals("//dsig:Signature", verifyLocation.getXPathExpression()); + assertEquals(3, verifyLocation.getNamespaceDeclarations().size()); + + checkParams = request.getSignatureManifestCheckParams(); + assertNotNull(checkParams); + assertEquals(true, checkParams.getReturnReferenceInputData()); + assertEquals(1, checkParams.getReferenceInfos().size()); + + refInfo = (ReferenceInfo) checkParams.getReferenceInfos().get(0); + assertEquals(1, refInfo.getVerifyTransformsInfoProfiles().size()); + + transformsProfile = + (VerifyTransformsInfoProfileExplicit) refInfo + .getVerifyTransformsInfoProfiles() + .get(0); + assertEquals(1, transformsProfile.getTransforms().size()); + assertEquals(1, transformsProfile.getTransformParameters().size()); + + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java new file mode 100644 index 000000000..131f38c19 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java @@ -0,0 +1,20 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class AllTests +{ + public static Test suite() + { + TestSuite suite = new TestSuite(); + suite.addTestSuite(ConfigurationProviderTest1.class); + suite.addTestSuite(ConfigurationProviderTest2.class); + suite.addTestSuite(ConfigurationProviderTest3.class); + return suite; + } +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java new file mode 100644 index 000000000..474a387ad --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java @@ -0,0 +1,377 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import iaik.asn1.structures.Name; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; +import iaik.x509.X509Certificate; + +import java.math.BigInteger; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import junit.framework.TestCase; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.server.config.CRLDistributionPoint; +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.config.HardwareCryptoModule; +import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule; +import at.gv.egovernment.moa.spss.server.config.KeyGroup; +import at.gv.egovernment.moa.spss.server.config.KeyGroupEntry; +import at.gv.egovernment.moa.spss.server.config.OCSPDistributionPoint; +import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule; +import at.gv.egovernment.moa.spss.server.config.TrustProfile; +import at.gv.egovernment.moa.util.Constants; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class ConfigurationProviderTest1 extends TestCase +{ + private static final String CONFIG_BASE_ = + "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; + + static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; + + static + { + System.setProperty( + "log4j.configuration", + "file:/" + CONFIG_BASE_ + "log4j.properties"); + System.setProperty( + at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, + CONFIG_BASE_ + "moa.spss.complete-config.xml"); + try + { + ConfigurationProvider.reload(); + provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); + } + catch (ConfigurationException e) + { + throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); + } + } + + /** + * Constructor for ConfigurationProvider. + * @param arg0 + */ + public ConfigurationProviderTest1() throws MOAException + { + super("ConfigurationProvider"); + } + + public void testGetWarnings() + { + assertEquals(0, provider_.getWarnings().size()); + } + + public void testGetDigestMethodAlgorithmName() + { + assertEquals( + Constants.SHA1_URI, + provider_.getDigestMethodAlgorithmName()); + } + + public void testGetCanonicalizationAlgorithmName() + { + assertEquals( + Constants.C14N_WITH_COMMENTS_URI, + provider_.getCanonicalizationAlgorithmName()); + } + + public void testGetHardwareCryptoModules() + { + List hwcms = provider_.getHardwareCryptoModules(); + assertEquals(2, hwcms.size()); + + HardwareCryptoModule hwc1 = (HardwareCryptoModule) hwcms.get(0); + assertEquals("HWC1_Name", hwc1.getName()); + assertEquals("HWC1_SlotId", hwc1.getSlotID()); + assertEquals("HWC1_UserPIN", hwc1.getUserPIN()); + + HardwareCryptoModule hwc2 = (HardwareCryptoModule) hwcms.get(1); + assertEquals("HWC2_Name", hwc2.getName()); + assertNull(hwc2.getSlotID()); + assertEquals("HWC2_UserPIN", hwc2.getUserPIN()); + } + + public void testGetHardwareKeyModules() + { + List hwkms = provider_.getHardwareKeyModules(); + assertEquals(2, hwkms.size()); + + HardwareKeyModule hwk1 = (HardwareKeyModule) hwkms.get(0); + assertEquals("HWK1_Id", hwk1.getId()); + assertEquals("HWK1_Name", hwk1.getName()); + assertEquals("HWK1_SlotId", hwk1.getSlotID()); + assertEquals("HWK1_UserPIN", hwk1.getUserPIN()); + + HardwareKeyModule hwk2 = (HardwareKeyModule) hwkms.get(1); + assertEquals("HWK2_Id", hwk2.getId()); + assertEquals("HWK2_Name", hwk2.getName()); + assertNull(hwk2.getSlotID()); + assertEquals("HWK2_UserPIN", hwk2.getUserPIN()); + } + + public void testGetSoftwareKeyModules() + { + List swkms = provider_.getSoftwareKeyModules(); + assertEquals(2, swkms.size()); + + SoftwareKeyModule swk1 = (SoftwareKeyModule) swkms.get(0); + assertEquals("SWK1_Id", swk1.getId()); + assertEquals(CONFIG_BASE_ + "swk/SWK1_FileName.txt", swk1.getFileName().replace('\\', '/')); + assertEquals("SWK1_Password", swk1.getPassWord()); + + SoftwareKeyModule swk2 = (SoftwareKeyModule) swkms.get(1); + assertEquals("SWK2_Id", swk2.getId()); + assertEquals(CONFIG_BASE_ + "swk/SWK2_FileName.txt", swk2.getFileName().replace('\\', '/')); + assertNull(swk2.getPassWord()); + } + + public void testGetKeyGroups() + { + Map keyGroups = provider_.getKeyGroups(); + assertEquals(2, keyGroups.size()); + + KeyGroup kg1 = (KeyGroup) keyGroups.get("KG1_Id"); + assertNotNull(kg1); + assertEquals("KG1_Id", kg1.getId()); + + Set kg1Entries = kg1.getKeyGroupEntries(); + assertEquals(2, kg1Entries.size()); + + Iterator kg1EntriesIt = kg1Entries.iterator(); + while(kg1EntriesIt.hasNext()) + { + KeyGroupEntry currentEntry = (KeyGroupEntry)kg1EntriesIt.next(); + if ("HWK1_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=HWK1_Issuer", currentEntry.getIssuerDN()); + assertEquals(0, currentEntry.getSerialNumber().intValue()); + } + else if ("HWK2_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=HWK2_Issuer", currentEntry.getIssuerDN()); + assertEquals(1, currentEntry.getSerialNumber().intValue()); + } + else fail("Invalid module identifer found."); + } + + KeyGroup kg2 = (KeyGroup) keyGroups.get("KG2_Id"); + assertNotNull(kg2); + assertEquals("KG2_Id", kg2.getId()); + + Set kg2Entries = kg2.getKeyGroupEntries(); + assertEquals(2, kg2Entries.size()); + + Iterator kg2EntriesIt = kg1Entries.iterator(); + while(kg1EntriesIt.hasNext()) + { + KeyGroupEntry currentEntry = (KeyGroupEntry)kg2EntriesIt.next(); + if ("SWK1_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=CN=SWK1_Issuer", currentEntry.getIssuerDN()); + assertEquals(2, currentEntry.getSerialNumber().intValue()); + } + else if ("SWK2_Id".equals(currentEntry.getModuleID())) + { + assertEquals("CN=SWK2_Issuer", currentEntry.getIssuerDN()); + assertEquals(3, currentEntry.getSerialNumber().intValue()); + } + else fail("Invalid module identifer found."); + } + } + + public void testGetKeyGroupEntries() throws RFC2253NameParserException + { + RFC2253NameParser parser = new RFC2253NameParser("CN=Customer1_Issuer"); + Name name = parser.parse(); + Set kgEntries = provider_.getKeyGroupEntries(name, BigInteger.valueOf(4), "KG1_Id"); + assertEquals(2, kgEntries.size()); + + Iterator kgEntriesIt = kgEntries.iterator(); + while (kgEntriesIt.hasNext()) + { + KeyGroupEntry currentEntry = (KeyGroupEntry) kgEntriesIt.next(); + if (!"HWK1_Id".equals(currentEntry.getModuleID()) && !"HWK2_Id".equals(currentEntry.getModuleID())) + { + fail("Invalid module identifier found."); + } + } + } + + public void testGetChainingMode() throws RFC2253NameParserException + { + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); + Name name = parser.parse(); + cert.setIssuerDN(name); + cert.setSerialNumber(BigInteger.valueOf(0)); + assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); // Default chaining mode + + parser = new RFC2253NameParser("CN=TA1_Issuer"); + name = parser.parse(); + cert.setIssuerDN(name); + cert.setSerialNumber(BigInteger.valueOf(5)); + assertEquals(ChainingModes.CHAIN_MODE, provider_.getChainingMode(cert)); + } + + public void testGetDistributionPoints() throws RFC2253NameParserException + { + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); + Name name = parser.parse(); + cert.setIssuerDN(name); + + Set dps = provider_.getDistributionPoints(cert); + assertEquals(2, dps.size()); + + Iterator dpIt = dps.iterator(); + while (dpIt.hasNext()) + { + CRLDistributionPoint currentDP = (CRLDistributionPoint)dpIt.next(); + if ("http://crl.myca.org".equals(currentDP.getUri())) + { + int reasonCodes = + iaik.asn1.structures.DistributionPoint.unused | + iaik.asn1.structures.DistributionPoint.keyCompromise | + iaik.asn1.structures.DistributionPoint.cACompromise | + iaik.asn1.structures.DistributionPoint.affiliationChanged | + iaik.asn1.structures.DistributionPoint.superseded | + iaik.asn1.structures.DistributionPoint.cessationOfOperation | + iaik.asn1.structures.DistributionPoint.certificateHold | + iaik.asn1.structures.DistributionPoint.privilegeWithdrawn | + iaik.asn1.structures.DistributionPoint.aACompromise; + assertEquals(reasonCodes, currentDP.getReasonCodes()); + } + else if ("http://crl.myotherca.org".equals(currentDP.getUri())) + { + int reasonCodes = + iaik.asn1.structures.DistributionPoint.aACompromise | + iaik.asn1.structures.DistributionPoint.affiliationChanged; + assertEquals(reasonCodes, currentDP.getReasonCodes()); + } + else fail("Invalid CRL DP URI found: " + currentDP.getUri()); + } + + parser = new RFC2253NameParser("CN=DP2_Issuer"); + name = parser.parse(); + cert.setIssuerDN(name); + + dps = provider_.getDistributionPoints(cert); + assertEquals(1, dps.size()); + + OCSPDistributionPoint dpo = (OCSPDistributionPoint) dps.toArray()[0]; + assertEquals("http://crl.yetanotherca.org", dpo.getUri()); + } + + public void testGetCRLArchiveDuration() + { + assertEquals(730, provider_.getCRLArchiveDuration()); + } + + public void testGetEnableRevocationArchiving() + { + assertFalse(provider_.getEnableRevocationArchiving()); + } + + public void testGetCertStoreLocation() + { + assertEquals( + CONFIG_BASE_ + "certstore_test", + provider_.getCertStoreLocation().replace('\\', '/')); + } + + public void testGetCreateTransformsInfoProfile() + { + Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); + assertEquals("CreateTransformsInfoProfile", ctip1.getLocalName()); + + Element ctip2 = provider_.getCreateTransformsInfoProfile("CTIP_2"); + assertEquals("CreateTransformsInfoProfile", ctip2.getLocalName()); + } + + public void testGetCreateSignatureEnvironmentProfile() + { + Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); + assertEquals("CreateSignatureEnvironmentProfile", csep.getLocalName()); + } + + public void testGetVerifyTransformsInfoProfile() + { + Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); + assertEquals("VerifyTransformsInfoProfile", vtip.getLocalName()); + } + + public void testGetSupplementProfile() + { + Element sp = provider_.getSupplementProfile("SP_1"); + assertEquals("SupplementProfile", sp.getLocalName()); + } + + public void testGetTrustProfile() + { + TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); + assertEquals( + "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/anchors", + tp1.getUri()); + assertEquals( + "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/signercerts", + tp1.getSignerCertsUri()); + + TrustProfile tp2 = provider_.getTrustProfile("TP2_Id"); + assertEquals( + "file:" + CONFIG_BASE_ + "trustprofiles/tp2/anchors", + tp2.getUri()); + assertEquals( + "file:" + CONFIG_BASE_ + "trustprofiles/tp2/signercerts", + tp2.getSignerCertsUri()); + } + + public void testGetRevocationArchiveJDBCURL() + { + assertEquals("jdbc://dummy", provider_.getRevocationArchiveJDBCURL()); + } + + public void testGetRevocationArchiveJDBCDriverClass() + { + assertEquals("fully.qualified.classname", provider_.getRevocationArchiveJDBCDriverClass()); + } + + public void testGetEnableRevocationChecking() + { + assertFalse(provider_.getEnableRevocationChecking()); + } + + public void testGetMaxRevocationAge() + { + assertEquals(10000, provider_.getMaxRevocationAge()); + } + + public void testGetServiceOrder() + { + String[] serviceOrder = provider_.getServiceOrder(); + assertEquals(2, serviceOrder.length); + assertEquals("crl", serviceOrder[0]); + assertEquals("ocsp", serviceOrder[1]); + } + + public void testGetAutoAddCertificates() + { + assertFalse(provider_.getAutoAddCertificates()); + } + + public void testGetUseAuthorityInfoAccess() + { + assertFalse(provider_.getUseAuthorityInfoAccess()); + } +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java new file mode 100644 index 000000000..adf02809b --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java @@ -0,0 +1,225 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import iaik.asn1.structures.Name; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; +import iaik.x509.X509Certificate; + +import java.math.BigInteger; +import java.util.List; +import java.util.Set; + +import junit.framework.TestCase; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAException; +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.config.TrustProfile; +import at.gv.egovernment.moa.util.Constants; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class ConfigurationProviderTest2 extends TestCase +{ + private static final String CONFIG_BASE_ = + "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; + + static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; + + static + { + System.setProperty( + "log4j.configuration", + "file:/" + CONFIG_BASE_ + "log4j.properties"); + System.setProperty( + at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, + CONFIG_BASE_ + "moa.ss.noopts-config.xml"); + try + { + ConfigurationProvider.reload(); + provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); + } + catch (ConfigurationException e) + { + throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); + } + } + + + /** + * Constructor for ConfigurationProvider. + * @param arg0 + */ + public ConfigurationProviderTest2() throws MOAException + { + super("ConfigurationProvider"); + } + + public void testGetWarnings() + { + // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found + assertEquals(3, provider_.getWarnings().size()); + } + + public void testGetDigestMethodAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.SHA1_URI, + provider_.getDigestMethodAlgorithmName()); + } + + public void testGetCanonicalizationAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.C14N_URI, + provider_.getCanonicalizationAlgorithmName()); + } + + public void testGetHardwareCryptoModules() + { + // No hardware crypto modules in config file, check for empty list + List hwcms = provider_.getHardwareCryptoModules(); + assertEquals(0, hwcms.size()); + } + + public void testGetHardwareKeyModules() + { + List hwkms = provider_.getHardwareKeyModules(); + assertEquals(1, hwkms.size()); + } + + public void testGetSoftwareKeyModules() + { + // No software key modules in config file, check for empty list + List swkms = provider_.getSoftwareKeyModules(); + assertEquals(0, swkms.size()); + } + + public void testGetChainingMode() throws RFC2253NameParserException + { + // Default Chaining Mode not set in configuration, check for default value + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown"); + Name name = parser.parse(); + cert.setIssuerDN(name); + cert.setSerialNumber(BigInteger.valueOf(0)); + assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); + } + + public void testGetDistributionPoints() throws RFC2253NameParserException + { + // Element is missing in config file, check if emty list is returned + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); + Name name = parser.parse(); + cert.setIssuerDN(name); + + Set dps = provider_.getDistributionPoints(cert); + assertEquals(0, dps.size()); + } + + public void testGetCRLArchiveDuration() + { + // Element is missing in config file, check if default value is returned + assertEquals(0, provider_.getCRLArchiveDuration()); + } + + public void testGetEnableRevocationArchiving() + { + // Element is missing in config file, check if default value is returned + assertFalse(provider_.getEnableRevocationArchiving()); + } + + public void testGetCertStoreLocation() + { + // Element is missing in config file, check if default value is returned + assertEquals( + CONFIG_BASE_ + "certstore", + provider_.getCertStoreLocation().replace('\\', '/')); + } + + public void testGetCreateTransformsInfoProfile() + { + // No profile in config file, check for null + Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); + assertNull(ctip1); + } + + public void testGetCreateSignatureEnvironmentProfile() + { + // No profile in config file, check for null + Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); + assertNull(csep); + } + + public void testGetVerifyTransformsInfoProfile() + { + // No profile in config file, check for null + Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); + assertNull(vtip); + } + + public void testGetSupplementProfile() + { + // No profile in config file, check for null + Element sp = provider_.getSupplementProfile("SP_1"); + assertNull(sp); + } + + public void testGetTrustProfile() + { + // No trust profiles config file, check for null + TrustProfile tp1 = provider_.getTrustProfile("TP1_Id"); + assertNull(tp1); + } + + public void testGetRevocationArchiveJDBCURL() + { + // Element is missing in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCURL()); + } + + public void testGetRevocationArchiveJDBCDriverClass() + { + // Element is missing in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCDriverClass()); + } + + public void testGetEnableRevocationChecking() + { + // Element is missing in config file, check for default value + assertFalse(provider_.getEnableRevocationChecking()); + } + + public void testGetMaxRevocationAge() + { + // Element is missing in config file, check for default value + assertEquals(0, provider_.getMaxRevocationAge()); + } + + public void testGetServiceOrder() + { + // Element is missing in config file, check for empty array + String[] serviceOrder = provider_.getServiceOrder(); + assertEquals(0, serviceOrder.length); + } + + public void testGetAutoAddCertificates() + { + // Element is missing in config file, check for default value + assertFalse(provider_.getAutoAddCertificates()); + } + + public void testGetUseAuthorityInfoAccess() + { + // Element is missing in config file, check for default value + assertFalse(provider_.getUseAuthorityInfoAccess()); + } +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java new file mode 100644 index 000000000..7da2165cb --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java @@ -0,0 +1,166 @@ +package test.at.gv.egovernment.moa.spss.server.config; + +import iaik.asn1.structures.Name; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; +import iaik.x509.X509Certificate; + +import java.util.List; +import java.util.Set; + +import junit.framework.TestCase; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.util.Constants; + +/** + * @author Gregor Karlinger + * @version $Id$ + */ +public class ConfigurationProviderTest3 extends TestCase +{ + private static final String CONFIG_BASE_ = + "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/"; + + static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_; + + static + { + System.setProperty( + "log4j.configuration", + "file:/" + CONFIG_BASE_ + "log4j.properties"); + System.setProperty( + at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME, + CONFIG_BASE_ + "moa.sp.noopts-config.xml"); + try + { + ConfigurationProvider.reload(); + provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance(); + } + catch (ConfigurationException e) + { + throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage()); + } + } + + /** + * Constructor for ConfigurationProvider. + * @param arg0 + */ + public ConfigurationProviderTest3() throws MOAException + { + super("ConfigurationProvider"); + } + + public void testGetWarnings() + { + // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found + assertEquals(3, provider_.getWarnings().size()); + } + + public void testGetDigestMethodAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.SHA1_URI, + provider_.getDigestMethodAlgorithmName()); + } + + public void testGetCanonicalizationAlgorithmName() + { + // Element is missing in config file, check if default value is returned + assertEquals( + Constants.C14N_URI, + provider_.getCanonicalizationAlgorithmName()); + } + + public void testGetHardwareCryptoModules() + { + // No hardware crypto modules in config file, check for empty list + List hwcms = provider_.getHardwareCryptoModules(); + assertEquals(0, hwcms.size()); + } + + public void testGetHardwareKeyModules() + { + // No hardware key modules in config file, check for empty list + List hwkms = provider_.getHardwareKeyModules(); + assertEquals(0, hwkms.size()); + } + + public void testGetSoftwareKeyModules() + { + // No software key modules in config file, check for empty list + List swkms = provider_.getSoftwareKeyModules(); + assertEquals(0, swkms.size()); + } + + public void testGetDistributionPoints() throws RFC2253NameParserException + { + // No distribution points in config file, check for emtpy set + X509Certificate cert = new X509Certificate(); + RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); + Name name = parser.parse(); + cert.setIssuerDN(name); + + Set dps = provider_.getDistributionPoints(cert); + assertEquals(0, dps.size()); + } + + public void testGetCRLArchiveDuration() + { + // No archive duration in config file, check for default value + assertEquals(0, provider_.getCRLArchiveDuration()); + } + + public void testGetCreateTransformsInfoProfile() + { + // No profile in config file, check for null + Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); + assertNull(ctip1); + } + + public void testGetCreateSignatureEnvironmentProfile() + { + // No profile in config file, check for null + Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); + assertNull(csep); + } + + public void testGetVerifyTransformsInfoProfile() + { + // No profile in config file, check for null + Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); + assertNull(vtip); + } + + public void testGetSupplementProfile() + { + // No profile in config file, check for null + Element sp = provider_.getSupplementProfile("SP_1"); + assertNull(sp); + } + + public void testGetRevocationArchiveJDBCURL() + { + // No archive in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCURL()); + } + + public void testGetRevocationArchiveJDBCDriverClass() + { + // No archive in config file, check for null + assertNull(provider_.getRevocationArchiveJDBCDriverClass()); + } + + public void testGetServiceOrder() + { + // Element is missing in config file, check for empty array + String[] serviceOrder = provider_.getServiceOrder(); + assertEquals(0, serviceOrder.length); + } +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java new file mode 100644 index 000000000..be1090e4a --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java @@ -0,0 +1,149 @@ +package test.at.gv.egovernment.moa.spss.server.iaik.config; + +import java.io.FileInputStream; +import java.security.KeyStore; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import iaik.asn1.structures.DistributionPoint; +import iaik.pki.PKIConfiguration; +import iaik.pki.pathvalidation.ChainingModes; +import iaik.pki.pathvalidation.ValidationConfiguration; +import iaik.pki.revocation.CRLDistributionPoint; +import iaik.pki.revocation.RevocationConfiguration; +import iaik.pki.store.certstore.CertStoreConfiguration; +import iaik.pki.store.certstore.CertStoreTypes; +import iaik.pki.store.revocation.archive.ArchiveConfiguration; +import iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter; +import iaik.server.ConfigurationData; +import iaik.server.modules.keys.HardwareKeyModuleConfiguration; +import iaik.server.modules.keys.SoftwareKeyModuleConfiguration; + +import at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImpl; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Tests the ConfigurationDataImpl. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ConfigurationDataImplTest extends SPSSTestCase { + + private ConfigurationData config; + private X509Certificate iaikCert; + + public ConfigurationDataImplTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + TransactionContext context; + + setUpTransactionContext(); + context = TransactionContextManager.getInstance().getTransactionContext(); + + config = new ConfigurationDataImpl(context.getConfiguration()); + + KeyStore ks = KeyStore.getInstance("JKS", "SUN"); + ks.load( + new FileInputStream(TESTDATA_ROOT + "security/server.keystore"), + "changeit".toCharArray()); + + CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); + Collection certs = + certFactory.generateCertificates( + new FileInputStream( + TESTDATA_ROOT + + "conf/moa-spss/trustprofiles/TrustProfile1/IAIKRoot.cer")); + iaikCert = (X509Certificate) certs.toArray()[0]; + + } + + public void testGetPKIConfiguration() { + PKIConfiguration pkiConfig = config.getPKIConfiguration(); + ArchiveConfiguration archiveConfig = pkiConfig.getArchiveConfiguration(); + CertStoreConfiguration certStoreConfig = + pkiConfig.getCertStoreConfiguration(); + RevocationConfiguration revocationConfig = + pkiConfig.getRevocationConfiguration(); + ValidationConfiguration validationConfig = + pkiConfig.getValidationConfiguration(); + DataBaseArchiveParameter archiveParam; + Set distributionPoints; + Iterator iter; + boolean found; + + // test archive parameters + archiveParam = + (DataBaseArchiveParameter) archiveConfig.getArchiveParameters(); + assertEquals( + archiveParam.getJDBCUrl(), + "jdbc:postgresql://10.16.46.108/moa?user=moa&password=moatest"); + + // test cert store configuration + assertEquals(1, certStoreConfig.getParameters().length); + assertEquals( + CertStoreTypes.DIRECTORY, + certStoreConfig.getParameters()[0].getType()); + + // test revocation configuration + distributionPoints = + revocationConfig.getAlternativeDistributionPoints(iaikCert, null, new Date()); + assertEquals(3, distributionPoints.size()); + found = false; + for (iter = distributionPoints.iterator(); iter.hasNext();) { + CRLDistributionPoint dp = (CRLDistributionPoint) iter.next(); + if (dp.getUri().equals("http://www.iaik.at/testCA/iaik_test_sig.crl")) { + found = + dp.getReasonCodes() + == (DistributionPoint.keyCompromise + | DistributionPoint.affiliationChanged); + } + } + assertTrue(found); + + // test validation configuration + assertEquals( + ChainingModes.PKIX_MODE, + validationConfig.getChainingMode(iaikCert)); + } + + /* + public void testGetCryptoModuleConfigurations() { + List cryptoConfigs = config.getCryptoModuleConfigurations(); + HardwareCryptoModuleConfiguration moduleConfig; + + assertEquals(2, cryptoConfigs.size()); + moduleConfig = (HardwareCryptoModuleConfiguration) cryptoConfigs.get(0); + assertEquals("Module1", moduleConfig.getModuleName()); + assertEquals("Slot1", moduleConfig.getSlotID()); + assertEquals("PIN1", new String(moduleConfig.getUserPIN())); + } + */ + + public void testGetKeyModuleConfigurations() { + List keyConfigs = config.getKeyModuleConfigurations(); + HardwareKeyModuleConfiguration hwKey; + SoftwareKeyModuleConfiguration swKey; + + assertEquals(7, keyConfigs.size()); + hwKey = (HardwareKeyModuleConfiguration) keyConfigs.get(0); + assertEquals("cryptoki.dll", hwKey.getModuleName()); + assertEquals("0", hwKey.getSlotID()); + assertEquals("0000", new String(hwKey.getUserPIN())); + swKey = (SoftwareKeyModuleConfiguration) keyConfigs.get(1); + assertEquals( + "buergerkarte", + new String(swKey.getKeyStoreAuthenticationData())); + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java new file mode 100644 index 000000000..3b403dc19 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java @@ -0,0 +1,36 @@ +package test.at.gv.egovernment.moa.spss.server.iaik.config; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; + +/** + * Tests the IaikConfigurator. + * + * @author Patrick Peck + * @version $Id$ + */ +public class IaikConfiguratorTest extends SPSSTestCase { + + public IaikConfiguratorTest(String name) { + super(name); + } + + /** + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUpTransactionContext(); + } + + public void testConfigure() throws Exception { + IaikConfigurator configurator = new IaikConfigurator(); + TransactionContext context = + TransactionContextManager.getInstance().getTransactionContext(); + + configurator.configure(context.getConfiguration()); + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java new file mode 100644 index 000000000..65fa2bf72 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java @@ -0,0 +1,25 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Runs all tests in this package. + * + * @author Patrick Peck + * @version $Id$ + */ +public class AllTests { + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(DataObjectFactoryTest.class); + suite.addTestSuite(TransformationFactoryTest.class); + suite.addTestSuite(XMLSignatureCreationInvokerTest.class); + suite.addTestSuite(CMSSignatureVerificationInvokerTest.class); + suite.addTestSuite(XMLSignatureVerificationInvokerTest.class); + + return suite; + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java new file mode 100644 index 000000000..3024730f4 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java @@ -0,0 +1,63 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; +import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; + +/** + * Mainly a smoke test for debugging the CMSSignatureVerificationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CMSSignatureVerificationInvokerTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyCMSSignature/"; + + /** + * Constructor for CMSSignatureVerificationInvokerTest. + * @param name + */ + public CMSSignatureVerificationInvokerTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + setUpTransactionContext(); + setUpLoggingContext(); + setUpIaikConfiguration(); + } + + public void testVerifyCMSSignature() throws Exception { + try { + CMSSignatureVerificationInvoker invoker = + CMSSignatureVerificationInvoker.getInstance(); + VerifyCMSSignatureRequestParser requestParser = + new VerifyCMSSignatureRequestParser(); + Document doc = + SPSSTestCase.parseXmlValidating( + TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml"); + VerifyCMSSignatureRequest request = + requestParser.parse(doc.getDocumentElement()); + VerifyCMSSignatureResponse response = invoker.verifyCMSSignature(request); + VerifyCMSSignatureResponseBuilder responseBuilder = + new VerifyCMSSignatureResponseBuilder(); + Element result = responseBuilder.build(response).getDocumentElement(); + + System.out.println(DOMUtils.serializeNode(result)); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java new file mode 100644 index 000000000..7de2add33 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java @@ -0,0 +1,180 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import java.io.InputStream; +import java.security.Security; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import iaik.server.modules.xml.BinaryDataObject; +import iaik.server.modules.xml.DataObject; +import iaik.server.modules.xml.XMLDataObject; + +import at.gv.egovernment.moa.util.Base64Utils; + +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.api.SPSSFactory; +import at.gv.egovernment.moa.spss.api.common.Content; +import at.gv.egovernment.moa.spss.server.iaik.xml.ByteArrayDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.ByteStreamDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLDataObjectImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.XMLNodeListDataObjectImpl; +import at.gv.egovernment.moa.spss.server.invoke.DataObjectFactory; + +/** + * Test cases for the DataObjectFactory class. + * + * @author Patrick Peck + * @version $Id$ + */ +public class DataObjectFactoryTest extends SPSSTestCase { + + private static final String HTTP_BINARY_CONTENT_URL = "http://www.google.com"; + private static final String HTTP_XML_CONTENT_URL = + "http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"; + private static final String HTTPS_BINARY_CONTENT_URL = + "https://businessnet.ba-ca.com"; + private static final String HTTPS_UNTRUSTED_URL = + "https://heribert.anecon.com"; + private static final String HTTP_UNKNOWN_HOST_URL = "http://uurjmjmruuw.com"; + private static final String MALFORMED_URL = "//hsld///ddd"; + private static final String FILE_BINARY_CONTENT_URL = "file:/C:/boot.ini"; + private static final String XML_CONTENT = + "" + + " " + + " " + + ""; + private static final String BASE64_CONTENT = "U3Zlbg=="; + + private SPSSFactory spssFactory = SPSSFactory.getInstance(); + private DataObjectFactory factory; + + /** + * Constructor for DataObjectFactoryTest. + * @param name + */ + public DataObjectFactoryTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + factory = DataObjectFactory.getInstance(); + + // set up SSL + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + System.setProperty( + "java.protocol.handler.pkgs", + "com.sun.net.ssl.internal.www.protocol"); + /* + System.setProperty( + "javax.net.ssl.keyStore", + "data/test/security/client.keystore"); + System.setProperty("javax.net.ssl.keyStorePassword", "changeit"); + System.setProperty( + "javax.net.ssl.trustStore", + "data/test/security/client.keystore"); + System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); + */ + } + + public void testCreateFromURIWithBinaryHttp() throws Exception { + DataObject dataObject = + factory.createFromURI(HTTP_BINARY_CONTENT_URL, false); + + assertNotNull(dataObject); + assertTrue(dataObject instanceof ByteStreamDataObjectImpl); + assertNotNull(((BinaryDataObject) dataObject).getInputStream()); + } + + public void testCreateFromURIWithXmlHttp() throws Exception { + DataObject dataObject = factory.createFromURI(HTTP_XML_CONTENT_URL, false); + Element element; + + assertNotNull(dataObject); + assertTrue(dataObject instanceof XMLDataObjectImpl); + element = ((XMLDataObject) dataObject).getElement(); + assertNotNull(element); + assertEquals("schema", element.getTagName()); + } + + public void testCreateFromURIWithMalformedURI() throws Exception { + try { + factory.createFromURI(MALFORMED_URL, false); + fail(); + } catch (MOAException e) { + } + } + + public void testCreateFromURIWithNonExistingHttpURL() throws Exception { + try { + factory.createFromURI(HTTP_UNKNOWN_HOST_URL, false); + fail(); + } catch (MOAException e) { + } + } + + public void testCreateFromURIWithHttps() throws Exception { + DataObject dataObject = + factory.createFromURI(HTTPS_BINARY_CONTENT_URL, false); + assertNotNull(dataObject); + assertTrue(dataObject instanceof BinaryDataObject); + } + + public void testCreateFromURIWithUntrustedHttps() throws Exception { + try { + factory.createFromURI(HTTPS_UNTRUSTED_URL, false); + fail(); + } catch (MOAException e) { + + } + } + + public void testCreateFromURIWithFile() throws Exception { + try { + factory.createFromURI(FILE_BINARY_CONTENT_URL, false); + fail(); + } catch (MOAException e) { + } + } + + public void testCreateFromContentOptionalRefTypeWithXmlContent() + throws Exception { + Document doc = parseXmlString(XML_CONTENT); + Content content = + spssFactory.createContent( + doc.getDocumentElement().getChildNodes(), + "http://data"); + DataObject dataObject = + factory.createFromContentOptionalRefType( + content, + null, + null, + true, + false, + true, + false); + + assertTrue(dataObject instanceof XMLNodeListDataObjectImpl); + } + + public void testCreateFromContentOptionalRefTypeWithBase64Content() + throws Exception { + InputStream is = Base64Utils.decodeToStream(BASE64_CONTENT, true); + Content content = spssFactory.createContent(is, "http://data"); + DataObject dataObject = + factory.createFromContentOptionalRefType( + content, + null, + null, + false, + false, + true, + false); + + assertNotNull(dataObject); + assertTrue(dataObject instanceof ByteArrayDataObjectImpl); + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java new file mode 100644 index 000000000..13a80cbf1 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java @@ -0,0 +1,201 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Document; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import iaik.ixsil.init.IXSILInit; +import iaik.ixsil.util.URI; +import iaik.server.modules.xml.Base64Transformation; +import iaik.server.modules.xml.Canonicalization; +import iaik.server.modules.xml.EnvelopedSignatureTransformation; +import iaik.server.modules.xml.Transformation; +import iaik.server.modules.xml.XPath2Transformation; +import iaik.server.modules.xml.XPathTransformation; +import iaik.server.modules.xml.XSLTTransformation; + +import at.gv.egovernment.moa.util.Constants; + +import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.api.common.Transform; +import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser; +import at.gv.egovernment.moa.spss.server.invoke.TransformationFactory; + +/** + * Test cases for the TransformationFactory class. + * + * @author Patrick Peck + * @version $Id$ + */ +public class TransformationFactoryTest extends SPSSTestCase { + + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/dsigTransform/"; + private TransformationFactory factory = TransformationFactory.getInstance(); + private TransformParser transformParser = new TransformParser(); + + /** + * Constructor for TransformationFactoryTest. + * @param name + */ + public TransformationFactoryTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + IXSILInit.init(new URI("init/properties/init.properties")); + //IXSILInit.init(new URI("file:data/deploy/ixsil/init/properties/init.properties")); + + } + + public void testCreateCanonicalization() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "canonicalization.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + + assertTrue(t instanceof Canonicalization); + assertEquals( + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", + t.getAlgorithmURI()); + } + + public void testCreateCanonicalizationWithComments() throws Exception { + Document transform = + parseXml(TESTDATA_BASE + "canonicalizationWithComments.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + + assertTrue(t instanceof Canonicalization); + assertEquals( + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", + t.getAlgorithmURI()); + } + + public void testCreateBase64Decode() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "base64.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + assertTrue(t instanceof Base64Transformation); + } + + public void testCreateEnvelopedSignature() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "enveloped.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + assertTrue(t instanceof EnvelopedSignatureTransformation); + } + + public void testXPathTransformation() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "xpath.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + Map nsDecls; + + assertTrue(t instanceof XPathTransformation); + nsDecls = ((XPathTransformation) t).getNamespaceDeclarations(); + assertEquals(1, nsDecls.size()); + assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); + } + + public void testCreateXPath2Transformation() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "xpath2.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + Transformation t = factory.createTransformation(tr); + assertTrue(t instanceof XPath2Transformation); + } + + public void testCreateXSLTTransformation() throws Exception { + Document transform = parseXml(TESTDATA_BASE + "xslt.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + XSLTTransformation t = + (XSLTTransformation) factory.createTransformation(tr); + assertNotNull(t.getStylesheetElement()); + } + + public void testCreateWithIllegalAlgorithm() throws Exception { + try { + Document transform = parseXml(TESTDATA_BASE + "illegalAlgorithm.xml"); + Transform tr = + transformParser.parseTransform(transform.getDocumentElement()); + factory.createTransformation(tr); + fail(); + } catch (MOAApplicationException e) { + } + } + + public void testEqualsXslt() throws Exception { + Document xslt = parseXml(TESTDATA_BASE + "xslt.xml"); + Transform tr = transformParser.parseTransform(xslt.getDocumentElement()); + Transformation trXslt = factory.createTransformation(tr); + + Document xsltEqu = parseXml(TESTDATA_BASE + "xsltEqual.xml"); + tr = transformParser.parseTransform(xsltEqu.getDocumentElement()); + Transformation trXsltEqu = factory.createTransformation(tr); + + Document xsltDiff = parseXml(TESTDATA_BASE + "xsltDifferent.xml"); + tr = transformParser.parseTransform(xsltDiff.getDocumentElement()); + Transformation trXsltDiff = factory.createTransformation(tr); + + Document canonicalization = + parseXml(TESTDATA_BASE + "canonicalization.xml"); + + assertTrue(trXslt.equals(trXsltEqu)); + assertFalse(trXslt.equals(trXsltDiff)); + assertFalse(trXsltEqu.equals(trXsltDiff)); + assertEquals(trXslt.hashCode(), trXsltEqu.hashCode()); + assertFalse(trXslt.hashCode() == trXsltDiff.hashCode()); + assertFalse(trXsltEqu.hashCode() == trXsltDiff.hashCode()); + assertFalse(trXslt.equals(canonicalization)); + } + + public void testEqualsXPath() throws Exception { + Document xpath = parseXml(TESTDATA_BASE + "xpath.xml"); + Transform tr = transformParser.parseTransform(xpath.getDocumentElement()); + Transformation trXpath = factory.createTransformation(tr); + Transformation trXpathEqu = factory.createTransformation(tr); + + Document xpathDiff = parseXml(TESTDATA_BASE + "xpathDifferent.xml"); + tr = transformParser.parseTransform(xpathDiff.getDocumentElement()); + Transformation trXpathDiff = factory.createTransformation(tr); + + assertTrue(trXpath.equals(trXpathEqu)); + assertEquals(trXpath.hashCode(), trXpathEqu.hashCode()); + assertFalse(trXpath.equals(trXpathDiff)); + assertFalse(trXpath.hashCode() == trXpathDiff.hashCode()); + } + + public void testEqualsXPath2() throws Exception { + Document xpath2 = parseXml(TESTDATA_BASE + "xpath2.xml"); + Transform tr = transformParser.parseTransform(xpath2.getDocumentElement()); + Transformation trXpath2 = factory.createTransformation(tr); + Transformation trXpath2Equ = factory.createTransformation(tr); + + Document xpath2Diff = parseXml(TESTDATA_BASE + "xpath2Different.xml"); + tr = transformParser.parseTransform(xpath2Diff.getDocumentElement()); + Transformation trXpath2Diff = factory.createTransformation(tr); + + assertTrue(trXpath2.equals(trXpath2Equ)); + assertEquals(trXpath2.hashCode(), trXpath2Equ.hashCode()); + assertFalse(trXpath2.equals(trXpath2Diff)); + assertFalse(trXpath2.hashCode() == trXpath2Diff.hashCode()); + } + + public void testCreateTransformationList() throws Exception { + Document transforms = parseXml(TESTDATA_BASE + "transforms.xml"); + List trs = transformParser.parseTransforms(transforms.getDocumentElement()); + List transformationList = factory.createTransformationList(trs); + + assertEquals(3, transformationList.size()); + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java new file mode 100644 index 000000000..28cd3805a --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java @@ -0,0 +1,63 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import java.util.Collections; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureCreationInvoker; + +/** + * Mainly a smoke test for debugging the XMLSignatureCreationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureCreationInvokerTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/CreateXMLSignature/"; + + public XMLSignatureCreationInvokerTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + setUpTransactionContext(); + setUpLoggingContext(); + setUpIaikConfiguration(); + setUpSSL(); + } + + public void testCreateXMLSignature() throws Exception { + try { + XMLSignatureCreationInvoker invoker = + XMLSignatureCreationInvoker.getInstance(); + CreateXMLSignatureRequestParser requestParser = + new CreateXMLSignatureRequestParser(); + Document doc = + SPSSTestCase.parseXmlValidating( + TESTDATA_BASE + "TestGeneratorCX2.004.Req.xml"); + CreateXMLSignatureRequest request = + requestParser.parse(doc.getDocumentElement()); + CreateXMLSignatureResponse response = + invoker.createXMLSignature(request, Collections.EMPTY_SET); + CreateXMLSignatureResponseBuilder responseBuilder = + new CreateXMLSignatureResponseBuilder(); + Element result = responseBuilder.build(response).getDocumentElement(); + + System.out.println(DOMUtils.serializeNode(result)); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java new file mode 100644 index 000000000..56e3d541b --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java @@ -0,0 +1,61 @@ +package test.at.gv.egovernment.moa.spss.server.invoke; + +import org.w3c.dom.Document; + +import test.at.gv.egovernment.moa.spss.SPSSTestCase; + +import at.gv.egovernment.moa.util.DOMUtils; + +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser; +import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureResponseBuilder; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; +import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureVerificationInvoker; + +/** + * Mainly a smoke test for debugging the XMLSignatureVerificationInvoker. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLSignatureVerificationInvokerTest extends SPSSTestCase { + private static final String TESTDATA_BASE = + TESTDATA_ROOT + "xml/VerifyXMLSignature/"; + + public XMLSignatureVerificationInvokerTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + setUpTransactionContext(); + setUpLoggingContext(); + setUpIaikConfiguration(); + } + + public void testVerifyXMLSignature() throws Exception { + try { + XMLSignatureVerificationInvoker invoker = + XMLSignatureVerificationInvoker.getInstance(); + VerifyXMLSignatureRequestParser requestParser = + new VerifyXMLSignatureRequestParser(); + VerifyXMLSignatureResponseBuilder responseBuilder = + new VerifyXMLSignatureResponseBuilder(); + Document doc = + SPSSTestCase.parseXmlValidating( + TESTDATA_BASE + "TestGeneratorVX.201.Req.xml"); + + VerifyXMLSignatureRequest request = + requestParser.parse(doc.getDocumentElement()); + VerifyXMLSignatureResponse response; + + response = invoker.verifyXMLSignature(request); + System.out.println( + DOMUtils.serializeNode(responseBuilder.build(response))); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + +} diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java new file mode 100644 index 000000000..ac6e8c3e0 --- /dev/null +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java @@ -0,0 +1,49 @@ +package test.at.gv.egovernment.moa.spss.server.tools; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import at.gv.egovernment.moa.spss.server.tools.CertTool; +import test.at.gv.egovernment.moa.MOATestCase; + +/** + * Tests for the CertTool. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CertToolTest extends MOATestCase { + + private static final String EXPECTED_RESULT = + "SubjectDN (RFC2253):" + + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" + + "IssuerDN (RFC2253) :" + + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" + + "Serial Number :" + + " 1047548672\r\n"; + private CertTool certTool; + + /** + * Constructor for CertToolTest. + * @param name + */ + public CertToolTest(String name) { + super(name); + } + + protected void setUp() { + certTool = new CertTool(); + } + + public void testPrintCertInfo() { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PrintStream ps = new PrintStream(bos); + String result; + + certTool.printCertInfo(TESTDATA_ROOT + "security/server.cer", ps); + result = new String(bos.toByteArray()); + System.out.println(result); + assertEquals(EXPECTED_RESULT, result); + } + +} -- cgit v1.2.3 From 072f482d381f6cc00c336e3f633c975eae3aef37 Mon Sep 17 00:00:00 2001 From: pdanner Date: Tue, 11 Sep 2007 10:24:18 +0000 Subject: fixed build process for spss tools git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1004 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 87e9b5575..5f0a4eeb1 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -126,6 +126,7 @@ MOA.spss.server moa-spss-tools + test -- cgit v1.2.3 From 3ca5552c3a3bf842df2557cf820b6de40c95768c Mon Sep 17 00:00:00 2001 From: pdanner Date: Tue, 11 Sep 2007 11:44:33 +0000 Subject: fixed build process for spss tests git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1007 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 5f0a4eeb1..2f4999825 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -122,6 +122,7 @@ MOA moa-common test-jar + test MOA.spss.server -- cgit v1.2.3 From 20689558ce4a30b369644e9cf31619237490517f Mon Sep 17 00:00:00 2001 From: pdanner Date: Thu, 13 Sep 2007 09:36:37 +0000 Subject: went back to axis 1.0 in SP/SS (dsig-Namespaceproblem on provided Stylesheets), fixed bug in transactions entity-cache git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1008 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 452 +++++++++++---------- .../moa/spss/server/invoke/DataObjectFactory.java | 14 +- .../moa/spss/server/service/AxisHandler.java | 26 +- .../server/service/SignatureCreationService.java | 2 +- .../service/SignatureVerificationService.java | 2 +- .../server/transaction/TransactionContext.java | 5 +- 6 files changed, 268 insertions(+), 233 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 2f4999825..514b43b82 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -1,220 +1,240 @@ - - - MOA.spss - moa-spss - 1.4.x - + + + MOA.spss + moa-spss + 1.4.x + - 4.0.0 - MOA.spss.server - moa-spss-lib - jar - 1.4.2 - MOA SP/SS API + 4.0.0 + MOA.spss.server + moa-spss-lib + jar + 1.4.2beta1 + MOA SP/SS API - - ${basedir}/../../../repository - - - - - axis - axis - - - commons-discovery - commons-discovery - - - commons-logging - commons-logging - - - javax.activation - activation - - - javax.mail - mail - - - junit - junit - - - log4j - log4j - - - postgresql - postgresql - - - javax.servlet - servlet-api - provided - - - xalan-bin-dist - xalan - compile - - - xerces - xercesImpl - - - xalan-bin-dist - xml-apis - - - xalan-bin-dist - serializer - - - iaik.prod - iaik_moa - - - iaik.prod - iaik_ixsil - - - iaik.prod - iaik_jce_full - compile - - - iaik.prod - iaik_ecc - compile - - - iaik.prod - iaik_cms - runtime - - - iaik.prod - iaik_Pkcs11Provider - runtime - - - iaik.prod - iaik_Pkcs11Wrapper - runtime - - - iaik.prod - iaik_Pkcs11Wrapper - win32 - dll - runtime - true - - - MOA - moa-common - jar - - - MOA - moa-common - test-jar - test - - - MOA.spss.server - moa-spss-tools - test - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - false - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.2 - - true - false - false - true - at.gv.egovernment.moa.spss.server.*;at.gv.egovernment.moa.spss.api.impl.*;at.gv.egovernment.moa.spss.impl.* - - - pre - a - Preconditions: - - - post - a - Postconditions: - - - - - API Factory and Services - at.gv.egovernment.moa.spss.api - - - Exceptions - at.gv.egovernment.moa.spss - - - API Objects for Signature Creation - at.gv.egovernment.moa.spss.api.xmlsign - - - API Objects for CMS Signature Verification - at.gv.egovernment.moa.spss.api.cmsverify - - - API Objects for XML Signature Verification - at.gv.egovernment.moa.spss.api.xmlverify - - - Common API Objects - at.gv.egovernment.moa.spss.api.common - - - Builders and Parsers to convert API Objects to and from XML - at.gv.egovernment.moa.spss.api.xmlbind - - - Utilities - at.gv.egovernment.moa.util - at.gv.egovernment.moa.spss.util - - - Logging - at.gv.egovernment.moa.logging - - - http://java.sun.com/j2se/1.4/docs/api/ - - - - generate-javadoc - package - - jar - - - - - - + + ${basedir}/../../../repository + + + + + axis + axis + + + axis + axis-jaxrpc + + + axis + axis-saaj + + + axis + axis-wsdl4j + + + commons-discovery + commons-discovery + + + commons-logging + commons-logging + + + javax.activation + activation + + + javax.mail + mail + + + junit + junit + + + log4j + log4j + + + postgresql + postgresql + + + javax.servlet + servlet-api + provided + + + xalan-bin-dist + xalan + compile + + + xerces + xercesImpl + + + xalan-bin-dist + xml-apis + + + xalan-bin-dist + serializer + + + iaik.prod + iaik_moa + + + iaik.prod + iaik_ixsil + + + iaik.prod + iaik_jce_full + compile + + + iaik.prod + iaik_ecc + compile + + + iaik.prod + iaik_cms + runtime + + + iaik.prod + iaik_Pkcs11Provider + runtime + + + iaik.prod + iaik_Pkcs11Wrapper + runtime + + + iaik.prod + iaik_Pkcs11Wrapper + win32 + dll + runtime + true + + + MOA + moa-common + jar + + + + MOA + moa-common + test-jar + test + + + MOA.spss.server + moa-spss-tools + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + false + + + + + test-jar + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.2 + + true + false + false + true + at.gv.egovernment.moa.spss.server.*;at.gv.egovernment.moa.spss.api.impl.*;at.gv.egovernment.moa.spss.impl.* + + + pre + a + Preconditions: + + + post + a + Postconditions: + + + + + API Factory and Services + at.gv.egovernment.moa.spss.api + + + Exceptions + at.gv.egovernment.moa.spss + + + API Objects for Signature Creation + at.gv.egovernment.moa.spss.api.xmlsign + + + API Objects for CMS Signature Verification + at.gv.egovernment.moa.spss.api.cmsverify + + + API Objects for XML Signature Verification + at.gv.egovernment.moa.spss.api.xmlverify + + + Common API Objects + at.gv.egovernment.moa.spss.api.common + + + Builders and Parsers to convert API Objects to and from XML + at.gv.egovernment.moa.spss.api.xmlbind + + + Utilities + at.gv.egovernment.moa.util + at.gv.egovernment.moa.spss.util + + + Logging + at.gv.egovernment.moa.logging + + + http://java.sun.com/j2se/1.4/docs/api/ + + + + generate-javadoc + package + + jar + + + + + + diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java index ad0da28f4..0abd80944 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -191,6 +191,7 @@ public class DataObjectFactory { } // try to parse validating + Logger.trace(">>> parsing the following content: \n" + new String(contentBytes)); try { ByteArrayInputStream is = new ByteArrayInputStream(contentBytes); Document doc = @@ -201,6 +202,7 @@ public class DataObjectFactory { null, entityResolver, new MOAErrorHandler()); + Logger.trace("<<< parsed"); return new XMLDataObjectImpl(doc.getDocumentElement()); } catch (Exception e) { @@ -304,18 +306,12 @@ public class DataObjectFactory { } case Content.LOCREF_CONTENT: { - InputStream contentIS = null; String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); - TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); - Vector entity = context.FindResolvedEntity(locRefURI); - if (entity!=null) { - contentIS = (InputStream) entity.get(0); - } else { + if (context.FindResolvedEntity(locRefURI)==null) { ExternalURIResolver uriResolver = new ExternalURIResolver(); - InputStream uriStream = null; byte[] contentBytes; String contentType = null; @@ -323,7 +319,6 @@ public class DataObjectFactory { { uriStream = uriResolver.resolve(locRefURI); contentBytes = StreamUtils.readStream(uriStream); - contentIS = new ByteArrayInputStream(contentBytes); contentType = uriResolver.getContentType(); } catch (Exception e) @@ -334,9 +329,10 @@ public class DataObjectFactory { { closeInputStream(uriStream); } - entities.put(locRefURI, contentIS); context.PutResolvedEntity(locRefURI, contentBytes, contentType); } + InputStream contentIS = context.ResolveURI(locRefURI); + entities.put(reference, contentIS); break; } case Content.XML_CONTENT : diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java index f5f77ff50..8e5c8a49b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -1,6 +1,7 @@ package at.gv.egovernment.moa.spss.server.service; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -18,6 +19,8 @@ import org.apache.axis.handlers.BasicHandler; import org.apache.axis.transport.http.HTTPConstants; import org.apache.axis.utils.Messages; import org.apache.axis.utils.XMLUtils; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -27,7 +30,6 @@ import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.logging.LoggingContext; import at.gv.egovernment.moa.logging.LoggingContextManager; import at.gv.egovernment.moa.spss.MOASystemException; -import at.gv.egovernment.moa.spss.api.common.Content; import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; @@ -105,7 +107,11 @@ public class AxisHandler extends BasicHandler { (X509Certificate[]) request.getAttribute(X509_CERTIFICATE_PROPERTY); //Configure Axis +// AxisProperties.setProperty(AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION,"false"); +// AxisProperties.setProperty(AxisEngine.PROP_DOMULTIREFS,"false"); +// AxisProperties.setProperty(AxisEngine.PROP_SEND_XSI,"true"); //msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE); + //msgContext.setProperty(org.apache.axis. AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION,"false"); Message soapMessage = msgContext.getCurrentMessage(); @@ -201,9 +207,21 @@ public class AxisHandler extends BasicHandler { info("handler.03", null); } if (Logger.isDebugEnabled()) { - String msg = soapMessage.getSOAPPartAsString(); - Logger.debug(new LogMsg(msg)); - } +// OutputFormat format = new OutputFormat((Document) xmlRequest.getOwnerDocument()); +// format.setLineSeparator("\n"); +// format.setIndenting(false); +// format.setPreserveSpace(true); +// format.setOmitXMLDeclaration(false); +// format.setEncoding("UTF-8"); +// ByteArrayOutputStream baos = new ByteArrayOutputStream(); +// XMLSerializer conSerializer = new XMLSerializer(baos, format); +// conSerializer.serialize(xmlRequest); +// Logger.debug(new LogMsg("Request:" + baos.toString())); + + + String msg = soapMessage.getSOAPPartAsString(); + Logger.debug(new LogMsg(msg)); + } } catch (MOASystemException e) { MOASystemException se = new MOASystemException("2900", null, e); AxisFault fault = AxisFault.makeFault(se); diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java index c173625f8..8fceb6fb6 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java @@ -70,7 +70,7 @@ public class SignatureCreationService { //since Axis (1.1 ff) has problem with namespaces we take the raw request stored by the Axishandler. TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); // validate the request - reparsedReq = ServiceUtils.reparseRequest(context.getRequest()); + reparsedReq = ServiceUtils.reparseRequest(request[0]);//context.getRequest()); // convert to API objects Logger.trace(">>> preparsing Request"); diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java index b335a6e23..feb49ffbf 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java @@ -56,7 +56,7 @@ public class SignatureVerificationService { //since Axis (1.1 ff) has problem with namespaces we take the raw request stored by the Axishandler. TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); // validate the request - reparsedReq = ServiceUtils.reparseRequest(context.getRequest()); + reparsedReq = ServiceUtils.reparseRequest(request[0]);//context.getRequest()); // convert to API objects requestObj = requestParser.parse(reparsedReq); diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java index 5c1e35a95..62db42674 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java @@ -273,8 +273,9 @@ public void cleanAttachmentCache() { if (mmds!=null) { InputStream is = mmds.getInputStream(); if (is!=null) is.close(); - File f = mmds.getDiskCacheFile(); - if (f!=null) f.delete(); +// not available in Axis 1.0 to 1.1 +// File f = mmds.getDiskCacheFile(); +// if (f!=null) f.delete(); mmds.delete(); } } catch (IOException e) { -- cgit v1.2.3 From 83f01ddf24d98dbb5df41fb627a14edee2d57df7 Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 17 Oct 2007 16:18:44 +0000 Subject: Implemented and integrated party representation and integrated mandates as per default available Now Eclipse projects are available. The Web Tools Platform can be used to run the web applications git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1014 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/.classpath | 9 ++++++ spss/server/serverlib/.project | 36 ++++++++++++++++++++++ .../serverlib/.settings/org.eclipse.jdt.core.prefs | 7 +++++ .../.settings/org.eclipse.wst.common.component | 8 +++++ .../org.eclipse.wst.common.project.facet.core.xml | 7 +++++ spss/server/serverlib/pom.xml | 2 +- .../serverlib/src/main/java/META-INF/MANIFEST.MF | 3 ++ 7 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 spss/server/serverlib/.classpath create mode 100644 spss/server/serverlib/.project create mode 100644 spss/server/serverlib/.settings/org.eclipse.jdt.core.prefs create mode 100644 spss/server/serverlib/.settings/org.eclipse.wst.common.component create mode 100644 spss/server/serverlib/.settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 spss/server/serverlib/src/main/java/META-INF/MANIFEST.MF (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/.classpath b/spss/server/serverlib/.classpath new file mode 100644 index 000000000..01edb156d --- /dev/null +++ b/spss/server/serverlib/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/spss/server/serverlib/.project b/spss/server/serverlib/.project new file mode 100644 index 000000000..8038e29f2 --- /dev/null +++ b/spss/server/serverlib/.project @@ -0,0 +1,36 @@ + + + moa-spss-lib + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + + diff --git a/spss/server/serverlib/.settings/org.eclipse.jdt.core.prefs b/spss/server/serverlib/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..c7b8a7c31 --- /dev/null +++ b/spss/server/serverlib/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +#Wed Oct 10 21:50:15 CEST 2007 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.4 diff --git a/spss/server/serverlib/.settings/org.eclipse.wst.common.component b/spss/server/serverlib/.settings/org.eclipse.wst.common.component new file mode 100644 index 000000000..ebc030867 --- /dev/null +++ b/spss/server/serverlib/.settings/org.eclipse.wst.common.component @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/spss/server/serverlib/.settings/org.eclipse.wst.common.project.facet.core.xml b/spss/server/serverlib/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 000000000..30c02fe23 --- /dev/null +++ b/spss/server/serverlib/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 514b43b82..b5c9c1ec2 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -9,7 +9,7 @@ MOA.spss.server moa-spss-lib jar - 1.4.2beta1 + 1.4.2beta2 MOA SP/SS API diff --git a/spss/server/serverlib/src/main/java/META-INF/MANIFEST.MF b/spss/server/serverlib/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 000000000..5e9495128 --- /dev/null +++ b/spss/server/serverlib/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + -- cgit v1.2.3 From 0e6b00ff7255a026fbfb8a12f122a09f135f2855 Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 17 Oct 2007 21:16:34 +0000 Subject: Fixed SPSS Apidoc git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1017 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java | 4 ++-- .../java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java index 2acb12e51..8acd03a3e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java @@ -27,7 +27,7 @@ public class CheckResultImpl implements CheckResult { } /** - * @see at.gv.egovernment.moa.spss.api.CheckResult#getCode() + * @see at.gv.egovernment.moa.spss.api.common.CheckResult#getCode() */ public int getCode() { return code; @@ -43,7 +43,7 @@ public class CheckResultImpl implements CheckResult { } /** - * @see at.gv.egovernment.moa.spss.api.CheckResult#getInfo() + * @see at.gv.egovernment.moa.spss.api.common.CheckResult#getInfo() */ public NodeList getInfo() { return info; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java index 902f7bd72..1e0e2dc63 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java @@ -16,7 +16,7 @@ public class ContentLocRefImpl extends ContentImpl implements ContentLocRef private String locationReferenceURI_; /** - * @see at.gv.egovernment.moa.spss.api.common.ContentLocRef#getLocationReference() + * @see at.gv.egovernment.moa.spss.api.common.ContentLocRef#getLocationReferenceURI() */ public String getLocationReferenceURI() { -- cgit v1.2.3 From d19cd318b86feacd77dde2ff344b68f4439461a9 Mon Sep 17 00:00:00 2001 From: pdanner Date: Thu, 18 Oct 2007 15:35:37 +0000 Subject: Show also SZR-gateway communication error 4000 on parep validation git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1022 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/.project | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/.project b/spss/server/serverlib/.project index 8038e29f2..973671634 100644 --- a/spss/server/serverlib/.project +++ b/spss/server/serverlib/.project @@ -16,12 +16,12 @@ - org.maven.ide.eclipse.maven2Builder + org.eclipse.wst.validation.validationbuilder - org.eclipse.wst.validation.validationbuilder + org.maven.ide.eclipse.maven2Builder -- cgit v1.2.3 From eaeae88fff31b34a75fff38fb7f08c6c6415aa3d Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 7 Nov 2007 09:55:40 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1035 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/.classpath | 2 +- spss/server/serverlib/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/.classpath b/spss/server/serverlib/.classpath index 01edb156d..eac66f93e 100644 --- a/spss/server/serverlib/.classpath +++ b/spss/server/serverlib/.classpath @@ -3,7 +3,7 @@ - + diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index b5c9c1ec2..65b005fec 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -9,7 +9,7 @@ MOA.spss.server moa-spss-lib jar - 1.4.2beta2 + 1.4.2 MOA SP/SS API -- cgit v1.2.3 From de1331212b42603ed762ec69c234b32a71fa764d Mon Sep 17 00:00:00 2001 From: pdanner Date: Fri, 16 Nov 2007 15:18:03 +0000 Subject: Refined Eclipse WTP settings; changed standard configuration git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1041 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/.classpath | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/.classpath b/spss/server/serverlib/.classpath index eac66f93e..01edb156d 100644 --- a/spss/server/serverlib/.classpath +++ b/spss/server/serverlib/.classpath @@ -3,7 +3,7 @@ - + -- cgit v1.2.3 From 3995c5a93a47fb71d7571a197702434b3261a359 Mon Sep 17 00:00:00 2001 From: pdanner Date: Fri, 16 Nov 2007 15:24:02 +0000 Subject: Refined Eclipse WTP settings git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1042 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/src/main/java/META-INF/MANIFEST.MF | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 spss/server/serverlib/src/main/java/META-INF/MANIFEST.MF (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/META-INF/MANIFEST.MF b/spss/server/serverlib/src/main/java/META-INF/MANIFEST.MF deleted file mode 100644 index 5e9495128..000000000 --- a/spss/server/serverlib/src/main/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - -- cgit v1.2.3 From a672b7a14f43f2ba63c94120fce78861b225a0f1 Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 21 Nov 2007 12:55:36 +0000 Subject: optimized API-DOC git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1049 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 65b005fec..f1c883008 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -222,7 +222,12 @@ at.gv.egovernment.moa.logging - http://java.sun.com/j2se/1.4/docs/api/ + + http://java.sun.com/j2se/1.4/docs/api/ + http://java.sun.com/j2se/1.5.0/docs/api/ + http://logging.apache.org/log4j/docs/api/ + + 1.4 -- cgit v1.2.3 From 8a0a31c377fbf2873714df580e7ddf8e248e2011 Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 16 Jan 2008 13:36:18 +0000 Subject: Preparation for 1.4.3 release (changed project version) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1058 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index f1c883008..5b224eef6 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -9,7 +9,7 @@ MOA.spss.server moa-spss-lib jar - 1.4.2 + 1.4.3 MOA SP/SS API -- cgit v1.2.3 From d80c2d33d88e0b7bcd88eb7fed0721d1a3235217 Mon Sep 17 00:00:00 2001 From: pdanner Date: Fri, 25 Jan 2008 12:43:47 +0000 Subject: Fixed typo git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1060 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/main/resources/resources/properties/spss_messages_de.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties b/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties index 19a4a89af..9b896c059 100644 --- a/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties +++ b/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties @@ -114,7 +114,7 @@ config.07=Fehler in der Konfiguration: Reason code {0} unbekannt config.08=Fehler beim Konfigurieren der IAIK-Module config.09=Fehler beim Öffnen der Schlüssel-Datei {0} config.10=Fehler beim Einlesen der Konfiguration (siehe Log-Datei für Details) -config.11=Fehler biem Erstellen der Konfiguration (siehe Log-Datei für Details) +config.11=Fehler beim Erstellen der Konfiguration (siehe Log-Datei für Details) config.12=Fehler beim Einlesen des Profils config.13=Fehler beim Erstellen des CRLDistributionPoint: CAIssuerDN={0} ungültig config.14=Das Attribut {0} für das TrustProfile mit id={1} ist ungültig (Wert={2}) -- cgit v1.2.3 From c940b711f4358d07c5b58cd1f48f7d8d6889e2c7 Mon Sep 17 00:00:00 2001 From: pdanner Date: Fri, 25 Jan 2008 12:45:02 +0000 Subject: Changed taking out of xml-request from soap message to be more robust again white spaces git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1061 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../at/gv/egovernment/moa/spss/server/service/AxisHandler.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java index 8e5c8a49b..3a7f13c48 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -1,7 +1,6 @@ package at.gv.egovernment.moa.spss.server.service; import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -19,8 +18,6 @@ import org.apache.axis.handlers.BasicHandler; import org.apache.axis.transport.http.HTTPConstants; import org.apache.axis.utils.Messages; import org.apache.axis.utils.XMLUtils; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -121,9 +118,10 @@ public class AxisHandler extends BasicHandler { Element xmlRequest = null; Element soapPart = DOMUtils.parseDocument(new ByteArrayInputStream(soapMessage.getSOAPPartAsBytes()), false, null, null).getDocumentElement(); if (soapPart!=null) { + //TODO: check if DOM Version is intolerant when white spaces are between tags (preceding normalization would be necessary) NodeList soapBodies = soapPart.getElementsByTagNameNS(SOAP_NS_URI, "Body"); if (soapBodies!=null && soapBodies.getLength()>0) { - xmlRequest = (Element) soapBodies.item(0).getFirstChild(); + xmlRequest = DOMUtils.getElementFromNodeList(soapBodies.item(0).getChildNodes()); } //oder TODO: Evaluierung ob XPATH schneller /* @@ -131,7 +129,7 @@ public class AxisHandler extends BasicHandler { nSMap.put((String)SOAP_PREFIX, SOAP_NS_URI); Element soapBody = (Element) XPathUtils.selectSingleNode(soapPart, nSMap, "/"+SOAP_PREFIX+":Envelope/"+SOAP_PREFIX+":Body"); if (soapBody!=null) { - xmlRequest= (Element) soapBody.getFirstChild(); + xmlRequest = DOMUtils.getElementFromNodeList(soapBody.getChildNodes()); } */ } -- cgit v1.2.3 From b1c951bd4c125f52123d4a6947f459b505f8beb1 Mon Sep 17 00:00:00 2001 From: pdanner Date: Thu, 27 Mar 2008 07:36:10 +0000 Subject: Added trace logs, resolved link issues in documentation git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1062 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../at/gv/egovernment/moa/spss/server/service/AxisHandler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java index 3a7f13c48..b079667b0 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -204,7 +204,7 @@ public class AxisHandler extends BasicHandler { } else { info("handler.03", null); } - if (Logger.isDebugEnabled()) { + if (Logger.isTraceEnabled()) { // OutputFormat format = new OutputFormat((Document) xmlRequest.getOwnerDocument()); // format.setLineSeparator("\n"); // format.setIndenting(false); @@ -218,7 +218,7 @@ public class AxisHandler extends BasicHandler { String msg = soapMessage.getSOAPPartAsString(); - Logger.debug(new LogMsg(msg)); + Logger.trace(new LogMsg(msg)); } } catch (MOASystemException e) { MOASystemException se = new MOASystemException("2900", null, e); @@ -270,6 +270,9 @@ public class AxisHandler extends BasicHandler { serializedBytes.close(); xmlResponseString = serializedBytes.toString("UTF-8"); */ + if (Logger.isTraceEnabled()) { + Logger.trace(new LogMsg(xmlResponseString)); + } soapResponseString = SOAP_PART_PRE + xmlResponseString + SOAP_PART_POST; //override axis response-message msgContext.setResponseMessage(new Message(soapResponseString)); -- cgit v1.2.3 From b00fd777ba1c564b1f4b3fdf14ec4d23ff80c1ea Mon Sep 17 00:00:00 2001 From: spuchmann Date: Thu, 8 May 2008 14:04:44 +0000 Subject: added PermitFileURIs; removing unnecessary dependencies to Sun's JSSE git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1071 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../server/config/ConfigurationPartsBuilder.java | 16 +++++++++++-- .../spss/server/config/ConfigurationProvider.java | 17 ++++++++++++-- .../xmlsign/XMLSignatureCreationProfileImpl.java | 7 ++++++ .../XMLSignatureVerificationProfileImpl.java | 21 +++++++++++++++-- .../moa/spss/server/init/SystemInitializer.java | 27 ++-------------------- .../XMLSignatureVerificationProfileFactory.java | 4 +++- 6 files changed, 60 insertions(+), 32 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 14ceb71cd..327b66f54 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -190,7 +190,9 @@ public class ConfigurationPartsBuilder { private static final String SUPPLEMENT_PROFILE_XPATH = ROOT + CONF + "SignatureVerification/" + CONF + "SupplementProfile"; - + private static final String PERMIT_FILE_URIS_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "PermitFileURIs"; // // default values for configuration parameters // @@ -1235,5 +1237,15 @@ public class ConfigurationPartsBuilder { String autoAdd = getElementValue(getConfigElem(), AUTO_ADD_CERTIFICATES_XPATH_, null); return Boolean.valueOf(autoAdd).booleanValue(); } - + + /** + * Returns whether file URIs are permitted + * @return whether file URIs are permitted + */ + public boolean getPermitFileURIs() + { + String permitFileURIs = getElementValue(getConfigElem(), PERMIT_FILE_URIS_XPATH, "false"); + return Boolean.valueOf(permitFileURIs).booleanValue(); + } + } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java index 57f06326a..16bf153c9 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java @@ -206,7 +206,11 @@ public class ConfigurationProvider * be used during certificate path construction. */ private boolean useAuthorityInfoAccess_; - + /** + * Indicates whether file URIs are allowed or not + */ + private boolean permitFileURIs; + /** * Return the single instance of configuration data. * @@ -319,6 +323,7 @@ public class ConfigurationProvider verifyTransformsInfoProfiles = builder.buildVerifyTransformsInfoProfiles(); supplementProfiles = builder.buildSupplementProfiles(); warnings = new ArrayList(builder.getWarnings()); + permitFileURIs = builder.getPermitFileURIs(); } catch (Throwable t) { throw new ConfigurationException("config.11", null, t); } finally { @@ -685,5 +690,13 @@ public class ConfigurationProvider { return useAuthorityInfoAccess_; } - + + /** + * Returns whether the file URIs are permitted or not + * @return whether the file URIs are permitted or not + */ + public boolean getPermitFileURIs() + { + return permitFileURIs; + } } \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java index fb3ff4931..2a35e5892 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java @@ -275,5 +275,12 @@ public class XMLSignatureCreationProfileImpl public String getSignedPropertiesID() { return propertyIDGenerator.uniqueId(); } + + /** + * @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getPermitFileURIs() + */ + public boolean getPermitFileURIs() { + return false; + } } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java index 216596dc3..ab302388d 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java @@ -26,7 +26,8 @@ public class XMLSignatureVerificationProfileImpl private boolean includeHashInputData; /** Whether to include reference input data in the response. */ private boolean includeReferenceInputData; - + /** Whether the file URIs are permitted */ + private boolean permitFileURIs; /** * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#checkSecurityLayerManifest() */ @@ -127,5 +128,21 @@ public class XMLSignatureVerificationProfileImpl public void setIncludeReferenceInputData(boolean includeReferenceInputData) { this.includeReferenceInputData = includeReferenceInputData; } - + + /** + * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#getPermitFileURIs() + */ + public boolean getPermitFileURIs() { + return permitFileURIs; + } + + /** + * Set whether the file URIs are permitted or not + * + * @param permitFileURIs whether the file URIs are permitted or not + */ + public void setPermitFileURIs(boolean permitFileURIs) + { + this.permitFileURIs = permitFileURIs; + } } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java index 4871ac4fe..42b1c7c3c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java @@ -1,11 +1,6 @@ package at.gv.egovernment.moa.spss.server.init; import java.io.IOException; -import java.security.Security; - -import javax.net.ssl.SSLSocketFactory; - -import org.apache.axis.AxisProperties; import iaik.ixsil.init.IXSILInit; @@ -42,7 +37,7 @@ public class SystemInitializer { */ public static void init() { MessageProvider msg = MessageProvider.getInstance(); - ClassLoader cl = SystemInitializer.class.getClassLoader(); + Thread archiveCleaner; // set up the MOA SPSS logging hierarchy @@ -51,25 +46,7 @@ public class SystemInitializer { // set up a logging context for logging the startup LoggingContextManager.getInstance().setLoggingContext( new LoggingContext("startup")); - - // load some jsse classes so that the integrity of the jars can be verified - // before the iaik jce is installed as the security provider - // this workaround is only needed when sun jsse is used in conjunction with - // iaik-jce (on jdk1.3) - try { - cl.loadClass("javax.security.cert.Certificate"); // from jcert.jar - } catch (ClassNotFoundException e) { - Logger.warn(msg.getMessage("init.03", null), e); - } - - // set up SUN JSSE SSL - Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - System.setProperty( - "java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); - SSLSocketFactory.getDefault(); - - + // AxisProperties.setProperty("enableNamespacePrefixOptimization","false"); // AxisProperties.setProperty("disablePrettyXML", "true"); // AxisProperties.setProperty("axis.doAutoTypes", "true"); diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java index 5df13a337..1a8c72779 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java @@ -86,7 +86,9 @@ public class XMLSignatureVerificationProfileFactory { } else { profile.setTransformationSupplements(Collections.EMPTY_LIST); } - + + profile.setPermitFileURIs(config.getPermitFileURIs()); + return profile; } -- cgit v1.2.3 From afcd856e186b9fd5d8dfcb0f3e6f3599ca920b51 Mon Sep 17 00:00:00 2001 From: mcentner Date: Thu, 28 Aug 2008 07:55:59 +0000 Subject: Added copyright and license header to all java source files. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1087 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../gv/egovernment/moa/spss/MOAApplicationException.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/spss/MOAException.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/MOARuntimeException.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/MOASystemException.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/spss/api/Configurator.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/spss/api/SPSSFactory.java | 15 +++++++++++++++ .../moa/spss/api/SignatureCreationService.java | 15 +++++++++++++++ .../moa/spss/api/SignatureVerificationService.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/cmsverify/CMSContent.java | 15 +++++++++++++++ .../moa/spss/api/cmsverify/CMSContentExcplicit.java | 15 +++++++++++++++ .../moa/spss/api/cmsverify/CMSContentReference.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/cmsverify/CMSDataObject.java | 15 +++++++++++++++ .../moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java | 15 +++++++++++++++ .../spss/api/cmsverify/VerifyCMSSignatureResponse.java | 15 +++++++++++++++ .../api/cmsverify/VerifyCMSSignatureResponseElement.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/common/Base64Transform.java | 15 +++++++++++++++ .../moa/spss/api/common/CanonicalizationTransform.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/common/CheckResult.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/api/common/Content.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/common/ContentBinary.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/common/ContentLocRef.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/common/ContentReference.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/api/common/ContentXML.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/common/ElementSelector.java | 15 +++++++++++++++ .../moa/spss/api/common/EnvelopedSignatureTransform.java | 15 +++++++++++++++ .../api/common/ExclusiveCanonicalizationTransform.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/api/common/InputData.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/api/common/MetaInfo.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/api/common/SignerInfo.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/api/common/Transform.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/common/X509IssuerSerial.java | 15 +++++++++++++++ .../moa/spss/api/common/XMLDataObjectAssociation.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/common/XPathFilter.java | 15 +++++++++++++++ .../moa/spss/api/common/XPathFilter2Transform.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/common/XPathTransform.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/common/XSLTTransform.java | 15 +++++++++++++++ .../moa/spss/api/impl/Base64TransformImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/CMSContentExplicitImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/CMSContentReferenceImpl.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/impl/CMSDataObjectImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/CanonicalizationTransformImpl.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/impl/CheckResultImpl.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/impl/ContentBinaryImpl.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/api/impl/ContentImpl.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/impl/ContentLocRefImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/ContentReferenceImpl.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java | 15 +++++++++++++++ .../CreateSignatureEnvironmentProfileExplicitImpl.java | 15 +++++++++++++++ .../api/impl/CreateSignatureEnvironmentProfileIDImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/CreateSignatureInfoImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/CreateSignatureLocationImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/CreateTransformsInfoImpl.java | 15 +++++++++++++++ .../api/impl/CreateTransformsInfoProfileExplicitImpl.java | 15 +++++++++++++++ .../spss/api/impl/CreateTransformsInfoProfileIDImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/CreateXMLSignatureRequestImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/CreateXMLSignatureResponseImpl.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/impl/DataObjectInfoImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/ElementSelectorImpl.java | 15 +++++++++++++++ .../spss/api/impl/EnvelopedSignatureTransformImpl.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/impl/ErrorResponseImpl.java | 15 +++++++++++++++ .../api/impl/ExclusiveCanonicalizationTransformImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/InputDataBinaryImpl.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/impl/InputDataXMLImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/ManifestRefsCheckResultImpl.java | 15 +++++++++++++++ .../spss/api/impl/ManifestRefsCheckResultInfoImpl.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/impl/ReferenceInfoImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/ReferencesCheckResultImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/ReferencesCheckResultInfoImpl.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java | 15 +++++++++++++++ .../spss/api/impl/SignatureEnvironmentResponseImpl.java | 15 +++++++++++++++ .../spss/api/impl/SignatureManifestCheckParamsImpl.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/SingleSignatureInfoImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/SupplementProfileExplicitImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/SupplementProfileIDImpl.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/impl/TransformImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/TransformParameterBinaryImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/TransformParameterImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/TransformParameterURIImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/TransformPatameterHashImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java | 15 +++++++++++++++ .../api/impl/VerifyCMSSignatureResponseElementImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/VerifySignatureInfoImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/VerifySignatureLocationImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/VerifyTransformsDataImpl.java | 15 +++++++++++++++ .../api/impl/VerifyTransformsInfoProfileExplicitImpl.java | 15 +++++++++++++++ .../spss/api/impl/VerifyTransformsInfoProfileIDImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/X509IssuerSerialImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/XMLDataObjectAssociationImpl.java | 15 +++++++++++++++ .../moa/spss/api/impl/XPathFilter2TransformImpl.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/impl/XPathTransformImpl.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/impl/XSLTransformImpl.java | 15 +++++++++++++++ .../spss/api/xmlbind/CreateXMLSignatureRequestParser.java | 15 +++++++++++++++ .../api/xmlbind/CreateXMLSignatureResponseBuilder.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/xmlbind/ProfileParser.java | 15 +++++++++++++++ .../moa/spss/api/xmlbind/RequestParserUtils.java | 15 +++++++++++++++ .../moa/spss/api/xmlbind/ResponseBuilderUtils.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/xmlbind/TransformParser.java | 15 +++++++++++++++ .../spss/api/xmlbind/VerifyCMSSignatureRequestParser.java | 15 +++++++++++++++ .../api/xmlbind/VerifyCMSSignatureResponseBuilder.java | 15 +++++++++++++++ .../spss/api/xmlbind/VerifyXMLSignatureRequestParser.java | 15 +++++++++++++++ .../api/xmlbind/VerifyXMLSignatureResponseBuilder.java | 15 +++++++++++++++ .../api/xmlsign/CreateSignatureEnvironmentProfile.java | 15 +++++++++++++++ .../CreateSignatureEnvironmentProfileExplicit.java | 15 +++++++++++++++ .../api/xmlsign/CreateSignatureEnvironmentProfileID.java | 15 +++++++++++++++ .../moa/spss/api/xmlsign/CreateSignatureInfo.java | 15 +++++++++++++++ .../moa/spss/api/xmlsign/CreateSignatureLocation.java | 15 +++++++++++++++ .../moa/spss/api/xmlsign/CreateTransformsInfo.java | 15 +++++++++++++++ .../moa/spss/api/xmlsign/CreateTransformsInfoProfile.java | 15 +++++++++++++++ .../api/xmlsign/CreateTransformsInfoProfileExplicit.java | 15 +++++++++++++++ .../spss/api/xmlsign/CreateTransformsInfoProfileID.java | 15 +++++++++++++++ .../moa/spss/api/xmlsign/CreateXMLSignatureRequest.java | 15 +++++++++++++++ .../moa/spss/api/xmlsign/CreateXMLSignatureResponse.java | 15 +++++++++++++++ .../api/xmlsign/CreateXMLSignatureResponseElement.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/xmlsign/DataObjectInfo.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/xmlsign/ErrorResponse.java | 15 +++++++++++++++ .../spss/api/xmlsign/SignatureEnvironmentResponse.java | 15 +++++++++++++++ .../moa/spss/api/xmlsign/SingleSignatureInfo.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/ManifestRefsCheckResult.java | 15 +++++++++++++++ .../spss/api/xmlverify/ManifestRefsCheckResultInfo.java | 15 +++++++++++++++ .../egovernment/moa/spss/api/xmlverify/ReferenceInfo.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/ReferencesCheckResult.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/ReferencesCheckResultInfo.java | 15 +++++++++++++++ .../spss/api/xmlverify/SignatureManifestCheckParams.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/SupplementProfile.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/SupplementProfileExplicit.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/SupplementProfileID.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/TransformParameter.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/TransformParameterBinary.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/TransformParameterHash.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/TransformParameterURI.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/VerifySignatureInfo.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/VerifySignatureLocation.java | 15 +++++++++++++++ .../spss/api/xmlverify/VerifyTransformsInfoProfile.java | 15 +++++++++++++++ .../xmlverify/VerifyTransformsInfoProfileExplicit.java | 15 +++++++++++++++ .../spss/api/xmlverify/VerifyTransformsInfoProfileID.java | 15 +++++++++++++++ .../moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java | 15 +++++++++++++++ .../spss/api/xmlverify/VerifyXMLSignatureResponse.java | 15 +++++++++++++++ .../moa/spss/server/config/CRLDistributionPoint.java | 15 +++++++++++++++ .../moa/spss/server/config/ConfigurationException.java | 15 +++++++++++++++ .../moa/spss/server/config/ConfigurationPartsBuilder.java | 15 +++++++++++++++ .../moa/spss/server/config/ConfigurationProvider.java | 15 +++++++++++++++ .../moa/spss/server/config/DistributionPoint.java | 15 +++++++++++++++ .../moa/spss/server/config/HardwareCryptoModule.java | 15 +++++++++++++++ .../moa/spss/server/config/HardwareKeyModule.java | 15 +++++++++++++++ .../moa/spss/server/config/IssuerAndSerial.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/server/config/KeyGroup.java | 15 +++++++++++++++ .../egovernment/moa/spss/server/config/KeyGroupEntry.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/server/config/KeyModule.java | 15 +++++++++++++++ .../moa/spss/server/config/OCSPDistributionPoint.java | 15 +++++++++++++++ .../moa/spss/server/config/SoftwareKeyModule.java | 15 +++++++++++++++ .../egovernment/moa/spss/server/config/TrustProfile.java | 15 +++++++++++++++ .../cmsverify/CMSSignatureVerificationProfileImpl.java | 15 +++++++++++++++ .../iaik/config/AbstractKeyModuleConfigurationImpl.java | 15 +++++++++++++++ .../iaik/config/AbstractObservableConfiguration.java | 15 +++++++++++++++ .../spss/server/iaik/config/ArchiveConfigurationImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/config/CRLRetriever.java | 15 +++++++++++++++ .../server/iaik/config/CertStoreConfigurationImpl.java | 15 +++++++++++++++ .../spss/server/iaik/config/ConfigurationDataImpl.java | 15 +++++++++++++++ .../server/iaik/config/DataBaseArchiveParameterImpl.java | 15 +++++++++++++++ .../iaik/config/DirectoryCertStoreParametersImpl.java | 15 +++++++++++++++ .../config/HardwareCryptoModuleConfigurationImpl.java | 15 +++++++++++++++ .../iaik/config/HardwareKeyModuleConfigurationImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/config/IaikConfigurator.java | 15 +++++++++++++++ .../moa/spss/server/iaik/config/LoggerConfigImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/config/PKIConfigurationImpl.java | 15 +++++++++++++++ .../server/iaik/config/RevocationConfigurationImpl.java | 15 +++++++++++++++ .../iaik/config/SoftwareKeyModuleConfigurationImpl.java | 15 +++++++++++++++ .../server/iaik/config/ValidationConfigurationImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/pki/PKIProfileImpl.java | 15 +++++++++++++++ .../iaik/pki/pathvalidation/ValidationProfileImpl.java | 15 +++++++++++++++ .../server/iaik/pki/revocation/RevocationProfileImpl.java | 15 +++++++++++++++ .../iaik/pki/store/truststore/TrustStoreProfileImpl.java | 15 +++++++++++++++ .../spss/server/iaik/xml/Base64TransformationImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java | 15 +++++++++++++++ .../spss/server/iaik/xml/ByteStreamDataObjectImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/CanonicalizationImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/DataObjectImpl.java | 15 +++++++++++++++ .../iaik/xml/EnvelopedSignatureTransformationImpl.java | 15 +++++++++++++++ .../server/iaik/xml/ExclusiveCanonicalizationImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/SigningTimeImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/TransformationImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/XMLDataObjectImpl.java | 15 +++++++++++++++ .../spss/server/iaik/xml/XMLNodeListDataObjectImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/XMLSignatureImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/XPath2FilterImpl.java | 15 +++++++++++++++ .../spss/server/iaik/xml/XPath2TransformationImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/XPathTransformationImpl.java | 15 +++++++++++++++ .../moa/spss/server/iaik/xml/XSLTTransformationImpl.java | 15 +++++++++++++++ .../spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java | 15 +++++++++++++++ .../iaik/xmlsign/XMLSignatureCreationProfileImpl.java | 15 +++++++++++++++ .../iaik/xmlsign/XMLSignatureInsertionLocationImpl.java | 15 +++++++++++++++ .../xmlverify/XMLSignatureVerificationProfileImpl.java | 15 +++++++++++++++ .../moa/spss/server/init/ConfiguratorImpl.java | 15 +++++++++++++++ .../moa/spss/server/init/SystemInitializer.java | 15 +++++++++++++++ .../server/invoke/CMSSignatureVerificationInvoker.java | 15 +++++++++++++++ .../invoke/CMSSignatureVerificationProfileFactory.java | 15 +++++++++++++++ .../server/invoke/CreateXMLSignatureResponseBuilder.java | 15 +++++++++++++++ .../moa/spss/server/invoke/DataObjectFactory.java | 15 +++++++++++++++ .../moa/spss/server/invoke/ExternalURIResolver.java | 15 +++++++++++++++ .../moa/spss/server/invoke/IaikExceptionMapper.java | 15 +++++++++++++++ .../egovernment/moa/spss/server/invoke/InvokerUtils.java | 15 +++++++++++++++ .../egovernment/moa/spss/server/invoke/ProfileMapper.java | 15 +++++++++++++++ .../moa/spss/server/invoke/ServiceContextUtils.java | 15 +++++++++++++++ .../spss/server/invoke/SignatureCreationServiceImpl.java | 15 +++++++++++++++ .../server/invoke/SignatureVerificationServiceImpl.java | 15 +++++++++++++++ .../moa/spss/server/invoke/TransformationFactory.java | 15 +++++++++++++++ .../server/invoke/VerifyCMSSignatureResponseBuilder.java | 15 +++++++++++++++ .../server/invoke/VerifyXMLSignatureResponseBuilder.java | 15 +++++++++++++++ .../spss/server/invoke/XMLSignatureCreationInvoker.java | 15 +++++++++++++++ .../server/invoke/XMLSignatureCreationProfileFactory.java | 15 +++++++++++++++ .../server/invoke/XMLSignatureVerificationInvoker.java | 15 +++++++++++++++ .../invoke/XMLSignatureVerificationProfileFactory.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/server/logging/IaikLog.java | 15 +++++++++++++++ .../moa/spss/server/logging/IaikLogFactory.java | 15 +++++++++++++++ .../egovernment/moa/spss/server/logging/IaikLogMsg.java | 15 +++++++++++++++ .../moa/spss/server/logging/TransactionId.java | 15 +++++++++++++++ .../egovernment/moa/spss/server/service/AxisHandler.java | 15 +++++++++++++++ .../moa/spss/server/service/ConfigurationServlet.java | 15 +++++++++++++++ .../moa/spss/server/service/RevocationArchiveCleaner.java | 15 +++++++++++++++ .../egovernment/moa/spss/server/service/ServiceUtils.java | 15 +++++++++++++++ .../moa/spss/server/service/SignatureCreationService.java | 15 +++++++++++++++ .../spss/server/service/SignatureVerificationService.java | 15 +++++++++++++++ .../moa/spss/server/transaction/TransactionContext.java | 15 +++++++++++++++ .../server/transaction/TransactionContextManager.java | 15 +++++++++++++++ .../spss/server/transaction/TransactionIDGenerator.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/server/util/IdGenerator.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/util/MessageProvider.java | 15 +++++++++++++++ .../java/test/at/gv/egovernment/moa/spss/AllTests.java | 15 +++++++++++++++ .../test/at/gv/egovernment/moa/spss/SPSSTestCase.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java | 15 +++++++++++++++ .../api/xmlbind/CreateXMLSignatureRequestParserTest.java | 15 +++++++++++++++ .../moa/spss/api/xmlbind/TransformParserTest.java | 15 +++++++++++++++ .../api/xmlbind/VerifyCMSSignatureRequestParserTest.java | 15 +++++++++++++++ .../api/xmlbind/VerifyXMLSignatureRequestParserTest.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/server/config/AllTests.java | 15 +++++++++++++++ .../spss/server/config/ConfigurationProviderTest1.java | 15 +++++++++++++++ .../spss/server/config/ConfigurationProviderTest2.java | 15 +++++++++++++++ .../spss/server/config/ConfigurationProviderTest3.java | 15 +++++++++++++++ .../server/iaik/config/ConfigurationDataImplTest.java | 15 +++++++++++++++ .../moa/spss/server/iaik/config/IaikConfiguratorTest.java | 15 +++++++++++++++ .../gv/egovernment/moa/spss/server/invoke/AllTests.java | 15 +++++++++++++++ .../invoke/CMSSignatureVerificationInvokerTest.java | 15 +++++++++++++++ .../moa/spss/server/invoke/DataObjectFactoryTest.java | 15 +++++++++++++++ .../moa/spss/server/invoke/TransformationFactoryTest.java | 15 +++++++++++++++ .../server/invoke/XMLSignatureCreationInvokerTest.java | 15 +++++++++++++++ .../invoke/XMLSignatureVerificationInvokerTest.java | 15 +++++++++++++++ .../egovernment/moa/spss/server/tools/CertToolTest.java | 15 +++++++++++++++ 253 files changed, 3795 insertions(+) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java index 0d7abd1d3..a356e2dbd 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss; /** * Base class of application specific MOA exceptions. diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java index f9eb12d63..160914fb3 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss; import java.io.PrintStream; import java.io.PrintWriter; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java index 0ff175b50..d1c02d1e7 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss; import java.io.PrintStream; import java.io.PrintWriter; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java index 5a49b6852..fd8178d26 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss; /** * Base class of technical MOA exceptions. diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java index a0efa8924..6b2eee1e4 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api; import org.apache.commons.discovery.tools.DiscoverClass; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java index e306127b3..0aedba6a6 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java index a84ca2a83..3333fff9c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api; import at.gv.egovernment.moa.spss.MOAException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java index d0fcb029a..0203e2ae1 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api; import org.apache.commons.discovery.tools.DiscoverClass; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java index b4ecb3937..8aed9fa72 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.cmsverify; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java index 58c2b0259..23e534cf3 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.cmsverify; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java index 7c4e6d913..a2bf5bae8 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.cmsverify; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java index 37f6fd396..1a2571aab 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.cmsverify; import at.gv.egovernment.moa.spss.api.common.MetaInfo; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java index 6d1f389af..e96da67fd 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.cmsverify; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java index 5f2e6d255..144f51716 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.cmsverify; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java index 49ddb9419..26fd5911d 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.cmsverify; import at.gv.egovernment.moa.spss.api.common.CheckResult; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java index 94785727d..5cf31ee79 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java index 352461e52..5082ad212 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import at.gv.egovernment.moa.util.Constants; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java index 974483d82..3745e3918 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java index 0777c3d65..859681e1f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java index 664afa406..d7fc16938 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java index f640f2b92..01a1cd56d 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java index c10f0c2f8..7250dfedc 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java index ad5930452..f242f7c1c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java index 862cb84da..c9a026a54 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import java.util.Map; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java index f951e35c0..267709fb8 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java index 369270259..0c200ef1f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java index fd2b69c6d..89e977e29 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java index 56a1793af..a65572e1f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java index c3b4aaadc..4a7ca8d3b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import java.security.cert.X509Certificate; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java index 49a4e7c35..68720526e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java index d2ea88968..95d07a3f7 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import java.math.BigInteger; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java index e1e034222..cc975f281 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java index 247776ce0..427cc639d 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import java.util.Map; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java index 335d37dbf..79f289783 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java index f1cc1a2bc..a00516064 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import java.util.Map; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java index 7f44bb060..634a6fc85 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.common; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java index 4af075da2..3372a3164 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.Base64Transform; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java index dd700cf21..d9b129ffa 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java index f9c080a0d..7694e108d 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentReference; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java index 6eec4e847..d9bc6f88a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java index cf446d1b4..adfc3176d 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java index 8acd03a3e..7f3be4933 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java index bbed6bf8b..99974d0e2 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java index 7f331d2cd..77ce9a75b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.Content; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java index 1e0e2dc63..c4fcf99e6 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.ContentLocRef; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java index 50609aa0e..25d54f38b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.ContentReference; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java index c03f5edde..e4fcd123f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java index 22e4cd61d..bab853b02 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java index 1c7dc6439..171ed0202 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileID; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java index 097af7fff..cfe4583a6 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.Content; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java index c0b36f505..22241c44b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java index ff4108248..4572e21fd 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java index 508b6c083..4362b7721 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java index 5cd1fcc48..85fcebb93 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileID; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java index 08f94cc31..2c7f2557f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java index 590258e30..f6f1ee7b4 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java index 8ab2241de..58ed3b87a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.Content; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java index e460bd584..570339dd4 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.HashMap; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java index a1be3d86a..a4cebd590 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java index d7047ab44..b538ec05c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java index bf21c8634..42c5ff653 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java index 42d61559e..f030a2598 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java index 029a402f5..cd9c34888 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java index 9174e3a46..a34e4dd00 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResult; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java index 0071a14f3..694d99c09 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResultInfo; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java index 93aceb033..309bb88e0 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java index 923a4bce1..470532cde 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java index 6bb4d30ac..00f84bbd0 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java index a21b417ae..700883fb9 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java index bf15bf37e..f0d16046c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java index 57d30ad3b..230bcd86e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java index 5924f8447..bfd2587fd 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java index 277f1a008..077419af6 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.security.cert.X509Certificate; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java index b50a65c68..70f5d629e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java index 78723fec2..41ee7c78b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java index 320827fad..0d3430570 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfileID; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java index 51c7a543f..1842c321b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.Transform; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java index 2901fb1bb..99f334e79 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java index 9fe60638e..d72be03f4 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java index 25449504c..7c8b8dcc4 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterURI; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java index a7843e68c..64667370e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterHash; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java index a3c37aaef..8fd398c5a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java index 40dc04683..322e83baa 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java index f258380e0..150003892 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java index 2653e2fd2..6b2bd895a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.Content; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java index 933e42987..33b0463db 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureLocation; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java index 594f9c246..b20524c77 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java index d9a864499..a2114fb3f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java index fb1f10cea..cc360ebeb 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileID; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java index 26d7def4c..64cd208b0 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java index 989dbfb4a..3777e8958 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java index e6d644fd9..cdac75f77 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.math.BigInteger; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java index b603c3367..1528ced4b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.common.Content; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java index a96a8f161..e7ada103c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java index 72d91bc58..cc43c2f87 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.HashMap; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java index 1c9817ecc..4a58b0906 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import java.util.HashMap; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java index c6ddc0fd6..d411a78e4 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.impl; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java index 319d3ac9d..2efb4f6dd 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java index eec9c4882..1b72b98ff 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.util.Iterator; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java index 66c08e0ab..d43f8b75a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.io.IOException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java index 9e8c7d0e2..9885a5e55 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.text.ParseException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java index 44134a70c..3bef8659a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.io.IOException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java index 2d01f2a0f..cc9ae0418 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java index 74d14b7cc..a2b90f273 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java index 3fc8f223d..80d8575f9 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.util.Iterator; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java index e736af522..665a9ed84 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java index 960d9571d..a8be59766 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlbind; import java.io.IOException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java index 425c410ad..2257ed3e8 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java index 6aebd102b..cca79de6f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java index 1c0d87adc..2248fd7e2 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java index 5ceae4d0a..567224483 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import at.gv.egovernment.moa.spss.api.common.Content; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java index 81374ceaa..812147e44 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import at.gv.egovernment.moa.spss.api.common.ElementSelector; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java index 94152434e..4f644046c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java index 40acfd317..7902f0d32 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java index aeb74445f..19f47678a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java index 3631ead29..283def739 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java index b8157fdfb..978c18d4c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java index 6bf54e6a5..cacde7ab7 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java index 2162d82fd..fd723c5dc 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java index 43d49c587..17296ca59 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import at.gv.egovernment.moa.spss.api.common.Content; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java index 30fa4fb52..4e20a59d3 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java index 449349a68..3a08f3183 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java index 9c74c5157..e600a89cc 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlsign; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java index 1984ba349..f0b9d5170 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java index 258840162..f1df7c644 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java index 4c644583b..4e2a07c8f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java index 7b5488613..0fbe11e1c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java index be21b61c2..4db4cffdc 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java index 8f0efacf3..45591a861 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java index 569e691ca..eea74e5e6 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java index 7dd37a2d1..4474c38a3 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java index 5b5083be9..fb0a00829 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java index 3e173e0cd..4e4212825 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java index 600227dfd..74c33f793 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java index ec45ea4f4..6215e1dc5 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java index 4a6f0a58f..685c9384b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java index 386651c47..56b201295 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import at.gv.egovernment.moa.spss.api.common.Content; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java index f05e3e889..d9e05d8f4 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import at.gv.egovernment.moa.spss.api.common.ElementSelector; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java index 909fc58a2..ccc677c1a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java index ff19683da..c43b6471f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java index 0df3664da..55b74b557 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java index eb71f500b..da5012cdd 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import java.util.Date; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java index 14ac71e67..01fe9cf2c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.api.xmlverify; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java index bd78012ef..c2ad52a8b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; import iaik.pki.revocation.RevocationSourceTypes; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java index 4c2b3aea3..2f408b9a8 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; import at.gv.egovernment.moa.spss.MOASystemException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 327b66f54..20628465a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; import java.io.File; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java index 16bf153c9..05bd43087 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; import java.io.File; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java index 5c0646449..8d5bdd6a2 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java index 62e8d63a6..1c0440675 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java index 622c8d110..62136eb5e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java index 0814c90d6..a94ffcd37 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; import java.math.BigInteger; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java index 5fd108e1a..5275dd852 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; import java.util.Iterator; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java index 2e39d6aa3..a54f47959 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; import java.math.BigInteger; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java index 412516d82..ec9548f80 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java index e4509ac97..488a84408 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; import iaik.pki.revocation.RevocationSourceTypes; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java index 479e98ca5..d795402f5 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java index 929d5ce2b..85d3947aa 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.config; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java index eaee58d3f..9c61f41a5 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.cmsverify; import iaik.pki.PKIProfile; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java index 713891714..4060f0b06 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.server.modules.keys.KeyModuleConfiguration; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java index 88d53d6ad..6ad727611 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java index bf56d437c..2e724c438 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.pki.store.revocation.archive.ArchiveConfiguration; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java index 71b8680c8..e8f39e72a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.logging.TransactionId; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java index e6e084e11..2e7cb2fa5 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.pki.store.certstore.CertStoreConfiguration; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java index 7aa4cbe4b..3ce6e2596 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java index d67523944..e57650542 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java index 2b00d6766..d2d8d76e1 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.pki.store.certstore.CertStoreTypes; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java index 3c8f4c002..c58a735df 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.server.modules.crypto.HardwareCryptoModuleConfiguration; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java index d905588c6..f1a94df7a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.server.modules.keys.HardwareKeyModuleConfiguration; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java index 2508b7946..12c560855 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java index 9679e8d18..dc511bd20 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import java.util.Properties; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java index 1c42cc4af..2ea1faf04 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.pki.PKIConfiguration; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java index bccb04a09..74a268519 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import iaik.pki.revocation.RevocationConfiguration; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java index 343f096ef..1b8d85538 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import java.io.FileInputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java index f6fbad215..44b2a04bf 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.config; import java.security.cert.X509Certificate; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java index 76f03ae07..9ef2b0ca9 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.pki; import iaik.pki.PKIProfile; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java index a4d7ea7fa..8e3d0e92c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.pki.pathvalidation; import iaik.pki.pathvalidation.ValidationProfile; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java index c8809b0d8..36b3c86e5 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.pki.revocation; import java.security.cert.X509Certificate; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java index c49f7fe8c..c0b626c77 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.pki.store.truststore; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java index e076fe1eb..2b03c069f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.Base64Transformation; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java index 921b10cb6..664f53678 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import java.io.ByteArrayInputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java index ce400e61a..612c0dbee 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import java.io.InputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java index a597b214d..eb116c5e7 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.Canonicalization; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java index 875d82613..7ef9de75f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.DataObject; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java index 41a47d0a1..a087cc91e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.EnvelopedSignatureTransformation; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java index b38fbe128..6321001ea 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java index 19ca3dadf..3a1976159 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.Date; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java index 59a414b69..5a718e018 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.Transformation; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java index bc31d694e..7de63d221 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java index c855a922a..51a490973 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import org.w3c.dom.NodeList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java index 4fca907f3..1c0287fdd 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java index 034d4b653..da3d9bfe9 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.Map; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java index c7496c2cd..cbf7ff26e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java index ccedbadb2..0d8dc2288 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.Map; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java index d38da650b..010578d82 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xml; import java.io.IOException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java index a14b83b7d..6c069ca18 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xmlsign; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java index 2a35e5892..03dd42b93 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xmlsign; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java index d55f61303..a722ec727 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xmlsign; import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java index ab302388d..fbc38c224 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.iaik.xmlverify; import java.util.List; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java index caf17db66..15ed8ceec 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.init; import at.gv.egovernment.moa.spss.MOAException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java index 42b1c7c3c..fb5f2cb21 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.init; import java.io.IOException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java index f7a322d11..96c8b984e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import java.io.IOException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java index 442921850..6be381064 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import iaik.server.modules.cmsverify.CMSSignatureVerificationProfile; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java index 6302cadfd..d1064057f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java index 0abd80944..37a5c09eb 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import iaik.ixsil.util.URI; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java index cbd88f7f3..3e3f6753a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import iaik.ixsil.exceptions.URIException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java index 60f573e5a..9a35c4082 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import java.lang.reflect.Constructor; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java index 0c3b45539..a8447b835 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java index 158a3ddb5..3062012c4 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java index 11f05a2f1..5f4a9b483 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import at.gv.egovernment.moa.logging.LoggingContext; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java index dc5ceb21e..0d0c792ee 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import java.util.Collections; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java index 94cdea5d9..cc61f6ee3 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import at.gv.egovernment.moa.spss.MOAException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java index 9984a95a5..ae0bb4dc0 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java index 55e2e1505..8a0b3de13 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import java.security.cert.X509Certificate; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java index d6f58a560..1250fcad5 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import iaik.ixsil.algorithms.CanonicalizationAlgorithm; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java index fd207ddea..660f8a5b3 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import iaik.IAIKException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java index 7ac971da8..8537cc6f2 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import iaik.server.modules.algorithms.HashAlgorithms; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java index 3dd7ecf11..f08588ecb 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import iaik.IAIKException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java index 1a8c72779..45369ff49 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.invoke; import java.util.ArrayList; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java index 068fab5ca..5e5e4e00e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.logging; import org.apache.commons.logging.Log; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java index a0e4def86..6d433f9ae 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.logging; import iaik.logging.Log; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java index 75fb388a9..374f0199c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.logging; import iaik.logging.TransactionId; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java index 9e0239464..1aebcec18 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.logging; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java index b079667b0..1ab6f01cc 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.service; import java.io.ByteArrayInputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java index 7783ed3f6..f13adfec9 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.service; import java.io.IOException; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java index 26d79dbd8..cdd6271fd 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.service; import iaik.pki.revocation.RevocationSourceTypes; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java index 4224f5665..9c0990268 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.service; import java.io.ByteArrayInputStream; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java index 8fceb6fb6..f1e56d407 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.service; import java.util.Collections; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java index feb49ffbf..cc923f4b7 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.service; import org.apache.axis.AxisFault; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java index 62db42674..d66cda965 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.transaction; import iaik.ixsil.util.URI; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java index 13127c3ae..7e82e91c8 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.transaction; /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java index 6eb07defe..715eb1e52 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.transaction; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java index 2dfd22140..722ab5e6c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.server.util; import java.util.Set; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java index a6f6c1d4a..bd858f50f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package at.gv.egovernment.moa.spss.util; import java.util.Locale; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java index c670b5e55..1619c7e8f 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss; import test.at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImplTest; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java index a585e30a0..43f04b77c 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss; import java.security.Security; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java index 28f79729e..64171e1da 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.api.xmlbind; import junit.framework.Test; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java index 7ce705b01..cbaef567a 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.api.xmlbind; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java index f580f86bc..0ee368060 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.api.xmlbind; import java.util.List; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java index 4be7667eb..d016781cc 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.api.xmlbind; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java index 3b8e8b00e..8636c6e18 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.api.xmlbind; import org.w3c.dom.Element; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java index 131f38c19..7af52ef70 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.config; import junit.framework.Test; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java index 474a387ad..27fd09836 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.config; import iaik.asn1.structures.Name; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java index adf02809b..9cd7d8520 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.config; import iaik.asn1.structures.Name; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java index 7da2165cb..39a9efdcb 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.config; import iaik.asn1.structures.Name; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java index be1090e4a..17daae1e9 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.iaik.config; import java.io.FileInputStream; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java index 3b403dc19..364264e51 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfiguratorTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.iaik.config; import test.at.gv.egovernment.moa.spss.SPSSTestCase; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java index 65fa2bf72..aa7f6defe 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.invoke; import junit.framework.Test; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java index 3024730f4..8277cfab9 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.invoke; import org.w3c.dom.Document; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java index 7de2add33..5861b2e8d 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.invoke; import java.io.InputStream; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java index 13a80cbf1..389ecfdb8 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.invoke; import java.util.List; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java index 28cd3805a..52dd89a3a 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.invoke; import java.util.Collections; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java index 56e3d541b..f2ed39e22 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.invoke; import org.w3c.dom.Document; diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java index ac6e8c3e0..deb6a941c 100644 --- a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java +++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ package test.at.gv.egovernment.moa.spss.server.tools; import java.io.ByteArrayOutputStream; -- cgit v1.2.3 From 527f2ec316c6d67498ed6dfe37a95218a2ab6f54 Mon Sep 17 00:00:00 2001 From: spuchmann Date: Mon, 15 Sep 2008 07:33:53 +0000 Subject: raised version to 1.4.4 moved licenses to root folder fixed Bug 332 and 333 slVersion changed from 1.1 to 1.2 (MOA-ID-Configuration-1.4.4.xsd) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1091 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 2 +- .../serverlib/resources/licenses/Apache-2.0.txt | 202 --------------------- .../serverlib/resources/licenses/IAIK-License.txt | 13 -- spss/server/serverlib/resources/licenses/Jaxen.txt | 40 ---- .../resources/licenses/PostgreSQL-JDBC.txt | 26 --- 5 files changed, 1 insertion(+), 282 deletions(-) delete mode 100644 spss/server/serverlib/resources/licenses/Apache-2.0.txt delete mode 100644 spss/server/serverlib/resources/licenses/IAIK-License.txt delete mode 100644 spss/server/serverlib/resources/licenses/Jaxen.txt delete mode 100644 spss/server/serverlib/resources/licenses/PostgreSQL-JDBC.txt (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 5b224eef6..972822a73 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -9,7 +9,7 @@ MOA.spss.server moa-spss-lib jar - 1.4.3 + 1.4.4 MOA SP/SS API diff --git a/spss/server/serverlib/resources/licenses/Apache-2.0.txt b/spss/server/serverlib/resources/licenses/Apache-2.0.txt deleted file mode 100644 index 57bc88a15..000000000 --- a/spss/server/serverlib/resources/licenses/Apache-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/spss/server/serverlib/resources/licenses/IAIK-License.txt b/spss/server/serverlib/resources/licenses/IAIK-License.txt deleted file mode 100644 index c0db63b22..000000000 --- a/spss/server/serverlib/resources/licenses/IAIK-License.txt +++ /dev/null @@ -1,13 +0,0 @@ -IAIK MOA Runtime Lizenz - -Stiftung SIC gewährt dem Lizenznehmer eine nicht-exklusive, nicht-übertragbare -Runtime Lizenz für die "IAIK MOA" Module im Kontext von MOA SP/SS und MOA ID. -Alle Versuche, Teile oder die kompletten IAIK Crypto Toolkits, die zusammen -mit dem MOA Produktbündel ausgeliefert werden, für andere Zwecke als jenem -für Applikationen im MOA Kontext zu verwenden, sind nicht erlaubt. Auch weitere -Versuche, die sich auf die Entwicklung von Anwendungen , oder aber darüber hinaus -auf die Schaffung eines eigenen Toolkits, oder die Aufnahme in ein weiters -weiteres Toolkit beziehen, sind nicht erlaubt. -Die hier beschriebene Runtime Lizenz ist nicht übertragbar auf weitere -Vertragspartner des Kunden, Personen, Organisationen oder Unternehmen -außerhalb der Organisation des Lizenznehmers. diff --git a/spss/server/serverlib/resources/licenses/Jaxen.txt b/spss/server/serverlib/resources/licenses/Jaxen.txt deleted file mode 100644 index bef65a520..000000000 --- a/spss/server/serverlib/resources/licenses/Jaxen.txt +++ /dev/null @@ -1,40 +0,0 @@ -Copyright 2003 (C) The Werken Company. All Rights Reserved. - - Redistribution and use of this software and associated documentation - ("Software"), with or without modification, are permitted provided - that the following conditions are met: - - 1. Redistributions of source code must retain copyright - statements and notices. Redistributions must also contain a - copy of this document. - - 2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - - 3. The name "jaxen" must not be used to endorse or promote - products derived from this Software without prior written - permission of The Werken Company. For written permission, - please contact bob@werken.com. - - 4. Products derived from this Software may not be called "jaxen" - nor may "jaxen" appear in their names without prior written - permission of The Werken Company. "jaxen" is a registered - trademark of The Werken Company. - - 5. Due credit should be given to The Werken Company. - (http://jaxen.werken.com/). - - THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/spss/server/serverlib/resources/licenses/PostgreSQL-JDBC.txt b/spss/server/serverlib/resources/licenses/PostgreSQL-JDBC.txt deleted file mode 100644 index 30d54d778..000000000 --- a/spss/server/serverlib/resources/licenses/PostgreSQL-JDBC.txt +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 1997-2005, PostgreSQL Global Development Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -3. Neither the name of the PostgreSQL Global Development Group nor the names - of its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file -- cgit v1.2.3 From 87d58af09dc7077492655b1df07bbbf389e3bffd Mon Sep 17 00:00:00 2001 From: mcentner Date: Fri, 19 Sep 2008 15:02:59 +0000 Subject: Made SPSS ConfigurationPartsBuilder namespace aware. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1092 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 20628465a..058ce5280 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -887,7 +887,8 @@ public class ConfigurationPartsBuilder { info("config.22", new Object[] { profileRoot, id, profileFile.getAbsoluteFile()}); Element profile = loadProfile(profileFile); - if (profile.getTagName().equals(profileRoot)) + if (Constants.MOA_NS_URI.equals(profile.getNamespaceURI()) && + profile.getLocalName().equals(profileRoot)) { profiles.put(id, profile); } -- cgit v1.2.3 From aebb5cd04d43b25b8d65237ba49fddf5f5dd1a8c Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 7 Jul 2009 14:27:40 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1114 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/.classpath | 8 ++--- spss/server/serverlib/pom.xml | 2 +- .../server/config/ConfigurationPartsBuilder.java | 36 +++++++++++++++++++ .../spss/server/config/ConfigurationProvider.java | 40 ++++++++++++++++++---- .../spss/server/iaik/config/IaikConfigurator.java | 2 +- .../iaik/config/RevocationConfigurationImpl.java | 12 +++++++ 6 files changed, 87 insertions(+), 13 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/.classpath b/spss/server/serverlib/.classpath index 01edb156d..1c79cc393 100644 --- a/spss/server/serverlib/.classpath +++ b/spss/server/serverlib/.classpath @@ -1,9 +1,9 @@ - - - - + + + + diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 972822a73..fe8ac16d4 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -9,7 +9,7 @@ MOA.spss.server moa-spss-lib jar - 1.4.4 + 1.4.5 MOA SP/SS API diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 058ce5280..3ad7b761f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -39,6 +39,7 @@ import org.w3c.dom.traversal.NodeIterator; import org.xml.sax.SAXException; +import iaik.asn1.structures.Name; import iaik.ixsil.exceptions.URIException; import iaik.ixsil.util.URI; import iaik.pki.pathvalidation.ChainingModes; @@ -149,6 +150,12 @@ public class ConfigurationPartsBuilder { + CONF + "CertificateValidation/" + CONF + "RevocationChecking/" + CONF + "DistributionPoint"; + private static final String CRL_RETENTION_INTERVALS_CA_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "CrlRetentionIntervals/" + + CONF + "CA"; private static final String ENABLE_REVOCATION_CHECKING_XPATH_ = ROOT + CONF + "SignatureVerification/" + CONF + "CertificateValidation/" @@ -1264,4 +1271,33 @@ public class ConfigurationPartsBuilder { return Boolean.valueOf(permitFileURIs).booleanValue(); } + /** + * Returns a map of CRL retention intervals + * @return + */ + public Map getCrlRetentionIntervals() { + Map map = new HashMap(); + NodeIterator modIter = XPathUtils.selectNodeIterator( + getConfigElem(), + CRL_RETENTION_INTERVALS_CA_XPATH); + + Element modElem; + while ((modElem = (Element) modIter.nextNode()) != null) { + String x509IssuerName = getElementValue(modElem, CONF + "X509IssuerName", null); + String i = getElementValue(modElem, CONF + "Interval", null); + Integer interval = new Integer(i); + try { + RFC2253NameParser parser = new RFC2253NameParser(x509IssuerName); + Name name = parser.parse(); + map.put(name.getRFC2253String(), interval); + } catch (RFC2253NameParserException e) { + map.put(x509IssuerName, interval); + } + + //System.out.println("Name: " + x509IssuerName + " - Interval: " + interval); + } + + return map; + } + } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java index 05bd43087..7b72e3cc5 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java @@ -15,6 +15,11 @@ */ package at.gv.egovernment.moa.spss.server.config; +import iaik.asn1.structures.Name; +import iaik.pki.revocation.RevocationSourceTypes; +import iaik.utils.RFC2253NameParser; +import iaik.utils.RFC2253NameParserException; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -24,22 +29,17 @@ import java.security.Principal; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.w3c.dom.Element; -import iaik.asn1.structures.Name; -import iaik.pki.revocation.RevocationSourceTypes; -import iaik.utils.RFC2253NameParser; -import iaik.utils.RFC2253NameParserException; - import at.gv.egovernment.moa.logging.LogMsg; import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.util.DOMUtils; - import at.gv.egovernment.moa.spss.util.MessageProvider; +import at.gv.egovernment.moa.util.DOMUtils; /** * A class providing access to the MOA configuration data. @@ -226,6 +226,11 @@ public class ConfigurationProvider */ private boolean permitFileURIs; + /** + * Indicates the CRL retention intervals + */ + private Map crlRetentionIntervals; + /** * Return the single instance of configuration data. * @@ -306,6 +311,7 @@ public class ConfigurationProvider // build the internal datastructures try { builder = new ConfigurationPartsBuilder(configElem, configRoot); + digestMethodAlgorithmName = builder.getDigestMethodAlgorithmName(); canonicalizationAlgorithmName = builder.getCanonicalizationAlgorithmName(); @@ -339,6 +345,16 @@ public class ConfigurationProvider supplementProfiles = builder.buildSupplementProfiles(); warnings = new ArrayList(builder.getWarnings()); permitFileURIs = builder.getPermitFileURIs(); + crlRetentionIntervals = builder.getCrlRetentionIntervals(); + +// Set set = crlRetentionIntervals.entrySet(); +// Iterator i = set.iterator(); +// while(i.hasNext()){ +// Map.Entry me = (Map.Entry)i.next(); +// System.out.println("Key: " + me.getKey() + " - Value: " + me.getValue() ); +// } + + } catch (Throwable t) { throw new ConfigurationException("config.11", null, t); } finally { @@ -714,4 +730,14 @@ public class ConfigurationProvider { return permitFileURIs; } + + /** + * Returns the map of retention intervals + * @return The map of retention intervals + */ + public Map getCrlRetentionIntervals() { + return crlRetentionIntervals; + } + + } \ No newline at end of file diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java index 12c560855..4625ccf88 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java @@ -72,7 +72,7 @@ public class IaikConfigurator { // Set customized CRL retriever to overcome a classloader problem when MOA is deployed in Tomcat RevocationSourceStore rss = RevocationFactory.getInstance(transId).getRevocationSourceStore(); - rss.setRetriever(new CRLRetriever(), RevocationSourceTypes.CRL); + //rss.setRetriever(new CRLRetriever(), RevocationSourceTypes.CRL); if ((moaConfig.getSoftwareKeyModules().size() > 0) || (moaConfig.getHardwareKeyModules().size() > 0)) { dumpKeyEntryIDs(); } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java index 74a268519..67eac5b55 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java @@ -19,6 +19,7 @@ import iaik.pki.revocation.RevocationConfiguration; import java.security.cert.X509Certificate; import java.util.Date; +import java.util.Map; import java.util.Set; import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; @@ -65,4 +66,15 @@ public class RevocationConfigurationImpl return config.getEnableRevocationArchiving(); } + /** + * @see iaik.pki.revocation.RevocationConfiguration#getCrlRetentionInterval(java.lang.String) + */ + public Integer getCrlRetentionInterval(String issuername) + { + Map map = config.getCrlRetentionIntervals(); + Integer interval = (Integer)map.get(issuername); + + return interval; +} + } -- cgit v1.2.3 From b96b2ef653f6bc62ca8a7880dde525dc44d9a8b7 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Mon, 10 Aug 2009 09:23:17 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1123 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/.settings/org.maven.ide.eclipse.prefs | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 spss/server/serverlib/.settings/org.maven.ide.eclipse.prefs (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/.settings/org.maven.ide.eclipse.prefs b/spss/server/serverlib/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..373d31d5c --- /dev/null +++ b/spss/server/serverlib/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Tue Jul 07 16:06:50 CEST 2009 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 -- cgit v1.2.3 From 5166270383bd11faeaa484ab878844f9b9445527 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 11 Aug 2009 08:11:40 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1127 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../moa/spss/server/invoke/DataObjectFactory.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java index 37a5c09eb..fab8a6dd7 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -65,6 +65,7 @@ import at.gv.egovernment.moa.util.MOAEntityResolver; import at.gv.egovernment.moa.util.MOAErrorHandler; import at.gv.egovernment.moa.util.StreamEntityResolver; import at.gv.egovernment.moa.util.StreamUtils; +import at.gv.egovernment.moa.util.XPathUtils; /** * A class to create DataObjects contained in different @@ -194,10 +195,12 @@ public class DataObjectFactory { Element element = checkForSingleElement(((ContentXML) content).getXMLContent()); contentBytes = DOMUtils.serializeNode(element, "UTF-8"); + break; } - default : + default : { contentBytes = null; // this will not happen + } } } catch (MOAApplicationException e) { throw e; @@ -205,8 +208,23 @@ public class DataObjectFactory { throw new MOAApplicationException("2219", null); } + // For logging in Debug-Mode: Mask baseid with xxx + String logString = new String(contentBytes); + String startS = ""; + String endS = "urn:publicid:gv.at:baseid"; + String logWithMaskedBaseid; + int start = logString.indexOf(startS); + if (start > -1) { + int end = logString.indexOf(endS); + logWithMaskedBaseid = logString.substring(0, start); + logWithMaskedBaseid += startS; + logWithMaskedBaseid += "xxxxxxxxxxxxxxxxxxxxxxxx"; + logWithMaskedBaseid += logString.substring(end, logString.length()); + } + else + logWithMaskedBaseid = logString; // try to parse validating - Logger.trace(">>> parsing the following content: \n" + new String(contentBytes)); + Logger.trace(">>> parsing the following content: \n" + logWithMaskedBaseid); try { ByteArrayInputStream is = new ByteArrayInputStream(contentBytes); Document doc = -- cgit v1.2.3 From 27be7994027944015c290e41e688e8723965bd48 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Wed, 26 Aug 2009 11:00:54 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1139 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../moa/spss/server/invoke/DataObjectFactory.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java index fab8a6dd7..566784796 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -210,19 +210,21 @@ public class DataObjectFactory { // For logging in Debug-Mode: Mask baseid with xxx String logString = new String(contentBytes); + // TODO use RegExp String startS = ""; String endS = "urn:publicid:gv.at:baseid"; - String logWithMaskedBaseid; + String logWithMaskedBaseid = logString; int start = logString.indexOf(startS); if (start > -1) { - int end = logString.indexOf(endS); - logWithMaskedBaseid = logString.substring(0, start); - logWithMaskedBaseid += startS; - logWithMaskedBaseid += "xxxxxxxxxxxxxxxxxxxxxxxx"; - logWithMaskedBaseid += logString.substring(end, logString.length()); + int end = logString.indexOf(endS); + if (end > -1) { + logWithMaskedBaseid = logString.substring(0, start); + logWithMaskedBaseid += startS; + logWithMaskedBaseid += "xxxxxxxxxxxxxxxxxxxxxxxx"; + logWithMaskedBaseid += logString.substring(end, logString.length()); + } } - else - logWithMaskedBaseid = logString; + // try to parse validating Logger.trace(">>> parsing the following content: \n" + logWithMaskedBaseid); try { -- cgit v1.2.3 From afa2a5ca9f92e81b594e8f29d9588d5e8690fba8 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Thu, 17 Sep 2009 09:45:46 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1145 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index fe8ac16d4..6648f8c55 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -9,7 +9,7 @@ MOA.spss.server moa-spss-lib jar - 1.4.5 + 1.4.6 MOA SP/SS API -- cgit v1.2.3 From 68af85701b6f797b0d662b89b95e043ee949defd Mon Sep 17 00:00:00 2001 From: mcentner Date: Fri, 2 Jul 2010 07:14:41 +0000 Subject: Merged branch 1.4.7_MOASP_TSL back into trunk. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1165 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/.classpath | 22 +++++--- .../.settings/org.eclipse.wst.common.component | 15 +++-- spss/server/serverlib/pom.xml | 2 +- .../gv/egovernment/moa/spss/api/SPSSFactory.java | 24 ++++++-- .../VerifyCMSSignatureResponseElement.java | 7 +++ .../moa/spss/api/common/CheckTSLResult.java | 40 +++++++++++++ .../moa/spss/api/impl/CheckTSLResultImpl.java | 66 ++++++++++++++++++++++ .../moa/spss/api/impl/SPSSFactoryImpl.java | 18 +++++- .../VerifyCMSSignatureResponseElementImpl.java | 17 +++++- .../api/impl/VerifyXMLSignatureResponseImpl.java | 17 +++++- .../moa/spss/api/xmlbind/ResponseBuilderUtils.java | 35 ++++++++++++ .../xmlbind/VerifyCMSSignatureResponseBuilder.java | 9 +++ .../xmlbind/VerifyXMLSignatureResponseBuilder.java | 7 +++ .../api/xmlverify/VerifyXMLSignatureResponse.java | 10 ++++ .../server/config/ConfigurationPartsBuilder.java | 36 +++++++++++- .../moa/spss/server/config/TrustProfile.java | 16 +++++- .../invoke/CMSSignatureVerificationInvoker.java | 11 +++- .../invoke/VerifyCMSSignatureResponseBuilder.java | 66 +++++++++++++++++++--- .../invoke/VerifyXMLSignatureResponseBuilder.java | 17 +++++- .../invoke/XMLSignatureVerificationInvoker.java | 44 ++++++++++++++- .../properties/spss_messages_de.properties | 4 +- 21 files changed, 437 insertions(+), 46 deletions(-) create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckTSLResult.java create mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckTSLResultImpl.java (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/.classpath b/spss/server/serverlib/.classpath index 1c79cc393..f0e483a4a 100644 --- a/spss/server/serverlib/.classpath +++ b/spss/server/serverlib/.classpath @@ -1,9 +1,13 @@ - - - - - - - - - + + + + + + + + + + + + + diff --git a/spss/server/serverlib/.settings/org.eclipse.wst.common.component b/spss/server/serverlib/.settings/org.eclipse.wst.common.component index ebc030867..e4ceae723 100644 --- a/spss/server/serverlib/.settings/org.eclipse.wst.common.component +++ b/spss/server/serverlib/.settings/org.eclipse.wst.common.component @@ -1,8 +1,7 @@ - - - - - - - - + + + + + + + diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 6648f8c55..4ee7075e3 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -9,7 +9,7 @@ MOA.spss.server moa-spss-lib jar - 1.4.6 + 1.4.7 MOA SP/SS API diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java index 0aedba6a6..1a778ad2b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java @@ -22,17 +22,17 @@ import java.util.Date; import java.util.List; import java.util.Map; +import org.apache.commons.discovery.tools.DiscoverClass; import org.w3c.dom.Element; import org.w3c.dom.NodeList; -import org.apache.commons.discovery.tools.DiscoverClass; - import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; 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.common.SignerInfo; @@ -434,6 +434,7 @@ public abstract class SPSSFactory { * @param signerInfo Information about the signer certificate. * @param signatureCheck Result of the singature value check. * @param certificateCheck Result of the certificate status check. + * @param tslCheck Result of the TSL check * @return The new VerifyCMSSignatureResponseElement containing * the above data. * @@ -444,7 +445,8 @@ public abstract class SPSSFactory { public abstract VerifyCMSSignatureResponseElement createVerifyCMSSignatureResponseElement( SignerInfo signerInfo, CheckResult signatureCheck, - CheckResult certificateCheck); + CheckResult certificateCheck, + CheckTSLResult tslCheck); // // Factory methods for verifying XML signatures @@ -698,7 +700,8 @@ public abstract class SPSSFactory { ReferencesCheckResult signatureCheck, ReferencesCheckResult signatureManifestCheck, List xmlDsigManifestChecks, - CheckResult certificateCheck); + CheckResult certificateCheck, + CheckTSLResult tslCheck); /** * Create a new ReferencesCheckResult object. @@ -987,6 +990,19 @@ public abstract class SPSSFactory { */ public abstract CheckResult createCheckResult(int code, NodeList info); + /** + * Create a new CheckTSLResult object. + * + * @param code The numerical error code. + * @param info Verbose error information. + * @return The new CheckTSLResult containing the above data. + * + * @pre code >= 0 + * @pre info != null + * @post return != null + */ + public abstract CheckTSLResult createCheckTSLResult(int code, String info); + /** * Create a new SignerInfo object. * diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java index 26fd5911d..e2f44c540 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java @@ -16,6 +16,7 @@ package at.gv.egovernment.moa.spss.api.cmsverify; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; /** @@ -44,4 +45,10 @@ public interface VerifyCMSSignatureResponseElement { * @return The result of the certificate verification. */ public CheckResult getCertificateCheck(); + /** + * Gets the result of the TSL verification + * + * @return The result of the TSL verification + */ + public CheckTSLResult getTSLCheck(); } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckTSLResult.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckTSLResult.java new file mode 100644 index 000000000..f31512cdb --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckTSLResult.java @@ -0,0 +1,40 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package at.gv.egovernment.moa.spss.api.common; + +import org.w3c.dom.NodeList; + +/** + * Object encapsulating the result of a TSL verification. + * + * @author Patrick Peck + * @author Stephan Grill + * @version $Id: CheckResult.java 1087 2008-08-28 07:55:59Z mcentner $ + */ +public interface CheckTSLResult { + /** + * Gets the result code. + * + * @return The result code. + */ + public int getCode(); + /** + * Gets descriptive information. + * + * @return Descriptive information. + */ + public String getInfo(); +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckTSLResultImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckTSLResultImpl.java new file mode 100644 index 000000000..62f3ab979 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckTSLResultImpl.java @@ -0,0 +1,66 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; + +/** + * Default implementation of CheckTSLResult. + * + * @author Fatemeh Philippi + * @author Klaus Stranacher + * @version $Id: CheckResultImpl.java 1087 2008-08-28 07:55:59Z mcentner $ + */ +public class CheckTSLResultImpl implements CheckTSLResult { + /** The result code. */ + private int code; + + /** Additional information. */ + private String info; + + /** + * Sets a result code. + * + * @param code The result code. + */ + public void setCode(int code) { + this.code = code; + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.CheckTSLResult#getCode() + */ + public int getCode() { + return code; + } + + /** + * Sets a descriptive information. + * + * @param info The descriptive information. + */ + public void setInfo(String info) { + this.info = info; + } + + /** + * @see at.gv.egovernment.moa.spss.api.common.CheckTSLResult#getInfo() + */ + public String getInfo() { + return info; + } + +} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java index f0d16046c..8cf06bb15 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java @@ -32,6 +32,7 @@ import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; 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.common.SignerInfo; @@ -259,12 +260,15 @@ public class SPSSFactoryImpl extends SPSSFactory { public VerifyCMSSignatureResponseElement createVerifyCMSSignatureResponseElement( SignerInfo signerInfo, CheckResult signatureCheck, - CheckResult certificateCheck) { + CheckResult certificateCheck, + CheckTSLResult tslCheck) { VerifyCMSSignatureResponseElementImpl verifyCMSSignatureResponseElement = new VerifyCMSSignatureResponseElementImpl(); verifyCMSSignatureResponseElement.setSignerInfo(signerInfo); verifyCMSSignatureResponseElement.setSignatureCheck(signatureCheck); verifyCMSSignatureResponseElement.setCertificateCheck(certificateCheck); + verifyCMSSignatureResponseElement.setTSLCheck(tslCheck); + return verifyCMSSignatureResponseElement; } @@ -390,7 +394,8 @@ public class SPSSFactoryImpl extends SPSSFactory { ReferencesCheckResult signatureCheck, ReferencesCheckResult signatureManifestCheck, List xmlDsigManifestChecks, - CheckResult certificateCheck) { + CheckResult certificateCheck, + CheckTSLResult tslCheck) { VerifyXMLSignatureResponseImpl verifyXMLSignatureResponse = new VerifyXMLSignatureResponseImpl(); verifyXMLSignatureResponse.setSignerInfo(signerInfo); @@ -401,6 +406,8 @@ public class SPSSFactoryImpl extends SPSSFactory { signatureManifestCheck); verifyXMLSignatureResponse.setXMLDsigManifestChecks(xmlDsigManifestChecks); verifyXMLSignatureResponse.setCertificateCheck(certificateCheck); + verifyXMLSignatureResponse.setTSLCheck(tslCheck); + return verifyXMLSignatureResponse; } @@ -557,6 +564,13 @@ public class SPSSFactoryImpl extends SPSSFactory { checkResult.setInfo(info); return checkResult; } + + public CheckTSLResult createCheckTSLResult(int code, String info) { + CheckTSLResultImpl checkTSLResult = new CheckTSLResultImpl(); + checkTSLResult.setCode(code); + checkTSLResult.setInfo(info); + return checkTSLResult; + } public SignerInfo createSignerInfo( X509Certificate signerCertificate, diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java index 322e83baa..f80c4ace2 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java @@ -17,6 +17,7 @@ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; /** @@ -34,7 +35,9 @@ public class VerifyCMSSignatureResponseElementImpl private CheckResult signatureCheck; /** Information about the certificate check. */ private CheckResult certificateCheck; - + /** Information about the TSL check */ + private CheckTSLResult tslCheck; + /** * Sets a SignerInfo element according to CMS. * @@ -73,5 +76,17 @@ public class VerifyCMSSignatureResponseElementImpl public CheckResult getCertificateCheck() { return certificateCheck; } + + /** + * Sets a result of the TSL verification. + * + * @param tslCheck The result of the TSL verification. + */ + public void setTSLCheck(CheckTSLResult tslCheck) { + this.tslCheck = tslCheck; + } + public CheckTSLResult getTSLCheck() { + return tslCheck; + } } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java index 3777e8958..ea6a180a7 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java @@ -20,6 +20,7 @@ import java.util.Collections; import java.util.List; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; @@ -52,7 +53,9 @@ public class VerifyXMLSignatureResponseImpl private List xmlDsigManifestChecks = new ArrayList(); /** Information about the certificate check. */ private CheckResult certificateCheck; - + /** Information about the TSL check. */ + private CheckTSLResult tslCheck; + /** * Sets information about the signer certificate. * @@ -136,6 +139,18 @@ public class VerifyXMLSignatureResponseImpl public CheckResult getCertificateCheck() { return certificateCheck; } + /** + * Sets the result of the TSL verification. + * + * @param certificateCheck The result of the TSL verification. + */ + public void setTSLCheck(CheckTSLResult tslCheck) { + this.tslCheck = tslCheck; + } + + public CheckTSLResult getTSLCheck() { + return tslCheck; + } /** * Sets the XMLDSigManifestChecks. diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java index 3bef8659a..30d19023a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java @@ -217,5 +217,40 @@ class ResponseBuilderUtils { } root.appendChild(codeInfoElem); } + + /** + * Add an element containing Code and Info + * subelements. + * + * @param response The response document, in order to create new elements in + * it. + * @param root The root element into which to insert the newly created + * element. + * @param elementName The name of the newly created element. + * @param code The content of the Code subelement. + * @param info The content of the Info subelement. + */ + public static void addCodeInfoElement( + Document response, + Element root, + String elementName, + int code, + String info) { + + Element codeInfoElem = response.createElementNS(MOA_NS_URI, elementName); + Element codeElem = response.createElementNS(MOA_NS_URI, "Code"); + Element infoElem; + int i; + + codeElem.appendChild(response.createTextNode(Integer.toString(code))); + codeInfoElem.appendChild(codeElem); + + if (info != null) { + infoElem = response.createElementNS(MOA_NS_URI, "Info"); + infoElem.appendChild(response.createTextNode(info)); + codeInfoElem.appendChild(infoElem); + } + root.appendChild(codeInfoElem); + } } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java index 80d8575f9..2e4a95a89 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java @@ -25,6 +25,7 @@ import at.gv.egovernment.moa.spss.MOASystemException; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; /** @@ -89,6 +90,7 @@ public class VerifyCMSSignatureResponseBuilder { SignerInfo signerInfo = responseElement.getSignerInfo(); CheckResult signatureCheck = responseElement.getSignatureCheck(); CheckResult certCheck = responseElement.getCertificateCheck(); + CheckTSLResult tslCheck = responseElement.getTSLCheck(); ResponseBuilderUtils.addSignerInfo( responseDoc, @@ -111,6 +113,13 @@ public class VerifyCMSSignatureResponseBuilder { "CertificateCheck", certCheck.getCode(), certCheck.getInfo()); + + ResponseBuilderUtils.addCodeInfoElement( + responseDoc, + responseElem, + "TSLCheck", + tslCheck.getCode(), + tslCheck.getInfo()); } } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java index a8be59766..dedb1dc88 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java @@ -135,6 +135,13 @@ public class VerifyXMLSignatureResponseBuilder { "CertificateCheck", response.getCertificateCheck().getCode(), response.getCertificateCheck().getInfo()); + + ResponseBuilderUtils.addCodeInfoElement( + responseDoc, + responseElem, + "TSLCheck", + response.getTSLCheck().getCode(), + response.getTSLCheck().getInfo()); return responseDoc; } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java index 01fe9cf2c..63da503cb 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java @@ -18,6 +18,7 @@ package at.gv.egovernment.moa.spss.api.xmlverify; import java.util.List; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; /** @@ -71,5 +72,14 @@ public interface VerifyXMLSignatureResponse { * @return The result of the certificate verification. */ public CheckResult getCertificateCheck(); + + /** + * Gets the result of the TSL verification. + * + * @return The result of the TSL verification. + */ + public CheckTSLResult getTSLCheck(); + + } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 3ad7b761f..51669026f 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -949,7 +949,8 @@ public class ConfigurationPartsBuilder { String id = getElementValue(profileElem, CONF + "Id", null); String trustAnchorsLocStr = getElementValue(profileElem, CONF + "TrustAnchorsLocation", null); String signerCertsLocStr = getElementValue(profileElem, CONF + "SignerCertsLocation", null); - + String tslLocStr = getElementValue(profileElem, CONF + "TSLLocation", null); + URI trustAnchorsLocURI = null; try { @@ -973,6 +974,34 @@ public class ConfigurationPartsBuilder { warn("config.27", new Object[] { "uri", id }); continue; } + + + URI tslLocURI = null; + if (tslLocStr != null) { + + try + { + tslLocURI = new URI(tslLocStr); + if (!tslLocURI.isAbsolute()) { // make it absolute to the config file + tslLocURI = new URI(configRoot_.toURL() + tslLocStr); + } + } + catch (URIException e) { + warn("config.14", new Object[] { "uriTSL", id, tslLocStr }, e); + continue; + } + catch (MalformedURLException e) + { + warn("config.33", new Object[] {id}, e); + continue; + } + + File profileDirTSL = new File(tslLocURI.getPath()); + if (!profileDirTSL.exists() || !profileDirTSL.isDirectory()) { + warn("config.27", new Object[] { "uriTSL", id }); + continue; + } + } if (trustProfiles.containsKey(id)) { warn("config.04", new Object[] { "TrustProfile", id }); @@ -1004,7 +1033,10 @@ public class ConfigurationPartsBuilder { } signerCertsLocStr = (signerCertsLocURI != null) ? signerCertsLocURI.toString() : null; - TrustProfile profile = new TrustProfile(id, trustAnchorsLocURI.toString(), signerCertsLocStr); + String tslLocURIString = null; + if (tslLocURI != null) + tslLocURIString = tslLocURI.toString(); + TrustProfile profile = new TrustProfile(id, trustAnchorsLocURI.toString(), signerCertsLocStr, tslLocURIString); trustProfiles.put(id, profile); } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java index 85d3947aa..66c08e34e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java @@ -28,7 +28,9 @@ public class TrustProfile { private String uri; /** The URI giving the location of the allowed signer certificates. */ private String signerCertsUri; - + /** The URI giving the location of the TSLs */ + private String uriTSL; + /** * Create a TrustProfile. * @@ -36,11 +38,13 @@ public class TrustProfile { * @param uri The URI of the TrustProfile to create. * @param signerCertsUri The URI of the location of the allowed signer * certificates of the TrustProfile to create. + * @param uriTSL The URI to the TSLs */ - public TrustProfile(String id, String uri, String signerCertsUri) { + public TrustProfile(String id, String uri, String signerCertsUri, String uriTSL) { this.id = id; this.uri = uri; this.signerCertsUri = signerCertsUri; + this.uriTSL = uriTSL; } /** @@ -70,4 +74,12 @@ public class TrustProfile { public String getSignerCertsUri() { return signerCertsUri; } + + /** + * Return the URI of the location of the TSLS + * @return The URI of the location of the TSLS + */ + public String getUriTSL() { + return uriTSL; + } } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java index 96c8b984e..b5c1023ab 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java @@ -39,6 +39,7 @@ import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentReference; import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; +import at.gv.egovernment.moa.spss.server.config.TrustProfile; import at.gv.egovernment.moa.spss.server.logging.IaikLog; import at.gv.egovernment.moa.spss.server.logging.TransactionId; import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; @@ -113,7 +114,11 @@ public class CMSSignatureVerificationInvoker { // get the signature signature = request.getCMSSignature(); + // get the actual trustprofile + TrustProfile trustProfile = context.getConfiguration().getTrustProfile(request.getTrustProfileId()); + try { + // get the signed content signedContent = getSignedContent(request); @@ -169,7 +174,7 @@ public class CMSSignatureVerificationInvoker { for (resultIter = results.iterator(); resultIter.hasNext();) { result = (CMSSignatureVerificationResult) resultIter.next(); - responseBuilder.addResult(result); + responseBuilder.addResult(result, trustProfile); } } else { int i; @@ -180,7 +185,7 @@ public class CMSSignatureVerificationInvoker { try { result = (CMSSignatureVerificationResult) results.get(signatories[i] - 1); - responseBuilder.addResult(result); + responseBuilder.addResult(result, trustProfile); } catch (IndexOutOfBoundsException e) { throw new MOAApplicationException( "2249", @@ -188,7 +193,7 @@ public class CMSSignatureVerificationInvoker { } } } - + return responseBuilder.getResponse(); } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java index 8a0b3de13..b7bdbc9b8 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java @@ -15,19 +15,25 @@ */ package at.gv.egovernment.moa.spss.server.invoke; +import iaik.server.modules.cmsverify.CMSSignatureVerificationResult; +import iaik.server.modules.cmsverify.CertificateValidationResult; +import iaik.server.modules.xmlverify.XMLSignatureVerificationResult; + import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; - -import iaik.server.modules.cmsverify.CMSSignatureVerificationResult; -import iaik.server.modules.cmsverify.CertificateValidationResult; +import java.util.ListIterator; import at.gv.egovernment.moa.spss.MOAApplicationException; +import at.gv.egovernment.moa.spss.MOAException; import at.gv.egovernment.moa.spss.api.SPSSFactory; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; +import at.gv.egovernment.moa.spss.server.config.TrustProfile; +import at.gv.egovernment.moa.spss.util.MessageProvider; /** * A class to build a VerifyCMSSignatureResponse object. @@ -60,21 +66,24 @@ public class VerifyCMSSignatureResponseBuilder { * Add a verification result to the response. * * @param result The result to add. - * @throws MOAApplicationException An error occurred adding the result. + * @param trustprofile The actual trustprofile + * @throws MOAException */ - public void addResult(CMSSignatureVerificationResult result) - throws MOAApplicationException { + public void addResult(CMSSignatureVerificationResult result, TrustProfile trustProfile) + throws MOAException { CertificateValidationResult certResult = result.getCertificateValidationResult(); int signatureCheckCode = result.getSignatureValueVerificationCode().intValue(); int certificateCheckCode = certResult.getValidationResultCode().intValue(); + VerifyCMSSignatureResponseElement responseElement; SignerInfo signerInfo; CheckResult signatureCheck; CheckResult certificateCheck; - + CheckTSLResult tslCheck; + // add SignerInfo element signerInfo = factory.createSignerInfo( @@ -88,14 +97,55 @@ public class VerifyCMSSignatureResponseBuilder { // add CertificateCheck element certificateCheck = factory.createCheckResult(certificateCheckCode, null); + + // add TSL check + tslCheck = validateTSL(result, trustProfile); + // build the response element responseElement = factory.createVerifyCMSSignatureResponseElement( signerInfo, signatureCheck, - certificateCheck); + certificateCheck, + tslCheck); responseElements.add(responseElement); } + + /** + * Checks the certificate chain against the given (in the provided trustProfile) TSLs + * + * @param result The result produced by the XMLSignatureVerificationModule. + * + * @param trustProfile The trust profile the signer certificate is validated against. + * + * @return The overal result of the TSL validation. + * + * @throws MOAException + */ + private CheckTSLResult validateTSL(CMSSignatureVerificationResult result, TrustProfile trustProfile) + throws MOAException +{ + MessageProvider msg = MessageProvider.getInstance(); + //String logMsg = msg.getMessage("tsl.00", new Object[]{trustProfile.getId(), files[i].getName()}); + + // TODO KS: TSL initialisieren, TSL abfrage mit chain + + List chain = result.getCertificateValidationResult().getCertificateChain(); + String uriTSL = trustProfile.getUriTSL(); + //System.out.println("Size: " + chain.size()); + ListIterator it = chain.listIterator(); + while(it.hasNext()) { + X509Certificate cert = (X509Certificate) it.next(); + //System.out.println(cert.getSubjectDN()); + } + //System.out.println("URL-TSL: " + uriTSL); + + int resultCode = 0; + String resultInfo = msg.getMessage("tsl.00", null); + + SPSSFactory factory = SPSSFactory.getInstance(); + return factory.createCheckTSLResult(resultCode, resultInfo); +} } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java index 1250fcad5..68ba4ad7e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java @@ -42,6 +42,7 @@ import org.w3c.dom.NodeList; import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.api.SPSSFactory; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.Content; import at.gv.egovernment.moa.spss.api.common.InputData; import at.gv.egovernment.moa.spss.api.common.SignerInfo; @@ -86,6 +87,9 @@ public class VerifyXMLSignatureResponseBuilder { private List xmlDsigManifestChecks; /** The result of the certificate check. */ private CheckResult certificateCheck; + /** The result of the TSL check. */ + private CheckTSLResult tslCheck; + /** * Get the VerifyMLSignatureResponse built so far. @@ -100,7 +104,8 @@ public class VerifyXMLSignatureResponseBuilder { signatureCheck, signatureManifestCheck, xmlDsigManifestChecks, - certificateCheck); + certificateCheck, + tslCheck); } /** @@ -113,14 +118,16 @@ public class VerifyXMLSignatureResponseBuilder { * @param profile The profile used for verifying the signature. * @param transformsSignatureManifestCheck The overall result for the signature * manifest check. - * @param certificateCheck The overall result for the certificate check. + * @param certificateCheck The overall result for the certificate check. + * @param tslCheck The result of the TSL check * @throws MOAApplicationException An error occurred adding the result. */ public void setResult( XMLSignatureVerificationResult result, XMLSignatureVerificationProfile profile, ReferencesCheckResult transformsSignatureManifestCheck, - CheckResult certificateCheck) + CheckResult certificateCheck, + CheckTSLResult tslCheck) throws MOAApplicationException { CertificateValidationResult certResult = @@ -284,6 +291,10 @@ public class VerifyXMLSignatureResponseBuilder { // create the certificate check this.certificateCheck = certificateCheck; + + // create the tsl check + this.tslCheck = tslCheck; + } /** diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java index f08588ecb..765a48e79 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java @@ -43,6 +43,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.ListIterator; import java.util.Map; import java.util.Set; @@ -58,6 +59,7 @@ import at.gv.egovernment.moa.spss.MOAException; import at.gv.egovernment.moa.spss.MOASystemException; import at.gv.egovernment.moa.spss.api.SPSSFactory; import at.gv.egovernment.moa.spss.api.common.CheckResult; +import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; @@ -225,6 +227,7 @@ public class XMLSignatureVerificationInvoker { signatureEnvironmentParent.appendChild(signatureEnvironment.getElement()); } + // check the result signatureManifestCheck = validateSignatureManifest(request, result, profile); @@ -233,8 +236,11 @@ public class XMLSignatureVerificationInvoker { TrustProfile trustProfile = context.getConfiguration().getTrustProfile(request.getTrustProfileId()); CheckResult certificateCheck = validateSignerCertificate(result, trustProfile); + // Check the TSL result + CheckTSLResult tslCheck = validateTSL(result, trustProfile); + // build the response - responseBuilder.setResult(result, profile, signatureManifestCheck, certificateCheck); + responseBuilder.setResult(result, profile, signatureManifestCheck, certificateCheck, tslCheck); return responseBuilder.getResponse(); } @@ -318,6 +324,42 @@ public class XMLSignatureVerificationInvoker { SPSSFactory factory = SPSSFactory.getInstance(); return factory.createCheckResult(resultCode, null); } + + /** + * Checks the certificate chain against the given (in the provided trustProfile) TSLs + * + * @param result The result produced by the XMLSignatureVerificationModule. + * + * @param trustProfile The trust profile the signer certificate is validated against. + * + * @return The overal result of the TSL validation. + * + * @throws MOAException + */ + private CheckTSLResult validateTSL(XMLSignatureVerificationResult result, TrustProfile trustProfile) + throws MOAException +{ + MessageProvider msg = MessageProvider.getInstance(); + //String logMsg = msg.getMessage("tsl.00", new Object[]{trustProfile.getId(), files[i].getName()}); + + // TODO KS: TSL initialisieren, TSL abfrage mit chain + + List chain = result.getCertificateValidationResult().getCertificateChain(); + String uriTSL = trustProfile.getUriTSL(); + //System.out.println("Size: " + chain.size()); + ListIterator it = chain.listIterator(); + while(it.hasNext()) { + X509Certificate cert = (X509Certificate) it.next(); + //System.out.println(cert.getSubjectDN()); + } + //System.out.println("URL-TSL: " + uriTSL); + + int resultCode = 0; + String resultInfo = msg.getMessage("tsl.00", null); + + SPSSFactory factory = SPSSFactory.getInstance(); + return factory.createCheckTSLResult(resultCode, resultInfo); +} /** * Select the dsig:Signature DOM element within the signature diff --git a/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties b/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties index 9b896c059..4c9d11f63 100644 --- a/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties +++ b/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties @@ -134,7 +134,7 @@ config.28=Einen detaillierten Fehlerbericht entnehmen Sie bitte der Log-Datei. config.29=Es sind folgende leichte Fehler aufgetreten: config.31=Fehler in der Konfiguration der KeyGroup mit id={0}: Der Schlüssel im KeyModule id={1} mit IssuerName={2} und SerialNumber={3} konnte nicht geladen werden config.32=Fehler in der Konfiguration: Verzeichnisangabe für den Zertifikatsspeicher ist ungültig ({0}). - +config.33=Fehler beim Erstellen des TrustProfile id={0}: Name des TSL-Verzeichnisses konnte nicht in eine URL umgewandet werden handler.00=Starte neue Transaktion: TID={0}, Service={1} handler.01=Aufruf von Adresse={0} @@ -149,3 +149,5 @@ invoker.00=Das Signature Environment konnte nicht validierend geparst werden invoker.01=Keine passende Transformationskette gefunden (Index={0}) invoker.02=Der Hashwert der Transformation stimmt nicht überein (Index={0}) invoker.03=Signatorzertifikat aus Trustprofile mit id={0} konnte nicht geparst werden (Dateiname={1}) + +tsl.00 = Das Zertifikat konnte erfolgreich gegen die TSL verifiziert werden \ No newline at end of file -- cgit v1.2.3 From fa30b5b2a26a6df4e56a81283761c35ef81770e3 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 13 Jul 2010 06:25:09 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1166 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/.classpath | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/.classpath b/spss/server/serverlib/.classpath index f0e483a4a..1c79cc393 100644 --- a/spss/server/serverlib/.classpath +++ b/spss/server/serverlib/.classpath @@ -1,13 +1,9 @@ - - - - - - - - - - - - - + + + + + + + + + -- cgit v1.2.3 From 4aa19048995f9ddca2f8943287a681992a55b79a Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 13 Jul 2010 09:38:55 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1169 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../gv/egovernment/moa/spss/api/SPSSFactory.java | 23 ++------ .../VerifyCMSSignatureResponseElement.java | 8 +-- .../moa/spss/api/common/CheckTSLResult.java | 40 ------------- .../moa/spss/api/impl/CheckTSLResultImpl.java | 66 ---------------------- .../moa/spss/api/impl/SPSSFactoryImpl.java | 15 +---- .../VerifyCMSSignatureResponseElementImpl.java | 15 ----- .../api/impl/VerifyXMLSignatureResponseImpl.java | 16 +----- .../xmlbind/VerifyCMSSignatureResponseBuilder.java | 11 +--- .../xmlbind/VerifyXMLSignatureResponseBuilder.java | 7 +-- .../api/xmlverify/VerifyXMLSignatureResponse.java | 7 --- .../server/config/ConfigurationPartsBuilder.java | 34 +---------- .../moa/spss/server/config/TrustProfile.java | 14 +---- .../invoke/VerifyCMSSignatureResponseBuilder.java | 47 ++------------- .../invoke/VerifyXMLSignatureResponseBuilder.java | 14 +---- .../invoke/XMLSignatureVerificationInvoker.java | 39 +------------ .../properties/spss_messages_de.properties | 5 +- 16 files changed, 24 insertions(+), 337 deletions(-) delete mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckTSLResult.java delete mode 100644 spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckTSLResultImpl.java (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java index 1a778ad2b..daca95eb2 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java @@ -32,7 +32,6 @@ import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; 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.common.SignerInfo; @@ -434,8 +433,7 @@ public abstract class SPSSFactory { * @param signerInfo Information about the signer certificate. * @param signatureCheck Result of the singature value check. * @param certificateCheck Result of the certificate status check. - * @param tslCheck Result of the TSL check - * @return The new VerifyCMSSignatureResponseElement containing + * @return The new VerifyCMSSignatureResponseElement containing * the above data. * * @pre signerInfo != null && signatureCheck != null && @@ -445,8 +443,7 @@ public abstract class SPSSFactory { public abstract VerifyCMSSignatureResponseElement createVerifyCMSSignatureResponseElement( SignerInfo signerInfo, CheckResult signatureCheck, - CheckResult certificateCheck, - CheckTSLResult tslCheck); + CheckResult certificateCheck); // // Factory methods for verifying XML signatures @@ -700,8 +697,7 @@ public abstract class SPSSFactory { ReferencesCheckResult signatureCheck, ReferencesCheckResult signatureManifestCheck, List xmlDsigManifestChecks, - CheckResult certificateCheck, - CheckTSLResult tslCheck); + CheckResult certificateCheck); /** * Create a new ReferencesCheckResult object. @@ -990,18 +986,7 @@ public abstract class SPSSFactory { */ public abstract CheckResult createCheckResult(int code, NodeList info); - /** - * Create a new CheckTSLResult object. - * - * @param code The numerical error code. - * @param info Verbose error information. - * @return The new CheckTSLResult containing the above data. - * - * @pre code >= 0 - * @pre info != null - * @post return != null - */ - public abstract CheckTSLResult createCheckTSLResult(int code, String info); + /** * Create a new SignerInfo object. diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java index e2f44c540..4920aac0c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java @@ -16,7 +16,6 @@ package at.gv.egovernment.moa.spss.api.cmsverify; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; /** @@ -45,10 +44,5 @@ public interface VerifyCMSSignatureResponseElement { * @return The result of the certificate verification. */ public CheckResult getCertificateCheck(); - /** - * Gets the result of the TSL verification - * - * @return The result of the TSL verification - */ - public CheckTSLResult getTSLCheck(); + } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckTSLResult.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckTSLResult.java deleted file mode 100644 index f31512cdb..000000000 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckTSLResult.java +++ /dev/null @@ -1,40 +0,0 @@ -/* -* Copyright 2003 Federal Chancellery Austria -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egovernment.moa.spss.api.common; - -import org.w3c.dom.NodeList; - -/** - * Object encapsulating the result of a TSL verification. - * - * @author Patrick Peck - * @author Stephan Grill - * @version $Id: CheckResult.java 1087 2008-08-28 07:55:59Z mcentner $ - */ -public interface CheckTSLResult { - /** - * Gets the result code. - * - * @return The result code. - */ - public int getCode(); - /** - * Gets descriptive information. - * - * @return Descriptive information. - */ - public String getInfo(); -} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckTSLResultImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckTSLResultImpl.java deleted file mode 100644 index 62f3ab979..000000000 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckTSLResultImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* -* Copyright 2003 Federal Chancellery Austria -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egovernment.moa.spss.api.impl; - -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; - -/** - * Default implementation of CheckTSLResult. - * - * @author Fatemeh Philippi - * @author Klaus Stranacher - * @version $Id: CheckResultImpl.java 1087 2008-08-28 07:55:59Z mcentner $ - */ -public class CheckTSLResultImpl implements CheckTSLResult { - /** The result code. */ - private int code; - - /** Additional information. */ - private String info; - - /** - * Sets a result code. - * - * @param code The result code. - */ - public void setCode(int code) { - this.code = code; - } - - /** - * @see at.gv.egovernment.moa.spss.api.common.CheckTSLResult#getCode() - */ - public int getCode() { - return code; - } - - /** - * Sets a descriptive information. - * - * @param info The descriptive information. - */ - public void setInfo(String info) { - this.info = info; - } - - /** - * @see at.gv.egovernment.moa.spss.api.common.CheckTSLResult#getInfo() - */ - public String getInfo() { - return info; - } - -} diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java index 8cf06bb15..7c8b7b561 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java @@ -32,7 +32,6 @@ import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; 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.common.SignerInfo; @@ -260,14 +259,12 @@ public class SPSSFactoryImpl extends SPSSFactory { public VerifyCMSSignatureResponseElement createVerifyCMSSignatureResponseElement( SignerInfo signerInfo, CheckResult signatureCheck, - CheckResult certificateCheck, - CheckTSLResult tslCheck) { + CheckResult certificateCheck) { VerifyCMSSignatureResponseElementImpl verifyCMSSignatureResponseElement = new VerifyCMSSignatureResponseElementImpl(); verifyCMSSignatureResponseElement.setSignerInfo(signerInfo); verifyCMSSignatureResponseElement.setSignatureCheck(signatureCheck); verifyCMSSignatureResponseElement.setCertificateCheck(certificateCheck); - verifyCMSSignatureResponseElement.setTSLCheck(tslCheck); return verifyCMSSignatureResponseElement; } @@ -394,8 +391,7 @@ public class SPSSFactoryImpl extends SPSSFactory { ReferencesCheckResult signatureCheck, ReferencesCheckResult signatureManifestCheck, List xmlDsigManifestChecks, - CheckResult certificateCheck, - CheckTSLResult tslCheck) { + CheckResult certificateCheck) { VerifyXMLSignatureResponseImpl verifyXMLSignatureResponse = new VerifyXMLSignatureResponseImpl(); verifyXMLSignatureResponse.setSignerInfo(signerInfo); @@ -406,7 +402,6 @@ public class SPSSFactoryImpl extends SPSSFactory { signatureManifestCheck); verifyXMLSignatureResponse.setXMLDsigManifestChecks(xmlDsigManifestChecks); verifyXMLSignatureResponse.setCertificateCheck(certificateCheck); - verifyXMLSignatureResponse.setTSLCheck(tslCheck); return verifyXMLSignatureResponse; } @@ -565,12 +560,6 @@ public class SPSSFactoryImpl extends SPSSFactory { return checkResult; } - public CheckTSLResult createCheckTSLResult(int code, String info) { - CheckTSLResultImpl checkTSLResult = new CheckTSLResultImpl(); - checkTSLResult.setCode(code); - checkTSLResult.setInfo(info); - return checkTSLResult; - } public SignerInfo createSignerInfo( X509Certificate signerCertificate, diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java index f80c4ace2..6d14692fd 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java @@ -17,7 +17,6 @@ package at.gv.egovernment.moa.spss.api.impl; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; /** @@ -35,8 +34,6 @@ public class VerifyCMSSignatureResponseElementImpl private CheckResult signatureCheck; /** Information about the certificate check. */ private CheckResult certificateCheck; - /** Information about the TSL check */ - private CheckTSLResult tslCheck; /** * Sets a SignerInfo element according to CMS. @@ -77,16 +74,4 @@ public class VerifyCMSSignatureResponseElementImpl return certificateCheck; } - /** - * Sets a result of the TSL verification. - * - * @param tslCheck The result of the TSL verification. - */ - public void setTSLCheck(CheckTSLResult tslCheck) { - this.tslCheck = tslCheck; - } - - public CheckTSLResult getTSLCheck() { - return tslCheck; - } } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java index ea6a180a7..3cad988ff 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java @@ -20,7 +20,6 @@ import java.util.Collections; import java.util.List; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; @@ -53,8 +52,6 @@ public class VerifyXMLSignatureResponseImpl private List xmlDsigManifestChecks = new ArrayList(); /** Information about the certificate check. */ private CheckResult certificateCheck; - /** Information about the TSL check. */ - private CheckTSLResult tslCheck; /** * Sets information about the signer certificate. @@ -139,18 +136,7 @@ public class VerifyXMLSignatureResponseImpl public CheckResult getCertificateCheck() { return certificateCheck; } - /** - * Sets the result of the TSL verification. - * - * @param certificateCheck The result of the TSL verification. - */ - public void setTSLCheck(CheckTSLResult tslCheck) { - this.tslCheck = tslCheck; - } - - public CheckTSLResult getTSLCheck() { - return tslCheck; - } + /** * Sets the XMLDSigManifestChecks. diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java index 2e4a95a89..1215f1ccc 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java @@ -25,7 +25,6 @@ import at.gv.egovernment.moa.spss.MOASystemException; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; /** @@ -90,8 +89,7 @@ public class VerifyCMSSignatureResponseBuilder { SignerInfo signerInfo = responseElement.getSignerInfo(); CheckResult signatureCheck = responseElement.getSignatureCheck(); CheckResult certCheck = responseElement.getCertificateCheck(); - CheckTSLResult tslCheck = responseElement.getTSLCheck(); - + ResponseBuilderUtils.addSignerInfo( responseDoc, responseElem, @@ -114,12 +112,7 @@ public class VerifyCMSSignatureResponseBuilder { certCheck.getCode(), certCheck.getInfo()); - ResponseBuilderUtils.addCodeInfoElement( - responseDoc, - responseElem, - "TSLCheck", - tslCheck.getCode(), - tslCheck.getInfo()); + } } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java index dedb1dc88..1ca931e9c 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java @@ -136,12 +136,7 @@ public class VerifyXMLSignatureResponseBuilder { response.getCertificateCheck().getCode(), response.getCertificateCheck().getInfo()); - ResponseBuilderUtils.addCodeInfoElement( - responseDoc, - responseElem, - "TSLCheck", - response.getTSLCheck().getCode(), - response.getTSLCheck().getInfo()); + return responseDoc; } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java index 63da503cb..1ccbae133 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java @@ -18,7 +18,6 @@ package at.gv.egovernment.moa.spss.api.xmlverify; import java.util.List; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; /** @@ -73,12 +72,6 @@ public interface VerifyXMLSignatureResponse { */ public CheckResult getCertificateCheck(); - /** - * Gets the result of the TSL verification. - * - * @return The result of the TSL verification. - */ - public CheckTSLResult getTSLCheck(); diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 51669026f..9e0dc7688 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -949,7 +949,6 @@ public class ConfigurationPartsBuilder { String id = getElementValue(profileElem, CONF + "Id", null); String trustAnchorsLocStr = getElementValue(profileElem, CONF + "TrustAnchorsLocation", null); String signerCertsLocStr = getElementValue(profileElem, CONF + "SignerCertsLocation", null); - String tslLocStr = getElementValue(profileElem, CONF + "TSLLocation", null); URI trustAnchorsLocURI = null; try @@ -976,33 +975,7 @@ public class ConfigurationPartsBuilder { } - URI tslLocURI = null; - if (tslLocStr != null) { - - try - { - tslLocURI = new URI(tslLocStr); - if (!tslLocURI.isAbsolute()) { // make it absolute to the config file - tslLocURI = new URI(configRoot_.toURL() + tslLocStr); - } - } - catch (URIException e) { - warn("config.14", new Object[] { "uriTSL", id, tslLocStr }, e); - continue; - } - catch (MalformedURLException e) - { - warn("config.33", new Object[] {id}, e); - continue; - } - - File profileDirTSL = new File(tslLocURI.getPath()); - if (!profileDirTSL.exists() || !profileDirTSL.isDirectory()) { - warn("config.27", new Object[] { "uriTSL", id }); - continue; - } - } - + if (trustProfiles.containsKey(id)) { warn("config.04", new Object[] { "TrustProfile", id }); continue; @@ -1033,10 +1006,7 @@ public class ConfigurationPartsBuilder { } signerCertsLocStr = (signerCertsLocURI != null) ? signerCertsLocURI.toString() : null; - String tslLocURIString = null; - if (tslLocURI != null) - tslLocURIString = tslLocURI.toString(); - TrustProfile profile = new TrustProfile(id, trustAnchorsLocURI.toString(), signerCertsLocStr, tslLocURIString); + TrustProfile profile = new TrustProfile(id, trustAnchorsLocURI.toString(), signerCertsLocStr); trustProfiles.put(id, profile); } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java index 66c08e34e..b1031c4cb 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java @@ -28,8 +28,6 @@ public class TrustProfile { private String uri; /** The URI giving the location of the allowed signer certificates. */ private String signerCertsUri; - /** The URI giving the location of the TSLs */ - private String uriTSL; /** * Create a TrustProfile. @@ -38,13 +36,11 @@ public class TrustProfile { * @param uri The URI of the TrustProfile to create. * @param signerCertsUri The URI of the location of the allowed signer * certificates of the TrustProfile to create. - * @param uriTSL The URI to the TSLs */ - public TrustProfile(String id, String uri, String signerCertsUri, String uriTSL) { + public TrustProfile(String id, String uri, String signerCertsUri) { this.id = id; this.uri = uri; this.signerCertsUri = signerCertsUri; - this.uriTSL = uriTSL; } /** @@ -75,11 +71,5 @@ public class TrustProfile { return signerCertsUri; } - /** - * Return the URI of the location of the TSLS - * @return The URI of the location of the TSLS - */ - public String getUriTSL() { - return uriTSL; - } + } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java index b7bdbc9b8..dc23b5c2d 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java @@ -30,7 +30,6 @@ import at.gv.egovernment.moa.spss.api.SPSSFactory; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.SignerInfo; import at.gv.egovernment.moa.spss.server.config.TrustProfile; import at.gv.egovernment.moa.spss.util.MessageProvider; @@ -82,8 +81,7 @@ public class VerifyCMSSignatureResponseBuilder { SignerInfo signerInfo; CheckResult signatureCheck; CheckResult certificateCheck; - CheckTSLResult tslCheck; - + // add SignerInfo element signerInfo = factory.createSignerInfo( @@ -98,54 +96,17 @@ public class VerifyCMSSignatureResponseBuilder { // add CertificateCheck element certificateCheck = factory.createCheckResult(certificateCheckCode, null); - // add TSL check - tslCheck = validateTSL(result, trustProfile); - + // build the response element responseElement = factory.createVerifyCMSSignatureResponseElement( signerInfo, signatureCheck, - certificateCheck, - tslCheck); + certificateCheck); responseElements.add(responseElement); } - /** - * Checks the certificate chain against the given (in the provided trustProfile) TSLs - * - * @param result The result produced by the XMLSignatureVerificationModule. - * - * @param trustProfile The trust profile the signer certificate is validated against. - * - * @return The overal result of the TSL validation. - * - * @throws MOAException - */ - private CheckTSLResult validateTSL(CMSSignatureVerificationResult result, TrustProfile trustProfile) - throws MOAException -{ - MessageProvider msg = MessageProvider.getInstance(); - //String logMsg = msg.getMessage("tsl.00", new Object[]{trustProfile.getId(), files[i].getName()}); - - // TODO KS: TSL initialisieren, TSL abfrage mit chain - - List chain = result.getCertificateValidationResult().getCertificateChain(); - String uriTSL = trustProfile.getUriTSL(); - //System.out.println("Size: " + chain.size()); - ListIterator it = chain.listIterator(); - while(it.hasNext()) { - X509Certificate cert = (X509Certificate) it.next(); - //System.out.println(cert.getSubjectDN()); - } - //System.out.println("URL-TSL: " + uriTSL); - - int resultCode = 0; - String resultInfo = msg.getMessage("tsl.00", null); - - SPSSFactory factory = SPSSFactory.getInstance(); - return factory.createCheckTSLResult(resultCode, resultInfo); -} + } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java index 68ba4ad7e..7d66811db 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java @@ -42,7 +42,6 @@ import org.w3c.dom.NodeList; import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.api.SPSSFactory; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.Content; import at.gv.egovernment.moa.spss.api.common.InputData; import at.gv.egovernment.moa.spss.api.common.SignerInfo; @@ -87,10 +86,7 @@ public class VerifyXMLSignatureResponseBuilder { private List xmlDsigManifestChecks; /** The result of the certificate check. */ private CheckResult certificateCheck; - /** The result of the TSL check. */ - private CheckTSLResult tslCheck; - /** * Get the VerifyMLSignatureResponse built so far. * @@ -104,8 +100,7 @@ public class VerifyXMLSignatureResponseBuilder { signatureCheck, signatureManifestCheck, xmlDsigManifestChecks, - certificateCheck, - tslCheck); + certificateCheck); } /** @@ -119,15 +114,13 @@ public class VerifyXMLSignatureResponseBuilder { * @param transformsSignatureManifestCheck The overall result for the signature * manifest check. * @param certificateCheck The overall result for the certificate check. - * @param tslCheck The result of the TSL check * @throws MOAApplicationException An error occurred adding the result. */ public void setResult( XMLSignatureVerificationResult result, XMLSignatureVerificationProfile profile, ReferencesCheckResult transformsSignatureManifestCheck, - CheckResult certificateCheck, - CheckTSLResult tslCheck) + CheckResult certificateCheck) throws MOAApplicationException { CertificateValidationResult certResult = @@ -292,8 +285,7 @@ public class VerifyXMLSignatureResponseBuilder { // create the certificate check this.certificateCheck = certificateCheck; - // create the tsl check - this.tslCheck = tslCheck; + } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java index 765a48e79..eb6275b3a 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java @@ -59,7 +59,6 @@ import at.gv.egovernment.moa.spss.MOAException; import at.gv.egovernment.moa.spss.MOASystemException; import at.gv.egovernment.moa.spss.api.SPSSFactory; import at.gv.egovernment.moa.spss.api.common.CheckResult; -import at.gv.egovernment.moa.spss.api.common.CheckTSLResult; import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo; import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult; @@ -236,11 +235,9 @@ public class XMLSignatureVerificationInvoker { TrustProfile trustProfile = context.getConfiguration().getTrustProfile(request.getTrustProfileId()); CheckResult certificateCheck = validateSignerCertificate(result, trustProfile); - // Check the TSL result - CheckTSLResult tslCheck = validateTSL(result, trustProfile); // build the response - responseBuilder.setResult(result, profile, signatureManifestCheck, certificateCheck, tslCheck); + responseBuilder.setResult(result, profile, signatureManifestCheck, certificateCheck); return responseBuilder.getResponse(); } @@ -325,41 +322,7 @@ public class XMLSignatureVerificationInvoker { return factory.createCheckResult(resultCode, null); } - /** - * Checks the certificate chain against the given (in the provided trustProfile) TSLs - * - * @param result The result produced by the XMLSignatureVerificationModule. - * - * @param trustProfile The trust profile the signer certificate is validated against. - * - * @return The overal result of the TSL validation. - * - * @throws MOAException - */ - private CheckTSLResult validateTSL(XMLSignatureVerificationResult result, TrustProfile trustProfile) - throws MOAException -{ - MessageProvider msg = MessageProvider.getInstance(); - //String logMsg = msg.getMessage("tsl.00", new Object[]{trustProfile.getId(), files[i].getName()}); - - // TODO KS: TSL initialisieren, TSL abfrage mit chain - - List chain = result.getCertificateValidationResult().getCertificateChain(); - String uriTSL = trustProfile.getUriTSL(); - //System.out.println("Size: " + chain.size()); - ListIterator it = chain.listIterator(); - while(it.hasNext()) { - X509Certificate cert = (X509Certificate) it.next(); - //System.out.println(cert.getSubjectDN()); - } - //System.out.println("URL-TSL: " + uriTSL); - - int resultCode = 0; - String resultInfo = msg.getMessage("tsl.00", null); - SPSSFactory factory = SPSSFactory.getInstance(); - return factory.createCheckTSLResult(resultCode, resultInfo); -} /** * Select the dsig:Signature DOM element within the signature diff --git a/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties b/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties index 4c9d11f63..3920da4d9 100644 --- a/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties +++ b/spss/server/serverlib/src/main/resources/resources/properties/spss_messages_de.properties @@ -134,7 +134,6 @@ config.28=Einen detaillierten Fehlerbericht entnehmen Sie bitte der Log-Datei. config.29=Es sind folgende leichte Fehler aufgetreten: config.31=Fehler in der Konfiguration der KeyGroup mit id={0}: Der Schlüssel im KeyModule id={1} mit IssuerName={2} und SerialNumber={3} konnte nicht geladen werden config.32=Fehler in der Konfiguration: Verzeichnisangabe für den Zertifikatsspeicher ist ungültig ({0}). -config.33=Fehler beim Erstellen des TrustProfile id={0}: Name des TSL-Verzeichnisses konnte nicht in eine URL umgewandet werden handler.00=Starte neue Transaktion: TID={0}, Service={1} handler.01=Aufruf von Adresse={0} @@ -148,6 +147,4 @@ handler.07=SOAP Request empfangen: Request={0} invoker.00=Das Signature Environment konnte nicht validierend geparst werden invoker.01=Keine passende Transformationskette gefunden (Index={0}) invoker.02=Der Hashwert der Transformation stimmt nicht überein (Index={0}) -invoker.03=Signatorzertifikat aus Trustprofile mit id={0} konnte nicht geparst werden (Dateiname={1}) - -tsl.00 = Das Zertifikat konnte erfolgreich gegen die TSL verifiziert werden \ No newline at end of file +invoker.03=Signatorzertifikat aus Trustprofile mit id={0} konnte nicht geparst werden (Dateiname={1}) \ No newline at end of file -- cgit v1.2.3 From 63994a018a74808e6124e45e32a970c9a24410ee Mon Sep 17 00:00:00 2001 From: kstranacher Date: Thu, 26 Aug 2010 13:49:48 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1186 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 4ee7075e3..a95d341be 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -9,7 +9,7 @@ MOA.spss.server moa-spss-lib jar - 1.4.7 + 1.4.8 MOA SP/SS API -- cgit v1.2.3 From ff023754e7ac46af874d00458840f50976fb7b38 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Wed, 16 Mar 2011 12:20:24 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1195 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index a95d341be..1f920a3d7 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -9,7 +9,7 @@ MOA.spss.server moa-spss-lib jar - 1.4.8 + 1.5.0 MOA SP/SS API -- cgit v1.2.3 From 2a31c88fda199a37fb7136d86100a9c330e5de34 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Mon, 28 Mar 2011 17:22:32 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1197 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss/server/serverlib/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 1f920a3d7..555376fe0 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -2,7 +2,7 @@ MOA.spss moa-spss - 1.4.x + 1.5.x 4.0.0 -- cgit v1.2.3 From ac9a6c52e96f4c737de3392a7ba16b8fa8958b85 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Wed, 6 Apr 2011 15:29:11 +0000 Subject: =?UTF-8?q?-=20IAIK=20Libraries=20(repository)=20aktualisiert:=20?= =?UTF-8?q?=09iaik-moa:=20=20=20=20=20=20=20=20=20=20=20Version=201.29=20?= =?UTF-8?q?=09iaik=5Fjce=5Ffull:=09=09Version=204.0=5FMOA=20=09iaik=5Fcms:?= =?UTF-8?q?=09=09=09Version=204.1=5FMOA=20-=20Einbindung=20von=20Online-Vo?= =?UTF-8?q?llmachten=20-=20Update=20MOA-Template=20zur=20B=C3=BCrgerkarten?= =?UTF-8?q?auswahl=20-=20Update=20Doku=20-=20Update=20Transformationen=20(?= =?UTF-8?q?f=C3=BCr=20Online-Vollmachten)=20-=20=C3=84nderung=20der=20Konf?= =?UTF-8?q?iguration=20f=C3=BCr:=20=09-=20Online-Vollmachten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1199 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../moa/spss/server/invoke/DataObjectFactory.java | 166 ++++++++++++--------- 1 file changed, 99 insertions(+), 67 deletions(-) (limited to 'spss/server/serverlib') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java index 566784796..f6b8b4392 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -27,10 +27,11 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Vector; import javax.xml.parsers.ParserConfigurationException; +import org.apache.xerces.dom.CoreDocumentImpl; +import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -70,19 +71,30 @@ import at.gv.egovernment.moa.util.XPathUtils; /** * A class to create DataObjects contained in different * locations of the MOA XML request format. - * + * * @author Patrick Peck * @author Gregor Karlinger * @version $Id$ */ public class DataObjectFactory { + /** + * XPATH for registering ID attributes of known schemas if + * validating parsing fails. + */ + private static final String XPATH = + "descendant-or-self::node()[" + + "namespace-uri()='http://www.w3.org/2000/09/xmldsig#' " + + "or namespace-uri()='http://reference.e-government.gv.at/namespace/persondata/20020228#' " + + "or starts-with(namespace-uri(), 'http://uri.etsi.org/01903/')" + + "]/attribute::Id"; + /** The single instance of this class. */ private static DataObjectFactory instance = null; /** * Return the only instance of this class. - * + * * @return The only instance of this class. */ public static synchronized DataObjectFactory getInstance() { @@ -94,7 +106,7 @@ public class DataObjectFactory { /** * Create a new DataObjectFactory. - * + * * Protected to disallow multiple instances. */ protected DataObjectFactory() { @@ -104,8 +116,8 @@ public class DataObjectFactory { * Return the signature environment, i.e., the root element of the * document, into which the signature will be inserted (if created) or which * contains the signature (if verified). - * - * @param content The Content object containing the signature + * + * @param content The Content object containing the signature * environment. * @param supplements Additional schema or DTD information. * @return The signature environment or null, if no @@ -128,7 +140,7 @@ public class DataObjectFactory { checkAllowContentAndReference(content, false); // build the EntityResolver for validating parsing - if (supplements == null || supplements.isEmpty()) { + if ((supplements == null) || supplements.isEmpty()) { entityResolver = new MOAEntityResolver(); } else { EntityResolverChain chain = new EntityResolverChain(); @@ -195,7 +207,7 @@ public class DataObjectFactory { Element element = checkForSingleElement(((ContentXML) content).getXMLContent()); contentBytes = DOMUtils.serializeNode(element, "UTF-8"); - + break; } default : { @@ -208,25 +220,27 @@ public class DataObjectFactory { throw new MOAApplicationException("2219", null); } - // For logging in Debug-Mode: Mask baseid with xxx - String logString = new String(contentBytes); - // TODO use RegExp - String startS = ""; - String endS = "urn:publicid:gv.at:baseid"; - String logWithMaskedBaseid = logString; - int start = logString.indexOf(startS); - if (start > -1) { - int end = logString.indexOf(endS); - if (end > -1) { + if (Logger.isTraceEnabled()) { + // For logging in Debug-Mode: Mask baseid with xxx + String logString = new String(contentBytes); + // TODO use RegExp + String startS = ""; + String endS = "urn:publicid:gv.at:baseid"; + String logWithMaskedBaseid = logString; + int start = logString.indexOf(startS); + if (start > -1) { + int end = logString.indexOf(endS); + if (end > -1) { logWithMaskedBaseid = logString.substring(0, start); logWithMaskedBaseid += startS; logWithMaskedBaseid += "xxxxxxxxxxxxxxxxxxxxxxxx"; logWithMaskedBaseid += logString.substring(end, logString.length()); - } + } + } + + // try to parse validating + Logger.trace(">>> parsing the following content: \n" + logWithMaskedBaseid); } - - // try to parse validating - Logger.trace(">>> parsing the following content: \n" + logWithMaskedBaseid); try { ByteArrayInputStream is = new ByteArrayInputStream(contentBytes); Document doc = @@ -250,6 +264,21 @@ public class DataObjectFactory { try { ByteArrayInputStream is = new ByteArrayInputStream(contentBytes); Document doc = DOMUtils.parseDocument(is, false, null, null); + // Since the parse tree will not contain any post schema validation information, + // we need to register any attributes known to be of type xsd:Id manually. + NodeList idAttributes = XPathUtils.selectNodeList(doc.getDocumentElement(), XPATH); + for (int i = 0; i < idAttributes.getLength(); i++) { + Node item = idAttributes.item(i); + if (item instanceof Attr) { + Attr attr = (Attr) item; + Element owner = attr.getOwnerElement(); + // Only available in DOM-Level 3 (Java 1.5): + // owner.setIdAttributeNode(attr, true); + if (doc instanceof CoreDocumentImpl) { + ((CoreDocumentImpl) doc).putIdentifier(attr.getValue(), owner); + } + } + } return new XMLDataObjectImpl(doc.getDocumentElement()); } catch (Exception e) { throw new MOAApplicationException("2218", null); @@ -258,11 +287,11 @@ public class DataObjectFactory { /** * Create an XMLDataObject from the given signature environment. - * + * * @param signatureEnvironment The signature environment contained in the * result. * @param uri The URI identifying the data. This must be either the empty - * URI, an URI starting with "#xpointer", "#xmlns" + * URI, an URI starting with "#xpointer", "#xmlns" * or "#element"; or an URI starting with "#" and * followed by an element ID. * @param referenceID The reference ID to set for the data object. @@ -312,16 +341,16 @@ public class DataObjectFactory { } /** - * Build a StreamEntityResolver from a List of + * Build a StreamEntityResolver from a List of * supplements. - * - * @param supplements The supplements, given as + * + * @param supplements The supplements, given as * XMLDataObjectAssociations. * @return A StreamEntityResolver mapping the supplements by * their reference URI to an InputStream of their respective - * content. + * content. */ - private static StreamEntityResolver buildSupplementEntityResolver(List supplements) + private static StreamEntityResolver buildSupplementEntityResolver(List supplements) throws MOAApplicationException { Map entities = new HashMap(); @@ -342,10 +371,10 @@ public class DataObjectFactory { case Content.LOCREF_CONTENT: { String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); - + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); if (context.FindResolvedEntity(locRefURI)==null) { - + ExternalURIResolver uriResolver = new ExternalURIResolver(); InputStream uriStream = null; byte[] contentBytes; @@ -378,17 +407,18 @@ public class DataObjectFactory { int i = 0; // find the first element node - while (i < nodes.getLength() - && nodes.item(i).getNodeType() != Node.ELEMENT_NODE) + while ((i < nodes.getLength()) + && (nodes.item(i).getNodeType() != Node.ELEMENT_NODE)) { i++; + } // serialize the node if (i < nodes.getLength()) { - try + try { byte[] serialized = DOMUtils.serializeNode(nodes.item(i), "UTF-8"); entities.put(reference, new ByteArrayInputStream(serialized)); - } + } catch (Exception e) { throw new MOAApplicationException("2281", new Object[]{reference}, e); @@ -404,7 +434,7 @@ public class DataObjectFactory { /** * Create a DataObject from a Content object. - * + * * @param content The Content object containing the data. * @param finalDataMetaInfo The meta information corresponding with content. * @param referenceID The reference ID to set in the resulting @@ -452,10 +482,10 @@ public class DataObjectFactory { checkAllowContentAndReference(content, allowContentAndReference); // ok, build the data object; use content first, if available - switch (content.getContentType()) + switch (content.getContentType()) { case Content.XML_CONTENT : - { + { ContentXML contentXml = (ContentXML) content; dataObject = createFromXmlContent(contentXml, xmlAsNodeList); break; @@ -499,7 +529,7 @@ public class DataObjectFactory { /** * Check, if content and reference URIs are allowed in the content an throw * an exception if an illegal combination of the two occurs. - * + * * @param content The Content to check. * @param allowContentAndReference Whether explicit content and a reference * are allowed at the same time. @@ -514,13 +544,13 @@ public class DataObjectFactory { String reference = content.getReference(); // check for content and reference not being set - if (content.getContentType() == Content.REFERENCE_CONTENT - && reference == null) { + if ((content.getContentType() == Content.REFERENCE_CONTENT) + && (reference == null)) { String errorCode = allowContentAndReference ? "1111" : "1110"; throw new MOAApplicationException(errorCode, null); } - // if we only allow either content or reference being set at once, check + // if we only allow either content or reference being set at once, check if (!allowContentAndReference && (content.getContentType() != Content.REFERENCE_CONTENT) && (reference != null)) { @@ -531,10 +561,10 @@ public class DataObjectFactory { /** * Create a DataObject from a * XMLDataObjectAssociation object. - * + * * @param xmlDataObjAssoc The XMLDataObjectAssociation object. * @param xmlContentAllowed Whether the content contained in the - * xmlDataObjAssoc is allowed to be of type + * xmlDataObjAssoc is allowed to be of type * XML_CONTENT. * @param binaryContentRepeatable If binary content must be provided as a * DataObject that can be read multiple times. @@ -559,11 +589,11 @@ public class DataObjectFactory { switch (content.getContentType()) { case Content.XML_CONTENT : - { + { if (xmlContentAllowed) { dataObject = createFromXmlContent((ContentXML) content, true); - } + } else { throw new MOAApplicationException("2280", null); @@ -601,8 +631,8 @@ public class DataObjectFactory { /** * Create a DataObject from a TransformParameter * object. - * - * @param transformParameter The TransformParameter object + * + * @param transformParameter The TransformParameter object * containing the data. * @return A DataObject representing the data in * root. @@ -662,7 +692,7 @@ public class DataObjectFactory { /** * Create a DataObject from data located at the given URI. - * + * * @param uri The URI where the data is located. This method uses * an ExternalURIResolver to resolve URIs. * @param asXml If true, a DataObject is only @@ -682,7 +712,7 @@ public class DataObjectFactory { /** * Create a DataObject from data located at the given URI. - * + * * @param uri The URI where the data is located. This method uses * an ExternalURIResolver to resolve URIs. * @param asXml If true, a DataObject is only @@ -701,7 +731,7 @@ public class DataObjectFactory { Logger.trace(">>> resolving uri \"" + uri + "\""); ExternalURIResolver resolver = new ExternalURIResolver(); - + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); InputStream is = context.ResolveURI(uri); String contentType = null; @@ -718,12 +748,12 @@ public class DataObjectFactory { DataObjectImpl dataObject; // read the content - if (contentType != null && contentTypeIsXml(contentType)) { + if ((contentType != null) && contentTypeIsXml(contentType)) { Document doc; if (asXml) { try { - // try parsing non-validating: this has to succeed or we + // try parsing non-validating: this has to succeed or we // bail out by throwing an exception is = resolver.resolve(uri); doc = DOMUtils.parseDocument(is, false, null, null); @@ -767,14 +797,14 @@ public class DataObjectFactory { Logger.trace(">>> read stream for \"" + uri + "\""); } } - } - - else if (asXml) + } + + else if (asXml) { // if we need XML data, we're in the wrong place here closeInputStream(is); throw new MOAApplicationException("2211", new Object[] { uri }); - } + } else { // content is binary: make it available as a binary input stream @@ -805,20 +835,22 @@ public class DataObjectFactory { dataObject.setURI(uri); Logger.trace("<<< resolved uri \"" + uri + "\""); - + return dataObject; } /** * Savely closes the specified input stream. - * + * * @param is The input stream to be closed. */ private static void closeInputStream(InputStream is) { try { - if (is != null) is.close(); + if (is != null) { + is.close(); + } } catch (Throwable t) { @@ -828,10 +860,10 @@ public class DataObjectFactory { /** * Determine whether the content type is XML. - * + * * Content types recognized as XML start with text/xml and * application/xml. - * + * * @param contentType The content MIME type. * @return boolean If true, the content type is XML, otherwise * not. @@ -842,8 +874,8 @@ public class DataObjectFactory { } /** - * Create a DataObject from a ContentXML object. - * + * Create a DataObject from a ContentXML object. + * * @param xmlContent The ContentXML object from * which the DataObject is to be built. * @param xmlAsNodeList If true, the children of @@ -879,7 +911,7 @@ public class DataObjectFactory { /** * Check, that the given NodeList contains a single DOM element * node and return it, otherwise throw an exception. - * + * * @param nodes The NodeList to check for a single element. * @return The single element contained in nodes. * @throws MOAApplicationException Thrown, if nodes does not @@ -912,11 +944,11 @@ public class DataObjectFactory { /** * Create a DataObject from a ContentBinary object. - * + * * @param binaryContent The ContentBinary object containing the * data. * @param asXml If true, binaryContent must - * contain XML data. Otherwise, a BinaryDataObject will be + * contain XML data. Otherwise, a BinaryDataObject will be * returned containing a byte stream to the decoded Base64 data. * @param repeatable If multiple calls to getInputStream() must * repeatedly return the content of the data object. -- cgit v1.2.3