From 84293bd12f63b59852026cab02035fc9ebee626a Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Mon, 14 Mar 2016 16:29:03 +0100 Subject: A lot of moa sig stuff --- moaSig/build.gradle | 15 +- moaSig/common/build.gradle | 2 +- .../java/at/gv/egovernment/moa/logging/LogMsg.java | 67 -- .../java/at/gv/egovernment/moa/logging/Logger.java | 230 ---- .../gv/egovernment/moa/logging/LoggingContext.java | 70 -- .../moa/logging/LoggingContextManager.java | 80 -- .../at/gv/egovernment/moa/util/Base64Utils.java | 153 --- .../java/at/gv/egovernment/moa/util/BoolUtils.java | 48 - .../gv/egovernment/moa/util/CollectionUtils.java | 60 - .../java/at/gv/egovernment/moa/util/Constants.java | 504 --------- .../java/at/gv/egovernment/moa/util/DOMUtils.java | 1168 ------------------- .../at/gv/egovernment/moa/util/DateTimeUtils.java | 515 --------- .../java/at/gv/egovernment/moa/util/Empty.java | 31 - .../egovernment/moa/util/EntityResolverChain.java | 76 -- .../java/at/gv/egovernment/moa/util/FileUtils.java | 179 --- .../at/gv/egovernment/moa/util/KeyStoreUtils.java | 223 ---- .../gv/egovernment/moa/util/MOADefaultHandler.java | 106 -- .../gv/egovernment/moa/util/MOAEntityResolver.java | 129 --- .../gv/egovernment/moa/util/MOAErrorHandler.java | 115 -- .../java/at/gv/egovernment/moa/util/MOATimer.java | 134 --- .../gv/egovernment/moa/util/MessageProvider.java | 87 -- .../java/at/gv/egovernment/moa/util/Messages.java | 141 --- .../java/at/gv/egovernment/moa/util/MiscUtil.java | 303 ----- .../egovernment/moa/util/NodeIteratorAdapter.java | 111 -- .../gv/egovernment/moa/util/NodeListAdapter.java | 68 -- .../at/gv/egovernment/moa/util/OutputXML2File.java | 102 -- .../egovernment/moa/util/ResourceBundleChain.java | 90 -- .../java/at/gv/egovernment/moa/util/SSLUtils.java | 244 ---- .../egovernment/moa/util/StreamEntityResolver.java | 88 -- .../at/gv/egovernment/moa/util/StreamUtils.java | 197 ---- .../at/gv/egovernment/moa/util/StringUtils.java | 178 --- .../at/gv/egovernment/moa/util/URLDecoder.java | 84 -- .../at/gv/egovernment/moa/util/URLEncoder.java | 89 -- .../at/gv/egovernment/moa/util/XPathException.java | 87 -- .../at/gv/egovernment/moa/util/XPathUtils.java | 557 ---------- .../egovernment/moa/util/ex/EgovUtilException.java | 41 - .../at/gv/egovernment/moaspss/logging/LogMsg.java | 67 ++ .../at/gv/egovernment/moaspss/logging/Logger.java | 230 ++++ .../moaspss/logging/LoggingContext.java | 70 ++ .../moaspss/logging/LoggingContextManager.java | 80 ++ .../gv/egovernment/moaspss/util/Base64Utils.java | 153 +++ .../at/gv/egovernment/moaspss/util/BoolUtils.java | 48 + .../egovernment/moaspss/util/CollectionUtils.java | 60 + .../at/gv/egovernment/moaspss/util/Constants.java | 515 +++++++++ .../at/gv/egovernment/moaspss/util/DOMUtils.java | 1171 ++++++++++++++++++++ .../gv/egovernment/moaspss/util/DateTimeUtils.java | 515 +++++++++ .../java/at/gv/egovernment/moaspss/util/Empty.java | 31 + .../moaspss/util/EntityResolverChain.java | 76 ++ .../at/gv/egovernment/moaspss/util/FileUtils.java | 179 +++ .../gv/egovernment/moaspss/util/KeyStoreUtils.java | 223 ++++ .../moaspss/util/MOADefaultHandler.java | 106 ++ .../moaspss/util/MOAEntityResolver.java | 129 +++ .../egovernment/moaspss/util/MOAErrorHandler.java | 115 ++ .../at/gv/egovernment/moaspss/util/MOATimer.java | 134 +++ .../egovernment/moaspss/util/MessageProvider.java | 87 ++ .../at/gv/egovernment/moaspss/util/Messages.java | 141 +++ .../at/gv/egovernment/moaspss/util/MiscUtil.java | 303 +++++ .../moaspss/util/NodeIteratorAdapter.java | 111 ++ .../egovernment/moaspss/util/NodeListAdapter.java | 68 ++ .../egovernment/moaspss/util/OutputXML2File.java | 102 ++ .../moaspss/util/ResourceBundleChain.java | 90 ++ .../at/gv/egovernment/moaspss/util/SSLUtils.java | 244 ++++ .../moaspss/util/StreamEntityResolver.java | 88 ++ .../gv/egovernment/moaspss/util/StreamUtils.java | 197 ++++ .../gv/egovernment/moaspss/util/StringUtils.java | 178 +++ .../at/gv/egovernment/moaspss/util/URLDecoder.java | 84 ++ .../at/gv/egovernment/moaspss/util/URLEncoder.java | 89 ++ .../egovernment/moaspss/util/XPathException.java | 87 ++ .../at/gv/egovernment/moaspss/util/XPathUtils.java | 557 ++++++++++ .../moaspss/util/ex/EgovUtilException.java | 41 + .../test/at/gv/egovernment/moa/MOATestCase.java | 5 +- .../at/gv/egovernment/moa/util/DOMUtilsTest.java | 5 +- .../gv/egovernment/moa/util/DateTimeUtilsTest.java | 3 +- .../gv/egovernment/moa/util/KeyStoreUtilsTest.java | 3 +- .../at/gv/egovernment/moa/util/SSLUtilsTest.java | 5 +- .../at/gv/egovernment/moa/util/URLDecoderTest.java | 5 +- .../at/gv/egovernment/moa/util/URLEncoderTest.java | 6 +- .../moa/util/XMLGrammarBuilderTest.java | 3 +- .../at/gv/egovernment/moa/util/XPathUtilsTest.java | 3 +- moaSig/libs/iaik_cpades.jar | Bin 98302 -> 112366 bytes moaSig/libs/iaik_moa.jar | Bin 481982 -> 521087 bytes moaSig/libs/iaik_pki.jar | Bin 790585 -> 0 bytes moaSig/libs/iaik_pki_module.jar | Bin 789343 -> 795075 bytes moaSig/libs/iaik_sigval.jar | Bin 44407 -> 75880 bytes moaSig/libs/iaik_sigvallib.jar | Bin 118996 -> 123663 bytes moaSig/libs/iaik_tsl-1.1.jar | Bin 605175 -> 558558 bytes moaSig/libs/iaik_xades.jar | Bin 414748 -> 432176 bytes moaSig/libs/iaik_xsect.jar | Bin 602942 -> 603047 bytes moaSig/moa-sig-lib/build.gradle | 8 + .../at/gv/egovernment/moa/spss/MOAException.java | 4 +- .../egovernment/moa/spss/MOARuntimeException.java | 2 +- .../gv/egovernment/moa/spss/api/Configurator.java | 2 +- .../gv/egovernment/moa/spss/api/SPSSFactory.java | 68 +- .../moa/spss/api/SignatureCreationService.java | 2 +- .../moa/spss/api/SignatureVerificationService.java | 2 +- .../api/cmsverify/VerifyCMSSignatureRequest.java | 1 + .../spss/api/common/CanonicalizationTransform.java | 2 +- .../common/ExclusiveCanonicalizationTransform.java | 2 +- .../moa/spss/api/impl/SPSSFactoryImpl.java | 1041 ++++++++--------- .../api/impl/VerifyCMSSignatureRequestImpl.java | 9 + .../api/impl/VerifyXMLSignatureRequestImpl.java | 204 ++-- .../xmlbind/CreateCMSSignatureRequestParser.java | 10 +- .../xmlbind/CreateCMSSignatureResponseBuilder.java | 4 +- .../xmlbind/CreateXMLSignatureRequestParser.java | 9 +- .../xmlbind/CreateXMLSignatureResponseBuilder.java | 3 +- .../moa/spss/api/xmlbind/ProfileParser.java | 9 +- .../moa/spss/api/xmlbind/RequestParserUtils.java | 299 ++--- .../moa/spss/api/xmlbind/ResponseBuilderUtils.java | 6 +- .../moa/spss/api/xmlbind/TransformParser.java | 7 +- .../xmlbind/VerifyCMSSignatureRequestParser.java | 56 +- .../xmlbind/VerifyCMSSignatureResponseBuilder.java | 18 +- .../xmlbind/VerifyPDFSignatureResponseBuilder.java | 145 +++ .../xmlbind/VerifyXMLSignatureRequestParser.java | 415 ++++--- .../xmlbind/VerifyXMLSignatureResponseBuilder.java | 25 +- .../api/xmlverify/VerifyXMLSignatureRequest.java | 8 + .../spss/server/config/CRLDistributionPoint.java | 5 +- .../server/config/ConfigurationPartsBuilder.java | 70 +- .../spss/server/config/ConfigurationProvider.java | 23 +- .../cmssign/CMSSignatureCreationProfileImpl.java | 2 +- .../PDFSignatureVerificationProfileImpl.java | 2 +- .../moa/spss/server/iaik/config/CRLRetriever.java | 18 +- .../spss/server/iaik/config/IaikConfigurator.java | 4 +- .../spss/server/iaik/config/LoggerConfigImpl.java | 3 +- .../server/iaik/config/PKIConfigurationImpl.java | 10 +- .../iaik/config/RevocationConfigurationImpl.java | 3 +- .../config/SoftwareKeyModuleConfigurationImpl.java | 6 +- .../server/iaik/xml/XSLTTransformationImpl.java | 26 +- .../xmlsign/XMLSignatureCreationProfileImpl.java | 2 +- .../moa/spss/server/init/SystemInitializer.java | 28 +- .../server/invoke/CMSSignatureCreationInvoker.java | 6 +- .../invoke/CMSSignatureVerificationInvoker.java | 755 +++++++------ .../CMSSignatureVerificationProfileFactory.java | 3 +- .../moa/spss/server/invoke/DataObjectFactory.java | 18 +- .../moa/spss/server/invoke/InvokerUtils.java | 5 +- .../spss/server/invoke/ServiceContextUtils.java | 5 +- .../invoke/VerifyCMSSignatureResponseBuilder.java | 60 +- .../invoke/VerifyXMLSignatureResponseBuilder.java | 6 +- .../server/invoke/XMLSignatureCreationInvoker.java | 10 +- .../invoke/XMLSignatureCreationProfileFactory.java | 6 +- .../invoke/XMLSignatureVerificationInvoker.java | 48 +- .../moa/spss/server/logging/IaikLogFactory.java | 3 +- .../server/service/RevocationArchiveCleaner.java | 4 +- .../server/transaction/TransactionContext.java | 2 +- .../moa/spss/tsl/config/Configurator.java | 4 +- .../moa/spss/tsl/connector/MOATSLVerifier.java | 265 +++++ .../moa/spss/tsl/connector/MOATslKeySelector.java | 123 ++ .../moa/spss/tsl/connector/TSLConnector.java | 12 +- .../moa/spss/tsl/timer/TSLUpdaterTimerTask.java | 6 +- .../spss/tsl/utils/TSLEUImportFromFileContext.java | 12 +- .../moa/spss/tsl/utils/TSLEvaluationContext.java | 4 +- .../spss/tsl/utils/TSLImportFromFileContext.java | 27 +- .../moa/spss/util/CertificateUtils.java | 4 +- .../moa/spss/util/ExternalURIVerifier.java | 4 +- .../moa/spss/util/MOASPSSEntityResolver.java | 6 +- .../egovernment/moa/spss/util/MessageProvider.java | 2 +- .../moa/spss/util/ResetableInputStreamWrapper.java | 59 + .../test/at/gv/egovernment/moa/spss/AllTests.java | 6 +- .../at/gv/egovernment/moa/spss/SPSSTestCase.java | 10 +- .../VerifyCMSSignatureRequestParserTest.java | 3 +- .../VerifyXMLSignatureRequestParserTest.java | 4 +- .../server/config/ConfigurationProviderTest1.java | 2 +- .../server/config/ConfigurationProviderTest2.java | 2 +- .../server/config/ConfigurationProviderTest3.java | 2 +- .../iaik/config/ConfigurationDataImplTest.java | 8 +- .../CMSSignatureVerificationInvokerTest.java | 4 +- .../spss/server/invoke/DataObjectFactoryTest.java | 4 +- .../server/invoke/TransformationFactoryTest.java | 2 +- .../invoke/XMLSignatureCreationInvokerTest.java | 4 +- .../XMLSignatureVerificationInvokerTest.java | 4 +- .../moa/spss/server/tools/CertToolTest.java | 8 +- moaSig/moa-sig/build.gradle | 40 +- .../java/at/gv/egiz/moasig/AllSignatoriesType.java | 2 +- .../java/at/gv/egiz/moasig/AnyChildrenType.java | 8 +- .../java/at/gv/egiz/moasig/CMSContentBaseType.java | 2 +- .../at/gv/egiz/moasig/CMSDataObjectInfoType.java | 2 +- .../egiz/moasig/CMSDataObjectOptionalMetaType.java | 2 +- .../egiz/moasig/CMSDataObjectRequiredMetaType.java | 2 +- .../gv/egiz/moasig/CanonicalizationMethodType.java | 4 +- .../java/at/gv/egiz/moasig/CheckResultType.java | 6 +- .../java/at/gv/egiz/moasig/ContentBaseType.java | 2 +- .../at/gv/egiz/moasig/ContentExLocRefBaseType.java | 2 +- .../at/gv/egiz/moasig/ContentOptionalRefType.java | 6 +- .../at/gv/egiz/moasig/ContentRequiredRefType.java | 2 +- .../gv/egiz/moasig/CreateCMSSignatureRequest.java | 2 +- .../egiz/moasig/CreateCMSSignatureRequestType.java | 2 +- .../moasig/CreateCMSSignatureResponseType.java | 2 +- .../gv/egiz/moasig/CreatePDFSignatureRequest.java | 2 +- .../egiz/moasig/CreatePDFSignatureRequestType.java | 2 +- .../moasig/CreatePDFSignatureResponseType.java | 2 +- .../moasig/CreateSignatureEnvironmentProfile.java | 2 +- .../egiz/moasig/CreateSignatureLocationType.java | 2 +- .../egiz/moasig/CreateTransformsInfoProfile.java | 2 +- .../gv/egiz/moasig/CreateXMLSignatureRequest.java | 2 +- .../egiz/moasig/CreateXMLSignatureRequestType.java | 2 +- .../moasig/CreateXMLSignatureResponseType.java | 2 +- .../java/at/gv/egiz/moasig/DSAKeyValueType.java | 2 +- .../java/at/gv/egiz/moasig/DataObjectInfoType.java | 2 +- .../java/at/gv/egiz/moasig/DigestMethodType.java | 4 +- .../java/at/gv/egiz/moasig/ErrorResponseType.java | 2 +- .../at/gv/egiz/moasig/FinalDataMetaInfoType.java | 2 +- .../java/at/gv/egiz/moasig/FormResultType.java | 2 +- .../java/at/gv/egiz/moasig/InputDataType.java | 2 +- .../java/at/gv/egiz/moasig/KeyInfoType.java | 24 +- .../java/at/gv/egiz/moasig/KeyStorageType.java | 2 +- .../java/at/gv/egiz/moasig/KeyValueType.java | 6 +- .../moasig/ManifestRefsCheckResultInfoType.java | 2 +- .../egiz/moasig/ManifestRefsCheckResultType.java | 2 +- .../java/at/gv/egiz/moasig/ManifestType.java | 2 +- .../java/at/gv/egiz/moasig/MetaInfoType.java | 2 +- .../java/at/gv/egiz/moasig/MoaTransformType.java | 8 +- .../java/at/gv/egiz/moasig/MoaTransformsType.java | 2 +- .../gv/egiz/moasig/NamespaceDeclarationType.java | 99 ++ .../java/at/gv/egiz/moasig/ObjectFactory.java | 892 ++++++++------- .../java/at/gv/egiz/moasig/ObjectType.java | 4 +- .../at/gv/egiz/moasig/PDFSignatureResultType.java | 2 +- .../java/at/gv/egiz/moasig/PDFSignedRepsonse.java | 2 +- .../java/at/gv/egiz/moasig/PGPDataType.java | 6 +- .../at/gv/egiz/moasig/PublicAuthorityType.java | 2 +- .../at/gv/egiz/moasig/QualifiedCertificate.java | 2 +- .../java/at/gv/egiz/moasig/RSAKeyValueType.java | 2 +- .../java/at/gv/egiz/moasig/ReferenceType.java | 2 +- .../egiz/moasig/ReferencesCheckResultInfoType.java | 2 +- .../gv/egiz/moasig/ReferencesCheckResultType.java | 2 +- .../at/gv/egiz/moasig/RetrievalMethodType.java | 2 +- .../java/at/gv/egiz/moasig/SPKIDataType.java | 4 +- .../egiz/moasig/SecureSignatureCreationDevice.java | 2 +- .../at/gv/egiz/moasig/SignatureMethodType.java | 4 +- .../at/gv/egiz/moasig/SignaturePropertiesType.java | 2 +- .../at/gv/egiz/moasig/SignaturePropertyType.java | 4 +- .../java/at/gv/egiz/moasig/SignatureType.java | 2 +- .../java/at/gv/egiz/moasig/SignatureValueType.java | 2 +- .../java/at/gv/egiz/moasig/SignedInfoType.java | 2 +- .../at/gv/egiz/moasig/TransformParameterType.java | 2 +- .../java/at/gv/egiz/moasig/TransformType.java | 4 +- .../java/at/gv/egiz/moasig/TransformsInfoType.java | 2 +- .../java/at/gv/egiz/moasig/TransformsType.java | 2 +- .../gv/egiz/moasig/VerifyCMSSignatureRequest.java | 2 +- .../egiz/moasig/VerifyCMSSignatureRequestType.java | 30 +- .../moasig/VerifyCMSSignatureResponseType.java | 8 +- .../gv/egiz/moasig/VerifyPDFSignatureRequest.java | 2 +- .../egiz/moasig/VerifyPDFSignatureRequestType.java | 30 +- .../moasig/VerifyPDFSignatureResponseType.java | 2 +- .../gv/egiz/moasig/VerifyTransformsDataType.java | 2 +- .../egiz/moasig/VerifyTransformsInfoProfile.java | 2 +- .../gv/egiz/moasig/VerifyXMLSignatureRequest.java | 2 +- .../egiz/moasig/VerifyXMLSignatureRequestType.java | 46 +- .../moasig/VerifyXMLSignatureResponseType.java | 2 +- .../java/at/gv/egiz/moasig/X509DataType.java | 10 +- .../at/gv/egiz/moasig/X509IssuerSerialType.java | 2 +- .../egiz/moasig/XMLDataObjectAssociationType.java | 2 +- .../at/gv/egiz/moasig/XMLSignatureLocation.java | 102 ++ .../gv/egiz/moasig/XMLSignatureLocationType.java | 109 ++ .../java/at/gv/egiz/moasig/package-info.java | 2 +- .../spss/server/initializer/PDFASInitializer.java | 6 +- .../moa/spss/server/invoke/PDFASInvoker.java | 16 +- .../spss/server/pdfas/ExtendedVerifyResult.java | 8 +- .../spss/server/pdfas/InternalMoaConnector.java | 14 +- .../moa/spss/server/pdfas/InternalMoaVerifier.java | 7 +- .../moa/spss/server/service/AxisHandler.java | 16 +- .../server/service/CertificateProviderServlet.java | 2 +- .../spss/server/service/ConfigurationServlet.java | 9 +- .../moa/spss/server/service/ServiceUtils.java | 6 +- .../server/service/SignatureCreationService.java | 10 +- .../service/SignatureVerificationService.java | 33 +- .../webservice/PDFVerifySignatureBinding.java | 15 - .../webservice/SignatureCreationService.java | 4 +- .../server/webservice/binding/CMSParserUtils.java | 2 +- .../binding/CMSVerifySignatureBindingImpl.java | 4 +- .../binding/PDFCreateSignatureBindingImpl.java | 1 - .../binding/PDFVerifySignatureBindingImpl.java | 25 - .../server/webservice/binding/TransformParser.java | 6 +- .../binding/XMLCreateSignatureBindingImpl.java | 2 +- .../binding/XMLVerifySignatureBindingImpl.java | 29 +- .../server/webservice/impl/ContextSetupAspect.java | 104 -- .../impl/SignatureCreationServiceImpl.java | 190 ---- .../impl/SignatureVerificationServiceImpl.java | 215 ---- .../webservice/impl/SimpleCXFNonSpringServlet.java | 28 - .../xmlbind/CreatePDFSignatureRequestParser.java | 8 +- .../xmlbind/CreatePDFSignatureResponseBuilder.java | 4 +- .../server/xmlbind/VerifyPDFRequestParser.java | 8 +- .../moa/spss/server/xmlbind/VerifyPDFResponse.java | 6 +- .../server/xmlbind/VerifyPDFResponseBuilder.java | 8 +- moaSig/moa-sig/src/main/resources/log4j.properties | 38 + .../resources/resources/schemas/MOA-SIG-3.0.0.xsd | 26 +- .../resources/schemas/MOA-SPSS-2.0.0.wsdl | 16 +- .../resources/resources/schemas/MOA-SPSS-2.0.0.xsd | 5 + moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml | 20 +- .../src/main/webapp/schemas/MOA-SPSS-2.0.0.xsd | 12 + 288 files changed, 10073 insertions(+), 9270 deletions(-) delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/Constants.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/Empty.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/Messages.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/MiscUtil.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java delete mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moa/util/ex/EgovUtilException.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LogMsg.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/Logger.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContext.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContextManager.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Base64Utils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/BoolUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/CollectionUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DOMUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DateTimeUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Empty.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/EntityResolverChain.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/FileUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/KeyStoreUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOADefaultHandler.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOATimer.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MessageProvider.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Messages.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MiscUtil.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeIteratorAdapter.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeListAdapter.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/OutputXML2File.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ResourceBundleChain.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/SSLUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamEntityResolver.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StringUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLDecoder.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLEncoder.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathException.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathUtils.java create mode 100644 moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ex/EgovUtilException.java delete mode 100644 moaSig/libs/iaik_pki.jar create mode 100644 moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java create mode 100644 moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/MOATSLVerifier.java create mode 100644 moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/MOATslKeySelector.java create mode 100644 moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ResetableInputStreamWrapper.java create mode 100644 moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/NamespaceDeclarationType.java create mode 100644 moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLSignatureLocation.java create mode 100644 moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLSignatureLocationType.java delete mode 100644 moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/PDFVerifySignatureBinding.java delete mode 100644 moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/PDFVerifySignatureBindingImpl.java delete mode 100644 moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/ContextSetupAspect.java delete mode 100644 moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SignatureCreationServiceImpl.java delete mode 100644 moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SignatureVerificationServiceImpl.java delete mode 100644 moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SimpleCXFNonSpringServlet.java create mode 100644 moaSig/moa-sig/src/main/resources/log4j.properties diff --git a/moaSig/build.gradle b/moaSig/build.gradle index 951632c..b7ed724 100644 --- a/moaSig/build.gradle +++ b/moaSig/build.gradle @@ -1,3 +1,14 @@ +buildscript { + repositories { + maven { + url "https://plugins.gradle.org/m2/" + } + } + dependencies { + classpath "com.bmuschko:gradle-tomcat-plugin:2.2.4" + } +} + subprojects { apply plugin: 'java' apply plugin: 'eclipse' @@ -10,10 +21,10 @@ subprojects { testCompile 'junit:junit:4.8.2' } - version = '1.0' + version = '3.0.0-RC1' jar { - manifest.attributes provider: 'my cool company' + manifest.attributes provider: 'EGIZ' } } diff --git a/moaSig/common/build.gradle b/moaSig/common/build.gradle index 998ccbe..9b88188 100644 --- a/moaSig/common/build.gradle +++ b/moaSig/common/build.gradle @@ -3,7 +3,7 @@ dependencies { compile 'org.slf4j:slf4j-api:1.7.12' compile 'xerces:xercesImpl:2.11.0' - compile 'xalan:xalan:2.7.2' + compile 'xalan:xalan:2.7.1' compile 'joda-time:joda-time:2.8.2' compile 'jaxen:jaxen:1.1.6' } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java deleted file mode 100644 index 51667f0..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.logging; - -/** - * A unified message type to log messages from inside the MOA subsystem. - * - * @author Patrick Peck - * @version $Id$ - */ -public class LogMsg { - /** The message to log. */ - private Object message; - - /** - * Create a LogMsg object. - * - * @param message The actual message to log. May be null. - */ - public LogMsg(Object message) { - 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(); - LoggingContext ctx = - LoggingContextManager.getInstance().getLoggingContext(); - String tid = ctx != null ? ctx.getTransactionID() : null; - String nodeId = ctx != null ? ctx.getNodeID() : null; - - msg.append("TID="); - msg.append(tid != null ? tid : ""); - msg.append(" NID="); - msg.append(nodeId != null ? nodeId : ""); - msg.append(" MSG="); - msg.append(message != null ? message.toString() : ""); - - return msg.toString(); - } -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java deleted file mode 100644 index 7cb2e7d..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.logging; - -import java.util.HashMap; -import java.util.Map; - -/** - * A utility class acting as a facade to the logging subsystem. - * - * Configure the logging defaultHierarchy that the Logger uses by - * calling setHierarchy once before calling any of the logging - * output functions. - * - * @author Patrick Peck - * @version $Id$ - */ -public class Logger { - - /** - * Set the default hierarchy to which the Logger should send its - * logging output. - * @param hierarchy The logging defaultHierarchy. - */ - public static void setHierarchy(String hierarchy) { - // there is no need for that anymore - } - - - /** The Constant instances. */ - private static final Map instances = new HashMap(); - - /** - * Gets the logger. - * - * @return the logger - */ - private static synchronized org.slf4j.Logger getLogger() { - StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace(); - - int i; - for(i = 2; i < stacktrace.length; i++) - if(!stacktrace[i].getClassName().equals(Logger.class.getName())) - break; - - String className = stacktrace[i].getClassName(); - - org.slf4j.Logger logger = instances.get(className); - if (logger != null) { - return logger; - } - - logger = org.slf4j.LoggerFactory.getLogger(className); - instances.put(className, logger); - - return logger; - } - - /** - * Prepare the message for printing it as string. - *

Mainly introduce because the message might be null. - * - * @param message the message - * @return the string - */ - private static String prepareMessage(Object message) { - if(null == message) - return "no message given"; - return message.toString(); - } - - /** - * Test, if the trace log level is enabled. - * - * @return boolean true, if tracing output is enabled - * false otherwise. - */ - public static boolean isTraceEnabled() { - org.slf4j.Logger logger = getLogger(); - return logger.isTraceEnabled(); - } - - /** - * Test, if the trace log level is enabled for a given hierarchy. - * - * @param hierarchy requested log hierarchy - * @return boolean true, if tracing output is enabled - * false otherwise. - */ - public static boolean isTraceEnabled(String hierarchy) { - org.slf4j.Logger logger = getLogger(); - return logger.isTraceEnabled(); - } - - /** - * Trace a message. - * - * @param message The message to trace. - */ - public static void trace(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.trace(prepareMessage(message)); - } - - /** - * Test, if the debug log level is enabled. - * - * @return boolean true, if debug output is enabled - * false otherwise. - */ - public static boolean isDebugEnabled() { - org.slf4j.Logger logger = getLogger(); - return logger.isDebugEnabled(); - } - - /** - * Test, if the debug log level is enabled for a given hierarchy. - * - * @param hierarchy requested log hierarchy - * @return boolean true, if debug output is enabled - * false otherwise. - */ - public static boolean isDebugEnabled(String hierarchy) { - org.slf4j.Logger logger = getLogger(); - return logger.isDebugEnabled(); - } - - /** - * Log a debug message. - * - * @param message The message to log. - */ - public static void debug(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.debug(prepareMessage(message)); - } - -/** - * Log an info message. - * - * @param message The message to log. - */ - public static void info(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.info(prepareMessage(message)); - } - - /** - * Log a warning message. - * - * @param message The message to log. - */ - public static void warn(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.warn(prepareMessage(message)); - } - - /** - * Log a warning message. - * - * @param message The message to log. - * @param t An exception that may be the cause of the warning. - */ - public static void warn(Object message, Throwable t) { - org.slf4j.Logger logger = getLogger(); - logger.warn(prepareMessage(message), t); - } - - /** - * Log an error message. - * - * @param message The message to log. - */ - public static void error(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.error(prepareMessage(message)); - } - - /** - * Log an error message. - * - * @param message The message to log. - * @param t An exception that may be the cause of the error. - */ - public static void error(Object message, Throwable t) { - org.slf4j.Logger logger = getLogger(); - logger.error(prepareMessage(message), t); - } - - /** - * Log a fatal error message. - * - * @param message The message to log. - */ - public static void fatal(Object message) { - error(message); - } - - /** - * Log a fatal error message. - * - * @param message The message to log. - * @param t An exception that may be the cause of the error. - */ - public static void fatal(Object message, Throwable t) { - error(message, t); - } -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java deleted file mode 100644 index db4b93a..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.logging; - -/** - * Encapsulates contextual information (i.e. per request information) for - * logging purposes. - * - * @author Patrick Peck - * @version $Id$ - */ -public class LoggingContext { - /** The name of the node ID system property. */ - public static final String NODE_ID_PROPERTY = "moa.node-id"; - - /** The current transaction ID. */ - private String transactionID; - /** The node ID. */ - private String nodeID; - - /** - * Create a new LoggingContext. - * - * @param transactionID The transaction ID. May be null. - */ - public LoggingContext(String transactionID) { - this.transactionID = transactionID; - this.nodeID = System.getProperty(NODE_ID_PROPERTY); - } - - /** - * Return the transaction ID. - * - * @return The transaction ID. - */ - public String getTransactionID() { - return transactionID; - } - - /** - * Return the node ID. - * - * @return The node ID. - */ - public String getNodeID() { - return nodeID; - } -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java deleted file mode 100644 index f0d7b4c..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.logging; - -/** - * Provides each thread with a single instance of LoggingContext. - * - * @author Patrick Peck - * @version $Id$ - */ -public class LoggingContextManager { - /** The single instance of this class. */ - private static LoggingContextManager instance = null; - - /** The LoggingContext for each thread. */ - private ThreadLocal context; - - /** - * Get the single instance of the LoggingContextManager class. - * - * @return LoggingContextManager The single instance. - */ - public static synchronized LoggingContextManager getInstance() { - if (instance == null) { - instance = new LoggingContextManager(); - } - return instance; - } - - /** - * Creates a new LoggingContextManager. - * - * Protected to disallow direct instantiation. - */ - protected LoggingContextManager() { - context = new ThreadLocal(); - } - - /** - * Set the LoggingContext context for the current thread. - * - * @param ctx The LoggingContext for the current thread. - */ - public void setLoggingContext(LoggingContext ctx) { - context.set(ctx); - } - - /** - * Return the LoggingContext for the current thread. - * - * @return LoggingContext The LoggingContext for the current - * thread, or null if none has been set. - */ - public LoggingContext getLoggingContext() { - return (LoggingContext) context.get(); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java deleted file mode 100644 index 66bf503..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; - -import iaik.utils.Base64InputStream; -import iaik.utils.Base64OutputStream; - -/** - * Utitility functions for encoding/decoding Base64 strings. - * - * @author Patrick Peck - * @version $Id$ - */ -public class Base64Utils { - - /** - * Read the bytes encoded in a Base64 encoded String. - * - * @param base64String The String containing the Base64 encoded - * bytes. - * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. - * @return byte[] The raw bytes contained in the base64String. - * @throws IOException Failed to read the Base64 data. - */ - public static byte[] decode(String base64String, boolean ignoreInvalidChars, String encoding) - throws IOException { - - Base64InputStream in = - new Base64InputStream( - new ByteArrayInputStream(base64String.getBytes(encoding)), - ignoreInvalidChars); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - byte[] bytes = new byte[256]; - int bytesRead; - - while ((bytesRead = in.read(bytes)) > 0) { - out.write(bytes, 0, bytesRead); - } - in.close(); - - return out.toByteArray(); - } - - public static byte[] decode(String base64String, boolean ignoreInvalidChars) throws IOException { - return decode(base64String, ignoreInvalidChars, "UTF-8"); - } - - /** - * Read the bytes encoded in a Base64 encoded String and provide - * them via an InputStream. - * - * @param base64String The String containing the Base64 encoded - * bytes. - * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. - * @return The InputStream from which the binary content of the - * base64String can be read. - */ - public static InputStream decodeToStream( - String base64String, - boolean ignoreInvalidChars, - String encoding) { - - try { - ByteArrayInputStream bin = - new ByteArrayInputStream(base64String.getBytes(encoding)); - Base64InputStream in = new Base64InputStream(bin, ignoreInvalidChars); - - return in; - } catch (UnsupportedEncodingException e) { - // cannot occur, since UTF-8 is required to be supported by every JRE - return null; - } - } - - public static InputStream decodeToStream( - String base64String, - boolean ignoreInvalidChars) { - return decodeToStream(base64String, ignoreInvalidChars, "UTF-8"); - - } - - /** - * Convert a byte array to a Base64 encoded String. - * - * @param bytes The bytes to encode. - * @return String The Base64 encoded representation of the bytes. - * @throws IOException Failed to write the bytes as Base64 data. - */ - public static String encode(byte[] bytes) throws IOException { - return encode(new ByteArrayInputStream(bytes), "UTF-8"); - } - - public static String encode(byte[] bytes, String encoding) throws IOException { - return encode(new ByteArrayInputStream(bytes), encoding); - } - - public static String encode(InputStream inputStream) throws IOException { - return encode(inputStream, "UTF-8"); - } - /** - * Convert the data contained in the given stream to a Base64 encoded - * String. - * - * @param inputStream The stream containing the data to encode. - * @return The Base64 encoded data of inputStream, as a - * String. - * @throws IOException Failed to convert the data in the stream. - */ - public static String encode(InputStream inputStream, String encoding) throws IOException { - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - Base64OutputStream base64Stream = new Base64OutputStream(byteStream, "\n".getBytes()); - byte[] bytes = new byte[256]; - int bytesRead; - - while ((bytesRead = inputStream.read(bytes)) > 0) { - base64Stream.write(bytes, 0, bytesRead); - } - base64Stream.flush(); - base64Stream.close(); - inputStream.close(); - - return byteStream.toString(encoding); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java deleted file mode 100644 index 492aca9..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -/** - * Utility class for parsing XML schema boolean values. - * - * @author Patrick Peck - * @version $Id$ - */ -public class BoolUtils { - - /** - * Return the boolean value of an xsd:boolean type of DOM - * element/attribute. - * - * @param boolStr The value of the xsd:boolean element/attribute. - * @return true, if boolStr equals - * "true" or "1;". Otherwise, - * false is returned. - */ - public static boolean valueOf(String boolStr) { - return "true".equals(boolStr) || "1".equals(boolStr); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java deleted file mode 100644 index 8597e1e..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.util.Iterator; -import java.util.List; - -/** - * Various utility methods for dealing with java.util.Collection - * classes. - * - * @author Patrick Peck - * @version $Id$ - */ -public class CollectionUtils { - - /** - * Convert a List of Number objects to an - * int array. - * - * @param nums The List containing the numbers whose integer - * value to put into the result. - * @return The int values of the Numbers contained - * in nums. - */ - public static int[] toIntArray(List nums) { - int[] result = new int[nums.size()]; - Iterator iter; - int i; - - for (i = 0, iter = nums.iterator(); iter.hasNext(); i++) { - Number num = (Number) iter.next(); - result[i] = num.intValue(); - } - - return result; - } -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Constants.java deleted file mode 100644 index 5fc0d4d..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ /dev/null @@ -1,504 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.util.HashMap; - -/** - * Contains various constants used throughout the system. - * - * @author Patrick Peck - * @version $Id$ - */ -public interface Constants { - /** Root location of the schema files. */ - public static final String SCHEMA_ROOT = "/resources/schemas/"; - - /** URI of the Widerrufregister XML namespace. */ - public static final String WRR_NS_URI = - "http://reference.e-government.gv.at/namespace/moavv/20041223"; - - /** Prefix used for the Widerrufregister XML namespace */ - public static final String WRR_PREFIX = "wrr"; - - /** URI of the StandardTextBlock XML namespace. */ - public static final String STB_NS_URI = - "http://reference.e-government.gv.at/namespace/standardtextblock/20041105#"; - - /** Prefix used for the standard text block XML namespace */ - public static final String STB_PREFIX = "stb"; - - /** URI of the MOA XML namespace. */ - public static final String MOA_NS_URI = - "http://reference.e-government.gv.at/namespace/moa/20020822#"; - - /** Name of the mandates infobox */ - public static final String INFOBOXIDENTIFIER_MANDATES = "Mandates"; - - /** Prefix used for the Mandate XML namespace */ - public static final String MD_PREFIX = "md"; - - /** URI of the Mandate XML namespace. */ - public static final String MD_NS_URI = - "http://reference.e-government.gv.at/namespace/mandates/20040701#"; - - /** Prefix used for the Mandate XML namespace */ - public static final String MVV_PREFIX = "mvv"; - - /** URI of the Mandate XML namespace. */ - public static final String MVV_NS_URI = - "http://reference.e-government.gv.at/namespace/moavv/app2mvv/20041125"; - - /** Prefix used for the MandateCheckProfile XML namespace */ - public static final String MDP_PREFIX = "mdp"; - - /** URI of the Mandate XML namespace. */ - public static final String MDP_NS_URI = - "http://reference.e-government.gv.at/namespace/mandateprofile/20041105#"; - - /** Prefix used for the MOA XML namespace */ - public static final String MOA_PREFIX = "moa"; - - /** Local location of the MOA XML schema definition. */ - public static final String MOA_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-2.0.0.xsd"; - - /** URI of the MOA configuration XML namespace. */ - public static final String MOA_CONFIG_NS_URI = - "http://reference.e-government.gv.at/namespace/moaconfig/20021122#"; - - /** URI of the MOA ID configuration XML namespace. */ - public static final String MOA_ID_CONFIG_NS_URI = - "http://www.buergerkarte.at/namespaces/moaconfig#"; - - /** Prefix used for the MOA configuration XML namespace */ - public static final String MOA_CONFIG_PREFIX = "conf"; - - /** Prefix used for the MOA configuration XML namespace */ - public static final String MOA_ID_CONFIG_PREFIX = "confID"; - - /** Local location of the MOA configuration XML schema definition. */ - public static final String MOA_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-config-2.0.1.xsd"; - - /** Local location of the MOA ID configuration XML schema definition. */ - public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.5.2.xsd"; - - /** URI of the Security Layer 1.0 namespace. */ - public static final String SL10_NS_URI = - "http://www.buergerkarte.at/namespaces/securitylayer/20020225#"; - - /** Prefix used for the Security Layer 1.0 XML namespace */ - public static final String SL10_PREFIX = "sl10"; - - /** Local location of the Security Layer 1.0 XML schema definition */ - public static final String SL10_SCHEMA_LOCATION = - SCHEMA_ROOT + "Core.20020225.xsd"; - - /** URI of the Security Layer 1.1 XML namespace */ - public static final String SL11_NS_URI = - "http://www.buergerkarte.at/namespaces/securitylayer/20020831#"; - - /** Prefix used for the Security Layer 1.1 XML namespace */ - public static final String SL11_PREFIX = "sl11"; - - /** Local location of the Security Layer 1.1 XML schema definition */ - public static final String SL11_SCHEMA_LOCATION = - SCHEMA_ROOT + "Core.20020831.xsd"; - - /** URI of the Security Layer 1.2 XML namespace */ - public static final String SL12_NS_URI = - "http://www.buergerkarte.at/namespaces/securitylayer/1.2#"; - - /** Prefix used for the Security Layer 1.2 XML namespace */ - public static final String SL12_PREFIX = "sl"; - - /** Local location of the Security Layer 1.2 XML schema definition */ - public static final String SL12_SCHEMA_LOCATION = - SCHEMA_ROOT + "Core-1.2.xsd"; - - /** URI of the ECDSA XML namespace */ - public static final String ECDSA_NS_URI = - "http://www.w3.org/2001/04/xmldsig-more#"; - - /** Prefix used for ECDSA namespace */ - public static final String ECDSA_PREFIX = "ecdsa"; - - /** Local location of ECDSA XML schema definition */ - public static final String ECDSA_SCHEMA_LOCATION = - SCHEMA_ROOT + "ECDSAKeyValue.xsd"; - - /** URI of the PersonData XML namespace. */ - public static final String PD_NS_URI = - "http://reference.e-government.gv.at/namespace/persondata/20020228#"; - - /** Prefix used for the PersonData XML namespace */ - public static final String PD_PREFIX = "pr"; - -// /** Local location of the PersonData XML schema definition */ -// public static final String PD_SCHEMA_LOCATION = -// SCHEMA_ROOT + "PersonData.xsd"; - - /** Local location of the PersonData XML schema definition */ - public static final String PD_SCHEMA_LOCATION = - SCHEMA_ROOT + "PersonData_20_en_moaWID.xsd"; - - /** URI of the SAML namespace. */ - public static final String SAML_NS_URI = - "urn:oasis:names:tc:SAML:1.0:assertion"; - - /** Prefix used for the SAML XML namespace */ - public static final String SAML_PREFIX = "saml"; - - /** Local location of the SAML XML schema definition. */ - public static final String SAML_SCHEMA_LOCATION = - SCHEMA_ROOT + "cs-sstc-schema-assertion-01.xsd"; - - /** URI of the SAML request-response protocol namespace. */ - public static final String SAMLP_NS_URI = - "urn:oasis:names:tc:SAML:1.0:protocol"; - - /** Prefix used for the SAML request-response protocol namespace */ - public static final String SAMLP_PREFIX = "samlp"; - - /** Local location of the SAML request-response protocol schema definition. */ - public static final String SAMLP_SCHEMA_LOCATION = - SCHEMA_ROOT + "cs-sstc-schema-protocol-01.xsd"; - - /** URI of the XML namespace. */ - public static final String XML_NS_URI = - "http://www.w3.org/XML/1998/namespace"; - - /** Prefix used for the XML namespace */ - public static final String XML_PREFIX = "xml"; - - /** Local location of the XML schema definition. */ - public static final String XML_SCHEMA_LOCATION = SCHEMA_ROOT + "xml.xsd"; - - /** URI of the XMLNS namespace */ - public static final String XMLNS_NS_URI = "http://www.w3.org/2000/xmlns/"; - - /** Prefix used for the XSI namespace */ - public static final String XSI_PREFIX = "xsi"; - - /** Local location of the XSI schema definition. */ - public static final String XSI_SCHEMA_LOCATION = - SCHEMA_ROOT + "XMLSchema-instance.xsd"; - - /** URI of the XSI XMLNS namespace */ - public static final String XSI_NS_URI = - "http://www.w3.org/2001/XMLSchema-instance"; - - /** URI of the XSLT XML namespace */ - public static final String XSLT_NS_URI = - "http://www.w3.org/1999/XSL/Transform"; - - /** Prefix used for the XSLT XML namespace */ - public static final String XSLT_PREFIX = "xsl"; - - /** URI of the XMLDSig XML namespace. */ - public static final String DSIG_NS_URI = "http://www.w3.org/2000/09/xmldsig#"; - - /** Prefix used for the XMLDSig XML namespace */ - public static final String DSIG_PREFIX = "dsig"; - - /** Local location of the XMLDSig XML schema. */ - public static final String DSIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "xmldsig-core-schema.xsd"; - - /** URI of the XMLDSig XPath Filter XML namespace. */ - public static final String DSIG_FILTER2_NS_URI = - "http://www.w3.org/2002/06/xmldsig-filter2"; - - /** Prefix used for the XMLDSig XPath Filter XML namespace */ - public static final String DSIG_FILTER2_PREFIX = "dsig-filter2"; - - /** Local location of the XMLDSig XPath Filter XML schema definition. */ - public static final String DSIG_FILTER2_SCHEMA_LOCATION = - SCHEMA_ROOT + "xmldsig-filter2.xsd"; - - /** URI of the Exclusive Canonicalization XML namespace */ - public static final String DSIG_EC_NS_URI = - "http://www.w3.org/2001/10/xml-exc-c14n#"; - - /** Prefix used for the Exclusive Canonicalization XML namespace */ - public static final String DSIG_EC_PREFIX = "ec"; - - /** Local location of the Exclusive Canonicalizaion XML schema definition */ - public static final String DSIG_EC_SCHEMA_LOCATION = - SCHEMA_ROOT + "exclusive-canonicalization.xsd"; - - /** URI of the XMLLoginParameterResolver Configuration XML namespace */ - public static final String XMLLPR_NS_URI="http://reference.e-government.gv.at/namespace/moa/20020822#/xmllpr20030814"; - - /** Local location of the XMLLoginParameterResolver Configuration XML schema definition */ - public static final String XMLLPR_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOAIdentities.xsd"; - - /** Local location of the XAdES v1.1.1 schema definition */ - public static final String XADES_1_1_1_SCHEMA_LOCATION = - SCHEMA_ROOT + "XAdES-1.1.1.xsd"; - - /** URI of the XAdES v1.1.1 namespace */ - public static final String XADES_1_1_1_NS_URI = "http://uri.etsi.org/01903/v1.1.1#"; - - public static final String XADES_1_1_1_NS_PREFIX = "xades111"; - - /** Local location of the XAdES v1.2.2 schema definition */ - public static final String XADES_1_2_2_SCHEMA_LOCATION = - SCHEMA_ROOT + "XAdES-1.2.2.xsd"; - - /** URI of the XAdES v1.2.2 namespace */ - public static final String XADES_1_2_2_NS_URI = "http://uri.etsi.org/01903/v1.2.2#"; - - public static final String XADES_1_2_2_NS_PREFIX = "xades122"; - - /** Local location of the XAdES v1.1.1 schema definition */ - public static final String XADES_1_3_2_SCHEMA_LOCATION = - SCHEMA_ROOT + "XAdES-1.3.2.xsd"; - - /** URI of the XAdES v1.3.2 namespace */ - public static final String XADES_1_3_2_NS_URI = "http://uri.etsi.org/01903/v1.3.2#"; - - public static final String XADES_1_3_2_NS_PREFIX = "xades132"; - - /** Local location of the XAdES v1.4.1 schema definition */ - public static final String XADES_1_4_1_SCHEMA_LOCATION = - SCHEMA_ROOT + "XAdES-1.4.1.xsd"; - - /** URI of the XAdES v1.4.1 namespace */ - public static final String XADES_1_4_1_NS_URI = "http://uri.etsi.org/01903/v1.4.1#"; - - public static final String XADES_1_4_1_NS_PREFIX = "xades141"; - /** URI of the SAML 2.0 namespace. */ - public static final String SAML2_NS_URI = - "urn:oasis:names:tc:SAML:2.0:assertion"; - - /** Prefix used for the SAML 2.0 XML namespace */ - public static final String SAML2_PREFIX = "saml2"; - - /** Local location of the SAML 2.0 XML schema definition. */ - public static final String SAML2_SCHEMA_LOCATION = - SCHEMA_ROOT + "saml-schema-assertion-2.0.xsd"; - - /** URI of the SAML 2.0 protocol namespace. */ - public static final String SAML2P_NS_URI = - "urn:oasis:names:tc:SAML:2.0:protocol"; - - /** Prefix used for the SAML 2.0 protocol XML namespace */ - public static final String SAML2P_PREFIX = "saml2p"; - - /** Local location of the SAML 2.0 protocol XML schema definition. */ - public static final String SAML2P_SCHEMA_LOCATION = - SCHEMA_ROOT + "saml-schema-protocol-2.0.xsd"; - - /** URI of the STORK namespace. */ - public static final String STORK_NS_URI = - "urn:eu:stork:names:tc:STORK:1.0:assertion"; - - /** Prefix used for the STORK XML namespace */ - public static final String STORK_PREFIX = "stork"; - - /** Local location of the STORK XML schema definition. */ - public static final String STORK_SCHEMA_LOCATION = - SCHEMA_ROOT + "stork-schema-assertion-1.0.xsd"; - - /** URI of the STORK protocol namespace. */ - public static final String STORKP_NS_URI = - "urn:eu:stork:names:tc:STORK:1.0:protocol"; - - /** Prefix used for the STORK protocol XML namespace */ - public static final String STORKP_PREFIX = "storkp"; - - /** Local location of the STORK protocol XML schema definition. */ - public static final String STORKP_SCHEMA_LOCATION = - SCHEMA_ROOT + "stork-schema-protocol-1.0.xsd"; - - /** URI of the TSL namespace. */ - public static final String TSL_NS_URI = - "http://uri.etsi.org/02231/v2#"; - - /** Prefix used for the TSL namespace */ - public static final String TSL_PREFIX = "tsl1"; - - /** Local location of the TSL schema definition. */ - public static final String TSL_SCHEMA_LOCATION = - SCHEMA_ROOT + "ts_119612v010201_xsd.xsd"; - - /** URI of the TSL SIE namespace. */ - public static final String TSL_SIE_NS_URI = - "http://uri.etsi.org/TrstSvc/SvcInfoExt/eSigDir-1999-93-EC-TrustedList/#"; - - /** Prefix used for the TSL SIE namespace */ - public static final String TSL_SIE_PREFIX = "tslsie"; - - /** Local location of the TSL SIE schema definition. */ - public static final String TSL_SIE_SCHEMA_LOCATION = - SCHEMA_ROOT + "ts_119612v010201_sie_xsd.xsd"; - - /** URI of the TSL additional types namespace. */ - public static final String TSL_ADDTYPES_NS_URI = - "http://uri.etsi.org/02231/v2/additionaltypes#"; - - /** Prefix used for the TSL additional types namespace */ - public static final String TSL_ADDTYPES_PREFIX = "tsltype"; - - /** Local location of the TSL additional types schema definition. */ - public static final String TSL_ADDTYPES_SCHEMA_LOCATION = - SCHEMA_ROOT + "ts_ts_119612v010201_additionaltypes_xsd.xsd"; - - /** URI of the XML Encryption namespace. */ - public static final String XENC_NS_URI = - "http://www.w3.org/2001/04/xmlenc#"; - - /** Prefix used for the XML Encryption XML namespace */ - public static final String XENC_PREFIX = "xenc"; - - /** Local location of the XML Encryption XML schema definition. */ - public static final String XENC_SCHEMA_LOCATION = - SCHEMA_ROOT + "xenc-schema.xsd"; - - /** - * Contains all namespaces and local schema locations for XML schema - * definitions relevant for MOA. For use in validating XML parsers. - */ - public static final String ALL_SCHEMA_LOCATIONS = - (MOA_NS_URI + " " + MOA_SCHEMA_LOCATION + " ") - + (MOA_CONFIG_NS_URI + " " + MOA_CONFIG_SCHEMA_LOCATION + " ") - + (MOA_ID_CONFIG_NS_URI + " " + MOA_ID_CONFIG_SCHEMA_LOCATION + " ") - + (SL10_NS_URI + " " + SL10_SCHEMA_LOCATION + " ") - + (SL11_NS_URI + " " + SL11_SCHEMA_LOCATION + " ") - + (SL12_NS_URI + " " + SL12_SCHEMA_LOCATION + " ") - + (ECDSA_NS_URI + " " + ECDSA_SCHEMA_LOCATION + " ") - + (PD_NS_URI + " " + PD_SCHEMA_LOCATION + " ") - + (SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " ") - + (SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " ") - + (XML_NS_URI + " " + XML_SCHEMA_LOCATION + " ") - + (XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " ") - + (DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " ") - + (DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " ") - + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " ") - + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION + " ") - + (XADES_1_1_1_NS_URI + " " + XADES_1_1_1_SCHEMA_LOCATION + " ") - + (XADES_1_2_2_NS_URI + " " + XADES_1_2_2_SCHEMA_LOCATION + " ") - + (XADES_1_3_2_NS_URI + " " + XADES_1_3_2_SCHEMA_LOCATION + " ") - + (XADES_1_4_1_NS_URI + " " + XADES_1_4_1_SCHEMA_LOCATION + " ") - + (TSL_NS_URI + " " + TSL_SCHEMA_LOCATION + " ") - + (TSL_SIE_NS_URI + " " + TSL_SIE_SCHEMA_LOCATION + " ") - + (TSL_ADDTYPES_NS_URI + " " + TSL_ADDTYPES_SCHEMA_LOCATION + " ") - + (SAML2_NS_URI + " " + SAML2_SCHEMA_LOCATION + " ") - + (SAML2P_NS_URI + " " + SAML2P_SCHEMA_LOCATION + " ") - + (STORK_NS_URI + " " + STORK_SCHEMA_LOCATION + " ") - + (STORKP_NS_URI + " " + STORKP_SCHEMA_LOCATION + " ") - + (XENC_NS_URI + " " + XENC_SCHEMA_LOCATION); - - /** URN prefix for bPK and wbPK. */ - public static final String URN_PREFIX = "urn:publicid:gv.at"; - - /** URN prefix for context dependent id. */ - public static final String URN_PREFIX_CDID = URN_PREFIX + ":cdid"; - - /** URN prefix for context dependent id (bPK). */ - public static final String URN_PREFIX_BPK = URN_PREFIX_CDID + "+bpk"; - - /** URN prefix for context dependent id (HPI). */ - public static final String URN_PREFIX_HPI = URN_PREFIX_CDID + "+EHSP"; - - /** URN prefix for context dependent id (wbPK). */ - public static final String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; - - /** URN prefix for context dependent id (stork). */ - public static final String URN_PREFIX_STORK = URN_PREFIX + ":storkid"; - - /** URN prefix for context dependent id. */ - public static final String URN_PREFIX_BASEID = URN_PREFIX + ":baseid"; - - /** Security Layer manifest type URI. */ - public static final String SL_MANIFEST_TYPE_URI = - "http://www.buergerkarte.at/specifications/Security-Layer/20020225#SignatureManifest"; - - /** URI of the SHA1 digest algorithm */ - public static final String SHA1_URI = - "http://www.w3.org/2000/09/xmldsig#sha1"; - - /** URI of the SHA1 digest algorithm */ - public static final String SHA256_URI = - "http://www.w3.org/2000/09/xmldsig#sha256"; - - /** URI of the SHA1 digest algorithm */ - public static final String SHA384_URI = - "http://www.w3.org/2000/09/xmldsig#sha384"; - - /** URI of the SHA1 digest algorithm */ - public static final String SHA512_URI = - "http://www.w3.org/2000/09/xmldsig#sha512"; - - /** URI of the Canonical XML algorithm */ - public static final String C14N_URI = - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; - - /** URI of the Canoncial XML with comments algorithm */ - public static final String C14N_WITH_COMMENTS_URI = - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; - - /** URI of the Exclusive Canonical XML algorithm */ - public static final String EXC_C14N_URI = - "http://www.w3.org/2001/10/xml-exc-c14n#"; - - /** URI of the Exclusive Canonical XML with commments algorithm */ - public static final String EXC_C14N_WITH_COMMENTS_URI = - "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; - - // - // Local names for elements of the MOA SPSS schema - // - - /** - * Local name of request for creating an XML signature. - */ - public static final String MOA_SPSS_CREATE_XML_REQUEST = "CreateXMLSignatureRequest"; - - /** - * Local name of request for creating a CMS signature. - */ - public static final String MOA_SPSS_CREATE_CMS_REQUEST = "CreateCMSSignatureRequest"; - - /** - * Local name of request for creating a CMS signature. - */ - public static final String MOA_SPSS_CREATE_PDF_REQUEST = "CreatePDFSignatureRequest"; - - /** - * Local name of request for verifying an XML signature. - */ - public static final String MOA_SPSS_VERIFY_XML_REQUEST = "VerifiyXMLSignatureRequest"; - - /** - * A map used to map namespace prefixes to namespace URIs - */ - public static HashMap nSMap = new HashMap(5); - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java deleted file mode 100644 index 2b816ed..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ /dev/null @@ -1,1168 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -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 java.util.Vector; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.apache.xerces.parsers.DOMParser; -import org.apache.xerces.parsers.SAXParser; -import org.apache.xerces.parsers.XMLGrammarPreparser; -import org.apache.xerces.util.SymbolTable; -import org.apache.xerces.util.XMLGrammarPoolImpl; -import org.apache.xerces.xni.grammars.XMLGrammarDescription; -import org.apache.xerces.xni.grammars.XMLGrammarPool; -import org.apache.xerces.xni.parser.XMLInputSource; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import at.gv.egovernment.moa.logging.Logger; - -/** - * Various utility functions for handling XML DOM trees. - * - * The parsing methods in this class make use of some features internal to the - * Xerces DOM parser, mainly for performance reasons. As soon as JAXP - * (currently at version 1.2) is better at schema handling, it should be used as - * the parser interface. - * - * @author Patrick Peck - * @version $Id$ - */ -public class DOMUtils { - - /** Feature URI for namespace aware parsing. */ - private static final String NAMESPACES_FEATURE = - "http://xml.org/sax/features/namespaces"; - /** Feature URI for validating parsing. */ - private static final String VALIDATION_FEATURE = - "http://xml.org/sax/features/validation"; - /** Feature URI for schema validating parsing. */ - private static final String SCHEMA_VALIDATION_FEATURE = - "http://apache.org/xml/features/validation/schema"; - /** Feature URI for normalization of element/attribute values. */ - private static final String NORMALIZED_VALUE_FEATURE = - "http://apache.org/xml/features/validation/schema/normalized-value"; - /** Feature URI for parsing ignorable whitespace. */ - private static final String INCLUDE_IGNORABLE_WHITESPACE_FEATURE = - "http://apache.org/xml/features/dom/include-ignorable-whitespace"; - /** Feature URI for creating EntityReference nodes in the DOM tree. */ - private static final String CREATE_ENTITY_REF_NODES_FEATURE = - "http://apache.org/xml/features/dom/create-entity-ref-nodes"; - /** Property URI for providing external schema locations. */ - private static final String EXTERNAL_SCHEMA_LOCATION_PROPERTY = - "http://apache.org/xml/properties/schema/external-schemaLocation"; - /** Property URI for providing the external schema location for elements - * without a namespace. */ - private static final String EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY = - "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"; - - private static final String EXTERNAL_GENERAL_ENTITIES_FEATURE = - "http://xml.org/sax/features/external-general-entities"; - - private static final String EXTERNAL_PARAMETER_ENTITIES_FEATURE = - "http://xml.org/sax/features/external-parameter-entities"; - - private static final String DISALLOW_DOCTYPE_FEATURE = - "http://apache.org/xml/features/disallow-doctype-decl"; - - - - /** Property URI for the Xerces grammar pool. */ - private static final String GRAMMAR_POOL = - org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX - + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; - /** A prime number for initializing the symbol table. */ - private static final int BIG_PRIME = 2039; - /** Symbol table for the grammar pool. */ - private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME); - /** Xerces schema grammar pool. */ - private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); - /** Set holding the NamespaceURIs of the grammarPool, to prevent multiple - * entries of same grammars to the pool */ - private static Set grammarNamespaces; - - static { - grammarPool.lockPool(); - grammarNamespaces = new HashSet(); - } - - /** - * Preparse a schema and add it to the schema pool. - * The method only adds the schema to the pool if a schema having the same - * systemId (namespace URI) is not already present in the pool. - * - * @param inputStream An InputStream providing the contents of - * the schema. - * @param systemId The systemId (namespace URI) to use for the schema. - * @throws IOException An error occurred reading the schema. - */ - public static void addSchemaToPool(InputStream inputStream, String systemId) - throws IOException { - XMLGrammarPreparser preparser; - - if (!grammarNamespaces.contains(systemId)) { - - grammarNamespaces.add(systemId); - - // unlock the pool so that we can add another grammar - grammarPool.unlockPool(); - - // prepare the preparser - preparser = new XMLGrammarPreparser(symbolTable); - preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); - preparser.setProperty(GRAMMAR_POOL, grammarPool); - preparser.setFeature(NAMESPACES_FEATURE, true); - preparser.setFeature(VALIDATION_FEATURE, true); - - // add the grammar to the pool - preparser.preparseGrammar( - XMLGrammarDescription.XML_SCHEMA, - new XMLInputSource(null, systemId, null, inputStream, null)); - - // lock the pool again so that schemas are not added automatically - grammarPool.lockPool(); - } - } - - /** - * Parse an XML document from an InputStream. - * - * @param inputStream The InputStream containing the XML - * document. - * @param validating If true, parse validating. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @param entityResolver An EntityResolver to resolve external - * entities (schemas and DTDs). If null, it will not be set. - * @param errorHandler An ErrorHandler to decide what to do - * with parsing errors. If null, it will not be set. - * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Document parseDocument( - InputStream inputStream, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation, - EntityResolver entityResolver, - ErrorHandler errorHandler) - throws SAXException, IOException, ParserConfigurationException { - - DOMParser parser; - -// class MyEntityResolver implements EntityResolver { -// -// public InputSource resolveEntity(String publicId, String systemId) -// throws SAXException, IOException { -// return new InputSource(new ByteArrayInputStream(new byte[0])); -// } -// } - - - //if Debug is enabled make a copy of inputStream to enable debug output in case of SAXException - byte buffer [] = null; - ByteArrayInputStream baStream = null; - if(true == Logger.isDebugEnabled()) { - int len = inputStream.available(); - buffer = new byte[len]; - inputStream.read(buffer); - baStream = new ByteArrayInputStream(buffer); - } - - // create the DOM parser - if (symbolTable != null) { - parser = new DOMParser(symbolTable, grammarPool); - } else { - parser = new DOMParser(); - } - - // set parser features and properties - try { - parser.setFeature(NAMESPACES_FEATURE, true); - parser.setFeature(VALIDATION_FEATURE, validating); - parser.setFeature(SCHEMA_VALIDATION_FEATURE, validating); - parser.setFeature(NORMALIZED_VALUE_FEATURE, false); - parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); - parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); - parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false); - parser.setFeature(EXTERNAL_PARAMETER_ENTITIES_FEATURE, false); - - if (validating) { - if (externalSchemaLocations != null) { - parser.setProperty( - EXTERNAL_SCHEMA_LOCATION_PROPERTY, - externalSchemaLocations); - } - if (externalNoNamespaceSchemaLocation != null) { - parser.setProperty( - EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, - externalNoNamespaceSchemaLocation); - } - } - - // set entity resolver and error handler - if (entityResolver != null) { - parser.setEntityResolver(entityResolver); - } - if (errorHandler != null) { - parser.setErrorHandler(errorHandler); - } - - // parse the document and return it - // if debug is enabled: use copy of strem (baStream) else use orig stream - if(null != baStream) - parser.parse(new InputSource(baStream)); - else - parser.parse(new InputSource(inputStream)); - } catch(SAXException e) { - if(true == Logger.isDebugEnabled() && null != buffer) { - String xmlContent = new String(buffer); - Logger.debug("SAXException in:\n" + xmlContent); - } - throw(e); - } - - return parser.getDocument(); - } - - /** - * Parse an XML document from an InputStream. - * - * @param inputStream The InputStream containing the XML - * document. - * @param validating If true, parse validating. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @param entityResolver An EntityResolver to resolve external - * entities (schemas and DTDs). If null, it will not be set. - * @param errorHandler An ErrorHandler to decide what to do - * with parsing errors. If null, it will not be set. - * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Document parseDocumentSimple(InputStream inputStream) - throws SAXException, IOException, ParserConfigurationException { - - DOMParser parser; - - parser = new DOMParser(); - // set parser features and properties - parser.setFeature(NAMESPACES_FEATURE, true); - parser.setFeature(VALIDATION_FEATURE, false); - parser.setFeature(SCHEMA_VALIDATION_FEATURE, false); - parser.setFeature(NORMALIZED_VALUE_FEATURE, false); - parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); - parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); - - parser.parse(new InputSource(inputStream)); - - return parser.getDocument(); - } - - - /** - * Parse an XML document from an InputStream. - * - * It uses a MOAEntityResolver as the EntityResolver - * and a MOAErrorHandler as the ErrorHandler. - * - * @param inputStream The InputStream containing the XML - * document. - * @param validating If true, parse validating. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Document parseDocument( - InputStream inputStream, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws SAXException, IOException, ParserConfigurationException { - - - - return parseDocument( - inputStream, - validating, - externalSchemaLocations, - externalNoNamespaceSchemaLocation, - new MOAEntityResolver(), - new MOAErrorHandler()); - } - - /** - * Parse an XML document from a String. - * - * It uses a MOAEntityResolver as the EntityResolver - * and a MOAErrorHandler as the ErrorHandler. - * - * @param xmlString The String containing the XML document. - * @param encoding The encoding of the XML document. - * @param validating If true, parse validating. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Document parseDocument( - String xmlString, - String encoding, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws SAXException, IOException, ParserConfigurationException { - - InputStream in = new ByteArrayInputStream(xmlString.getBytes(encoding)); - return parseDocument( - in, - validating, - externalSchemaLocations, - externalNoNamespaceSchemaLocation); - } - - /** - * Parse an UTF-8 encoded XML document from a String. - * - * @param xmlString The String containing the XML document. - * @param validating If true, parse validating. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Document parseDocument( - String xmlString, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws SAXException, IOException, ParserConfigurationException { - - return parseDocument( - xmlString, - "UTF-8", - validating, - externalSchemaLocations, - externalNoNamespaceSchemaLocation); - } - - /** - * A convenience method to parse an XML document validating. - * - * @param inputStream The InputStream containing the XML - * document. - * @return The root element of the parsed XML document. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Element parseXmlValidating(InputStream inputStream) - throws ParserConfigurationException, SAXException, IOException { - return DOMUtils - .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null) - .getDocumentElement(); - } - - /** - * A convenience method to parse an XML document non validating. - * - * @param inputStream The InputStream containing the XML - * document. - * @return The root element of the parsed XML document. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Element parseXmlNonValidating(InputStream inputStream) - throws ParserConfigurationException, SAXException, IOException { - return DOMUtils - .parseDocument(inputStream, false, Constants.ALL_SCHEMA_LOCATIONS, null) - .getDocumentElement(); - } - - /** - * Schema validate a given DOM element. - * - * @param element The element to validate. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @return true, if the element validates against - * the schemas declared in it. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document from its - * serialized representation. - * @throws ParserConfigurationException An error occurred configuring the XML - * @throws TransformerException An error occurred serializing the element. - */ - public static boolean validateElement( - Element element, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws - ParserConfigurationException, - IOException, - SAXException, - TransformerException { - - byte[] docBytes; - SAXParser parser; - - // create the SAX parser - if (symbolTable != null) { - parser = new SAXParser(symbolTable, grammarPool); - } else { - parser = new SAXParser(); - } - - // serialize the document - docBytes = serializeNode(element, "UTF-8"); - - // set up parser features and attributes - parser.setFeature(NAMESPACES_FEATURE, true); - parser.setFeature(VALIDATION_FEATURE, true); - parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); - parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false); - parser.setFeature(DISALLOW_DOCTYPE_FEATURE, true); - - - if (externalSchemaLocations != null) { - parser.setProperty( - EXTERNAL_SCHEMA_LOCATION_PROPERTY, - externalSchemaLocations); - } - if (externalNoNamespaceSchemaLocation != null) { - parser.setProperty( - EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, - "externalNoNamespaceSchemaLocation"); - } - - // set up entity resolver and error handler - parser.setEntityResolver(new MOAEntityResolver()); - parser.setErrorHandler(new MOAErrorHandler()); - - // parse validating - parser.parse(new InputSource(new ByteArrayInputStream(docBytes))); - return true; - } - - - /** - * Schema validate a given DOM element. - * - * @param element The element to validate. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @return true, if the element validates against - * the schemas declared in it. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document from its - * serialized representation. - * @throws ParserConfigurationException An error occurred configuring the XML - * @throws TransformerException An error occurred serializing the element. - */ - public static boolean validateElement( - Element element, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation, - EntityResolver entityResolver) - throws - ParserConfigurationException, - IOException, - SAXException, - TransformerException { - - byte[] docBytes; - SAXParser parser; - - // create the SAX parser - if (symbolTable != null) { - parser = new SAXParser(symbolTable, grammarPool); - } else { - parser = new SAXParser(); - } - - // serialize the document - docBytes = serializeNode(element, "UTF-8"); - - // set up parser features and attributes - parser.setFeature(NAMESPACES_FEATURE, true); - parser.setFeature(VALIDATION_FEATURE, true); - parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); - - if (externalSchemaLocations != null) { - parser.setProperty( - EXTERNAL_SCHEMA_LOCATION_PROPERTY, - externalSchemaLocations); - } - if (externalNoNamespaceSchemaLocation != null) { - parser.setProperty( - EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, - "externalNoNamespaceSchemaLocation"); - } - - // set up entity resolver and error handler - parser.setEntityResolver(entityResolver); - parser.setErrorHandler(new MOAErrorHandler()); - - // parse validating - parser.parse(new InputSource(new ByteArrayInputStream(docBytes))); - return true; - } - - /** - * Serialize the given DOM node. - * - * The node will be serialized using the UTF-8 encoding. - * - * @param node The node to serialize. - * @return String The String representation of the given DOM - * node. - * @throws TransformerException An error occurred transforming the - * node to a String. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static String serializeNode(Node node) - throws TransformerException, IOException { - return new String(serializeNode(node, "UTF-8", false), "UTF-8"); - } - - - /** - * Serialize the given DOM node. - * - * The node will be serialized using the UTF-8 encoding. - * - * @param node The node to serialize. - * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. - * @return String The String representation of the given DOM - * node. - * @throws TransformerException An error occurred transforming the - * node to a String. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static String serializeNode(Node node, boolean omitXmlDeclaration) - throws TransformerException, IOException { - return new String(serializeNode(node, "UTF-8", omitXmlDeclaration), "UTF-8"); - } - - /** - * Serialize the given DOM node. - * - * The node will be serialized using the UTF-8 encoding. - * - * @param node The node to serialize. - * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. - * @param lineSeperator Sets the line seperator String of the parser - * @return String The String representation of the given DOM - * node. - * @throws TransformerException An error occurred transforming the - * node to a String. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static String serializeNode(Node node, boolean omitXmlDeclaration, String lineSeperator) - throws TransformerException, IOException { - return new String(serializeNode(node, "UTF-8", omitXmlDeclaration, lineSeperator), "UTF-8"); - } - - /** - * Serialize the given DOM node to a byte array. - * - * @param node The node to serialize. - * @param xmlEncoding The XML encoding to use. - * @return The serialized node, as a byte array. Using a compatible encoding - * this can easily be converted into a String. - * @throws TransformerException An error occurred transforming the node to a - * byte array. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static byte[] serializeNode(Node node, String xmlEncoding) - throws TransformerException, IOException { - return serializeNode(node, xmlEncoding, false); - } - - /** - * Serialize the given DOM node to a byte array. - * - * @param node The node to serialize. - * @param xmlEncoding The XML encoding to use. - * @param omitDeclaration The boolean value for omitting the XML Declaration. - * @return The serialized node, as a byte array. Using a compatible encoding - * this can easily be converted into a String. - * @throws TransformerException An error occurred transforming the node to a - * byte array. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration) - throws TransformerException, IOException { - return serializeNode(node, xmlEncoding, omitDeclaration, null); - } - - - /** - * Serialize the given DOM node to a byte array. - * - * @param node The node to serialize. - * @param xmlEncoding The XML encoding to use. - * @param omitDeclaration The boolean value for omitting the XML Declaration. - * @param lineSeperator Sets the line seperator String of the parser - * @return The serialized node, as a byte array. Using a compatible encoding - * this can easily be converted into a String. - * @throws TransformerException An error occurred transforming the node to a - * byte array. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration, String lineSeperator) - throws TransformerException, IOException { - - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - ByteArrayOutputStream bos = new ByteArrayOutputStream(16384); - - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.ENCODING, xmlEncoding); - String omit = omitDeclaration ? "yes" : "no"; - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omit); - if (null!=lineSeperator) { - transformer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", lineSeperator);//does not work for xalan <= 2.5.1 - } - transformer.transform(new DOMSource(node), new StreamResult(bos)); - - bos.flush(); - bos.close(); - - return bos.toByteArray(); - } - - /** - * Return the text that a node contains. - * - * This routine: - *

    - *
  • Ignores comments and processing instructions.
  • - *
  • Concatenates TEXT nodes, CDATA nodes, and the results recursively - * processing EntityRef nodes.
  • - *
  • Ignores any element nodes in the sublist. (Other possible options are - * to recurse into element sublists or throw an exception.)
  • - *
- * - * @param node A DOM node from which to extract text. - * @return A String representing its contents. - */ - public static String getText(Node node) { - if (!node.hasChildNodes()) { - return ""; - } - - StringBuffer result = new StringBuffer(); - NodeList list = node.getChildNodes(); - - for (int i = 0; i < list.getLength(); i++) { - Node subnode = list.item(i); - if (subnode.getNodeType() == Node.TEXT_NODE) { - result.append(subnode.getNodeValue()); - } else if (subnode.getNodeType() == Node.CDATA_SECTION_NODE) { - result.append(subnode.getNodeValue()); - } else if (subnode.getNodeType() == Node.ENTITY_REFERENCE_NODE) { - // Recurse into the subtree for text - // (and ignore comments) - result.append(getText(subnode)); - } - } - return result.toString(); - } - - /** - * Build the namespace prefix to namespace URL mapping in effect for a given - * node. - * - * @param node The context node for which build the map. - * @return The namespace prefix to namespace URL mapping ( - * a String value to String value mapping). - */ - public static Map getNamespaceDeclarations(Node node) { - Map nsDecls = new HashMap(); - int i; - - do { - if (node.hasAttributes()) { - NamedNodeMap attrs = node.getAttributes(); - - for (i = 0; i < attrs.getLength(); i++) { - Attr attr = (Attr) attrs.item(i); - - // add prefix mapping if none exists - if ("xmlns".equals(attr.getPrefix()) - || "xmlns".equals(attr.getName())) { - - String nsPrefix = - attr.getPrefix() != null ? attr.getLocalName() : ""; - - if (nsDecls.get(nsPrefix) == null) { - nsDecls.put(nsPrefix, attr.getValue()); - } - } - } - } - } while ((node = node.getParentNode()) != null); - - return nsDecls; - } - - /** - * Add all namespace declarations declared in the parent(s) of a given - * element and used in the subtree of the given element to the given element. - * - * @param context The element to which to add the namespaces. - */ - public static void localizeNamespaceDeclarations(Element context) { - Node parent = context.getParentNode(); - - if (parent != null) { - Map namespaces = getNamespaceDeclarations(context.getParentNode()); - Set nsUris = collectNamespaceURIs(context); - Iterator iter; - - for (iter = namespaces.entrySet().iterator(); iter.hasNext();) { - Map.Entry e = (Map.Entry) iter.next(); - - if (nsUris.contains(e.getValue())) { - String prefix = (String) e.getKey(); - String nsUri = (String) e.getValue(); - String nsAttrName = "".equals(prefix) ? "xmlns" : "xmlns:" + prefix; - - context.setAttributeNS(Constants.XMLNS_NS_URI, nsAttrName, nsUri); - } - } - } - } - - /** - * Collect all the namespace URIs used in the subtree of a given element. - * - * @param context The element that should be searched for namespace URIs. - * @return All namespace URIs used in the subtree of context, - * including the ones used in context itself. - */ - public static Set collectNamespaceURIs(Element context) { - Set result = new HashSet(); - - collectNamespaceURIsImpl(context, result); - return result; - } - - /** - * A recursive method to do the work of collectNamespaceURIs. - * - * @param context The context element to evaluate. - * @param result The result, passed as a parameter to avoid unnecessary - * instantiations of Set. - */ - private static void collectNamespaceURIsImpl(Element context, Set result) { - NamedNodeMap attrs = context.getAttributes(); - NodeList childNodes = context.getChildNodes(); - String nsUri; - int i; - - // add the namespace of the context element - nsUri = context.getNamespaceURI(); - if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { - result.add(nsUri); - } - - // add all namespace URIs from attributes - for (i = 0; i < attrs.getLength(); i++) { - nsUri = attrs.item(i).getNamespaceURI(); - if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { - result.add(nsUri); - } - } - - // add all namespaces from subelements - for (i = 0; i < childNodes.getLength(); i++) { - Node node = childNodes.item(i); - - if (node.getNodeType() == Node.ELEMENT_NODE) { - collectNamespaceURIsImpl((Element) node, result); - } - } - } - - /** - * Check, that each attribute node in the given NodeList has its - * parent in the NodeList as well. - * - * @param nodes The NodeList to check. - * @return true, if each attribute node in nodes - * has its parent in nodes as well. - */ - public static boolean checkAttributeParentsInNodeList(NodeList nodes) { - Set nodeSet = new HashSet(); - int i; - - // put the nodes into the nodeSet - for (i = 0; i < nodes.getLength(); i++) { - nodeSet.add(nodes.item(i)); - } - - // check that each attribute node's parent is in the node list - for (i = 0; i < nodes.getLength(); i++) { - Node n = nodes.item(i); - - if (n.getNodeType() == Node.ATTRIBUTE_NODE) { - Attr attr = (Attr) n; - Element owner = attr.getOwnerElement(); - - if (owner == null) { - if (!isNamespaceDeclaration(attr)) { - return false; - } - } - - if (!nodeSet.contains(owner) && !isNamespaceDeclaration(attr)) { - return false; - } - } - } - - return true; - } - - /** - * Convert an unstructured NodeList into a - * DocumentFragment. - * - * @param nodeList Contains the node list to be converted into a DOM - * DocumentFragment. - * @return the resulting DocumentFragment. The DocumentFragment will be - * backed by a new DOM Document, i.e. all noded of the node list will be - * cloned. - * @throws ParserConfigurationException An error occurred creating the - * DocumentFragment. - * @precondition The nodes in the node list appear in document order - * @precondition for each Attr node in the node list, the owning Element is - * in the node list as well. - * @precondition each Element or Attr node in the node list is namespace - * aware. - */ - public static DocumentFragment nodeList2DocumentFragment(NodeList nodeList) - throws ParserConfigurationException { - - DocumentBuilder builder = - DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document doc = builder.newDocument(); - DocumentFragment result = doc.createDocumentFragment(); - - if (null == nodeList || nodeList.getLength() == 0) { - return result; - } - - int currPos = 0; - currPos = - nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; - - while (currPos < nodeList.getLength()) { - currPos = - nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; - } - return result; - } - - /** - * Helper method for the nodeList2DocumentFragment. - * - * @param nodeList The NodeList to convert. - * @param currPos The current position in the nodeList. - * @param result The resulting DocumentFragment. - * @param currOrgElem The current original element. - * @param currClonedElem The current cloned element. - * @return The current position. - */ - private static int nodeList2DocumentFragment( - NodeList nodeList, - int currPos, - DocumentFragment result, - Element currOrgElem, - Element currClonedElem) { - - while (currPos < nodeList.getLength()) { - Node currentNode = nodeList.item(currPos); - switch (currentNode.getNodeType()) { - case Node.COMMENT_NODE : - case Node.PROCESSING_INSTRUCTION_NODE : - case Node.TEXT_NODE : - { - // Append current node either to resulting DocumentFragment or to - // current cloned Element - if (null == currClonedElem) { - result.appendChild( - result.getOwnerDocument().importNode(currentNode, false)); - } else { - // Stop processing if current Node is not a descendant of - // current Element - if (!isAncestor(currOrgElem, currentNode)) { - return --currPos; - } - - currClonedElem.appendChild( - result.getOwnerDocument().importNode(currentNode, false)); - } - break; - } - - case Node.ELEMENT_NODE : - { - Element nextCurrOrgElem = (Element) currentNode; - Element nextCurrClonedElem = - result.getOwnerDocument().createElementNS( - nextCurrOrgElem.getNamespaceURI(), - nextCurrOrgElem.getNodeName()); - - // Append current Node either to resulting DocumentFragment or to - // current cloned Element - if (null == currClonedElem) { - result.appendChild(nextCurrClonedElem); - currOrgElem = nextCurrOrgElem; - currClonedElem = nextCurrClonedElem; - } else { - // Stop processing if current Node is not a descendant of - // current Element - if (!isAncestor(currOrgElem, currentNode)) { - return --currPos; - } - - currClonedElem.appendChild(nextCurrClonedElem); - } - - // Process current Node (of type Element) recursively - currPos = - nodeList2DocumentFragment( - nodeList, - ++currPos, - result, - nextCurrOrgElem, - nextCurrClonedElem); - - break; - } - - case Node.ATTRIBUTE_NODE : - { - Attr currAttr = (Attr) currentNode; - - // GK 20030411: Hack to overcome problems with IAIK IXSIL - if (currAttr.getOwnerElement() == null) - break; - if (currClonedElem == null) - break; - - // currClonedElem must be the owner Element of currAttr if - // preconditions are met - currClonedElem.setAttributeNS( - currAttr.getNamespaceURI(), - currAttr.getNodeName(), - currAttr.getValue()); - break; - } - - default : - { - // All other nodes will be ignored - } - } - - currPos++; - } - - return currPos; - } - - /** - * Check, if the given attribute is a namespace declaration. - * - * @param attr The attribute to check. - * @return true, if the attribute is a namespace declaration, - * false otherwise. - */ - private static boolean isNamespaceDeclaration(Attr attr) { - return Constants.XMLNS_NS_URI.equals(attr.getNamespaceURI()); - } - - /** - * Check, if a given DOM element is an ancestor of a given node. - * - * @param candAnc The DOM element to check for being the ancestor. - * @param cand The node to check for being the child. - * @return true, if candAnc is an (indirect) - * ancestor of cand; false otherwise. - */ - public static boolean isAncestor(Element candAnc, Node cand) { - Node currPar = cand.getParentNode(); - - while (currPar != null) { - if (candAnc == currPar) - return true; - currPar = currPar.getParentNode(); - } - return false; - } - - /** - * Selects the (first) element from a node list and returns it. - * - * @param nl The NodeList to get the element from. - * @return The (first) element included in the node list or null - * if the node list is null or empty or no element is - * included in the list. - */ - public static Element getElementFromNodeList (NodeList nl) { - if ((nl == null) || (nl.getLength() == 0)) { - return null; - } - for (int i=0; idateTime, - * according to ISO 8601. - * - * @author Patrick Peck - * @version $Id$ - * @see http://www.w3.org/2001/XMLSchema-datatypes" - */ -public class DateTimeUtils { - /** Error messages. */ - private static MessageProvider msg = MessageProvider.getInstance(); - -// /** -// * Builds a dateTime value from a Calendar value. -// * @param cal the Calendar value -// * @return the dateTime value -// */ -// public static String buildDateTime(Calendar cal, boolean useUTC) { -// -// if (useUTC) -// return buildDateTimeUTC(cal); -// else { -// StringWriter out = new StringWriter(); -// out.write("" + cal.get(Calendar.YEAR)); -// out.write("-"); -// out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); -// out.write("-"); -// out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); -// out.write("T"); -// out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); -// out.write(":"); -// out.write(to2DigitString(cal.get(Calendar.MINUTE))); -// out.write(":"); -// out.write(to2DigitString(cal.get(Calendar.SECOND))); -// int tzOffsetMilliseconds = -// cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); -// if (tzOffsetMilliseconds != 0) { -// int tzOffsetMinutes = tzOffsetMilliseconds / (1000 * 60); -// int tzOffsetHours = tzOffsetMinutes / 60; -// tzOffsetMinutes -= tzOffsetHours * 60; -// if (tzOffsetMilliseconds > 0) { -// out.write("+"); -// out.write(to2DigitString(tzOffsetHours)); -// out.write(":"); -// out.write(to2DigitString(tzOffsetMinutes)); -// } else { -// out.write("-"); -// out.write(to2DigitString(-tzOffsetHours)); -// out.write(":"); -// out.write(to2DigitString(-tzOffsetMinutes)); -// } -// } -// return out.toString(); -// } -// } - - /** - * Builds a dateTime value in UTC from a Calendar value. - * @param cal the Calendar value - * @return the dateTime value - */ - public static String buildDateTimeUTC(Calendar cal) { - - SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); - f.setTimeZone(TimeZone.getTimeZone("UTC")); - - return f.format(cal.getTime()); - } - - /** - * Builds a dateTime value in UTC from a Calendar value. - * @param cal the Calendar value - * @return the dateTime value - */ - public static String buildDateTimeUTC(Date cal) { - - SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); - f.setTimeZone(TimeZone.getTimeZone("UTC")); - - return f.format(cal); - - } - - /** - * Builds a dateTime value from a Calendar value. - * @param cal the Calendar value - * @return the dateTime value - */ - public static String buildDate(Calendar cal) { - StringWriter out = new StringWriter(); - out.write("" + cal.get(Calendar.YEAR)); - out.write("-"); - out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); - out.write("-"); - out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); - return out.toString(); - } - - /** - * Builds a dateTime value from a Calendar value. - * @param cal the Calendar value - * @return the dateTime value - */ - public static String buildTime(Calendar cal) { - StringWriter out = new StringWriter(); - out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); - out.write(":"); - out.write(to2DigitString(cal.get(Calendar.MINUTE))); - out.write(":"); - out.write(to2DigitString(cal.get(Calendar.SECOND))); - - return out.toString(); - } - - /** - * Converts month, day, hour, minute, or second value - * to a 2 digit String. - * @param number the month, day, hour, minute, or second value - * @return 2 digit String - */ - private static String to2DigitString(int number) { - if (number < 10) - return "0" + number; - else - return "" + number; - } - - /** - * Parse a String containing a date and time instant, given in - * ISO 8601 format. - * - * @param dateTime The String to parse. - * @return The Date representation of the contents of - * dateTime. - * @throws ParseException Parsing the dateTime failed. - */ - public static Date parseDateTime(String dateTime) throws ParseException { - GregorianCalendar calendar; - long time; - int yearSign = 1, year, month, day; - int hour, minute, second; - double fraction = 0.0; - int tzSign = 1, tzHour = 0, tzMinute = 0; - int curPos = 0; - String fractStr; - boolean localTime = false; - char c; - - // parse year sign - ensureChars(dateTime, curPos, 1); - c = dateTime.charAt(curPos); - if (c == '+' || c == '-') { - yearSign = c == '+' ? 1 : -1; - curPos++; - } - - // parse year - year = parseInt(dateTime, curPos, 4); - curPos += 4; - - // parse '-' - ensureChar(dateTime, curPos, '-'); - curPos++; - - // parse month - month = parseInt(dateTime, curPos, 2); - ensureValue(month, 1, 12, curPos); - curPos += 2; - - // parse '-' - ensureChar(dateTime, curPos, '-'); - curPos++; - - // parse day - day = parseInt(dateTime, curPos, 2); - ensureValue(day, 1, 31, curPos); - curPos += 2; - - // parse 'T' - ensureChar(dateTime, curPos, 'T'); - curPos++; - - // parse hour - hour = parseInt(dateTime, curPos, 2); - ensureValue(hour, 0, 23, curPos); - curPos += 2; - - // parse ':' - ensureChar(dateTime, curPos, ':'); - curPos++; - - // parse minute - minute = parseInt(dateTime, curPos, 2); - ensureValue(minute, 0, 59, curPos); - curPos += 2; - - // parse ':' - ensureChar(dateTime, curPos, ':'); - curPos++; - - // parse second - second = parseInt(dateTime, curPos, 2); - ensureValue(second, 0, 59, curPos); - curPos += 2; - - // parse a fraction - if (dateTime.length() > curPos && dateTime.charAt(curPos) == '.') { - curPos++; - ensureDigits(dateTime, curPos, 1); - fractStr = "0."; - fractStr - += dateTime.substring(curPos, curPos + countDigits(dateTime, curPos)); - fraction = Double.parseDouble(fractStr); - curPos += countDigits(dateTime, curPos); - } - - // parse a time zone - if (dateTime.length() > curPos) { - c = dateTime.charAt(curPos); - if (c == 'Z') { - curPos++; - } else if (c == '+' || c == '-') { - // parse time zone sign - tzSign = c == '+' ? 1 : -1; - curPos++; - - // parse time zone hour - tzHour = parseInt(dateTime, curPos, 2); - ensureValue(tzHour, 0, 14, curPos); - curPos += 2; - - // parse ':' - ensureChar(dateTime, curPos, ':'); - curPos++; - - // parse time zone minute - tzMinute = parseInt(dateTime, curPos, 2); - ensureValue(tzMinute, 0, 59, curPos); - curPos += 2; - } - } else { - localTime = true; - } - - // if we have characters left, it's an error - if (dateTime.length() != curPos) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - - // build the Date object - year = year * yearSign; - try { - calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT")); - calendar.set(year, month - 1, day, hour, minute, second); - calendar.set(Calendar.MILLISECOND, 0); - time = calendar.getTime().getTime(); - time += (long) (fraction * 1000.0); - time -= tzSign * ((tzHour * 60) + tzMinute) * 60 * 1000; - if (localTime) { - time -= TimeZone.getDefault().getRawOffset(); - } - return new Date(time); - } catch (IllegalArgumentException e) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - - } - - /** - * Parse an integer value. - * - * @param str The String containing the digits. - * @param curPos The starting position. - * @param digits The number of digist making up the integer value. - * @return int The integer representation of the digits contained in - * str. - * @throws ParseException Parsing the integer value failed. - */ - private static int parseInt(String str, int curPos, int digits) - throws ParseException { - - ensureDigits(str, curPos, digits); - return Integer.parseInt(str.substring(curPos, curPos + digits)); - } - - /** - * Count the number of digits following curPos. - * - * @param str The String in which to count digits. - * @param curPos The starting position. - * @return int The number of digits. - */ - private static int countDigits(String str, int curPos) { - int i; - - for (i = curPos; i < str.length() && Character.isDigit(str.charAt(i)); i++); - return i - curPos; - } - - /** - * Ensure that a value falls in a given min/max range. - * - * @param value The value to check. - * @param min The minimum allowed value. - * @param max The maximum allowed value. - * @param curPos To indicate the parsing position in the - * ParseException. - * @throws ParseException Thrown, if value < min || value > - * max - */ - private static void ensureValue(int value, int min, int max, int curPos) - throws ParseException { - - if (value < min || value > max) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - } - - /** - * Ensure that the given String has a number of characters left. - * - * @param str The String to check for its length. - * @param curPos The starting position. - * @param count The minimum number of characters that str must - * contain, starting at from curPos. - * @throws ParseException Thrown, if - * curPos + count > str.length(). - */ - private static void ensureChars(String str, int curPos, int count) - throws ParseException { - if (curPos + count > str.length()) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - } - - /** - * Ensure that a given String contains a certain character at a - * certain position. - * - * @param str The String in which to look up the character. - * @param curPos The position in str that must contain the - * character. - * @param c The character value that must be contained at position - * curPos. - * @throws ParseException Thrown, if the characters do not match or - * curPos is out of range. - */ - private static void ensureChar(String str, int curPos, char c) - throws ParseException { - - ensureChars(str, curPos, 1); - if (str.charAt(curPos) != c) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - } - - /** - * Ensure that a given String contains a number of digits, - * starting at a given position. - * - * @param str The String to scan for digits. - * @param curPos The starting postion. - * @param count The number of digits that must be contained in - * str, starting at curPos. - * @throws ParseException Thrown, if str is not long enough, or - * one of the characters following curPos in str is - * not a digit. - */ - private static void ensureDigits(String str, int curPos, int count) - throws ParseException { - - ensureChars(str, curPos, count); - for (int i = curPos; i < curPos + count; i++) { - if (!Character.isDigit(str.charAt(i))) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - } - } - - /** - * Calculates the age if date of birth is given (for a calendar time stamp) - * @param dateOfBirth Date of Birth - * @param now Calendar time stamp at which the age needs to be calculated for - * @return Age of a person - */ - public static int calcAge(Calendar dateOfBirth, Calendar now) { - int age = now.get(Calendar.YEAR) - dateOfBirth.get(Calendar.YEAR); - - int nowM = now.get(Calendar.MONTH); - int dobM = dateOfBirth.get(Calendar.MONTH); - int nowDOM = now.get(Calendar.DAY_OF_MONTH); - int dobDOM = dateOfBirth.get(Calendar.DAY_OF_MONTH); - - if ((nowM < dobM) || ((nowM == dobM) && (nowDOM < dobDOM))) { - age--; - } - - if (age < 0) { - throw new IllegalArgumentException("Calculated age results in negative value."); - } - return age; - } - - /** - * Calculates the age if date of birth is given as Calendar object - * @param dateOfBirth Date of Birth as Calendar object - * @return Age of a person - */ - public static int calcAge(Calendar dateOfBirth) { - return calcAge(dateOfBirth, Calendar.getInstance()); - } - - /** - * Calculates the age if date of birth is given (for a date time stamp) - * @param dateOfBirth Date of Birth - * @param now Date time stamp at which the age needs to be calculated for - * @return Age of a person - */ - public static int calcAge(Date dateOfBirth, Date now) { - Calendar dob = Calendar.getInstance(); - dob.setTime(dateOfBirth); - Calendar nowCal = Calendar.getInstance(); - nowCal.setTime(now); - return calcAge(dob, nowCal); - } - - /** - * Calculates the age if date of birth is given as Date object - * @param dateOfBirth Date of Birth as Date object - * @return Age of a person - */ - public static int calcAge(Date dateOfBirth) { - return calcAge(dateOfBirth, new Date()); - } - - public static String formatPEPSDateToMOADate(String pepsDate) { - - if (StringUtils.isEmpty(pepsDate)) { - return null; - } - - DateTimeFormatter fmt = null; - - switch (pepsDate.length()) { - case 4: - fmt = DateTimeFormat.forPattern("yyyy"); - break; - case 6: - fmt = DateTimeFormat.forPattern("yyyyMM"); - break; - case 8: - fmt = DateTimeFormat.forPattern("yyyyMMdd"); - break; - default: - fmt = DateTimeFormat.forPattern("yyyy-MM-dd"); - break; - } - - DateTime dt = fmt.parseDateTime(pepsDate); - DateTimeFormatter fmt2 = DateTimeFormat.forPattern("yyyy-MM-dd"); - return fmt2.print(dt); - - } - - /** - * Returns a date as String using a provided format - * @param format Format the date/time should be returned - * @return Date/Time as String formatted according the provided format - */ - public static String getDateTimeWithFormat(String format) { - DateFormat dateFormat = new SimpleDateFormat(format); - Date date = new Date(); - return dateFormat.format(date); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Empty.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Empty.java deleted file mode 100644 index 533b39b..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Empty.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2011 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES 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.util; - -/** - * @author Thomas Knall - */ -public interface Empty { - - /** - * Returns {@code true} if underlying object is empty. - * - * @return {@code true} if empty, {@code false} if not empty. - */ - boolean isEmpty(); - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java deleted file mode 100644 index 7213d03..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * Implementation of the org.xml.sax.EntityResolver, - * for use by a org.apache.xerces.parsers.DOMParser. - * - * @author Patrick Peck - * @version $Id$ - */ -public class EntityResolverChain implements EntityResolver { - /** The EntityResolvers in the chain. */ - private List resolvers = new ArrayList(); - - /** - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) - */ - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException, IOException { - - Iterator iter; - - for (iter = resolvers.iterator(); iter.hasNext(); ) { - EntityResolver resolver = (EntityResolver) iter.next(); - InputSource is = resolver.resolveEntity(publicId, systemId); - - if (is != null) { - return is; - } - } - - return null; - } - - /** - * Add an EntityResolver to the chain. - * - * @param entityResolver The EntityResolver to add. - */ - public void addEntityResolver(EntityResolver entityResolver) { - resolvers.add(entityResolver); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java deleted file mode 100644 index a70d62e..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; - -/** - * Utility for accessing files on the file system, and for reading from input streams. - * @author Paul Ivancsics - * @version $Id$ - */ -public class FileUtils { - - /** - * Reads a file, given by URL, into a byte array. - * @param urlString file URL - * @return file content - * @throws IOException on any exception thrown - */ - public static byte[] readURL(String urlString) throws IOException { - URL url = new URL(urlString); - InputStream in = new BufferedInputStream(url.openStream()); - byte[] content = StreamUtils.readStream(in); - in.close(); - return content; - } - /** - * Reads a file, given by URL, into a String. - * @param urlString file URL - * @param encoding character encoding - * @return file content - * @throws IOException on any exception thrown - */ - public static String readURL(String urlString, String encoding) throws IOException { - byte[] content = readURL(urlString); - return new String(content, encoding); - } - /** - * Reads a file, given by filename, into a byte array. - * @param filename filename - * @return file content - * @throws IOException on any exception thrown - */ - public static byte[] readFile(String filename) throws IOException { - BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename)); - byte[] content = StreamUtils.readStream(in); - in.close(); - return content; - } - /** - * Reads a file, given by filename, into a String. - * @param filename filename - * @param encoding character encoding - * @return file content - * @throws IOException on any exception thrown - */ - public static String readFile(String filename, String encoding) throws IOException { - byte[] content = readFile(filename); - return new String(content, encoding); - } - /** - * Reads a file from a resource. - * @param name resource name - * @return file content as a byte array - * @throws IOException on any exception thrown - */ - public static byte[] readResource(String name) throws IOException { - ClassLoader cl = FileUtils.class.getClassLoader(); - BufferedInputStream in = new BufferedInputStream(cl.getResourceAsStream(name)); - byte[] content = StreamUtils.readStream(in); - in.close(); - return content; - } - /** - * Reads a file from a resource. - * @param name filename - * @param encoding character encoding - * @return file content - * @throws IOException on any exception thrown - */ - public static String readResource(String name, String encoding) throws IOException { - byte[] content = readResource(name); - return new String(content, encoding); - } - - /** - * Returns the absolute URL of a given url which is relative to the parameter root - * @param url - * @param root - * @return String - */ - public static String makeAbsoluteURL(String url, String root) { - //if url is relative to rootConfigFileDirName make it absolute - - File keyFile; - String newURL = url; - - if(null == url) return null; - - if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith("ftp:/")) { - return url; - } else { - // check if absolute - if not make it absolute - keyFile = new File(url); - if (!keyFile.isAbsolute()) { - keyFile = new File(root, url); - - if (keyFile.toString().startsWith("file:")) - newURL = keyFile.toString(); - - else - newURL = keyFile.toURI().toString(); - - } - return newURL; - } - } - - - private static void copy( InputStream fis, OutputStream fos ) - { - try - { - byte[] buffer = new byte[ 0xFFFF ]; - for ( int len; (len = fis.read(buffer)) != -1; ) - fos.write( buffer, 0, len ); - } - catch( IOException e ) { - System.err.println( e ); - } - finally { - if ( fis != null ) - try { fis.close(); } catch ( IOException e ) { e.printStackTrace(); } - if ( fos != null ) - try { fos.close(); } catch ( IOException e ) { e.printStackTrace(); } - } - } - - public static void copyFile(File src, File dest) - { - try - { - copy( new FileInputStream( src ), new FileOutputStream( dest ) ); - } - catch( IOException e ) { - e.printStackTrace(); - } - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java deleted file mode 100644 index 3d28f4f..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import iaik.x509.X509Certificate; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.cert.Certificate; - -/** - * Utility for creating and loading key stores. - * - * @author Paul Ivancsics - * @version $Id$ - */ -public class KeyStoreUtils { - - /** - * JAVA KeyStore - */ - private static final String KEYSTORE_TYPE_JKS = "JKS"; - - /** - * PKCS12 KeyStore - */ - private static final String KEYSTORE_TYPE_PKCS12 = "PKCS12"; - - - - /** - * Loads a key store from file. - * - * @param keystoreType key store type - * @param urlString URL of key store - * @param password password protecting the key store - * @return key store loaded - * @throws IOException thrown while reading the key store from file - * @throws GeneralSecurityException thrown while creating the key store - */ - public static KeyStore loadKeyStore( - String keystoreType, - String urlString, - String password) - throws IOException, GeneralSecurityException { - - URL keystoreURL = new URL(urlString); - InputStream in = keystoreURL.openStream(); - return loadKeyStore(keystoreType, in, password); - } - /** - * Loads a key store from an InputStream, and - * closes the InputStream. - * - * @param keystoreType key store type - * @param in input stream - * @param password password protecting the key store - * @return key store loaded - * @throws IOException thrown while reading the key store from the stream - * @throws GeneralSecurityException thrown while creating the key store - */ - public static KeyStore loadKeyStore( - String keystoreType, - InputStream in, - String password) - throws IOException, GeneralSecurityException { - - char[] chPassword = null; - if (password != null) - chPassword = password.toCharArray(); - KeyStore ks = KeyStore.getInstance(keystoreType); - ks.load(in, chPassword); - in.close(); - return ks; - } - /** - * Creates a key store from X509 certificate files, aliasing them with - * the index in the String[], starting with "0". - * - * @param keyStoreType key store type - * @param certFilenames certificate filenames - * @return key store created - * @throws IOException thrown while reading the certificates from file - * @throws GeneralSecurityException thrown while creating the key store - */ - public static KeyStore createKeyStore( - String keyStoreType, - String[] certFilenames) - throws IOException, GeneralSecurityException { - - KeyStore ks = KeyStore.getInstance(keyStoreType); - ks.load(null, null); - for (int i = 0; i < certFilenames.length; i++) { - Certificate cert = loadCertificate(certFilenames[i]); - ks.setCertificateEntry("" + i, cert); - } - return ks; - } - /** - * Creates a key store from a directory containg X509 certificate files, - * aliasing them with the index in the String[], starting with "0". - * All the files in the directory are considered to be certificates. - * - * @param keyStoreType key store type - * @param certDirURLString file URL of directory containing certificate filenames - * @return key store created - * @throws IOException thrown while reading the certificates from file - * @throws GeneralSecurityException thrown while creating the key store - */ - public static KeyStore createKeyStoreFromCertificateDirectory( - String keyStoreType, - String certDirURLString) - throws IOException, GeneralSecurityException { - - URL certDirURL = new URL(certDirURLString); - String certDirname = certDirURL.getFile(); - File certDir = new File(certDirname); - String[] certFilenames = certDir.list(); - String separator = - (certDirname.endsWith(File.separator) ? "" : File.separator); - for (int i = 0; i < certFilenames.length; i++) { - certFilenames[i] = certDirname + separator + certFilenames[i]; - } - return createKeyStore(keyStoreType, certFilenames); - } - - /** - * Loads an X509 certificate from file. - * @param certFilename filename - * @return the certificate loaded - * @throws IOException thrown while reading the certificate from file - * @throws GeneralSecurityException thrown while creating the certificate - */ - private static Certificate loadCertificate(String certFilename) - throws IOException, GeneralSecurityException { - - FileInputStream in = new FileInputStream(certFilename); - Certificate cert = new X509Certificate(in); - in.close(); - return cert; - } - - - /** - * Loads a keyStore without knowing the keyStore type - * @param keyStorePath URL to the keyStore - * @param password Password protecting the keyStore - * @return keyStore loaded - * @throws KeyStoreException thrown if keyStore cannot be loaded - * @throws FileNotFoundException - * @throws IOException - */ - public static KeyStore loadKeyStore(String keyStorePath, String password) throws KeyStoreException, IOException{ - - //InputStream is = new FileInputStream(keyStorePath); - URL keystoreURL = new URL(keyStorePath); - InputStream in = keystoreURL.openStream(); - InputStream isBuffered = new BufferedInputStream(in); - return loadKeyStore(isBuffered, password); - - } - - /** - * Loads a keyStore without knowing the keyStore type - * @param in input stream - * @param password Password protecting the keyStore - * @return keyStore loaded - * @throws KeyStoreException thrown if keyStore cannot be loaded - * @throws FileNotFoundException - * @throws IOException - */ -public static KeyStore loadKeyStore(InputStream is, String password) throws KeyStoreException, IOException{ - is.mark(1024*1024); - KeyStore ks = null; - try { - try { - ks = loadKeyStore(KEYSTORE_TYPE_PKCS12, is, password); - } catch (IOException e2) { - is.reset(); - ks = loadKeyStore(KEYSTORE_TYPE_JKS, is, password); - } - } catch(Exception e) { - e.printStackTrace(); - //throw new KeyStoreException(e); - } - return ks; - - } - - - - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java deleted file mode 100644 index 7a79bd9..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.IOException; - -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * A DefaultHandler that uses a MOAEntityResolver and - * a MOAErrorHandler. - * - * @author Patrick Peck - * @version $Id$ - */ -public class MOADefaultHandler extends DefaultHandler { - /** The EntityResolver to use. */ - private EntityResolver entityResolver; - /** The ErrorHandler to use. */ - private ErrorHandler errorHandler; - - /** - * Create a new MOADefaultHandler. - */ - public MOADefaultHandler() { - entityResolver = new MOAEntityResolver(); - errorHandler = new MOAErrorHandler(); - } - - /** - * Create a new MOADefaultHandler. - * - * @param entityResolver The EntityResolver to use for resolving - * external entities. - * @param errorHandler The ErrorHandler to use for reporting - * parsing errors. - */ - public MOADefaultHandler( - EntityResolver entityResolver, - ErrorHandler errorHandler) { - - this.entityResolver = entityResolver; - this.errorHandler = errorHandler; - } - - /** - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) - */ - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException { - try { - return entityResolver.resolveEntity(publicId, systemId); - } catch (IOException e) { - return null; - } - } - - /** - * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) - */ - public void warning(SAXParseException exception) throws SAXException { - errorHandler.warning(exception); - } - - /** - * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) - */ - public void error(SAXParseException exception) throws SAXException { - errorHandler.error(exception); - } - - /** - * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) - */ - public void fatalError(SAXParseException exception) throws SAXException { - errorHandler.fatalError(exception); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java deleted file mode 100644 index 8f3ffd4..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.InputStream; - -import org.apache.xerces.util.URI; -import org.apache.xerces.util.URI.MalformedURIException; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; - -import at.gv.egovernment.moa.logging.LogMsg; -import at.gv.egovernment.moa.logging.Logger; - -/** - * An EntityResolver that looks up entities stored as - * local resources. - * - *

The following DTDs are mapped to local resources: - *

    - *
  • The XMLSchema.dtd
  • - *
  • The datatypes.dtd
  • - *
- *

- *

For all other resources, an attempt is made to resolve them as resources, - * either absolute or relative to Constants.SCHEMA_ROOT. - * - * @author Patrick Peck - * @author Sven Aigner - */ -public class MOAEntityResolver implements EntityResolver { - - /** - * Resolve an entity. - * - * The systemId parameter is used to perform the lookup of the - * entity as a resource, either by interpreting the systemId as - * an absolute resource path, or by appending the last path component of - * systemId to Constants.SCHEMA_ROOT. - * - * @param publicId The public ID of the resource. - * @param systemId The system ID of the resource. - * @return An InputSource from which the entity can be read, or - * null, if the entity could not be found. - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) - */ - public InputSource resolveEntity(String publicId, String systemId) { - InputStream stream; - int slashPos; - - if (Logger.isDebugEnabled()) { - Logger.debug( - new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId)); - } - - if (publicId != null) { - // check if we can resolve some standard dtd's - if (publicId.equalsIgnoreCase("-//W3C//DTD XMLSchema 200102//EN")) { - return new InputSource( - getClass().getResourceAsStream( - Constants.SCHEMA_ROOT + "XMLSchema.dtd")); - } else if (publicId.equalsIgnoreCase("datatypes")) { - return new InputSource( - getClass().getResourceAsStream( - Constants.SCHEMA_ROOT + "datatypes.dtd")); - } - } else if (systemId != null) { - // get the URI path - try { - URI uri = new URI(systemId); - systemId = uri.getPath(); - - if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) { - return null; - } - - } catch (MalformedURIException e) { - return null; - } - - // try to get the resource from the full path - stream = getClass().getResourceAsStream(systemId); - if (stream != null) { - InputSource source = new InputSource(stream); - - source.setSystemId(systemId); - return source; - } - - // try to get the resource from the last path component - slashPos = systemId.lastIndexOf('/'); - if (slashPos >= 0 && systemId.length() > slashPos) { - systemId = systemId.substring(slashPos + 1, systemId.length()); - stream = - getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId); - if (stream != null) { - InputSource source = new InputSource(stream); - - source.setSystemId(systemId); - return source; - } - } - } - - return null; // nothing found - let the parser handle the entity - } -} \ No newline at end of file diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java deleted file mode 100644 index 3769b26..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import org.apache.xml.utils.DefaultErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import at.gv.egovernment.moa.logging.LogMsg; -import at.gv.egovernment.moa.logging.Logger; - -/** - * An ErrorHandler that logs a message and throws a - * SAXException upon error and fatal - * parsing errors. - * - * @author Patrick Peck - * @author Sven Aigner - */ -public class MOAErrorHandler extends DefaultErrorHandler { - - - /** - * Logs a warning message. - * - * @see org.xml.sax.ErrorHandler#warning(SAXParseException) - */ - public void warning(SAXParseException exception) throws SAXException { - warn("parser.00", messageParams(exception), null); - } - - /** - * Logs a warning and rethrows the exception. - * - * @see org.xml.sax.ErrorHandler#error(SAXParseException) - */ - public void error(SAXParseException exception) throws SAXException { - warn("parser.01", messageParams(exception), null); - - // if Target attribute is missing in QualifyingProperties - don't throw exception (bug fix for old MOCCA signatures) - if (exception.getMessage().startsWith("cvc-complex-type.4: Attribute 'Target' must appear on element")) - warn("parser.04", new Object[] {"Attribute 'Target' must appear on element 'QualifyingProperties' - ignored for compatibility reasons."}, null); - else - throw exception; - } - - /** - * Logs a warning and rethrows the exception. - * - * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) - */ - public void fatalError(SAXParseException exception) throws SAXException { - warn("parser.02", messageParams(exception), null); - throw exception; - } - - /** - * Log a warning message. - * - * @param messageId The message ID to log. - * @param parameters Additional message parameters. - * @param t The Throwable to log; usually the cause of this - * warning. - */ - private static void warn( - String messageId, - Object[] parameters, - Throwable t) { - - MessageProvider msg = MessageProvider.getInstance(); - Logger.warn(new LogMsg(msg.getMessage(messageId, parameters)), t); - } - - /** - * Put the system id, line and column number information from the exception - * into an Object array, to provide it as a - * MessageFormat parameter. - * - * @param e The SAXParseException containing the - * source system id and line/column numbers. - * @return An array containing the system id (a String) as well - * as line/column numbers (2 Integer objects) from the - * SAXParseException. - */ - private static Object[] messageParams(SAXParseException e) { - return new Object[] { - e.getMessage(), - e.getSystemId(), - new Integer(e.getLineNumber()), - new Integer(e.getColumnNumber())}; - } - -} \ No newline at end of file diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java deleted file mode 100644 index acc380d..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.util.Map; -import java.util.WeakHashMap; - -/** - * A timer utility for named timers. - * - * @author Sven Aigner - */ -public class MOATimer { - - /** The single instance of this class. */ - private static MOATimer instance = null; - /** The starting points of single timings. */ - private static Map timemapstart = new WeakHashMap(); - /** The end points of single timings. */ - private static Map timemapend = new WeakHashMap(); - - /** - * Return the single instance of this class. - * - * @return The single instance of this class. - */ - public static MOATimer getInstance() { - if (instance == null) { - instance = new MOATimer(); - } - return instance; - } - - /** - * Create a new MOATimer. - * - * Protected to disallow multiple instances. - */ - protected MOATimer() { - super(); - } - - /** - * Start timing a certain action. - * - * The timing belonging to the action ID is garbage collected as soon as there - * exists no other reference to the action ID. - * - * @param id The action ID. - */ - public void startTiming(Object id) { - timemapstart.put(id, new Long(System.currentTimeMillis())); - } - - /** - * Stop timing an action. - * - * @param id The action ID. - */ - public void stopTiming(Object id) { - timemapend.put(id, new Long(System.currentTimeMillis())); - } - - /** - * Get the duration of an action. - * - * @param id The action ID for which to compute the duration. - * @return long The duration in milliseconds between calls to - * startTiming() and stopTiming(). If - * only startTiming() has been called for the action, then - * current difference to the system time is returned. If no timing exists for - * the action, - 1 is returned. - */ - public long duration(Object id) { - if (timemapstart.containsKey(id)) { - long start = ((Long) timemapstart.get(id)).longValue(); - if (timemapend.containsKey(id)) { - long end = ((Long) timemapend.get(id)).longValue(); - return end - start; - } else { - return System.currentTimeMillis() - start; - } - } else - return -1; - } - - /** - * Get the duration of an action, as a nicely formatted String. - * - * @param id The action ID. - * @return String The duration() as a String. - */ - public String durationAsString(Object id) { - long dur = duration(id); - long second = dur / 1000; - long mil = (dur) - (second * 1000); - return "Duration: " + second + "." + mil + " seconds"; - } - - /** - * Remove a timing. - * - * @param id The action ID. - */ - public void clearTiming(String id) { - if (timemapstart.containsKey(id)) - timemapstart.remove(id); - if (timemapend.containsKey(id)) - timemapend.remove(id); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java deleted file mode 100644 index 1623ff1..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.util.Locale; - -/** - * A singleton wrapper around a Message object. - * - * Provides the messages used in the common project. - * - * @author Patrick Peck - * @version $Id$ - */ -public class MessageProvider { - /** The location of the default message resources. */ - private static final String[] DEFAULT_MESSAGE_RESOURCES = - { "resources/properties/common_messages" }; - /** The locale of the default message resources. */ - 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 this MessageProvider. */ - private Messages messages; - - /** - * Return the single instance of the MessageProvider. - * - * Intialilizes the MessageProvider with the default message - * locations: /resources/properties/common_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/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Messages.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Messages.java deleted file mode 100644 index 20de46b..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/Messages.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.text.MessageFormat; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; - -import at.gv.egovernment.moa.logging.Logger; - -/** - * Provides access to the system messages resource used for exception handling - * and logging messages. - * - * Messages must be provided as a resource bundle at the path. - * - * @author Patrick Peck - * @version $Id$ - */ -public class Messages { - /** Error message indicating that no messages are avaiable. */ - private static final String ERROR_MESSAGES_UNAVAILABLE = - "Fehler in der Server-Konfiguration. " - + "Die Fehlertexte konnten nicht geladen werden."; - /** Error message indicating that the message is not available. */ - private static final String ERROR_NO_MESSAGE = - "No errormesseage for error with number.={0}"; - - /** The names of the resources containing the messages. */ - private String[] resourceNames; - /** The corresponding Locales of the resources. */ - private Locale[] locales; - /** The ResourceBundles containing the messages. */ - private ResourceBundleChain messages; - - /** - * Create a new Message object containing the messages - * in the given resources. - * - * @param resourceNames The names of the resources containing the messages. - * @param locales The corresponding locales. - */ - public Messages(String[] resourceNames, Locale[] locales) { - this.resourceNames = resourceNames; - this.locales = locales; - this.messages = null; - } - - /** - * 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) { - // initialize messages - if (messages == null) { - initMessages(); - } - - // create the message - if (messages == null) { - return ERROR_MESSAGES_UNAVAILABLE; - } else { - try { - String rawMessage = messages.getString(messageId); - return MessageFormat.format(rawMessage, parameters); - } catch (MissingResourceException e2) { - // couldn't find any message -> set to default error message - return MessageFormat.format( - ERROR_NO_MESSAGE, - new Object[] { messageId }); - } - } - } - - /** - * Return the names of the resources containing the messages. - * - * @return String[] The names of the resource bundles containing the messages. - */ - private String[] getResourceNames() { - return resourceNames; - } - - /** - * Return the Locales of the resources containing the messages. - * - * @return Locale[] The Locales of the resource bundles - * containing the messages. - */ - private Locale[] getLocales() { - return locales; - } - - /** - * Initialize the messages ResourceBundle containing - * the MOA error messages. - */ - private void initMessages() { - messages = new ResourceBundleChain(); - int i; - - // initialize the message resources - for (i = 0; i < resourceNames.length; i++) { - try { - messages.addResourceBundle( - PropertyResourceBundle.getBundle( - getResourceNames()[i], - getLocales()[i])); - } catch (MissingResourceException e) { - Logger.error(ERROR_MESSAGES_UNAVAILABLE, e); - } - } - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MiscUtil.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MiscUtil.java deleted file mode 100644 index 2a5e1b8..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/MiscUtil.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright 2011 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES 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.util; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Collection; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.Iterator; -import java.util.Properties; - -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamResult; - -import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.util.ex.EgovUtilException; - - - -/** - * Class providing several utility methods. - * - * @author Arne Tauber - * - */ -public class MiscUtil { - - public static final String DEFAULT_SLASH = "/"; - - private static final int IO_BUFFER_SIZE = 4 * 1024; - - public static void copyStream(InputStream is, OutputStream os) throws IOException { - byte[] b = new byte[IO_BUFFER_SIZE]; - int read; - while ((read = is.read(b)) != -1) { - os.write(b, 0, read); - } - } - - public static void assertNotNull(Object param, String name) { - if (param == null) { - throw new NullPointerException(name + " must not be null."); - } - } - - public static boolean areAllNull(Object... objects) { - for (Object o : objects) { - if (o != null) { - return false; - } - } - return true; - } - - public static String extractContentType(String contentTypeString) { - if (contentTypeString == null) { - return ""; - } - if (contentTypeString.indexOf(";") != -1) { - return contentTypeString.substring(0, contentTypeString.indexOf(";")); - } - return contentTypeString; - } - - public static XMLGregorianCalendar getXMLGregorianCalendar(Date date) - throws DatatypeConfigurationException { - GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); - cal.setTime(date); - return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); - } - - public static XMLGregorianCalendar getXMLGregorianCalendar(String str) - throws DatatypeConfigurationException { - return DatatypeFactory.newInstance().newXMLGregorianCalendar(str); - } - - public static X509Certificate readCertificate(InputStream certStream) - throws CertificateException { - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - return (X509Certificate) cf.generateCertificate(certStream); - } - - public static boolean isEmpty(String str) { - return str == null || "".equals(str); - } - - public static boolean isNotEmpty(String str) { - return str != null && !"".equals(str); - } - - public static byte[] sourceToByteArray(Source result) - throws TransformerException { - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = factory.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - StreamResult streamResult = new StreamResult(); - streamResult.setOutputStream(out); - transformer.transform(result, streamResult); - return out.toByteArray(); - } - -// public static Document parseDocument(InputStream inputStream) -// throws IOException { -// try { -// DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory -// .newInstance(); -// docBuilderFactory.setNamespaceAware(true); -// DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); -// return docBuilder.parse(inputStream); -// } catch (ParserConfigurationException e) { -// throw new IOException(e); -// } catch (SAXException e) { -// throw new IOException(e); -// } -// } - - public static String removePrecedingSlash(String path, String slash) { - assertNotEmpty(slash, "Shash"); - if (!isEmpty(path)) { - while (path.startsWith(slash)) { - path = path.substring(slash.length(), path.length()); - } - } - return path; - } - - public static String removePrecedingSlash(String path) { - return removePrecedingSlash(path, DEFAULT_SLASH); - } - - public static void assertNotEmpty(String param, String name) { - if (param == null) { - throw new NullPointerException(name + " must not be null."); - } - if (param.length() == 0) { - throw new IllegalArgumentException(name + " must not be empty."); - } - } - - @SuppressWarnings("rawtypes") - public static boolean isEmpty(Properties props) { - if (props == null || props.isEmpty()) { - return true; - } - Iterator it = props.values().iterator(); - while (it.hasNext()) { - if (MiscUtil.isNotEmpty((String) it.next())) { - return false; - } - } - return true; - } - - public static boolean isEmpty(Empty empty) { - return empty == null || empty.isEmpty(); - } - - public static boolean isNotEmpty(Empty empty) { - return !isEmpty(empty); - } - - public static boolean isEmpty(byte[] data) { - return data == null || data.length == 0; - } - - public static boolean isNotEmpty(byte[] data) { - return !isEmpty(data); - } - - public static boolean isEmpty(Collection c) { - return c == null || c.isEmpty(); - } - - public static boolean isNotEmpty(Collection c) { - return !isEmpty(c); - } - - public static boolean areAllEmpty(String... strings) { - for (String s : strings) { - if (s != null && s.trim().length() != 0) { - return false; - } - } - return true; - } - - public static boolean areAllEmpty(Empty... empties) { - if (empties != null) { - for (Empty e : empties) { - if (e != null && !e.isEmpty()) { - return false; - } - } - } - return true; - } - - public static void assertNotEmpty(T[] param, String name) { - if (param == null) { - throw new NullPointerException(name + " must not be null."); - } - if (param.length == 0) { - throw new IllegalArgumentException(name + " must not be empty."); - } - } - - public static void assertNotEmpty(Empty empty, String name) { - if (empty == null) { - throw new NullPointerException(name + " must not be null."); - } - if (empty.isEmpty()) { - throw new IllegalArgumentException(name + " must not be empty."); - } - } - - public static void assertNotEmpty(byte[] param, String name) { - if (param == null) { - throw new NullPointerException(name + " must not be null."); - } - if (param.length == 0) { - throw new IllegalArgumentException(name + " must not be empty."); - } - } - - public static Date parseXMLDate(String xmlDate) throws EgovUtilException { - if (xmlDate == null) { - return null; - } - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - return sdf.parse(xmlDate); - } catch (ParseException e) { - throw new EgovUtilException(e); - } - } - - public static boolean isEmpty(T[] array) { - return array == null || array.length == 0; - } - - public static boolean isNotEmpty(T[] array) { - return !isEmpty(array); - } - - public static String convertDateFromStandardToXML(String dateString) { - MiscUtil.assertNotNull(dateString, "dateString"); - Date date = parseDate(dateString); - return formatDate(date, "yyyy-MM-dd"); - } - - public static Date parseDate(String dateString) { - return parseDate(dateString, "dd.MM.yyyy"); - } - - public static Date parseDate(String dateString, String pattern) { - MiscUtil.assertNotNull(dateString, "dateString"); - MiscUtil.assertNotNull(pattern, "pattern"); - SimpleDateFormat sdf = new SimpleDateFormat(pattern); - try { - return sdf.parse(dateString); - } catch (ParseException e) { - Logger.warn("Error parsing date.", e); - return null; - } - } - - public static String formatDate(Date date, String format) { - SimpleDateFormat sdf = new SimpleDateFormat(format); - return sdf.format(date); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java deleted file mode 100644 index fdc8232..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.util.ListIterator; - -import org.w3c.dom.DOMException; -import org.w3c.dom.Node; -import org.w3c.dom.traversal.NodeFilter; -import org.w3c.dom.traversal.NodeIterator; - -/** - * A NodeIterator implementation based on a - * ListIterator. - * - * @see java.util.ListIterator - * @see org.w3c.dom.traversal.NodeIterator - * - * @author Patrick Peck - * @version $Id$ - */ -public class NodeIteratorAdapter implements NodeIterator { - - /** The ListIterator to wrap. */ - private ListIterator nodeIterator; - - /** - * Create a new NodeIteratorAdapter. - * @param nodeIterator The ListIterator to iterate over. - */ - public NodeIteratorAdapter(ListIterator nodeIterator) { - this.nodeIterator = nodeIterator; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#getRoot() - */ - public Node getRoot() { - return null; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#getWhatToShow() - */ - public int getWhatToShow() { - return NodeFilter.SHOW_ALL; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#getFilter() - */ - public NodeFilter getFilter() { - return null; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#getExpandEntityReferences() - */ - public boolean getExpandEntityReferences() { - return false; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#nextNode() - */ - public Node nextNode() throws DOMException { - if (nodeIterator.hasNext()) { - return (Node) nodeIterator.next(); - } - return null; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#previousNode() - */ - public Node previousNode() throws DOMException { - if (nodeIterator.hasPrevious()) { - return (Node) nodeIterator.previous(); - } - return null; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#detach() - */ - public void detach() { - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java deleted file mode 100644 index e39cc02..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.util.List; - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * A NodeList implementation based on a List. - * - * @see java.util.List - * @see org.w3c.dom.NodeList - * - * @author Patrick Peck - * @version $Id$ - */ -public class NodeListAdapter implements NodeList { - /** The List to wrap. */ - private List nodeList; - - /** - * Create a new NodeListAdapter. - * - * @param nodeList The List containing the nodes. - */ - public NodeListAdapter(List nodeList) { - this.nodeList = nodeList; - } - - /** - * @see org.w3c.dom.NodeList#item(int) - */ - public Node item(int index) { - return (Node) nodeList.get(index); - } - - /** - * @see org.w3c.dom.NodeList#getLength() - */ - public int getLength() { - return nodeList.size(); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java deleted file mode 100644 index e3f8f75..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -/* - * Created on 26.04.2004 - * - * @author rschamberger - * $ID$ - */ -package at.gv.egovernment.moa.util; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.logging.Logger; - -/** - * utility functions to write XML data to files - * @author rschamberger - * @version $Id$ - */ -public class OutputXML2File { - - /** - * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) - * - * @param filename file name - * @param rootElem root element in DOM tree - * @param hierarchy of the Logger - */ - public static void debugOutputXML2File(String filename, Element rootElem, String hierarchy) { - if (Logger.isDebugEnabled(hierarchy)) { - outputXML2File(filename, rootElem); - } - } - - /** - * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) - * - * @param filename file name - * @param xmlString XML string - * @param hierarchy of the Logger - */ - public static void debugOutputXML2File(String filename, String xmlString, String hierarchy) { - if (Logger.isDebugEnabled(hierarchy)) { - outputXML2File(filename, xmlString); - } - } - - /** - * writes an XML structure to file (Encoding: UTF-8) - * - * @param filename file name - * @param rootElem root element in DOM tree - */ - public static void outputXML2File(String filename, Element rootElem) { - try { - String xmlString = new String(DOMUtils.serializeNode(rootElem)); - outputXML2File(filename, xmlString); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - /** - * writes an XML structure to file (Encoding: UTF-8) - * - * @param filename file name - * @param xmlString XML string - */ - public static void outputXML2File(String filename, String xmlString) { - try { - java.io.OutputStream fout = new java.io.FileOutputStream(filename); - byte[] xmlData = xmlString.getBytes("UTF-8"); - fout.write(xmlData); - fout.close(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java deleted file mode 100644 index 234ed89..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * A class to chain ResourceBundles. - * - * @author Patrick Peck - * @version $Id$ - */ -public class ResourceBundleChain { - /** Error message indicating the resource is not available. */ - private static final String ERROR_MISSING_RESOURCE = "Missing resource"; - /** The ResourceBundles contained in this chain. */ - private List resourceBundles = new ArrayList(); - - /** - * Add a ResourceBundle to the chain. - * - * @param resourceBundle The ResourceBundle to add. - */ - public void addResourceBundle(ResourceBundle resourceBundle) { - resourceBundles.add(resourceBundle); - } - - /** - * Return the value of the resource. - * - * @param key The key to access the String resource. - * @return The resource value. All the registered ResourceBundles - * are searched in the order in which they have previously been added to this - * ResourceBundleChain. - * @throws MissingResourceException The resource coult not be found in any of - * the bundles. - */ - public String getString(String key) throws MissingResourceException { - MissingResourceException lastException = null; - Iterator iter; - - // handle case where no resource bundles have been added - if (resourceBundles.size() == 0) { - throw new MissingResourceException( - ERROR_MISSING_RESOURCE, - this.getClass().getName(), - key); - } - - // try to find the resource in one of the bundles; if it cannot be found, - // return the exception thrown by the last bundle in the list - for (iter = resourceBundles.iterator(); iter.hasNext();) { - ResourceBundle resourceBundle = (ResourceBundle) iter.next(); - try { - String value = resourceBundle.getString(key); - return value; - } catch (MissingResourceException e) { - lastException = e; - } - } - throw lastException; - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java deleted file mode 100644 index c2c67ec..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.IOException; -import java.io.InputStream; -import java.security.GeneralSecurityException; -import java.security.KeyStore; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; - -/** - * Utility for connecting to server applications via SSL. - * - * @author Paul Ivancsics - * @version $Id$ - */ -public class SSLUtils { - - /** - * Creates an SSLSocketFactory which utilizes the given trust store. - * - * @param trustStoreType key store type of trust store - * @param trustStoreInputStream input stream for reading JKS trust store containing - * trusted server certificates; if null, the default - * trust store will be utilized - * @param trustStorePassword if provided, it will be used to check - * the integrity of the trust store; if omitted, it will not be checked - * @return SSLSocketFactory to be used by an HttpsURLConnection - * @throws IOException thrown while reading from the input stream - * @throws GeneralSecurityException thrown while creating the socket factory - */ - public static SSLSocketFactory getSSLSocketFactory( - String trustStoreType, - InputStream trustStoreInputStream, - String trustStorePassword) - throws IOException, GeneralSecurityException { - - TrustManager[] tms = getTrustManagers(trustStoreType, trustStoreInputStream, trustStorePassword); - SSLContext ctx = SSLContext.getInstance("TLS"); - ctx.init(null, tms, null); - - SSLSocketFactory sf = ctx.getSocketFactory(); - return sf; - } - /** - * Creates an SSLSocketFactory which utilizes the - * given trust store and keystore. - * - * @param trustStore trust store containing trusted server certificates; - * if null, the default trust store will be utilized - * @param clientKeyStoreType key store type of clientKeyStore - * @param clientKeyStoreURL URL of key store containing keys to be used for - * client authentication; if null, the default key store will be utilized - * @param clientKeyStorePassword if provided, it will be used to check - * the integrity of the client key store; if omitted, it will not be checked - * @return SSLSocketFactory to be used by an HttpsURLConnection - * @throws IOException thrown while reading key store file - * @throws GeneralSecurityException thrown while creating the socket factory - */ - public static SSLSocketFactory getSSLSocketFactory( - KeyStore trustStore, - String clientKeyStoreType, - String clientKeyStoreURL, - String clientKeyStorePassword) - throws IOException, GeneralSecurityException { - - SSLContext ctx = getSSLContext( - trustStore, clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); - SSLSocketFactory sf = ctx.getSocketFactory(); - return sf; - } - /** - * Creates an SSLContext initialized for the - * given trust store and keystore. - * - * @param trustStore trust store containing trusted server certificates; - * if null, the default trust store will be utilized - * @param clientKeyStoreType key store type of clientKeyStore - * @param clientKeyStoreURL URL of key store containing keys to be used for - * client authentication; if null, the default key store will be utilized - * @param clientKeyStorePassword if provided, it will be used to check - * the integrity of the client key store; if omitted, it will not be checked - * @return SSLContext to be used for creating an SSLSocketFactory - * @throws IOException thrown while reading key store file - * @throws GeneralSecurityException thrown while creating the SSL context - */ - public static SSLContext getSSLContext( - KeyStore trustStore, - String clientKeyStoreType, - String clientKeyStoreURL, - String clientKeyStorePassword) - throws IOException, GeneralSecurityException { - - TrustManager[] tms = getTrustManagers(trustStore); - KeyManager[] kms = getKeyManagers(clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); - SSLContext ctx = SSLContext.getInstance("TLS"); - ctx.init(kms, tms, null); - return ctx; - } - /** - * Loads the trust store from an input stream and gets the - * TrustManagers from a default TrustManagerFactory, - * initialized from the given trust store. - * @param trustStoreType key store type of trust store - * @param trustStoreInputStream input stream for reading JKS trust store containing - * trusted server certificates; if null, the default - * trust store will be utilized - * @param trustStorePassword if provided, it will be used to check - * the integrity of the trust store; if omitted, it will not be checked - * @return TrustManagers to be used for creating an - * SSLSocketFactory utilizing the given trust store - * @throws IOException thrown while reading from the input stream - * @throws GeneralSecurityException thrown while initializing the - * default TrustManagerFactory - */ - protected static TrustManager[] getTrustManagers( - String trustStoreType, - InputStream trustStoreInputStream, - String trustStorePassword) - throws IOException, GeneralSecurityException { - - if (trustStoreInputStream == null) - return null; - - // Set up the TrustStore to use. We need to load the file into - // a KeyStore instance. - KeyStore trustStore = KeyStoreUtils.loadKeyStore(trustStoreType, trustStoreInputStream, trustStorePassword); - return getTrustManagers(trustStore); - } - /** - * Gets the TrustManagers from a default TrustManagerFactory, - * initialized from the given trust store. - * - * @param trustStore the trust store to use - * @return TrustManagers to be used for creating an - * SSLSocketFactory utilizing the given trust store - * @throws GeneralSecurityException thrown while initializing the - * default TrustManagerFactory - */ - protected static TrustManager[] getTrustManagers(KeyStore trustStore) - throws GeneralSecurityException { - - if (trustStore == null) - return null; - - // Initialize the default TrustManagerFactory with this KeyStore - String alg=TrustManagerFactory.getDefaultAlgorithm(); - TrustManagerFactory tmFact=TrustManagerFactory.getInstance(alg); - tmFact.init(trustStore); - - // And now get the TrustManagers - TrustManager[] tms=tmFact.getTrustManagers(); - return tms; - } - /** - * Loads the client key store from file and gets the - * KeyManagers from a default KeyManagerFactory, - * initialized from the given client key store. - * @param clientKeyStoreType key store type of clientKeyStore - * @param clientKeyStoreURL URL of key store containing keys to be used for - * client authentication; if null, the default key store will be utilized - * @param clientKeyStorePassword password used to check the integrity of the client key store; - * if null, it will not be checked - * @return KeyManagers to be used for creating an - * SSLSocketFactory utilizing the given client key store - * @throws IOException thrown while reading from the key store file - * @throws GeneralSecurityException thrown while initializing the - * default KeyManagerFactory - */ - public static KeyManager[] getKeyManagers ( - String clientKeyStoreType, - String clientKeyStoreURL, - String clientKeyStorePassword) - throws IOException, GeneralSecurityException { - - if (clientKeyStoreURL == null) - return null; - - // Set up the KeyStore to use. We need to load the file into - // a KeyStore instance. - KeyStore clientKeyStore = KeyStoreUtils.loadKeyStore( - clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); - return getKeyManagers(clientKeyStore, clientKeyStorePassword); - } - /** - * Gets the KeyManagers from a default KeyManagerFactory, - * initialized from the given client key store. - * @param clientKeyStore client key store - * @param clientKeyStorePassword if provided, it will be used to check - * the integrity of the client key store; if omitted, it will not be checked - * @return KeyManagers to be used for creating an - * SSLSocketFactory utilizing the given client key store - * @throws GeneralSecurityException thrown while initializing the - * default KeyManagerFactory - */ - public static KeyManager[] getKeyManagers ( - KeyStore clientKeyStore, - String clientKeyStorePassword) - throws GeneralSecurityException { - - if (clientKeyStore == null) - return null; - - // Now we initialize the default KeyManagerFactory with this KeyStore - String alg=KeyManagerFactory.getDefaultAlgorithm(); - KeyManagerFactory kmFact=KeyManagerFactory.getInstance(alg); - char[] password = null; - if (clientKeyStorePassword != null) - password = clientKeyStorePassword.toCharArray(); - kmFact.init(clientKeyStore, password); - - // And now get the KeyManagers - KeyManager[] kms=kmFact.getKeyManagers(); - return kms; - } -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java deleted file mode 100644 index b3bc8ae..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; - -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * An EntityResolver that maps system IDs to - * InputStreams. - * - * @author Patrick Peck - * @version $Id$ - */ -public class StreamEntityResolver implements EntityResolver { - - /** A mapping from Public ID or System ID to an InputStream - * containing the entity. */ - private Map mappedEntities; - - /** - * Create a StreamEntityResolver. - * - * @param mappedEntities A mapping from public or system IDs - * (String objects) to InputStreams. - */ - public StreamEntityResolver(Map mappedEntities) { - this.mappedEntities = mappedEntities; - } - - /** - * Resolve an entity by looking it up in the mapped entities. - * - * First, the public ID is looked up in the mapping, then the system ID. - * - * @param publicId The public ID of the entity. - * @param systemId The system ID of the entity. - * @return An InputStream containing the entity or - * null if no entity could be found. - * @throws SAXException Signalling a parsing exception. - * @throws IOException Error reading the entity. - */ - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException, IOException { - - InputSource src = null; - - if (publicId != null && mappedEntities.get(publicId) != null) { - src = new InputSource((InputStream) mappedEntities.get(publicId)); - } else if (systemId != null && mappedEntities.get(systemId) != null) { - src = new InputSource((InputStream) mappedEntities.get(systemId)); - } - - if (src != null) { - src.setPublicId(publicId); - src.setSystemId(systemId); - } - - return src; - } -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java deleted file mode 100644 index e4ccd12..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintStream; - -/** - * Utility methods for streams. - * - * @author Patrick Peck - * @version $Id$ - */ -public class StreamUtils { - - /** - * Compare the contents of two InputStreams. - * - * @param is1 The 1st InputStream to compare. - * @param is2 The 2nd InputStream to compare. - * @return boolean true, if both streams contain the exactly the - * same content, false otherwise. - * @throws IOException An error occurred reading one of the streams. - */ - public static boolean compareStreams(InputStream is1, InputStream is2) - throws IOException { - - byte[] buf1 = new byte[256]; - byte[] buf2 = new byte[256]; - int length1; - int length2; - - try { - while (true) { - length1 = is1.read(buf1); - length2 = is2.read(buf2); - - if (length1 != length2) { - return false; - } - if (length1 <= 0) { - return true; - } - if (!compareBytes(buf1, buf2, length1)) { - return false; - } - } - } catch (IOException e) { - throw e; - } finally { - // close both streams - try { - is1.close(); - is2.close(); - } catch (IOException e) { - // ignore this - } - } - } - - /** - * Compare two byte arrays, up to a given maximum length. - * - * @param b1 1st byte array to compare. - * @param b2 2nd byte array to compare. - * @param length The maximum number of bytes to compare. - * @return true, if the byte arrays are equal, false - * otherwise. - */ - private static boolean compareBytes(byte[] b1, byte[] b2, int length) { - if (b1.length != b2.length) { - return false; - } - - for (int i = 0; i < b1.length && i < length; i++) { - if (b1[i] != b2[i]) { - return false; - } - } - - return true; - } - - /** - * Reads a byte array from a stream. - * @param in The InputStream to read. - * @return The bytes contained in the given InputStream. - * @throws IOException on any exception thrown - */ - public static byte[] readStream(InputStream in) throws IOException { - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - copyStream(in, out, null); - - /* - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int b; - while ((b = in.read()) >= 0) - out.write(b); - - */ - in.close(); - return out.toByteArray(); - } - - /** - * Reads a String from a stream, using given encoding. - * @param in The InputStream to read. - * @param encoding The character encoding to use for converting the bytes - * of the InputStream into a String. - * @return The content of the given InputStream converted into - * a String. - * @throws IOException on any exception thrown - */ - public static String readStream(InputStream in, String encoding) throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - copyStream(in, out, null); - - /* - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int b; - while ((b = in.read()) >= 0) - out.write(b); - */ - in.close(); - return out.toString(encoding); - } - - /** - * Reads all data (until EOF is reached) from the given source to the - * destination stream. If the destination stream is null, all data is dropped. - * It uses the given buffer to read data and forward it. If the buffer is - * null, this method allocates a buffer. - * - * @param source The stream providing the data. - * @param destination The stream that takes the data. If this is null, all - * data from source will be read and discarded. - * @param buffer The buffer to use for forwarding. If it is null, the method - * allocates a buffer. - * @exception IOException If reading from the source or writing to the - * destination fails. - */ - private static void copyStream(InputStream source, OutputStream destination, byte[] buffer) throws IOException { - if (source == null) { - throw new NullPointerException("Argument \"source\" must not be null."); - } - if (buffer == null) { - buffer = new byte[8192]; - } - - if (destination != null) { - int bytesRead; - while ((bytesRead = source.read(buffer)) >= 0) { - destination.write(buffer, 0, bytesRead); - } - } else { - while (source.read(buffer) >= 0); - } - } - - /** - * Gets the stack trace of the Throwable passed in as a string. - * @param t The Throwable. - * @return a String representing the stack trace of the Throwable. - */ - public static String getStackTraceAsString(Throwable t) - { - ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream(); - t.printStackTrace(new PrintStream(stackTraceBIS)); - return new String(stackTraceBIS.toByteArray()); - } -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java deleted file mode 100644 index ad879d2..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.util.StringTokenizer; - -/** - * Utitility functions for string manipulations. - * - * @author Harald Bratko - */ -public class StringUtils { - - /** - * Removes all blanks and tabs from the given string. - * - * @param s The string to remove all blanks and tabs from. - * @return The input string with all blanks and tabs removed from. - */ - public static String removeBlanks(String s) { - StringTokenizer st = new StringTokenizer(s); - StringBuffer sb = new StringBuffer(s.length()); - while (st.hasMoreTokens()) { - sb.append(st.nextToken()); - } - return sb.toString(); - } - - /** - * Removes all occurences of the specified token from the the given string. - * - * @param s The string to remove all occurences of the specified token from. - * @return The input string with all occurences of the specified token removed from. - */ - public static String removeToken(String s, String token) { - StringTokenizer st = new StringTokenizer(s, token); - StringBuffer sb = new StringBuffer(s.length()); - while (st.hasMoreTokens()) { - sb.append(st.nextToken()); - } - return sb.toString(); - } - - /** - * Removes all leading zeros from the input string. - * - * @param s The string remove the leading zeros from. - * @return The input string with the leading zeros removed from. - */ - public static String deleteLeadingZeros(String s) { - StringBuffer sb = new StringBuffer(s); - int l = sb.length(); - int j = 0; - for (int i=0; is that matches the given - * search string by the given replace string. - * - * @param s The string where the replacement should take place. - * @param search The pattern that should be replaced. - * @param replace The string that should replace all each search - * string within s. - * @return A string where all occurrence of search are - * replaced with replace. - */ - public static String replaceAll (String s, String search, String replace) - { - StringBuffer sb = new StringBuffer(); - int i = 0, j = 0; - int len = search.length(); - while (j > -1) - { - j = s.indexOf(search, i); - - if (j > -1) - { - sb.append(s.substring(i,j)); - sb.append(replace); - i = j + len; - } - } - - sb.append(s.substring(i, s.length())); - - return sb.toString(); - } - - /** - * Changes the SecurityLayer version in the given string. - * This method usually takes as input an XML structure represented in a string - * format and changes the SecurityLayer namespaces prefixes and URIs from - * one SecurityLayer version to another. - * e.g.: code>sl10 to sl and - * http://www.buergerkarte.at/namespaces/securitylayer/20020225# - * to - * http://www.buergerkarte.at/namespaces/securitylayer/1.2# - * - * @param s The string (usally an XML structure) where the - * SecurityLayer version should be changed. - * @param slPrefixOld The SecurityLayer namespace prefix that should be - * replaced by the new one. - * @param slPrefixNew The new SecurityLayer namespace prefix that should - * replace the old one. - * @param slNSUriOld The SecurityLayer namespace URI that should be - * replaced by the new one. - * @param slNSUriNew The new SecurityLayer namespace URI that should - * replace the old one. - * @return A string where the SecurityLayer namespace prefixes - * and URIs are replaced by new ones. - */ - public static String changeSLVersion(String s, String slPrefixOld, String slPrefixNew, String slNSUriOld, String slNSUriNew) { - String retString = replaceAll(s, slPrefixOld, slPrefixNew); - retString = replaceAll(retString, slNSUriOld, slNSUriNew); - return retString ; - } - - /** - * Removes the XML declaration from an XML expression. - * - * @param xmlString XML expression as String - * - * @return XML expression, XML declaration removed - */ - public static String removeXMLDeclaration(String xmlString) { - if (xmlString!=null && xmlString.startsWith("application/x-www-form-urlencoded string using a specific encoding scheme. - * @param s the string to decode - * @param encoding name of character encoding - * @return the newly decoded string - * @throws UnsupportedEncodingException if the encoding is not supported - */ - public static String decode(String s, String encoding) throws UnsupportedEncodingException { - StringReader in = new StringReader(s); - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - for (int b = read(in); b >= 0; b = read(in)) - bout.write(b); - return bout.toString(encoding); - } - /** - * Decodes the next byte from the string reader. - * @param in string reader - * @return the next byte decoded; - * -1 upon end of string, on erroneous data, and on any exception caught - * @todo syntax check on string - */ - private static int read(StringReader in) { - try { - int b = in.read(); - if (b == '+') - return ' '; - if (b == '%') { - char[] hex = new char[2]; - if (in.read(hex, 0, 2) >= 0) { - String hexString = new String(hex); - return Integer.valueOf(hexString, 16).intValue(); - } - else - return -1; - } - return b; - } - catch (IOException ex) { - return -1; - } - catch (NumberFormatException ex) { - return -1; - } - } -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java deleted file mode 100644 index e6df1fd..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.ByteArrayInputStream; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; - -/** - * Translates a string into mime format "x-www-form-urlencoded". - * Provides a function missing in JDK 1.3. - * @author Paul Ivancsics - * @version $Id$ - */ -public class URLEncoder { - - /** - * Translates a string into x-www-form-urlencoded format. - * @param s the string to be translated - * @param encoding the encoding to use - * @return the translated string - * @throws UnsupportedEncodingException when the desired encoding is not supported - */ - public static String encode(String s, String encoding) throws UnsupportedEncodingException { -// if (MiscUtil.isEmpty(s)) -// return null; - byte[] barr = s.getBytes(encoding); - ByteArrayInputStream bin = new ByteArrayInputStream(barr); - StringWriter out = new StringWriter(); - for (int b = bin.read(); b >= 0; b = bin.read()) - encode(b, out); - return out.toString(); - } - - /** - * Encode a character. - * @param ch The character to encode. - * @param out The StringWriter containing the result. - */ - private static void encode(int ch, StringWriter out) { - if ((ch >= 'a' && ch <= 'z') - || (ch >= 'A' && ch <= 'Z') - || (ch >= '0' && ch <= '9') - || ch == '.' || ch == '-' || ch == '*' || ch == '_') - out.write(ch); - else if (ch == ' ') - out.write('+'); - else - encodeHex(ch, out); - } - - /** - * Encode a character as an escaped hex value. - * @param ch The character to encode. - * @param out The StringWriter containing the result. - */ - private static void encodeHex(int ch, StringWriter out) { - out.write('%'); - String hex = Integer.toHexString(ch).toUpperCase(); - if (hex.length() < 2) - out.write('0'); - else - out.write(hex.charAt(hex.length() - 2)); - out.write(hex.charAt(hex.length() - 1)); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java deleted file mode 100644 index 0d20752..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.io.PrintStream; -import java.io.PrintWriter; - -/** - * An exception occurred evaluating an XPath. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XPathException extends RuntimeException { - /** - * - */ - private static final long serialVersionUID = 1736311265333034392L; -/** The wrapped exception. */ - private Throwable wrapped; - - /** - * Create a XPathException. - * - * @param message The exception message. - * @param wrapped The exception being the likely cause of this exception. - */ - public XPathException(String message, Throwable wrapped) { - // TODO: remove wrapped from super cstr. again - super(message, wrapped); - this.wrapped = wrapped; - } - - /** - * Return the wrapped exception. - * - * @return The wrapped exception being the likely cause of this exception. - */ - public Throwable getWrapped() { - return wrapped; - } - - /** - * @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); - } - } - - /** - * @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/moaSig/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java deleted file mode 100644 index 89aeaf3..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java +++ /dev/null @@ -1,557 +0,0 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egovernment.moa.util; - -import java.util.List; -import java.util.Map; - -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.traversal.NodeIterator; - -import org.jaxen.JaxenException; -import org.jaxen.NamespaceContext; -import org.jaxen.Navigator; -import org.jaxen.SimpleNamespaceContext; -import org.jaxen.dom.DOMXPath; -import org.jaxen.dom.DocumentNavigator; - -/** - * Utility methods to evaluate XPath expressions on DOM nodes. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XPathUtils { - - /** - * The XPath expression selecting all nodes under a given root (including the - * root node itself). - */ - public static final String ALL_NODES_XPATH = - "(.//. | .//@* | .//namespace::*)"; - - /** The DocumentNavigator to use for navigating the document. */ - private static Navigator documentNavigator = - DocumentNavigator.getInstance(); - /** The default namespace prefix to namespace URI mappings. */ - private static NamespaceContext NS_CONTEXT; - - static { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); - ctx.addNamespace(Constants.MOA_PREFIX, Constants.MOA_NS_URI); - ctx.addNamespace(Constants.MOA_CONFIG_PREFIX, Constants.MOA_CONFIG_NS_URI); - ctx.addNamespace(Constants.MOA_ID_CONFIG_PREFIX, Constants.MOA_ID_CONFIG_NS_URI); - ctx.addNamespace(Constants.SL10_PREFIX, Constants.SL10_NS_URI); - ctx.addNamespace(Constants.SL11_PREFIX, Constants.SL11_NS_URI); - ctx.addNamespace(Constants.SL12_PREFIX, Constants.SL12_NS_URI); - ctx.addNamespace(Constants.ECDSA_PREFIX, Constants.ECDSA_NS_URI); - ctx.addNamespace(Constants.PD_PREFIX, Constants.PD_NS_URI); - ctx.addNamespace(Constants.SAML_PREFIX, Constants.SAML_NS_URI); - ctx.addNamespace(Constants.SAMLP_PREFIX, Constants.SAMLP_NS_URI); - ctx.addNamespace(Constants.DSIG_PREFIX, Constants.DSIG_NS_URI); - ctx.addNamespace(Constants.XSLT_PREFIX, Constants.XSLT_NS_URI); - ctx.addNamespace(Constants.XSI_PREFIX, Constants.XSI_NS_URI); - ctx.addNamespace(Constants.DSIG_FILTER2_PREFIX, Constants.DSIG_FILTER2_NS_URI); - ctx.addNamespace(Constants.DSIG_EC_PREFIX, Constants.DSIG_EC_NS_URI); - ctx.addNamespace(Constants.MD_PREFIX, Constants.MD_NS_URI); - ctx.addNamespace(Constants.MDP_PREFIX, Constants.MDP_NS_URI); - ctx.addNamespace(Constants.MVV_PREFIX, Constants.MVV_NS_URI); - ctx.addNamespace(Constants.STB_PREFIX, Constants.STB_NS_URI); - ctx.addNamespace(Constants.WRR_PREFIX, Constants.WRR_NS_URI); - ctx.addNamespace(Constants.STORK_PREFIX, Constants.STORK_NS_URI); - ctx.addNamespace(Constants.STORKP_PREFIX, Constants.STORKP_NS_URI); - ctx.addNamespace(Constants.SAML2_PREFIX, Constants.SAML2_NS_URI); - ctx.addNamespace(Constants.SAML2P_PREFIX, Constants.SAML2P_NS_URI); - ctx.addNamespace(Constants.XENC_PREFIX, Constants.XENC_NS_URI); - ctx.addNamespace(Constants.XADES_1_1_1_NS_PREFIX, Constants.XADES_1_1_1_NS_URI); - NS_CONTEXT = ctx; - } - - /** - * Return a NodeIterator over the nodes matching the XPath - * expression. - * - * All namespace URIs and prefixes declared in the Constants - * interface are used for resolving namespaces. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return An iterator over the resulting nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeIterator selectNodeIterator(Node contextNode, String exp) - throws XPathException { - - return selectNodeIterator(contextNode, NS_CONTEXT, exp); - } - - /** - * Return a NodeIterator over the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceElement An element from which to build the - * namespace mapping for evaluating the XPath expression - * @param exp The XPath expression to evaluate. - * @return An iterator over the resulting nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeIterator selectNodeIterator( - Node contextNode, - Element namespaceElement, - String exp) - throws XPathException { - - try { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); - ctx.addElementNamespaces(documentNavigator, namespaceElement); - return selectNodeIterator(contextNode, ctx, exp); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Return a NodeIterator over the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceMapping A namespace prefix to namespace URI mapping - * (String to String) for evaluating the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return An iterator over the resulting nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeIterator selectNodeIterator( - Node contextNode, - Map namespaceMapping, - String exp) - throws XPathException { - - SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); - - return selectNodeIterator(contextNode, ctx, exp); - } - - /** - * Return a NodeIterator over the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param nsContext The NamespaceContext for resolving namespace - * prefixes to namespace URIs for evaluating the XPath expression. - * @param exp The XPath expression to evaluate. - * @return An iterator over the resulting nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - private static NodeIterator selectNodeIterator( - Node contextNode, - NamespaceContext nsContext, - String exp) - throws XPathException { - - try { - DOMXPath xpath = new DOMXPath(exp); - List nodes; - - xpath.setNamespaceContext(nsContext); - nodes = xpath.selectNodes(contextNode); - return new NodeIteratorAdapter(nodes.listIterator()); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Return a NodeList of all the nodes matching the XPath - * expression. - * - * All namespace URIs and prefixes declared in the Constants - * interface are used for resolving namespaces. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return A NodeList containing the matching nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeList selectNodeList(Node contextNode, String exp) - throws XPathException { - - return selectNodeList(contextNode, NS_CONTEXT, exp); - } - - /** - * Return a NodeList of all the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceElement An element from which to build the - * namespace mapping for evaluating the XPath expression - * @param exp The XPath expression to evaluate. - * @return A NodeList containing the matching nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeList selectNodeList( - Node contextNode, - Element namespaceElement, - String exp) - throws XPathException { - - try { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); - - ctx.addElementNamespaces(documentNavigator, namespaceElement); - return selectNodeList(contextNode, ctx, exp); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Return a NodeList of all the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceMapping A namespace prefix to namespace URI mapping - * (String to String) for evaluating the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return A NodeList containing the matching nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeList selectNodeList( - Node contextNode, - Map namespaceMapping, - String exp) - throws XPathException { - - SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); - - return selectNodeList(contextNode, ctx, exp); - } - - /** - * Return a NodeList of all the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param nsContext The NamespaceContext for resolving namespace - * prefixes to namespace URIs for evaluating the XPath expression. - * @param exp The XPath expression to evaluate. - * @return A NodeList containing the matching nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - private static NodeList selectNodeList( - Node contextNode, - NamespaceContext nsContext, - String exp) - throws XPathException { - - try { - DOMXPath xpath = new DOMXPath(exp); - List nodes; - - xpath.setNamespaceContext(nsContext); - nodes = xpath.selectNodes(contextNode); - return new NodeListAdapter(nodes); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Select the first node matching an XPath expression. - * - * All namespace URIs and prefixes declared in the Constants - * interface are used for resolving namespaces. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return Node The first node matching the XPath expression, or - * null, if no node matched. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static Node selectSingleNode(Node contextNode, String exp) - throws XPathException { - - return selectSingleNode(contextNode, NS_CONTEXT, exp); - } - - /** - * Select the first node matching an XPath expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceElement An element from which to build the - * namespace mapping for evaluating the XPath expression - * @param exp The XPath expression to evaluate. - * @return Node The first node matching the XPath expression, or - * null, if no node matched. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static Node selectSingleNode( - Node contextNode, - Element namespaceElement, - String exp) - throws XPathException { - - try { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); - ctx.addElementNamespaces(documentNavigator, namespaceElement); - - return selectSingleNode(contextNode, ctx, exp); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Select the first node matching an XPath expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceMapping A namespace prefix to namespace URI mapping - * (String to String) for evaluating the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return Node The first node matching the XPath expression, or - * null, if no node matched. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static Node selectSingleNode( - Node contextNode, - Map namespaceMapping, - String exp) - throws XPathException { - - SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); - - return selectSingleNode(contextNode, ctx, exp); - } - - /** - * Select the first node matching an XPath expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param nsContext The NamespaceContext for resolving namespace - * prefixes to namespace URIs for evaluating the XPath expression. - * @param exp The XPath expression to evaluate. - * @return Node The first node matching the XPath expression, or - * null, if no node matched. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static Node selectSingleNode( - Node contextNode, - NamespaceContext nsContext, - String exp) - throws XPathException { - - try { - DOMXPath xpath = new DOMXPath(exp); - xpath.setNamespaceContext(nsContext); - return (Node) xpath.selectSingleNode(contextNode); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Return the value of a DOM element whose location is given by an XPath - * expression. - * - * @param root The root element from which to evaluate the XPath. - * @param xpath The XPath expression pointing to the element whose value - * to return. - * @param def The default value to return, if no element can be found using - * the given xpath. - * @return The element value, if it can be located using the - * xpath. Otherwise, def is returned. - */ - public static 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 a DOM attribute whose location is given by an XPath - * expression. - * - * @param root The root element from which to evaluate the XPath. - * @param xpath The XPath expression pointing to the attribute whose value to - * return. - * @param def The default value to return, if no attribute can be found using - * the given xpath. - * @return The element value, if it can be located using the - * xpath. Otherwise, def is returned. - */ - public static String getAttributeValue( - Element root, - String xpath, - String def) { - - Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); - return attr != null ? attr.getValue() : def; - } - - /** - * Returns the namespace prefix used within XPathUtils for referring to - * the namespace of the specified (Security Layer command) element. - * - * This namespace prefix can be used in various XPath expression evaluation methods - * within XPathUtils without explicitely binding it to the particular - * namespace. - * - * @param contextElement The (Security Layer command) element. - * - * @return the namespace prefix used within XPathUtils for referring to - * the namespace of the specified (Security Layer command) element. - * - * throws XpathException If the specified element has a namespace other than the ones - * known by this implementation as valid Security Layer namespaces (cf. - * @link Constants#SL10_NS_URI, @link Constants#SL11_NS_URI, @link Constants#SL12_NS_URI). - */ - public static String getSlPrefix (Element contextElement) throws XPathException - { - String sLNamespace = contextElement.getNamespaceURI(); - String sLPrefix = null; - - if (sLNamespace.equals(Constants.SL10_NS_URI)) - { - sLPrefix = Constants.SL10_PREFIX; - } - else if (sLNamespace.equals(Constants.SL12_NS_URI)) - { - sLPrefix = Constants.SL12_PREFIX; - } - else if (sLNamespace.equals(Constants.SL11_NS_URI)) - { - sLPrefix = Constants.SL11_PREFIX; - } - else - { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ung�ltiger Security Layer Namespace: \"" + sLNamespace + "\"."}); - throw new XPathException(message, null); - } - - return sLPrefix; - } - - - /** - * Return the SecurityLayer namespace prefix of the context element. - * If the context element is not the element that lies within the - * SecurityLayer namespace. The Securitylayer namespace is derived from - * the xmlns:sl10, sl11 or sl - * attribute of the context element. - * - * The returned prefix is needed for evaluating XPATH expressions. - * - * @param contextElement The element to get a prefix for the Securitylayer namespace, - * that is used within the corresponding document. - * - * @return The string sl10, sl11 or sl, - * depending on the SecurityLayer namespace of the contextElement. - * - * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace - * is defined. - */ - public static String getSlPrefixFromNoRoot (Element contextElement) throws XPathException { - - String slPrefix = checkSLnsDeclaration(contextElement, Constants.SL10_PREFIX, Constants.SL10_NS_URI); - if (slPrefix == null) { - slPrefix = checkSLnsDeclaration(contextElement, Constants.SL11_PREFIX, Constants.SL11_NS_URI); - } - if (slPrefix == null) { - slPrefix = checkSLnsDeclaration(contextElement, Constants.SL12_PREFIX, Constants.SL12_NS_URI); - } - - return slPrefix; - - } - - /** - * Checks if the context element has an attribute xmlns:slPrefix and - * if the prefix of that attribute corresponds with a valid SecurityLayer namespace. - * - * @param contextElement The element to be checked. - * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer - * namespace prefix. - * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix. - * - * @return The valid SecurityLayer prefix or null if this prefix is - * not used. - * @throws XPathException - */ - private static String checkSLnsDeclaration(Element contextElement, String slPrefix, String slNameSpace) - throws XPathException - { - String nsAtt = "xmlns:" + slPrefix; - String nameSpace = contextElement.getAttribute(nsAtt); - if (nameSpace == "") { - return null; - } else { - // check if namespace is correct - if (nameSpace.equals(slNameSpace)) { - return slPrefix; - } else { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ung�ltiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); - throw new XPathException(message, null); - } - } - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/ex/EgovUtilException.java b/moaSig/common/src/main/java/at/gv/egovernment/moa/util/ex/EgovUtilException.java deleted file mode 100644 index 733a2a8..0000000 --- a/moaSig/common/src/main/java/at/gv/egovernment/moa/util/ex/EgovUtilException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2011 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES 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.util.ex; - -public class EgovUtilException extends Exception { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public EgovUtilException() { - } - - public EgovUtilException(String message) { - super(message); - } - - public EgovUtilException(Throwable cause) { - super(cause); - } - - public EgovUtilException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LogMsg.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LogMsg.java new file mode 100644 index 0000000..9eb84fa --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LogMsg.java @@ -0,0 +1,67 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.logging; + +/** + * A unified message type to log messages from inside the MOA subsystem. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LogMsg { + /** The message to log. */ + private Object message; + + /** + * Create a LogMsg object. + * + * @param message The actual message to log. May be null. + */ + public LogMsg(Object message) { + 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(); + LoggingContext ctx = + LoggingContextManager.getInstance().getLoggingContext(); + String tid = ctx != null ? ctx.getTransactionID() : null; + String nodeId = ctx != null ? ctx.getNodeID() : null; + + msg.append("TID="); + msg.append(tid != null ? tid : ""); + msg.append(" NID="); + msg.append(nodeId != null ? nodeId : ""); + msg.append(" MSG="); + msg.append(message != null ? message.toString() : ""); + + return msg.toString(); + } +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/Logger.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/Logger.java new file mode 100644 index 0000000..532a8be --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/Logger.java @@ -0,0 +1,230 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.logging; + +import java.util.HashMap; +import java.util.Map; + +/** + * A utility class acting as a facade to the logging subsystem. + * + * Configure the logging defaultHierarchy that the Logger uses by + * calling setHierarchy once before calling any of the logging + * output functions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Logger { + + /** + * Set the default hierarchy to which the Logger should send its + * logging output. + * @param hierarchy The logging defaultHierarchy. + */ + public static void setHierarchy(String hierarchy) { + // there is no need for that anymore + } + + + /** The Constant instances. */ + private static final Map instances = new HashMap(); + + /** + * Gets the logger. + * + * @return the logger + */ + private static synchronized org.slf4j.Logger getLogger() { + StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace(); + + int i; + for(i = 2; i < stacktrace.length; i++) + if(!stacktrace[i].getClassName().equals(Logger.class.getName())) + break; + + String className = stacktrace[i].getClassName(); + + org.slf4j.Logger logger = instances.get(className); + if (logger != null) { + return logger; + } + + logger = org.slf4j.LoggerFactory.getLogger(className); + instances.put(className, logger); + + return logger; + } + + /** + * Prepare the message for printing it as string. + *

Mainly introduce because the message might be null. + * + * @param message the message + * @return the string + */ + private static String prepareMessage(Object message) { + if(null == message) + return "no message given"; + return message.toString(); + } + + /** + * Test, if the trace log level is enabled. + * + * @return boolean true, if tracing output is enabled + * false otherwise. + */ + public static boolean isTraceEnabled() { + org.slf4j.Logger logger = getLogger(); + return logger.isTraceEnabled(); + } + + /** + * Test, if the trace log level is enabled for a given hierarchy. + * + * @param hierarchy requested log hierarchy + * @return boolean true, if tracing output is enabled + * false otherwise. + */ + public static boolean isTraceEnabled(String hierarchy) { + org.slf4j.Logger logger = getLogger(); + return logger.isTraceEnabled(); + } + + /** + * Trace a message. + * + * @param message The message to trace. + */ + public static void trace(Object message) { + org.slf4j.Logger logger = getLogger(); + logger.trace(prepareMessage(message)); + } + + /** + * Test, if the debug log level is enabled. + * + * @return boolean true, if debug output is enabled + * false otherwise. + */ + public static boolean isDebugEnabled() { + org.slf4j.Logger logger = getLogger(); + return logger.isDebugEnabled(); + } + + /** + * Test, if the debug log level is enabled for a given hierarchy. + * + * @param hierarchy requested log hierarchy + * @return boolean true, if debug output is enabled + * false otherwise. + */ + public static boolean isDebugEnabled(String hierarchy) { + org.slf4j.Logger logger = getLogger(); + return logger.isDebugEnabled(); + } + + /** + * Log a debug message. + * + * @param message The message to log. + */ + public static void debug(Object message) { + org.slf4j.Logger logger = getLogger(); + logger.debug(prepareMessage(message)); + } + +/** + * Log an info message. + * + * @param message The message to log. + */ + public static void info(Object message) { + org.slf4j.Logger logger = getLogger(); + logger.info(prepareMessage(message)); + } + + /** + * Log a warning message. + * + * @param message The message to log. + */ + public static void warn(Object message) { + org.slf4j.Logger logger = getLogger(); + logger.warn(prepareMessage(message)); + } + + /** + * Log a warning message. + * + * @param message The message to log. + * @param t An exception that may be the cause of the warning. + */ + public static void warn(Object message, Throwable t) { + org.slf4j.Logger logger = getLogger(); + logger.warn(prepareMessage(message), t); + } + + /** + * Log an error message. + * + * @param message The message to log. + */ + public static void error(Object message) { + org.slf4j.Logger logger = getLogger(); + logger.error(prepareMessage(message)); + } + + /** + * Log an error message. + * + * @param message The message to log. + * @param t An exception that may be the cause of the error. + */ + public static void error(Object message, Throwable t) { + org.slf4j.Logger logger = getLogger(); + logger.error(prepareMessage(message), t); + } + + /** + * Log a fatal error message. + * + * @param message The message to log. + */ + public static void fatal(Object message) { + error(message); + } + + /** + * Log a fatal error message. + * + * @param message The message to log. + * @param t An exception that may be the cause of the error. + */ + public static void fatal(Object message, Throwable t) { + error(message, t); + } +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContext.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContext.java new file mode 100644 index 0000000..0fb0e7d --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContext.java @@ -0,0 +1,70 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.logging; + +/** + * Encapsulates contextual information (i.e. per request information) for + * logging purposes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LoggingContext { + /** The name of the node ID system property. */ + public static final String NODE_ID_PROPERTY = "moa.node-id"; + + /** The current transaction ID. */ + private String transactionID; + /** The node ID. */ + private String nodeID; + + /** + * Create a new LoggingContext. + * + * @param transactionID The transaction ID. May be null. + */ + public LoggingContext(String transactionID) { + this.transactionID = transactionID; + this.nodeID = System.getProperty(NODE_ID_PROPERTY); + } + + /** + * Return the transaction ID. + * + * @return The transaction ID. + */ + public String getTransactionID() { + return transactionID; + } + + /** + * Return the node ID. + * + * @return The node ID. + */ + public String getNodeID() { + return nodeID; + } +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContextManager.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContextManager.java new file mode 100644 index 0000000..b4cd294 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContextManager.java @@ -0,0 +1,80 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.logging; + +/** + * Provides each thread with a single instance of LoggingContext. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LoggingContextManager { + /** The single instance of this class. */ + private static LoggingContextManager instance = null; + + /** The LoggingContext for each thread. */ + private ThreadLocal context; + + /** + * Get the single instance of the LoggingContextManager class. + * + * @return LoggingContextManager The single instance. + */ + public static synchronized LoggingContextManager getInstance() { + if (instance == null) { + instance = new LoggingContextManager(); + } + return instance; + } + + /** + * Creates a new LoggingContextManager. + * + * Protected to disallow direct instantiation. + */ + protected LoggingContextManager() { + context = new ThreadLocal(); + } + + /** + * Set the LoggingContext context for the current thread. + * + * @param ctx The LoggingContext for the current thread. + */ + public void setLoggingContext(LoggingContext ctx) { + context.set(ctx); + } + + /** + * Return the LoggingContext for the current thread. + * + * @return LoggingContext The LoggingContext for the current + * thread, or null if none has been set. + */ + public LoggingContext getLoggingContext() { + return (LoggingContext) context.get(); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Base64Utils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Base64Utils.java new file mode 100644 index 0000000..25a19bc --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Base64Utils.java @@ -0,0 +1,153 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; + +import iaik.utils.Base64InputStream; +import iaik.utils.Base64OutputStream; + +/** + * Utitility functions for encoding/decoding Base64 strings. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Base64Utils { + + /** + * Read the bytes encoded in a Base64 encoded String. + * + * @param base64String The String containing the Base64 encoded + * bytes. + * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. + * @return byte[] The raw bytes contained in the base64String. + * @throws IOException Failed to read the Base64 data. + */ + public static byte[] decode(String base64String, boolean ignoreInvalidChars, String encoding) + throws IOException { + + Base64InputStream in = + new Base64InputStream( + new ByteArrayInputStream(base64String.getBytes(encoding)), + ignoreInvalidChars); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte[] bytes = new byte[256]; + int bytesRead; + + while ((bytesRead = in.read(bytes)) > 0) { + out.write(bytes, 0, bytesRead); + } + in.close(); + + return out.toByteArray(); + } + + public static byte[] decode(String base64String, boolean ignoreInvalidChars) throws IOException { + return decode(base64String, ignoreInvalidChars, "UTF-8"); + } + + /** + * Read the bytes encoded in a Base64 encoded String and provide + * them via an InputStream. + * + * @param base64String The String containing the Base64 encoded + * bytes. + * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. + * @return The InputStream from which the binary content of the + * base64String can be read. + */ + public static InputStream decodeToStream( + String base64String, + boolean ignoreInvalidChars, + String encoding) { + + try { + ByteArrayInputStream bin = + new ByteArrayInputStream(base64String.getBytes(encoding)); + Base64InputStream in = new Base64InputStream(bin, ignoreInvalidChars); + + return in; + } catch (UnsupportedEncodingException e) { + // cannot occur, since UTF-8 is required to be supported by every JRE + return null; + } + } + + public static InputStream decodeToStream( + String base64String, + boolean ignoreInvalidChars) { + return decodeToStream(base64String, ignoreInvalidChars, "UTF-8"); + + } + + /** + * Convert a byte array to a Base64 encoded String. + * + * @param bytes The bytes to encode. + * @return String The Base64 encoded representation of the bytes. + * @throws IOException Failed to write the bytes as Base64 data. + */ + public static String encode(byte[] bytes) throws IOException { + return encode(new ByteArrayInputStream(bytes), "UTF-8"); + } + + public static String encode(byte[] bytes, String encoding) throws IOException { + return encode(new ByteArrayInputStream(bytes), encoding); + } + + public static String encode(InputStream inputStream) throws IOException { + return encode(inputStream, "UTF-8"); + } + /** + * Convert the data contained in the given stream to a Base64 encoded + * String. + * + * @param inputStream The stream containing the data to encode. + * @return The Base64 encoded data of inputStream, as a + * String. + * @throws IOException Failed to convert the data in the stream. + */ + public static String encode(InputStream inputStream, String encoding) throws IOException { + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + Base64OutputStream base64Stream = new Base64OutputStream(byteStream, "\n".getBytes()); + byte[] bytes = new byte[256]; + int bytesRead; + + while ((bytesRead = inputStream.read(bytes)) > 0) { + base64Stream.write(bytes, 0, bytesRead); + } + base64Stream.flush(); + base64Stream.close(); + inputStream.close(); + + return byteStream.toString(encoding); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/BoolUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/BoolUtils.java new file mode 100644 index 0000000..56eab08 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/BoolUtils.java @@ -0,0 +1,48 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +/** + * Utility class for parsing XML schema boolean values. + * + * @author Patrick Peck + * @version $Id$ + */ +public class BoolUtils { + + /** + * Return the boolean value of an xsd:boolean type of DOM + * element/attribute. + * + * @param boolStr The value of the xsd:boolean element/attribute. + * @return true, if boolStr equals + * "true" or "1;". Otherwise, + * false is returned. + */ + public static boolean valueOf(String boolStr) { + return "true".equals(boolStr) || "1".equals(boolStr); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/CollectionUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/CollectionUtils.java new file mode 100644 index 0000000..01a80ea --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/CollectionUtils.java @@ -0,0 +1,60 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.util.Iterator; +import java.util.List; + +/** + * Various utility methods for dealing with java.util.Collection + * classes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CollectionUtils { + + /** + * Convert a List of Number objects to an + * int array. + * + * @param nums The List containing the numbers whose integer + * value to put into the result. + * @return The int values of the Numbers contained + * in nums. + */ + public static int[] toIntArray(List nums) { + int[] result = new int[nums.size()]; + Iterator iter; + int i; + + for (i = 0, iter = nums.iterator(); iter.hasNext(); i++) { + Number num = (Number) iter.next(); + result[i] = num.intValue(); + } + + return result; + } +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java new file mode 100644 index 0000000..45e7d8a --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java @@ -0,0 +1,515 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.util.HashMap; + +/** + * Contains various constants used throughout the system. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface Constants { + /** Root location of the schema files. */ + public static final String SCHEMA_ROOT = "/resources/schemas/"; + + /** URI of the Widerrufregister XML namespace. */ + public static final String WRR_NS_URI = + "http://reference.e-government.gv.at/namespace/moavv/20041223"; + + /** Prefix used for the Widerrufregister XML namespace */ + public static final String WRR_PREFIX = "wrr"; + + /** URI of the StandardTextBlock XML namespace. */ + public static final String STB_NS_URI = + "http://reference.e-government.gv.at/namespace/standardtextblock/20041105#"; + + /** Prefix used for the standard text block XML namespace */ + public static final String STB_PREFIX = "stb"; + + /** URI of the MOA XML namespace. */ + public static final String MOA_NS_URI = + "http://reference.e-government.gv.at/namespace/moa/20020822#"; + + /** Name of the mandates infobox */ + public static final String INFOBOXIDENTIFIER_MANDATES = "Mandates"; + + /** Prefix used for the Mandate XML namespace */ + public static final String MD_PREFIX = "md"; + + /** URI of the Mandate XML namespace. */ + public static final String MD_NS_URI = + "http://reference.e-government.gv.at/namespace/mandates/20040701#"; + + /** Prefix used for the Mandate XML namespace */ + public static final String MVV_PREFIX = "mvv"; + + /** URI of the Mandate XML namespace. */ + public static final String MVV_NS_URI = + "http://reference.e-government.gv.at/namespace/moavv/app2mvv/20041125"; + + /** Prefix used for the MandateCheckProfile XML namespace */ + public static final String MDP_PREFIX = "mdp"; + + /** URI of the Mandate XML namespace. */ + public static final String MDP_NS_URI = + "http://reference.e-government.gv.at/namespace/mandateprofile/20041105#"; + + /** Prefix used for the MOA XML namespace */ + public static final String MOA_PREFIX = "moa"; + + /** Local location of the MOA XML schema definition. */ + public static final String MOA_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-SPSS-2.0.0.xsd"; + + /** URI of the MOA configuration XML namespace. */ + public static final String MOA_CONFIG_NS_URI = + "http://reference.e-government.gv.at/namespace/moaconfig/20021122#"; + + /** URI of the MOA ID configuration XML namespace. */ + public static final String MOA_ID_CONFIG_NS_URI = + "http://www.buergerkarte.at/namespaces/moaconfig#"; + + /** Prefix used for the MOA configuration XML namespace */ + public static final String MOA_CONFIG_PREFIX = "conf"; + + /** Prefix used for the MOA configuration XML namespace */ + public static final String MOA_ID_CONFIG_PREFIX = "confID"; + + /** Local location of the MOA configuration XML schema definition. */ + public static final String MOA_CONFIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-SPSS-config-2.0.1.xsd"; + + /** Local location of the MOA ID configuration XML schema definition. */ + public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-ID-Configuration-1.5.2.xsd"; + + /** URI of the Security Layer 1.0 namespace. */ + public static final String SL10_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/20020225#"; + + /** Prefix used for the Security Layer 1.0 XML namespace */ + public static final String SL10_PREFIX = "sl10"; + + /** Local location of the Security Layer 1.0 XML schema definition */ + public static final String SL10_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core.20020225.xsd"; + + /** URI of the Security Layer 1.1 XML namespace */ + public static final String SL11_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/20020831#"; + + /** Prefix used for the Security Layer 1.1 XML namespace */ + public static final String SL11_PREFIX = "sl11"; + + /** Local location of the Security Layer 1.1 XML schema definition */ + public static final String SL11_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core.20020831.xsd"; + + /** URI of the Security Layer 1.2 XML namespace */ + public static final String SL12_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/1.2#"; + + /** Prefix used for the Security Layer 1.2 XML namespace */ + public static final String SL12_PREFIX = "sl"; + + /** Local location of the Security Layer 1.2 XML schema definition */ + public static final String SL12_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core-1.2.xsd"; + + /** URI of the ECDSA XML namespace */ + public static final String ECDSA_NS_URI = + "http://www.w3.org/2001/04/xmldsig-more#"; + + /** Prefix used for ECDSA namespace */ + public static final String ECDSA_PREFIX = "ecdsa"; + + /** Local location of ECDSA XML schema definition */ + public static final String ECDSA_SCHEMA_LOCATION = + SCHEMA_ROOT + "ECDSAKeyValue.xsd"; + + /** URI of the PersonData XML namespace. */ + public static final String PD_NS_URI = + "http://reference.e-government.gv.at/namespace/persondata/20020228#"; + + /** Prefix used for the PersonData XML namespace */ + public static final String PD_PREFIX = "pr"; + +// /** Local location of the PersonData XML schema definition */ +// public static final String PD_SCHEMA_LOCATION = +// SCHEMA_ROOT + "PersonData.xsd"; + + /** Local location of the PersonData XML schema definition */ + public static final String PD_SCHEMA_LOCATION = + SCHEMA_ROOT + "PersonData_20_en_moaWID.xsd"; + + /** URI of the SAML namespace. */ + public static final String SAML_NS_URI = + "urn:oasis:names:tc:SAML:1.0:assertion"; + + /** Prefix used for the SAML XML namespace */ + public static final String SAML_PREFIX = "saml"; + + /** Local location of the SAML XML schema definition. */ + public static final String SAML_SCHEMA_LOCATION = + SCHEMA_ROOT + "cs-sstc-schema-assertion-01.xsd"; + + /** URI of the SAML request-response protocol namespace. */ + public static final String SAMLP_NS_URI = + "urn:oasis:names:tc:SAML:1.0:protocol"; + + /** Prefix used for the SAML request-response protocol namespace */ + public static final String SAMLP_PREFIX = "samlp"; + + /** Local location of the SAML request-response protocol schema definition. */ + public static final String SAMLP_SCHEMA_LOCATION = + SCHEMA_ROOT + "cs-sstc-schema-protocol-01.xsd"; + + /** URI of the XML namespace. */ + public static final String XML_NS_URI = + "http://www.w3.org/XML/1998/namespace"; + + /** Prefix used for the XML namespace */ + public static final String XML_PREFIX = "xml"; + + /** Local location of the XML schema definition. */ + public static final String XML_SCHEMA_LOCATION = SCHEMA_ROOT + "xml.xsd"; + + /** URI of the XMLNS namespace */ + public static final String XMLNS_NS_URI = "http://www.w3.org/2000/xmlns/"; + + /** Prefix used for the XSI namespace */ + public static final String XSI_PREFIX = "xsi"; + + /** Local location of the XSI schema definition. */ + public static final String XSI_SCHEMA_LOCATION = + SCHEMA_ROOT + "XMLSchema-instance.xsd"; + + /** URI of the XSI XMLNS namespace */ + public static final String XSI_NS_URI = + "http://www.w3.org/2001/XMLSchema-instance"; + + /** URI of the XSLT XML namespace */ + public static final String XSLT_NS_URI = + "http://www.w3.org/1999/XSL/Transform"; + + /** Prefix used for the XSLT XML namespace */ + public static final String XSLT_PREFIX = "xsl"; + + /** URI of the XMLDSig XML namespace. */ + public static final String DSIG_NS_URI = "http://www.w3.org/2000/09/xmldsig#"; + + /** Prefix used for the XMLDSig XML namespace */ + public static final String DSIG_PREFIX = "dsig"; + + /** Local location of the XMLDSig XML schema. */ + public static final String DSIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "xmldsig-core-schema.xsd"; + + /** URI of the XMLDSig XPath Filter XML namespace. */ + public static final String DSIG_FILTER2_NS_URI = + "http://www.w3.org/2002/06/xmldsig-filter2"; + + /** Prefix used for the XMLDSig XPath Filter XML namespace */ + public static final String DSIG_FILTER2_PREFIX = "dsig-filter2"; + + /** Local location of the XMLDSig XPath Filter XML schema definition. */ + public static final String DSIG_FILTER2_SCHEMA_LOCATION = + SCHEMA_ROOT + "xmldsig-filter2.xsd"; + + /** URI of the Exclusive Canonicalization XML namespace */ + public static final String DSIG_EC_NS_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#"; + + /** Prefix used for the Exclusive Canonicalization XML namespace */ + public static final String DSIG_EC_PREFIX = "ec"; + + /** Local location of the Exclusive Canonicalizaion XML schema definition */ + public static final String DSIG_EC_SCHEMA_LOCATION = + SCHEMA_ROOT + "exclusive-canonicalization.xsd"; + + /** URI of the XMLLoginParameterResolver Configuration XML namespace */ + public static final String XMLLPR_NS_URI="http://reference.e-government.gv.at/namespace/moa/20020822#/xmllpr20030814"; + + /** Local location of the XMLLoginParameterResolver Configuration XML schema definition */ + public static final String XMLLPR_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOAIdentities.xsd"; + + /** Local location of the XAdES v1.1.1 schema definition */ + public static final String XADES_1_1_1_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.1.1.xsd"; + + /** URI of the XAdES v1.1.1 namespace */ + public static final String XADES_1_1_1_NS_URI = "http://uri.etsi.org/01903/v1.1.1#"; + + public static final String XADES_1_1_1_NS_PREFIX = "xades111"; + + /** Local location of the XAdES v1.2.2 schema definition */ + public static final String XADES_1_2_2_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.2.2.xsd"; + + /** URI of the XAdES v1.2.2 namespace */ + public static final String XADES_1_2_2_NS_URI = "http://uri.etsi.org/01903/v1.2.2#"; + + public static final String XADES_1_2_2_NS_PREFIX = "xades122"; + + /** Local location of the XAdES v1.1.1 schema definition */ + public static final String XADES_1_3_2_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.3.2.xsd"; + + /** URI of the XAdES v1.3.2 namespace */ + public static final String XADES_1_3_2_NS_URI = "http://uri.etsi.org/01903/v1.3.2#"; + + public static final String XADES_1_3_2_NS_PREFIX = "xades132"; + + /** Local location of the XAdES v1.4.1 schema definition */ + public static final String XADES_1_4_1_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.4.1.xsd"; + + /** URI of the XAdES v1.4.1 namespace */ + public static final String XADES_1_4_1_NS_URI = "http://uri.etsi.org/01903/v1.4.1#"; + + public static final String XADES_1_4_1_NS_PREFIX = "xades141"; + /** URI of the SAML 2.0 namespace. */ + public static final String SAML2_NS_URI = + "urn:oasis:names:tc:SAML:2.0:assertion"; + + /** Prefix used for the SAML 2.0 XML namespace */ + public static final String SAML2_PREFIX = "saml2"; + + /** Local location of the SAML 2.0 XML schema definition. */ + public static final String SAML2_SCHEMA_LOCATION = + SCHEMA_ROOT + "saml-schema-assertion-2.0.xsd"; + + /** URI of the SAML 2.0 protocol namespace. */ + public static final String SAML2P_NS_URI = + "urn:oasis:names:tc:SAML:2.0:protocol"; + + /** Prefix used for the SAML 2.0 protocol XML namespace */ + public static final String SAML2P_PREFIX = "saml2p"; + + /** Local location of the SAML 2.0 protocol XML schema definition. */ + public static final String SAML2P_SCHEMA_LOCATION = + SCHEMA_ROOT + "saml-schema-protocol-2.0.xsd"; + + /** URI of the STORK namespace. */ + public static final String STORK_NS_URI = + "urn:eu:stork:names:tc:STORK:1.0:assertion"; + + /** Prefix used for the STORK XML namespace */ + public static final String STORK_PREFIX = "stork"; + + /** Local location of the STORK XML schema definition. */ + public static final String STORK_SCHEMA_LOCATION = + SCHEMA_ROOT + "stork-schema-assertion-1.0.xsd"; + + /** URI of the STORK protocol namespace. */ + public static final String STORKP_NS_URI = + "urn:eu:stork:names:tc:STORK:1.0:protocol"; + + /** Prefix used for the STORK protocol XML namespace */ + public static final String STORKP_PREFIX = "storkp"; + + /** Local location of the STORK protocol XML schema definition. */ + public static final String STORKP_SCHEMA_LOCATION = + SCHEMA_ROOT + "stork-schema-protocol-1.0.xsd"; + + /** URI of the TSL namespace. */ + public static final String TSL_NS_URI = + "http://uri.etsi.org/02231/v2#"; + + /** Prefix used for the TSL namespace */ + public static final String TSL_PREFIX = "tsl1"; + + /** Local location of the TSL schema definition. */ + public static final String TSL_SCHEMA_LOCATION = + SCHEMA_ROOT + "ts_119612v010201_xsd.xsd"; + + /** URI of the TSL SIE namespace. */ + public static final String TSL_SIE_NS_URI = + "http://uri.etsi.org/TrstSvc/SvcInfoExt/eSigDir-1999-93-EC-TrustedList/#"; + + /** Prefix used for the TSL SIE namespace */ + public static final String TSL_SIE_PREFIX = "tslsie"; + + /** Local location of the TSL SIE schema definition. */ + public static final String TSL_SIE_SCHEMA_LOCATION = + SCHEMA_ROOT + "ts_119612v010201_sie_xsd.xsd"; + + /** URI of the TSL additional types namespace. */ + public static final String TSL_ADDTYPES_NS_URI = + "http://uri.etsi.org/02231/v2/additionaltypes#"; + + /** Prefix used for the TSL additional types namespace */ + public static final String TSL_ADDTYPES_PREFIX = "tsltype"; + + /** Local location of the TSL additional types schema definition. */ + public static final String TSL_ADDTYPES_SCHEMA_LOCATION = + SCHEMA_ROOT + "ts_ts_119612v010201_additionaltypes_xsd.xsd"; + + /** URI of the XML Encryption namespace. */ + public static final String XENC_NS_URI = + "http://www.w3.org/2001/04/xmlenc#"; + + /** Prefix used for the XML Encryption XML namespace */ + public static final String XENC_PREFIX = "xenc"; + + /** Local location of the XML Encryption XML schema definition. */ + public static final String XENC_SCHEMA_LOCATION = + SCHEMA_ROOT + "xenc-schema.xsd"; + + /* Prefix used for the XML Encryption XML namespace */ + public static final String SAML2_METADATA_PREFIX = "md"; + + /* Prefix used for the XML Encryption XML namespace */ + public static final String SAML2_METADATA_URI = "urn:oasis:names:tc:SAML:2.0:metadata"; + + /* Local location of the XML Encryption XML schema definition. */ + public static final String SAML2_METADATA_SCHEMA_LOCATION = + SCHEMA_ROOT + "saml-schema-metadata-2.0.xsd"; + + /** + * Contains all namespaces and local schema locations for XML schema + * definitions relevant for MOA. For use in validating XML parsers. + */ + public static final String ALL_SCHEMA_LOCATIONS = + (MOA_NS_URI + " " + MOA_SCHEMA_LOCATION + " ") + + (MOA_CONFIG_NS_URI + " " + MOA_CONFIG_SCHEMA_LOCATION + " ") + + (MOA_ID_CONFIG_NS_URI + " " + MOA_ID_CONFIG_SCHEMA_LOCATION + " ") + + (SL10_NS_URI + " " + SL10_SCHEMA_LOCATION + " ") + + (SL11_NS_URI + " " + SL11_SCHEMA_LOCATION + " ") + + (SL12_NS_URI + " " + SL12_SCHEMA_LOCATION + " ") + + (ECDSA_NS_URI + " " + ECDSA_SCHEMA_LOCATION + " ") + + (PD_NS_URI + " " + PD_SCHEMA_LOCATION + " ") + + (SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " ") + + (SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " ") + + (XML_NS_URI + " " + XML_SCHEMA_LOCATION + " ") + + (XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " ") + + (DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " ") + + (DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " ") + + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " ") + + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION + " ") + + (XADES_1_1_1_NS_URI + " " + XADES_1_1_1_SCHEMA_LOCATION + " ") + + (XADES_1_2_2_NS_URI + " " + XADES_1_2_2_SCHEMA_LOCATION + " ") + + (XADES_1_3_2_NS_URI + " " + XADES_1_3_2_SCHEMA_LOCATION + " ") + + (XADES_1_4_1_NS_URI + " " + XADES_1_4_1_SCHEMA_LOCATION + " ") + + (TSL_NS_URI + " " + TSL_SCHEMA_LOCATION + " ") + + (TSL_SIE_NS_URI + " " + TSL_SIE_SCHEMA_LOCATION + " ") + + (TSL_ADDTYPES_NS_URI + " " + TSL_ADDTYPES_SCHEMA_LOCATION + " ") + + (SAML2_NS_URI + " " + SAML2_SCHEMA_LOCATION + " ") + + (SAML2P_NS_URI + " " + SAML2P_SCHEMA_LOCATION + " ") + + (STORK_NS_URI + " " + STORK_SCHEMA_LOCATION + " ") + + (STORKP_NS_URI + " " + STORKP_SCHEMA_LOCATION + " ") + + (XENC_NS_URI + " " + XENC_SCHEMA_LOCATION + " ") + + (SAML2_METADATA_URI + " " + SAML2_METADATA_SCHEMA_LOCATION); + + /** URN prefix for bPK and wbPK. */ + public static final String URN_PREFIX = "urn:publicid:gv.at"; + + /** URN prefix for context dependent id. */ + public static final String URN_PREFIX_CDID = URN_PREFIX + ":cdid"; + + /** URN prefix for context dependent id (bPK). */ + public static final String URN_PREFIX_BPK = URN_PREFIX_CDID + "+bpk"; + + /** URN prefix for context dependent id (HPI). */ + public static final String URN_PREFIX_HPI = URN_PREFIX_CDID + "+EHSP"; + + /** URN prefix for context dependent id (wbPK). */ + public static final String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; + + /** URN prefix for context dependent id (stork). */ + public static final String URN_PREFIX_STORK = URN_PREFIX + ":storkid"; + + /** URN prefix for context dependent id. */ + public static final String URN_PREFIX_BASEID = URN_PREFIX + ":baseid"; + + /** Security Layer manifest type URI. */ + public static final String SL_MANIFEST_TYPE_URI = + "http://www.buergerkarte.at/specifications/Security-Layer/20020225#SignatureManifest"; + + /** URI of the SHA1 digest algorithm */ + public static final String SHA1_URI = + "http://www.w3.org/2000/09/xmldsig#sha1"; + + /** URI of the SHA1 digest algorithm */ + public static final String SHA256_URI = + "http://www.w3.org/2000/09/xmldsig#sha256"; + + /** URI of the SHA1 digest algorithm */ + public static final String SHA384_URI = + "http://www.w3.org/2000/09/xmldsig#sha384"; + + /** URI of the SHA1 digest algorithm */ + public static final String SHA512_URI = + "http://www.w3.org/2000/09/xmldsig#sha512"; + + /** URI of the Canonical XML algorithm */ + public static final String C14N_URI = + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; + + /** URI of the Canoncial XML with comments algorithm */ + public static final String C14N_WITH_COMMENTS_URI = + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; + + /** URI of the Exclusive Canonical XML algorithm */ + public static final String EXC_C14N_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#"; + + /** URI of the Exclusive Canonical XML with commments algorithm */ + public static final String EXC_C14N_WITH_COMMENTS_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; + + // + // Local names for elements of the MOA SPSS schema + // + + /** + * Local name of request for creating an XML signature. + */ + public static final String MOA_SPSS_CREATE_XML_REQUEST = "CreateXMLSignatureRequest"; + + /** + * Local name of request for creating a CMS signature. + */ + public static final String MOA_SPSS_CREATE_CMS_REQUEST = "CreateCMSSignatureRequest"; + + /** + * Local name of request for creating a CMS signature. + */ + public static final String MOA_SPSS_CREATE_PDF_REQUEST = "CreatePDFSignatureRequest"; + + /** + * Local name of request for verifying an XML signature. + */ + public static final String MOA_SPSS_VERIFY_XML_REQUEST = "VerifiyXMLSignatureRequest"; + + /** + * A map used to map namespace prefixes to namespace URIs + */ + public static HashMap nSMap = new HashMap(5); + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DOMUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DOMUtils.java new file mode 100644 index 0000000..c5550ad --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DOMUtils.java @@ -0,0 +1,1171 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +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 java.util.Vector; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.xerces.parsers.DOMParser; +import org.apache.xerces.parsers.SAXParser; +import org.apache.xerces.parsers.XMLGrammarPreparser; +import org.apache.xerces.util.SymbolTable; +import org.apache.xerces.util.XMLGrammarPoolImpl; +import org.apache.xerces.xni.grammars.XMLGrammarDescription; +import org.apache.xerces.xni.grammars.XMLGrammarPool; +import org.apache.xerces.xni.parser.XMLInputSource; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentFragment; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import at.gv.egovernment.moaspss.logging.Logger; + +/** + * Various utility functions for handling XML DOM trees. + * + * The parsing methods in this class make use of some features internal to the + * Xerces DOM parser, mainly for performance reasons. As soon as JAXP + * (currently at version 1.2) is better at schema handling, it should be used as + * the parser interface. + * + * @author Patrick Peck + * @version $Id$ + */ +public class DOMUtils { + + /** Feature URI for namespace aware parsing. */ + private static final String NAMESPACES_FEATURE = + "http://xml.org/sax/features/namespaces"; + /** Feature URI for validating parsing. */ + private static final String VALIDATION_FEATURE = + "http://xml.org/sax/features/validation"; + /** Feature URI for schema validating parsing. */ + private static final String SCHEMA_VALIDATION_FEATURE = + "http://apache.org/xml/features/validation/schema"; + /** Feature URI for normalization of element/attribute values. */ + private static final String NORMALIZED_VALUE_FEATURE = + "http://apache.org/xml/features/validation/schema/normalized-value"; + /** Feature URI for parsing ignorable whitespace. */ + private static final String INCLUDE_IGNORABLE_WHITESPACE_FEATURE = + "http://apache.org/xml/features/dom/include-ignorable-whitespace"; + /** Feature URI for creating EntityReference nodes in the DOM tree. */ + private static final String CREATE_ENTITY_REF_NODES_FEATURE = + "http://apache.org/xml/features/dom/create-entity-ref-nodes"; + /** Property URI for providing external schema locations. */ + private static final String EXTERNAL_SCHEMA_LOCATION_PROPERTY = + "http://apache.org/xml/properties/schema/external-schemaLocation"; + /** Property URI for providing the external schema location for elements + * without a namespace. */ + private static final String EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY = + "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"; + + private static final String EXTERNAL_GENERAL_ENTITIES_FEATURE = + "http://xml.org/sax/features/external-general-entities"; + + private static final String EXTERNAL_PARAMETER_ENTITIES_FEATURE = + "http://xml.org/sax/features/external-parameter-entities"; + + private static final String DISALLOW_DOCTYPE_FEATURE = + "http://apache.org/xml/features/disallow-doctype-decl"; + + + + /** Property URI for the Xerces grammar pool. */ + private static final String GRAMMAR_POOL = + org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; + /** A prime number for initializing the symbol table. */ + private static final int BIG_PRIME = 2039; + /** Symbol table for the grammar pool. */ + private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME); + /** Xerces schema grammar pool. */ + private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); + /** Set holding the NamespaceURIs of the grammarPool, to prevent multiple + * entries of same grammars to the pool */ + private static Set grammarNamespaces; + + static { + grammarPool.lockPool(); + grammarNamespaces = new HashSet(); + } + + /** + * Preparse a schema and add it to the schema pool. + * The method only adds the schema to the pool if a schema having the same + * systemId (namespace URI) is not already present in the pool. + * + * @param inputStream An InputStream providing the contents of + * the schema. + * @param systemId The systemId (namespace URI) to use for the schema. + * @throws IOException An error occurred reading the schema. + */ + public static void addSchemaToPool(InputStream inputStream, String systemId) + throws IOException { + XMLGrammarPreparser preparser; + + if (!grammarNamespaces.contains(systemId)) { + + grammarNamespaces.add(systemId); + + // unlock the pool so that we can add another grammar + grammarPool.unlockPool(); + + // prepare the preparser + preparser = new XMLGrammarPreparser(symbolTable); + preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); + preparser.setProperty(GRAMMAR_POOL, grammarPool); + preparser.setFeature(NAMESPACES_FEATURE, true); + preparser.setFeature(VALIDATION_FEATURE, true); + + // add the grammar to the pool + preparser.preparseGrammar( + XMLGrammarDescription.XML_SCHEMA, + new XMLInputSource(null, systemId, null, inputStream, null)); + + // lock the pool again so that schemas are not added automatically + grammarPool.lockPool(); + } + } + + /** + * Parse an XML document from an InputStream. + * + * @param inputStream The InputStream containing the XML + * document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @param entityResolver An EntityResolver to resolve external + * entities (schemas and DTDs). If null, it will not be set. + * @param errorHandler An ErrorHandler to decide what to do + * with parsing errors. If null, it will not be set. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + InputStream inputStream, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation, + EntityResolver entityResolver, + ErrorHandler errorHandler) + throws SAXException, IOException, ParserConfigurationException { + + DOMParser parser; + +// class MyEntityResolver implements EntityResolver { +// +// public InputSource resolveEntity(String publicId, String systemId) +// throws SAXException, IOException { +// return new InputSource(new ByteArrayInputStream(new byte[0])); +// } +// } + + + //if Debug is enabled make a copy of inputStream to enable debug output in case of SAXException + byte buffer [] = null; + ByteArrayInputStream baStream = null; + if(true == Logger.isDebugEnabled()) { + int len = inputStream.available(); + buffer = new byte[len]; + inputStream.read(buffer); + baStream = new ByteArrayInputStream(buffer); + } + + // create the DOM parser + if (symbolTable != null) { + parser = new DOMParser(symbolTable, grammarPool); + } else { + parser = new DOMParser(); + } + + // set parser features and properties + try { + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, validating); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, validating); + parser.setFeature(NORMALIZED_VALUE_FEATURE, false); + parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); + parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); + parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false); + parser.setFeature(EXTERNAL_PARAMETER_ENTITIES_FEATURE, false); + + //fix XXE problem + //parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + + if (validating) { + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + externalNoNamespaceSchemaLocation); + } + } + + // set entity resolver and error handler + if (entityResolver != null) { + parser.setEntityResolver(entityResolver); + } + if (errorHandler != null) { + parser.setErrorHandler(errorHandler); + } + + // parse the document and return it + // if debug is enabled: use copy of strem (baStream) else use orig stream + + if(null != baStream) + parser.parse(new InputSource(baStream)); + else + parser.parse(new InputSource(inputStream)); + } catch(SAXException e) { + if(true == Logger.isDebugEnabled() && null != buffer) { + String xmlContent = new String(buffer); + Logger.debug("SAXException in:\n" + xmlContent); + } + throw(e); + } + + return parser.getDocument(); + } + + /** + * Parse an XML document from an InputStream. + * + * @param inputStream The InputStream containing the XML + * document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @param entityResolver An EntityResolver to resolve external + * entities (schemas and DTDs). If null, it will not be set. + * @param errorHandler An ErrorHandler to decide what to do + * with parsing errors. If null, it will not be set. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocumentSimple(InputStream inputStream) + throws SAXException, IOException, ParserConfigurationException { + + DOMParser parser; + + parser = new DOMParser(); + // set parser features and properties + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, false); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, false); + parser.setFeature(NORMALIZED_VALUE_FEATURE, false); + parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); + parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); + + parser.parse(new InputSource(inputStream)); + + return parser.getDocument(); + } + + + /** + * Parse an XML document from an InputStream. + * + * It uses a MOAEntityResolver as the EntityResolver + * and a MOAErrorHandler as the ErrorHandler. + * + * @param inputStream The InputStream containing the XML + * document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + InputStream inputStream, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + + + return parseDocument( + inputStream, + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation, + new MOAEntityResolver(), + new MOAErrorHandler()); + } + + /** + * Parse an XML document from a String. + * + * It uses a MOAEntityResolver as the EntityResolver + * and a MOAErrorHandler as the ErrorHandler. + * + * @param xmlString The String containing the XML document. + * @param encoding The encoding of the XML document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + String xmlString, + String encoding, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + InputStream in = new ByteArrayInputStream(xmlString.getBytes(encoding)); + return parseDocument( + in, + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation); + } + + /** + * Parse an UTF-8 encoded XML document from a String. + * + * @param xmlString The String containing the XML document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + String xmlString, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + return parseDocument( + xmlString, + "UTF-8", + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation); + } + + /** + * A convenience method to parse an XML document validating. + * + * @param inputStream The InputStream containing the XML + * document. + * @return The root element of the parsed XML document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Element parseXmlValidating(InputStream inputStream) + throws ParserConfigurationException, SAXException, IOException { + return DOMUtils + .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null) + .getDocumentElement(); + } + + /** + * A convenience method to parse an XML document non validating. + * + * @param inputStream The InputStream containing the XML + * document. + * @return The root element of the parsed XML document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Element parseXmlNonValidating(InputStream inputStream) + throws ParserConfigurationException, SAXException, IOException { + return DOMUtils + .parseDocument(inputStream, false, Constants.ALL_SCHEMA_LOCATIONS, null) + .getDocumentElement(); + } + + /** + * Schema validate a given DOM element. + * + * @param element The element to validate. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return true, if the element validates against + * the schemas declared in it. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document from its + * serialized representation. + * @throws ParserConfigurationException An error occurred configuring the XML + * @throws TransformerException An error occurred serializing the element. + */ + public static boolean validateElement( + Element element, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws + ParserConfigurationException, + IOException, + SAXException, + TransformerException { + + byte[] docBytes; + SAXParser parser; + + // create the SAX parser + if (symbolTable != null) { + parser = new SAXParser(symbolTable, grammarPool); + } else { + parser = new SAXParser(); + } + + // serialize the document + docBytes = serializeNode(element, "UTF-8"); + + // set up parser features and attributes + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, true); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); + parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false); + parser.setFeature(DISALLOW_DOCTYPE_FEATURE, true); + + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + "externalNoNamespaceSchemaLocation"); + } + + // set up entity resolver and error handler + parser.setEntityResolver(new MOAEntityResolver()); + parser.setErrorHandler(new MOAErrorHandler()); + + // parse validating + parser.parse(new InputSource(new ByteArrayInputStream(docBytes))); + return true; + } + + + /** + * Schema validate a given DOM element. + * + * @param element The element to validate. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return true, if the element validates against + * the schemas declared in it. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document from its + * serialized representation. + * @throws ParserConfigurationException An error occurred configuring the XML + * @throws TransformerException An error occurred serializing the element. + */ + public static boolean validateElement( + Element element, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation, + EntityResolver entityResolver) + throws + ParserConfigurationException, + IOException, + SAXException, + TransformerException { + + byte[] docBytes; + SAXParser parser; + + // create the SAX parser + if (symbolTable != null) { + parser = new SAXParser(symbolTable, grammarPool); + } else { + parser = new SAXParser(); + } + + // serialize the document + docBytes = serializeNode(element, "UTF-8"); + + // set up parser features and attributes + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, true); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); + + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + "externalNoNamespaceSchemaLocation"); + } + + // set up entity resolver and error handler + parser.setEntityResolver(entityResolver); + parser.setErrorHandler(new MOAErrorHandler()); + + // parse validating + parser.parse(new InputSource(new ByteArrayInputStream(docBytes))); + return true; + } + + /** + * Serialize the given DOM node. + * + * The node will be serialized using the UTF-8 encoding. + * + * @param node The node to serialize. + * @return String The String representation of the given DOM + * node. + * @throws TransformerException An error occurred transforming the + * node to a String. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static String serializeNode(Node node) + throws TransformerException, IOException { + return new String(serializeNode(node, "UTF-8", false), "UTF-8"); + } + + + /** + * Serialize the given DOM node. + * + * The node will be serialized using the UTF-8 encoding. + * + * @param node The node to serialize. + * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. + * @return String The String representation of the given DOM + * node. + * @throws TransformerException An error occurred transforming the + * node to a String. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static String serializeNode(Node node, boolean omitXmlDeclaration) + throws TransformerException, IOException { + return new String(serializeNode(node, "UTF-8", omitXmlDeclaration), "UTF-8"); + } + + /** + * Serialize the given DOM node. + * + * The node will be serialized using the UTF-8 encoding. + * + * @param node The node to serialize. + * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. + * @param lineSeperator Sets the line seperator String of the parser + * @return String The String representation of the given DOM + * node. + * @throws TransformerException An error occurred transforming the + * node to a String. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static String serializeNode(Node node, boolean omitXmlDeclaration, String lineSeperator) + throws TransformerException, IOException { + return new String(serializeNode(node, "UTF-8", omitXmlDeclaration, lineSeperator), "UTF-8"); + } + + /** + * Serialize the given DOM node to a byte array. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. + * @return The serialized node, as a byte array. Using a compatible encoding + * this can easily be converted into a String. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static byte[] serializeNode(Node node, String xmlEncoding) + throws TransformerException, IOException { + return serializeNode(node, xmlEncoding, false); + } + + /** + * Serialize the given DOM node to a byte array. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. + * @param omitDeclaration The boolean value for omitting the XML Declaration. + * @return The serialized node, as a byte array. Using a compatible encoding + * this can easily be converted into a String. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration) + throws TransformerException, IOException { + return serializeNode(node, xmlEncoding, omitDeclaration, null); + } + + + /** + * Serialize the given DOM node to a byte array. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. + * @param omitDeclaration The boolean value for omitting the XML Declaration. + * @param lineSeperator Sets the line seperator String of the parser + * @return The serialized node, as a byte array. Using a compatible encoding + * this can easily be converted into a String. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration, String lineSeperator) + throws TransformerException, IOException { + + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(16384); + + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.ENCODING, xmlEncoding); + String omit = omitDeclaration ? "yes" : "no"; + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omit); + if (null!=lineSeperator) { + transformer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", lineSeperator);//does not work for xalan <= 2.5.1 + } + transformer.transform(new DOMSource(node), new StreamResult(bos)); + + bos.flush(); + bos.close(); + + return bos.toByteArray(); + } + + /** + * Return the text that a node contains. + * + * This routine: + *

    + *
  • Ignores comments and processing instructions.
  • + *
  • Concatenates TEXT nodes, CDATA nodes, and the results recursively + * processing EntityRef nodes.
  • + *
  • Ignores any element nodes in the sublist. (Other possible options are + * to recurse into element sublists or throw an exception.)
  • + *
+ * + * @param node A DOM node from which to extract text. + * @return A String representing its contents. + */ + public static String getText(Node node) { + if (!node.hasChildNodes()) { + return ""; + } + + StringBuffer result = new StringBuffer(); + NodeList list = node.getChildNodes(); + + for (int i = 0; i < list.getLength(); i++) { + Node subnode = list.item(i); + if (subnode.getNodeType() == Node.TEXT_NODE) { + result.append(subnode.getNodeValue()); + } else if (subnode.getNodeType() == Node.CDATA_SECTION_NODE) { + result.append(subnode.getNodeValue()); + } else if (subnode.getNodeType() == Node.ENTITY_REFERENCE_NODE) { + // Recurse into the subtree for text + // (and ignore comments) + result.append(getText(subnode)); + } + } + return result.toString(); + } + + /** + * Build the namespace prefix to namespace URL mapping in effect for a given + * node. + * + * @param node The context node for which build the map. + * @return The namespace prefix to namespace URL mapping ( + * a String value to String value mapping). + */ + public static Map getNamespaceDeclarations(Node node) { + Map nsDecls = new HashMap(); + int i; + + do { + if (node.hasAttributes()) { + NamedNodeMap attrs = node.getAttributes(); + + for (i = 0; i < attrs.getLength(); i++) { + Attr attr = (Attr) attrs.item(i); + + // add prefix mapping if none exists + if ("xmlns".equals(attr.getPrefix()) + || "xmlns".equals(attr.getName())) { + + String nsPrefix = + attr.getPrefix() != null ? attr.getLocalName() : ""; + + if (nsDecls.get(nsPrefix) == null) { + nsDecls.put(nsPrefix, attr.getValue()); + } + } + } + } + } while ((node = node.getParentNode()) != null); + + return nsDecls; + } + + /** + * Add all namespace declarations declared in the parent(s) of a given + * element and used in the subtree of the given element to the given element. + * + * @param context The element to which to add the namespaces. + */ + public static void localizeNamespaceDeclarations(Element context) { + Node parent = context.getParentNode(); + + if (parent != null) { + Map namespaces = getNamespaceDeclarations(context.getParentNode()); + Set nsUris = collectNamespaceURIs(context); + Iterator iter; + + for (iter = namespaces.entrySet().iterator(); iter.hasNext();) { + Map.Entry e = (Map.Entry) iter.next(); + + if (nsUris.contains(e.getValue())) { + String prefix = (String) e.getKey(); + String nsUri = (String) e.getValue(); + String nsAttrName = "".equals(prefix) ? "xmlns" : "xmlns:" + prefix; + + context.setAttributeNS(Constants.XMLNS_NS_URI, nsAttrName, nsUri); + } + } + } + } + + /** + * Collect all the namespace URIs used in the subtree of a given element. + * + * @param context The element that should be searched for namespace URIs. + * @return All namespace URIs used in the subtree of context, + * including the ones used in context itself. + */ + public static Set collectNamespaceURIs(Element context) { + Set result = new HashSet(); + + collectNamespaceURIsImpl(context, result); + return result; + } + + /** + * A recursive method to do the work of collectNamespaceURIs. + * + * @param context The context element to evaluate. + * @param result The result, passed as a parameter to avoid unnecessary + * instantiations of Set. + */ + private static void collectNamespaceURIsImpl(Element context, Set result) { + NamedNodeMap attrs = context.getAttributes(); + NodeList childNodes = context.getChildNodes(); + String nsUri; + int i; + + // add the namespace of the context element + nsUri = context.getNamespaceURI(); + if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { + result.add(nsUri); + } + + // add all namespace URIs from attributes + for (i = 0; i < attrs.getLength(); i++) { + nsUri = attrs.item(i).getNamespaceURI(); + if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { + result.add(nsUri); + } + } + + // add all namespaces from subelements + for (i = 0; i < childNodes.getLength(); i++) { + Node node = childNodes.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + collectNamespaceURIsImpl((Element) node, result); + } + } + } + + /** + * Check, that each attribute node in the given NodeList has its + * parent in the NodeList as well. + * + * @param nodes The NodeList to check. + * @return true, if each attribute node in nodes + * has its parent in nodes as well. + */ + public static boolean checkAttributeParentsInNodeList(NodeList nodes) { + Set nodeSet = new HashSet(); + int i; + + // put the nodes into the nodeSet + for (i = 0; i < nodes.getLength(); i++) { + nodeSet.add(nodes.item(i)); + } + + // check that each attribute node's parent is in the node list + for (i = 0; i < nodes.getLength(); i++) { + Node n = nodes.item(i); + + if (n.getNodeType() == Node.ATTRIBUTE_NODE) { + Attr attr = (Attr) n; + Element owner = attr.getOwnerElement(); + + if (owner == null) { + if (!isNamespaceDeclaration(attr)) { + return false; + } + } + + if (!nodeSet.contains(owner) && !isNamespaceDeclaration(attr)) { + return false; + } + } + } + + return true; + } + + /** + * Convert an unstructured NodeList into a + * DocumentFragment. + * + * @param nodeList Contains the node list to be converted into a DOM + * DocumentFragment. + * @return the resulting DocumentFragment. The DocumentFragment will be + * backed by a new DOM Document, i.e. all noded of the node list will be + * cloned. + * @throws ParserConfigurationException An error occurred creating the + * DocumentFragment. + * @precondition The nodes in the node list appear in document order + * @precondition for each Attr node in the node list, the owning Element is + * in the node list as well. + * @precondition each Element or Attr node in the node list is namespace + * aware. + */ + public static DocumentFragment nodeList2DocumentFragment(NodeList nodeList) + throws ParserConfigurationException { + + DocumentBuilder builder = + DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.newDocument(); + DocumentFragment result = doc.createDocumentFragment(); + + if (null == nodeList || nodeList.getLength() == 0) { + return result; + } + + int currPos = 0; + currPos = + nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; + + while (currPos < nodeList.getLength()) { + currPos = + nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; + } + return result; + } + + /** + * Helper method for the nodeList2DocumentFragment. + * + * @param nodeList The NodeList to convert. + * @param currPos The current position in the nodeList. + * @param result The resulting DocumentFragment. + * @param currOrgElem The current original element. + * @param currClonedElem The current cloned element. + * @return The current position. + */ + private static int nodeList2DocumentFragment( + NodeList nodeList, + int currPos, + DocumentFragment result, + Element currOrgElem, + Element currClonedElem) { + + while (currPos < nodeList.getLength()) { + Node currentNode = nodeList.item(currPos); + switch (currentNode.getNodeType()) { + case Node.COMMENT_NODE : + case Node.PROCESSING_INSTRUCTION_NODE : + case Node.TEXT_NODE : + { + // Append current node either to resulting DocumentFragment or to + // current cloned Element + if (null == currClonedElem) { + result.appendChild( + result.getOwnerDocument().importNode(currentNode, false)); + } else { + // Stop processing if current Node is not a descendant of + // current Element + if (!isAncestor(currOrgElem, currentNode)) { + return --currPos; + } + + currClonedElem.appendChild( + result.getOwnerDocument().importNode(currentNode, false)); + } + break; + } + + case Node.ELEMENT_NODE : + { + Element nextCurrOrgElem = (Element) currentNode; + Element nextCurrClonedElem = + result.getOwnerDocument().createElementNS( + nextCurrOrgElem.getNamespaceURI(), + nextCurrOrgElem.getNodeName()); + + // Append current Node either to resulting DocumentFragment or to + // current cloned Element + if (null == currClonedElem) { + result.appendChild(nextCurrClonedElem); + currOrgElem = nextCurrOrgElem; + currClonedElem = nextCurrClonedElem; + } else { + // Stop processing if current Node is not a descendant of + // current Element + if (!isAncestor(currOrgElem, currentNode)) { + return --currPos; + } + + currClonedElem.appendChild(nextCurrClonedElem); + } + + // Process current Node (of type Element) recursively + currPos = + nodeList2DocumentFragment( + nodeList, + ++currPos, + result, + nextCurrOrgElem, + nextCurrClonedElem); + + break; + } + + case Node.ATTRIBUTE_NODE : + { + Attr currAttr = (Attr) currentNode; + + // GK 20030411: Hack to overcome problems with IAIK IXSIL + if (currAttr.getOwnerElement() == null) + break; + if (currClonedElem == null) + break; + + // currClonedElem must be the owner Element of currAttr if + // preconditions are met + currClonedElem.setAttributeNS( + currAttr.getNamespaceURI(), + currAttr.getNodeName(), + currAttr.getValue()); + break; + } + + default : + { + // All other nodes will be ignored + } + } + + currPos++; + } + + return currPos; + } + + /** + * Check, if the given attribute is a namespace declaration. + * + * @param attr The attribute to check. + * @return true, if the attribute is a namespace declaration, + * false otherwise. + */ + private static boolean isNamespaceDeclaration(Attr attr) { + return Constants.XMLNS_NS_URI.equals(attr.getNamespaceURI()); + } + + /** + * Check, if a given DOM element is an ancestor of a given node. + * + * @param candAnc The DOM element to check for being the ancestor. + * @param cand The node to check for being the child. + * @return true, if candAnc is an (indirect) + * ancestor of cand; false otherwise. + */ + public static boolean isAncestor(Element candAnc, Node cand) { + Node currPar = cand.getParentNode(); + + while (currPar != null) { + if (candAnc == currPar) + return true; + currPar = currPar.getParentNode(); + } + return false; + } + + /** + * Selects the (first) element from a node list and returns it. + * + * @param nl The NodeList to get the element from. + * @return The (first) element included in the node list or null + * if the node list is null or empty or no element is + * included in the list. + */ + public static Element getElementFromNodeList (NodeList nl) { + if ((nl == null) || (nl.getLength() == 0)) { + return null; + } + for (int i=0; idateTime, + * according to ISO 8601. + * + * @author Patrick Peck + * @version $Id$ + * @see http://www.w3.org/2001/XMLSchema-datatypes" + */ +public class DateTimeUtils { + /** Error messages. */ + private static MessageProvider msg = MessageProvider.getInstance(); + +// /** +// * Builds a dateTime value from a Calendar value. +// * @param cal the Calendar value +// * @return the dateTime value +// */ +// public static String buildDateTime(Calendar cal, boolean useUTC) { +// +// if (useUTC) +// return buildDateTimeUTC(cal); +// else { +// StringWriter out = new StringWriter(); +// out.write("" + cal.get(Calendar.YEAR)); +// out.write("-"); +// out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); +// out.write("-"); +// out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); +// out.write("T"); +// out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); +// out.write(":"); +// out.write(to2DigitString(cal.get(Calendar.MINUTE))); +// out.write(":"); +// out.write(to2DigitString(cal.get(Calendar.SECOND))); +// int tzOffsetMilliseconds = +// cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); +// if (tzOffsetMilliseconds != 0) { +// int tzOffsetMinutes = tzOffsetMilliseconds / (1000 * 60); +// int tzOffsetHours = tzOffsetMinutes / 60; +// tzOffsetMinutes -= tzOffsetHours * 60; +// if (tzOffsetMilliseconds > 0) { +// out.write("+"); +// out.write(to2DigitString(tzOffsetHours)); +// out.write(":"); +// out.write(to2DigitString(tzOffsetMinutes)); +// } else { +// out.write("-"); +// out.write(to2DigitString(-tzOffsetHours)); +// out.write(":"); +// out.write(to2DigitString(-tzOffsetMinutes)); +// } +// } +// return out.toString(); +// } +// } + + /** + * Builds a dateTime value in UTC from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildDateTimeUTC(Calendar cal) { + + SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + f.setTimeZone(TimeZone.getTimeZone("UTC")); + + return f.format(cal.getTime()); + } + + /** + * Builds a dateTime value in UTC from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildDateTimeUTC(Date cal) { + + SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + f.setTimeZone(TimeZone.getTimeZone("UTC")); + + return f.format(cal); + + } + + /** + * Builds a dateTime value from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildDate(Calendar cal) { + StringWriter out = new StringWriter(); + out.write("" + cal.get(Calendar.YEAR)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); + return out.toString(); + } + + /** + * Builds a dateTime value from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildTime(Calendar cal) { + StringWriter out = new StringWriter(); + out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.MINUTE))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.SECOND))); + + return out.toString(); + } + + /** + * Converts month, day, hour, minute, or second value + * to a 2 digit String. + * @param number the month, day, hour, minute, or second value + * @return 2 digit String + */ + private static String to2DigitString(int number) { + if (number < 10) + return "0" + number; + else + return "" + number; + } + + /** + * Parse a String containing a date and time instant, given in + * ISO 8601 format. + * + * @param dateTime The String to parse. + * @return The Date representation of the contents of + * dateTime. + * @throws ParseException Parsing the dateTime failed. + */ + public static Date parseDateTime(String dateTime) throws ParseException { + GregorianCalendar calendar; + long time; + int yearSign = 1, year, month, day; + int hour, minute, second; + double fraction = 0.0; + int tzSign = 1, tzHour = 0, tzMinute = 0; + int curPos = 0; + String fractStr; + boolean localTime = false; + char c; + + // parse year sign + ensureChars(dateTime, curPos, 1); + c = dateTime.charAt(curPos); + if (c == '+' || c == '-') { + yearSign = c == '+' ? 1 : -1; + curPos++; + } + + // parse year + year = parseInt(dateTime, curPos, 4); + curPos += 4; + + // parse '-' + ensureChar(dateTime, curPos, '-'); + curPos++; + + // parse month + month = parseInt(dateTime, curPos, 2); + ensureValue(month, 1, 12, curPos); + curPos += 2; + + // parse '-' + ensureChar(dateTime, curPos, '-'); + curPos++; + + // parse day + day = parseInt(dateTime, curPos, 2); + ensureValue(day, 1, 31, curPos); + curPos += 2; + + // parse 'T' + ensureChar(dateTime, curPos, 'T'); + curPos++; + + // parse hour + hour = parseInt(dateTime, curPos, 2); + ensureValue(hour, 0, 23, curPos); + curPos += 2; + + // parse ':' + ensureChar(dateTime, curPos, ':'); + curPos++; + + // parse minute + minute = parseInt(dateTime, curPos, 2); + ensureValue(minute, 0, 59, curPos); + curPos += 2; + + // parse ':' + ensureChar(dateTime, curPos, ':'); + curPos++; + + // parse second + second = parseInt(dateTime, curPos, 2); + ensureValue(second, 0, 59, curPos); + curPos += 2; + + // parse a fraction + if (dateTime.length() > curPos && dateTime.charAt(curPos) == '.') { + curPos++; + ensureDigits(dateTime, curPos, 1); + fractStr = "0."; + fractStr + += dateTime.substring(curPos, curPos + countDigits(dateTime, curPos)); + fraction = Double.parseDouble(fractStr); + curPos += countDigits(dateTime, curPos); + } + + // parse a time zone + if (dateTime.length() > curPos) { + c = dateTime.charAt(curPos); + if (c == 'Z') { + curPos++; + } else if (c == '+' || c == '-') { + // parse time zone sign + tzSign = c == '+' ? 1 : -1; + curPos++; + + // parse time zone hour + tzHour = parseInt(dateTime, curPos, 2); + ensureValue(tzHour, 0, 14, curPos); + curPos += 2; + + // parse ':' + ensureChar(dateTime, curPos, ':'); + curPos++; + + // parse time zone minute + tzMinute = parseInt(dateTime, curPos, 2); + ensureValue(tzMinute, 0, 59, curPos); + curPos += 2; + } + } else { + localTime = true; + } + + // if we have characters left, it's an error + if (dateTime.length() != curPos) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + + // build the Date object + year = year * yearSign; + try { + calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT")); + calendar.set(year, month - 1, day, hour, minute, second); + calendar.set(Calendar.MILLISECOND, 0); + time = calendar.getTime().getTime(); + time += (long) (fraction * 1000.0); + time -= tzSign * ((tzHour * 60) + tzMinute) * 60 * 1000; + if (localTime) { + time -= TimeZone.getDefault().getRawOffset(); + } + return new Date(time); + } catch (IllegalArgumentException e) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + + } + + /** + * Parse an integer value. + * + * @param str The String containing the digits. + * @param curPos The starting position. + * @param digits The number of digist making up the integer value. + * @return int The integer representation of the digits contained in + * str. + * @throws ParseException Parsing the integer value failed. + */ + private static int parseInt(String str, int curPos, int digits) + throws ParseException { + + ensureDigits(str, curPos, digits); + return Integer.parseInt(str.substring(curPos, curPos + digits)); + } + + /** + * Count the number of digits following curPos. + * + * @param str The String in which to count digits. + * @param curPos The starting position. + * @return int The number of digits. + */ + private static int countDigits(String str, int curPos) { + int i; + + for (i = curPos; i < str.length() && Character.isDigit(str.charAt(i)); i++); + return i - curPos; + } + + /** + * Ensure that a value falls in a given min/max range. + * + * @param value The value to check. + * @param min The minimum allowed value. + * @param max The maximum allowed value. + * @param curPos To indicate the parsing position in the + * ParseException. + * @throws ParseException Thrown, if value < min || value > + * max + */ + private static void ensureValue(int value, int min, int max, int curPos) + throws ParseException { + + if (value < min || value > max) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + + /** + * Ensure that the given String has a number of characters left. + * + * @param str The String to check for its length. + * @param curPos The starting position. + * @param count The minimum number of characters that str must + * contain, starting at from curPos. + * @throws ParseException Thrown, if + * curPos + count > str.length(). + */ + private static void ensureChars(String str, int curPos, int count) + throws ParseException { + if (curPos + count > str.length()) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + + /** + * Ensure that a given String contains a certain character at a + * certain position. + * + * @param str The String in which to look up the character. + * @param curPos The position in str that must contain the + * character. + * @param c The character value that must be contained at position + * curPos. + * @throws ParseException Thrown, if the characters do not match or + * curPos is out of range. + */ + private static void ensureChar(String str, int curPos, char c) + throws ParseException { + + ensureChars(str, curPos, 1); + if (str.charAt(curPos) != c) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + + /** + * Ensure that a given String contains a number of digits, + * starting at a given position. + * + * @param str The String to scan for digits. + * @param curPos The starting postion. + * @param count The number of digits that must be contained in + * str, starting at curPos. + * @throws ParseException Thrown, if str is not long enough, or + * one of the characters following curPos in str is + * not a digit. + */ + private static void ensureDigits(String str, int curPos, int count) + throws ParseException { + + ensureChars(str, curPos, count); + for (int i = curPos; i < curPos + count; i++) { + if (!Character.isDigit(str.charAt(i))) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + } + + /** + * Calculates the age if date of birth is given (for a calendar time stamp) + * @param dateOfBirth Date of Birth + * @param now Calendar time stamp at which the age needs to be calculated for + * @return Age of a person + */ + public static int calcAge(Calendar dateOfBirth, Calendar now) { + int age = now.get(Calendar.YEAR) - dateOfBirth.get(Calendar.YEAR); + + int nowM = now.get(Calendar.MONTH); + int dobM = dateOfBirth.get(Calendar.MONTH); + int nowDOM = now.get(Calendar.DAY_OF_MONTH); + int dobDOM = dateOfBirth.get(Calendar.DAY_OF_MONTH); + + if ((nowM < dobM) || ((nowM == dobM) && (nowDOM < dobDOM))) { + age--; + } + + if (age < 0) { + throw new IllegalArgumentException("Calculated age results in negative value."); + } + return age; + } + + /** + * Calculates the age if date of birth is given as Calendar object + * @param dateOfBirth Date of Birth as Calendar object + * @return Age of a person + */ + public static int calcAge(Calendar dateOfBirth) { + return calcAge(dateOfBirth, Calendar.getInstance()); + } + + /** + * Calculates the age if date of birth is given (for a date time stamp) + * @param dateOfBirth Date of Birth + * @param now Date time stamp at which the age needs to be calculated for + * @return Age of a person + */ + public static int calcAge(Date dateOfBirth, Date now) { + Calendar dob = Calendar.getInstance(); + dob.setTime(dateOfBirth); + Calendar nowCal = Calendar.getInstance(); + nowCal.setTime(now); + return calcAge(dob, nowCal); + } + + /** + * Calculates the age if date of birth is given as Date object + * @param dateOfBirth Date of Birth as Date object + * @return Age of a person + */ + public static int calcAge(Date dateOfBirth) { + return calcAge(dateOfBirth, new Date()); + } + + public static String formatPEPSDateToMOADate(String pepsDate) { + + if (StringUtils.isEmpty(pepsDate)) { + return null; + } + + DateTimeFormatter fmt = null; + + switch (pepsDate.length()) { + case 4: + fmt = DateTimeFormat.forPattern("yyyy"); + break; + case 6: + fmt = DateTimeFormat.forPattern("yyyyMM"); + break; + case 8: + fmt = DateTimeFormat.forPattern("yyyyMMdd"); + break; + default: + fmt = DateTimeFormat.forPattern("yyyy-MM-dd"); + break; + } + + DateTime dt = fmt.parseDateTime(pepsDate); + DateTimeFormatter fmt2 = DateTimeFormat.forPattern("yyyy-MM-dd"); + return fmt2.print(dt); + + } + + /** + * Returns a date as String using a provided format + * @param format Format the date/time should be returned + * @return Date/Time as String formatted according the provided format + */ + public static String getDateTimeWithFormat(String format) { + DateFormat dateFormat = new SimpleDateFormat(format); + Date date = new Date(); + return dateFormat.format(date); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Empty.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Empty.java new file mode 100644 index 0000000..9c678d4 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Empty.java @@ -0,0 +1,31 @@ +/* + * Copyright 2011 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.moaspss.util; + +/** + * @author Thomas Knall + */ +public interface Empty { + + /** + * Returns {@code true} if underlying object is empty. + * + * @return {@code true} if empty, {@code false} if not empty. + */ + boolean isEmpty(); + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/EntityResolverChain.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/EntityResolverChain.java new file mode 100644 index 0000000..487c6a4 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/EntityResolverChain.java @@ -0,0 +1,76 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Implementation of the org.xml.sax.EntityResolver, + * for use by a org.apache.xerces.parsers.DOMParser. + * + * @author Patrick Peck + * @version $Id$ + */ +public class EntityResolverChain implements EntityResolver { + /** The EntityResolvers in the chain. */ + private List resolvers = new ArrayList(); + + /** + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + */ + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + + Iterator iter; + + for (iter = resolvers.iterator(); iter.hasNext(); ) { + EntityResolver resolver = (EntityResolver) iter.next(); + InputSource is = resolver.resolveEntity(publicId, systemId); + + if (is != null) { + return is; + } + } + + return null; + } + + /** + * Add an EntityResolver to the chain. + * + * @param entityResolver The EntityResolver to add. + */ + public void addEntityResolver(EntityResolver entityResolver) { + resolvers.add(entityResolver); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/FileUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/FileUtils.java new file mode 100644 index 0000000..309e01a --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/FileUtils.java @@ -0,0 +1,179 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; + +/** + * Utility for accessing files on the file system, and for reading from input streams. + * @author Paul Ivancsics + * @version $Id$ + */ +public class FileUtils { + + /** + * Reads a file, given by URL, into a byte array. + * @param urlString file URL + * @return file content + * @throws IOException on any exception thrown + */ + public static byte[] readURL(String urlString) throws IOException { + URL url = new URL(urlString); + InputStream in = new BufferedInputStream(url.openStream()); + byte[] content = StreamUtils.readStream(in); + in.close(); + return content; + } + /** + * Reads a file, given by URL, into a String. + * @param urlString file URL + * @param encoding character encoding + * @return file content + * @throws IOException on any exception thrown + */ + public static String readURL(String urlString, String encoding) throws IOException { + byte[] content = readURL(urlString); + return new String(content, encoding); + } + /** + * Reads a file, given by filename, into a byte array. + * @param filename filename + * @return file content + * @throws IOException on any exception thrown + */ + public static byte[] readFile(String filename) throws IOException { + BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename)); + byte[] content = StreamUtils.readStream(in); + in.close(); + return content; + } + /** + * Reads a file, given by filename, into a String. + * @param filename filename + * @param encoding character encoding + * @return file content + * @throws IOException on any exception thrown + */ + public static String readFile(String filename, String encoding) throws IOException { + byte[] content = readFile(filename); + return new String(content, encoding); + } + /** + * Reads a file from a resource. + * @param name resource name + * @return file content as a byte array + * @throws IOException on any exception thrown + */ + public static byte[] readResource(String name) throws IOException { + ClassLoader cl = FileUtils.class.getClassLoader(); + BufferedInputStream in = new BufferedInputStream(cl.getResourceAsStream(name)); + byte[] content = StreamUtils.readStream(in); + in.close(); + return content; + } + /** + * Reads a file from a resource. + * @param name filename + * @param encoding character encoding + * @return file content + * @throws IOException on any exception thrown + */ + public static String readResource(String name, String encoding) throws IOException { + byte[] content = readResource(name); + return new String(content, encoding); + } + + /** + * Returns the absolute URL of a given url which is relative to the parameter root + * @param url + * @param root + * @return String + */ + public static String makeAbsoluteURL(String url, String root) { + //if url is relative to rootConfigFileDirName make it absolute + + File keyFile; + String newURL = url; + + if(null == url) return null; + + if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith("ftp:/")) { + return url; + } else { + // check if absolute - if not make it absolute + keyFile = new File(url); + if (!keyFile.isAbsolute()) { + keyFile = new File(root, url); + + if (keyFile.toString().startsWith("file:")) + newURL = keyFile.toString(); + + else + newURL = keyFile.toURI().toString(); + + } + return newURL; + } + } + + + private static void copy( InputStream fis, OutputStream fos ) + { + try + { + byte[] buffer = new byte[ 0xFFFF ]; + for ( int len; (len = fis.read(buffer)) != -1; ) + fos.write( buffer, 0, len ); + } + catch( IOException e ) { + System.err.println( e ); + } + finally { + if ( fis != null ) + try { fis.close(); } catch ( IOException e ) { e.printStackTrace(); } + if ( fos != null ) + try { fos.close(); } catch ( IOException e ) { e.printStackTrace(); } + } + } + + public static void copyFile(File src, File dest) + { + try + { + copy( new FileInputStream( src ), new FileOutputStream( dest ) ); + } + catch( IOException e ) { + e.printStackTrace(); + } + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/KeyStoreUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/KeyStoreUtils.java new file mode 100644 index 0000000..b4d7b02 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/KeyStoreUtils.java @@ -0,0 +1,223 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import iaik.x509.X509Certificate; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.cert.Certificate; + +/** + * Utility for creating and loading key stores. + * + * @author Paul Ivancsics + * @version $Id$ + */ +public class KeyStoreUtils { + + /** + * JAVA KeyStore + */ + private static final String KEYSTORE_TYPE_JKS = "JKS"; + + /** + * PKCS12 KeyStore + */ + private static final String KEYSTORE_TYPE_PKCS12 = "PKCS12"; + + + + /** + * Loads a key store from file. + * + * @param keystoreType key store type + * @param urlString URL of key store + * @param password password protecting the key store + * @return key store loaded + * @throws IOException thrown while reading the key store from file + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore loadKeyStore( + String keystoreType, + String urlString, + String password) + throws IOException, GeneralSecurityException { + + URL keystoreURL = new URL(urlString); + InputStream in = keystoreURL.openStream(); + return loadKeyStore(keystoreType, in, password); + } + /** + * Loads a key store from an InputStream, and + * closes the InputStream. + * + * @param keystoreType key store type + * @param in input stream + * @param password password protecting the key store + * @return key store loaded + * @throws IOException thrown while reading the key store from the stream + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore loadKeyStore( + String keystoreType, + InputStream in, + String password) + throws IOException, GeneralSecurityException { + + char[] chPassword = null; + if (password != null) + chPassword = password.toCharArray(); + KeyStore ks = KeyStore.getInstance(keystoreType); + ks.load(in, chPassword); + in.close(); + return ks; + } + /** + * Creates a key store from X509 certificate files, aliasing them with + * the index in the String[], starting with "0". + * + * @param keyStoreType key store type + * @param certFilenames certificate filenames + * @return key store created + * @throws IOException thrown while reading the certificates from file + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore createKeyStore( + String keyStoreType, + String[] certFilenames) + throws IOException, GeneralSecurityException { + + KeyStore ks = KeyStore.getInstance(keyStoreType); + ks.load(null, null); + for (int i = 0; i < certFilenames.length; i++) { + Certificate cert = loadCertificate(certFilenames[i]); + ks.setCertificateEntry("" + i, cert); + } + return ks; + } + /** + * Creates a key store from a directory containg X509 certificate files, + * aliasing them with the index in the String[], starting with "0". + * All the files in the directory are considered to be certificates. + * + * @param keyStoreType key store type + * @param certDirURLString file URL of directory containing certificate filenames + * @return key store created + * @throws IOException thrown while reading the certificates from file + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore createKeyStoreFromCertificateDirectory( + String keyStoreType, + String certDirURLString) + throws IOException, GeneralSecurityException { + + URL certDirURL = new URL(certDirURLString); + String certDirname = certDirURL.getFile(); + File certDir = new File(certDirname); + String[] certFilenames = certDir.list(); + String separator = + (certDirname.endsWith(File.separator) ? "" : File.separator); + for (int i = 0; i < certFilenames.length; i++) { + certFilenames[i] = certDirname + separator + certFilenames[i]; + } + return createKeyStore(keyStoreType, certFilenames); + } + + /** + * Loads an X509 certificate from file. + * @param certFilename filename + * @return the certificate loaded + * @throws IOException thrown while reading the certificate from file + * @throws GeneralSecurityException thrown while creating the certificate + */ + private static Certificate loadCertificate(String certFilename) + throws IOException, GeneralSecurityException { + + FileInputStream in = new FileInputStream(certFilename); + Certificate cert = new X509Certificate(in); + in.close(); + return cert; + } + + + /** + * Loads a keyStore without knowing the keyStore type + * @param keyStorePath URL to the keyStore + * @param password Password protecting the keyStore + * @return keyStore loaded + * @throws KeyStoreException thrown if keyStore cannot be loaded + * @throws FileNotFoundException + * @throws IOException + */ + public static KeyStore loadKeyStore(String keyStorePath, String password) throws KeyStoreException, IOException{ + + //InputStream is = new FileInputStream(keyStorePath); + URL keystoreURL = new URL(keyStorePath); + InputStream in = keystoreURL.openStream(); + InputStream isBuffered = new BufferedInputStream(in); + return loadKeyStore(isBuffered, password); + + } + + /** + * Loads a keyStore without knowing the keyStore type + * @param in input stream + * @param password Password protecting the keyStore + * @return keyStore loaded + * @throws KeyStoreException thrown if keyStore cannot be loaded + * @throws FileNotFoundException + * @throws IOException + */ +public static KeyStore loadKeyStore(InputStream is, String password) throws KeyStoreException, IOException{ + is.mark(1024*1024); + KeyStore ks = null; + try { + try { + ks = loadKeyStore(KEYSTORE_TYPE_PKCS12, is, password); + } catch (IOException e2) { + is.reset(); + ks = loadKeyStore(KEYSTORE_TYPE_JKS, is, password); + } + } catch(Exception e) { + e.printStackTrace(); + //throw new KeyStoreException(e); + } + return ks; + + } + + + + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOADefaultHandler.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOADefaultHandler.java new file mode 100644 index 0000000..3dde827 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOADefaultHandler.java @@ -0,0 +1,106 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.IOException; + +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * A DefaultHandler that uses a MOAEntityResolver and + * a MOAErrorHandler. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MOADefaultHandler extends DefaultHandler { + /** The EntityResolver to use. */ + private EntityResolver entityResolver; + /** The ErrorHandler to use. */ + private ErrorHandler errorHandler; + + /** + * Create a new MOADefaultHandler. + */ + public MOADefaultHandler() { + entityResolver = new MOAEntityResolver(); + errorHandler = new MOAErrorHandler(); + } + + /** + * Create a new MOADefaultHandler. + * + * @param entityResolver The EntityResolver to use for resolving + * external entities. + * @param errorHandler The ErrorHandler to use for reporting + * parsing errors. + */ + public MOADefaultHandler( + EntityResolver entityResolver, + ErrorHandler errorHandler) { + + this.entityResolver = entityResolver; + this.errorHandler = errorHandler; + } + + /** + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + */ + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException { + try { + return entityResolver.resolveEntity(publicId, systemId); + } catch (IOException e) { + return null; + } + } + + /** + * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) + */ + public void warning(SAXParseException exception) throws SAXException { + errorHandler.warning(exception); + } + + /** + * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) + */ + public void error(SAXParseException exception) throws SAXException { + errorHandler.error(exception); + } + + /** + * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) + */ + public void fatalError(SAXParseException exception) throws SAXException { + errorHandler.fatalError(exception); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java new file mode 100644 index 0000000..7f529ca --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java @@ -0,0 +1,129 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.InputStream; + +import org.apache.xerces.util.URI; +import org.apache.xerces.util.URI.MalformedURIException; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; + +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; + +/** + * An EntityResolver that looks up entities stored as + * local resources. + * + *

The following DTDs are mapped to local resources: + *

    + *
  • The XMLSchema.dtd
  • + *
  • The datatypes.dtd
  • + *
+ *

+ *

For all other resources, an attempt is made to resolve them as resources, + * either absolute or relative to Constants.SCHEMA_ROOT. + * + * @author Patrick Peck + * @author Sven Aigner + */ +public class MOAEntityResolver implements EntityResolver { + + /** + * Resolve an entity. + * + * The systemId parameter is used to perform the lookup of the + * entity as a resource, either by interpreting the systemId as + * an absolute resource path, or by appending the last path component of + * systemId to Constants.SCHEMA_ROOT. + * + * @param publicId The public ID of the resource. + * @param systemId The system ID of the resource. + * @return An InputSource from which the entity can be read, or + * null, if the entity could not be found. + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + */ + public InputSource resolveEntity(String publicId, String systemId) { + InputStream stream; + int slashPos; + + if (Logger.isDebugEnabled()) { + Logger.debug( + new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId)); + } + + if (publicId != null) { + // check if we can resolve some standard dtd's + if (publicId.equalsIgnoreCase("-//W3C//DTD XMLSchema 200102//EN")) { + return new InputSource( + getClass().getResourceAsStream( + Constants.SCHEMA_ROOT + "XMLSchema.dtd")); + } else if (publicId.equalsIgnoreCase("datatypes")) { + return new InputSource( + getClass().getResourceAsStream( + Constants.SCHEMA_ROOT + "datatypes.dtd")); + } + } else if (systemId != null) { + // get the URI path + try { + URI uri = new URI(systemId); + systemId = uri.getPath(); + + if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) { + return null; + } + + } catch (MalformedURIException e) { + return null; + } + + // try to get the resource from the full path + stream = getClass().getResourceAsStream(systemId); + if (stream != null) { + InputSource source = new InputSource(stream); + + source.setSystemId(systemId); + return source; + } + + // try to get the resource from the last path component + slashPos = systemId.lastIndexOf('/'); + if (slashPos >= 0 && systemId.length() > slashPos) { + systemId = systemId.substring(slashPos + 1, systemId.length()); + stream = + getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId); + if (stream != null) { + InputSource source = new InputSource(stream); + + source.setSystemId(systemId); + return source; + } + } + } + + return null; // nothing found - let the parser handle the entity + } +} \ No newline at end of file diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java new file mode 100644 index 0000000..1842d03 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java @@ -0,0 +1,115 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import org.apache.xml.utils.DefaultErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; + +/** + * An ErrorHandler that logs a message and throws a + * SAXException upon error and fatal + * parsing errors. + * + * @author Patrick Peck + * @author Sven Aigner + */ +public class MOAErrorHandler extends DefaultErrorHandler { + + + /** + * Logs a warning message. + * + * @see org.xml.sax.ErrorHandler#warning(SAXParseException) + */ + public void warning(SAXParseException exception) throws SAXException { + warn("parser.00", messageParams(exception), null); + } + + /** + * Logs a warning and rethrows the exception. + * + * @see org.xml.sax.ErrorHandler#error(SAXParseException) + */ + public void error(SAXParseException exception) throws SAXException { + warn("parser.01", messageParams(exception), null); + + // if Target attribute is missing in QualifyingProperties - don't throw exception (bug fix for old MOCCA signatures) + if (exception.getMessage().startsWith("cvc-complex-type.4: Attribute 'Target' must appear on element")) + warn("parser.04", new Object[] {"Attribute 'Target' must appear on element 'QualifyingProperties' - ignored for compatibility reasons."}, null); + else + throw exception; + } + + /** + * Logs a warning and rethrows the exception. + * + * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) + */ + public void fatalError(SAXParseException exception) throws SAXException { + warn("parser.02", messageParams(exception), null); + throw exception; + } + + /** + * Log a warning message. + * + * @param messageId The message ID to log. + * @param parameters Additional message parameters. + * @param t The Throwable to log; usually the cause of this + * warning. + */ + private static void warn( + String messageId, + Object[] parameters, + Throwable t) { + + MessageProvider msg = MessageProvider.getInstance(); + Logger.warn(new LogMsg(msg.getMessage(messageId, parameters)), t); + } + + /** + * Put the system id, line and column number information from the exception + * into an Object array, to provide it as a + * MessageFormat parameter. + * + * @param e The SAXParseException containing the + * source system id and line/column numbers. + * @return An array containing the system id (a String) as well + * as line/column numbers (2 Integer objects) from the + * SAXParseException. + */ + private static Object[] messageParams(SAXParseException e) { + return new Object[] { + e.getMessage(), + e.getSystemId(), + new Integer(e.getLineNumber()), + new Integer(e.getColumnNumber())}; + } + +} \ No newline at end of file diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOATimer.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOATimer.java new file mode 100644 index 0000000..8542b58 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOATimer.java @@ -0,0 +1,134 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.util.Map; +import java.util.WeakHashMap; + +/** + * A timer utility for named timers. + * + * @author Sven Aigner + */ +public class MOATimer { + + /** The single instance of this class. */ + private static MOATimer instance = null; + /** The starting points of single timings. */ + private static Map timemapstart = new WeakHashMap(); + /** The end points of single timings. */ + private static Map timemapend = new WeakHashMap(); + + /** + * Return the single instance of this class. + * + * @return The single instance of this class. + */ + public static MOATimer getInstance() { + if (instance == null) { + instance = new MOATimer(); + } + return instance; + } + + /** + * Create a new MOATimer. + * + * Protected to disallow multiple instances. + */ + protected MOATimer() { + super(); + } + + /** + * Start timing a certain action. + * + * The timing belonging to the action ID is garbage collected as soon as there + * exists no other reference to the action ID. + * + * @param id The action ID. + */ + public void startTiming(Object id) { + timemapstart.put(id, new Long(System.currentTimeMillis())); + } + + /** + * Stop timing an action. + * + * @param id The action ID. + */ + public void stopTiming(Object id) { + timemapend.put(id, new Long(System.currentTimeMillis())); + } + + /** + * Get the duration of an action. + * + * @param id The action ID for which to compute the duration. + * @return long The duration in milliseconds between calls to + * startTiming() and stopTiming(). If + * only startTiming() has been called for the action, then + * current difference to the system time is returned. If no timing exists for + * the action, - 1 is returned. + */ + public long duration(Object id) { + if (timemapstart.containsKey(id)) { + long start = ((Long) timemapstart.get(id)).longValue(); + if (timemapend.containsKey(id)) { + long end = ((Long) timemapend.get(id)).longValue(); + return end - start; + } else { + return System.currentTimeMillis() - start; + } + } else + return -1; + } + + /** + * Get the duration of an action, as a nicely formatted String. + * + * @param id The action ID. + * @return String The duration() as a String. + */ + public String durationAsString(Object id) { + long dur = duration(id); + long second = dur / 1000; + long mil = (dur) - (second * 1000); + return "Duration: " + second + "." + mil + " seconds"; + } + + /** + * Remove a timing. + * + * @param id The action ID. + */ + public void clearTiming(String id) { + if (timemapstart.containsKey(id)) + timemapstart.remove(id); + if (timemapend.containsKey(id)) + timemapend.remove(id); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MessageProvider.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MessageProvider.java new file mode 100644 index 0000000..da97ea1 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MessageProvider.java @@ -0,0 +1,87 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.util.Locale; + +/** + * A singleton wrapper around a Message object. + * + * Provides the messages used in the common project. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MessageProvider { + /** The location of the default message resources. */ + private static final String[] DEFAULT_MESSAGE_RESOURCES = + { "resources/properties/common_messages" }; + /** The locale of the default message resources. */ + 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 this MessageProvider. */ + private Messages messages; + + /** + * Return the single instance of the MessageProvider. + * + * Intialilizes the MessageProvider with the default message + * locations: /resources/properties/common_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/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Messages.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Messages.java new file mode 100644 index 0000000..6e324b7 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Messages.java @@ -0,0 +1,141 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.text.MessageFormat; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.PropertyResourceBundle; + +import at.gv.egovernment.moaspss.logging.Logger; + +/** + * Provides access to the system messages resource used for exception handling + * and logging messages. + * + * Messages must be provided as a resource bundle at the path. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Messages { + /** Error message indicating that no messages are avaiable. */ + private static final String ERROR_MESSAGES_UNAVAILABLE = + "Fehler in der Server-Konfiguration. " + + "Die Fehlertexte konnten nicht geladen werden."; + /** Error message indicating that the message is not available. */ + private static final String ERROR_NO_MESSAGE = + "No errormesseage for error with number.={0}"; + + /** The names of the resources containing the messages. */ + private String[] resourceNames; + /** The corresponding Locales of the resources. */ + private Locale[] locales; + /** The ResourceBundles containing the messages. */ + private ResourceBundleChain messages; + + /** + * Create a new Message object containing the messages + * in the given resources. + * + * @param resourceNames The names of the resources containing the messages. + * @param locales The corresponding locales. + */ + public Messages(String[] resourceNames, Locale[] locales) { + this.resourceNames = resourceNames; + this.locales = locales; + this.messages = null; + } + + /** + * 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) { + // initialize messages + if (messages == null) { + initMessages(); + } + + // create the message + if (messages == null) { + return ERROR_MESSAGES_UNAVAILABLE; + } else { + try { + String rawMessage = messages.getString(messageId); + return MessageFormat.format(rawMessage, parameters); + } catch (MissingResourceException e2) { + // couldn't find any message -> set to default error message + return MessageFormat.format( + ERROR_NO_MESSAGE, + new Object[] { messageId }); + } + } + } + + /** + * Return the names of the resources containing the messages. + * + * @return String[] The names of the resource bundles containing the messages. + */ + private String[] getResourceNames() { + return resourceNames; + } + + /** + * Return the Locales of the resources containing the messages. + * + * @return Locale[] The Locales of the resource bundles + * containing the messages. + */ + private Locale[] getLocales() { + return locales; + } + + /** + * Initialize the messages ResourceBundle containing + * the MOA error messages. + */ + private void initMessages() { + messages = new ResourceBundleChain(); + int i; + + // initialize the message resources + for (i = 0; i < resourceNames.length; i++) { + try { + messages.addResourceBundle( + PropertyResourceBundle.getBundle( + getResourceNames()[i], + getLocales()[i])); + } catch (MissingResourceException e) { + Logger.error(ERROR_MESSAGES_UNAVAILABLE, e); + } + } + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MiscUtil.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MiscUtil.java new file mode 100644 index 0000000..5510ac8 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MiscUtil.java @@ -0,0 +1,303 @@ +/* + * Copyright 2011 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.moaspss.util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Iterator; +import java.util.Properties; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; + +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.ex.EgovUtilException; + + + +/** + * Class providing several utility methods. + * + * @author Arne Tauber + * + */ +public class MiscUtil { + + public static final String DEFAULT_SLASH = "/"; + + private static final int IO_BUFFER_SIZE = 4 * 1024; + + public static void copyStream(InputStream is, OutputStream os) throws IOException { + byte[] b = new byte[IO_BUFFER_SIZE]; + int read; + while ((read = is.read(b)) != -1) { + os.write(b, 0, read); + } + } + + public static void assertNotNull(Object param, String name) { + if (param == null) { + throw new NullPointerException(name + " must not be null."); + } + } + + public static boolean areAllNull(Object... objects) { + for (Object o : objects) { + if (o != null) { + return false; + } + } + return true; + } + + public static String extractContentType(String contentTypeString) { + if (contentTypeString == null) { + return ""; + } + if (contentTypeString.indexOf(";") != -1) { + return contentTypeString.substring(0, contentTypeString.indexOf(";")); + } + return contentTypeString; + } + + public static XMLGregorianCalendar getXMLGregorianCalendar(Date date) + throws DatatypeConfigurationException { + GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); + cal.setTime(date); + return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); + } + + public static XMLGregorianCalendar getXMLGregorianCalendar(String str) + throws DatatypeConfigurationException { + return DatatypeFactory.newInstance().newXMLGregorianCalendar(str); + } + + public static X509Certificate readCertificate(InputStream certStream) + throws CertificateException { + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + return (X509Certificate) cf.generateCertificate(certStream); + } + + public static boolean isEmpty(String str) { + return str == null || "".equals(str); + } + + public static boolean isNotEmpty(String str) { + return str != null && !"".equals(str); + } + + public static byte[] sourceToByteArray(Source result) + throws TransformerException { + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + StreamResult streamResult = new StreamResult(); + streamResult.setOutputStream(out); + transformer.transform(result, streamResult); + return out.toByteArray(); + } + +// public static Document parseDocument(InputStream inputStream) +// throws IOException { +// try { +// DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory +// .newInstance(); +// docBuilderFactory.setNamespaceAware(true); +// DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); +// return docBuilder.parse(inputStream); +// } catch (ParserConfigurationException e) { +// throw new IOException(e); +// } catch (SAXException e) { +// throw new IOException(e); +// } +// } + + public static String removePrecedingSlash(String path, String slash) { + assertNotEmpty(slash, "Shash"); + if (!isEmpty(path)) { + while (path.startsWith(slash)) { + path = path.substring(slash.length(), path.length()); + } + } + return path; + } + + public static String removePrecedingSlash(String path) { + return removePrecedingSlash(path, DEFAULT_SLASH); + } + + public static void assertNotEmpty(String param, String name) { + if (param == null) { + throw new NullPointerException(name + " must not be null."); + } + if (param.length() == 0) { + throw new IllegalArgumentException(name + " must not be empty."); + } + } + + @SuppressWarnings("rawtypes") + public static boolean isEmpty(Properties props) { + if (props == null || props.isEmpty()) { + return true; + } + Iterator it = props.values().iterator(); + while (it.hasNext()) { + if (MiscUtil.isNotEmpty((String) it.next())) { + return false; + } + } + return true; + } + + public static boolean isEmpty(Empty empty) { + return empty == null || empty.isEmpty(); + } + + public static boolean isNotEmpty(Empty empty) { + return !isEmpty(empty); + } + + public static boolean isEmpty(byte[] data) { + return data == null || data.length == 0; + } + + public static boolean isNotEmpty(byte[] data) { + return !isEmpty(data); + } + + public static boolean isEmpty(Collection c) { + return c == null || c.isEmpty(); + } + + public static boolean isNotEmpty(Collection c) { + return !isEmpty(c); + } + + public static boolean areAllEmpty(String... strings) { + for (String s : strings) { + if (s != null && s.trim().length() != 0) { + return false; + } + } + return true; + } + + public static boolean areAllEmpty(Empty... empties) { + if (empties != null) { + for (Empty e : empties) { + if (e != null && !e.isEmpty()) { + return false; + } + } + } + return true; + } + + public static void assertNotEmpty(T[] param, String name) { + if (param == null) { + throw new NullPointerException(name + " must not be null."); + } + if (param.length == 0) { + throw new IllegalArgumentException(name + " must not be empty."); + } + } + + public static void assertNotEmpty(Empty empty, String name) { + if (empty == null) { + throw new NullPointerException(name + " must not be null."); + } + if (empty.isEmpty()) { + throw new IllegalArgumentException(name + " must not be empty."); + } + } + + public static void assertNotEmpty(byte[] param, String name) { + if (param == null) { + throw new NullPointerException(name + " must not be null."); + } + if (param.length == 0) { + throw new IllegalArgumentException(name + " must not be empty."); + } + } + + public static Date parseXMLDate(String xmlDate) throws EgovUtilException { + if (xmlDate == null) { + return null; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { + return sdf.parse(xmlDate); + } catch (ParseException e) { + throw new EgovUtilException(e); + } + } + + public static boolean isEmpty(T[] array) { + return array == null || array.length == 0; + } + + public static boolean isNotEmpty(T[] array) { + return !isEmpty(array); + } + + public static String convertDateFromStandardToXML(String dateString) { + MiscUtil.assertNotNull(dateString, "dateString"); + Date date = parseDate(dateString); + return formatDate(date, "yyyy-MM-dd"); + } + + public static Date parseDate(String dateString) { + return parseDate(dateString, "dd.MM.yyyy"); + } + + public static Date parseDate(String dateString, String pattern) { + MiscUtil.assertNotNull(dateString, "dateString"); + MiscUtil.assertNotNull(pattern, "pattern"); + SimpleDateFormat sdf = new SimpleDateFormat(pattern); + try { + return sdf.parse(dateString); + } catch (ParseException e) { + Logger.warn("Error parsing date.", e); + return null; + } + } + + public static String formatDate(Date date, String format) { + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(date); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeIteratorAdapter.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeIteratorAdapter.java new file mode 100644 index 0000000..998edb4 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeIteratorAdapter.java @@ -0,0 +1,111 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.util.ListIterator; + +import org.w3c.dom.DOMException; +import org.w3c.dom.Node; +import org.w3c.dom.traversal.NodeFilter; +import org.w3c.dom.traversal.NodeIterator; + +/** + * A NodeIterator implementation based on a + * ListIterator. + * + * @see java.util.ListIterator + * @see org.w3c.dom.traversal.NodeIterator + * + * @author Patrick Peck + * @version $Id$ + */ +public class NodeIteratorAdapter implements NodeIterator { + + /** The ListIterator to wrap. */ + private ListIterator nodeIterator; + + /** + * Create a new NodeIteratorAdapter. + * @param nodeIterator The ListIterator to iterate over. + */ + public NodeIteratorAdapter(ListIterator nodeIterator) { + this.nodeIterator = nodeIterator; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getRoot() + */ + public Node getRoot() { + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getWhatToShow() + */ + public int getWhatToShow() { + return NodeFilter.SHOW_ALL; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getFilter() + */ + public NodeFilter getFilter() { + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getExpandEntityReferences() + */ + public boolean getExpandEntityReferences() { + return false; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#nextNode() + */ + public Node nextNode() throws DOMException { + if (nodeIterator.hasNext()) { + return (Node) nodeIterator.next(); + } + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#previousNode() + */ + public Node previousNode() throws DOMException { + if (nodeIterator.hasPrevious()) { + return (Node) nodeIterator.previous(); + } + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#detach() + */ + public void detach() { + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeListAdapter.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeListAdapter.java new file mode 100644 index 0000000..d88ef4b --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeListAdapter.java @@ -0,0 +1,68 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.util.List; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * A NodeList implementation based on a List. + * + * @see java.util.List + * @see org.w3c.dom.NodeList + * + * @author Patrick Peck + * @version $Id$ + */ +public class NodeListAdapter implements NodeList { + /** The List to wrap. */ + private List nodeList; + + /** + * Create a new NodeListAdapter. + * + * @param nodeList The List containing the nodes. + */ + public NodeListAdapter(List nodeList) { + this.nodeList = nodeList; + } + + /** + * @see org.w3c.dom.NodeList#item(int) + */ + public Node item(int index) { + return (Node) nodeList.get(index); + } + + /** + * @see org.w3c.dom.NodeList#getLength() + */ + public int getLength() { + return nodeList.size(); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/OutputXML2File.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/OutputXML2File.java new file mode 100644 index 0000000..e4e6cc5 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/OutputXML2File.java @@ -0,0 +1,102 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +/* + * Created on 26.04.2004 + * + * @author rschamberger + * $ID$ + */ +package at.gv.egovernment.moaspss.util; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moaspss.logging.Logger; + +/** + * utility functions to write XML data to files + * @author rschamberger + * @version $Id$ + */ +public class OutputXML2File { + + /** + * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) + * + * @param filename file name + * @param rootElem root element in DOM tree + * @param hierarchy of the Logger + */ + public static void debugOutputXML2File(String filename, Element rootElem, String hierarchy) { + if (Logger.isDebugEnabled(hierarchy)) { + outputXML2File(filename, rootElem); + } + } + + /** + * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) + * + * @param filename file name + * @param xmlString XML string + * @param hierarchy of the Logger + */ + public static void debugOutputXML2File(String filename, String xmlString, String hierarchy) { + if (Logger.isDebugEnabled(hierarchy)) { + outputXML2File(filename, xmlString); + } + } + + /** + * writes an XML structure to file (Encoding: UTF-8) + * + * @param filename file name + * @param rootElem root element in DOM tree + */ + public static void outputXML2File(String filename, Element rootElem) { + try { + String xmlString = new String(DOMUtils.serializeNode(rootElem)); + outputXML2File(filename, xmlString); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + /** + * writes an XML structure to file (Encoding: UTF-8) + * + * @param filename file name + * @param xmlString XML string + */ + public static void outputXML2File(String filename, String xmlString) { + try { + java.io.OutputStream fout = new java.io.FileOutputStream(filename); + byte[] xmlData = xmlString.getBytes("UTF-8"); + fout.write(xmlData); + fout.close(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ResourceBundleChain.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ResourceBundleChain.java new file mode 100644 index 0000000..1edad95 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ResourceBundleChain.java @@ -0,0 +1,90 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * A class to chain ResourceBundles. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ResourceBundleChain { + /** Error message indicating the resource is not available. */ + private static final String ERROR_MISSING_RESOURCE = "Missing resource"; + /** The ResourceBundles contained in this chain. */ + private List resourceBundles = new ArrayList(); + + /** + * Add a ResourceBundle to the chain. + * + * @param resourceBundle The ResourceBundle to add. + */ + public void addResourceBundle(ResourceBundle resourceBundle) { + resourceBundles.add(resourceBundle); + } + + /** + * Return the value of the resource. + * + * @param key The key to access the String resource. + * @return The resource value. All the registered ResourceBundles + * are searched in the order in which they have previously been added to this + * ResourceBundleChain. + * @throws MissingResourceException The resource coult not be found in any of + * the bundles. + */ + public String getString(String key) throws MissingResourceException { + MissingResourceException lastException = null; + Iterator iter; + + // handle case where no resource bundles have been added + if (resourceBundles.size() == 0) { + throw new MissingResourceException( + ERROR_MISSING_RESOURCE, + this.getClass().getName(), + key); + } + + // try to find the resource in one of the bundles; if it cannot be found, + // return the exception thrown by the last bundle in the list + for (iter = resourceBundles.iterator(); iter.hasNext();) { + ResourceBundle resourceBundle = (ResourceBundle) iter.next(); + try { + String value = resourceBundle.getString(key); + return value; + } catch (MissingResourceException e) { + lastException = e; + } + } + throw lastException; + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/SSLUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/SSLUtils.java new file mode 100644 index 0000000..5078f01 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/SSLUtils.java @@ -0,0 +1,244 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.IOException; +import java.io.InputStream; +import java.security.GeneralSecurityException; +import java.security.KeyStore; + +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; + +/** + * Utility for connecting to server applications via SSL. + * + * @author Paul Ivancsics + * @version $Id$ + */ +public class SSLUtils { + + /** + * Creates an SSLSocketFactory which utilizes the given trust store. + * + * @param trustStoreType key store type of trust store + * @param trustStoreInputStream input stream for reading JKS trust store containing + * trusted server certificates; if null, the default + * trust store will be utilized + * @param trustStorePassword if provided, it will be used to check + * the integrity of the trust store; if omitted, it will not be checked + * @return SSLSocketFactory to be used by an HttpsURLConnection + * @throws IOException thrown while reading from the input stream + * @throws GeneralSecurityException thrown while creating the socket factory + */ + public static SSLSocketFactory getSSLSocketFactory( + String trustStoreType, + InputStream trustStoreInputStream, + String trustStorePassword) + throws IOException, GeneralSecurityException { + + TrustManager[] tms = getTrustManagers(trustStoreType, trustStoreInputStream, trustStorePassword); + SSLContext ctx = SSLContext.getInstance("TLS"); + ctx.init(null, tms, null); + + SSLSocketFactory sf = ctx.getSocketFactory(); + return sf; + } + /** + * Creates an SSLSocketFactory which utilizes the + * given trust store and keystore. + * + * @param trustStore trust store containing trusted server certificates; + * if null, the default trust store will be utilized + * @param clientKeyStoreType key store type of clientKeyStore + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if null, the default key store will be utilized + * @param clientKeyStorePassword if provided, it will be used to check + * the integrity of the client key store; if omitted, it will not be checked + * @return SSLSocketFactory to be used by an HttpsURLConnection + * @throws IOException thrown while reading key store file + * @throws GeneralSecurityException thrown while creating the socket factory + */ + public static SSLSocketFactory getSSLSocketFactory( + KeyStore trustStore, + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + SSLContext ctx = getSSLContext( + trustStore, clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + SSLSocketFactory sf = ctx.getSocketFactory(); + return sf; + } + /** + * Creates an SSLContext initialized for the + * given trust store and keystore. + * + * @param trustStore trust store containing trusted server certificates; + * if null, the default trust store will be utilized + * @param clientKeyStoreType key store type of clientKeyStore + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if null, the default key store will be utilized + * @param clientKeyStorePassword if provided, it will be used to check + * the integrity of the client key store; if omitted, it will not be checked + * @return SSLContext to be used for creating an SSLSocketFactory + * @throws IOException thrown while reading key store file + * @throws GeneralSecurityException thrown while creating the SSL context + */ + public static SSLContext getSSLContext( + KeyStore trustStore, + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + TrustManager[] tms = getTrustManagers(trustStore); + KeyManager[] kms = getKeyManagers(clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + SSLContext ctx = SSLContext.getInstance("TLS"); + ctx.init(kms, tms, null); + return ctx; + } + /** + * Loads the trust store from an input stream and gets the + * TrustManagers from a default TrustManagerFactory, + * initialized from the given trust store. + * @param trustStoreType key store type of trust store + * @param trustStoreInputStream input stream for reading JKS trust store containing + * trusted server certificates; if null, the default + * trust store will be utilized + * @param trustStorePassword if provided, it will be used to check + * the integrity of the trust store; if omitted, it will not be checked + * @return TrustManagers to be used for creating an + * SSLSocketFactory utilizing the given trust store + * @throws IOException thrown while reading from the input stream + * @throws GeneralSecurityException thrown while initializing the + * default TrustManagerFactory + */ + protected static TrustManager[] getTrustManagers( + String trustStoreType, + InputStream trustStoreInputStream, + String trustStorePassword) + throws IOException, GeneralSecurityException { + + if (trustStoreInputStream == null) + return null; + + // Set up the TrustStore to use. We need to load the file into + // a KeyStore instance. + KeyStore trustStore = KeyStoreUtils.loadKeyStore(trustStoreType, trustStoreInputStream, trustStorePassword); + return getTrustManagers(trustStore); + } + /** + * Gets the TrustManagers from a default TrustManagerFactory, + * initialized from the given trust store. + * + * @param trustStore the trust store to use + * @return TrustManagers to be used for creating an + * SSLSocketFactory utilizing the given trust store + * @throws GeneralSecurityException thrown while initializing the + * default TrustManagerFactory + */ + protected static TrustManager[] getTrustManagers(KeyStore trustStore) + throws GeneralSecurityException { + + if (trustStore == null) + return null; + + // Initialize the default TrustManagerFactory with this KeyStore + String alg=TrustManagerFactory.getDefaultAlgorithm(); + TrustManagerFactory tmFact=TrustManagerFactory.getInstance(alg); + tmFact.init(trustStore); + + // And now get the TrustManagers + TrustManager[] tms=tmFact.getTrustManagers(); + return tms; + } + /** + * Loads the client key store from file and gets the + * KeyManagers from a default KeyManagerFactory, + * initialized from the given client key store. + * @param clientKeyStoreType key store type of clientKeyStore + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if null, the default key store will be utilized + * @param clientKeyStorePassword password used to check the integrity of the client key store; + * if null, it will not be checked + * @return KeyManagers to be used for creating an + * SSLSocketFactory utilizing the given client key store + * @throws IOException thrown while reading from the key store file + * @throws GeneralSecurityException thrown while initializing the + * default KeyManagerFactory + */ + public static KeyManager[] getKeyManagers ( + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + if (clientKeyStoreURL == null) + return null; + + // Set up the KeyStore to use. We need to load the file into + // a KeyStore instance. + KeyStore clientKeyStore = KeyStoreUtils.loadKeyStore( + clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + return getKeyManagers(clientKeyStore, clientKeyStorePassword); + } + /** + * Gets the KeyManagers from a default KeyManagerFactory, + * initialized from the given client key store. + * @param clientKeyStore client key store + * @param clientKeyStorePassword if provided, it will be used to check + * the integrity of the client key store; if omitted, it will not be checked + * @return KeyManagers to be used for creating an + * SSLSocketFactory utilizing the given client key store + * @throws GeneralSecurityException thrown while initializing the + * default KeyManagerFactory + */ + public static KeyManager[] getKeyManagers ( + KeyStore clientKeyStore, + String clientKeyStorePassword) + throws GeneralSecurityException { + + if (clientKeyStore == null) + return null; + + // Now we initialize the default KeyManagerFactory with this KeyStore + String alg=KeyManagerFactory.getDefaultAlgorithm(); + KeyManagerFactory kmFact=KeyManagerFactory.getInstance(alg); + char[] password = null; + if (clientKeyStorePassword != null) + password = clientKeyStorePassword.toCharArray(); + kmFact.init(clientKeyStore, password); + + // And now get the KeyManagers + KeyManager[] kms=kmFact.getKeyManagers(); + return kms; + } +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamEntityResolver.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamEntityResolver.java new file mode 100644 index 0000000..5d328cf --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamEntityResolver.java @@ -0,0 +1,88 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * An EntityResolver that maps system IDs to + * InputStreams. + * + * @author Patrick Peck + * @version $Id$ + */ +public class StreamEntityResolver implements EntityResolver { + + /** A mapping from Public ID or System ID to an InputStream + * containing the entity. */ + private Map mappedEntities; + + /** + * Create a StreamEntityResolver. + * + * @param mappedEntities A mapping from public or system IDs + * (String objects) to InputStreams. + */ + public StreamEntityResolver(Map mappedEntities) { + this.mappedEntities = mappedEntities; + } + + /** + * Resolve an entity by looking it up in the mapped entities. + * + * First, the public ID is looked up in the mapping, then the system ID. + * + * @param publicId The public ID of the entity. + * @param systemId The system ID of the entity. + * @return An InputStream containing the entity or + * null if no entity could be found. + * @throws SAXException Signalling a parsing exception. + * @throws IOException Error reading the entity. + */ + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + + InputSource src = null; + + if (publicId != null && mappedEntities.get(publicId) != null) { + src = new InputSource((InputStream) mappedEntities.get(publicId)); + } else if (systemId != null && mappedEntities.get(systemId) != null) { + src = new InputSource((InputStream) mappedEntities.get(systemId)); + } + + if (src != null) { + src.setPublicId(publicId); + src.setSystemId(systemId); + } + + return src; + } +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamUtils.java new file mode 100644 index 0000000..f3abe9c --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamUtils.java @@ -0,0 +1,197 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintStream; + +/** + * Utility methods for streams. + * + * @author Patrick Peck + * @version $Id$ + */ +public class StreamUtils { + + /** + * Compare the contents of two InputStreams. + * + * @param is1 The 1st InputStream to compare. + * @param is2 The 2nd InputStream to compare. + * @return boolean true, if both streams contain the exactly the + * same content, false otherwise. + * @throws IOException An error occurred reading one of the streams. + */ + public static boolean compareStreams(InputStream is1, InputStream is2) + throws IOException { + + byte[] buf1 = new byte[256]; + byte[] buf2 = new byte[256]; + int length1; + int length2; + + try { + while (true) { + length1 = is1.read(buf1); + length2 = is2.read(buf2); + + if (length1 != length2) { + return false; + } + if (length1 <= 0) { + return true; + } + if (!compareBytes(buf1, buf2, length1)) { + return false; + } + } + } catch (IOException e) { + throw e; + } finally { + // close both streams + try { + is1.close(); + is2.close(); + } catch (IOException e) { + // ignore this + } + } + } + + /** + * Compare two byte arrays, up to a given maximum length. + * + * @param b1 1st byte array to compare. + * @param b2 2nd byte array to compare. + * @param length The maximum number of bytes to compare. + * @return true, if the byte arrays are equal, false + * otherwise. + */ + private static boolean compareBytes(byte[] b1, byte[] b2, int length) { + if (b1.length != b2.length) { + return false; + } + + for (int i = 0; i < b1.length && i < length; i++) { + if (b1[i] != b2[i]) { + return false; + } + } + + return true; + } + + /** + * Reads a byte array from a stream. + * @param in The InputStream to read. + * @return The bytes contained in the given InputStream. + * @throws IOException on any exception thrown + */ + public static byte[] readStream(InputStream in) throws IOException { + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + copyStream(in, out, null); + + /* + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int b; + while ((b = in.read()) >= 0) + out.write(b); + + */ + in.close(); + return out.toByteArray(); + } + + /** + * Reads a String from a stream, using given encoding. + * @param in The InputStream to read. + * @param encoding The character encoding to use for converting the bytes + * of the InputStream into a String. + * @return The content of the given InputStream converted into + * a String. + * @throws IOException on any exception thrown + */ + public static String readStream(InputStream in, String encoding) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + copyStream(in, out, null); + + /* + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int b; + while ((b = in.read()) >= 0) + out.write(b); + */ + in.close(); + return out.toString(encoding); + } + + /** + * Reads all data (until EOF is reached) from the given source to the + * destination stream. If the destination stream is null, all data is dropped. + * It uses the given buffer to read data and forward it. If the buffer is + * null, this method allocates a buffer. + * + * @param source The stream providing the data. + * @param destination The stream that takes the data. If this is null, all + * data from source will be read and discarded. + * @param buffer The buffer to use for forwarding. If it is null, the method + * allocates a buffer. + * @exception IOException If reading from the source or writing to the + * destination fails. + */ + private static void copyStream(InputStream source, OutputStream destination, byte[] buffer) throws IOException { + if (source == null) { + throw new NullPointerException("Argument \"source\" must not be null."); + } + if (buffer == null) { + buffer = new byte[8192]; + } + + if (destination != null) { + int bytesRead; + while ((bytesRead = source.read(buffer)) >= 0) { + destination.write(buffer, 0, bytesRead); + } + } else { + while (source.read(buffer) >= 0); + } + } + + /** + * Gets the stack trace of the Throwable passed in as a string. + * @param t The Throwable. + * @return a String representing the stack trace of the Throwable. + */ + public static String getStackTraceAsString(Throwable t) + { + ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream(); + t.printStackTrace(new PrintStream(stackTraceBIS)); + return new String(stackTraceBIS.toByteArray()); + } +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StringUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StringUtils.java new file mode 100644 index 0000000..695be18 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StringUtils.java @@ -0,0 +1,178 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.util.StringTokenizer; + +/** + * Utitility functions for string manipulations. + * + * @author Harald Bratko + */ +public class StringUtils { + + /** + * Removes all blanks and tabs from the given string. + * + * @param s The string to remove all blanks and tabs from. + * @return The input string with all blanks and tabs removed from. + */ + public static String removeBlanks(String s) { + StringTokenizer st = new StringTokenizer(s); + StringBuffer sb = new StringBuffer(s.length()); + while (st.hasMoreTokens()) { + sb.append(st.nextToken()); + } + return sb.toString(); + } + + /** + * Removes all occurences of the specified token from the the given string. + * + * @param s The string to remove all occurences of the specified token from. + * @return The input string with all occurences of the specified token removed from. + */ + public static String removeToken(String s, String token) { + StringTokenizer st = new StringTokenizer(s, token); + StringBuffer sb = new StringBuffer(s.length()); + while (st.hasMoreTokens()) { + sb.append(st.nextToken()); + } + return sb.toString(); + } + + /** + * Removes all leading zeros from the input string. + * + * @param s The string remove the leading zeros from. + * @return The input string with the leading zeros removed from. + */ + public static String deleteLeadingZeros(String s) { + StringBuffer sb = new StringBuffer(s); + int l = sb.length(); + int j = 0; + for (int i=0; is that matches the given + * search string by the given replace string. + * + * @param s The string where the replacement should take place. + * @param search The pattern that should be replaced. + * @param replace The string that should replace all each search + * string within s. + * @return A string where all occurrence of search are + * replaced with replace. + */ + public static String replaceAll (String s, String search, String replace) + { + StringBuffer sb = new StringBuffer(); + int i = 0, j = 0; + int len = search.length(); + while (j > -1) + { + j = s.indexOf(search, i); + + if (j > -1) + { + sb.append(s.substring(i,j)); + sb.append(replace); + i = j + len; + } + } + + sb.append(s.substring(i, s.length())); + + return sb.toString(); + } + + /** + * Changes the SecurityLayer version in the given string. + * This method usually takes as input an XML structure represented in a string + * format and changes the SecurityLayer namespaces prefixes and URIs from + * one SecurityLayer version to another. + * e.g.: code>sl10 to sl and + * http://www.buergerkarte.at/namespaces/securitylayer/20020225# + * to + * http://www.buergerkarte.at/namespaces/securitylayer/1.2# + * + * @param s The string (usally an XML structure) where the + * SecurityLayer version should be changed. + * @param slPrefixOld The SecurityLayer namespace prefix that should be + * replaced by the new one. + * @param slPrefixNew The new SecurityLayer namespace prefix that should + * replace the old one. + * @param slNSUriOld The SecurityLayer namespace URI that should be + * replaced by the new one. + * @param slNSUriNew The new SecurityLayer namespace URI that should + * replace the old one. + * @return A string where the SecurityLayer namespace prefixes + * and URIs are replaced by new ones. + */ + public static String changeSLVersion(String s, String slPrefixOld, String slPrefixNew, String slNSUriOld, String slNSUriNew) { + String retString = replaceAll(s, slPrefixOld, slPrefixNew); + retString = replaceAll(retString, slNSUriOld, slNSUriNew); + return retString ; + } + + /** + * Removes the XML declaration from an XML expression. + * + * @param xmlString XML expression as String + * + * @return XML expression, XML declaration removed + */ + public static String removeXMLDeclaration(String xmlString) { + if (xmlString!=null && xmlString.startsWith("application/x-www-form-urlencoded string using a specific encoding scheme. + * @param s the string to decode + * @param encoding name of character encoding + * @return the newly decoded string + * @throws UnsupportedEncodingException if the encoding is not supported + */ + public static String decode(String s, String encoding) throws UnsupportedEncodingException { + StringReader in = new StringReader(s); + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + for (int b = read(in); b >= 0; b = read(in)) + bout.write(b); + return bout.toString(encoding); + } + /** + * Decodes the next byte from the string reader. + * @param in string reader + * @return the next byte decoded; + * -1 upon end of string, on erroneous data, and on any exception caught + * @todo syntax check on string + */ + private static int read(StringReader in) { + try { + int b = in.read(); + if (b == '+') + return ' '; + if (b == '%') { + char[] hex = new char[2]; + if (in.read(hex, 0, 2) >= 0) { + String hexString = new String(hex); + return Integer.valueOf(hexString, 16).intValue(); + } + else + return -1; + } + return b; + } + catch (IOException ex) { + return -1; + } + catch (NumberFormatException ex) { + return -1; + } + } +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLEncoder.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLEncoder.java new file mode 100644 index 0000000..2aa7e22 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLEncoder.java @@ -0,0 +1,89 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.ByteArrayInputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; + +/** + * Translates a string into mime format "x-www-form-urlencoded". + * Provides a function missing in JDK 1.3. + * @author Paul Ivancsics + * @version $Id$ + */ +public class URLEncoder { + + /** + * Translates a string into x-www-form-urlencoded format. + * @param s the string to be translated + * @param encoding the encoding to use + * @return the translated string + * @throws UnsupportedEncodingException when the desired encoding is not supported + */ + public static String encode(String s, String encoding) throws UnsupportedEncodingException { +// if (MiscUtil.isEmpty(s)) +// return null; + byte[] barr = s.getBytes(encoding); + ByteArrayInputStream bin = new ByteArrayInputStream(barr); + StringWriter out = new StringWriter(); + for (int b = bin.read(); b >= 0; b = bin.read()) + encode(b, out); + return out.toString(); + } + + /** + * Encode a character. + * @param ch The character to encode. + * @param out The StringWriter containing the result. + */ + private static void encode(int ch, StringWriter out) { + if ((ch >= 'a' && ch <= 'z') + || (ch >= 'A' && ch <= 'Z') + || (ch >= '0' && ch <= '9') + || ch == '.' || ch == '-' || ch == '*' || ch == '_') + out.write(ch); + else if (ch == ' ') + out.write('+'); + else + encodeHex(ch, out); + } + + /** + * Encode a character as an escaped hex value. + * @param ch The character to encode. + * @param out The StringWriter containing the result. + */ + private static void encodeHex(int ch, StringWriter out) { + out.write('%'); + String hex = Integer.toHexString(ch).toUpperCase(); + if (hex.length() < 2) + out.write('0'); + else + out.write(hex.charAt(hex.length() - 2)); + out.write(hex.charAt(hex.length() - 1)); + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathException.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathException.java new file mode 100644 index 0000000..cbf3e4e --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathException.java @@ -0,0 +1,87 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.io.PrintStream; +import java.io.PrintWriter; + +/** + * An exception occurred evaluating an XPath. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPathException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = 1736311265333034392L; +/** The wrapped exception. */ + private Throwable wrapped; + + /** + * Create a XPathException. + * + * @param message The exception message. + * @param wrapped The exception being the likely cause of this exception. + */ + public XPathException(String message, Throwable wrapped) { + // TODO: remove wrapped from super cstr. again + super(message, wrapped); + this.wrapped = wrapped; + } + + /** + * Return the wrapped exception. + * + * @return The wrapped exception being the likely cause of this exception. + */ + public Throwable getWrapped() { + return wrapped; + } + + /** + * @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); + } + } + + /** + * @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/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathUtils.java new file mode 100644 index 0000000..2604c20 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathUtils.java @@ -0,0 +1,557 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moaspss.util; + +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.traversal.NodeIterator; + +import org.jaxen.JaxenException; +import org.jaxen.NamespaceContext; +import org.jaxen.Navigator; +import org.jaxen.SimpleNamespaceContext; +import org.jaxen.dom.DOMXPath; +import org.jaxen.dom.DocumentNavigator; + +/** + * Utility methods to evaluate XPath expressions on DOM nodes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPathUtils { + + /** + * The XPath expression selecting all nodes under a given root (including the + * root node itself). + */ + public static final String ALL_NODES_XPATH = + "(.//. | .//@* | .//namespace::*)"; + + /** The DocumentNavigator to use for navigating the document. */ + private static Navigator documentNavigator = + DocumentNavigator.getInstance(); + /** The default namespace prefix to namespace URI mappings. */ + private static NamespaceContext NS_CONTEXT; + + static { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + ctx.addNamespace(Constants.MOA_PREFIX, Constants.MOA_NS_URI); + ctx.addNamespace(Constants.MOA_CONFIG_PREFIX, Constants.MOA_CONFIG_NS_URI); + ctx.addNamespace(Constants.MOA_ID_CONFIG_PREFIX, Constants.MOA_ID_CONFIG_NS_URI); + ctx.addNamespace(Constants.SL10_PREFIX, Constants.SL10_NS_URI); + ctx.addNamespace(Constants.SL11_PREFIX, Constants.SL11_NS_URI); + ctx.addNamespace(Constants.SL12_PREFIX, Constants.SL12_NS_URI); + ctx.addNamespace(Constants.ECDSA_PREFIX, Constants.ECDSA_NS_URI); + ctx.addNamespace(Constants.PD_PREFIX, Constants.PD_NS_URI); + ctx.addNamespace(Constants.SAML_PREFIX, Constants.SAML_NS_URI); + ctx.addNamespace(Constants.SAMLP_PREFIX, Constants.SAMLP_NS_URI); + ctx.addNamespace(Constants.DSIG_PREFIX, Constants.DSIG_NS_URI); + ctx.addNamespace(Constants.XSLT_PREFIX, Constants.XSLT_NS_URI); + ctx.addNamespace(Constants.XSI_PREFIX, Constants.XSI_NS_URI); + ctx.addNamespace(Constants.DSIG_FILTER2_PREFIX, Constants.DSIG_FILTER2_NS_URI); + ctx.addNamespace(Constants.DSIG_EC_PREFIX, Constants.DSIG_EC_NS_URI); + ctx.addNamespace(Constants.MD_PREFIX, Constants.MD_NS_URI); + ctx.addNamespace(Constants.MDP_PREFIX, Constants.MDP_NS_URI); + ctx.addNamespace(Constants.MVV_PREFIX, Constants.MVV_NS_URI); + ctx.addNamespace(Constants.STB_PREFIX, Constants.STB_NS_URI); + ctx.addNamespace(Constants.WRR_PREFIX, Constants.WRR_NS_URI); + ctx.addNamespace(Constants.STORK_PREFIX, Constants.STORK_NS_URI); + ctx.addNamespace(Constants.STORKP_PREFIX, Constants.STORKP_NS_URI); + ctx.addNamespace(Constants.SAML2_PREFIX, Constants.SAML2_NS_URI); + ctx.addNamespace(Constants.SAML2P_PREFIX, Constants.SAML2P_NS_URI); + ctx.addNamespace(Constants.XENC_PREFIX, Constants.XENC_NS_URI); + ctx.addNamespace(Constants.XADES_1_1_1_NS_PREFIX, Constants.XADES_1_1_1_NS_URI); + NS_CONTEXT = ctx; + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * All namespace URIs and prefixes declared in the Constants + * interface are used for resolving namespaces. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeIterator selectNodeIterator(Node contextNode, String exp) + throws XPathException { + + return selectNodeIterator(contextNode, NS_CONTEXT, exp); + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the + * namespace mapping for evaluating the XPath expression + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeIterator selectNodeIterator( + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { + + try { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + ctx.addElementNamespaces(documentNavigator, namespaceElement); + return selectNodeIterator(contextNode, ctx, exp); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceMapping A namespace prefix to namespace URI mapping + * (String to String) for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeIterator selectNodeIterator( + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { + + SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + + return selectNodeIterator(contextNode, ctx, exp); + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param nsContext The NamespaceContext for resolving namespace + * prefixes to namespace URIs for evaluating the XPath expression. + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + private static NodeIterator selectNodeIterator( + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { + + try { + DOMXPath xpath = new DOMXPath(exp); + List nodes; + + xpath.setNamespaceContext(nsContext); + nodes = xpath.selectNodes(contextNode); + return new NodeIteratorAdapter(nodes.listIterator()); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * All namespace URIs and prefixes declared in the Constants + * interface are used for resolving namespaces. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeList selectNodeList(Node contextNode, String exp) + throws XPathException { + + return selectNodeList(contextNode, NS_CONTEXT, exp); + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the + * namespace mapping for evaluating the XPath expression + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeList selectNodeList( + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { + + try { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + + ctx.addElementNamespaces(documentNavigator, namespaceElement); + return selectNodeList(contextNode, ctx, exp); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceMapping A namespace prefix to namespace URI mapping + * (String to String) for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeList selectNodeList( + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { + + SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + + return selectNodeList(contextNode, ctx, exp); + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param nsContext The NamespaceContext for resolving namespace + * prefixes to namespace URIs for evaluating the XPath expression. + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + private static NodeList selectNodeList( + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { + + try { + DOMXPath xpath = new DOMXPath(exp); + List nodes; + + xpath.setNamespaceContext(nsContext); + nodes = xpath.selectNodes(contextNode); + return new NodeListAdapter(nodes); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Select the first node matching an XPath expression. + * + * All namespace URIs and prefixes declared in the Constants + * interface are used for resolving namespaces. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode(Node contextNode, String exp) + throws XPathException { + + return selectSingleNode(contextNode, NS_CONTEXT, exp); + } + + /** + * Select the first node matching an XPath expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the + * namespace mapping for evaluating the XPath expression + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode( + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { + + try { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + ctx.addElementNamespaces(documentNavigator, namespaceElement); + + return selectSingleNode(contextNode, ctx, exp); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Select the first node matching an XPath expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceMapping A namespace prefix to namespace URI mapping + * (String to String) for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode( + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { + + SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + + return selectSingleNode(contextNode, ctx, exp); + } + + /** + * Select the first node matching an XPath expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param nsContext The NamespaceContext for resolving namespace + * prefixes to namespace URIs for evaluating the XPath expression. + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode( + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { + + try { + DOMXPath xpath = new DOMXPath(exp); + xpath.setNamespaceContext(nsContext); + return (Node) xpath.selectSingleNode(contextNode); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return the value of a DOM element whose location is given by an XPath + * expression. + * + * @param root The root element from which to evaluate the XPath. + * @param xpath The XPath expression pointing to the element whose value + * to return. + * @param def The default value to return, if no element can be found using + * the given xpath. + * @return The element value, if it can be located using the + * xpath. Otherwise, def is returned. + */ + public static 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 a DOM attribute whose location is given by an XPath + * expression. + * + * @param root The root element from which to evaluate the XPath. + * @param xpath The XPath expression pointing to the attribute whose value to + * return. + * @param def The default value to return, if no attribute can be found using + * the given xpath. + * @return The element value, if it can be located using the + * xpath. Otherwise, def is returned. + */ + public static String getAttributeValue( + Element root, + String xpath, + String def) { + + Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); + return attr != null ? attr.getValue() : def; + } + + /** + * Returns the namespace prefix used within XPathUtils for referring to + * the namespace of the specified (Security Layer command) element. + * + * This namespace prefix can be used in various XPath expression evaluation methods + * within XPathUtils without explicitely binding it to the particular + * namespace. + * + * @param contextElement The (Security Layer command) element. + * + * @return the namespace prefix used within XPathUtils for referring to + * the namespace of the specified (Security Layer command) element. + * + * throws XpathException If the specified element has a namespace other than the ones + * known by this implementation as valid Security Layer namespaces (cf. + * @link Constants#SL10_NS_URI, @link Constants#SL11_NS_URI, @link Constants#SL12_NS_URI). + */ + public static String getSlPrefix (Element contextElement) throws XPathException + { + String sLNamespace = contextElement.getNamespaceURI(); + String sLPrefix = null; + + if (sLNamespace.equals(Constants.SL10_NS_URI)) + { + sLPrefix = Constants.SL10_PREFIX; + } + else if (sLNamespace.equals(Constants.SL12_NS_URI)) + { + sLPrefix = Constants.SL12_PREFIX; + } + else if (sLNamespace.equals(Constants.SL11_NS_URI)) + { + sLPrefix = Constants.SL11_PREFIX; + } + else + { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { "Ung�ltiger Security Layer Namespace: \"" + sLNamespace + "\"."}); + throw new XPathException(message, null); + } + + return sLPrefix; + } + + + /** + * Return the SecurityLayer namespace prefix of the context element. + * If the context element is not the element that lies within the + * SecurityLayer namespace. The Securitylayer namespace is derived from + * the xmlns:sl10, sl11 or sl + * attribute of the context element. + * + * The returned prefix is needed for evaluating XPATH expressions. + * + * @param contextElement The element to get a prefix for the Securitylayer namespace, + * that is used within the corresponding document. + * + * @return The string sl10, sl11 or sl, + * depending on the SecurityLayer namespace of the contextElement. + * + * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace + * is defined. + */ + public static String getSlPrefixFromNoRoot (Element contextElement) throws XPathException { + + String slPrefix = checkSLnsDeclaration(contextElement, Constants.SL10_PREFIX, Constants.SL10_NS_URI); + if (slPrefix == null) { + slPrefix = checkSLnsDeclaration(contextElement, Constants.SL11_PREFIX, Constants.SL11_NS_URI); + } + if (slPrefix == null) { + slPrefix = checkSLnsDeclaration(contextElement, Constants.SL12_PREFIX, Constants.SL12_NS_URI); + } + + return slPrefix; + + } + + /** + * Checks if the context element has an attribute xmlns:slPrefix and + * if the prefix of that attribute corresponds with a valid SecurityLayer namespace. + * + * @param contextElement The element to be checked. + * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer + * namespace prefix. + * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix. + * + * @return The valid SecurityLayer prefix or null if this prefix is + * not used. + * @throws XPathException + */ + private static String checkSLnsDeclaration(Element contextElement, String slPrefix, String slNameSpace) + throws XPathException + { + String nsAtt = "xmlns:" + slPrefix; + String nameSpace = contextElement.getAttribute(nsAtt); + if (nameSpace == "") { + return null; + } else { + // check if namespace is correct + if (nameSpace.equals(slNameSpace)) { + return slPrefix; + } else { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { "Ung�ltiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); + throw new XPathException(message, null); + } + } + } + +} diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ex/EgovUtilException.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ex/EgovUtilException.java new file mode 100644 index 0000000..27169b4 --- /dev/null +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ex/EgovUtilException.java @@ -0,0 +1,41 @@ +/* + * Copyright 2011 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.moaspss.util.ex; + +public class EgovUtilException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public EgovUtilException() { + } + + public EgovUtilException(String message) { + super(message); + } + + public EgovUtilException(Throwable cause) { + super(cause); + } + + public EgovUtilException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java index 5d1c537..1754ead 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java @@ -34,11 +34,10 @@ import org.w3c.dom.Document; import org.xml.sax.InputSource; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; import junit.framework.TestCase; -import at.gv.egovernment.moa.util.Constants; -import at.gv.egovernment.moa.util.DOMUtils; - /** * Base class for MOA test cases. * diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java index 1a2b690..e62d896 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java @@ -30,11 +30,10 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; import test.at.gv.egovernment.moa.*; -import at.gv.egovernment.moa.util.Constants; -import at.gv.egovernment.moa.util.DOMUtils; - /** * @author Patrick Peck * @version $Id$ diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java index e3468b8..56f7578 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java @@ -31,10 +31,9 @@ import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; +import at.gv.egovernment.moaspss.util.DateTimeUtils; import junit.framework.TestCase; -import at.gv.egovernment.moa.util.DateTimeUtils; - /** * @author Patrick Peck * @version $Id$ diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java index 2433eca..5e0c8fb 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java @@ -34,8 +34,7 @@ import java.security.Security; import java.security.cert.X509Certificate; import java.util.Enumeration; -import at.gv.egovernment.moa.util.KeyStoreUtils; - +import at.gv.egovernment.moaspss.util.KeyStoreUtils; import junit.framework.TestCase; /** diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java index 2b5094f..31a0591 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java @@ -32,12 +32,13 @@ import javax.net.ssl.SSLException; import javax.net.ssl.SSLSocketFactory; import junit.framework.TestCase; -import at.gv.egovernment.moa.util.KeyStoreUtils; -import at.gv.egovernment.moa.util.SSLUtils; import com.sun.net.ssl.HostnameVerifier; import com.sun.net.ssl.HttpsURLConnection; +import at.gv.egovernment.moaspss.util.KeyStoreUtils; +import at.gv.egovernment.moaspss.util.SSLUtils; + /** * @author Paul Ivancsics * @version $Id$ diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java index 2ded896..7513b51 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java @@ -26,9 +26,8 @@ package test.at.gv.egovernment.moa.util; import java.net.URLEncoder; -import at.gv.egovernment.moa.util.FileUtils; -import at.gv.egovernment.moa.util.URLDecoder; - +import at.gv.egovernment.moaspss.util.FileUtils; +import at.gv.egovernment.moaspss.util.URLDecoder; import junit.framework.TestCase; /* diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java index 5f72c8a..78c3c7c 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java @@ -24,9 +24,9 @@ package test.at.gv.egovernment.moa.util; -import at.gv.egovernment.moa.util.FileUtils; -import at.gv.egovernment.moa.util.URLDecoder; -import at.gv.egovernment.moa.util.URLEncoder; +import at.gv.egovernment.moaspss.util.FileUtils; +import at.gv.egovernment.moaspss.util.URLDecoder; +import at.gv.egovernment.moaspss.util.URLEncoder; import junit.framework.TestCase; /* diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java index dfe7a53..b471fe6 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java @@ -35,10 +35,9 @@ import org.apache.xerces.xni.grammars.XMLGrammarDescription; import org.apache.xerces.xni.parser.XMLInputSource; import org.xml.sax.InputSource; +import at.gv.egovernment.moaspss.util.Constants; import test.at.gv.egovernment.moa.MOATestCase; -import at.gv.egovernment.moa.util.Constants; - /** * Experimentation with Xerces grammar caching. diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java index 15e6a62..f2b216f 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java @@ -26,10 +26,9 @@ package test.at.gv.egovernment.moa.util; import org.w3c.dom.Document; import org.w3c.dom.NodeList; +import at.gv.egovernment.moaspss.util.XPathUtils; import test.at.gv.egovernment.moa.MOATestCase; -import at.gv.egovernment.moa.util.XPathUtils; - /** * @author Patrick Peck diff --git a/moaSig/libs/iaik_cpades.jar b/moaSig/libs/iaik_cpades.jar index 9deb1bf..3116980 100644 Binary files a/moaSig/libs/iaik_cpades.jar and b/moaSig/libs/iaik_cpades.jar differ diff --git a/moaSig/libs/iaik_moa.jar b/moaSig/libs/iaik_moa.jar index 8d274c6..0e4f72a 100644 Binary files a/moaSig/libs/iaik_moa.jar and b/moaSig/libs/iaik_moa.jar differ diff --git a/moaSig/libs/iaik_pki.jar b/moaSig/libs/iaik_pki.jar deleted file mode 100644 index 9c89086..0000000 Binary files a/moaSig/libs/iaik_pki.jar and /dev/null differ diff --git a/moaSig/libs/iaik_pki_module.jar b/moaSig/libs/iaik_pki_module.jar index 01379aa..eb6b2ad 100644 Binary files a/moaSig/libs/iaik_pki_module.jar and b/moaSig/libs/iaik_pki_module.jar differ diff --git a/moaSig/libs/iaik_sigval.jar b/moaSig/libs/iaik_sigval.jar index 4aa741e..1e69ad3 100644 Binary files a/moaSig/libs/iaik_sigval.jar and b/moaSig/libs/iaik_sigval.jar differ diff --git a/moaSig/libs/iaik_sigvallib.jar b/moaSig/libs/iaik_sigvallib.jar index b2d8184..cc60786 100644 Binary files a/moaSig/libs/iaik_sigvallib.jar and b/moaSig/libs/iaik_sigvallib.jar differ diff --git a/moaSig/libs/iaik_tsl-1.1.jar b/moaSig/libs/iaik_tsl-1.1.jar index 6fa0fef..b4eb067 100644 Binary files a/moaSig/libs/iaik_tsl-1.1.jar and b/moaSig/libs/iaik_tsl-1.1.jar differ diff --git a/moaSig/libs/iaik_xades.jar b/moaSig/libs/iaik_xades.jar index 73401d7..07ae769 100644 Binary files a/moaSig/libs/iaik_xades.jar and b/moaSig/libs/iaik_xades.jar differ diff --git a/moaSig/libs/iaik_xsect.jar b/moaSig/libs/iaik_xsect.jar index e891231..b04dc07 100644 Binary files a/moaSig/libs/iaik_xsect.jar and b/moaSig/libs/iaik_xsect.jar differ diff --git a/moaSig/moa-sig-lib/build.gradle b/moaSig/moa-sig-lib/build.gradle index adb053f..ee39d3c 100644 --- a/moaSig/moa-sig-lib/build.gradle +++ b/moaSig/moa-sig-lib/build.gradle @@ -1,3 +1,10 @@ +apply plugin: 'java-library-distribution' + +distributions { + main{ + baseName = 'MOA-SPSS' + } +} dependencies { compile fileTree(dir: '../libs', include: '*.jar') @@ -11,6 +18,7 @@ dependencies { compile 'org.xerial:sqlite-jdbc:3.8.11.2' compile 'javax.xml.bind:jaxb-api:2.2.12' compile 'com.sun.xml.bind:jaxb-core:2.2.11' + compile 'com.sun.xml.bind:jaxb-impl:2.2.11' compile 'org.postgresql:postgresql:9.4-1204-jdbc42' } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java index 803f3fd..bf7f9af 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java @@ -34,10 +34,8 @@ 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; +import at.gv.egovernment.moaspss.util.Constants; /** * Base class of MOA specific exceptions. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java index a3c8565..3a65c48 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java @@ -35,7 +35,7 @@ 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; +import at.gv.egovernment.moaspss.util.Constants; /** * Base class of MOA specific runtime exceptions. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java index 6cbdf7d..59db7b5 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java @@ -52,7 +52,7 @@ public abstract class Configurator { (Configurator) discover.newInstance( Configurator.class, DEFAULT_IMPLEMENTATION);*/ - return new ConfiguratorImpl(); + instance = new ConfiguratorImpl(); } catch (Exception e) { // this can not happen since we provide a valid default // implementation diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java index d216569..c6a750e 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java @@ -109,7 +109,7 @@ public abstract class SPSSFactory { (SPSSFactory) discover.newInstance( SPSSFactory.class, DEFAULT_IMPLEMENTATION);*/ - return new SPSSFactoryImpl(); + instance = new SPSSFactoryImpl(); } catch (Exception e) { // this can not happen since we provide a valid default // implementation @@ -469,6 +469,37 @@ public abstract class SPSSFactory { CMSDataObject dataObject, String trustProfileID, boolean pdf); + + /** + * 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, + boolean pdf, + boolean extended); /** * Create a new CMSDataObject object from data at a given URI. @@ -583,6 +614,41 @@ public abstract class SPSSFactory { SignatureManifestCheckParams signatureManifestParams, boolean returnHashInputData, String trustProfileID); + + /** + * 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. + * @param extendedValidation Should the valdation result in forms + * @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, + boolean extendedValidation); /** * Create a new VerifySignatureInfo object. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java index dfdd13d..05271fb 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java @@ -59,7 +59,7 @@ public abstract class SignatureCreationService { (SignatureCreationService) discover.newInstance( SignatureCreationService.class, DEFAULT_IMPLEMENTATION);*/ - return new SignatureCreationServiceImpl(); + instance = new SignatureCreationServiceImpl(); } catch (Exception e) { // this can not happen since we provide a valid default // implementation diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java index 85e2a97..2433e20 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java @@ -60,7 +60,7 @@ public abstract class SignatureVerificationService { (SignatureVerificationService) discover.newInstance( SignatureVerificationService.class, DEFAULT_IMPLEMENTATION);*/ - return new SignatureVerificationServiceImpl(); + instance = new SignatureVerificationServiceImpl(); } catch (Exception e) { // this can not happen since we provide a valid default // implementation diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java index 3adb381..6294fb1 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java @@ -75,4 +75,5 @@ public interface VerifyCMSSignatureRequest { public String getTrustProfileId(); public boolean isPDF(); + public boolean isExtended(); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java index 988c5bc..05977c5 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java @@ -24,7 +24,7 @@ package at.gv.egovernment.moa.spss.api.common; -import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moaspss.util.Constants; /** * A canonicalization type of Transform. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java index 5c2b633..557ff21 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java @@ -26,7 +26,7 @@ package at.gv.egovernment.moa.spss.api.common; import java.util.List; -import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moaspss.util.Constants; /** * An exclusive canonicalization type of Transform. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java index 478dcb4..9719c29 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.api.impl; import java.io.InputStream; @@ -85,576 +84,474 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; */ 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 CreateCMSSignatureRequest createCreateCMSSignatureRequest( - String keyIdentifier, - List singleSignatureInfos) { - CreateCMSSignatureRequestImpl createCMSSignatureRequest = - new CreateCMSSignatureRequestImpl(); - createCMSSignatureRequest.setKeyIdentifier(keyIdentifier); - createCMSSignatureRequest.setSingleSignatureInfos(singleSignatureInfos); - return createCMSSignatureRequest; - - } - - public CreateCMSSignatureResponse createCreateCMSSignatureResponse(List responseElements) { - CreateCMSSignatureResponseImpl createCMSSignatureResponse = new CreateCMSSignatureResponseImpl(); - createCMSSignatureResponse.setResponseElements(responseElements); - return createCMSSignatureResponse; - } - - - public CMSSignatureResponse createCMSSignatureResponse(String base64value) { - CMSSignatureResponseImpl cmsSignatureResponse = new CMSSignatureResponseImpl(); - cmsSignatureResponse.setCMSSignature(base64value); - - return cmsSignatureResponse; - } - - - 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 at.gv.egovernment.moa.spss.api.cmssign.SingleSignatureInfo createSingleSignatureInfoCMS( - at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo dataObjectInfo, - boolean securityLayerConform) { - SingleSignatureInfoCMSImpl singleSignatureInfo = new SingleSignatureInfoCMSImpl(); - singleSignatureInfo.setDataObjectInfo(dataObjectInfo); - 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 at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo createDataObjectInfo( - String structure, - CMSDataObject dataObject) { - DataObjectInfoCMSImpl dataObjectInfo = new DataObjectInfoCMSImpl(); - dataObjectInfo.setStructure(structure); - dataObjectInfo.setDataObject(dataObject); - 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, - boolean pdf) { - VerifyCMSSignatureRequestImpl verifyCMSSignatureRequest = - new VerifyCMSSignatureRequestImpl(); - verifyCMSSignatureRequest.setDateTime(dateTime); - verifyCMSSignatureRequest.setCMSSignature(cmsSignature); - verifyCMSSignatureRequest.setDataObject(dataObject); - verifyCMSSignatureRequest.setTrustProfileId(trustProfileID); - verifyCMSSignatureRequest.setSignatories(signatories); - verifyCMSSignatureRequest.setPDF(pdf); - return verifyCMSSignatureRequest; - } - - public CMSDataObject createCMSDataObject( - MetaInfo metaInfo, - CMSContent content, - BigDecimal excludeByteRangeFrom, - BigDecimal excludeByteRangeTo) { - - CMSDataObjectImpl cmsDataObject = new CMSDataObjectImpl(); - cmsDataObject.setMetaInfo(metaInfo); - cmsDataObject.setContent(content); - cmsDataObject.setExcludeByteRangeFrom(excludeByteRangeFrom); - cmsDataObject.setExcludeByteRangeTo(excludeByteRangeTo); - - 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, - List adesResult) { - VerifyCMSSignatureResponseElementImpl verifyCMSSignatureResponseElement = - new VerifyCMSSignatureResponseElementImpl(); - verifyCMSSignatureResponseElement.setSignerInfo(signerInfo); - verifyCMSSignatureResponseElement.setSignatureCheck(signatureCheck); - verifyCMSSignatureResponseElement.setCertificateCheck(certificateCheck); - verifyCMSSignatureResponseElement.setAdESFormResults(adesResult); - 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, - List adesFormResults) { - 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); - verifyXMLSignatureResponse.setAdESFormResults(adesFormResults); - 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 qcSourceTSL, - boolean publicAuthority, - String publicAuthorityID, - boolean sscd, - boolean sscdSourceTSL, - String issuerCountryCode) { - SignerInfoImpl signerInfo = new SignerInfoImpl(); - signerInfo.setSignerCertificate(signerCertificate); - signerInfo.setQualifiedCertificate(qualifiedCertificate); - signerInfo.setQCSourceTSL(qcSourceTSL); - signerInfo.setPublicAuthority(publicAuthority); - signerInfo.setPublicAuhtorityID(publicAuthorityID); - signerInfo.setSSCD(sscd); - signerInfo.setSSCDSourceTSL(sscdSourceTSL); - signerInfo.setIssuerCountryCode(issuerCountryCode); - return signerInfo; - } - - public X509IssuerSerial createX509IssuerSerial( - String issuerName, - BigInteger serialNumber) { - X509IssuerSerialImpl x509IssuerSerial = new X509IssuerSerialImpl(); - x509IssuerSerial.setX509IssuerName(issuerName); - x509IssuerSerial.setX509SerialNumber(serialNumber); - return x509IssuerSerial; - } + public CreateXMLSignatureRequest createCreateXMLSignatureRequest(String keyIdentifier, List singleSignatureInfos) { + CreateXMLSignatureRequestImpl createXMLSignatureRequest = new CreateXMLSignatureRequestImpl(); + createXMLSignatureRequest.setKeyIdentifier(keyIdentifier); + createXMLSignatureRequest.setSingleSignatureInfos(singleSignatureInfos); + return createXMLSignatureRequest; + } + + public CreateCMSSignatureRequest createCreateCMSSignatureRequest(String keyIdentifier, List singleSignatureInfos) { + CreateCMSSignatureRequestImpl createCMSSignatureRequest = new CreateCMSSignatureRequestImpl(); + createCMSSignatureRequest.setKeyIdentifier(keyIdentifier); + createCMSSignatureRequest.setSingleSignatureInfos(singleSignatureInfos); + return createCMSSignatureRequest; + + } + + public CreateCMSSignatureResponse createCreateCMSSignatureResponse(List responseElements) { + CreateCMSSignatureResponseImpl createCMSSignatureResponse = new CreateCMSSignatureResponseImpl(); + createCMSSignatureResponse.setResponseElements(responseElements); + return createCMSSignatureResponse; + } + + public CMSSignatureResponse createCMSSignatureResponse(String base64value) { + CMSSignatureResponseImpl cmsSignatureResponse = new CMSSignatureResponseImpl(); + cmsSignatureResponse.setCMSSignature(base64value); + + return cmsSignatureResponse; + } + + 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 at.gv.egovernment.moa.spss.api.cmssign.SingleSignatureInfo createSingleSignatureInfoCMS( + at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo dataObjectInfo, boolean securityLayerConform) { + SingleSignatureInfoCMSImpl singleSignatureInfo = new SingleSignatureInfoCMSImpl(); + singleSignatureInfo.setDataObjectInfo(dataObjectInfo); + 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 at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo createDataObjectInfo(String structure, + CMSDataObject dataObject) { + DataObjectInfoCMSImpl dataObjectInfo = new DataObjectInfoCMSImpl(); + dataObjectInfo.setStructure(structure); + dataObjectInfo.setDataObject(dataObject); + 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, boolean pdf) { + return this.createVerifyCMSSignatureRequest(signatories, dateTime, cmsSignature, dataObject, trustProfileID, pdf, false); + } + + public VerifyCMSSignatureRequest createVerifyCMSSignatureRequest(int[] signatories, Date dateTime, + InputStream cmsSignature, CMSDataObject dataObject, String trustProfileID, boolean pdf, boolean extended) { + VerifyCMSSignatureRequestImpl verifyCMSSignatureRequest = new VerifyCMSSignatureRequestImpl(); + verifyCMSSignatureRequest.setDateTime(dateTime); + verifyCMSSignatureRequest.setCMSSignature(cmsSignature); + verifyCMSSignatureRequest.setDataObject(dataObject); + verifyCMSSignatureRequest.setTrustProfileId(trustProfileID); + verifyCMSSignatureRequest.setSignatories(signatories); + verifyCMSSignatureRequest.setPDF(pdf); + verifyCMSSignatureRequest.setExtended(extended); + return verifyCMSSignatureRequest; + } + + public CMSDataObject createCMSDataObject(MetaInfo metaInfo, CMSContent content, BigDecimal excludeByteRangeFrom, + BigDecimal excludeByteRangeTo) { + + CMSDataObjectImpl cmsDataObject = new CMSDataObjectImpl(); + cmsDataObject.setMetaInfo(metaInfo); + cmsDataObject.setContent(content); + cmsDataObject.setExcludeByteRangeFrom(excludeByteRangeFrom); + cmsDataObject.setExcludeByteRangeTo(excludeByteRangeTo); + + 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, List adesResult) { + VerifyCMSSignatureResponseElementImpl verifyCMSSignatureResponseElement = new VerifyCMSSignatureResponseElementImpl(); + verifyCMSSignatureResponseElement.setSignerInfo(signerInfo); + verifyCMSSignatureResponseElement.setSignatureCheck(signatureCheck); + verifyCMSSignatureResponseElement.setCertificateCheck(certificateCheck); + verifyCMSSignatureResponseElement.setAdESFormResults(adesResult); + return verifyCMSSignatureResponseElement; + } + + public VerifyXMLSignatureRequest createVerifyXMLSignatureRequest(Date dateTime, + VerifySignatureInfo verifySignatureInfo, List supplementProfiles, + SignatureManifestCheckParams signatureManifestParams, boolean returnHashInputData, String trustProfileID) { + return this.createVerifyXMLSignatureRequest(dateTime, verifySignatureInfo, supplementProfiles, + signatureManifestParams, returnHashInputData, trustProfileID, false); + } + + 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, + List adesFormResults) { + 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); + verifyXMLSignatureResponse.setAdESFormResults(adesFormResults); + 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 qcSourceTSL, boolean publicAuthority, String publicAuthorityID, boolean sscd, boolean sscdSourceTSL, + String issuerCountryCode) { + SignerInfoImpl signerInfo = new SignerInfoImpl(); + signerInfo.setSignerCertificate(signerCertificate); + signerInfo.setQualifiedCertificate(qualifiedCertificate); + signerInfo.setQCSourceTSL(qcSourceTSL); + signerInfo.setPublicAuthority(publicAuthority); + signerInfo.setPublicAuhtorityID(publicAuthorityID); + signerInfo.setSSCD(sscd); + signerInfo.setSSCDSourceTSL(sscdSourceTSL); + signerInfo.setIssuerCountryCode(issuerCountryCode); + return signerInfo; + } + + public X509IssuerSerial createX509IssuerSerial(String issuerName, BigInteger serialNumber) { + X509IssuerSerialImpl x509IssuerSerial = new X509IssuerSerialImpl(); + x509IssuerSerial.setX509IssuerName(issuerName); + x509IssuerSerial.setX509SerialNumber(serialNumber); + return x509IssuerSerial; + } + + @Override + public VerifyXMLSignatureRequest createVerifyXMLSignatureRequest(Date dateTime, + VerifySignatureInfo verifySignatureInfo, List supplementProfiles, + SignatureManifestCheckParams signatureManifestParams, boolean returnHashInputData, String trustProfileID, + boolean extendedValidation) { + VerifyXMLSignatureRequestImpl verifyXMLSignatureRequest = new VerifyXMLSignatureRequestImpl(); + verifyXMLSignatureRequest.setDateTime(dateTime); + verifyXMLSignatureRequest.setSignatureInfo(verifySignatureInfo); + verifyXMLSignatureRequest.setSupplementProfiles(supplementProfiles); + verifyXMLSignatureRequest.setSignatureManifestCheckParams(signatureManifestParams); + verifyXMLSignatureRequest.setReturnHashInputData(returnHashInputData); + verifyXMLSignatureRequest.setTrustProfileId(trustProfileID); + verifyXMLSignatureRequest.setExtendedValidation(extendedValidation); + return verifyXMLSignatureRequest; + } } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java index 78d817b..e16717d 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java @@ -51,6 +51,7 @@ public class VerifyCMSSignatureRequestImpl private Date dateTime; private boolean pdf = false; + private boolean extended = false; /** * Sets the indexes of the signatories whose signature should be verified. @@ -124,4 +125,12 @@ public class VerifyCMSSignatureRequestImpl return this.pdf; } +public synchronized boolean isExtended() { + return extended; +} + +public synchronized void setExtended(boolean extended) { + this.extended = extended; +} + } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java index 1b9be35..91d1917 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.api.impl; import java.util.ArrayList; @@ -39,99 +38,114 @@ import at.gv.egovernment.moa.spss.api.xmlverify.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; - } +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; + private boolean extendedValidation; + /** + * 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; + } + + public synchronized void setExtendedValidation(boolean extendedValidation) { + this.extendedValidation = extendedValidation; + } + + @Override + public boolean getExtendedValidaiton() { + return extendedValidation; + } } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureRequestParser.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureRequestParser.java index a8cae9c..3550c27 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureRequestParser.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureRequestParser.java @@ -40,11 +40,11 @@ import at.gv.egovernment.moa.spss.api.cmssign.SingleSignatureInfo; 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; -import at.gv.egovernment.moa.util.Base64Utils; -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.moaspss.util.Base64Utils; +import at.gv.egovernment.moaspss.util.BoolUtils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * A parser to parse CreateCMSSignatureRequest DOM trees into diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureResponseBuilder.java index 907f90d..d808f2b 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureResponseBuilder.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureResponseBuilder.java @@ -38,8 +38,8 @@ import at.gv.egovernment.moa.spss.api.cmssign.CreateCMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmssign.CreateCMSSignatureResponseElement; import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse; import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse; -import at.gv.egovernment.moa.util.Constants; -import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; /** * Convert a CreateCMSSignatureResponse API object into its diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java index 9cea2fc..d677f88 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java @@ -30,11 +30,6 @@ 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; @@ -44,6 +39,10 @@ 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; +import at.gv.egovernment.moaspss.util.BoolUtils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * A parser to parse CreateXMLSignatureRequest DOM trees into diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java index 0af1a67..3c93fce 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java @@ -30,13 +30,12 @@ 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; +import at.gv.egovernment.moaspss.util.Constants; /** * Convert a CreateXMLSignatureResponse API object into its diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java index 0705c0b..6b34922 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java @@ -33,11 +33,6 @@ 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; @@ -49,6 +44,10 @@ 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; +import at.gv.egovernment.moaspss.util.Base64Utils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * Parse the various profile elements contained in the MOA web service requests diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java index 743a17c..1d53a0c 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.api.xmlbind; import java.text.ParseException; @@ -30,17 +29,16 @@ 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; +import at.gv.egovernment.moaspss.util.Base64Utils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.DateTimeUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * Utility methods for parsing XML requests definied in the MOA XML schema. @@ -49,133 +47,164 @@ import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; * @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; - } - } + // + // 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; + } + } + + /** + * 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 boolean parseExtendedValidation(Element requestElem, String extendedValidationXPath, + boolean defaultValue) throws MOAApplicationException { + + Element dateTimeElem; + String dateTimeText; + + // select the DateTime element + dateTimeElem = (Element) XPathUtils.selectSingleNode(requestElem, extendedValidationXPath); + + // parse a date from the element value + if (dateTimeElem != null) { + dateTimeText = DOMUtils.getText(dateTimeElem); + String xsdBoolean = dateTimeText.trim(); + if ("".equals(xsdBoolean)) + return defaultValue; + switch (xsdBoolean) { + case "true": + case "1": + return true; + case "false": + case "0": + return false; + default: + return false; + } + } else { + return defaultValue; + } + } } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java index eaafe00..a6ed83d 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java @@ -39,12 +39,10 @@ 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; +import at.gv.egovernment.moaspss.util.Base64Utils; +import at.gv.egovernment.moaspss.util.Constants; /** * Utility methods used by the verious ResponseBuilder classes. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java index 687b0ae..6dc4803 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java @@ -32,10 +32,6 @@ 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; @@ -47,6 +43,9 @@ 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.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * A parser to parse XMLDsig Transform DOM elements into their diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java index bc92b7a..97a2541 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java @@ -33,18 +33,17 @@ 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; +import at.gv.egovernment.moaspss.util.Base64Utils; +import at.gv.egovernment.moaspss.util.CollectionUtils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * A parser to parse VerifyCMSSignatureRequest DOM trees into @@ -60,6 +59,7 @@ public class VerifyCMSSignatureRequestParser { // private static final String MOA = Constants.MOA_PREFIX + ":"; private static final String DATE_TIME_XPATH = MOA + "DateTime"; + private static final String EXTENDED_VALIDATION_XPATH = MOA + "ExtendedValidation"; 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"; @@ -73,6 +73,44 @@ public class VerifyCMSSignatureRequestParser { /** 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 parsePDF(Element requestElem) + throws MOAApplicationException { + + int[] signatories = parseSignatories(requestElem); + Date dateTime = + RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH); + boolean extendedValidation = + RequestParserUtils.parseExtendedValidation(requestElem, EXTENDED_VALIDATION_XPATH, false); + + 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, + true, + extendedValidation); + } + /** * Parse a VerifyCMSSignatureRequest DOM element, as defined * by the MOA schema. @@ -90,6 +128,9 @@ public class VerifyCMSSignatureRequestParser { int[] signatories = parseSignatories(requestElem); Date dateTime = RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH); + boolean extendedValidation = + RequestParserUtils.parseExtendedValidation(requestElem, EXTENDED_VALIDATION_XPATH, false); + String cmsSignatureStr = XPathUtils.getElementValue(requestElem, CMS_SIGNATURE_XPATH, ""); CMSDataObject dataObject = parseDataObject(requestElem); @@ -104,7 +145,8 @@ public class VerifyCMSSignatureRequestParser { cmsSignature, dataObject, trustProfileID, - false); + false, + extendedValidation); } /** diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java index b11560b..cefecac 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java @@ -35,6 +35,7 @@ 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; +import at.gv.egovernment.moa.spss.api.xmlverify.AdESFormResults; /** * Convert a VerifyCMSSignatureResponse API object into its @@ -60,7 +61,7 @@ public class VerifyCMSSignatureResponseBuilder { ResponseBuilderUtils.createResponse("VerifyCMSSignatureResponse"); responseElem = responseDoc.getDocumentElement(); } - + /** * Build a document containing a VerifyCMSSignatureResponse * DOM element being the XML representation of the given @@ -82,7 +83,7 @@ public class VerifyCMSSignatureResponseBuilder { (VerifyCMSSignatureResponseElement) iter.next(); addResponseElement(responseElement); } - + return responseDoc; } @@ -125,6 +126,19 @@ public class VerifyCMSSignatureResponseBuilder { certCheck.getCode(), certCheck.getInfo()); + + if (responseElement.getAdESFormResults() != null) { + + Iterator formIterator = responseElement.getAdESFormResults().iterator(); + + while (formIterator.hasNext()) { + AdESFormResults adESFormResult = (AdESFormResults) formIterator.next(); + // add the CertificateCheck + ResponseBuilderUtils.addFormCheckElement(responseDoc, responseElem, "FormCheckResult", + adESFormResult.getCode().intValue(), adESFormResult.getName()); + + } + } } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java new file mode 100644 index 0000000..cc44c29 --- /dev/null +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java @@ -0,0 +1,145 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-SPSS has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moa.spss.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; +import at.gv.egovernment.moa.spss.api.xmlverify.AdESFormResults; + +/** + * Convert a VerifyCMSSignatureResponse API object into its + * XML representation, according to the MOA XML schema. + * + * @author Patrick Peck + * @version $Id$ + */ +public class VerifyPDFSignatureResponseBuilder { + /** 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 VerifyPDFSignatureResponseBuilder() throws MOASystemException { + responseDoc = + ResponseBuilderUtils.createResponse("VerifyPDFSignatureResponse"); + 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.getQCSource(), + signerInfo.isPublicAuthority(), + signerInfo.getPublicAuhtorityID(), + signerInfo.isSSCD(), + signerInfo.getSSCDSource(), + signerInfo.getIssuerCountryCode()); + + ResponseBuilderUtils.addCodeInfoElement( + responseDoc, + responseElem, + "SignatureCheck", + signatureCheck.getCode(), + signatureCheck.getInfo()); + + ResponseBuilderUtils.addCodeInfoElement( + responseDoc, + responseElem, + "CertificateCheck", + certCheck.getCode(), + certCheck.getInfo()); + + + if (responseElement.getAdESFormResults() != null) { + + Iterator formIterator = responseElement.getAdESFormResults().iterator(); + + while (formIterator.hasNext()) { + AdESFormResults adESFormResult = (AdESFormResults) formIterator.next(); + // add the CertificateCheck + ResponseBuilderUtils.addFormCheckElement(responseDoc, responseElem, "FormCheckResult", + adESFormResult.getCode().intValue(), adESFormResult.getName()); + + } + } + + } + +} diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java index 7bd0b9e..f1bb1d7 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.api.xmlbind; import java.util.ArrayList; @@ -32,11 +31,6 @@ 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; @@ -46,6 +40,10 @@ 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; +import at.gv.egovernment.moaspss.util.BoolUtils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * @author Patrick Peck @@ -53,32 +51,28 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest; */ 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(); - - - /** + // + // 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 EXTENDED_VALIDATION_XPATH = MOA + "ExtendedValidation"; + 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. * @@ -94,6 +88,10 @@ public class VerifyXMLSignatureRequestParser { Date dateTime = RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH); + + boolean extendedValidation = + RequestParserUtils.parseExtendedValidation(requestElem, EXTENDED_VALIDATION_XPATH, false); + VerifySignatureInfo verifySignatureInfo = parseVerifySignatureInfo(requestElem); List supplementProfiles = parseSupplementProfiles(requestElem); @@ -111,189 +109,178 @@ public class VerifyXMLSignatureRequestParser { 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; - } + trustProfileID, + extendedValidation); } - /** - * 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; - } + /** + * 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/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java index bc949fa..2109b35 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java @@ -32,9 +32,9 @@ 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.logging.Logger; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.Base64Utils; +import at.gv.egovernment.moaspss.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; @@ -137,23 +137,18 @@ public class VerifyXMLSignatureResponseBuilder { ResponseBuilderUtils.addCodeInfoElement(responseDoc, responseElem, "CertificateCheck", response.getCertificateCheck().getCode(), response.getCertificateCheck().getInfo()); - try { - if (ConfigurationProvider.getInstance().getAdesFormResults() && response.getAdESFormResults() != null) { + if (response.getAdESFormResults() != null) { - Iterator formIterator = response.getAdESFormResults().iterator(); + Iterator formIterator = response.getAdESFormResults().iterator(); - while (formIterator.hasNext()) { - AdESFormResults adESFormResult = (AdESFormResults) formIterator.next(); - // add the CertificateCheck - ResponseBuilderUtils.addFormCheckElement(responseDoc, responseElem, "FormCheckResult", - adESFormResult.getCode().intValue(), adESFormResult.getName()); + while (formIterator.hasNext()) { + AdESFormResults adESFormResult = (AdESFormResults) formIterator.next(); + // add the CertificateCheck + ResponseBuilderUtils.addFormCheckElement(responseDoc, responseElem, "FormCheckResult", + adESFormResult.getCode().intValue(), adESFormResult.getName()); - } } - } catch (ConfigurationException e) { - Logger.warn("Failed to access configuration to determine if we should return AdES Form Results"); } - return responseDoc; } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java index a6272d5..c4a0fd1 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java @@ -76,4 +76,12 @@ public interface VerifyXMLSignatureRequest { * @return The id of the trusted certificates. */ public String getTrustProfileId(); + + /** + * Should perform extended validation + * + * @return true, if signed data will be returned, + * otherwise false. + */ + public boolean getExtendedValidaiton(); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java index bb2589a..b2389a4 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java @@ -31,10 +31,9 @@ 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; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; /** * A class representing a CRL distribution point. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 6bc6f0b..3c7bf6a 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -31,6 +31,7 @@ import iaik.pki.revocation.RevocationSourceTypes; import iaik.server.modules.xml.BlackListEntry; import iaik.server.modules.xml.ExternalReferenceChecker; import iaik.server.modules.xml.WhiteListEntry; +import iaik.util.logging.Log; import iaik.utils.RFC2253NameParser; import iaik.utils.RFC2253NameParserException; import iaik.xml.crypto.utils.URI; @@ -62,16 +63,16 @@ import org.w3c.dom.Element; import org.w3c.dom.traversal.NodeIterator; import org.xml.sax.SAXException; -import at.gv.egovernment.moa.logging.LogMsg; -import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.spss.api.common.TSLConfiguration; import at.gv.egovernment.moa.spss.api.impl.TSLConfigurationImpl; 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.FileUtils; -import at.gv.egovernment.moa.util.StringUtils; -import at.gv.egovernment.moa.util.XPathUtils; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.FileUtils; +import at.gv.egovernment.moaspss.util.StringUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * A class that builds configuration data from a DOM based representation. @@ -259,6 +260,16 @@ public class ConfigurationPartsBuilder { ROOT + CONF + "SignatureVerification/" + CONF + "PermitFileURIs"; + private static final String CONNECTION_TIMEOUT_XPATH_ = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "ConnectionTimeout"; + + private static final String READ_TIMEOUT_XPATH_ = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "ReadTimeout"; + private static final String TSL_CONFIGURATION_XPATH = ROOT + CONF + "SignatureVerification/" + CONF + "CertificateValidation/" @@ -408,6 +419,51 @@ public class ConfigurationPartsBuilder { return pdfasConfiguration; } + /** + * Returns the digest method algorithm name. + * + * @return The digest method algorithm name from the configuration. + */ + public int getConnectionTimeout() + { + String connectionTimeout = getElementValue(getConfigElem(), CONNECTION_TIMEOUT_XPATH_, "30"); + int defaultConnectionTimeout = 30; + + if(connectionTimeout != null) { + try { + defaultConnectionTimeout = Integer.parseInt(connectionTimeout); + } catch(NumberFormatException e) { + Log.warn("Configuration value " + CONNECTION_TIMEOUT_XPATH_ + " should be a number defaulting to 30"); + } + } + + if(defaultConnectionTimeout < 0) { + defaultConnectionTimeout = 30; + } + + return defaultConnectionTimeout; + } + + public int getReadTimeout() + { + String connectionTimeout = getElementValue(getConfigElem(), READ_TIMEOUT_XPATH_, "30"); + int defaultConnectionTimeout = 30; + + if(connectionTimeout != null) { + try { + defaultConnectionTimeout = Integer.parseInt(connectionTimeout); + } catch(NumberFormatException e) { + Log.warn("Configuration value " + READ_TIMEOUT_XPATH_ + " should be a number defaulting to 30"); + } + } + + if(defaultConnectionTimeout < 0) { + defaultConnectionTimeout = 30; + } + + return defaultConnectionTimeout; + } + public boolean getAdesFormResult() { String enableArchiving = getElementValue(getConfigElem(), FORMRESULT_CONFIGURATION_XPATH, null); diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java index 578f2fd..d777d8f 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java @@ -46,11 +46,11 @@ import java.util.Set; import org.w3c.dom.Element; -import at.gv.egovernment.moa.logging.LogMsg; -import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.spss.api.common.TSLConfiguration; import at.gv.egovernment.moa.spss.util.MessageProvider; -import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.DOMUtils; /** * A class providing access to the MOA configuration data. @@ -107,6 +107,9 @@ public class ConfigurationProvider /** PDF AS Configuration */ private String pdfAsConfiguration; + private int connectionTimeout; + private int readTimeout; + /** * A List of HardwareCryptoModule objects for * configuring hardware modules. @@ -376,6 +379,8 @@ public class ConfigurationProvider keyGroupMappings = builder.buildKeyGroupMappings(keyGroups, ANONYMOUS_ISSUER_SERIAL); + connectionTimeout = builder.getConnectionTimeout(); + readTimeout = builder.getReadTimeout(); pdfAsConfiguration = builder.getPDFASConfiguration(); adesFormResults = builder.getAdesFormResult(); xadesVersion = builder.getXAdESVersion(); @@ -553,8 +558,16 @@ public class ConfigurationProvider } public String getPDFASConfiguration() { - return pdfAsConfiguration; - } + return pdfAsConfiguration; + } + + public int getConnectionTimeout() { + return this.connectionTimeout; + } + + public int getReadTimeout() { + return this.readTimeout; + } public boolean getAdesFormResults() { return this.adesFormResults; diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmssign/CMSSignatureCreationProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmssign/CMSSignatureCreationProfileImpl.java index 49e5ecc..2dc047a 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmssign/CMSSignatureCreationProfileImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmssign/CMSSignatureCreationProfileImpl.java @@ -35,10 +35,10 @@ import iaik.server.modules.keys.UnknownKeyException; import java.util.List; import java.util.Set; -import at.gv.egovernment.moa.logging.Logger; 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.moaspss.logging.Logger; /** * An object providing auxiliary information for creating a CMS signature. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/PDFSignatureVerificationProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/PDFSignatureVerificationProfileImpl.java index 9189597..785c85b 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/PDFSignatureVerificationProfileImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/PDFSignatureVerificationProfileImpl.java @@ -1,6 +1,6 @@ package at.gv.egovernment.moa.spss.server.iaik.cmsverify; -import iaik.server.modules.cmsverify.PDFSignatureVerificationProfile; +import iaik.server.modules.pdfverify.PDFSignatureVerificationProfile; public class PDFSignatureVerificationProfileImpl extends CMSSignatureVerificationProfileImpl implements PDFSignatureVerificationProfile { diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java index 304a7d3..d752a63 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java @@ -33,11 +33,12 @@ import iaik.pki.ldap.Handler; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; +import java.net.URLConnection; import java.net.URLStreamHandler; import java.util.Collection; import java.util.Date; -import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moaspss.logging.Logger; /** * A customized implementation of @@ -51,6 +52,11 @@ import at.gv.egovernment.moa.logging.Logger; * @version $$ */ public class CRLRetriever implements RevocationInfoRetriever { + + private int connectTimeout = 5; + private int readTimeout = 5; + + public void update(RevocationSource source, Collection supplementalRequestData, TransactionId tid) throws RevocationStoreException { if (source == null) { @@ -70,8 +76,10 @@ public class CRLRetriever implements RevocationInfoRetriever { URLStreamHandler handler = new Handler(); crlUrl = new URL(null, source.getUri(), handler); } - - InputStream crlInputStream = crlUrl.openStream(); + URLConnection con = crlUrl.openConnection(); + con.setConnectTimeout(connectTimeout); + con.setReadTimeout(readTimeout); + InputStream crlInputStream = con.getInputStream(); source.readFrom(crlInputStream, tid); source.setDownloadTime(new Date()); crlInputStream.close(); @@ -83,11 +91,11 @@ public class CRLRetriever implements RevocationInfoRetriever { @Override public void setConnectTimeout(int arg0) { - // TODO AFITZEK IMPLEMENT THIS METHOD + this.connectTimeout = arg0; } @Override public void setReadTimeout(int arg0) { - // TODO AFITZEK IMPLEMENT THIS METHOD + this.readTimeout = arg0; } } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java index ef9ddeb..c49004b 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java @@ -43,8 +43,6 @@ 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.server.config.ConfigurationException; import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; import at.gv.egovernment.moa.spss.server.config.KeyGroup; @@ -53,6 +51,8 @@ import at.gv.egovernment.moa.spss.server.logging.TransactionId; import at.gv.egovernment.moa.spss.util.CertStoreConverter; import at.gv.egovernment.moa.spss.util.MessageProvider; import at.gv.egovernment.moa.spss.util.SecProviderUtils; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; /** * A class responsible for configuring the IAIK MOA modules. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java index 3fb842f..317fcca 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java @@ -26,11 +26,10 @@ package at.gv.egovernment.moa.spss.server.iaik.config; import java.util.Properties; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; import iaik.logging.LogConfigurationException; import iaik.logging.LoggerConfig; -import at.gv.egovernment.moa.logging.LoggingContextManager; - /** * Default implementation of the LoggerConfig interface. * diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java index fe0de1f..6341609 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java @@ -47,6 +47,8 @@ public class PKIConfigurationImpl implements PKIConfiguration { private ArchiveConfiguration archiveConfiguration; /** The certificate validation configuration. */ private ValidationConfiguration validationConfiguration; + private int connectionTimeout; + private int readTimeout; /** * Create a new PKIConfigurationImpl. @@ -68,6 +70,8 @@ public class PKIConfigurationImpl implements PKIConfiguration { } this.validationConfiguration = new ValidationConfigurationImpl(config); + this.connectionTimeout = config.getConnectionTimeout(); + this.readTimeout = config.getReadTimeout(); } /** @@ -100,14 +104,12 @@ public class PKIConfigurationImpl implements PKIConfiguration { @Override public int getConnectTimeout() { - // TODO AFITZEK IMPLEMENT THIS METHOD - return 0; + return this.connectionTimeout; } @Override public int getReadTimeout() { - // TODO AFITZEK IMPLEMENT THIS METHOD - return 0; + return this.readTimeout; } } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java index a09a701..5df84c9 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java @@ -27,6 +27,7 @@ import iaik.pki.revocation.RevocationConfiguration; import iaik.pki.revocation.dbcrl.config.DBCrlConfig; import java.security.cert.X509Certificate; +import java.util.Collections; import java.util.Date; import java.util.Map; import java.util.Set; @@ -100,7 +101,7 @@ public class RevocationConfigurationImpl extends AbstractObservableConfiguration @Override public Set getPositiveOCSPResponders() { // TODO AFITZEK IMPLEMENT THIS METHOD - return null; + return Collections.EMPTY_SET; } @Override diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java index 937f32f..1aed76e 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java @@ -30,12 +30,10 @@ 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; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; /** * An implementation of the SoftwareKeyModuleConfiguration wrapping diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java index 1c5d26a..9e6ed6d 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java @@ -39,12 +39,16 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; import at.gv.egovernment.moa.spss.util.NodeListToNodeSetDataAdapter; -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; +import at.gv.egovernment.moaspss.util.NodeListAdapter; +import at.gv.egovernment.moaspss.util.StreamUtils; +import at.gv.egovernment.moaspss.util.XPathException; +import at.gv.egovernment.moaspss.util.XPathUtils; +import iaik.server.modules.xml.MOAXSecProvider; import iaik.server.modules.xml.XSLTTransformation; import iaik.xml.crypto.dsig.XMLSignatureFactory; +import iaik.xml.filter.impl.dsig.CanonInputStream; +import iaik.xml.filter.impl.dsig.Canonicalizer; +import iaik.xml.filter.impl.dsig.Traverser; /** * A Transformation containing an XSLT transformation. @@ -195,12 +199,18 @@ public class XSLTTransformationImpl extends TransformationImpl implements XSLTTr */ private static InputStream canonicalize(Element element) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, IOException, TransformException { - CanonicalizationMethod canonicalizationMethod = XMLSignatureFactory.getInstance().newCanonicalizationMethod( - CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec()); + // CanonicalizationMethod canonicalizationMethod = + // MOAXSecProvider.getXMLSignatureFactory().newCanonicalizationMethod( + // CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec()); //CanonicalizationAlgorithm c14n = // new CanonicalizationAlgorithmImplExclusiveCanonicalXML(); - NodeList nodeList; + Traverser traverser = new Traverser(element, true, true); + Canonicalizer canonicalizer = new Canonicalizer(traverser, false, true, null); + + return new CanonInputStream(canonicalizer); + /* + NodeList nodeList; try { nodeList = XPathUtils.selectNodeList(element, XPathUtils.ALL_NODES_XPATH); @@ -211,7 +221,7 @@ public class XSLTTransformationImpl extends TransformationImpl implements XSLTTr ByteArrayOutputStream baos = new ByteArrayOutputStream(); canonicalizationMethod.transform(new NodeListToNodeSetDataAdapter(nodeList), null, baos); baos.close(); - return new ByteArrayInputStream(baos.toByteArray()); + return new ByteArrayInputStream(baos.toByteArray());*/ } } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java index 7d0c5a0..9d6e3d2 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java @@ -37,11 +37,11 @@ import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation; import java.util.List; import java.util.Set; -import at.gv.egovernment.moa.logging.Logger; 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.moaspss.logging.Logger; /** * An object providing auxiliary information for creating an XML signature. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java index 37569c5..094e446 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java @@ -36,25 +36,28 @@ import java.util.Timer; import org.slf4j.LoggerFactory; -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.MOAException; import at.gv.egovernment.moa.spss.api.common.TSLConfiguration; 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.service.RevocationArchiveCleaner; +import at.gv.egovernment.moa.spss.tsl.connector.MOATSLVerifier; import at.gv.egovernment.moa.spss.tsl.connector.TSLConnector; import at.gv.egovernment.moa.spss.tsl.timer.TSLUpdaterTimerTask; 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.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.logging.LoggingContext; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; import iaik.pki.store.certstore.CertStoreException; import iaik.pki.store.truststore.TrustStoreException; import iaik.server.ConfigurationData; +import iaik.xml.crypto.tsl.SecuredSAXParserFactoryImpl; import iaik.xml.crypto.tsl.ex.TSLEngineDiedException; import iaik.xml.crypto.tsl.ex.TSLSearchException; +import iaik.xml.crypto.tsl.verify.ITSLVerifierFactory; /** * MOA SP/SS web service initialization. @@ -93,8 +96,8 @@ public class SystemInitializer { logger.info("##############################################################################"); logger.info("##############################################################################"); logger.info("### ###"); - logger.info("### LOADING MOA-SIG ###"); - logger.info("### =============== ###"); + logger.info("### LOADING MOA-SPSS ###"); + logger.info("### ================ ###"); logger.info("### ###"); logger.info("##############################################################################"); logger.info("##############################################################################"); @@ -153,7 +156,11 @@ public class SystemInitializer { TSLConnector tslconnector = new TSLConnector(); if (tslconfig != null) { //Logger.info(new LogMsg(msg.getMessage("init.01", null))); + SecuredSAXParserFactoryImpl.newInstance(); Logger.info(new LogMsg(msg.getMessage("config.41", null))); + + ITSLVerifierFactory.setITSLVerifier(new MOATSLVerifier()); + tslconnector.initialize(tslconfig.getEuTSLUrl(), tslconfig.getWorkingDirectory(), null, null); } @@ -188,6 +195,11 @@ public class SystemInitializer { Logger.fatal(new LogMsg(msg.getMessage("init.00", null)), e); } catch (CertificateException e) { Logger.fatal(new LogMsg(msg.getMessage("init.00", null)), e); + } catch (Throwable e) { + Logger.fatal(new LogMsg(msg.getMessage("init.00", null)), e); + throw e; + } finally { + logger.info("Configuration initialized"); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureCreationInvoker.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureCreationInvoker.java index df04434..8e9380e 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureCreationInvoker.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureCreationInvoker.java @@ -52,8 +52,6 @@ import java.util.Set; import org.apache.commons.io.IOUtils; -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.MOAException; import at.gv.egovernment.moa.spss.MOASystemException; @@ -75,7 +73,9 @@ 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.FilteredOutputStream; import at.gv.egovernment.moa.spss.util.MessageProvider; -import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.Constants; /** * A class providing an API based interface to the diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java index 905254e..906abbe 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.invoke; import iaik.server.modules.AdESFormVerificationResult; @@ -34,6 +33,11 @@ import iaik.server.modules.cmsverify.CMSSignatureVerificationModuleFactory; import iaik.server.modules.cmsverify.CMSSignatureVerificationProfile; import iaik.server.modules.cmsverify.CMSSignatureVerificationResult; import iaik.server.modules.cmsverify.ExtendedCMSSignatureVerificationResult; +import iaik.server.modules.pdfverify.PDFSignatureVerificationProfile; +import iaik.server.modules.pdfverify.PDFSignatureVerificationResult; +import iaik.util.logging.Log; +import iaik.server.modules.pdfverify.ExtendedPDFSignatureVerificationResult; +import iaik.server.modules.pdfverify.PDFSignatureVerificationModule; import iaik.x509.X509Certificate; import java.io.ByteArrayInputStream; @@ -50,10 +54,8 @@ import java.util.List; import org.apache.commons.codec.binary.Hex; import org.apache.commons.io.HexDump; import org.apache.commons.io.IOUtils; +import org.slf4j.LoggerFactory; -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.api.cmsverify.CMSContent; @@ -70,14 +72,17 @@ 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.CertificateUtils; import at.gv.egovernment.moa.spss.util.QCSSCDResult; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.logging.LoggingContext; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; /** * A class providing an interface to the * CMSSignatureVerificationModule. * - * This class performs the invocation of the + * This class performs the invocation of the * iaik.server.modules.cmsverify.CMSSignatureVerificationModule - * from a VerifyCMSSignatureRequest. The result of the invocation + * from a VerifyCMSSignatureRequest. The result of the invocation * is integrated into a VerifyCMSSignatureResponse returned. * * @author Patrick Peck @@ -85,338 +90,414 @@ import at.gv.egovernment.moa.spss.util.QCSSCDResult; */ 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; - ExtendedCMSSignatureVerificationResult result; - int[] signatories; - InputStream input; - byte[] buf = new byte[2048]; - - // 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); - - // build the profile - if(request.isPDF()) { - profile = profileFactory.createPDFProfile(); - } else { - 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.verifyCAdESSignature(signingTime); - 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 - } - } - - QCSSCDResult qcsscdresult = new QCSSCDResult(); - - // 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();) { - Object resultObject = resultIter.next(); - CMSSignatureVerificationResult cmsResult = null; - List adesResults = null; - if(resultObject instanceof ExtendedCMSSignatureVerificationResult) { - result = (ExtendedCMSSignatureVerificationResult) resultObject; - - adesResults = getAdESResult(result.getFormVerificationResult()); - - if (adesResults != null) { - Iterator adesIterator = adesResults.iterator(); - while (adesIterator.hasNext()) { - Logger.info("ADES Formresults: " + adesIterator.next().toString()); - } - } - } else { - cmsResult = (CMSSignatureVerificationResult)resultObject; - } - - - String issuerCountryCode = null; - // QC/SSCD check - - List list = cmsResult.getCertificateValidationResult().getCertificateChain(); - if (list != null) { - X509Certificate[] chain = new X509Certificate[list.size()]; - - Iterator it = list.iterator(); - int i = 0; - while(it.hasNext()) { - chain[i] = (X509Certificate)it.next(); - i++; - } - - - qcsscdresult = CertificateUtils.checkQCSSCD(chain, trustProfile.isTSLEnabled()); - - // get signer certificate issuer country code - issuerCountryCode = CertificateUtils.getIssuerCountry((X509Certificate)list.get(0)); - - } - - responseBuilder.addResult(cmsResult, trustProfile, qcsscdresult.isQC(), qcsscdresult.isQCSourceTSL(), qcsscdresult.isSSCD(), qcsscdresult.isSSCDSourceTSL(), issuerCountryCode, adesResults); - } - } else { - int i; - - for (i = 0; i < signatories.length; i++) { - int sigIndex = signatories[i] - 1; - - try { - result = - (ExtendedCMSSignatureVerificationResult) results.get(signatories[i] - 1); - - String issuerCountryCode = null; - - CMSSignatureVerificationResult cmsResult = result.getCMSSignatureVerificationResult(); - - List adesResults = getAdESResult(result.getFormVerificationResult()); - - if (adesResults != null) { - Iterator adesIterator = adesResults.iterator(); - while (adesIterator.hasNext()) { - Logger.info("ADES Formresults: " + adesIterator.next().toString()); - } - } - - // QC/SSCD check - List list = cmsResult.getCertificateValidationResult().getCertificateChain(); - if (list != null) { - X509Certificate[] chain = new X509Certificate[list.size()]; - - Iterator it = list.iterator(); - int j = 0; - while(it.hasNext()) { - chain[j] = (X509Certificate)it.next(); - j++; - } - - - qcsscdresult = CertificateUtils.checkQCSSCD(chain, trustProfile.isTSLEnabled()); - - issuerCountryCode = CertificateUtils.getIssuerCountry((X509Certificate)list.get(0)); - } - - responseBuilder.addResult(cmsResult, trustProfile, qcsscdresult.isQC(), qcsscdresult.isQCSourceTSL(), qcsscdresult.isSSCD(), qcsscdresult.isSSCDSourceTSL(), issuerCountryCode, adesResults); - } 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 { - - InputStream is = null; - 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 : - is = ((CMSContentExcplicit) content).getBinaryContent(); - is = excludeByteRange(is, request); - return is; - case CMSContent.REFERENCE_CONTENT : - String reference = ((CMSContentReference) content).getReference(); - if (!"".equals(reference)) { - ExternalURIResolver resolver = new ExternalURIResolver(); - is = resolver.resolve(reference); - is = excludeByteRange(is, request); - return is; - } else { - return null; - } - default : - return null; - } - - - - } - - private InputStream excludeByteRange(InputStream contentIs, VerifyCMSSignatureRequest request) throws MOAApplicationException { - - int byteRead; - - ByteArrayOutputStream contentOs = new ByteArrayOutputStream(); - - CMSDataObject dataobject = request.getDataObject(); - BigDecimal from = dataobject.getExcludeByteRangeFrom(); - BigDecimal to = dataobject.getExcludeByteRangeTo(); - - if ( (from == null) || (to == null)) - return contentIs; - - BigDecimal counter = new BigDecimal("0"); - BigDecimal one = new BigDecimal("1"); - - try { - while ((byteRead=contentIs.read()) >= 0) { - - if (inRange(counter, dataobject)) { - // if byte is in byte range, set byte to 0x00 - contentOs.write(0); - } - else - contentOs.write(byteRead); - - counter = counter.add(one); + /** 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; + Date signingTime; + List results; + int[] signatories; + InputStream input; + byte[] buf = new byte[2048]; + + // get the signature + signature = request.getCMSSignature(); + + // get the actual trustprofile + TrustProfile trustProfile = context.getConfiguration().getTrustProfile(request.getTrustProfileId()); + + try { + // get the signing time + signingTime = request.getDateTime(); + + // build the profile + if (request.isPDF()) { + PDFSignatureVerificationProfile profile = profileFactory.createPDFProfile(); + Logger.info("Sending PDFSignatureVerificationProfile to IAIK-MOA"); + + PDFSignatureVerificationModule module = iaik.server.modules.pdfverify.PDFSignatureVerificationModuleFactory + .getInstance(); + + module.setLog(new IaikLog(loggingCtx.getNodeID())); + + module.init(signature, profile, new TransactionId(context.getTransactionID())); + + // input = module.getInputStream(); + + // while (input.read(buf) > 0); + if(request.isExtended()) { + results = module.verifyPAdESSignature(signingTime); + } else { + results = module.verifySignature(signingTime); + } + + } else { + // get the signed content + signedContent = getSignedContent(request); + CMSSignatureVerificationProfile profile = profileFactory.createProfile(); + Logger.info("Sending CMSSignatureVerificationProfile to IAIK-MOA"); + + // 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) + ; + + if(request.isExtended()) { + results = module.verifyCAdESSignature(signingTime); + } else { + results = module.verifySignature(signingTime); + } + // 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 + } + } + + QCSSCDResult qcsscdresult = new QCSSCDResult(); + + // 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();) { + Object resultObject = resultIter.next(); + if (!request.isPDF()) { + handleCMSResult(resultObject, responseBuilder, trustProfile); + } else { + handlePDFResult(resultObject, responseBuilder, trustProfile); + } + } + } else { + int i; + + for (i = 0; i < signatories.length; i++) { + int sigIndex = signatories[i] - 1; + + try { + Object resultObject = results.get(signatories[i] - 1); + if (!request.isPDF()) { + handleCMSResult(resultObject, responseBuilder, trustProfile); + } else { + handlePDFResult(resultObject, responseBuilder, trustProfile); + } + } catch (IndexOutOfBoundsException e) { + throw new MOAApplicationException("2249", new Object[] { new Integer(sigIndex) }); + } + } + } + + return responseBuilder.getResponse(); + } + + private void handleCMSResult(Object resultObject, VerifyCMSSignatureResponseBuilder responseBuilder, + TrustProfile trustProfile) throws MOAException { + QCSSCDResult qcsscdresult = new QCSSCDResult(); + + CMSSignatureVerificationResult cmsResult = null; + List adesResults = null; + if (resultObject instanceof ExtendedCMSSignatureVerificationResult) { + ExtendedCMSSignatureVerificationResult result = (ExtendedCMSSignatureVerificationResult) resultObject; + + adesResults = getAdESResult(result.getFormVerificationResult()); + + if (adesResults != null) { + Iterator adesIterator = adesResults.iterator(); + while (adesIterator.hasNext()) { + Logger.info("ADES Formresults: " + adesIterator.next().toString()); + } + } + } else { + cmsResult = (CMSSignatureVerificationResult) resultObject; + } + + String issuerCountryCode = null; + // QC/SSCD check + + List list = cmsResult.getCertificateValidationResult().getCertificateChain(); + if (list != null) { + X509Certificate[] chain = new X509Certificate[list.size()]; + + Iterator it = list.iterator(); + int i = 0; + while (it.hasNext()) { + chain[i] = (X509Certificate) it.next(); + i++; + } + + qcsscdresult = CertificateUtils.checkQCSSCD(chain, trustProfile.isTSLEnabled()); + + // get signer certificate issuer country code + issuerCountryCode = CertificateUtils.getIssuerCountry((X509Certificate) list.get(0)); + } - - InputStream is = new ByteArrayInputStream(contentOs.toByteArray()); - - return is; - - - } catch (IOException e) { - throw new MOAApplicationException("2301", null, e); + + responseBuilder.addResult(cmsResult, trustProfile, qcsscdresult.isQC(), qcsscdresult.isQCSourceTSL(), + qcsscdresult.isSSCD(), qcsscdresult.isSSCDSourceTSL(), issuerCountryCode, adesResults); } - - } - - - private boolean inRange(BigDecimal counter, CMSDataObject dataobject) { - BigDecimal from = dataobject.getExcludeByteRangeFrom(); - BigDecimal to = dataobject.getExcludeByteRangeTo(); - - if ( (from == null) || (to == null)) - return false; - - int compare = counter.compareTo(from); - if (compare == -1) - return false; - else { - compare = counter.compareTo(to); - if (compare == 1) - return false; - else - return true; - } - - - - } - - - private List getAdESResult(AdESFormVerificationResult adesFormVerification) { + + private void handleCMSEXTResult(Object resultObject, VerifyCMSSignatureResponseBuilder responseBuilder, + TrustProfile trustProfile) throws MOAException { + QCSSCDResult qcsscdresult = new QCSSCDResult(); + + CMSSignatureVerificationResult cmsResult = null; + List adesResults = null; + if (resultObject instanceof ExtendedCMSSignatureVerificationResult) { + ExtendedCMSSignatureVerificationResult result = (ExtendedCMSSignatureVerificationResult) resultObject; + + adesResults = getAdESResult(result.getFormVerificationResult()); + + if (adesResults != null) { + Iterator adesIterator = adesResults.iterator(); + while (adesIterator.hasNext()) { + Logger.info("ADES Formresults: " + adesIterator.next().toString()); + } + } + cmsResult = result.getCMSSignatureVerificationResult(); + } else { + cmsResult = (CMSSignatureVerificationResult) resultObject; + } + + String issuerCountryCode = null; + // QC/SSCD check + + List list = cmsResult.getCertificateValidationResult().getCertificateChain(); + if (list != null) { + X509Certificate[] chain = new X509Certificate[list.size()]; + + Iterator it = list.iterator(); + int i = 0; + while (it.hasNext()) { + chain[i] = (X509Certificate) it.next(); + i++; + } + + qcsscdresult = CertificateUtils.checkQCSSCD(chain, trustProfile.isTSLEnabled()); + + // get signer certificate issuer country code + issuerCountryCode = CertificateUtils.getIssuerCountry((X509Certificate) list.get(0)); + + } + + responseBuilder.addResult(cmsResult, trustProfile, qcsscdresult.isQC(), qcsscdresult.isQCSourceTSL(), + qcsscdresult.isSSCD(), qcsscdresult.isSSCDSourceTSL(), issuerCountryCode, adesResults); + } + + private void handlePDFResult(Object resultObject, VerifyCMSSignatureResponseBuilder responseBuilder, + TrustProfile trustProfile) throws MOAException { + QCSSCDResult qcsscdresult = new QCSSCDResult(); + + PDFSignatureVerificationResult cmsResult = null; + List adesResults = null; + if (resultObject instanceof ExtendedPDFSignatureVerificationResult) { + ExtendedPDFSignatureVerificationResult result = (ExtendedPDFSignatureVerificationResult) resultObject; + + adesResults = getAdESResult(result.getFormVerificationResult()); + + if (adesResults != null) { + Iterator adesIterator = adesResults.iterator(); + while (adesIterator.hasNext()) { + Logger.info("ADES Formresults: " + adesIterator.next().toString()); + } + } + cmsResult = result.getPDFSignatureVerificationResult(); + } else { + cmsResult = (PDFSignatureVerificationResult) resultObject; + } + + String issuerCountryCode = null; + // QC/SSCD check + + List list = cmsResult.getCertificateValidationResult().getCertificateChain(); + if (list != null) { + X509Certificate[] chain = new X509Certificate[list.size()]; + + Iterator it = list.iterator(); + int i = 0; + while (it.hasNext()) { + chain[i] = (X509Certificate) it.next(); + i++; + } + + qcsscdresult = CertificateUtils.checkQCSSCD(chain, trustProfile.isTSLEnabled()); + + // get signer certificate issuer country code + issuerCountryCode = CertificateUtils.getIssuerCountry((X509Certificate) list.get(0)); + + } + + responseBuilder.addResult(cmsResult, trustProfile, qcsscdresult.isQC(), qcsscdresult.isQCSourceTSL(), + qcsscdresult.isSSCD(), qcsscdresult.isSSCDSourceTSL(), issuerCountryCode, adesResults); + } + + /** + * 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 { + + InputStream is = null; + 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: + is = ((CMSContentExcplicit) content).getBinaryContent(); + is = excludeByteRange(is, request); + return is; + case CMSContent.REFERENCE_CONTENT: + String reference = ((CMSContentReference) content).getReference(); + if (!"".equals(reference)) { + ExternalURIResolver resolver = new ExternalURIResolver(); + is = resolver.resolve(reference); + is = excludeByteRange(is, request); + return is; + } else { + return null; + } + default: + return null; + } + + } + + private InputStream excludeByteRange(InputStream contentIs, VerifyCMSSignatureRequest request) + throws MOAApplicationException { + + int byteRead; + + ByteArrayOutputStream contentOs = new ByteArrayOutputStream(); + + CMSDataObject dataobject = request.getDataObject(); + BigDecimal from = dataobject.getExcludeByteRangeFrom(); + BigDecimal to = dataobject.getExcludeByteRangeTo(); + + if ((from == null) || (to == null)) + return contentIs; + + BigDecimal counter = new BigDecimal("0"); + BigDecimal one = new BigDecimal("1"); + + try { + while ((byteRead = contentIs.read()) >= 0) { + + if (inRange(counter, dataobject)) { + // if byte is in byte range, set byte to 0x00 + contentOs.write(0); + } else + contentOs.write(byteRead); + + counter = counter.add(one); + } + + InputStream is = new ByteArrayInputStream(contentOs.toByteArray()); + + return is; + + } catch (IOException e) { + throw new MOAApplicationException("2301", null, e); + } + + } + + private boolean inRange(BigDecimal counter, CMSDataObject dataobject) { + BigDecimal from = dataobject.getExcludeByteRangeFrom(); + BigDecimal to = dataobject.getExcludeByteRangeTo(); + + if ((from == null) || (to == null)) + return false; + + int compare = counter.compareTo(from); + if (compare == -1) + return false; + else { + compare = counter.compareTo(to); + if (compare == 1) + return false; + else + return true; + } + + } + + private List getAdESResult(AdESFormVerificationResult adesFormVerification) { if (adesFormVerification == null) { // no form information return null; @@ -451,5 +532,5 @@ public class CMSSignatureVerificationInvoker { } } } - + } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java index 74b2a89..bd5db6d 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java @@ -33,6 +33,7 @@ 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; import iaik.server.modules.cmsverify.CMSSignatureVerificationProfile; +import iaik.server.modules.pdfverify.PDFSignatureVerificationProfile; /** * A factory to create a CMSSignatureVerificationProfile from a @@ -65,7 +66,7 @@ public class CMSSignatureVerificationProfileFactory { * request, based on the current configuration. * @throws MOAException An error occurred creating the profile. */ - public CMSSignatureVerificationProfile createPDFProfile() + public PDFSignatureVerificationProfile createPDFProfile() throws MOAException { TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java index d775fdb..1eca7d2 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -49,8 +49,6 @@ import org.w3c.dom.NodeList; import org.xml.sax.EntityResolver; import org.xml.sax.SAXException; -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.Content; @@ -70,13 +68,15 @@ 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.MOASPSSEntityResolver; 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.MOAErrorHandler; -import at.gv.egovernment.moa.util.StreamEntityResolver; -import at.gv.egovernment.moa.util.StreamUtils; -import at.gv.egovernment.moa.util.XPathUtils; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.EntityResolverChain; +import at.gv.egovernment.moaspss.util.MOAErrorHandler; +import at.gv.egovernment.moaspss.util.StreamEntityResolver; +import at.gv.egovernment.moaspss.util.StreamUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; import iaik.server.modules.xml.DataObject; import iaik.server.modules.xml.NodeListImplementation; import iaik.server.modules.xml.URIReferenceImpl; diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java index 0bca8ae..0128e6a 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java @@ -28,11 +28,10 @@ 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; +import at.gv.egovernment.moaspss.util.XPathException; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * Utility methods for invoking the IAIK MOA modules. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java index 8f3c075..330ffdd 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java @@ -24,13 +24,12 @@ 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; +import at.gv.egovernment.moaspss.logging.LoggingContext; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; /** * A utility class for setting up and tearing down thread-local context diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java index f32093a..3e18c2a 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java @@ -25,7 +25,8 @@ package at.gv.egovernment.moa.spss.server.invoke; import iaik.server.modules.cmsverify.CMSSignatureVerificationResult; -import iaik.server.modules.cmsverify.CertificateValidationResult; +import iaik.server.modules.pdfverify.PDFSignatureVerificationResult; +import iaik.server.cmspdfverify.CertificateValidationResult; import java.security.cert.X509Certificate; import java.util.ArrayList; @@ -123,6 +124,61 @@ public class VerifyCMSSignatureResponseBuilder { responseElements.add(responseElement); } - + /** + * Add a verification result to the response. + * + * @param result The result to add. + * @param trustprofile The actual trustprofile + * @param checkQCFromTSL true, if the TSL check verifies the + * certificate as qualified, otherwise false. + * @param checkSSCD true, if the TSL check verifies the + * signature based on a SSDC, otherwise false. + * @param sscdSourceTSL true, if the SSCD information comes from the TSL, + * otherwise false. + * @throws MOAException + */ + public void addResult(PDFSignatureVerificationResult result, TrustProfile trustProfile, boolean checkQC, boolean qcSourceTSL, boolean checkSSCD, boolean sscdSourceTSL, String issuerCountryCode, List adesResults) + throws MOAException { + + CertificateValidationResult certResult = + result.getCertificateValidationResult(); + int signatureCheckCode = + result.getSignatureValueVerificationCode().intValue(); + int certificateCheckCode = certResult.getValidationResultCode().intValue(); + + VerifyCMSSignatureResponseElement responseElement; + SignerInfo signerInfo; + CheckResult signatureCheck; + CheckResult certificateCheck; + + boolean qualifiedCertificate = checkQC; + + // add SignerInfo element + signerInfo = + factory.createSignerInfo( + (X509Certificate) certResult.getCertificateChain().get(0), + qualifiedCertificate, + qcSourceTSL, + certResult.isPublicAuthorityCertificate(), + certResult.getPublicAuthorityID(), + checkSSCD, + sscdSourceTSL, + issuerCountryCode); + + // 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, + adesResults); + responseElements.add(responseElement); + } } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java index 7bcf723..a6e8971 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java @@ -50,9 +50,9 @@ 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; +import at.gv.egovernment.moaspss.util.CollectionUtils; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.NodeListAdapter; import iaik.server.modules.xml.BinaryDataObject; import iaik.server.modules.xml.DataObject; import iaik.server.modules.xml.XMLDataObject; diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java index 7debb7b..ecdd811 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java @@ -46,9 +46,6 @@ 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; @@ -69,8 +66,11 @@ 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; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.logging.LoggingContext; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * A class providing an API based interface to the diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java index 6a85415..cb77ad1 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java @@ -44,8 +44,6 @@ 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; @@ -67,7 +65,9 @@ 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; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.Constants; /** * A factory to create XMLSignatureCreationProfiles from a diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java index c09740c..a8c3ea0 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java @@ -40,10 +40,6 @@ 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; @@ -71,8 +67,12 @@ import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; import at.gv.egovernment.moa.spss.util.CertificateUtils; import at.gv.egovernment.moa.spss.util.MessageProvider; import at.gv.egovernment.moa.spss.util.QCSSCDResult; -import at.gv.egovernment.moa.util.CollectionUtils; -import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.logging.LoggingContext; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; +import at.gv.egovernment.moaspss.util.CollectionUtils; +import at.gv.egovernment.moaspss.util.Constants; import iaik.server.modules.AdESFormVerificationResult; import iaik.server.modules.AdESVerificationResult; import iaik.server.modules.IAIKException; @@ -162,7 +162,8 @@ public class XMLSignatureVerificationInvoker { LoggingContext loggingCtx = LoggingContextManager.getInstance().getLoggingContext(); XMLSignatureVerificationProfileFactory profileFactory = new XMLSignatureVerificationProfileFactory(request); VerifyXMLSignatureResponseBuilder responseBuilder = new VerifyXMLSignatureResponseBuilder(); - ExtendedXMLSignatureVerificationResult result; + ExtendedXMLSignatureVerificationResult result = null; + XMLSignatureVerificationResult plainResult; XMLSignatureVerificationProfile profile; ReferencesCheckResult signatureManifestCheck; DataObjectFactory dataObjFactory; @@ -215,8 +216,14 @@ public class XMLSignatureVerificationInvoker { module.setLog(new IaikLog(loggingCtx.getNodeID())); - result = module.verifyXAdESSignature(xmlSignature, dataObjectList, profile, signingTime, + if(request.getExtendedValidaiton()) { + result = module.verifyXAdESSignature(xmlSignature, dataObjectList, profile, signingTime, new TransactionId(context.getTransactionID())); + plainResult = result.getXMLSignatureVerificationResult(); + } else { + plainResult = module.verifySignature(xmlSignature, dataObjectList, profile, signingTime, + new TransactionId(context.getTransactionID())); + } } catch (IAIKException e) { MOAException moaException = IaikExceptionMapper.getInstance().map(e); throw moaException; @@ -225,19 +232,20 @@ public class XMLSignatureVerificationInvoker { throw moaException; } - List adesResults = getAdESResult(result.getFormVerificationResult()); + if(result != null) { + List adesResults = getAdESResult(result.getFormVerificationResult()); - if (adesResults != null) { - Iterator adesIterator = adesResults.iterator(); - while (adesIterator.hasNext()) { - Logger.info("ADES Formresults: " + adesIterator.next().toString()); + if (adesResults != null) { + Iterator adesIterator = adesResults.iterator(); + while (adesIterator.hasNext()) { + Logger.info("ADES Formresults: " + adesIterator.next().toString()); + } } - } - - responseBuilder.setAdESFormResults(adesResults); + responseBuilder.setAdESFormResults(adesResults); + } // QC/SSCD check - List list = result.getXMLSignatureVerificationResult().getCertificateValidationResult().getCertificateChain(); + List list = plainResult.getCertificateValidationResult().getCertificateChain(); if (list != null) { X509Certificate[] chain = new X509Certificate[list.size()]; @@ -261,17 +269,17 @@ public class XMLSignatureVerificationInvoker { } // check the result - signatureManifestCheck = validateSignatureManifest(request, result.getXMLSignatureVerificationResult(), + signatureManifestCheck = validateSignatureManifest(request, plainResult, 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.getXMLSignatureVerificationResult(), + CheckResult certificateCheck = validateSignerCertificate(plainResult, trustProfile); // build the response - responseBuilder.setResult(result.getXMLSignatureVerificationResult(), profile, signatureManifestCheck, + responseBuilder.setResult(plainResult, profile, signatureManifestCheck, certificateCheck, qcsscdresult.isQC(), qcsscdresult.isQCSourceTSL(), qcsscdresult.isSSCD(), qcsscdresult.isSSCDSourceTSL(), tp.isTSLEnabled(), issuerCountryCode); return responseBuilder.getResponse(); diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java index 64810a8..cca9117 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java @@ -24,12 +24,11 @@ package at.gv.egovernment.moa.spss.server.logging; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; 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. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java index f6d84c7..d3a930c 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java @@ -30,11 +30,11 @@ 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; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; /** * A Runnable for periodically cleaning up the revocation archive. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java index 3425dac..4e0d9f6 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java @@ -41,9 +41,9 @@ import java.util.Map.Entry; 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; +import at.gv.egovernment.moaspss.logging.Logger; /** * Contains information about the current request. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/config/Configurator.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/config/Configurator.java index defaedd..53e023f 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/config/Configurator.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/config/Configurator.java @@ -1,6 +1,6 @@ package at.gv.egovernment.moa.spss.tsl.config; -import iaik.util.logging._l; +import iaik.util.logging.GeneralLog; import iaik.xml.crypto.tsl.ex.TSLEngineDiedException; import java.net.MalformedURLException; @@ -37,7 +37,7 @@ public class Configurator { try { _euTSLURL = new URL(euTSLURL); } catch (MalformedURLException e) { - _l.err("Bad TSL URL: " + euTSLURL, e); + GeneralLog.err("Bad TSL URL: " + euTSLURL, e); throw new TSLEngineDiedException(e); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/MOATSLVerifier.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/MOATSLVerifier.java new file mode 100644 index 0000000..39b2f8c --- /dev/null +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/MOATSLVerifier.java @@ -0,0 +1,265 @@ +package at.gv.egovernment.moa.spss.tsl.connector; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.security.cert.X509Certificate; +import java.util.Iterator; +import java.util.ListIterator; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBIntrospector; +import javax.xml.crypto.Data; +import javax.xml.crypto.MarshalException; +import javax.xml.crypto.NodeSetData; +import javax.xml.crypto.URIReferenceException; +import javax.xml.crypto.dom.DOMCryptoContext; +import javax.xml.crypto.dsig.Reference; +import javax.xml.crypto.dsig.SignedInfo; +import javax.xml.crypto.dsig.Transform; +import javax.xml.crypto.dsig.XMLSignature; +import javax.xml.crypto.dsig.XMLSignatureException; +import javax.xml.crypto.dsig.XMLSignatureFactory; +import javax.xml.crypto.dsig.dom.DOMValidateContext; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import iaik.server.modules.xml.MOAXSecProvider; +import iaik.xml.crypto.tsl.TSLConstants; +import iaik.xml.crypto.tsl.TSLContext; +import iaik.xml.crypto.tsl.TSLEngine; +import iaik.xml.crypto.tsl.ex.SeverityAspect.Severity; +import iaik.xml.crypto.tsl.ex.TSLSecurityException; +import iaik.xml.crypto.tsl.ex.TSLVerificationException; +import iaik.xml.crypto.tsl.gen.TrustStatusListType; +import iaik.xml.crypto.tsl.verify.ITSLVerifier; +import iaik.xml.crypto.utils.URIDereferencerImpl; + +public class MOATSLVerifier implements ITSLVerifier { + + private static final Logger logger = LoggerFactory.getLogger(MOATSLVerifier.class); + + private static iaik.xml.crypto.xmldsig.gen.ObjectFactory dsOf = new iaik.xml.crypto.xmldsig.gen.ObjectFactory(); + + private static JAXBIntrospector JI = TSLEngine.jc.createJAXBIntrospector(); + + public Boolean verifyTSL(Document tslDoc, TSLContext tslContext, + ListIterator euTslCertsHash) { + + boolean coreValidity = false; + + try { + // Signature s = new Signature(); + // TrustServiceStatusList tssl = new TrustServiceStatusList(); + JAXBElement s = dsOf.createSignature(new iaik.xml.crypto.xmldsig.gen.SignatureType()); +// _l.debug(""+JI.getElementName(s)); + JAXBElement tssl = TSLConstants.TSL_OF.createTrustServiceStatusList(new TrustStatusListType()); +// _l.debug(""+JI.getElementName(tssl)); + + Element tsslE = tslDoc.getDocumentElement(); + + if (tsslE == null) { + tslContext.throwException(new TSLVerificationException("Empty XML File", Severity.xml_failed)); + // } else if (!tsslE.getNamespaceURI().equals(tssl.getName().getNamespaceURI())) { + } else if (!tsslE.getNamespaceURI().equals(JI.getElementName(tssl).getNamespaceURI())) { + tslContext.throwException(new TSLVerificationException("Incorrect Namespace", Severity.xml_failed)); + // } else if (!tsslE.getLocalName().equals(tssl.getName().getLocalPart())) { + } else if (!tsslE.getLocalName().equals(JI.getElementName(tssl).getLocalPart())) { + tslContext.throwException(new TSLVerificationException("Wrong Document Element in document "+tslDoc.getDocumentURI(), Severity.xml_failed)); + } + + //now we can be sure the right document element is in place, Schema validation does not assure this for us + //Schema validation however assures that the internal Structure of TrustServicesStatus List is correct + + // B.6 1) It MUST be an enveloped signature. + + Node n = tsslE.getLastChild(); + + while ( n != null && ! (n instanceof Element) ) { + n = n.getPreviousSibling(); + } + + Element sig = (Element) n; + + if (sig == null || + // ! sig.getNamespaceURI().equals(s.getName().getNamespaceURI()) || + // ! sig.getLocalName().equals(s.getName().getLocalPart())) { + ! sig.getNamespaceURI().equals(JI.getElementName(s).getNamespaceURI()) || + ! sig.getLocalName().equals(JI.getElementName(s).getLocalPart())) { + + tslContext.throwException( + new TSLVerificationException( + TSLSecurityException.Type.NO_TSL_SIGNATURE) + ); + + } else { + + NodeList cn = tsslE.getChildNodes(); + + for (int j = 0; j < cn.getLength(); j++) { + cn.item(j); + } + + //TODO assure connection with the PKI Module + DOMValidateContext valContext = new DOMValidateContext( + new MOATslKeySelector(euTslCertsHash, tslContext), + sig); + + if (valContext.getURIDereferencer() == null) { + valContext.setURIDereferencer(new URIDereferencerImpl()); + } + + // valContext.setProperty("iaik.xml.crypto.debug.OutputStream", System.out); + valContext.setProperty("javax.xml.crypto.dsig.cacheReference", Boolean.TRUE); + + XMLSignatureFactory fac = MOAXSecProvider.getXMLSignatureFactory(); + + // unmarshal the XMLSignature + XMLSignature signature = fac.unmarshalXMLSignature(valContext); + + // Validate the XMLSignature (generated above) + coreValidity = signature.validate(valContext); + // Check core validation status + if (coreValidity == false) { + debug(valContext, "Signature failed core validation"); + boolean sv = signature.getSignatureValue().validate(valContext); + debug(valContext, "signature validation status: " + sv); + // check the validation status of each Reference + Iterator it = signature.getSignedInfo().getReferences().iterator(); + for (int j = 0; it.hasNext(); j++) { + boolean refValid = ((Reference) it.next()).validate(valContext); + debug(valContext, "ref[" + j + "] validity status: " + refValid); + } + + tslContext.throwException(new TSLVerificationException("Signature failed core validation", Severity.signature_failed)); + } + + SignedInfo si = signature.getSignedInfo(); + Iterator it = si.getReferences().iterator(); + + + // 2) Its ds:SignedInfo element MUST contain a ds:Reference element with the + // URI attribute set to a value referencing the TrustServiceStatusList + // element enveloping the signature itself. This ds:Reference element MUST + // satisfy the following requirements: + // a) It MUST contain only one ds:Transforms element. + // b) This ds:Transforms element MUST contain two ds:Transform elements. The + // first one will be one whose Algorithm attribute indicates the enveloped + // transformation with the value: + // "http://www.w3.org/2000/09/xmldsig#enveloped-signature". The second one + // will be one whose Algorithm attribute instructs to perform the exclusive + // canonicalization "http://www.w3.org/2001/10/xml-exc-c14n#" + + boolean found_proper_tsslE_reference = false; + + for (int j = 0; it.hasNext(); j++) { + Reference ref = ((Reference) it.next()); + Data d = valContext.getURIDereferencer().dereference(ref, valContext); + + if(!(d instanceof NodeSetData)) { + continue; + } else { + NodeSetData nsd = (NodeSetData) d; + + + if (nsd.iterator().next() == tsslE) { + + //Assured by XMLSchema + //throw new TSLException("B.6 2 a) It MUST contain only one ds:Transforms element."); + + if(ref.getTransforms().size() != 2) { + tslContext.throwException( + new TSLVerificationException(TSLSecurityException.Type.NON_CONFORMANT_TRANSFORMS_IN_TSL_SIGNATURE) + ); + } else { + + Transform[] transforms = (Transform[]) ref.getTransforms().toArray(new Transform[2]); + + //TODO assign severity, code some heuristic showing the problems + if (! transforms[0].getAlgorithm().equals("http://www.w3.org/2000/09/xmldsig#enveloped-signature")) { + tslContext.throwException( + new TSLVerificationException(TSLSecurityException.Type.NON_CONFORMANT_TRANSFORM_IN_TSL_SIGNATURE) + ); + + } + + //TODO assign severity, code some heuristic showing the problems + if (! transforms[1].getAlgorithm().equals("http://www.w3.org/2001/10/xml-exc-c14n#")) { + tslContext.throwException( + new TSLVerificationException(TSLSecurityException.Type.NON_CONFORMANT_C14N_IN_TSL_SIGNATURE) + ); + } + } + + found_proper_tsslE_reference = true; + }//if (nsd.iterator().next() == tsslE) + + } + } + + if(!found_proper_tsslE_reference) { + tslContext.throwException( + new TSLVerificationException(TSLSecurityException.Type.NON_CONFORMANT_REFERENCE_IN_TSL_SIGNATURE) + ); + } + + // 3) ds:CanonicalizationMethod MUST be + // "http://www.w3.org/2001/10/xml-exc-c14n#". + if (! si.getCanonicalizationMethod().getAlgorithm().equals("http://www.w3.org/2001/10/xml-exc-c14n#")){ + tslContext.throwException( + new TSLVerificationException(TSLSecurityException.Type.NON_CONFORMANT_C14N_IN_CANONICALIZATION_METHOD) + ); + } + + // 4) It MAY have other ds:Reference elements. + + } + } catch (URIReferenceException e) { + tslContext.throwException(new TSLVerificationException(e)); + } catch (MarshalException e) { + tslContext.throwException(new TSLVerificationException(e)); + } catch (XMLSignatureException e) { + logger.error("Failed to verify XML Signature for TSL!", e); + return (Boolean) tslContext.throwException( + new TSLSecurityException(TSLSecurityException.Type.ERRORS_IN_TSL_SIGNATURE), + //we need an anonymous class to find the enclosing Method + (new Object(){}).getClass().getEnclosingMethod(), + null, + new Object[] {tslDoc, tslContext, euTslCertsHash} + ); + } + return coreValidity; + } + + public static void debug(DOMCryptoContext context, String message) { + + Object propDebug = context.getProperty("iaik.xml.crypto.debug.OutputStream"); + + if ( propDebug == null) { + return; + } + + if (! (propDebug instanceof OutputStream)) { + System.err.println("Failed to write to debug output stream. " + + "DOMCryptoContext's Property (\"iaik.xml.crypto.debug.OutputStream\") " + + "has to be of type OutputStream." + ); + } else { + + OutputStream os = (OutputStream) propDebug; + try { + (new OutputStreamWriter(os)).write(message); + } catch (IOException e) { + System.err.println("Failed to write to debug output stream. " + e.getMessage()); + //TODO we cannot close the output stream here ... + } + } + + } + +} diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/MOATslKeySelector.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/MOATslKeySelector.java new file mode 100644 index 0000000..efdd877 --- /dev/null +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/MOATslKeySelector.java @@ -0,0 +1,123 @@ +package at.gv.egovernment.moa.spss.tsl.connector; + +import java.security.cert.X509Certificate; +import java.util.List; +import java.util.ListIterator; + +import javax.xml.crypto.AlgorithmMethod; +import javax.xml.crypto.KeySelectorException; +import javax.xml.crypto.KeySelectorResult; +import javax.xml.crypto.XMLCryptoContext; +import javax.xml.crypto.dsig.keyinfo.KeyInfo; +import javax.xml.crypto.dsig.keyinfo.X509Data; + +import iaik.server.modules.xmlverify.MOAKeySelector; +import iaik.xml.crypto.tsl.TSLContext; +import iaik.xml.crypto.tsl.ex.TSLSecurityException; +import iaik.xml.crypto.tsl.ex.TSLVerificationException; +import iaik.xml.crypto.tsl.verify.TslKeyInfoHints; +import iaik.xml.crypto.utils.X509KeySelectorResult; + +public class MOATslKeySelector extends MOAKeySelector { + + private final ListIterator tslSignerCerts_; + private TSLContext tslContextI_; + + public MOATslKeySelector(ListIterator euTslCertsHash, TSLContext tslContext) { + if(euTslCertsHash == null){ + tslContext.throwException( + new TSLVerificationException( + TSLSecurityException.Type.MISSING_INFO_ON_TSL_SIGNER) + ); + } + tslSignerCerts_ = euTslCertsHash; + tslContextI_ = tslContext; + tslContext.toString(); + } + + @Override + protected KeyInfoHints newKeyInfoHints(KeyInfo keyInfo, + XMLCryptoContext context) + throws KeySelectorException { + + return new TslKeyInfoHints(keyInfo, context, tslContextI_, tslSignerCerts_); + + } + + @Override + protected KeySelectorResult select(KeyInfoHints hints, + KeySelectorResult[] results) { + + if (results.length > 1){ + + return (KeySelectorResult) tslContextI_.throwException( + new TSLSecurityException(TSLSecurityException.Type.UNTRUSTED_TSL_SIGNER), + //we need an anonymous class to find the enclosing Method + (new Object(){}).getClass().getEnclosingMethod(), + this, + new Object[] {hints, results} + ); + + } else { + KeySelectorResult result = results[0]; + if (result instanceof X509KeySelectorResult) { + result = new MOAX509KeySelectorResult((X509KeySelectorResult)result); + } else { + result = new MOAKeySelectorResult(result.getKey()); + } + return result; + } + } + + @Override + public KeySelectorResult select(X509Data x509Data, + Purpose purpose, + AlgorithmMethod method, + XMLCryptoContext context) throws KeySelectorException { + + X509KeySelectorResult ksr; + try { + ksr = (X509KeySelectorResult) super.select(x509Data, purpose, method, context); + } catch (ClassCastException e) { + ksr = (X509KeySelectorResult) tslContextI_.throwException( + e, + //we need an anonymous class to find the enclosing Method + (new Object(){}).getClass().getEnclosingMethod(), + this, + new Object[]{x509Data, purpose, method, context}); + } + + if (ksr == null){ + //there has been a Problem with the X509Data + ksr = (X509KeySelectorResult) tslContextI_.throwException( + new KeySelectorException(failReason_.replace(". ", ".\n")), + //we need an anonymous class to find the enclosing Method + (new Object(){}).getClass().getEnclosingMethod(), + this, + new Object[]{x509Data, purpose, method, context}); + } + + List l = ksr.getCertificates(); + tslContextI_.securityCheck( + TSLSecurityException.Type.UNTRUSTED_TSL_SIGNER, + (X509Certificate[]) l.toArray(new X509Certificate[l.size()]), + tslSignerCerts_ + ); + + return ksr; + } + + @Override + protected KeySelectorResult select(X509Certificate cert, Purpose purpose, + AlgorithmMethod method, XMLCryptoContext context) + throws KeySelectorException { + + tslContextI_.securityCheck( + TSLSecurityException.Type.UNTRUSTED_TSL_SIGNER, + cert, + tslSignerCerts_ + ); + + return super.select(cert, purpose, method, context); + } +} \ No newline at end of file diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/TSLConnector.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/TSLConnector.java index 82df37b..fee6ebe 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/TSLConnector.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/connector/TSLConnector.java @@ -29,8 +29,8 @@ import at.gv.egovernment.moa.spss.tsl.utils.TSLEUImportFromFileContext; import at.gv.egovernment.moa.spss.tsl.utils.TSLEvaluationContext; import at.gv.egovernment.moa.spss.tsl.utils.TSLImportFromFileContext; import iaik.asn1.ObjectID; -import iaik.util._15; -import iaik.util.logging._l; +import iaik.util.GeneralUtils15; +import iaik.util.logging.GeneralLog; import iaik.utils.RFC2253NameParser; import iaik.xml.crypto.EccProviderAdapter; import iaik.xml.crypto.XSecProvider; @@ -314,7 +314,7 @@ public class TSLConnector implements TSLConnectorInterface { log.debug(Thread.currentThread() + " waiting for other threads ..."); topLevelTslContext.waitForAllOtherThreads(); - log.debug(_15.dumpAllThreads()); + log.debug(GeneralUtils15.dumpAllThreads()); log.debug(Thread.currentThread() + " reactivated after other threads finished ..."); connection = null; @@ -395,7 +395,7 @@ public class TSLConnector implements TSLConnectorInterface { log.debug("### SURNAME registered as " + ObjectID.surName + " ###"); RFC2253NameParser.register("SURNAME", ObjectID.surName); - XSecProvider.addAsProvider(false); + //XSecProvider.addAsProvider(false); TSLEngine tslEngine; TslSqlConnectionWrapper connection = null; @@ -557,7 +557,7 @@ public class TSLConnector implements TSLConnectorInterface { log.debug(Thread.currentThread() + " waiting for other threads ..."); topLevelTslContext.waitForAllOtherThreads(); - log.debug(_15.dumpAllThreads()); + log.debug(GeneralUtils15.dumpAllThreads()); log.debug(Thread.currentThread() + " reactivated after other threads finished ..."); connection = null; @@ -635,7 +635,7 @@ public class TSLConnector implements TSLConnectorInterface { } catch (TSLEngineFatalException e) { e.printStackTrace(); - _l.err("could not export Certs", e); + GeneralLog.err("could not export Certs", e); throw new TSLEngineDiedException(e); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java index e06abe4..5139469 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java @@ -21,8 +21,6 @@ import java.util.Iterator; import java.util.Map; import java.util.TimerTask; -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.api.common.TSLConfiguration; import at.gv.egovernment.moa.spss.server.config.ConfigurationException; @@ -33,7 +31,9 @@ import at.gv.egovernment.moa.spss.server.iaik.pki.store.truststore.TrustStorePro import at.gv.egovernment.moa.spss.server.logging.TransactionId; import at.gv.egovernment.moa.spss.tsl.connector.TSLConnector; import at.gv.egovernment.moa.spss.util.MessageProvider; -import at.gv.egovernment.moa.util.StringUtils; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.StringUtils; public class TSLUpdaterTimerTask extends TimerTask { diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLEUImportFromFileContext.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLEUImportFromFileContext.java index 453ee2b..e0fff56 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLEUImportFromFileContext.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLEUImportFromFileContext.java @@ -1,6 +1,7 @@ package at.gv.egovernment.moa.spss.tsl.utils; import java.io.File; +import java.io.FileFilter; import java.io.IOException; import java.lang.reflect.Method; import java.net.URL; @@ -11,7 +12,7 @@ import java.util.List; import org.sqlite.SQLiteErrorCode; import iaik.util.logging.Log; -import iaik.util.logging._l; +import iaik.util.logging.GeneralLog; import iaik.util.logging.Log.MultiThreadLoggingGroup; import iaik.xml.crypto.tsl.DbTables; import iaik.xml.crypto.tsl.TSLImportFromFileContext; @@ -76,7 +77,7 @@ public class TSLEUImportFromFileContext extends TopLevelTslFetchContext { parameters[0] instanceof URL ){ - _l.err("Ignoring download error using old: " + parameters[0],null); + GeneralLog.err("Ignoring download error using old: " + parameters[0],null); wrapException(e); return parameters[1]; } @@ -87,7 +88,7 @@ public class TSLEUImportFromFileContext extends TopLevelTslFetchContext { TSLExceptionB ve = (TSLExceptionB) e; Severity s = ve.getSeverity(); if ( s != null && s.ordinal() < Severity.insecure.ordinal()){ - _l.err("Ignored Exception: ",ve); + GeneralLog.err("Ignored Exception: ",ve); // if(logExceptions_){ warnings_.add( new ThrowableAndLocatorAndMitigation( @@ -136,5 +137,10 @@ public class TSLEUImportFromFileContext extends TopLevelTslFetchContext { public void print(Object msg) { Log.print(msg); } + + @Override + public FileFilter getCertificateFileFilter() { + return null; + } } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLEvaluationContext.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLEvaluationContext.java index a656f11..f0723a1 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLEvaluationContext.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLEvaluationContext.java @@ -2,7 +2,7 @@ package at.gv.egovernment.moa.spss.tsl.utils; import iaik.util.logging.Log.MultiThreadLoggingGroup; import iaik.util.logging.Log; -import iaik.util.logging._l; +import iaik.util.logging.GeneralLog; import iaik.xml.crypto.tsl.BaseClass; import iaik.xml.crypto.tsl.SIEExtensionChecker; import iaik.xml.crypto.tsl.constants.Countries; @@ -42,7 +42,7 @@ public final class TSLEvaluationContext extends iaik.xml.crypto.tsl.TSLEvaluatio CriteriaListType criteriaList = (CriteriaListType) parameters[1]; - _l.warn(criteriaList.getDescription()); + GeneralLog.warn(criteriaList.getDescription()); String description = criteriaList.getDescription(); if (description diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLImportFromFileContext.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLImportFromFileContext.java index 5d69f69..eda2b34 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLImportFromFileContext.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/TSLImportFromFileContext.java @@ -2,6 +2,7 @@ package at.gv.egovernment.moa.spss.tsl.utils; import java.io.BufferedOutputStream; import java.io.File; +import java.io.FileFilter; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStream; @@ -36,10 +37,10 @@ import org.xml.sax.SAXParseException; import at.gv.egovernment.moa.spss.tsl.exception.MitigatedTSLSecurityException; import iaik.util.logging.Log.MultiThreadLoggingGroup; -import iaik.util.logging._l; +import iaik.util.logging.GeneralLog; import iaik.utils.RFC2253NameParserException; import iaik.utils.Util; -import iaik.util._15; +import iaik.util.GeneralUtils15; import iaik.xml.crypto.dsig.keyinfo.X509DataImpl; import iaik.xml.crypto.tsl.DbTables; import iaik.xml.crypto.tsl.TSLConstants; @@ -243,7 +244,7 @@ public class TSLImportFromFileContext extends iaik.xml.crypto.tsl.TSLImportFromF if (parameters[0] instanceof DOMError) { DOMError domError = (DOMError) parameters[0]; - _l.warn(""+domError.getRelatedData()); + GeneralLog.warn(""+domError.getRelatedData()); // domError.getRelatedData().getClass().getField("") @@ -277,9 +278,9 @@ public class TSLImportFromFileContext extends iaik.xml.crypto.tsl.TSLImportFromF String[] rdns = subDN.substring(1, subDN.length()).split("/"); - rdns = (String[]) _15.reverseInPlace(rdns); + rdns = (String[]) GeneralUtils15.reverseInPlace(rdns); - subDN = "/"+_15.implode("/", rdns); + subDN = "/"+GeneralUtils15.implode("/", rdns); //for now we only support properly quoted values or such without quotes @@ -375,7 +376,7 @@ public class TSLImportFromFileContext extends iaik.xml.crypto.tsl.TSLImportFromF } } - _l.err("Ignoring download error using old: " + parameters[0], null); + GeneralLog.err("Ignoring download error using old: " + parameters[0], null); wrapException(e); return parameters[1]; } @@ -448,7 +449,7 @@ public class TSLImportFromFileContext extends iaik.xml.crypto.tsl.TSLImportFromF X509Certificate crt = (X509Certificate)parameters[1]; File f = new File("./wrong/"+expectedTerritory_+"/", - iaik.util._15.toHexString(getFingerPrint(crt, + iaik.util.GeneralUtils15.toHexString(getFingerPrint(crt, new byte[TSLConstants.CertHash.LENGTH]))+".der"); File parent = f.getParentFile(); if(!parent.exists() && !parent.mkdirs()){ @@ -571,7 +572,7 @@ public class TSLImportFromFileContext extends iaik.xml.crypto.tsl.TSLImportFromF li.next(); String sn = (String) li.next(); - _l.err(sn, null); + GeneralLog.err(sn, null); System.exit(1); @@ -796,7 +797,7 @@ public class TSLImportFromFileContext extends iaik.xml.crypto.tsl.TSLImportFromF String msg = e.getMessage(); - _l.info(msg); + GeneralLog.info(msg); return( msg.startsWith("["+SQLiteErrorCode.SQLITE_CONSTRAINT.name()+"]") && msg.contains("column " + DbTables.TSLDownload.C.rawHash + " is not unique") @@ -804,7 +805,7 @@ public class TSLImportFromFileContext extends iaik.xml.crypto.tsl.TSLImportFromF } @Override - protected Long getLocalLastModified(File targetFile) { + protected File getLocalLastModified(File targetFile) { return super.getLocalLastModified(targetFile); } @Override @@ -830,7 +831,7 @@ public class TSLImportFromFileContext extends iaik.xml.crypto.tsl.TSLImportFromF synchronized (log) { parentContext_.print("<" + ncName + " state=\"" + currentThread.getState() + "\" " + " id=\"" + currentThread.getId() + "\">\n" + log.toString() + "" + _15.LB); + + ncName + ">" + GeneralUtils15.LB); parentContext_.flushLog(); log.setLength(0); } @@ -846,5 +847,9 @@ public class TSLImportFromFileContext extends iaik.xml.crypto.tsl.TSLImportFromF log.append(msg); } } + @Override + public FileFilter getCertificateFileFilter() { + return null; + } } \ No newline at end of file diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertificateUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertificateUtils.java index 544ea91..358524d 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertificateUtils.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertificateUtils.java @@ -17,9 +17,9 @@ import iaik.xml.crypto.tsl.ex.TSLSearchException; import java.security.Principal; -import at.gv.egovernment.moa.logging.LogMsg; -import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.spss.tsl.timer.TSLUpdaterTimerTask; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; public class CertificateUtils { diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ExternalURIVerifier.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ExternalURIVerifier.java index 219bb7c..859e7e9 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ExternalURIVerifier.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ExternalURIVerifier.java @@ -5,11 +5,11 @@ import java.net.UnknownHostException; import java.util.Iterator; import java.util.List; -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.server.config.ConfigurationException; import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; public class ExternalURIVerifier { diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MOASPSSEntityResolver.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MOASPSSEntityResolver.java index b5f72c4..ee6fe0a 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MOASPSSEntityResolver.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MOASPSSEntityResolver.java @@ -31,10 +31,10 @@ import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -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.util.Constants; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.Constants; /** diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java index 6c8a833..47b8d36 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java @@ -26,7 +26,7 @@ package at.gv.egovernment.moa.spss.util; import java.util.Locale; -import at.gv.egovernment.moa.util.Messages; +import at.gv.egovernment.moaspss.util.Messages; /** * Singleton wrapper around a Messages object. diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ResetableInputStreamWrapper.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ResetableInputStreamWrapper.java new file mode 100644 index 0000000..243cd5d --- /dev/null +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ResetableInputStreamWrapper.java @@ -0,0 +1,59 @@ +package at.gv.egovernment.moa.spss.util; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; + +public class ResetableInputStreamWrapper extends InputStream { + + private ByteArrayInputStream bais; + + public ResetableInputStreamWrapper(ByteArrayInputStream bais) { + this.bais = bais; + } + + @Override + public int read() throws IOException { + return this.bais.read(); + } + + @Override + public int read(byte[] b) throws IOException { + return this.bais.read(b); + } + + @Override + public int read(byte[] b, int off, int len) throws IOException { + return this.bais.read(b, off, len); + } + + @Override + public long skip(long n) throws IOException { + return this.bais.skip(n); + } + + @Override + public int available() throws IOException { + return this.bais.available(); + } + + @Override + public void close() throws IOException { + this.bais.close(); + } + + @Override + public synchronized void mark(int readlimit) { + this.bais.mark(readlimit); + } + + @Override + public synchronized void reset() throws IOException { + this.bais.reset(); + } + + @Override + public boolean markSupported() { + return this.bais.markSupported(); + } +} diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java index 16d9dc9..3d0d7da 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java @@ -28,7 +28,7 @@ import test.at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImplT 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.awtui.TestRunner; import junit.framework.Test; import junit.framework.TestSuite; @@ -43,7 +43,7 @@ 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(test.at.gv.egovernment.moa.spss.server.config.AllTests.class); suite.addTestSuite(ConfigurationDataImplTest.class); suite.addTestSuite(IaikConfiguratorTest.class); suite.addTest( @@ -56,7 +56,7 @@ public class AllTests { public static void main(String[] args) { try { - TestRunner.run(AllTests.class); + //TestRunner.run(AllTests.class); } catch (Exception e) { e.printStackTrace(); } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java index 64ab7db..9a55e27 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/SPSSTestCase.java @@ -27,12 +27,10 @@ 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.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.logging.LoggingContext; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; +import at.gv.egovernment.moaspss.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; diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java index 73bf54f..3b1022e 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java @@ -26,14 +26,13 @@ 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; +import at.gv.egovernment.moaspss.util.DateTimeUtils; /** * Test the VerifyCMSSignatureRequestParserTest. diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java index 66d7efa..ceb50fb 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java @@ -27,9 +27,6 @@ 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; @@ -37,6 +34,7 @@ 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; +import at.gv.egovernment.moaspss.util.DateTimeUtils; /** * Test the VerifyXMLSignatureRequestParserTest. diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java index 180b94d..c277de5 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java @@ -51,7 +51,7 @@ 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; +import at.gv.egovernment.moaspss.util.Constants; /** * @author Gregor Karlinger diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java index 45cae37..6bf1c9d 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java @@ -42,7 +42,7 @@ 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; +import at.gv.egovernment.moaspss.util.Constants; /** * @author Gregor Karlinger diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java index 59fa200..33be7f0 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java @@ -39,7 +39,7 @@ 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; +import at.gv.egovernment.moaspss.util.Constants; /** * @author Gregor Karlinger diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java index 11b0294..2deb180 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java @@ -45,7 +45,7 @@ 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.pki.store.revocation.archive.db.DataBaseArchiveParameter; import iaik.server.ConfigurationData; import iaik.server.modules.keys.HardwareKeyModuleConfiguration; import iaik.server.modules.keys.SoftwareKeyModuleConfiguration; @@ -101,18 +101,18 @@ public class ConfigurationDataImplTest extends SPSSTestCase { pkiConfig.getRevocationConfiguration(); ValidationConfiguration validationConfig = pkiConfig.getValidationConfiguration(); - DataBaseArchiveParameter archiveParam; + //DataBaseArchiveParameter archiveParam; Set distributionPoints; Iterator iter; boolean found; // test archive parameters - archiveParam = + /* 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( diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java index 0db5dbc..4bdf62a 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java @@ -28,14 +28,12 @@ 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; +import at.gv.egovernment.moaspss.util.DOMUtils; /** * Mainly a smoke test for debugging the CMSSignatureVerificationInvoker. diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java index 602393c..3d3e884 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java @@ -35,9 +35,6 @@ 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; @@ -46,6 +43,7 @@ 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; +import at.gv.egovernment.moaspss.util.Base64Utils; /** * Test cases for the DataObjectFactory class. diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java index 52f8038..64c0c8b 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java @@ -33,7 +33,7 @@ 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; -import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moaspss.util.Constants; import iaik.server.modules.xml.Base64Transformation; import iaik.server.modules.xml.Canonicalization; import iaik.server.modules.xml.EnvelopedSignatureTransformation; diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java index 8b3e6b0..e862e2c 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java @@ -30,14 +30,12 @@ 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; +import at.gv.egovernment.moaspss.util.DOMUtils; /** * Mainly a smoke test for debugging the XMLSignatureCreationInvoker. diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java index 7ea63e2..565ea27 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java @@ -27,14 +27,12 @@ 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; +import at.gv.egovernment.moaspss.util.DOMUtils; /** * Mainly a smoke test for debugging the XMLSignatureVerificationInvoker. diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java index 296ba00..9b2fd32 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java @@ -27,7 +27,7 @@ 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 at.gv.egovernment.moa.spss.server.tools.CertTool; import test.at.gv.egovernment.moa.MOATestCase; /** @@ -45,7 +45,7 @@ public class CertToolTest extends MOATestCase { + " CN=Patrick Peck,OU=MOA Team,O=BRZ,L=Vienna,ST=Vienna,C=AT\r\n" + "Serial Number :" + " 1047548672\r\n"; - private CertTool certTool; + //private CertTool certTool; /** * Constructor for CertToolTest. @@ -56,7 +56,7 @@ public class CertToolTest extends MOATestCase { } protected void setUp() { - certTool = new CertTool(); + //certTool = new CertTool(); } public void testPrintCertInfo() { @@ -64,7 +64,7 @@ public class CertToolTest extends MOATestCase { PrintStream ps = new PrintStream(bos); String result; - certTool.printCertInfo(TESTDATA_ROOT + "security/server.cer", ps); + //certTool.printCertInfo(TESTDATA_ROOT + "security/server.cer", ps); result = new String(bos.toByteArray()); System.out.println(result); assertEquals(EXPECTED_RESULT, result); diff --git a/moaSig/moa-sig/build.gradle b/moaSig/moa-sig/build.gradle index c366cf0..cfee94b 100644 --- a/moaSig/moa-sig/build.gradle +++ b/moaSig/moa-sig/build.gradle @@ -1,5 +1,6 @@ apply plugin: 'war' apply plugin: 'eclipse-wtp' +apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin' repositories { maven { @@ -14,14 +15,14 @@ dependencies { compile 'commons-discovery:commons-discovery:0.5' compile 'org.slf4j:slf4j-log4j12:1.7.12' - compile 'org.apache.cxf:cxf-rt-frontend-jaxws:3.1.4' - compile 'org.apache.cxf:cxf-rt-transports-http:3.1.4' - compile 'org.aspectj:aspectjrt:1.8.7' - compile 'org.aspectj:aspectjweaver:1.8.7' + //compile 'org.apache.cxf:cxf-rt-frontend-jaxws:3.1.4' + //compile 'org.apache.cxf:cxf-rt-transports-http:3.1.4' + //compile 'org.aspectj:aspectjrt:1.8.7' + //compile 'org.aspectj:aspectjweaver:1.8.7' - compile 'at.gv.egiz.pdfas:pdf-as-lib:4.0.7' - compile 'at.gv.egiz.pdfas:pdf-as-pdfbox:4.0.7' - compile 'at.gv.egiz.pdfas:sigs-pades:4.0.7' + //compile 'at.gv.egiz.pdfas:pdf-as-lib:4.0.7' + //compile 'at.gv.egiz.pdfas:pdf-as-pdfbox:4.0.7' + //compile 'at.gv.egiz.pdfas:sigs-pades:4.0.7' } sourceSets { @@ -38,6 +39,20 @@ configurations { dependencies { jaxb group: 'com.sun.xml.bind', name: 'jaxb-xjc', version: '2.2.4-1' + //compile 'ch.qos.logback:logback-classic:1.1.5' + //compile 'ch.qos.logback:logback-core:1.1.5' + //def tomcatVersion = '7.0.59' + //tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}", + // "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}", + // "org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}" +} + +gretty { + jvmArgs = [ + '-Dmoa.spss.server.configuration=/home/afitzek/server/moa-spss/apache-tomcat-8.0.0-RC3/conf/moa-spss/spss.config.xml', + '-Dlog4j.configuration=/home/afitzek/server/moa-spss/apache-tomcat-8.0.0-RC3/conf/moa-spss/log4j.properties' + ] + loggingLevel = "TRACE" } task jaxb () { @@ -62,3 +77,14 @@ task jaxb () { } //compileJava.dependsOn jaxb +// context where tomcat is deployed, by defautl localhost:8080/ + +//tomcat { +// stopKey = 'x' + //daemon = true +//} +//System.setProperty('moa.spss.server.configuration', '/home/afitzek/server/moa-spss/apache-tomcat-8.0.0-RC3/conf/moa-spss/spss.config.xml') +// System.setProperty('log4j.configuration', '/home/afitzek/server/moa-spss/apache-tomcat-8.0.0-RC3/conf/moa-spss/log4j.properties') + +//tomcatRun.contextPath = '/' +//tomcatRunWar.contextPath = '/' diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/AllSignatoriesType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/AllSignatoriesType.java index 0faa261..7c355f1 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/AllSignatoriesType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/AllSignatoriesType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/AnyChildrenType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/AnyChildrenType.java index c305a51..6c91ce0 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/AnyChildrenType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/AnyChildrenType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -43,8 +43,8 @@ import org.w3c.dom.Element; "content" }) @XmlSeeAlso({ - ReferencesCheckResultInfoType.class, - ManifestRefsCheckResultInfoType.class + ManifestRefsCheckResultInfoType.class, + ReferencesCheckResultInfoType.class }) public class AnyChildrenType { @@ -70,9 +70,9 @@ public class AnyChildrenType { * *

* Objects of the following type(s) are allowed in the list + * {@link Element } * {@link Object } * {@link String } - * {@link Element } * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSContentBaseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSContentBaseType.java index 86b030d..7427e70 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSContentBaseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSContentBaseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectInfoType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectInfoType.java index 69a89bb..9def3b2 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectInfoType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectInfoType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectOptionalMetaType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectOptionalMetaType.java index fda13bb..12d377f 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectOptionalMetaType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectOptionalMetaType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectRequiredMetaType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectRequiredMetaType.java index b3155c2..2b756d5 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectRequiredMetaType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CMSDataObjectRequiredMetaType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CanonicalizationMethodType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CanonicalizationMethodType.java index 196446d..14b7625 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CanonicalizationMethodType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CanonicalizationMethodType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -70,8 +70,8 @@ public class CanonicalizationMethodType { * *

* Objects of the following type(s) are allowed in the list - * {@link String } * {@link Object } + * {@link String } * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CheckResultType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CheckResultType.java index 93e4362..aaa6c0e 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CheckResultType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CheckResultType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -43,8 +43,8 @@ import javax.xml.bind.annotation.XmlType; "info" }) @XmlSeeAlso({ - ManifestRefsCheckResultType.class, - ReferencesCheckResultType.class + ReferencesCheckResultType.class, + ManifestRefsCheckResultType.class }) public class CheckResultType { diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentBaseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentBaseType.java index 692110e..e5b064e 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentBaseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentBaseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentExLocRefBaseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentExLocRefBaseType.java index 7c0dd25..1b660d8 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentExLocRefBaseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentExLocRefBaseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentOptionalRefType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentOptionalRefType.java index aa09c98..46db140 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentOptionalRefType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentOptionalRefType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -36,9 +36,9 @@ import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ContentOptionalRefType") @XmlSeeAlso({ + at.gv.egiz.moasig.DataObjectInfoType.DataObject.class, CMSContentBaseType.class, - ContentRequiredRefType.class, - at.gv.egiz.moasig.DataObjectInfoType.DataObject.class + ContentRequiredRefType.class }) public class ContentOptionalRefType extends ContentBaseType diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentRequiredRefType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentRequiredRefType.java index 09e8af8..6a57050 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentRequiredRefType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ContentRequiredRefType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureRequest.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureRequest.java index 4d166e7..89c8944 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureRequest.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureRequest.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureRequestType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureRequestType.java index b74132f..14b54c3 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureRequestType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureRequestType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureResponseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureResponseType.java index 7e4d9a5..ef473ce 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureResponseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateCMSSignatureResponseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureRequest.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureRequest.java index 3ee7507..c66580d 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureRequest.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureRequest.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2015.12.09 at 08:47:56 AM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureRequestType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureRequestType.java index c69738c..b6b4b2c 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureRequestType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureRequestType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2015.12.09 at 08:47:56 AM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureResponseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureResponseType.java index eace92c..5bd70ac 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureResponseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreatePDFSignatureResponseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2015.12.09 at 08:47:56 AM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateSignatureEnvironmentProfile.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateSignatureEnvironmentProfile.java index e3ee7fd..3a6f743 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateSignatureEnvironmentProfile.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateSignatureEnvironmentProfile.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateSignatureLocationType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateSignatureLocationType.java index f5e40af..5a1bd95 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateSignatureLocationType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateSignatureLocationType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateTransformsInfoProfile.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateTransformsInfoProfile.java index 74f0ad1..5277571 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateTransformsInfoProfile.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateTransformsInfoProfile.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureRequest.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureRequest.java index 3953720..1b4755e 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureRequest.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureRequest.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureRequestType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureRequestType.java index c19c1fa..0dd5bc0 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureRequestType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureRequestType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureResponseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureResponseType.java index fb00cd5..f7f38a4 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureResponseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/CreateXMLSignatureResponseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DSAKeyValueType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DSAKeyValueType.java index e3ee203..241cbe9 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DSAKeyValueType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DSAKeyValueType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DataObjectInfoType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DataObjectInfoType.java index f5853e5..068751c 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DataObjectInfoType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DataObjectInfoType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DigestMethodType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DigestMethodType.java index 2fc5bc8..038ce1c 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DigestMethodType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/DigestMethodType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -71,9 +71,9 @@ public class DigestMethodType { * *

* Objects of the following type(s) are allowed in the list + * {@link Element } * {@link Object } * {@link String } - * {@link Element } * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ErrorResponseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ErrorResponseType.java index 29e36c8..6bed498 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ErrorResponseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ErrorResponseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/FinalDataMetaInfoType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/FinalDataMetaInfoType.java index 829ba47..70afe1d 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/FinalDataMetaInfoType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/FinalDataMetaInfoType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/FormResultType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/FormResultType.java index dd6b787..0d61c08 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/FormResultType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/FormResultType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/InputDataType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/InputDataType.java index 6c24b40..477927d 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/InputDataType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/InputDataType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyInfoType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyInfoType.java index ea2b0a8..4663f48 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyInfoType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyInfoType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -60,13 +60,13 @@ import org.w3c.dom.Element; public class KeyInfoType { @XmlElementRefs({ - @XmlElementRef(name = "KeyValue", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "RetrievalMethod", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "PGPData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "KeyName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), @XmlElementRef(name = "X509Data", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "SPKIData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "KeyValue", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), @XmlElementRef(name = "MgmtData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "KeyName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false) + @XmlElementRef(name = "SPKIData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "RetrievalMethod", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "PGPData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false) }) @XmlMixed @XmlAnyElement(lax = true) @@ -95,16 +95,16 @@ public class KeyInfoType { * *

* Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link KeyValueType }{@code >} - * {@link JAXBElement }{@code <}{@link RetrievalMethodType }{@code >} + * {@link JAXBElement }{@code <}{@link String }{@code >} + * {@link JAXBElement }{@code <}{@link X509DataType }{@code >} * {@link Element } + * {@link JAXBElement }{@code <}{@link KeyValueType }{@code >} + * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link Object } + * {@link JAXBElement }{@code <}{@link SPKIDataType }{@code >} * {@link String } + * {@link JAXBElement }{@code <}{@link RetrievalMethodType }{@code >} * {@link JAXBElement }{@code <}{@link PGPDataType }{@code >} - * {@link JAXBElement }{@code <}{@link X509DataType }{@code >} - * {@link JAXBElement }{@code <}{@link SPKIDataType }{@code >} - * {@link JAXBElement }{@code <}{@link String }{@code >} - * {@link JAXBElement }{@code <}{@link String }{@code >} * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyStorageType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyStorageType.java index de9229e..0968c74 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyStorageType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyStorageType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyValueType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyValueType.java index 962acfd..993d15c 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyValueType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/KeyValueType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -74,11 +74,11 @@ public class KeyValueType { * *

* Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link DSAKeyValueType }{@code >} * {@link Element } + * {@link JAXBElement }{@code <}{@link DSAKeyValueType }{@code >} + * {@link JAXBElement }{@code <}{@link RSAKeyValueType }{@code >} * {@link Object } * {@link String } - * {@link JAXBElement }{@code <}{@link RSAKeyValueType }{@code >} * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestRefsCheckResultInfoType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestRefsCheckResultInfoType.java index 802500b..64cba47 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestRefsCheckResultInfoType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestRefsCheckResultInfoType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestRefsCheckResultType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestRefsCheckResultType.java index 6cb8b6e..3a61f4d 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestRefsCheckResultType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestRefsCheckResultType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestType.java index 00b879c..3cf35aa 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ManifestType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MetaInfoType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MetaInfoType.java index 5f7f52a..321d5d6 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MetaInfoType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MetaInfoType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MoaTransformType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MoaTransformType.java index 36797df..3874e8a 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MoaTransformType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MoaTransformType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -50,8 +50,8 @@ import javax.xml.bind.annotation.XmlType; public class MoaTransformType { @XmlElementRefs({ - @XmlElementRef(name = "transformData", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "XPath", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class, required = false) + @XmlElementRef(name = "XPath", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "transformData", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class, required = false) }) @XmlMixed protected List content; @@ -78,8 +78,8 @@ public class MoaTransformType { *

* Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link String }{@code >} - * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * {@link String } + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MoaTransformsType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MoaTransformsType.java index e262b9c..1deb142 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MoaTransformsType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/MoaTransformsType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/NamespaceDeclarationType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/NamespaceDeclarationType.java new file mode 100644 index 0000000..751ba8c --- /dev/null +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/NamespaceDeclarationType.java @@ -0,0 +1,99 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2016.03.14 at 12:02:35 PM CET +// + + +package at.gv.egiz.moasig; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

Java class for NamespaceDeclarationType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="NamespaceDeclarationType">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>token">
+ *       <attribute name="prefix" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "NamespaceDeclarationType", propOrder = { + "value" +}) +public class NamespaceDeclarationType { + + @XmlValue + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "token") + protected String value; + @XmlAttribute(name = "prefix", required = true) + protected String prefix; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Gets the value of the prefix property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPrefix() { + return prefix; + } + + /** + * Sets the value of the prefix property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPrefix(String value) { + this.prefix = value; + } + +} diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ObjectFactory.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ObjectFactory.java index 5fcafb9..beae6d9 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ObjectFactory.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ObjectFactory.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -34,61 +34,60 @@ import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory { - private final static QName _TransformTypeXPath_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "XPath"); - private final static QName _Signature_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Signature"); - private final static QName _PGPData_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPData"); - private final static QName _DSAKeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DSAKeyValue"); + private final static QName _SupplementProfile_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "SupplementProfile"); private final static QName _SPKIData_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SPKIData"); + private final static QName _CreateXMLSignatureResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "CreateXMLSignatureResponse"); + private final static QName _KeyInfo_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyInfo"); + private final static QName _SignatureValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureValue"); private final static QName _ErrorResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "ErrorResponse"); - private final static QName _SignedInfo_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignedInfo"); - private final static QName _RetrievalMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "RetrievalMethod"); + private final static QName _KeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyValue"); private final static QName _VerifyXMLSignatureResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "VerifyXMLSignatureResponse"); - private final static QName _CanonicalizationMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "CanonicalizationMethod"); - private final static QName _Object_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Object"); - private final static QName _VerifyPDFSignatureResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "VerifyPDFSignatureResponse"); - private final static QName _FailedReference_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "FailedReference"); - private final static QName _Supplement_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "Supplement"); - private final static QName _SignatureProperty_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperty"); private final static QName _Transforms_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Transforms"); - private final static QName _SignatureValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureValue"); - private final static QName _Manifest_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Manifest"); - private final static QName _Transform_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Transform"); + private final static QName _DigestMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DigestMethod"); + private final static QName _Supplement_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "Supplement"); + private final static QName _MoaTransforms_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "MoaTransforms"); private final static QName _X509Data_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Data"); - private final static QName _IssuingCountry_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "IssuingCountry"); - private final static QName _CreateXMLSignatureResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "CreateXMLSignatureResponse"); - private final static QName _SignatureMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureMethod"); - private final static QName _KeyInfo_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyInfo"); - private final static QName _SupplementProfile_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "SupplementProfile"); + private final static QName _SignatureProperty_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperty"); private final static QName _CreateCMSSignatureResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "CreateCMSSignatureResponse"); - private final static QName _VerifyCMSSignatureResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "VerifyCMSSignatureResponse"); - private final static QName _DigestMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DigestMethod"); - private final static QName _DigestValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DigestValue"); + private final static QName _FailedReference_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "FailedReference"); + private final static QName _KeyName_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyName"); + private final static QName _RSAKeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "RSAKeyValue"); + private final static QName _Signature_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Signature"); private final static QName _MgmtData_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "MgmtData"); + private final static QName _SignatureMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureMethod"); + private final static QName _Object_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Object"); + private final static QName _VerifyCMSSignatureResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "VerifyCMSSignatureResponse"); private final static QName _SignatureProperties_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperties"); - private final static QName _KeyName_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyName"); - private final static QName _KeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyValue"); + private final static QName _ReferringSigReference_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "ReferringSigReference"); + private final static QName _Transform_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Transform"); + private final static QName _VerifyPDFSignatureResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "VerifyPDFSignatureResponse"); + private final static QName _MoaTransform_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "MoaTransform"); + private final static QName _PGPData_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPData"); private final static QName _Reference_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Reference"); + private final static QName _RetrievalMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "RetrievalMethod"); + private final static QName _DSAKeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DSAKeyValue"); + private final static QName _DigestValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DigestValue"); private final static QName _PublicAuthority_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "PublicAuthority"); - private final static QName _CreatePDFSignatureResponse_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "CreatePDFSignatureResponse"); - private final static QName _MoaTransform_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "MoaTransform"); - private final static QName _ReferringSigReference_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "ReferringSigReference"); - private final static QName _RSAKeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "RSAKeyValue"); - private final static QName _MoaTransforms_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "MoaTransforms"); + private final static QName _CanonicalizationMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "CanonicalizationMethod"); + private final static QName _SignedInfo_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignedInfo"); + private final static QName _IssuingCountry_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "IssuingCountry"); + private final static QName _Manifest_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Manifest"); + private final static QName _MoaTransformTypeXPath_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "XPath"); + private final static QName _MoaTransformTypeTransformData_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "transformData"); + private final static QName _TransformTypeXPath_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "XPath"); + private final static QName _PGPDataTypePGPKeyID_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyID"); + private final static QName _PGPDataTypePGPKeyPacket_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyPacket"); private final static QName _SPKIDataTypeSPKISexp_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SPKISexp"); + private final static QName _X509DataTypeX509IssuerSerial_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509IssuerSerial"); + private final static QName _X509DataTypeX509CRL_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509CRL"); + private final static QName _X509DataTypeX509SubjectName_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SubjectName"); + private final static QName _X509DataTypeX509SKI_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SKI"); + private final static QName _X509DataTypeX509Certificate_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Certificate"); private final static QName _SignatureMethodTypeHMACOutputLength_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "HMACOutputLength"); - private final static QName _VerifyCMSSignatureResponseTypeSignatureCheck_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "SignatureCheck"); private final static QName _VerifyCMSSignatureResponseTypeCertificateCheck_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "CertificateCheck"); private final static QName _VerifyCMSSignatureResponseTypeSignerInfo_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "SignerInfo"); + private final static QName _VerifyCMSSignatureResponseTypeSignatureCheck_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "SignatureCheck"); private final static QName _VerifyCMSSignatureResponseTypeFormCheckResult_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "FormCheckResult"); - private final static QName _X509DataTypeX509IssuerSerial_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509IssuerSerial"); - private final static QName _X509DataTypeX509Certificate_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Certificate"); - private final static QName _X509DataTypeX509SKI_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SKI"); - private final static QName _X509DataTypeX509SubjectName_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SubjectName"); - private final static QName _X509DataTypeX509CRL_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509CRL"); - private final static QName _PGPDataTypePGPKeyID_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyID"); - private final static QName _PGPDataTypePGPKeyPacket_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyPacket"); - private final static QName _MoaTransformTypeTransformData_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "transformData"); - private final static QName _MoaTransformTypeXPath_QNAME = new QName("http://reference.e-government.gv.at/namespace/moa/20151109#", "XPath"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: at.gv.egiz.moasig @@ -105,14 +104,6 @@ public class ObjectFactory { return new CreateXMLSignatureRequestType(); } - /** - * Create an instance of {@link CreatePDFSignatureRequestType } - * - */ - public CreatePDFSignatureRequestType createCreatePDFSignatureRequestType() { - return new CreatePDFSignatureRequestType(); - } - /** * Create an instance of {@link CreateCMSSignatureRequestType } * @@ -145,14 +136,6 @@ public class ObjectFactory { return new CreateCMSSignatureRequestType.SingleSignatureInfo(); } - /** - * Create an instance of {@link TransformParameterType } - * - */ - public TransformParameterType createTransformParameterType() { - return new TransformParameterType(); - } - /** * Create an instance of {@link CreateXMLSignatureRequestType.SingleSignatureInfo } * @@ -162,19 +145,19 @@ public class ObjectFactory { } /** - * Create an instance of {@link VerifyXMLSignatureResponseType } + * Create an instance of {@link TransformParameterType } * */ - public VerifyXMLSignatureResponseType createVerifyXMLSignatureResponseType() { - return new VerifyXMLSignatureResponseType(); + public TransformParameterType createTransformParameterType() { + return new TransformParameterType(); } /** - * Create an instance of {@link VerifyPDFSignatureResponseType } + * Create an instance of {@link QualifiedCertificate } * */ - public VerifyPDFSignatureResponseType createVerifyPDFSignatureResponseType() { - return new VerifyPDFSignatureResponseType(); + public QualifiedCertificate createQualifiedCertificate() { + return new QualifiedCertificate(); } /** @@ -186,155 +169,163 @@ public class ObjectFactory { } /** - * Create an instance of {@link QualifiedCertificate } + * Create an instance of {@link CreateCMSSignatureResponseType } * */ - public QualifiedCertificate createQualifiedCertificate() { - return new QualifiedCertificate(); + public CreateCMSSignatureResponseType createCreateCMSSignatureResponseType() { + return new CreateCMSSignatureResponseType(); } /** - * Create an instance of {@link CreateXMLSignatureRequest } + * Create an instance of {@link VerifyPDFSignatureRequest } * */ - public CreateXMLSignatureRequest createCreateXMLSignatureRequest() { - return new CreateXMLSignatureRequest(); + public VerifyPDFSignatureRequest createVerifyPDFSignatureRequest() { + return new VerifyPDFSignatureRequest(); } /** - * Create an instance of {@link CreatePDFSignatureRequest } + * Create an instance of {@link VerifyPDFSignatureRequestType } * */ - public CreatePDFSignatureRequest createCreatePDFSignatureRequest() { - return new CreatePDFSignatureRequest(); + public VerifyPDFSignatureRequestType createVerifyPDFSignatureRequestType() { + return new VerifyPDFSignatureRequestType(); } /** - * Create an instance of {@link CreatePDFSignatureRequestType.SingleSignatureInfo } + * Create an instance of {@link CreateXMLSignatureResponseType } * */ - public CreatePDFSignatureRequestType.SingleSignatureInfo createCreatePDFSignatureRequestTypeSingleSignatureInfo() { - return new CreatePDFSignatureRequestType.SingleSignatureInfo(); + public CreateXMLSignatureResponseType createCreateXMLSignatureResponseType() { + return new CreateXMLSignatureResponseType(); } /** - * Create an instance of {@link VerifyTransformsInfoProfile } + * Create an instance of {@link CreateTransformsInfoProfile } * */ - public VerifyTransformsInfoProfile createVerifyTransformsInfoProfile() { - return new VerifyTransformsInfoProfile(); + public CreateTransformsInfoProfile createCreateTransformsInfoProfile() { + return new CreateTransformsInfoProfile(); } /** - * Create an instance of {@link MoaTransformsType } + * Create an instance of {@link TransformsInfoType } * */ - public MoaTransformsType createMoaTransformsType() { - return new MoaTransformsType(); + public TransformsInfoType createTransformsInfoType() { + return new TransformsInfoType(); } /** - * Create an instance of {@link ErrorResponseType } + * Create an instance of {@link VerifyCMSSignatureRequest } * */ - public ErrorResponseType createErrorResponseType() { - return new ErrorResponseType(); + public VerifyCMSSignatureRequest createVerifyCMSSignatureRequest() { + return new VerifyCMSSignatureRequest(); } /** - * Create an instance of {@link SecureSignatureCreationDevice } + * Create an instance of {@link VerifyCMSSignatureRequestType } * */ - public SecureSignatureCreationDevice createSecureSignatureCreationDevice() { - return new SecureSignatureCreationDevice(); + public VerifyCMSSignatureRequestType createVerifyCMSSignatureRequestType() { + return new VerifyCMSSignatureRequestType(); } /** - * Create an instance of {@link CreateSignatureEnvironmentProfile } + * Create an instance of {@link CMSDataObjectOptionalMetaType } * */ - public CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile() { - return new CreateSignatureEnvironmentProfile(); + public CMSDataObjectOptionalMetaType createCMSDataObjectOptionalMetaType() { + return new CMSDataObjectOptionalMetaType(); } /** - * Create an instance of {@link CreateSignatureLocationType } + * Create an instance of {@link VerifyCMSSignatureResponseType } * */ - public CreateSignatureLocationType createCreateSignatureLocationType() { - return new CreateSignatureLocationType(); + public VerifyCMSSignatureResponseType createVerifyCMSSignatureResponseType() { + return new VerifyCMSSignatureResponseType(); } /** - * Create an instance of {@link PublicAuthorityType } + * Create an instance of {@link SecureSignatureCreationDevice } * */ - public PublicAuthorityType createPublicAuthorityType() { - return new PublicAuthorityType(); + public SecureSignatureCreationDevice createSecureSignatureCreationDevice() { + return new SecureSignatureCreationDevice(); } /** - * Create an instance of {@link VerifyCMSSignatureRequest } + * Create an instance of {@link VerifyTransformsInfoProfile } * */ - public VerifyCMSSignatureRequest createVerifyCMSSignatureRequest() { - return new VerifyCMSSignatureRequest(); + public VerifyTransformsInfoProfile createVerifyTransformsInfoProfile() { + return new VerifyTransformsInfoProfile(); } /** - * Create an instance of {@link VerifyCMSSignatureRequestType } + * Create an instance of {@link MoaTransformsType } * */ - public VerifyCMSSignatureRequestType createVerifyCMSSignatureRequestType() { - return new VerifyCMSSignatureRequestType(); + public MoaTransformsType createMoaTransformsType() { + return new MoaTransformsType(); } /** - * Create an instance of {@link CMSDataObjectOptionalMetaType } + * Create an instance of {@link ErrorResponseType } * */ - public CMSDataObjectOptionalMetaType createCMSDataObjectOptionalMetaType() { - return new CMSDataObjectOptionalMetaType(); + public ErrorResponseType createErrorResponseType() { + return new ErrorResponseType(); } /** - * Create an instance of {@link CreatePDFSignatureResponseType } + * Create an instance of {@link MoaTransformType } * */ - public CreatePDFSignatureResponseType createCreatePDFSignatureResponseType() { - return new CreatePDFSignatureResponseType(); + public MoaTransformType createMoaTransformType() { + return new MoaTransformType(); } /** - * Create an instance of {@link MoaTransformType } + * Create an instance of {@link VerifyPDFSignatureResponseType } * */ - public MoaTransformType createMoaTransformType() { - return new MoaTransformType(); + public VerifyPDFSignatureResponseType createVerifyPDFSignatureResponseType() { + return new VerifyPDFSignatureResponseType(); } /** - * Create an instance of {@link VerifyPDFSignatureRequest } + * Create an instance of {@link VerifyXMLSignatureResponseType } * */ - public VerifyPDFSignatureRequest createVerifyPDFSignatureRequest() { - return new VerifyPDFSignatureRequest(); + public VerifyXMLSignatureResponseType createVerifyXMLSignatureResponseType() { + return new VerifyXMLSignatureResponseType(); } /** - * Create an instance of {@link VerifyPDFSignatureRequestType } + * Create an instance of {@link CreateSignatureEnvironmentProfile } * */ - public VerifyPDFSignatureRequestType createVerifyPDFSignatureRequestType() { - return new VerifyPDFSignatureRequestType(); + public CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile() { + return new CreateSignatureEnvironmentProfile(); } /** - * Create an instance of {@link CreateXMLSignatureResponseType } + * Create an instance of {@link CreateSignatureLocationType } * */ - public CreateXMLSignatureResponseType createCreateXMLSignatureResponseType() { - return new CreateXMLSignatureResponseType(); + public CreateSignatureLocationType createCreateSignatureLocationType() { + return new CreateSignatureLocationType(); + } + + /** + * Create an instance of {@link CreateXMLSignatureRequest } + * + */ + public CreateXMLSignatureRequest createCreateXMLSignatureRequest() { + return new CreateXMLSignatureRequest(); } /** @@ -370,99 +361,99 @@ public class ObjectFactory { } /** - * Create an instance of {@link CreateCMSSignatureResponseType } + * Create an instance of {@link PublicAuthorityType } * */ - public CreateCMSSignatureResponseType createCreateCMSSignatureResponseType() { - return new CreateCMSSignatureResponseType(); + public PublicAuthorityType createPublicAuthorityType() { + return new PublicAuthorityType(); } /** - * Create an instance of {@link VerifyCMSSignatureResponseType } + * Create an instance of {@link PDFSignatureResultType } * */ - public VerifyCMSSignatureResponseType createVerifyCMSSignatureResponseType() { - return new VerifyCMSSignatureResponseType(); + public PDFSignatureResultType createPDFSignatureResultType() { + return new PDFSignatureResultType(); } /** - * Create an instance of {@link CreateTransformsInfoProfile } + * Create an instance of {@link CheckResultType } * */ - public CreateTransformsInfoProfile createCreateTransformsInfoProfile() { - return new CreateTransformsInfoProfile(); + public CheckResultType createCheckResultType() { + return new CheckResultType(); } /** - * Create an instance of {@link TransformsInfoType } + * Create an instance of {@link ManifestRefsCheckResultInfoType } * */ - public TransformsInfoType createTransformsInfoType() { - return new TransformsInfoType(); + public ManifestRefsCheckResultInfoType createManifestRefsCheckResultInfoType() { + return new ManifestRefsCheckResultInfoType(); } /** - * Create an instance of {@link FormResultType } + * Create an instance of {@link ContentBaseType } * */ - public FormResultType createFormResultType() { - return new FormResultType(); + public ContentBaseType createContentBaseType() { + return new ContentBaseType(); } /** - * Create an instance of {@link CMSContentBaseType } + * Create an instance of {@link VerifyTransformsDataType } * */ - public CMSContentBaseType createCMSContentBaseType() { - return new CMSContentBaseType(); + public VerifyTransformsDataType createVerifyTransformsDataType() { + return new VerifyTransformsDataType(); } /** - * Create an instance of {@link ManifestRefsCheckResultType } + * Create an instance of {@link NamespaceDeclarationType } * */ - public ManifestRefsCheckResultType createManifestRefsCheckResultType() { - return new ManifestRefsCheckResultType(); + public NamespaceDeclarationType createNamespaceDeclarationType() { + return new NamespaceDeclarationType(); } /** - * Create an instance of {@link InputDataType } + * Create an instance of {@link XMLSignatureLocationType } * */ - public InputDataType createInputDataType() { - return new InputDataType(); + public XMLSignatureLocationType createXMLSignatureLocationType() { + return new XMLSignatureLocationType(); } /** - * Create an instance of {@link CheckResultType } + * Create an instance of {@link CMSDataObjectRequiredMetaType } * */ - public CheckResultType createCheckResultType() { - return new CheckResultType(); + public CMSDataObjectRequiredMetaType createCMSDataObjectRequiredMetaType() { + return new CMSDataObjectRequiredMetaType(); } /** - * Create an instance of {@link ContentBaseType } + * Create an instance of {@link FormResultType } * */ - public ContentBaseType createContentBaseType() { - return new ContentBaseType(); + public FormResultType createFormResultType() { + return new FormResultType(); } /** - * Create an instance of {@link PDFSignatureResultType } + * Create an instance of {@link FinalDataMetaInfoType } * */ - public PDFSignatureResultType createPDFSignatureResultType() { - return new PDFSignatureResultType(); + public FinalDataMetaInfoType createFinalDataMetaInfoType() { + return new FinalDataMetaInfoType(); } /** - * Create an instance of {@link FinalDataMetaInfoType } + * Create an instance of {@link MetaInfoType } * */ - public FinalDataMetaInfoType createFinalDataMetaInfoType() { - return new FinalDataMetaInfoType(); + public MetaInfoType createMetaInfoType() { + return new MetaInfoType(); } /** @@ -474,51 +465,51 @@ public class ObjectFactory { } /** - * Create an instance of {@link ReferencesCheckResultInfoType } + * Create an instance of {@link InputDataType } * */ - public ReferencesCheckResultInfoType createReferencesCheckResultInfoType() { - return new ReferencesCheckResultInfoType(); + public InputDataType createInputDataType() { + return new InputDataType(); } /** - * Create an instance of {@link CMSDataObjectRequiredMetaType } + * Create an instance of {@link ContentExLocRefBaseType } * */ - public CMSDataObjectRequiredMetaType createCMSDataObjectRequiredMetaType() { - return new CMSDataObjectRequiredMetaType(); + public ContentExLocRefBaseType createContentExLocRefBaseType() { + return new ContentExLocRefBaseType(); } /** - * Create an instance of {@link MetaInfoType } + * Create an instance of {@link AnyChildrenType } * */ - public MetaInfoType createMetaInfoType() { - return new MetaInfoType(); + public AnyChildrenType createAnyChildrenType() { + return new AnyChildrenType(); } /** - * Create an instance of {@link ContentExLocRefBaseType } + * Create an instance of {@link ContentOptionalRefType } * */ - public ContentExLocRefBaseType createContentExLocRefBaseType() { - return new ContentExLocRefBaseType(); + public ContentOptionalRefType createContentOptionalRefType() { + return new ContentOptionalRefType(); } /** - * Create an instance of {@link AnyChildrenType } + * Create an instance of {@link CMSContentBaseType } * */ - public AnyChildrenType createAnyChildrenType() { - return new AnyChildrenType(); + public CMSContentBaseType createCMSContentBaseType() { + return new CMSContentBaseType(); } /** - * Create an instance of {@link ManifestRefsCheckResultInfoType } + * Create an instance of {@link ReferencesCheckResultInfoType } * */ - public ManifestRefsCheckResultInfoType createManifestRefsCheckResultInfoType() { - return new ManifestRefsCheckResultInfoType(); + public ReferencesCheckResultInfoType createReferencesCheckResultInfoType() { + return new ReferencesCheckResultInfoType(); } /** @@ -529,14 +520,6 @@ public class ObjectFactory { return new ReferencesCheckResultType(); } - /** - * Create an instance of {@link VerifyTransformsDataType } - * - */ - public VerifyTransformsDataType createVerifyTransformsDataType() { - return new VerifyTransformsDataType(); - } - /** * Create an instance of {@link ContentRequiredRefType } * @@ -546,11 +529,11 @@ public class ObjectFactory { } /** - * Create an instance of {@link ContentOptionalRefType } + * Create an instance of {@link ManifestRefsCheckResultType } * */ - public ContentOptionalRefType createContentOptionalRefType() { - return new ContentOptionalRefType(); + public ManifestRefsCheckResultType createManifestRefsCheckResultType() { + return new ManifestRefsCheckResultType(); } /** @@ -562,107 +545,99 @@ public class ObjectFactory { } /** - * Create an instance of {@link KeyInfoType } - * - */ - public KeyInfoType createKeyInfoType() { - return new KeyInfoType(); - } - - /** - * Create an instance of {@link SignedInfoType } + * Create an instance of {@link PGPDataType } * */ - public SignedInfoType createSignedInfoType() { - return new SignedInfoType(); + public PGPDataType createPGPDataType() { + return new PGPDataType(); } /** - * Create an instance of {@link RetrievalMethodType } + * Create an instance of {@link KeyValueType } * */ - public RetrievalMethodType createRetrievalMethodType() { - return new RetrievalMethodType(); + public KeyValueType createKeyValueType() { + return new KeyValueType(); } /** - * Create an instance of {@link DigestMethodType } + * Create an instance of {@link DSAKeyValueType } * */ - public DigestMethodType createDigestMethodType() { - return new DigestMethodType(); + public DSAKeyValueType createDSAKeyValueType() { + return new DSAKeyValueType(); } /** - * Create an instance of {@link SignatureMethodType } + * Create an instance of {@link ReferenceType } * */ - public SignatureMethodType createSignatureMethodType() { - return new SignatureMethodType(); + public ReferenceType createReferenceType() { + return new ReferenceType(); } /** - * Create an instance of {@link SPKIDataType } + * Create an instance of {@link RetrievalMethodType } * */ - public SPKIDataType createSPKIDataType() { - return new SPKIDataType(); + public RetrievalMethodType createRetrievalMethodType() { + return new RetrievalMethodType(); } /** - * Create an instance of {@link X509DataType } + * Create an instance of {@link TransformsType } * */ - public X509DataType createX509DataType() { - return new X509DataType(); + public TransformsType createTransformsType() { + return new TransformsType(); } /** - * Create an instance of {@link PGPDataType } + * Create an instance of {@link CanonicalizationMethodType } * */ - public PGPDataType createPGPDataType() { - return new PGPDataType(); + public CanonicalizationMethodType createCanonicalizationMethodType() { + return new CanonicalizationMethodType(); } /** - * Create an instance of {@link SignatureType } + * Create an instance of {@link DigestMethodType } * */ - public SignatureType createSignatureType() { - return new SignatureType(); + public DigestMethodType createDigestMethodType() { + return new DigestMethodType(); } /** - * Create an instance of {@link DSAKeyValueType } + * Create an instance of {@link ManifestType } * */ - public DSAKeyValueType createDSAKeyValueType() { - return new DSAKeyValueType(); + public ManifestType createManifestType() { + return new ManifestType(); } /** - * Create an instance of {@link ManifestType } + * Create an instance of {@link SignaturePropertyType } * */ - public ManifestType createManifestType() { - return new ManifestType(); + public SignaturePropertyType createSignaturePropertyType() { + return new SignaturePropertyType(); } /** - * Create an instance of {@link SignatureValueType } + * Create an instance of {@link X509DataType } * */ - public SignatureValueType createSignatureValueType() { - return new SignatureValueType(); + public X509DataType createX509DataType() { + return new X509DataType(); } /** - * Create an instance of {@link TransformsType } + * Create an instance of {@link SignedInfoType } * */ - public TransformsType createTransformsType() { - return new TransformsType(); + public SignedInfoType createSignedInfoType() { + return new SignedInfoType(); } /** @@ -674,51 +649,51 @@ public class ObjectFactory { } /** - * Create an instance of {@link TransformType } + * Create an instance of {@link SPKIDataType } * */ - public TransformType createTransformType() { - return new TransformType(); + public SPKIDataType createSPKIDataType() { + return new SPKIDataType(); } /** - * Create an instance of {@link SignaturePropertyType } + * Create an instance of {@link SignatureValueType } * */ - public SignaturePropertyType createSignaturePropertyType() { - return new SignaturePropertyType(); + public SignatureValueType createSignatureValueType() { + return new SignatureValueType(); } /** - * Create an instance of {@link KeyValueType } + * Create an instance of {@link KeyInfoType } * */ - public KeyValueType createKeyValueType() { - return new KeyValueType(); + public KeyInfoType createKeyInfoType() { + return new KeyInfoType(); } /** - * Create an instance of {@link ReferenceType } + * Create an instance of {@link SignatureType } * */ - public ReferenceType createReferenceType() { - return new ReferenceType(); + public SignatureType createSignatureType() { + return new SignatureType(); } /** - * Create an instance of {@link CanonicalizationMethodType } + * Create an instance of {@link SignaturePropertiesType } * */ - public CanonicalizationMethodType createCanonicalizationMethodType() { - return new CanonicalizationMethodType(); + public SignaturePropertiesType createSignaturePropertiesType() { + return new SignaturePropertiesType(); } /** - * Create an instance of {@link SignaturePropertiesType } + * Create an instance of {@link SignatureMethodType } * */ - public SignaturePropertiesType createSignaturePropertiesType() { - return new SignaturePropertiesType(); + public SignatureMethodType createSignatureMethodType() { + return new SignatureMethodType(); } /** @@ -729,6 +704,14 @@ public class ObjectFactory { return new ObjectType(); } + /** + * Create an instance of {@link TransformType } + * + */ + public TransformType createTransformType() { + return new TransformType(); + } + /** * Create an instance of {@link X509IssuerSerialType } * @@ -753,14 +736,6 @@ public class ObjectFactory { return new CreateCMSSignatureRequestType.SingleSignatureInfo.DataObjectInfo(); } - /** - * Create an instance of {@link TransformParameterType.Hash } - * - */ - public TransformParameterType.Hash createTransformParameterTypeHash() { - return new TransformParameterType.Hash(); - } - /** * Create an instance of {@link CreateXMLSignatureRequestType.SingleSignatureInfo.DataObjectInfo } * @@ -778,48 +753,56 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link TransformParameterType.Hash } * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "XPath", scope = TransformType.class) - public JAXBElement createTransformTypeXPath(String value) { - return new JAXBElement(_TransformTypeXPath_QNAME, String.class, TransformType.class, value); + public TransformParameterType.Hash createTransformParameterTypeHash() { + return new TransformParameterType.Hash(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link SignatureType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link XMLDataObjectAssociationType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Signature") - public JAXBElement createSignature(SignatureType value) { - return new JAXBElement(_Signature_QNAME, SignatureType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "SupplementProfile") + public JAXBElement createSupplementProfile(XMLDataObjectAssociationType value) { + return new JAXBElement(_SupplementProfile_QNAME, XMLDataObjectAssociationType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link PGPDataType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link SPKIDataType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPData") - public JAXBElement createPGPData(PGPDataType value) { - return new JAXBElement(_PGPData_QNAME, PGPDataType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKIData") + public JAXBElement createSPKIData(SPKIDataType value) { + return new JAXBElement(_SPKIData_QNAME, SPKIDataType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link DSAKeyValueType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link CreateXMLSignatureResponseType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DSAKeyValue") - public JAXBElement createDSAKeyValue(DSAKeyValueType value) { - return new JAXBElement(_DSAKeyValue_QNAME, DSAKeyValueType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "CreateXMLSignatureResponse") + public JAXBElement createCreateXMLSignatureResponse(CreateXMLSignatureResponseType value) { + return new JAXBElement(_CreateXMLSignatureResponse_QNAME, CreateXMLSignatureResponseType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link SPKIDataType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link KeyInfoType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKIData") - public JAXBElement createSPKIData(SPKIDataType value) { - return new JAXBElement(_SPKIData_QNAME, SPKIDataType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyInfo") + public JAXBElement createKeyInfo(KeyInfoType value) { + return new JAXBElement(_KeyInfo_QNAME, KeyInfoType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link SignatureValueType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureValue") + public JAXBElement createSignatureValue(SignatureValueType value) { + return new JAXBElement(_SignatureValue_QNAME, SignatureValueType.class, null, value); } /** @@ -832,21 +815,12 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link SignedInfoType }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignedInfo") - public JAXBElement createSignedInfo(SignedInfoType value) { - return new JAXBElement(_SignedInfo_QNAME, SignedInfoType.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link RetrievalMethodType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link KeyValueType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "RetrievalMethod") - public JAXBElement createRetrievalMethod(RetrievalMethodType value) { - return new JAXBElement(_RetrievalMethod_QNAME, RetrievalMethodType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyValue") + public JAXBElement createKeyValue(KeyValueType value) { + return new JAXBElement(_KeyValue_QNAME, KeyValueType.class, null, value); } /** @@ -859,48 +833,48 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link CanonicalizationMethodType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link TransformsType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "CanonicalizationMethod") - public JAXBElement createCanonicalizationMethod(CanonicalizationMethodType value) { - return new JAXBElement(_CanonicalizationMethod_QNAME, CanonicalizationMethodType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transforms") + public JAXBElement createTransforms(TransformsType value) { + return new JAXBElement(_Transforms_QNAME, TransformsType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link ObjectType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link DigestMethodType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Object") - public JAXBElement createObject(ObjectType value) { - return new JAXBElement(_Object_QNAME, ObjectType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DigestMethod") + public JAXBElement createDigestMethod(DigestMethodType value) { + return new JAXBElement(_DigestMethod_QNAME, DigestMethodType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link VerifyPDFSignatureResponseType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link XMLDataObjectAssociationType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "VerifyPDFSignatureResponse") - public JAXBElement createVerifyPDFSignatureResponse(VerifyPDFSignatureResponseType value) { - return new JAXBElement(_VerifyPDFSignatureResponse_QNAME, VerifyPDFSignatureResponseType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "Supplement") + public JAXBElement createSupplement(XMLDataObjectAssociationType value) { + return new JAXBElement(_Supplement_QNAME, XMLDataObjectAssociationType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link MoaTransformsType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "FailedReference") - public JAXBElement createFailedReference(BigInteger value) { - return new JAXBElement(_FailedReference_QNAME, BigInteger.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "MoaTransforms") + public JAXBElement createMoaTransforms(MoaTransformsType value) { + return new JAXBElement(_MoaTransforms_QNAME, MoaTransformsType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link XMLDataObjectAssociationType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link X509DataType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "Supplement") - public JAXBElement createSupplement(XMLDataObjectAssociationType value) { - return new JAXBElement(_Supplement_QNAME, XMLDataObjectAssociationType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Data") + public JAXBElement createX509Data(X509DataType value) { + return new JAXBElement(_X509Data_QNAME, X509DataType.class, null, value); } /** @@ -913,175 +887,174 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link TransformsType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link CreateCMSSignatureResponseType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transforms") - public JAXBElement createTransforms(TransformsType value) { - return new JAXBElement(_Transforms_QNAME, TransformsType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "CreateCMSSignatureResponse") + public JAXBElement createCreateCMSSignatureResponse(CreateCMSSignatureResponseType value) { + return new JAXBElement(_CreateCMSSignatureResponse_QNAME, CreateCMSSignatureResponseType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link SignatureValueType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureValue") - public JAXBElement createSignatureValue(SignatureValueType value) { - return new JAXBElement(_SignatureValue_QNAME, SignatureValueType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "FailedReference") + public JAXBElement createFailedReference(BigInteger value) { + return new JAXBElement(_FailedReference_QNAME, BigInteger.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link ManifestType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Manifest") - public JAXBElement createManifest(ManifestType value) { - return new JAXBElement(_Manifest_QNAME, ManifestType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyName") + public JAXBElement createKeyName(String value) { + return new JAXBElement(_KeyName_QNAME, String.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link TransformType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link RSAKeyValueType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transform") - public JAXBElement createTransform(TransformType value) { - return new JAXBElement(_Transform_QNAME, TransformType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "RSAKeyValue") + public JAXBElement createRSAKeyValue(RSAKeyValueType value) { + return new JAXBElement(_RSAKeyValue_QNAME, RSAKeyValueType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link X509DataType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link SignatureType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Data") - public JAXBElement createX509Data(X509DataType value) { - return new JAXBElement(_X509Data_QNAME, X509DataType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Signature") + public JAXBElement createSignature(SignatureType value) { + return new JAXBElement(_Signature_QNAME, SignatureType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "IssuingCountry") - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - public JAXBElement createIssuingCountry(String value) { - return new JAXBElement(_IssuingCountry_QNAME, String.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "MgmtData") + public JAXBElement createMgmtData(String value) { + return new JAXBElement(_MgmtData_QNAME, String.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link CreateXMLSignatureResponseType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link SignatureMethodType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "CreateXMLSignatureResponse") - public JAXBElement createCreateXMLSignatureResponse(CreateXMLSignatureResponseType value) { - return new JAXBElement(_CreateXMLSignatureResponse_QNAME, CreateXMLSignatureResponseType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureMethod") + public JAXBElement createSignatureMethod(SignatureMethodType value) { + return new JAXBElement(_SignatureMethod_QNAME, SignatureMethodType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link SignatureMethodType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link ObjectType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureMethod") - public JAXBElement createSignatureMethod(SignatureMethodType value) { - return new JAXBElement(_SignatureMethod_QNAME, SignatureMethodType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Object") + public JAXBElement createObject(ObjectType value) { + return new JAXBElement(_Object_QNAME, ObjectType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link KeyInfoType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link VerifyCMSSignatureResponseType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyInfo") - public JAXBElement createKeyInfo(KeyInfoType value) { - return new JAXBElement(_KeyInfo_QNAME, KeyInfoType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "VerifyCMSSignatureResponse") + public JAXBElement createVerifyCMSSignatureResponse(VerifyCMSSignatureResponseType value) { + return new JAXBElement(_VerifyCMSSignatureResponse_QNAME, VerifyCMSSignatureResponseType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link XMLDataObjectAssociationType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link SignaturePropertiesType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "SupplementProfile") - public JAXBElement createSupplementProfile(XMLDataObjectAssociationType value) { - return new JAXBElement(_SupplementProfile_QNAME, XMLDataObjectAssociationType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureProperties") + public JAXBElement createSignatureProperties(SignaturePropertiesType value) { + return new JAXBElement(_SignatureProperties_QNAME, SignaturePropertiesType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link CreateCMSSignatureResponseType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "CreateCMSSignatureResponse") - public JAXBElement createCreateCMSSignatureResponse(CreateCMSSignatureResponseType value) { - return new JAXBElement(_CreateCMSSignatureResponse_QNAME, CreateCMSSignatureResponseType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "ReferringSigReference") + public JAXBElement createReferringSigReference(BigInteger value) { + return new JAXBElement(_ReferringSigReference_QNAME, BigInteger.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link VerifyCMSSignatureResponseType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link TransformType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "VerifyCMSSignatureResponse") - public JAXBElement createVerifyCMSSignatureResponse(VerifyCMSSignatureResponseType value) { - return new JAXBElement(_VerifyCMSSignatureResponse_QNAME, VerifyCMSSignatureResponseType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transform") + public JAXBElement createTransform(TransformType value) { + return new JAXBElement(_Transform_QNAME, TransformType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link DigestMethodType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link VerifyPDFSignatureResponseType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DigestMethod") - public JAXBElement createDigestMethod(DigestMethodType value) { - return new JAXBElement(_DigestMethod_QNAME, DigestMethodType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "VerifyPDFSignatureResponse") + public JAXBElement createVerifyPDFSignatureResponse(VerifyPDFSignatureResponseType value) { + return new JAXBElement(_VerifyPDFSignatureResponse_QNAME, VerifyPDFSignatureResponseType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link MoaTransformType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DigestValue") - public JAXBElement createDigestValue(byte[] value) { - return new JAXBElement(_DigestValue_QNAME, byte[].class, null, ((byte[]) value)); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "MoaTransform") + public JAXBElement createMoaTransform(MoaTransformType value) { + return new JAXBElement(_MoaTransform_QNAME, MoaTransformType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link PGPDataType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "MgmtData") - public JAXBElement createMgmtData(String value) { - return new JAXBElement(_MgmtData_QNAME, String.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPData") + public JAXBElement createPGPData(PGPDataType value) { + return new JAXBElement(_PGPData_QNAME, PGPDataType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link SignaturePropertiesType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link ReferenceType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureProperties") - public JAXBElement createSignatureProperties(SignaturePropertiesType value) { - return new JAXBElement(_SignatureProperties_QNAME, SignaturePropertiesType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Reference") + public JAXBElement createReference(ReferenceType value) { + return new JAXBElement(_Reference_QNAME, ReferenceType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link RetrievalMethodType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyName") - public JAXBElement createKeyName(String value) { - return new JAXBElement(_KeyName_QNAME, String.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "RetrievalMethod") + public JAXBElement createRetrievalMethod(RetrievalMethodType value) { + return new JAXBElement(_RetrievalMethod_QNAME, RetrievalMethodType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link KeyValueType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link DSAKeyValueType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyValue") - public JAXBElement createKeyValue(KeyValueType value) { - return new JAXBElement(_KeyValue_QNAME, KeyValueType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DSAKeyValue") + public JAXBElement createDSAKeyValue(DSAKeyValueType value) { + return new JAXBElement(_DSAKeyValue_QNAME, DSAKeyValueType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link ReferenceType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Reference") - public JAXBElement createReference(ReferenceType value) { - return new JAXBElement(_Reference_QNAME, ReferenceType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DigestValue") + public JAXBElement createDigestValue(byte[] value) { + return new JAXBElement(_DigestValue_QNAME, byte[].class, null, ((byte[]) value)); } /** @@ -1094,102 +1067,94 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link CreatePDFSignatureResponseType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link CanonicalizationMethodType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "CreatePDFSignatureResponse") - public JAXBElement createCreatePDFSignatureResponse(CreatePDFSignatureResponseType value) { - return new JAXBElement(_CreatePDFSignatureResponse_QNAME, CreatePDFSignatureResponseType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "CanonicalizationMethod") + public JAXBElement createCanonicalizationMethod(CanonicalizationMethodType value) { + return new JAXBElement(_CanonicalizationMethod_QNAME, CanonicalizationMethodType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link MoaTransformType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link SignedInfoType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "MoaTransform") - public JAXBElement createMoaTransform(MoaTransformType value) { - return new JAXBElement(_MoaTransform_QNAME, MoaTransformType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignedInfo") + public JAXBElement createSignedInfo(SignedInfoType value) { + return new JAXBElement(_SignedInfo_QNAME, SignedInfoType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "ReferringSigReference") - public JAXBElement createReferringSigReference(BigInteger value) { - return new JAXBElement(_ReferringSigReference_QNAME, BigInteger.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "IssuingCountry") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + public JAXBElement createIssuingCountry(String value) { + return new JAXBElement(_IssuingCountry_QNAME, String.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link RSAKeyValueType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link ManifestType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "RSAKeyValue") - public JAXBElement createRSAKeyValue(RSAKeyValueType value) { - return new JAXBElement(_RSAKeyValue_QNAME, RSAKeyValueType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Manifest") + public JAXBElement createManifest(ManifestType value) { + return new JAXBElement(_Manifest_QNAME, ManifestType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link MoaTransformsType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "MoaTransforms") - public JAXBElement createMoaTransforms(MoaTransformsType value) { - return new JAXBElement(_MoaTransforms_QNAME, MoaTransformsType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "XPath", scope = MoaTransformType.class) + public JAXBElement createMoaTransformTypeXPath(String value) { + return new JAXBElement(_MoaTransformTypeXPath_QNAME, String.class, MoaTransformType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKISexp", scope = SPKIDataType.class) - public JAXBElement createSPKIDataTypeSPKISexp(byte[] value) { - return new JAXBElement(_SPKIDataTypeSPKISexp_QNAME, byte[].class, SPKIDataType.class, ((byte[]) value)); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "HMACOutputLength", scope = SignatureMethodType.class) - public JAXBElement createSignatureMethodTypeHMACOutputLength(BigInteger value) { - return new JAXBElement(_SignatureMethodTypeHMACOutputLength_QNAME, BigInteger.class, SignatureMethodType.class, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "transformData", scope = MoaTransformType.class) + public JAXBElement createMoaTransformTypeTransformData(byte[] value) { + return new JAXBElement(_MoaTransformTypeTransformData_QNAME, byte[].class, MoaTransformType.class, ((byte[]) value)); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link CheckResultType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "SignatureCheck", scope = VerifyCMSSignatureResponseType.class) - public JAXBElement createVerifyCMSSignatureResponseTypeSignatureCheck(CheckResultType value) { - return new JAXBElement(_VerifyCMSSignatureResponseTypeSignatureCheck_QNAME, CheckResultType.class, VerifyCMSSignatureResponseType.class, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "XPath", scope = TransformType.class) + public JAXBElement createTransformTypeXPath(String value) { + return new JAXBElement(_TransformTypeXPath_QNAME, String.class, TransformType.class, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link CheckResultType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "CertificateCheck", scope = VerifyCMSSignatureResponseType.class) - public JAXBElement createVerifyCMSSignatureResponseTypeCertificateCheck(CheckResultType value) { - return new JAXBElement(_VerifyCMSSignatureResponseTypeCertificateCheck_QNAME, CheckResultType.class, VerifyCMSSignatureResponseType.class, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyID", scope = PGPDataType.class) + public JAXBElement createPGPDataTypePGPKeyID(byte[] value) { + return new JAXBElement(_PGPDataTypePGPKeyID_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link KeyInfoType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "SignerInfo", scope = VerifyCMSSignatureResponseType.class) - public JAXBElement createVerifyCMSSignatureResponseTypeSignerInfo(KeyInfoType value) { - return new JAXBElement(_VerifyCMSSignatureResponseTypeSignerInfo_QNAME, KeyInfoType.class, VerifyCMSSignatureResponseType.class, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyPacket", scope = PGPDataType.class) + public JAXBElement createPGPDataTypePGPKeyPacket(byte[] value) { + return new JAXBElement(_PGPDataTypePGPKeyPacket_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link FormResultType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "FormCheckResult", scope = VerifyCMSSignatureResponseType.class) - public JAXBElement createVerifyCMSSignatureResponseTypeFormCheckResult(FormResultType value) { - return new JAXBElement(_VerifyCMSSignatureResponseTypeFormCheckResult_QNAME, FormResultType.class, VerifyCMSSignatureResponseType.class, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKISexp", scope = SPKIDataType.class) + public JAXBElement createSPKIDataTypeSPKISexp(byte[] value) { + return new JAXBElement(_SPKIDataTypeSPKISexp_QNAME, byte[].class, SPKIDataType.class, ((byte[]) value)); } /** @@ -1205,9 +1170,18 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Certificate", scope = X509DataType.class) - public JAXBElement createX509DataTypeX509Certificate(byte[] value) { - return new JAXBElement(_X509DataTypeX509Certificate_QNAME, byte[].class, X509DataType.class, ((byte[]) value)); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509CRL", scope = X509DataType.class) + public JAXBElement createX509DataTypeX509CRL(byte[] value) { + return new JAXBElement(_X509DataTypeX509CRL_QNAME, byte[].class, X509DataType.class, ((byte[]) value)); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509SubjectName", scope = X509DataType.class) + public JAXBElement createX509DataTypeX509SubjectName(String value) { + return new JAXBElement(_X509DataTypeX509SubjectName_QNAME, String.class, X509DataType.class, value); } /** @@ -1220,57 +1194,57 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509SubjectName", scope = X509DataType.class) - public JAXBElement createX509DataTypeX509SubjectName(String value) { - return new JAXBElement(_X509DataTypeX509SubjectName_QNAME, String.class, X509DataType.class, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Certificate", scope = X509DataType.class) + public JAXBElement createX509DataTypeX509Certificate(byte[] value) { + return new JAXBElement(_X509DataTypeX509Certificate_QNAME, byte[].class, X509DataType.class, ((byte[]) value)); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509CRL", scope = X509DataType.class) - public JAXBElement createX509DataTypeX509CRL(byte[] value) { - return new JAXBElement(_X509DataTypeX509CRL_QNAME, byte[].class, X509DataType.class, ((byte[]) value)); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "HMACOutputLength", scope = SignatureMethodType.class) + public JAXBElement createSignatureMethodTypeHMACOutputLength(BigInteger value) { + return new JAXBElement(_SignatureMethodTypeHMACOutputLength_QNAME, BigInteger.class, SignatureMethodType.class, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link CheckResultType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyID", scope = PGPDataType.class) - public JAXBElement createPGPDataTypePGPKeyID(byte[] value) { - return new JAXBElement(_PGPDataTypePGPKeyID_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "CertificateCheck", scope = VerifyCMSSignatureResponseType.class) + public JAXBElement createVerifyCMSSignatureResponseTypeCertificateCheck(CheckResultType value) { + return new JAXBElement(_VerifyCMSSignatureResponseTypeCertificateCheck_QNAME, CheckResultType.class, VerifyCMSSignatureResponseType.class, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link KeyInfoType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyPacket", scope = PGPDataType.class) - public JAXBElement createPGPDataTypePGPKeyPacket(byte[] value) { - return new JAXBElement(_PGPDataTypePGPKeyPacket_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "SignerInfo", scope = VerifyCMSSignatureResponseType.class) + public JAXBElement createVerifyCMSSignatureResponseTypeSignerInfo(KeyInfoType value) { + return new JAXBElement(_VerifyCMSSignatureResponseTypeSignerInfo_QNAME, KeyInfoType.class, VerifyCMSSignatureResponseType.class, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link CheckResultType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "transformData", scope = MoaTransformType.class) - public JAXBElement createMoaTransformTypeTransformData(byte[] value) { - return new JAXBElement(_MoaTransformTypeTransformData_QNAME, byte[].class, MoaTransformType.class, ((byte[]) value)); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "SignatureCheck", scope = VerifyCMSSignatureResponseType.class) + public JAXBElement createVerifyCMSSignatureResponseTypeSignatureCheck(CheckResultType value) { + return new JAXBElement(_VerifyCMSSignatureResponseTypeSignatureCheck_QNAME, CheckResultType.class, VerifyCMSSignatureResponseType.class, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link FormResultType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "XPath", scope = MoaTransformType.class) - public JAXBElement createMoaTransformTypeXPath(String value) { - return new JAXBElement(_MoaTransformTypeXPath_QNAME, String.class, MoaTransformType.class, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", name = "FormCheckResult", scope = VerifyCMSSignatureResponseType.class) + public JAXBElement createVerifyCMSSignatureResponseTypeFormCheckResult(FormResultType value) { + return new JAXBElement(_VerifyCMSSignatureResponseTypeFormCheckResult_QNAME, FormResultType.class, VerifyCMSSignatureResponseType.class, value); } } diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ObjectType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ObjectType.java index 0fc0943..4494f4d 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ObjectType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ObjectType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -83,9 +83,9 @@ public class ObjectType { * *

* Objects of the following type(s) are allowed in the list + * {@link Element } * {@link Object } * {@link String } - * {@link Element } * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PDFSignatureResultType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PDFSignatureResultType.java index e1567bc..63ca953 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PDFSignatureResultType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PDFSignatureResultType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PDFSignedRepsonse.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PDFSignedRepsonse.java index 8b18768..6af2130 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PDFSignedRepsonse.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PDFSignedRepsonse.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PGPDataType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PGPDataType.java index fdade7f..f19eefa 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PGPDataType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PGPDataType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -88,10 +88,10 @@ public class PGPDataType { * *

* Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * {@link Element } * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * {@link Object } + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PublicAuthorityType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PublicAuthorityType.java index 76049e6..76721ae 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PublicAuthorityType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/PublicAuthorityType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/QualifiedCertificate.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/QualifiedCertificate.java index 9577f98..15404b4 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/QualifiedCertificate.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/QualifiedCertificate.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/RSAKeyValueType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/RSAKeyValueType.java index 3a7ba44..9525231 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/RSAKeyValueType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/RSAKeyValueType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferenceType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferenceType.java index cf5ff98..611f2c9 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferenceType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferenceType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferencesCheckResultInfoType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferencesCheckResultInfoType.java index f6700ce..0260328 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferencesCheckResultInfoType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferencesCheckResultInfoType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferencesCheckResultType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferencesCheckResultType.java index 85c12ea..429cd60 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferencesCheckResultType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/ReferencesCheckResultType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/RetrievalMethodType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/RetrievalMethodType.java index 1ec3d68..a3e6cd3 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/RetrievalMethodType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/RetrievalMethodType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SPKIDataType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SPKIDataType.java index 8e8e914..b5e36f3 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SPKIDataType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SPKIDataType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -67,9 +67,9 @@ public class SPKIDataType { * *

* Objects of the following type(s) are allowed in the list + * {@link Element } * {@link Object } * {@link JAXBElement }{@code <}{@link byte[]}{@code >} - * {@link Element } * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SecureSignatureCreationDevice.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SecureSignatureCreationDevice.java index e4f8397..e4b5ca5 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SecureSignatureCreationDevice.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SecureSignatureCreationDevice.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureMethodType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureMethodType.java index 8a425ed..2829062 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureMethodType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureMethodType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -75,8 +75,8 @@ public class SignatureMethodType { * *

* Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link BigInteger }{@code >} * {@link Object } + * {@link JAXBElement }{@code <}{@link BigInteger }{@code >} * {@link String } * * diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignaturePropertiesType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignaturePropertiesType.java index c106440..c4017ef 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignaturePropertiesType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignaturePropertiesType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignaturePropertyType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignaturePropertyType.java index 8d58626..6cdb654 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignaturePropertyType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignaturePropertyType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -80,9 +80,9 @@ public class SignaturePropertyType { * *

* Objects of the following type(s) are allowed in the list + * {@link Element } * {@link Object } * {@link String } - * {@link Element } * * */ diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureType.java index b0da91b..a928b80 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureValueType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureValueType.java index efb6359..9f8dc29 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureValueType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignatureValueType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignedInfoType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignedInfoType.java index b91610b..7ebb177 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignedInfoType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/SignedInfoType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformParameterType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformParameterType.java index 3cbc23b..55c2322 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformParameterType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformParameterType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformType.java index e320b31..9e62836 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -76,8 +76,8 @@ public class TransformType { *

* Objects of the following type(s) are allowed in the list * {@link Element } - * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link Object } + * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link String } * * diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformsInfoType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformsInfoType.java index 102a762..8e8b1df 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformsInfoType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformsInfoType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformsType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformsType.java index 5ad37b8..24c1631 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformsType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/TransformsType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureRequest.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureRequest.java index fb97464..7b67ffb 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureRequest.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureRequest.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureRequestType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureRequestType.java index b970ca6..c9aca2f 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureRequestType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureRequestType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -30,6 +30,7 @@ import javax.xml.datatype.XMLGregorianCalendar; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="DateTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/> + * <element name="ExtendedValidation" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * <element name="CMSSignature" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> * <element name="DataObject" type="{http://reference.e-government.gv.at/namespace/moa/20151109#}CMSDataObjectOptionalMetaType" minOccurs="0"/> * <element name="TrustProfileID" type="{http://www.w3.org/2001/XMLSchema}token"/> @@ -44,6 +45,7 @@ import javax.xml.datatype.XMLGregorianCalendar; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "VerifyCMSSignatureRequestType", propOrder = { "dateTime", + "extendedValidation", "cmsSignature", "dataObject", "trustProfileID" @@ -56,6 +58,8 @@ public class VerifyCMSSignatureRequestType { @XmlElement(name = "DateTime") @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar dateTime; + @XmlElement(name = "ExtendedValidation", defaultValue = "false") + protected Boolean extendedValidation; @XmlElement(name = "CMSSignature", required = true) protected byte[] cmsSignature; @XmlElement(name = "DataObject") @@ -89,6 +93,30 @@ public class VerifyCMSSignatureRequestType { this.dateTime = value; } + /** + * Gets the value of the extendedValidation property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isExtendedValidation() { + return extendedValidation; + } + + /** + * Sets the value of the extendedValidation property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setExtendedValidation(Boolean value) { + this.extendedValidation = value; + } + /** * Gets the value of the cmsSignature property. * diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureResponseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureResponseType.java index ece5c9d..e92bd48 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureResponseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyCMSSignatureResponseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -47,10 +47,10 @@ import javax.xml.bind.annotation.XmlType; public class VerifyCMSSignatureResponseType { @XmlElementRefs({ - @XmlElementRef(name = "CertificateCheck", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class), - @XmlElementRef(name = "SignatureCheck", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class), @XmlElementRef(name = "FormCheckResult", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class), - @XmlElementRef(name = "SignerInfo", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class) + @XmlElementRef(name = "SignerInfo", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class), + @XmlElementRef(name = "CertificateCheck", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class), + @XmlElementRef(name = "SignatureCheck", namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", type = JAXBElement.class) }) protected List> signerInfoAndSignatureCheckAndCertificateCheck; diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureRequest.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureRequest.java index 045e36f..1a3d824 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureRequest.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureRequest.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureRequestType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureRequestType.java index 6487059..3414e94 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureRequestType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureRequestType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -30,6 +30,7 @@ import javax.xml.datatype.XMLGregorianCalendar; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="DateTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/> + * <element name="ExtendedValidation" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * <element name="PDFSignature" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> * <element name="TrustProfileID" type="{http://www.w3.org/2001/XMLSchema}token"/> * </sequence> @@ -43,6 +44,7 @@ import javax.xml.datatype.XMLGregorianCalendar; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "VerifyPDFSignatureRequestType", propOrder = { "dateTime", + "extendedValidation", "pdfSignature", "trustProfileID" }) @@ -54,6 +56,8 @@ public class VerifyPDFSignatureRequestType { @XmlElement(name = "DateTime") @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar dateTime; + @XmlElement(name = "ExtendedValidation", defaultValue = "false") + protected Boolean extendedValidation; @XmlElement(name = "PDFSignature", required = true) protected byte[] pdfSignature; @XmlElement(name = "TrustProfileID", required = true) @@ -85,6 +89,30 @@ public class VerifyPDFSignatureRequestType { this.dateTime = value; } + /** + * Gets the value of the extendedValidation property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isExtendedValidation() { + return extendedValidation; + } + + /** + * Sets the value of the extendedValidation property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setExtendedValidation(Boolean value) { + this.extendedValidation = value; + } + /** * Gets the value of the pdfSignature property. * diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureResponseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureResponseType.java index bf344ce..9d2f7ed 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureResponseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyPDFSignatureResponseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyTransformsDataType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyTransformsDataType.java index 35a5366..743e609 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyTransformsDataType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyTransformsDataType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyTransformsInfoProfile.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyTransformsInfoProfile.java index b015978..827b1d9 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyTransformsInfoProfile.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyTransformsInfoProfile.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureRequest.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureRequest.java index 3187efd..6041b0f 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureRequest.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureRequest.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureRequestType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureRequestType.java index 4e4d28d..8b02f1d 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureRequestType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureRequestType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -34,13 +34,14 @@ import javax.xml.datatype.XMLGregorianCalendar; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="DateTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/> + * <element name="ExtendedValidation" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * <element name="VerifySignatureInfo"> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="VerifySignatureEnvironment" type="{http://reference.e-government.gv.at/namespace/moa/20151109#}ContentOptionalRefType"/> - * <element name="VerifySignatureLocation" type="{http://www.w3.org/2001/XMLSchema}token"/> + * <element name="VerifySignatureLocation" type="{http://reference.e-government.gv.at/namespace/moa/20151109#}XMLSignatureLocationType"/> * </sequence> * </restriction> * </complexContent> @@ -75,6 +76,7 @@ import javax.xml.datatype.XMLGregorianCalendar; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "VerifyXMLSignatureRequestType", propOrder = { "dateTime", + "extendedValidation", "verifySignatureInfo", "supplementProfileOrSupplementProfileID", "signatureManifestCheckParams", @@ -89,6 +91,8 @@ public class VerifyXMLSignatureRequestType { @XmlElement(name = "DateTime") @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar dateTime; + @XmlElement(name = "ExtendedValidation", defaultValue = "false") + protected Boolean extendedValidation; @XmlElement(name = "VerifySignatureInfo", required = true) protected VerifyXMLSignatureRequestType.VerifySignatureInfo verifySignatureInfo; @XmlElements({ @@ -129,6 +133,30 @@ public class VerifyXMLSignatureRequestType { this.dateTime = value; } + /** + * Gets the value of the extendedValidation property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isExtendedValidation() { + return extendedValidation; + } + + /** + * Sets the value of the extendedValidation property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setExtendedValidation(Boolean value) { + this.extendedValidation = value; + } + /** * Gets the value of the verifySignatureInfo property. * @@ -358,7 +386,7 @@ public class VerifyXMLSignatureRequestType { * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="VerifySignatureEnvironment" type="{http://reference.e-government.gv.at/namespace/moa/20151109#}ContentOptionalRefType"/> - * <element name="VerifySignatureLocation" type="{http://www.w3.org/2001/XMLSchema}token"/> + * <element name="VerifySignatureLocation" type="{http://reference.e-government.gv.at/namespace/moa/20151109#}XMLSignatureLocationType"/> * </sequence> * </restriction> * </complexContent> @@ -377,9 +405,7 @@ public class VerifyXMLSignatureRequestType { @XmlElement(name = "VerifySignatureEnvironment", required = true) protected ContentOptionalRefType verifySignatureEnvironment; @XmlElement(name = "VerifySignatureLocation", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "token") - protected String verifySignatureLocation; + protected XMLSignatureLocationType verifySignatureLocation; /** * Gets the value of the verifySignatureEnvironment property. @@ -410,10 +436,10 @@ public class VerifyXMLSignatureRequestType { * * @return * possible object is - * {@link String } + * {@link XMLSignatureLocationType } * */ - public String getVerifySignatureLocation() { + public XMLSignatureLocationType getVerifySignatureLocation() { return verifySignatureLocation; } @@ -422,10 +448,10 @@ public class VerifyXMLSignatureRequestType { * * @param value * allowed object is - * {@link String } + * {@link XMLSignatureLocationType } * */ - public void setVerifySignatureLocation(String value) { + public void setVerifySignatureLocation(XMLSignatureLocationType value) { this.verifySignatureLocation = value; } diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureResponseType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureResponseType.java index 69cac83..b1fb162 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureResponseType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/VerifyXMLSignatureResponseType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/X509DataType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/X509DataType.java index a7a7b97..fac1ade 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/X509DataType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/X509DataType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @@ -54,9 +54,9 @@ public class X509DataType { @XmlElementRefs({ @XmlElementRef(name = "X509CRL", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "X509Certificate", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), @XmlElementRef(name = "X509SKI", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), @XmlElementRef(name = "X509IssuerSerial", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "X509Certificate", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), @XmlElementRef(name = "X509SubjectName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false) }) @XmlAnyElement(lax = true) @@ -80,12 +80,12 @@ public class X509DataType { * *

* Objects of the following type(s) are allowed in the list - * {@link Element } - * {@link Object } * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * {@link JAXBElement }{@code <}{@link byte[]}{@code >} - * {@link JAXBElement }{@code <}{@link X509IssuerSerialType }{@code >} + * {@link Element } * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * {@link JAXBElement }{@code <}{@link X509IssuerSerialType }{@code >} + * {@link Object } * {@link JAXBElement }{@code <}{@link String }{@code >} * * diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/X509IssuerSerialType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/X509IssuerSerialType.java index 4e066e5..6c4941c 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/X509IssuerSerialType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/X509IssuerSerialType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLDataObjectAssociationType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLDataObjectAssociationType.java index b9b0958..81aaf02 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLDataObjectAssociationType.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLDataObjectAssociationType.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLSignatureLocation.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLSignatureLocation.java new file mode 100644 index 0000000..a82bd26 --- /dev/null +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLSignatureLocation.java @@ -0,0 +1,102 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.12.09 at 08:10:59 AM CET +// + + +package at.gv.egiz.moasig; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

Java class for XMLSignatureLocation complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="XMLSignatureLocation">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="NamespaceDeclaration" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
+ *         <element name="XPathExpression" type="{http://www.w3.org/2001/XMLSchema}token"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "XMLSignatureLocation", propOrder = { + "namespaceDeclaration", + "xPathExpression" +}) +public class XMLSignatureLocation { + + @XmlElement(name = "NamespaceDeclaration", required = true) + protected Object namespaceDeclaration; + @XmlElement(name = "XPathExpression", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "token") + protected String xPathExpression; + + /** + * Gets the value of the namespaceDeclaration property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getNamespaceDeclaration() { + return namespaceDeclaration; + } + + /** + * Sets the value of the namespaceDeclaration property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setNamespaceDeclaration(Object value) { + this.namespaceDeclaration = value; + } + + /** + * Gets the value of the xPathExpression property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXPathExpression() { + return xPathExpression; + } + + /** + * Sets the value of the xPathExpression property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXPathExpression(String value) { + this.xPathExpression = value; + } + +} diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLSignatureLocationType.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLSignatureLocationType.java new file mode 100644 index 0000000..9293c1d --- /dev/null +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/XMLSignatureLocationType.java @@ -0,0 +1,109 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2016.03.14 at 12:02:35 PM CET +// + + +package at.gv.egiz.moasig; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

Java class for XMLSignatureLocationType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="XMLSignatureLocationType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="NamespaceDeclaration" type="{http://reference.e-government.gv.at/namespace/moa/20151109#}NamespaceDeclarationType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="XPathExpression" type="{http://www.w3.org/2001/XMLSchema}token"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "XMLSignatureLocationType", propOrder = { + "namespaceDeclaration", + "xPathExpression" +}) +public class XMLSignatureLocationType { + + @XmlElement(name = "NamespaceDeclaration") + protected List namespaceDeclaration; + @XmlElement(name = "XPathExpression", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "token") + protected String xPathExpression; + + /** + * Gets the value of the namespaceDeclaration property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the namespaceDeclaration property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getNamespaceDeclaration().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link NamespaceDeclarationType } + * + * + */ + public List getNamespaceDeclaration() { + if (namespaceDeclaration == null) { + namespaceDeclaration = new ArrayList(); + } + return this.namespaceDeclaration; + } + + /** + * Gets the value of the xPathExpression property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXPathExpression() { + return xPathExpression; + } + + /** + * Sets the value of the xPathExpression property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXPathExpression(String value) { + this.xPathExpression = value; + } + +} diff --git a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/package-info.java b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/package-info.java index 0344afc..08d774d 100644 --- a/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/package-info.java +++ b/moaSig/moa-sig/src/generated/java/at/gv/egiz/moasig/package-info.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.11.30 at 11:32:30 AM CET +// Generated on: 2016.03.14 at 12:02:35 PM CET // @javax.xml.bind.annotation.XmlSchema(namespace = "http://reference.e-government.gv.at/namespace/moa/20151109#", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/initializer/PDFASInitializer.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/initializer/PDFASInitializer.java index aaa41c1..fb84293 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/initializer/PDFASInitializer.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/initializer/PDFASInitializer.java @@ -13,14 +13,16 @@ public class PDFASInitializer implements ExternalInitializer { @Override public void initialize(ConfigurationProvider configurationProvider) { - String pdfAsConfiguration = configurationProvider.getPDFASConfiguration(); + logger.warn("Log4j Config: {}", System.getProperty("log4j.configuration")); + + /*String pdfAsConfiguration = configurationProvider.getPDFASConfiguration(); logger.info("Running PDFASInitializer with pdf as cfg: {}", pdfAsConfiguration); if(pdfAsConfiguration != null) { PDFASInvoker .init(pdfAsConfiguration); - } + }*/ } } diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/invoke/PDFASInvoker.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/invoke/PDFASInvoker.java index 7f638fa..1f7522b 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/invoke/PDFASInvoker.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/invoke/PDFASInvoker.java @@ -7,17 +7,6 @@ import java.util.List; import org.apache.commons.io.IOUtils; -import at.gv.egiz.pdfas.common.exceptions.PDFASError; -import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; -import at.gv.egiz.pdfas.lib.api.Configuration; -import at.gv.egiz.pdfas.lib.api.PdfAs; -import at.gv.egiz.pdfas.lib.api.PdfAsFactory; -import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; -import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; -import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; -import at.gv.egiz.pdfas.sigs.pades.PAdESSigner; -import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.MOAException; import at.gv.egovernment.moa.spss.server.logging.TransactionId; @@ -29,9 +18,10 @@ import at.gv.egovernment.moa.spss.server.xmlbind.PDFSignatureInfo; import at.gv.egovernment.moa.spss.server.xmlbind.SignedPDFInfo; import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFRequest; import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFResponse; +import at.gv.egovernment.moaspss.logging.Logger; public class PDFASInvoker { - + /* private static PDFASInvoker instance = null; private PdfAs pdfAS; @@ -124,5 +114,5 @@ public class PDFASInvoker { } return createPDFRespone; - } + }*/ } diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/ExtendedVerifyResult.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/ExtendedVerifyResult.java index 30bf148..705e124 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/ExtendedVerifyResult.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/ExtendedVerifyResult.java @@ -1,9 +1,9 @@ package at.gv.egovernment.moa.spss.server.pdfas; - +/* import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; import at.gv.egiz.pdfas.lib.impl.verify.VerifyResultImpl; - -public class ExtendedVerifyResult extends VerifyResultImpl implements VerifyResult { +*/ +public class ExtendedVerifyResult { /*extends VerifyResultImpl implements VerifyResult { private String qcSource; private boolean publicAuthority; private String publicAuthorityID; @@ -57,5 +57,5 @@ public class ExtendedVerifyResult extends VerifyResultImpl implements VerifyResu public synchronized void setSscdSource(String sscdSource) { this.sscdSource = sscdSource; - } + }*/ } diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/InternalMoaConnector.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/InternalMoaConnector.java index f12a2d1..0344346 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/InternalMoaConnector.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/InternalMoaConnector.java @@ -13,13 +13,6 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import at.gv.egiz.pdfas.common.exceptions.PDFASError; -import at.gv.egiz.pdfas.common.exceptions.PdfAsErrorCarrier; -import at.gv.egiz.pdfas.common.exceptions.PdfAsException; -import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; -import at.gv.egiz.sl.util.ISignatureConnector; -import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.spss.MOAException; import at.gv.egovernment.moa.spss.api.cmssign.CMSSignatureResponse; import at.gv.egovernment.moa.spss.api.cmssign.CreateCMSSignatureResponse; @@ -35,7 +28,8 @@ 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.KeyGroupEntry; import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureCreationInvoker; -import at.gv.egovernment.moa.util.Base64Utils; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.Base64Utils; import iaik.logging.TransactionId; import iaik.server.modules.keys.KeyEntryID; import iaik.server.modules.keys.KeyModule; @@ -43,7 +37,7 @@ import iaik.server.modules.keys.KeyModuleFactory; import iaik.server.modules.keys.UnknownKeyException; import iaik.x509.X509Certificate; -public class InternalMoaConnector implements ISignatureConnector { +public class InternalMoaConnector { /*implements ISignatureConnector { private String keyIdentifier; private X509Certificate clientCert; @@ -229,5 +223,5 @@ public class InternalMoaConnector implements ISignatureConnector { return null; } - + */ } diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/InternalMoaVerifier.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/InternalMoaVerifier.java index e59fe50..8d5a27e 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/InternalMoaVerifier.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/pdfas/InternalMoaVerifier.java @@ -11,13 +11,14 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.gv.egiz.pdfas.common.exceptions.PdfAsException; +/*import at.gv.egiz.pdfas.common.exceptions.PdfAsException; import at.gv.egiz.pdfas.lib.api.Configuration; import at.gv.egiz.pdfas.lib.api.verify.SignatureCheck; import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel; import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; import at.gv.egiz.pdfas.lib.impl.verify.IVerifier; import at.gv.egiz.pdfas.lib.impl.verify.SignatureCheckImpl; +*/ 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; @@ -30,7 +31,7 @@ import at.gv.egovernment.moa.spss.api.impl.VerifyCMSSignatureRequestImpl; import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; import iaik.x509.X509Certificate; -public class InternalMoaVerifier implements IVerifier { +public class InternalMoaVerifier { /*implements IVerifier { public static final String MOA_TRUSTPROFILE = "internal.moa.trustprofile"; @@ -124,5 +125,5 @@ public class InternalMoaVerifier implements IVerifier { public SignatureVerificationLevel getLevel() { return SignatureVerificationLevel.FULL_VERIFICATION; } - + */ } diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java index a18ee9f..9fa99b1 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -33,7 +33,9 @@ import java.util.Iterator; import javax.servlet.http.HttpServletRequest; +import org.apache.axis.AxisEngine; import org.apache.axis.AxisFault; +import org.apache.axis.AxisProperties; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.attachments.AttachmentPart; @@ -45,17 +47,17 @@ 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; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.logging.LoggingContext; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; +import at.gv.egovernment.moaspss.util.DOMUtils; /** * An handler that is invoked on each web service request and performs some @@ -141,9 +143,9 @@ public class AxisHandler extends BasicHandler { // Boolean.FALSE); // msgContext.setProperty(org.apache.axis. // AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION,"false"); - + //AxisProperties.setProperty(AxisEngine.PROP_ATTACHMENT_IMPLEMENTATION, AxisEngine.DEFAULT_ATTACHMENT_IMPL); Message soapMessage = msgContext.getCurrentMessage(); - + ConfigurationProvider configuration = ConfigurationProvider.getInstance(); Element xmlRequest = null; diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/CertificateProviderServlet.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/CertificateProviderServlet.java index 5fe96ef..43804a2 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/CertificateProviderServlet.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/CertificateProviderServlet.java @@ -20,12 +20,12 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -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.KeyGroupEntry; import at.gv.egovernment.moa.spss.server.logging.TransactionId; import at.gv.egovernment.moa.spss.server.transaction.TransactionIDGenerator; +import at.gv.egovernment.moaspss.logging.Logger; /** * diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java index bfefaec..6164154 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/ConfigurationServlet.java @@ -35,15 +35,14 @@ 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; +import at.gv.egovernment.moaspss.logging.LogMsg; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.logging.LoggingContext; +import at.gv.egovernment.moaspss.logging.LoggingContextManager; /** * A servlet to initialize and update the MOA configuration. diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java index d986f7a..03eb3d3 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/ServiceUtils.java @@ -31,9 +31,9 @@ import org.w3c.dom.Element; import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.util.MOASPSSEntityResolver; -import at.gv.egovernment.moa.util.Constants; -import at.gv.egovernment.moa.util.DOMUtils; -import at.gv.egovernment.moa.util.MOAErrorHandler; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.MOAErrorHandler; /** * Helper methods for the Service classes. diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java index 0c800a2..4effec6 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java @@ -32,7 +32,6 @@ 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.cmssign.CreateCMSSignatureRequest; @@ -52,8 +51,9 @@ import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFRequest; import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFRespone; import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFSignatureRequestParser; import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFSignatureResponseBuilder; -import at.gv.egovernment.moa.util.Constants; -import at.gv.egovernment.moa.util.StreamUtils; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.StreamUtils; /** * The service endpoint for the SignatureCreation web service. @@ -100,7 +100,7 @@ public class SignatureCreationService { new CreatePDFSignatureResponseBuilder(); Element reparsedReq; CreatePDFRequest requestObj; - CreatePDFRespone responseObj; + CreatePDFRespone responseObj = null; //since Axis (1.1 ff) has problem with namespaces we take the raw request stored by the Axishandler. TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); @@ -115,7 +115,7 @@ public class SignatureCreationService { Logger.trace(">>> creating Signature"); // invoke the core logic - responseObj = PDFASInvoker.getInstance().createPDFSignature(requestObj, context.getTransactionID()); + //responseObj = PDFASInvoker.getInstance().createPDFSignature(requestObj, context.getTransactionID()); Logger.trace("<<< created Signature"); Logger.trace(">>> building Response"); diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java index f676ed4..8278399 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java @@ -27,28 +27,23 @@ 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.VerifyPDFSignatureResponseBuilder; 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.config.ConfigurationProvider; import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; -import at.gv.egovernment.moa.spss.server.invoke.PDFASInvoker; 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.spss.server.xmlbind.VerifyPDFRequest; -import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFRequestParser; -import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFResponse; -import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFResponseBuilder; -import at.gv.egovernment.moa.util.StreamUtils; +import at.gv.egovernment.moaspss.logging.Logger; +import at.gv.egovernment.moaspss.util.StreamUtils; /** * The service endpoint for the SignatureVerification web service. @@ -69,20 +64,28 @@ public class SignatureVerificationService { */ public Element[] VerifyPDFSignatureRequest(Element[] request) throws AxisFault { - PDFASInvoker invoker = - PDFASInvoker.getInstance(); + 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(); + VerifyPDFSignatureResponseBuilder responseBuilder = + new VerifyPDFSignatureResponseBuilder(); + Element reparsedReq; + VerifyCMSSignatureRequest requestObj; + VerifyCMSSignatureResponse responseObj; // create a parser and builder for binding API objects to/from XML - VerifyPDFRequestParser requestParser = + /*VerifyPDFRequestParser requestParser = new VerifyPDFRequestParser(); VerifyPDFResponseBuilder responseBuilder = new VerifyPDFResponseBuilder(); Element reparsedReq; VerifyPDFRequest requestObj; - VerifyPDFResponse responseObj; + VerifyPDFResponse responseObj;*/ //since Axis (1.1 ff) has problem with namespaces we take the raw request stored by the Axishandler. TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); @@ -90,10 +93,10 @@ public class SignatureVerificationService { reparsedReq = ServiceUtils.reparseRequest(request[0]);//context.getRequest()); // convert to API objects - requestObj = requestParser.parse(reparsedReq); + requestObj = requestParser.parsePDF(reparsedReq); // invoke the core logic - responseObj = invoker.verifyPDFSignature(requestObj); + responseObj = invoker.verifyCMSSignature(requestObj); // map back to XML response[0] = responseBuilder.build(responseObj).getDocumentElement(); diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/PDFVerifySignatureBinding.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/PDFVerifySignatureBinding.java deleted file mode 100644 index 6c6a89a..0000000 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/PDFVerifySignatureBinding.java +++ /dev/null @@ -1,15 +0,0 @@ -package at.gv.egovernment.moa.spss.server.webservice; - -import at.gv.egiz.moasig.VerifyPDFSignatureRequest; -import at.gv.egiz.moasig.VerifyPDFSignatureResponseType; -import at.gv.egovernment.moa.spss.MOAApplicationException; -import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFRequest; -import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFResponse; - -public interface PDFVerifySignatureBinding { - public VerifyPDFRequest buildPDFRequest( - VerifyPDFSignatureRequest createCMSSignatureRequest) throws MOAApplicationException; - - public VerifyPDFSignatureResponseType buildPDFResponse(VerifyPDFResponse response) - throws MOAApplicationException; -} diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/SignatureCreationService.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/SignatureCreationService.java index 5162f55..ccfc3fc 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/SignatureCreationService.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/SignatureCreationService.java @@ -17,8 +17,8 @@ public interface SignatureCreationService { @WebParam(name = "CreateCMSSignatureRequest") at.gv.egiz.moasig.CreateCMSSignatureRequest createCMSSignatureRequest) throws Exception; - @WebMethod(action = "PDFSignatureCreate", operationName = "PDFSignatureCreate") + /*@WebMethod(action = "PDFSignatureCreate", operationName = "PDFSignatureCreate") public at.gv.egiz.moasig.CreatePDFSignatureResponseType createPDFSignature( @WebParam(name = "CreatePDFSignatureRequest") at.gv.egiz.moasig.CreatePDFSignatureRequest createPDFSignatureRequest) - throws Exception; + throws Exception;*/ } diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/CMSParserUtils.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/CMSParserUtils.java index 9512761..3bfe2f5 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/CMSParserUtils.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/CMSParserUtils.java @@ -13,7 +13,7 @@ import at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo; import at.gv.egovernment.moa.spss.api.cmssign.SingleSignatureInfo; import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse; -import at.gv.egovernment.moa.util.Base64Utils; +import at.gv.egovernment.moaspss.util.Base64Utils; public class CMSParserUtils { diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/CMSVerifySignatureBindingImpl.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/CMSVerifySignatureBindingImpl.java index 7a49d6a..1cfa806 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/CMSVerifySignatureBindingImpl.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/CMSVerifySignatureBindingImpl.java @@ -25,7 +25,7 @@ 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.AdESFormResults; import at.gv.egovernment.moa.spss.server.webservice.CMSVerifySignatureBinding; -import at.gv.egovernment.moa.util.CollectionUtils; +import at.gv.egovernment.moaspss.util.CollectionUtils; public class CMSVerifySignatureBindingImpl implements CMSVerifySignatureBinding { @@ -209,7 +209,7 @@ public class CMSVerifySignatureBindingImpl implements CMSVerifySignatureBinding public VerifyCMSSignatureRequest buildPDFRequest(VerifyPDFSignatureRequest verifyPDFSignatureRequest) throws MOAApplicationException { Date dateTime = null; - if (verifyPDFSignatureRequest.getDateTime() == null) { + if (verifyPDFSignatureRequest.getDateTime() != null) { dateTime = verifyPDFSignatureRequest.getDateTime().toGregorianCalendar().getTime(); } diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/PDFCreateSignatureBindingImpl.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/PDFCreateSignatureBindingImpl.java index dfe3ce5..b16cce7 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/PDFCreateSignatureBindingImpl.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/PDFCreateSignatureBindingImpl.java @@ -7,7 +7,6 @@ import at.gv.egiz.moasig.CreatePDFSignatureRequest; import at.gv.egiz.moasig.CreatePDFSignatureResponseType; import at.gv.egiz.moasig.ErrorResponseType; import at.gv.egovernment.moa.spss.MOAApplicationException; -import at.gv.egovernment.moa.spss.api.SPSSFactory; import at.gv.egovernment.moa.spss.server.webservice.PDFCreateSignatureBinding; import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFRequest; import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFRespone; diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/PDFVerifySignatureBindingImpl.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/PDFVerifySignatureBindingImpl.java deleted file mode 100644 index 42301ad..0000000 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/PDFVerifySignatureBindingImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package at.gv.egovernment.moa.spss.server.webservice.binding; - -import at.gv.egiz.moasig.VerifyPDFSignatureRequest; -import at.gv.egiz.moasig.VerifyPDFSignatureResponseType; -import at.gv.egovernment.moa.spss.MOAApplicationException; -import at.gv.egovernment.moa.spss.server.webservice.PDFVerifySignatureBinding; -import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFRequest; -import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFResponse; - -public class PDFVerifySignatureBindingImpl implements PDFVerifySignatureBinding { - - @Override - public VerifyPDFRequest buildPDFRequest(VerifyPDFSignatureRequest createCMSSignatureRequest) - throws MOAApplicationException { - // TODO Auto-generated method stub - return null; - } - - @Override - public VerifyPDFSignatureResponseType buildPDFResponse(VerifyPDFResponse response) throws MOAApplicationException { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/TransformParser.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/TransformParser.java index cd10260..1d05f22 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/TransformParser.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/TransformParser.java @@ -56,9 +56,9 @@ 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.util.Constants; -import at.gv.egovernment.moa.util.DOMUtils; -import at.gv.egovernment.moa.util.XPathUtils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * A parser to parse XMLDsig Transform DOM elements into their MOA diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/XMLCreateSignatureBindingImpl.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/XMLCreateSignatureBindingImpl.java index d5d50cd..6656d51 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/XMLCreateSignatureBindingImpl.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/XMLCreateSignatureBindingImpl.java @@ -17,7 +17,7 @@ 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; import at.gv.egovernment.moa.spss.server.webservice.XMLCreateSignatureBinding; -import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moaspss.util.DOMUtils; public class XMLCreateSignatureBindingImpl implements XMLCreateSignatureBinding { diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/XMLVerifySignatureBindingImpl.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/XMLVerifySignatureBindingImpl.java index 44dc2c2..dcc92f9 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/XMLVerifySignatureBindingImpl.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/binding/XMLVerifySignatureBindingImpl.java @@ -11,16 +11,21 @@ import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; +import javax.security.auth.login.FailedLoginException; +import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; +import javax.xml.transform.dom.DOMResult; import org.apache.commons.io.IOUtils; import org.w3c.dom.Element; import org.w3c.dom.Node; import at.gv.egiz.moasig.MoaTransformsType; +import at.gv.egiz.moasig.NamespaceDeclarationType; import at.gv.egiz.moasig.PublicAuthorityType; import at.gv.egiz.moasig.QualifiedCertificate; import at.gv.egiz.moasig.SecureSignatureCreationDevice; @@ -28,6 +33,7 @@ import at.gv.egiz.moasig.TransformParameterType; import at.gv.egiz.moasig.TransformParameterType.Hash; import at.gv.egiz.moasig.VerifyXMLSignatureResponseType; import at.gv.egiz.moasig.XMLDataObjectAssociationType; +import at.gv.egiz.moasig.XMLSignatureLocationType; import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.api.SPSSFactory; import at.gv.egovernment.moa.spss.api.common.Content; @@ -46,7 +52,7 @@ 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; import at.gv.egovernment.moa.spss.server.webservice.XMLVerifySignatureBinding; -import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moaspss.util.DOMUtils; import iaik.utils.RFC2253NameParser; import iaik.utils.RFC2253NameParserException; @@ -264,11 +270,26 @@ public class XMLVerifySignatureBindingImpl implements XMLVerifySignatureBinding throws MOAApplicationException { Content verifySignatureEnvironment = transformerUtils .buildContent(verifySignatureInfo.getVerifySignatureEnvironment()); + + XMLSignatureLocationType xmlSignatureLocationType = verifySignatureInfo.getVerifySignatureLocation(); - String xPathExpression = verifySignatureInfo.getVerifySignatureLocation(); - + String xPathExpression = xmlSignatureLocationType.getXPathExpression(); + + Iterator namespaceDelcarationIterator = xmlSignatureLocationType.getNamespaceDeclaration().iterator(); + + Map namespaceMap = new HashMap(); + + while(namespaceDelcarationIterator.hasNext()) { + NamespaceDeclarationType namespaceDelcaration = namespaceDelcarationIterator.next(); + + String prefix = namespaceDelcaration.getPrefix(); + String namespace = namespaceDelcaration.getValue(); + + namespaceMap.put(prefix, namespace); + } + VerifySignatureLocation verifySignatureLocation = factory.createVerifySignatureLocation(xPathExpression, - new HashMap()); + namespaceMap); return factory.createVerifySignatureInfo(verifySignatureEnvironment, verifySignatureLocation); } diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/ContextSetupAspect.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/ContextSetupAspect.java deleted file mode 100644 index 42ffd5e..0000000 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/ContextSetupAspect.java +++ /dev/null @@ -1,104 +0,0 @@ -package at.gv.egovernment.moa.spss.server.webservice.impl; - -import java.security.cert.X509Certificate; - -import javax.servlet.http.HttpServletRequest; -import javax.xml.ws.handler.MessageContext; -import javax.xml.ws.handler.soap.SOAPMessageContext; - -import org.apache.cxf.transport.http.AbstractHTTPDestination; -import org.aspectj.lang.annotation.Aspect; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Element; - -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; -import at.gv.egovernment.moa.spss.server.transaction.TransactionIDGenerator; - -@Aspect -public class ContextSetupAspect { - - private static final Logger logger = LoggerFactory.getLogger(ContextSetupAspect.class); - - /** 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"; - - /** - * Set up the thread-local contexts (TransactionContext and - * LoggingContext). - * - * @param context - * The TransactionContext to set for the current - * request. - */ - private static 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 static 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); - } - - public static void setupContext(MessageContext messageContext, String targetService) throws ConfigurationException { - logger.debug("Context setup"); - - HttpServletRequest request = (HttpServletRequest) messageContext - .get(AbstractHTTPDestination.HTTP_REQUEST); - - X509Certificate[] clientCert = (X509Certificate[]) request.getAttribute(X509_CERTIFICATE_PROPERTY); - - ConfigurationProvider configuration = ConfigurationProvider.getInstance(); - - Element xmlRequest = null; - if (messageContext instanceof SOAPMessageContext) { - SOAPMessageContext soapMessageContext = (SOAPMessageContext) messageContext; - xmlRequest = soapMessageContext.getMessage().getSOAPPart().getDocumentElement(); - } - - 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 = targetService; - } - context.setRequestName(soapAction); - - setUpContexts(context); - } - - public static void cleanContext() { - logger.debug("Context clean up"); - tearDownContexts(); - } -} diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SignatureCreationServiceImpl.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SignatureCreationServiceImpl.java deleted file mode 100644 index 358b9d6..0000000 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SignatureCreationServiceImpl.java +++ /dev/null @@ -1,190 +0,0 @@ -package at.gv.egovernment.moa.spss.server.webservice.impl; - -import java.util.Collections; - -import javax.annotation.Resource; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.xml.ws.WebServiceContext; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.moasig.CreateCMSSignatureRequest; -import at.gv.egiz.moasig.CreateCMSSignatureRequestType; -import at.gv.egiz.moasig.CreateCMSSignatureResponseType; -import at.gv.egiz.moasig.CreatePDFSignatureRequest; -import at.gv.egiz.moasig.CreatePDFSignatureRequestType; -import at.gv.egiz.moasig.CreatePDFSignatureResponseType; -import at.gv.egiz.moasig.CreateXMLSignatureRequest; -import at.gv.egiz.moasig.CreateXMLSignatureResponseType; -import at.gv.egovernment.moa.spss.MOAException; -import at.gv.egovernment.moa.spss.MOASystemException; -import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureCreationInvoker; -import at.gv.egovernment.moa.spss.server.invoke.PDFASInvoker; -import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureCreationInvoker; -import at.gv.egovernment.moa.spss.server.service.ServiceUtils; -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.webservice.CMSCreateSignatureBinding; -import at.gv.egovernment.moa.spss.server.webservice.PDFCreateSignatureBinding; -import at.gv.egovernment.moa.spss.server.webservice.SignatureCreationService; -import at.gv.egovernment.moa.spss.server.webservice.XMLCreateSignatureBinding; -import at.gv.egovernment.moa.spss.server.webservice.binding.CMSCreateSignatureBindingImpl; -import at.gv.egovernment.moa.spss.server.webservice.binding.PDFCreateSignatureBindingImpl; -import at.gv.egovernment.moa.spss.server.webservice.binding.XMLCreateSignatureBindingImpl; -import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFRequest; -import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFRespone; -import at.gv.egovernment.moa.util.StreamUtils; - -@WebService(endpointInterface = "at.gv.egovernment.moa.spss.server.webservice.SignatureCreationService", portName = "SignatureCreationService", serviceName = "SignatureCreationService") -public class SignatureCreationServiceImpl implements SignatureCreationService { - - private static final Logger logger = LoggerFactory.getLogger(SignatureCreationServiceImpl.class); - - @Resource - private WebServiceContext context; - - private XMLCreateSignatureBinding xmlCreateSignatureBinding; - private CMSCreateSignatureBinding cmsCreateSignatureBinding; - private PDFCreateSignatureBinding pdfCreateSignatureBinding; - - public SignatureCreationServiceImpl() { - this.xmlCreateSignatureBinding = new XMLCreateSignatureBindingImpl(); - this.cmsCreateSignatureBinding = new CMSCreateSignatureBindingImpl(); - this.pdfCreateSignatureBinding = new PDFCreateSignatureBindingImpl(); - } - - @Override - @WebResult(name = "CreateXMLSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") - public CreateXMLSignatureResponseType createXMLSignature(CreateXMLSignatureRequest createXMLSignatureRequest) - throws Exception { - logger.info("createXMLSignature start"); - try { - logger.info("WebServiceContext: {}", context); - ContextSetupAspect.setupContext(context.getMessageContext(), "createXMLSignature"); - - XMLSignatureCreationInvoker invoker = XMLSignatureCreationInvoker.getInstance(); - - at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest requestObj; - at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse responseObj; - - logger.trace(">>> preparsing Request"); - requestObj = this.xmlCreateSignatureBinding.buildXMLRequest(createXMLSignatureRequest); - logger.trace("<<< preparsed Request"); - - logger.trace(">>> creating Signature"); - // invoke the core logic - responseObj = invoker.createXMLSignature(requestObj, Collections.EMPTY_SET); - logger.trace("<<< created Signature"); - - logger.trace(">>> building Response"); - // map back to XML - CreateXMLSignatureResponseType response = this.xmlCreateSignatureBinding.buildXMLResponse(responseObj); - logger.trace("<<< built Response"); - - return response; - } catch (MOAException e) { - logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" - + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); - logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); - throw new Exception(e.getMessage()); - } catch (Throwable t) { - MOASystemException e = new MOASystemException("2900", null, t); - logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" - + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); - logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); - throw new Exception(e.getMessage()); - } finally { - ContextSetupAspect.cleanContext(); - } - } - - @Override - @WebResult(name = "CreateCMSSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") - public CreateCMSSignatureResponseType createCMSSignature(CreateCMSSignatureRequest createCMSSignatureRequest) - throws Exception { - logger.info("createCMSSignature start"); - try { - logger.info("WebServiceContext: {}", context); - ContextSetupAspect.setupContext(context.getMessageContext(), "createCMSSignature"); - - CMSSignatureCreationInvoker invoker = CMSSignatureCreationInvoker.getInstance(); - - at.gv.egovernment.moa.spss.api.cmssign.CreateCMSSignatureRequest requestObj; - at.gv.egovernment.moa.spss.api.cmssign.CreateCMSSignatureResponse responseObj; - - logger.trace(">>> preparsing Request"); - requestObj = this.cmsCreateSignatureBinding.buildCMSRequest(createCMSSignatureRequest); - logger.trace("<<< preparsed Request"); - - logger.trace(">>> creating Signature"); - // invoke the core logic - responseObj = invoker.createCMSSignature(requestObj, Collections.EMPTY_SET); - logger.trace("<<< created Signature"); - - logger.trace(">>> building Response"); - // map back to XML - CreateCMSSignatureResponseType response = this.cmsCreateSignatureBinding.buildCMSResponse(responseObj); - logger.trace("<<< built Response"); - - return response; - - } catch (MOAException e) { - logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" - + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); - logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); - throw new Exception(e.getMessage()); - } catch (Throwable t) { - MOASystemException e = new MOASystemException("2900", null, t); - logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" - + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); - logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); - throw new Exception(e.getMessage()); - } finally { - ContextSetupAspect.cleanContext(); - } - } - - @Override - @WebResult(name = "CreatePDFSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") - public CreatePDFSignatureResponseType createPDFSignature(CreatePDFSignatureRequest createPDFSignatureRequest) - throws Exception { - logger.info("createPDFSignature start"); - try { - logger.info("WebServiceContext: {}", context); - ContextSetupAspect.setupContext(context.getMessageContext(), "createPDFSignature"); - - CreatePDFRequest requestObj; - CreatePDFRespone responseObj; - - TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); - - // convert to API objects - logger.trace(">>> preparsing Request"); - requestObj = this.pdfCreateSignatureBinding.buildPDFRequest(createPDFSignatureRequest); - logger.trace("<<< preparsed Request"); - - logger.trace(">>> creating Signature"); - // invoke the core logic - responseObj = PDFASInvoker.getInstance().createPDFSignature(requestObj, context.getTransactionID()); - logger.trace("<<< created Signature"); - - logger.trace(">>> building Response"); - // map back to XML - CreatePDFSignatureResponseType response = this.pdfCreateSignatureBinding.buildPDFResponse(responseObj); - logger.trace("<<< built Response"); - - return response; - } catch (Throwable t) { - MOASystemException e = new MOASystemException("2900", null, t); - logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" - + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); - logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); - throw new Exception(e.getMessage()); - } finally { - ContextSetupAspect.cleanContext(); - } - } - -} diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SignatureVerificationServiceImpl.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SignatureVerificationServiceImpl.java deleted file mode 100644 index cbc4d2d..0000000 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SignatureVerificationServiceImpl.java +++ /dev/null @@ -1,215 +0,0 @@ -package at.gv.egovernment.moa.spss.server.webservice.impl; - -import javax.annotation.Resource; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.xml.ws.WebServiceContext; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.moasig.VerifyCMSSignatureRequest; -import at.gv.egiz.moasig.VerifyCMSSignatureResponseType; -import at.gv.egiz.moasig.VerifyPDFSignatureRequest; -import at.gv.egiz.moasig.VerifyPDFSignatureResponseType; -import at.gv.egiz.moasig.VerifyXMLSignatureRequest; -import at.gv.egiz.moasig.VerifyXMLSignatureResponseType; -import at.gv.egovernment.moa.spss.MOASystemException; -import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; -import at.gv.egovernment.moa.spss.server.invoke.PDFASInvoker; -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.spss.server.webservice.CMSVerifySignatureBinding; -import at.gv.egovernment.moa.spss.server.webservice.PDFVerifySignatureBinding; -import at.gv.egovernment.moa.spss.server.webservice.SignatureVerificationService; -import at.gv.egovernment.moa.spss.server.webservice.XMLVerifySignatureBinding; -import at.gv.egovernment.moa.spss.server.webservice.binding.CMSVerifySignatureBindingImpl; -import at.gv.egovernment.moa.spss.server.webservice.binding.PDFVerifySignatureBindingImpl; -import at.gv.egovernment.moa.spss.server.webservice.binding.XMLVerifySignatureBindingImpl; -import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFRequest; -import at.gv.egovernment.moa.spss.server.xmlbind.VerifyPDFResponse; -import at.gv.egovernment.moa.util.StreamUtils; - -@WebService(endpointInterface = "at.gv.egovernment.moa.spss.server.webservice.SignatureVerificationService", portName = "SignatureVerificationService", serviceName = "SignatureVerificationService") -public class SignatureVerificationServiceImpl implements SignatureVerificationService { - - private static final Logger logger = LoggerFactory.getLogger(SignatureVerificationServiceImpl.class); - - @Resource - private WebServiceContext context; - - private XMLVerifySignatureBinding xmlVerifySignatureBinding; - private CMSVerifySignatureBinding cmsVerifySignatureBinding; - private PDFVerifySignatureBinding pdfVerifySignatureBinding; - - public SignatureVerificationServiceImpl() { - this.xmlVerifySignatureBinding = new XMLVerifySignatureBindingImpl(); - this.cmsVerifySignatureBinding = new CMSVerifySignatureBindingImpl(); - this.pdfVerifySignatureBinding = new PDFVerifySignatureBindingImpl(); - } - - @Override - @WebResult(name = "VerifyXMLSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") - public VerifyXMLSignatureResponseType verifyXMLSignature(VerifyXMLSignatureRequest verifyXMLSignatureRequest) - throws Exception { - logger.info("verifyXMLSignature start"); - try { - logger.info("WebServiceContext: {}", context); - ContextSetupAspect.setupContext(context.getMessageContext(), "verifyXMLSignature"); - - XMLSignatureVerificationInvoker invoker = XMLSignatureVerificationInvoker.getInstance(); - - at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest requestObj; - at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse responseObj; - - logger.trace(">>> preparsing Request"); - requestObj = this.xmlVerifySignatureBinding.buildXMLRequest(verifyXMLSignatureRequest); - logger.trace("<<< preparsed Request"); - - logger.trace(">>> verifying Signature"); - // invoke the core logic - responseObj = invoker.verifyXMLSignature(requestObj); - logger.trace("<<< verified Signature"); - - logger.trace(">>> building Response"); - // map back to XML - VerifyXMLSignatureResponseType response = this.xmlVerifySignatureBinding.buildXMLResponse(responseObj); - logger.trace("<<< built Response"); - - return response; - } catch (Throwable t) { - MOASystemException e = new MOASystemException("2900", null, t); - logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" - + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); - logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); - throw new Exception(e.getMessage()); - } finally { - ContextSetupAspect.cleanContext(); - } - } - - @Override - @WebResult(name = "VerifyCMSSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") - public VerifyCMSSignatureResponseType verifyCMSSignature(VerifyCMSSignatureRequest verifyCMSSignatureRequest) - throws Exception { - logger.info("verifyCMSSignature start"); - try { - logger.info("WebServiceContext: {}", context); - ContextSetupAspect.setupContext(context.getMessageContext(), "verifyCMSSignature"); - - CMSSignatureVerificationInvoker invoker = CMSSignatureVerificationInvoker.getInstance(); - - at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest requestObj; - at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse responseObj; - - logger.trace(">>> preparsing Request"); - requestObj = this.cmsVerifySignatureBinding.buildCMSRequest(verifyCMSSignatureRequest); - logger.trace("<<< preparsed Request"); - - logger.trace(">>> verifying Signature"); - // invoke the core logic - responseObj = invoker.verifyCMSSignature(requestObj); - logger.trace("<<< verified Signature"); - - logger.trace(">>> building Response"); - // map back to XML - VerifyCMSSignatureResponseType response = this.cmsVerifySignatureBinding.buildCMSResponse(responseObj); - logger.trace("<<< built Response"); - - return response; - } catch (Throwable t) { - MOASystemException e = new MOASystemException("2900", null, t); - logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" - + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); - logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); - throw new Exception(e.getMessage()); - } finally { - ContextSetupAspect.cleanContext(); - } - } - - //@Override - //@WebResult(name = "VerifyPDFSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") - private VerifyPDFSignatureResponseType verifyPDFASSignature(VerifyPDFSignatureRequest verifyPDFSignatureRequest) - throws Exception { - logger.info("verifyPDFSignature start"); - try { - logger.info("WebServiceContext: {}", context); - ContextSetupAspect.setupContext(context.getMessageContext(), "verifyPDFSignature"); - - VerifyPDFRequest requestObj; - VerifyPDFResponse responseObj; - - // since Axis (1.1 ff) has problem with namespaces we take the raw - // request stored by the Axishandler. - TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); - - // convert to API objects - logger.trace(">>> preparsing Request"); - requestObj = this.pdfVerifySignatureBinding.buildPDFRequest(verifyPDFSignatureRequest); - logger.trace("<<< preparsed Request"); - - logger.trace(">>> verifying Signature"); - // invoke the core logic - responseObj = PDFASInvoker.getInstance().verifyPDFSignature(requestObj); - logger.trace("<<< verified Signature"); - - logger.trace(">>> building Response"); - // map back to XML - VerifyPDFSignatureResponseType response = this.pdfVerifySignatureBinding.buildPDFResponse(responseObj); - logger.trace("<<< built Response"); - - return response; - } catch (Throwable t) { - MOASystemException e = new MOASystemException("2900", null, t); - logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" - + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); - logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); - throw new Exception(e.getMessage()); - } finally { - ContextSetupAspect.cleanContext(); - } - } - - @Override - @WebResult(name = "VerifyPDFSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") - public VerifyPDFSignatureResponseType verifyPDFSignature(VerifyPDFSignatureRequest verifyPDFSignatureRequest) - throws Exception { - logger.info("verifyPDFSignature start"); - try { - logger.info("WebServiceContext: {}", context); - ContextSetupAspect.setupContext(context.getMessageContext(), "verifyPDFSignature"); - - CMSSignatureVerificationInvoker invoker = CMSSignatureVerificationInvoker.getInstance(); - - at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest requestObj; - at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse responseObj; - - logger.trace(">>> preparsing Request"); - requestObj = this.cmsVerifySignatureBinding.buildPDFRequest(verifyPDFSignatureRequest); - logger.trace("<<< preparsed Request"); - - logger.trace(">>> verifying Signature"); - // invoke the core logic - responseObj = invoker.verifyCMSSignature(requestObj); - logger.trace("<<< verified Signature"); - - logger.trace(">>> building Response"); - // map back to XML - VerifyPDFSignatureResponseType response = this.cmsVerifySignatureBinding.buildPDFResponse(responseObj); - logger.trace("<<< built Response"); - - return response; - } catch (Throwable t) { - MOASystemException e = new MOASystemException("2900", null, t); - logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" - + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); - logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); - throw new Exception(e.getMessage()); - } finally { - ContextSetupAspect.cleanContext(); - } - } - -} diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SimpleCXFNonSpringServlet.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SimpleCXFNonSpringServlet.java deleted file mode 100644 index 65625a7..0000000 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/webservice/impl/SimpleCXFNonSpringServlet.java +++ /dev/null @@ -1,28 +0,0 @@ -package at.gv.egovernment.moa.spss.server.webservice.impl; - -import javax.servlet.ServletConfig; -import javax.xml.ws.Endpoint; - -import org.apache.cxf.Bus; -import org.apache.cxf.BusFactory; -import org.apache.cxf.transport.servlet.CXFNonSpringServlet; - -public class SimpleCXFNonSpringServlet extends CXFNonSpringServlet { - - /** - * - */ - private static final long serialVersionUID = 8564433272673970611L; - - @Override - public void loadBus(ServletConfig servletConfig) { - super.loadBus(servletConfig); - Bus bus = getBus(); - BusFactory.setDefaultBus(bus); - Endpoint signatureCreationEndpoint = Endpoint.publish("/SignatureCreation", new SignatureCreationServiceImpl()); - signatureCreationEndpoint.getProperties().put("schema-validation-enabled", "true"); - Endpoint signatureVerificationEndpoint = Endpoint.publish("/SignatureVerification", new SignatureVerificationServiceImpl()); - signatureVerificationEndpoint.getProperties().put("schema-validation-enabled", "true"); - } - -} diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/CreatePDFSignatureRequestParser.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/CreatePDFSignatureRequestParser.java index 163a7ba..c6b2126 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/CreatePDFSignatureRequestParser.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/CreatePDFSignatureRequestParser.java @@ -29,10 +29,10 @@ import org.w3c.dom.Element; import org.w3c.dom.traversal.NodeIterator; import at.gv.egovernment.moa.spss.MOAApplicationException; -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.moaspss.util.Base64Utils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; /** * A parser to parse CreateCMSSignatureRequest DOM trees into diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/CreatePDFSignatureResponseBuilder.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/CreatePDFSignatureResponseBuilder.java index 78586ba..bdb9a71 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/CreatePDFSignatureResponseBuilder.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/CreatePDFSignatureResponseBuilder.java @@ -33,8 +33,8 @@ import org.w3c.dom.Element; import at.gv.egovernment.moa.spss.MOASystemException; import at.gv.egovernment.moa.spss.api.xmlbind.ResponseBuilderUtils; -import at.gv.egovernment.moa.util.Base64Utils; -import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moaspss.util.Base64Utils; +import at.gv.egovernment.moaspss.util.Constants; /** * Convert a CreateCMSSignatureResponse API object into its XML diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFRequestParser.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFRequestParser.java index 7601b31..66761e4 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFRequestParser.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFRequestParser.java @@ -7,10 +7,10 @@ import org.w3c.dom.Element; import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.api.xmlbind.RequestParserUtils; -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.moaspss.util.Base64Utils; +import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.XPathUtils; public class VerifyPDFRequestParser { diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFResponse.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFResponse.java index 76746cf..c162529 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFResponse.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFResponse.java @@ -2,10 +2,10 @@ package at.gv.egovernment.moa.spss.server.xmlbind; import java.util.List; -import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; +//import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; public class VerifyPDFResponse { - private List verificationResults = null; + /*private List verificationResults = null; public VerifyPDFResponse() { } @@ -16,5 +16,5 @@ public class VerifyPDFResponse { public synchronized void setVerificationResults(List verificationResults) { this.verificationResults = verificationResults; - } + }*/ } diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFResponseBuilder.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFResponseBuilder.java index 705eff6..cb3c66b 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFResponseBuilder.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/xmlbind/VerifyPDFResponseBuilder.java @@ -5,13 +5,13 @@ import java.util.Iterator; import org.w3c.dom.Document; import org.w3c.dom.Element; -import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; +//import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; 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.xmlbind.ResponseBuilderUtils; import at.gv.egovernment.moa.spss.server.pdfas.ExtendedVerifyResult; -import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moaspss.util.Constants; public class VerifyPDFResponseBuilder { private static final String MOA_NS_URI = Constants.MOA_NS_URI; @@ -44,7 +44,7 @@ public class VerifyPDFResponseBuilder { * @return A document containing the CreateCMSSignatureResponse * DOM element. */ - public Document build(VerifyPDFResponse response) throws MOAException { + /*public Document build(VerifyPDFResponse response) throws MOAException { if(response.getVerificationResults() == null) { throw new MOAApplicationException("No verification results available", null); } @@ -106,5 +106,5 @@ public class VerifyPDFResponseBuilder { (String)null); responseElem.appendChild(pdfSignature); - } + }*/ } diff --git a/moaSig/moa-sig/src/main/resources/log4j.properties b/moaSig/moa-sig/src/main/resources/log4j.properties new file mode 100644 index 0000000..7beb0c5 --- /dev/null +++ b/moaSig/moa-sig/src/main/resources/log4j.properties @@ -0,0 +1,38 @@ +# +# Sample log4j configuration for the MOA-SPSS web service +# + +# commons-logging setup +org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory + +# Configure root logger and loggers for moa-spss +log4j.rootLogger=TRACE, stdout +log4j.logger.moa.spss.server=TRACE, stdout, moaspss +log4j.logger.iaik.server=TRACE, stdout, moaspss +log4j.logger.at.gv.egovernment.moa.spss=TRACE, stdout, moaspss + +# Configure the 'stdout' appender to write logging output to the console +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %C{1} | %20c | %10t | %m%n + +# Configure the 'moaspss' appender to write moa-spss related logging output +# to the file '${catalina.base}/logs/moa-spss.log'. The file is rolled over every 1000KB, +# and a maximum history of 10 log files is being kept. +log4j.appender.moaspss=org.apache.log4j.RollingFileAppender +log4j.appender.moaspss.File=${catalina.base}/logs/moa-spss.log +log4j.appender.moaspss.MaxFileSize=1000KB +log4j.appender.moaspss.MaxBackupIndex=10 +log4j.appender.moaspss.layout=org.apache.log4j.PatternLayout +log4j.appender.moaspss.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %C{1} | %20c | %10t | %m%n + +# Configure the jdbc appender 'JDBC' to write logging output +# to the given PostgreSQL database +# a suitable table called 'spss_log' must have been created in the +# database using the command: +# create table spss_log (log_time timestamp, log_level char(5), log_msg text) +#log4j.appender.JDBC=org.apache.log4j.jdbc.JDBCAppender +#log4j.appender.JDBC.driver=org.postgresql.Driver +#log4j.appender.JDBC.URL=jdbc:postgresql://10.16.46.108/moa?user=moa&password=moatest +#log4j.appender.JDBC.layout=org.apache.log4j.PatternLayout +#log4j.appender.JDBC.sql=INSERT INTO spss_log (log_time, log_level, log_msg) VALUES ('%d{ yyyy-MM-dd HH:mm:ss.SSS}', '%5p', '%m') diff --git a/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SIG-3.0.0.xsd b/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SIG-3.0.0.xsd index 63e82a2..55f0259 100644 --- a/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SIG-3.0.0.xsd +++ b/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SIG-3.0.0.xsd @@ -133,7 +133,7 @@ - + - + @@ -186,6 +186,7 @@ + @@ -230,6 +231,7 @@ + @@ -277,11 +279,12 @@ + - + @@ -648,6 +651,19 @@ + + + + + + + + + + + + + diff --git a/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SPSS-2.0.0.wsdl b/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SPSS-2.0.0.wsdl index 03b14ba..00bf4c5 100644 --- a/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SPSS-2.0.0.wsdl +++ b/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SPSS-2.0.0.wsdl @@ -10,12 +10,12 @@ - + @@ -54,11 +54,11 @@ - + @@ -103,7 +103,7 @@ - + - - + diff --git a/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SPSS-2.0.0.xsd b/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SPSS-2.0.0.xsd index 67a897c..a12dc09 100644 --- a/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SPSS-2.0.0.xsd +++ b/moaSig/moa-sig/src/main/resources/resources/schemas/MOA-SPSS-2.0.0.xsd @@ -166,6 +166,7 @@ + @@ -186,6 +187,7 @@ + @@ -200,6 +202,7 @@ + @@ -224,6 +227,7 @@ + @@ -232,6 +236,7 @@ + diff --git a/moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml b/moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml index aca8e6a..667f084 100644 --- a/moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml +++ b/moaSig/moa-sig/src/main/webapp/WEB-INF/web.xml @@ -1,9 +1,4 @@ - - - MOA SP-SS MOA Signature Creation and Verification Services @@ -16,29 +11,28 @@ AxisServlet Apache-Axis Servlet - - org.apache.axis.transport.http.AxisServlet - + org.apache.axis.transport.http.AxisServlet - + CertificateProviderServlet MOA Certificate Provider Servlet at.gv.egovernment.moa.spss.server.service.CertificateProviderServlet - 0 + 1 AxisServlet /services/* - + ConfigurationServlet /ConfigurationUpdate diff --git a/moaSig/moa-sig/src/main/webapp/schemas/MOA-SPSS-2.0.0.xsd b/moaSig/moa-sig/src/main/webapp/schemas/MOA-SPSS-2.0.0.xsd index 3b852ca..a12dc09 100644 --- a/moaSig/moa-sig/src/main/webapp/schemas/MOA-SPSS-2.0.0.xsd +++ b/moaSig/moa-sig/src/main/webapp/schemas/MOA-SPSS-2.0.0.xsd @@ -166,6 +166,7 @@ + @@ -186,6 +187,7 @@ + @@ -200,6 +202,7 @@ + @@ -224,6 +227,7 @@ + @@ -232,6 +236,7 @@ + @@ -279,6 +284,7 @@ + @@ -412,6 +418,12 @@ + + + + + + -- cgit v1.2.3