aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/main/java
diff options
context:
space:
mode:
authorThomas <>2021-03-24 12:16:25 +0100
committerThomas <>2021-03-24 12:16:25 +0100
commit835a395f3ecb7477b5b67e9da9bf3af58c86473a (patch)
tree916fa7705879063f6b83517d80197c37dc53caf8 /moaSig/moa-sig-lib/src/main/java
parenta972fba0402eca3c5fcfcd1eef1979808fd716a1 (diff)
parent666d8c9f8cec7573e60a14ab039c0874f6a9ec53 (diff)
downloadmoa-sig-835a395f3ecb7477b5b67e9da9bf3af58c86473a.tar.gz
moa-sig-835a395f3ecb7477b5b67e9da9bf3af58c86473a.tar.bz2
moa-sig-835a395f3ecb7477b5b67e9da9bf3af58c86473a.zip
Merge branch 'master' of gitlab.iaik.tugraz.at:egiz/moa-sig
# Conflicts: # moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java # moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java
Diffstat (limited to 'moaSig/moa-sig-lib/src/main/java')
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java44
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java76
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java84
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java36
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/OutputConstants.java15
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/Configurator.java57
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java1190
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureCreationService.java36
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SignatureVerificationService.java43
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CMSSignatureResponse.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureRequest.java17
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponse.java9
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponseElement.java22
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/DataObjectInfo.java17
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/SingleSignatureInfo.java27
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java17
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java25
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureRequest.java51
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java35
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CanonicalizationTransform.java9
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java26
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java3
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java16
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExclusiveCanonicalizationTransform.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExtendedCertificateCheckResult.java50
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java52
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java24
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java76
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TSLConfiguration.java65
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TslInfos.java78
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java29
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java15
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java22
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/AdESFormResultsImpl.java70
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java33
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSSignatureResponseImpl.java15
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java15
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java6
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java32
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java10
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureRequestImpl.java21
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureResponseImpl.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java29
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java19
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java10
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java15
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java20
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java10
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java21
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoCMSImpl.java10
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java26
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java27
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExtendedCertificateCheckResultImpl.java74
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java79
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java76
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java9
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java19
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java17
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java20
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java22
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java1042
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java19
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java137
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoCMSImpl.java16
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java10
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TSLConfigurationImpl.java134
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java4
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java15
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java4
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java10
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java17
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TslInfosImpl.java100
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureRequestImpl.java43
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java76
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java16
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java16
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java20
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java9
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureRequestImpl.java220
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java312
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java9
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java8
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java23
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java23
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java26
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java8
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureRequestParser.java215
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureResponseBuilder.java116
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParser.java243
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java82
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ProfileParser.java246
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java310
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java569
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java149
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java216
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java161
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java170
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParser.java440
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java595
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java25
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java23
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java8
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java17
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java9
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java15
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java9
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java22
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java32
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java21
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/AdESFormResults.java8
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java13
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java16
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java10
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java34
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java3
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java18
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java3
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java19
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java7
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureRequest.java57
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java57
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/CRLDistributionPoint.java277
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java23
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java1931
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java687
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java26
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java30
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java35
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java57
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java37
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java58
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java19
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java22
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java233
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmssign/CMSSignatureCreationProfileImpl.java281
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java46
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/PDFSignatureVerificationProfileImpl.java2
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java16
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java87
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java104
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java89
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java64
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java8
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java49
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java25
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java21
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java172
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/LoggerConfigImpl.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/PKIConfigurationImpl.java131
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java143
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java32
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java22
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java350
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java47
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java33
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java93
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java29
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java27
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java18
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java27
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java25
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java22
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java53
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java12
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java15
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java21
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java14
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java45
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java31
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java43
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java350
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java51
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureCreationProfileImpl.java320
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java18
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java57
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java43
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ExternalInitializer.java2
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/StartupConfigurationHolder.java40
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java268
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureCreationInvoker.java546
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java913
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationProfileFactory.java57
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateCMSSignatureResponseBuilder.java50
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java50
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java895
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java83
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java246
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/InvokerUtils.java47
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java187
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ServiceContextUtils.java32
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java22
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java38
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java165
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java245
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java528
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvoker.java532
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java479
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java1309
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java103
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java37
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java32
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java37
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java17
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/monitoring/ServiceStatusContainer.java44
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/service/RevocationArchiveCleaner.java52
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/DeleteableDataSource.java2
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java287
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java21
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java27
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java43
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java92
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/timer/TSLUpdaterTimerTask.java83
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/CertificateReader.java198
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/AdESResultUtils.java403
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertStoreConverter.java184
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertificateUtils.java720
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ExternalURIVerifier.java196
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/FilteredOutputStream.java126
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MOASPSSEntityResolver.java64
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/MessageProvider.java32
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/NodeListToNodeSetDataAdapter.java24
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/QCSSCDResult.java92
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/ResetableInputStreamWrapper.java100
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/SecProviderUtils.java24
272 files changed, 13301 insertions, 12760 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java
index 305c227..97e63c5 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAApplicationException.java
@@ -21,30 +21,30 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss;
+
/**
* Base class of application specific MOA exceptions.
- *
- * Application exceptions are exceptions that originate from application
- * code (e.g. inconsistent data provided by the user, no permission to access
- * certain resources, etc.)
- *
+ *
+ * Application exceptions are exceptions that originate from application code
+ * (e.g. inconsistent data provided by the user, no permission to access certain
+ * resources, etc.)
+ *
* @author Patrick Peck
* @version $Id$
*/
public class MOAApplicationException extends MOAException {
-
+
/**
- *
- */
- private static final long serialVersionUID = 1042877795934327684L;
+ *
+ */
+ private static final long serialVersionUID = 1042877795934327684L;
-/**
+ /**
* Create a new <code>MOAApplicationException</code>.
- *
- * @param messageId The identifier of the message associated with this
- * exception.
+ *
+ * @param messageId The identifier of the message associated with this
+ * exception.
* @param parameters Additional message parameters.
*/
public MOAApplicationException(String messageId, Object[] parameters) {
@@ -53,17 +53,17 @@ public class MOAApplicationException extends MOAException {
/**
* Create a new <code>MOAApplicationException</code>.
- *
- * @param messageId The identifier of the message associated with this
- * <code>MOAApplicationException</code>.
+ *
+ * @param messageId The identifier of the message associated with this
+ * <code>MOAApplicationException</code>.
* @param parameters Additional message parameters.
- * @param wrapped The exception wrapped by this
- * <code>MOAApplicationException</code>.
+ * @param wrapped The exception wrapped by this
+ * <code>MOAApplicationException</code>.
*/
public MOAApplicationException(
- String messageId,
- Object[] parameters,
- Throwable wrapped) {
+ String messageId,
+ Object[] parameters,
+ Throwable wrapped) {
super(messageId, parameters, wrapped);
}
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 bf7f9af..0aff639 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
@@ -21,8 +21,8 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss;
+
import java.io.PrintStream;
import java.io.PrintWriter;
@@ -39,30 +39,30 @@ import at.gv.egovernment.moaspss.util.Constants;
/**
* Base class of MOA specific exceptions.
- *
- * This class has the ability to wrap other exceptions which may be seen
- * as the root cause for this exception. A similar mechanism is in place
- * since JDK1.4 (see the <code>getClause()</code> method) but will not be used
- * because of required compatibility with JDK1.3.
- *
+ *
+ * This class has the ability to wrap other exceptions which may be seen as the
+ * root cause for this exception. A similar mechanism is in place since JDK1.4
+ * (see the <code>getClause()</code> method) but will not be used because of
+ * required compatibility with JDK1.3.
+ *
* @author Patrick Peck
* @version $Id$
*/
public abstract class MOAException extends Exception {
/**
- *
- */
- private static final long serialVersionUID = 7115301799538771949L;
-/** The message ID. */
- private String messageId;
+ *
+ */
+ private static final long serialVersionUID = 7115301799538771949L;
+ /** The message ID. */
+ private final String messageId;
/** The wrapped <code>Throwable</code>. */
private Throwable wrapped;
/**
* Create a <code>MOAException</code>.
- *
- * @param messageId The message ID of the message contained in the created
- * <code>MOAException</code>.
+ *
+ * @param messageId The message ID of the message contained in the created
+ * <code>MOAException</code>.
* @param parameters The parameters needed to fill in the message arguments.
*/
public MOAException(String messageId, Object[] parameters) {
@@ -72,15 +72,15 @@ public abstract class MOAException extends Exception {
/**
* Create a <code>MOAException</code>.
- *
- * @param messageId The message ID of the message contained in the created
- * <code>MOAException</code>.
+ *
+ * @param messageId The message ID of the message contained in the created
+ * <code>MOAException</code>.
* @param parameters The parameters needed to fill in the message arguments.
- * @param wrapped The exception wrapped by the created
- * <code>MOAException</code>.
+ * @param wrapped The exception wrapped by the created
+ * <code>MOAException</code>.
*/
public MOAException(String messageId, Object[] parameters, Throwable wrapped) {
- // TODO: remove wrapped again from super constructor
+ // TODO: remove wrapped again from super constructor
super(MessageProvider.getInstance().getMessage(messageId, parameters), wrapped);
this.messageId = messageId;
this.wrapped = wrapped;
@@ -88,7 +88,7 @@ public abstract class MOAException extends Exception {
/**
* Returns the message ID of this exception.
- *
+ *
* @return The message ID as provided in the constructor.
*/
public String getMessageId() {
@@ -97,9 +97,9 @@ public abstract class MOAException extends Exception {
/**
* Returns the exception wrapped by this <code>MOAException</code>.
- *
- * @return The exception wrapped by this exception. Possibly
- * <code>null</code>, if none was provided at construction time.
+ *
+ * @return The exception wrapped by this exception. Possibly <code>null</code>,
+ * if none was provided at construction time.
*/
public Throwable getWrapped() {
return wrapped;
@@ -108,9 +108,10 @@ public abstract class MOAException extends Exception {
/**
* Convert this <code>MOAException</code> to an <code>ErrorResponse</code>
* element from the MOA namespace.
- *
+ *
* @return An <code>ErrorResponse</code> element, containing the subelements
- * <code>ErrorCode</code> and <code>Info</code> required by the MOA schema.
+ * <code>ErrorCode</code> and <code>Info</code> required by the MOA
+ * schema.
*/
public Element toErrorResponse() {
DocumentBuilder builder;
@@ -124,7 +125,7 @@ public abstract class MOAException extends Exception {
try {
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
impl = builder.getDOMImplementation();
- } catch (ParserConfigurationException e) {
+ } catch (final ParserConfigurationException e) {
return null;
}
@@ -134,11 +135,11 @@ public abstract class MOAException extends Exception {
// add MOA namespace declaration
errorResponse.setAttributeNS(
- Constants.XMLNS_NS_URI,
- "xmlns",
- Constants.MOA_NS_URI);
+ Constants.XMLNS_NS_URI,
+ "xmlns",
+ Constants.MOA_NS_URI);
- // build the child elements
+ // build the child elements
errorCode = doc.createElementNS(Constants.MOA_NS_URI, "ErrorCode");
errorCode.appendChild(doc.createTextNode(messageId));
info = doc.createElementNS(Constants.MOA_NS_URI, "Info");
@@ -147,22 +148,24 @@ public abstract class MOAException extends Exception {
errorResponse.appendChild(info);
return errorResponse;
}
-
+
/**
* Print a stack trace of this exception to <code>System.err</code>.
- *
+ *
* @see java.lang.Throwable#printStackTrace()
*/
+ @Override
public void printStackTrace() {
printStackTrace(System.err);
}
/**
* Print a stack trace of this exception, including the wrapped exception.
- *
+ *
* @param s The stream to write the stack trace to.
* @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
*/
+ @Override
public void printStackTrace(PrintStream s) {
super.printStackTrace(s);
if (getWrapped() != null) {
@@ -173,10 +176,11 @@ public abstract class MOAException extends Exception {
/**
* Print a stack trace of this exception, including the wrapped exception.
- *
+ *
* @param s The stream to write the stacktrace to.
* @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
*/
+ @Override
public void printStackTrace(PrintWriter s) {
super.printStackTrace(s);
if (getWrapped() != null) {
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 3a65c48..d7522ff 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
@@ -21,8 +21,8 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss;
+
import java.io.PrintStream;
import java.io.PrintWriter;
@@ -39,30 +39,30 @@ import at.gv.egovernment.moaspss.util.Constants;
/**
* Base class of MOA specific runtime exceptions.
- *
- * This class has the ability to wrap other exceptions which may be seen
- * as the root cause for this exception. A similar mechanism is in place
- * since JDK1.4 (see the <code>getClause()</code> method) but will not be used
- * because of required compatibility with JDK1.3.
- *
+ *
+ * This class has the ability to wrap other exceptions which may be seen as the
+ * root cause for this exception. A similar mechanism is in place since JDK1.4
+ * (see the <code>getClause()</code> method) but will not be used because of
+ * required compatibility with JDK1.3.
+ *
* @author Patrick Peck
* @version $Id$
*/
public class MOARuntimeException extends RuntimeException {
/**
- *
- */
- private static final long serialVersionUID = 8516197293435621864L;
-/** The message ID. */
- private String messageId;
+ *
+ */
+ private static final long serialVersionUID = 8516197293435621864L;
+ /** The message ID. */
+ private final String messageId;
/** The wrapped <code>Throwable</code>. */
private Throwable wrapped;
/**
* Create a <code>MOAException</code>.
- *
- * @param messageId The message ID of the message contained in the created
- * <code>MOAException</code>.
+ *
+ * @param messageId The message ID of the message contained in the created
+ * <code>MOAException</code>.
* @param parameters The parameters needed to fill in the message arguments.
*/
public MOARuntimeException(String messageId, Object[] parameters) {
@@ -72,17 +72,17 @@ public class MOARuntimeException extends RuntimeException {
/**
* Create a <code>MOAException</code>.
- *
- * @param messageId The message ID of the message contained in the created
- * <code>MOAException</code>.
+ *
+ * @param messageId The message ID of the message contained in the created
+ * <code>MOAException</code>.
* @param parameters The parameters needed to fill in the message arguments.
- * @param wrapped The exception wrapped by the created
- * <code>MOAException</code>.
+ * @param wrapped The exception wrapped by the created
+ * <code>MOAException</code>.
*/
public MOARuntimeException(
- String messageId,
- Object[] parameters,
- Throwable wrapped) {
+ String messageId,
+ Object[] parameters,
+ Throwable wrapped) {
super(MessageProvider.getInstance().getMessage(messageId, parameters));
this.messageId = messageId;
@@ -91,7 +91,7 @@ public class MOARuntimeException extends RuntimeException {
/**
* Returns the message ID of this exception.
- *
+ *
* @return The message ID as provided in the constructor.
*/
public String getMessageId() {
@@ -100,20 +100,21 @@ public class MOARuntimeException extends RuntimeException {
/**
* Returns the exception wrapped by this <code>MOARuntimeException</code>.
- *
- * @return The exception wrapped by this exception. Possibly
- * <code>null</code>, if none was provided at construction time.
+ *
+ * @return The exception wrapped by this exception. Possibly <code>null</code>,
+ * if none was provided at construction time.
*/
public Throwable getWrapped() {
return wrapped;
}
/**
- * Convert this <code>MOARuntimeException</code> to an <code>ErrorResponse</code>
- * element from the MOA namespace.
- *
+ * Convert this <code>MOARuntimeException</code> to an
+ * <code>ErrorResponse</code> element from the MOA namespace.
+ *
* @return An <code>ErrorResponse</code> element, containing the subelements
- * <code>ErrorCode</code> and <code>Info</code> required by the MOA schema.
+ * <code>ErrorCode</code> and <code>Info</code> required by the MOA
+ * schema.
*/
public Element toErrorResponse() {
DocumentBuilder builder;
@@ -127,7 +128,7 @@ public class MOARuntimeException extends RuntimeException {
try {
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
impl = builder.getDOMImplementation();
- } catch (ParserConfigurationException e) {
+ } catch (final ParserConfigurationException e) {
return null;
}
@@ -137,11 +138,11 @@ public class MOARuntimeException extends RuntimeException {
// add MOA namespace declaration
errorResponse.setAttributeNS(
- Constants.XMLNS_NS_URI,
- "xmlns",
- Constants.MOA_NS_URI);
+ Constants.XMLNS_NS_URI,
+ "xmlns",
+ Constants.MOA_NS_URI);
- // build the child elements
+ // build the child elements
errorCode = doc.createElementNS(Constants.MOA_NS_URI, "ErrorCode");
errorCode.appendChild(doc.createTextNode(messageId));
info = doc.createElementNS(Constants.MOA_NS_URI, "Info");
@@ -150,22 +151,24 @@ public class MOARuntimeException extends RuntimeException {
errorResponse.appendChild(info);
return errorResponse;
}
-
+
/**
* Print a stack trace of this exception to <code>System.err</code>.
- *
+ *
* @see java.lang.Throwable#printStackTrace()
*/
+ @Override
public void printStackTrace() {
printStackTrace(System.err);
}
/**
* Print a stack trace of this exception, including the wrapped exception.
- *
+ *
* @param s The stream to write the stack trace to.
* @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
*/
+ @Override
public void printStackTrace(PrintStream s) {
super.printStackTrace(s);
if (getWrapped() != null) {
@@ -176,10 +179,11 @@ public class MOARuntimeException extends RuntimeException {
/**
* Print a stack trace of this exception, including the wrapped exception.
- *
+ *
* @param s The stream to write the stacktrace to.
* @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
*/
+ @Override
public void printStackTrace(PrintWriter s) {
super.printStackTrace(s);
if (getWrapped() != null) {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java
index 67c1908..aea00a8 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOASystemException.java
@@ -21,29 +21,29 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss;
+
/**
* Base class of technical MOA exceptions.
- *
+ *
* Technical exceptions are exceptions that originate from system failure (e.g.,
* a database connection fails, a component is not available, etc.)
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class MOASystemException extends MOAException {
/**
- *
- */
- private static final long serialVersionUID = 655642019638205185L;
+ *
+ */
+ private static final long serialVersionUID = 655642019638205185L;
-/**
+ /**
* Create a new <code>MOASystemException</code>.
- *
- * @param messageId The identifier of the message associated with this
- * exception.
+ *
+ * @param messageId The identifier of the message associated with this
+ * exception.
* @param parameters Additional message parameters.
*/
public MOASystemException(String messageId, Object[] parameters) {
@@ -52,17 +52,17 @@ public class MOASystemException extends MOAException {
/**
* Create a new <code>MOASystemException</code>.
- *
- * @param messageId The identifier of the message associated with this
- * <code>MOASystemException</code>.
+ *
+ * @param messageId The identifier of the message associated with this
+ * <code>MOASystemException</code>.
* @param parameters Additional message parameters.
- * @param wrapped The exception wrapped by this
- * <code>MOASystemException</code>.
+ * @param wrapped The exception wrapped by this
+ * <code>MOASystemException</code>.
*/
public MOASystemException(
- String messageId,
- Object[] parameters,
- Throwable wrapped) {
+ String messageId,
+ Object[] parameters,
+ Throwable wrapped) {
super(messageId, parameters, wrapped);
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/OutputConstants.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/OutputConstants.java
index 83519d2..e69171c 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/OutputConstants.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/OutputConstants.java
@@ -2,14 +2,13 @@ package at.gv.egovernment.moa.spss;
import java.lang.reflect.Field;
-import iaik.server.modules.ResultCode;
+import iaik.server.modules.resultcodes.ResultCode;
public class OutputConstants {
- public static void main(String[] argv) throws IllegalArgumentException, IllegalAccessException {
- Field[] fields = ResultCode.class.getFields();
- for(int i = 0; i < fields.length; i++) {
- Field f = fields[i];
- System.out.println(f.getName() + " : " + f.get(null));
- }
- }
+ public static void main(String[] argv) throws IllegalArgumentException, IllegalAccessException {
+ final Field[] fields = ResultCode.class.getFields();
+ for (final Field f : fields) {
+ System.out.println(f.getName() + " : " + f.get(null));
+ }
+ }
}
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 59db7b5..f2d3b89 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
@@ -21,17 +21,17 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api;
import at.gv.egovernment.moa.spss.MOAException;
import at.gv.egovernment.moa.spss.server.init.ConfiguratorImpl;
+import at.gv.egovernment.moa.spss.server.init.StartupConfigurationHolder;
/**
* Configures the SP/SS API.
- *
- * Also handles dynamic configuration updates.
- *
+ *
+ * Also handles dynamic configuration updates.
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -39,7 +39,7 @@ public abstract class Configurator {
/** The default implementation class. */
private static final String DEFAULT_IMPLEMENTATION =
- "at.gv.egovernment.moa.spss.server.init.ConfiguratorImpl";
+ "at.gv.egovernment.moa.spss.server.init.ConfiguratorImpl";
/** The single instance of this class. */
private static Configurator instance = null;
@@ -47,14 +47,13 @@ public abstract class Configurator {
public static synchronized Configurator getInstance() {
if (instance == null) {
try {
- /*DiscoverClass discover = new DiscoverClass();
- instance =
- (Configurator) discover.newInstance(
- Configurator.class,
- DEFAULT_IMPLEMENTATION);*/
- instance = new ConfiguratorImpl();
- } catch (Exception e) {
- // this can not happen since we provide a valid default
+ /*
+ * DiscoverClass discover = new DiscoverClass(); instance = (Configurator)
+ * discover.newInstance( Configurator.class, DEFAULT_IMPLEMENTATION);
+ */
+ instance = new ConfiguratorImpl();
+ } catch (final Exception e) {
+ // this can not happen since we provide a valid default
// implementation
}
}
@@ -62,23 +61,35 @@ public abstract class Configurator {
}
/**
+ * Get current configuration object.
+ *
+ * @return Configuration or <code>null</code> if it was not initialized yet
+ */
+ public abstract StartupConfigurationHolder getCurrentConfiguration();
+
+ /**
* Initialize the SP/SS configuration.
- *
- * Only a single call to this method will have an effect. Use
- * <code>update()</code> for reflecting changes in the configuration instead.
- *
+ *
+ * Only a single call to this method will have an effect. Use
+ * <code>update()</code> for reflecting changes in the configuration instead.
+ *
+ * @return Configuration holder
+ *
* @throws MOAException An error occurred updating the SP/SS configuration.
- */
- public abstract void init() throws MOAException;
-
+ */
+ public abstract StartupConfigurationHolder init() throws MOAException;
+
/**
* Update the SP/SS configuration.
- *
+ *
* This will only have an effect after the system has been initialized once
* using <code>init()</code>.
- *
+ *
+ * @return Updated Configuration holder, or <code>null</code> if it was not
+ * initialized
+ *
* @throws MOAException An error occurred updating the SP/SS configuration.
*/
- public abstract void update() throws MOAException;
+ public abstract StartupConfigurationHolder update() throws MOAException;
}
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 aadaefb..d0be7d5 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
@@ -21,7 +21,6 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api;
import java.io.InputStream;
@@ -81,10 +80,10 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse;
/**
* An abstract factory for creating MOA SP/SS API objects.
- *
- * Use <code>getInstance()</code> to get a concrete factory instance. Using
- * this instance, concrete MOA SP/SS API object can be created.
- *
+ *
+ * Use <code>getInstance()</code> to get a concrete factory instance. Using this
+ * instance, concrete MOA SP/SS API object can be created.
+ *
* @author Patrick Peck
* @author Gregor Karlinger
* @version $Id$
@@ -93,27 +92,26 @@ public abstract class SPSSFactory {
/** The default implementation of this class. */
private static final String DEFAULT_IMPLEMENTATION =
- "at.gv.egovernment.moa.spss.api.impl.SPSSFactoryImpl";
+ "at.gv.egovernment.moa.spss.api.impl.SPSSFactoryImpl";
/** The single instance of this class. */
private static SPSSFactory instance = null;
/**
* Returns the single instance of this class.
- *
+ *
* @return The single instance of this class.
*/
public static synchronized SPSSFactory getInstance() {
if (instance == null) {
try {
- /*DiscoverClass discover = new DiscoverClass();
- instance =
- (SPSSFactory) discover.newInstance(
- SPSSFactory.class,
- DEFAULT_IMPLEMENTATION);*/
+ /*
+ * DiscoverClass discover = new DiscoverClass(); instance = (SPSSFactory)
+ * discover.newInstance( SPSSFactory.class, DEFAULT_IMPLEMENTATION);
+ */
instance = new SPSSFactoryImpl();
- } catch (Exception e) {
- // this can not happen since we provide a valid default
+ } catch (final Exception e) {
+ // this can not happen since we provide a valid default
// implementation
}
}
@@ -126,93 +124,94 @@ public abstract class SPSSFactory {
/**
* Create a new <code>CreateXMLSignatureRequest</code> object.
- *
- * @param keyIdentifier The identifier for the key group to use for signing.
- * @param singleSignatureInfos A <code>List</code> of
- * <code>SingleSignatureInfo</code> objects containing information about a
- * single signature to be created.
- * @return The <code>CreateXMLSignatureRequest</code> containing the above
- * data.
- *
+ *
+ * @param keyIdentifier The identifier for the key group to use for
+ * signing.
+ * @param singleSignatureInfos A <code>List</code> of
+ * <code>SingleSignatureInfo</code> objects
+ * containing information about a single signature
+ * to be created.
+ * @return The <code>CreateXMLSignatureRequest</code> containing the above data.
+ *
* @pre keyIdentifier != null && keyIdentifier.length() > 0
* @pre singleSignatureInfos != null
- * @pre forall Object o in singleSignatureInfos |
- * o instanceof at.gv.egovernment.moa.spss.api.common.SingleSignatureInfo
+ * @pre forall Object o in singleSignatureInfos | o instanceof
+ * at.gv.egovernment.moa.spss.api.common.SingleSignatureInfo
* @post return != null
*/
public abstract CreateXMLSignatureRequest createCreateXMLSignatureRequest(
- String keyIdentifier,
- List singleSignatureInfos);
+ String keyIdentifier,
+ List singleSignatureInfos);
/**
* Create a new <code>CreateCMSSignatureRequest</code> object.
- *
- * @param keyIdentifier The identifier for the key group to use for signing.
- * @param singleSignatureInfos A <code>List</code> of
- * <code>SingleSignatureInfo</code> objects containing information about a
- * single signature to be created.
- * @return The <code>CreateCMSSignatureRequest</code> containing the above
- * data.
- *
+ *
+ * @param keyIdentifier The identifier for the key group to use for
+ * signing.
+ * @param singleSignatureInfos A <code>List</code> of
+ * <code>SingleSignatureInfo</code> objects
+ * containing information about a single signature
+ * to be created.
+ * @return The <code>CreateCMSSignatureRequest</code> containing the above data.
+ *
* @pre keyIdentifier != null && keyIdentifier.length() > 0
* @pre singleSignatureInfos != null
- * @pre forall Object o in singleSignatureInfos |
- * o instanceof at.gv.egovernment.moa.spss.api.common.SingleSignatureInfo
+ * @pre forall Object o in singleSignatureInfos | o instanceof
+ * at.gv.egovernment.moa.spss.api.common.SingleSignatureInfo
* @post return != null
*/
public abstract CreateCMSSignatureRequest createCreateCMSSignatureRequest(
- String keyIdentifier,
- List singleSignatureInfos);
-
+ String keyIdentifier,
+ List singleSignatureInfos);
+
/**
* Create a new <code>SingleSignatureInfo</code> object.
- *
- * @param dataObjectInfos The data objects that will be signed (including
- * transformations).
- * @param createSignatureInfo Information about the signature environment. May
- * be <code>null</code>.
+ *
+ * @param dataObjectInfos The data objects that will be signed (including
+ * transformations).
+ * @param createSignatureInfo Information about the signature environment. May
+ * be <code>null</code>.
* @param securityLayerConform If <code>true</code>, a Security Layer conform
- * signature manifest is created, otherwise not.
+ * signature manifest is created, otherwise not.
* @return The <code>SingleSignatureInfo</code> containing the above data.
- *
+ *
* @pre dataObjectInfos != null && dataObjectInfos.size() > 0
- * @pre forall Object o in dataObjectInfos |
- * o instanceof at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo
+ * @pre forall Object o in dataObjectInfos | o instanceof
+ * at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo
* @post return != null
*/
public abstract SingleSignatureInfo createSingleSignatureInfo(
- List dataObjectInfos,
- CreateSignatureInfo createSignatureInfo, boolean securityLayerConform);
-
+ List dataObjectInfos,
+ CreateSignatureInfo createSignatureInfo, boolean securityLayerConform);
+
/**
* Create a new <code>SingleSignatureInfo</code> object.
- *
- * @param dataObjectInfo The data object that will be signed.
+ *
+ * @param dataObjectInfo The data object that will be signed.
* @param securityLayerConform If <code>true</code>, a Security Layer conform
- * signature manifest is created, otherwise not.
+ * signature manifest is created, otherwise not.
+ * @param isPAdESSignature
* @return The <code>SingleSignatureInfo</code> containing the above data.
- *
+ *
* @post return != null
*/
- public abstract at.gv.egovernment.moa.spss.api.cmssign.SingleSignatureInfo createSingleSignatureInfoCMS(
- at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo dataObjectInfo,
- boolean securityLayerConform);
-
-
-
+ public abstract at.gv.egovernment.moa.spss.api.cmssign.SingleSignatureInfo createSingleSignatureInfoCMS(
+ at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo dataObjectInfo,
+ boolean securityLayerConform, boolean isPAdESSignature);
/**
* Create a new <code>DataObjectInfo</code> object.
- *
- * @param structure The type of signature to create.
- * @param childOfManifest If <code>true</code>, references will be returned
- * as children of an XMLDsig manifest. Otherwise, they will be returned as
- * children of the signature itself.
- * @param dataObject The data object that will be signed.
- * @param createTransformsInfoProfile Additional transformations to apply
- * to the data object.
+ *
+ * @param structure The type of signature to create.
+ * @param childOfManifest If <code>true</code>, references will be
+ * returned as children of an XMLDsig
+ * manifest. Otherwise, they will be returned
+ * as children of the signature itself.
+ * @param dataObject The data object that will be signed.
+ * @param createTransformsInfoProfile Additional transformations to apply to the
+ * data object.
* @return The <code>DataObjectInfo</code> containing the above data.
- *
+ *
* @pre DataObjectInfo.STRUCTURE_DETACHED.equals(structure) ||
* DataObjectInfo.STRUCTURE_ENVELOPING.equals(structure)
* @pre dataObject != null
@@ -220,218 +219,216 @@ public abstract class SPSSFactory {
* @post return != null
*/
public abstract DataObjectInfo createDataObjectInfo(
- String structure,
- boolean childOfManifest,
- Content dataObject,
- CreateTransformsInfoProfile createTransformsInfoProfile);
+ String structure,
+ boolean childOfManifest,
+ Content dataObject,
+ CreateTransformsInfoProfile createTransformsInfoProfile);
/**
* Create a new <code>DataObjectInfo</code> object.
- *
- * @param structure The type of signature to create.
+ *
+ * @param structure The type of signature to create.
* @param dataObject The data object that will be signed.
* @return The <code>DataObjectInfo</code> containing the above data.
- *
+ *
* @pre DataObjectInfo.STRUCTURE_DETACHED.equals(structure) ||
* DataObjectInfo.STRUCTURE_ENVELOPING.equals(structure)
* @pre dataObject != null
* @post return != null
*/
public abstract at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo createDataObjectInfo(
- String structure,
- CMSDataObject dataObject);
-
+ String structure,
+ CMSDataObject dataObject);
+
/**
* Create a new <code>CreateTransformsInfoProfile</code> object containing a
* reference to a locally stored profile.
- *
- * @param profileID The profile ID to resolve during signature creation.
+ *
+ * @param profileID The profile ID to resolve during signature creation.
* @return The <code>CreateTransformsInfoProfile</code> containing the given
- * profile ID.
- *
+ * profile ID.
+ *
* @pre profileID != null && profileID.length() > 0
* @post return != null
*/
public abstract CreateTransformsInfoProfile createCreateTransformsInfoProfile(String profileID);
/**
- * Create a new <code>CreateTransformsInfoProfile</code> object by providing
- * the profile data explicitly.
- *
- * @param transformsInfo The transformations to apply to the associated
- * data object.
- * @param supplements Supplemental information for the transformation. May be
- * <code>null</code>.
+ * Create a new <code>CreateTransformsInfoProfile</code> object by providing the
+ * profile data explicitly.
+ *
+ * @param transformsInfo The transformations to apply to the associated data
+ * object.
+ * @param supplements Supplemental information for the transformation. May be
+ * <code>null</code>.
* @return The <code>CreateTransformsInfoProfile</code> containing the above
- * data.
- *
+ * data.
+ *
* @pre transformsInfo != null
- * @pre supplements != null implies
- * forall Object o in supplements |
- * o instanceof at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation
+ * @pre supplements != null implies forall Object o in supplements | o
+ * instanceof
+ * at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation
* @post return != null
*/
public abstract CreateTransformsInfoProfile createCreateTransformsInfoProfile(
- CreateTransformsInfo transformsInfo,
- List supplements);
+ CreateTransformsInfo transformsInfo,
+ List supplements);
/**
* Create a new <code>CreateTransformsInfo</code> object.
- *
- * @param transforms The <code>Transform</code>s to apply to the associated
- * data object. May be <code>null</code>.
- * @param finalDataMetaInfo Information about the type of the transformed
- * data.
+ *
+ * @param transforms The <code>Transform</code>s to apply to the
+ * associated data object. May be <code>null</code>.
+ * @param finalDataMetaInfo Information about the type of the transformed data.
* @return The <code>CreateTransformsInfo</code> containing the above data.
- *
+ *
* @pre transforms != null implies transforms.size > 0
- * @pre transforms != null implies
- * forall Object o in transforms |
- * o instanceof at.gv.egovernment.moa.spss.api.common.Transform
+ * @pre transforms != null implies forall Object o in transforms | o instanceof
+ * at.gv.egovernment.moa.spss.api.common.Transform
* @pre finalDataMetaInfo != null
* @post return != null
*/
public abstract CreateTransformsInfo createCreateTransformsInfo(
- List transforms,
- MetaInfo finalDataMetaInfo);
+ List transforms,
+ MetaInfo finalDataMetaInfo);
/**
* Create a new <code>CreateSignatureInfo</code> object.
- *
- * @param createSignatureEnvironment The signature environment that will
- * contain the signature.
- * @param createSignatureEnvironmentProfile Additional information about
- * the signture environment.
+ *
+ * @param createSignatureEnvironment The signature environment that will
+ * contain the signature.
+ * @param createSignatureEnvironmentProfile Additional information about the
+ * signture environment.
* @return The <code>CreateSignatureInfo</code> containing the above data.
- *
+ *
* @pre createSignatureEnvironment != null
* @pre createSignatureEnvironmentProfile != null
* @post return != null
*/
public abstract CreateSignatureInfo createCreateSignatureInfo(
- Content createSignatureEnvironment,
- CreateSignatureEnvironmentProfile createSignatureEnvironmentProfile);
+ Content createSignatureEnvironment,
+ CreateSignatureEnvironmentProfile createSignatureEnvironmentProfile);
/**
- * Create a new <code>CreateSignatureEnvironmentProfile</code> object
- * containing a reference to a locally stored profile.
- *
+ * Create a new <code>CreateSignatureEnvironmentProfile</code> object containing
+ * a reference to a locally stored profile.
+ *
* @param profileID The profile ID to resolve during signature creation.
- * @return The <code>CreateSignatureEnvironmentProfile</code> containing
- * the given profile ID.
- *
+ * @return The <code>CreateSignatureEnvironmentProfile</code> containing the
+ * given profile ID.
+ *
* @pre profileID != null && profileID.length() > 0
* @post return != null
*/
public abstract CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile(String profileID);
/**
- * Create a new <code>CreateSignatureEnvironmentProfile</code> object by
- * providing the profile data explicitly.
- *
+ * Create a new <code>CreateSignatureEnvironmentProfile</code> object by
+ * providing the profile data explicitly.
+ *
* @param createSignatureLocation The location where the signature will be
- * inserted.
- * @param supplements Additional information about the signature environment.
+ * inserted.
+ * @param supplements Additional information about the signature
+ * environment.
* @return The <code>CreateSignatureEnvironmentProfile</code> containing the
- * above data.
- *
+ * above data.
+ *
* @pre createSignatureLocation != null
- * @pre supplements != null
- * @pre forall Object o in supplements |
- * o instanceof at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation
+ * @pre supplements != null
+ * @pre forall Object o in supplements | o instanceof
+ * at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation
* @post return != null
*/
public abstract CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile(
- CreateSignatureLocation createSignatureLocation,
- List supplements);
+ CreateSignatureLocation createSignatureLocation,
+ List supplements);
/**
* Create a new <code>CreateSignatureLocation</code> object.
- *
- * @param xPathExpression The XPath expression to select the signature
- * parent element within the signature environment.
- * @param index The index of the node, after which the signature will be
- * inserted.
+ *
+ * @param xPathExpression The XPath expression to select the signature
+ * parent element within the signature environment.
+ * @param index The index of the node, after which the signature
+ * will be inserted.
* @param namespaceDeclarations The namespace prefix to URI mapping to apply
- * while evaluating the XPath expression.
+ * while evaluating the XPath expression.
* @return The <code>CreateSignatureLocation</code> containing the above data.
- *
+ *
* @pre xPathExpression != null
* @pre index >= 0
* @pre namespaceDeclarations != null
*/
public abstract CreateSignatureLocation createCreateSignatureLocation(
- String xPathExpression,
- int index,
- Map namespaceDeclarations);
+ String xPathExpression,
+ int index,
+ Map namespaceDeclarations);
/**
* Create a new <code>CreateXMLSignatureResponse</code> object.
- *
- * @param responseElements The elements of the response, either
- * <code>SignatureEnvironmentResponse</code> objects, or
- * <code>ErrorResponse</code> objects.
- * @return The new <code>CreateXMLSignatureResponse</code> containing the
- * above data.
- *
+ *
+ * @param responseElements The elements of the response, either
+ * <code>SignatureEnvironmentResponse</code> objects, or
+ * <code>ErrorResponse</code> objects.
+ * @return The new <code>CreateXMLSignatureResponse</code> containing the above
+ * data.
+ *
* @pre responseElements != null && responseElements.size() > 0
- * @pre forall Object o in responseElements |
- * o instanceof at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureResponseElement
+ * @pre forall Object o in responseElements | o instanceof
+ * at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureResponseElement
* @post return != null
*/
public abstract CreateXMLSignatureResponse createCreateXMLSignatureResponse(List responseElements);
-
/**
* Create a new <code>CreateCMSSignatureResponse</code> object.
- *
- * @param responseElements The elements of the response, either
- * <code>CMSSignatureResponse</code> objects, or
- * <code>ErrorResponse</code> objects.
- * @return The new <code>CreateCMSSignatureResponse</code> containing the
- * above data.
- *
+ *
+ * @param responseElements The elements of the response, either
+ * <code>CMSSignatureResponse</code> objects, or
+ * <code>ErrorResponse</code> objects.
+ * @return The new <code>CreateCMSSignatureResponse</code> containing the above
+ * data.
+ *
* @pre responseElements != null && responseElements.size() > 0
- * @pre forall Object o in responseElements |
- * o instanceof at.gv.egovernment.moa.spss.api.cmssign.CMSSignatureResponse
+ * @pre forall Object o in responseElements | o instanceof
+ * at.gv.egovernment.moa.spss.api.cmssign.CMSSignatureResponse
* @post return != null
*/
public abstract CreateCMSSignatureResponse createCreateCMSSignatureResponse(List responseElements);
-
-
+
/**
* Create a new <code>SignatureEnvironmentResponse</code> object.
- *
+ *
* @param signatureEnvironment The signature environment containing the
- * signature.
+ * signature.
* @return The <code>SignatureEnvironmentResponse</code> containing the
- * <code>signatureEnvironment</code>.
- *
+ * <code>signatureEnvironment</code>.
+ *
* @pre signatureEnvironment != null
* @post return != null
*/
public abstract CMSSignatureResponse createCMSSignatureResponse(String base64value);
-
+
/**
* Create a new <code>SignatureEnvironmentResponse</code> object.
- *
+ *
* @param signatureEnvironment The signature environment containing the
- * signature.
+ * signature.
* @return The <code>SignatureEnvironmentResponse</code> containing the
- * <code>signatureEnvironment</code>.
- *
+ * <code>signatureEnvironment</code>.
+ *
* @pre signatureEnvironment != null
* @post return != null
*/
- public abstract SignatureEnvironmentResponse createSignatureEnvironmentResponse(Element signatureEnvironment);
+ public abstract SignatureEnvironmentResponse createSignatureEnvironmentResponse(
+ Element signatureEnvironment);
/**
* Create a new <code>ErrorResponse</code> object.
- *
+ *
* @param code The numerical error code.
* @param info Verbose error information.
* @return The new <code>ErrorResponse</code> containing the above data.
- *
+ *
* @pre code > 0
* @pre info != null
* @post return != null
@@ -444,91 +441,87 @@ public abstract class SPSSFactory {
/**
* Create a new <code>VerifyCMSSignatureRequest</code> 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 <code>null</code>.
- * @param cmsSignature The CMS signature.
- * @param dataObject The signed data. May be <code>null</code>.
- * @param trustProfileID The ID of the trust profile containing the trusted
- * root certificates.
- * @return The <code>VerifyCMSSignatureRequest</code> containing the above
- * data.
- *
+ *
+ * @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 <code>null</code>.
+ * @param cmsSignature The CMS signature.
+ * @param dataObject The signed data. May be <code>null</code>.
+ * @param trustProfileID The ID of the trust profile containing the trusted root
+ * certificates.
+ * @return The <code>VerifyCMSSignatureRequest</code> 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 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);
-
+ int[] signatories,
+ Date dateTime,
+ InputStream cmsSignature,
+ CMSDataObject dataObject,
+ String trustProfileID,
+ boolean pdf);
+
/**
* Create a new <code>VerifyCMSSignatureRequest</code> 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 <code>null</code>.
- * @param cmsSignature The CMS signature.
- * @param dataObject The signed data. May be <code>null</code>.
- * @param trustProfileID The ID of the trust profile containing the trusted
- * root certificates.
- * @return The <code>VerifyCMSSignatureRequest</code> containing the above
- * data.
- *
+ *
+ * @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 <code>null</code>.
+ * @param cmsSignature The CMS signature.
+ * @param dataObject The signed data. May be <code>null</code>.
+ * @param trustProfileID The ID of the trust profile containing the trusted root
+ * certificates.
+ * @return The <code>VerifyCMSSignatureRequest</code> 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 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);
+ int[] signatories,
+ Date dateTime,
+ InputStream cmsSignature,
+ CMSDataObject dataObject,
+ String trustProfileID,
+ boolean pdf,
+ boolean extended);
/**
* Create a new <code>CMSDataObject</code> object from data at a given URI.
- *
- * @param metaInfo Type information about the <code>CMSDataObject</code>.
- * May be <code>null</code>.
- * @param content The CMS content containing the data.
+ *
+ * @param metaInfo Type information about the <code>CMSDataObject</code>. May be
+ * <code>null</code>.
+ * @param content The CMS content containing the data.
* @return The new <code>CMSDataObject</code> containing the data.
- *
+ *
* @pre referenceURI != null
* @pre content != null
* @post return != null
*/
public abstract CMSDataObject createCMSDataObject(
- MetaInfo metaInfo,
- CMSContent content,
- BigDecimal excludeByteRangeFrom,
- BigDecimal excludeByteRangeTo);
+ MetaInfo metaInfo,
+ CMSContent content,
+ BigDecimal excludeByteRangeFrom,
+ BigDecimal excludeByteRangeTo);
/**
* Create a new <code>CMSContent</code> object from the data contained at the
* given URI.
- *
+ *
* @param referenceURI The URI identifying the data. Must be resolvable.
* @return The <code>CMSContent</code> containing a reference to the signed
- * data.
- *
+ * data.
+ *
* @pre referenceURI != null
* @post return != null
*/
@@ -536,11 +529,11 @@ public abstract class SPSSFactory {
/**
* Create a new <code>CMSContent</code> object from a byte stream.
- *
+ *
* @param binaryContent The byte stream containing the signed data.
- * @return The new <code>CMSContent</code> containing the data from the
- * byte stream.
- *
+ * @return The new <code>CMSContent</code> containing the data from the byte
+ * stream.
+ *
* @pre binaryContent != null
* @post return != null
*/
@@ -548,38 +541,40 @@ public abstract class SPSSFactory {
/**
* Create a new <code>VerifyCMSSignatureResponse</code> object.
- *
+ *
* @param responseElements Verification information about each signature.
- * @return The new <code>VerifyCMSSignatureResponse</code> containing the
- * status of signature verification for each signature contained in the
- * request.
- *
- * @pre responseElements != null && responseElements.size() > 0
- * @pre forall Object o in responseElements |
- * o instanceof at.gv.egovernment.moa.spss.api.cmssign.VerifyCMSSignatureResponseElement
+ * @return The new <code>VerifyCMSSignatureResponse</code> containing the status
+ * of signature verification for each signature contained in the
+ * request.
+ *
+ * @pre responseElements != null && responseElements.size() > 0
+ * @pre forall Object o in responseElements | o instanceof
+ * at.gv.egovernment.moa.spss.api.cmssign.VerifyCMSSignatureResponseElement
* @post return != null
*/
public abstract VerifyCMSSignatureResponse createVerifyCMSSignatureResponse(List responseElements);
/**
* Create a new <code>VerifyCMSSignatureResponseElement</code> object.
- *
- * @param signerInfo Information about the signer certificate.
- * @param signatureCheck Result of the singature value check.
+ *
+ * @param signerInfo Information about the signer certificate.
+ * @param signatureCheck Result of the signature value check.
* @param certificateCheck Result of the certificate status check.
- * @return The new <code>VerifyCMSSignatureResponseElement</code> containing
- * the above data.
- *
- * @pre signerInfo != null && signatureCheck != null &&
- * certificateCheck != null
+ * @return The new <code>VerifyCMSSignatureResponseElement</code> containing the
+ * above data.
+ *
+ * @pre signerInfo != null && signatureCheck != null && certificateCheck != null
* @post return != null
*/
public abstract VerifyCMSSignatureResponseElement createVerifyCMSSignatureResponseElement(
- SignerInfo signerInfo,
- CheckResult signatureCheck,
- CheckResult certificateCheck,
- List adesResult,
- ExtendedCertificateCheckResult extendedCertificateCheckResult);
+ SignerInfo signerInfo,
+ CheckResult signatureCheck,
+ CheckResult certificateCheck,
+ List adesResult,
+ ExtendedCertificateCheckResult extendedCertificateCheckResult,
+ String usedAlgorithm,
+ Boolean coversFullDocument,
+ int[] byteRangeOfSignature);
//
// Factory methods for verifying XML signatures
@@ -587,114 +582,114 @@ public abstract class SPSSFactory {
/**
* Create a new <code>VerifyXMLSignatureRequest</code> object.
- *
- * @param dateTime The date for which the verification is to be performed.
- * May be <code>null</code>.
- * @param verifySignatureInfo Information about the signature environment and
- * the location of the signature.
- * @param supplementProfiles Supplemental information for the signature
- * environment. May be <code>null</code>.
+ *
+ * @param dateTime The date for which the verification is to be
+ * performed. May be <code>null</code>.
+ * @param verifySignatureInfo Information about the signature environment
+ * and the location of the signature.
+ * @param supplementProfiles Supplemental information for the signature
+ * environment. May be <code>null</code>.
* @param signatureManifestParams Additional information for checking the
- * signature manifest. May be <code>null</code>.
- * @param returnHashInputData If <code>true</code>, hash input data will
- * be returned in the response, otherwise not.
- * @param trustProfileID The ID of the trust profile containing the trusted
- * root certificates.
- * @return The new <code>VerifyXMLSignatureRequest</code> containing the
- * above data.
- *
+ * signature manifest. May be <code>null</code>.
+ * @param returnHashInputData If <code>true</code>, hash input data will be
+ * returned in the response, otherwise not.
+ * @param trustProfileID The ID of the trust profile containing the
+ * trusted root certificates.
+ * @return The new <code>VerifyXMLSignatureRequest</code> 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 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);
-
+ Date dateTime,
+ VerifySignatureInfo verifySignatureInfo,
+ List supplementProfiles,
+ SignatureManifestCheckParams signatureManifestParams,
+ boolean returnHashInputData,
+ String trustProfileID);
+
/**
* Create a new <code>VerifyXMLSignatureRequest</code> object.
- *
- * @param dateTime The date for which the verification is to be performed.
- * May be <code>null</code>.
- * @param verifySignatureInfo Information about the signature environment and
- * the location of the signature.
- * @param supplementProfiles Supplemental information for the signature
- * environment. May be <code>null</code>.
+ *
+ * @param dateTime The date for which the verification is to be
+ * performed. May be <code>null</code>.
+ * @param verifySignatureInfo Information about the signature environment
+ * and the location of the signature.
+ * @param supplementProfiles Supplemental information for the signature
+ * environment. May be <code>null</code>.
* @param signatureManifestParams Additional information for checking the
- * signature manifest. May be <code>null</code>.
- * @param returnHashInputData If <code>true</code>, 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 <code>VerifyXMLSignatureRequest</code> containing the
- * above data.
- *
+ * signature manifest. May be <code>null</code>.
+ * @param returnHashInputData If <code>true</code>, 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 <code>VerifyXMLSignatureRequest</code> 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 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);
+ Date dateTime,
+ VerifySignatureInfo verifySignatureInfo,
+ List supplementProfiles,
+ SignatureManifestCheckParams signatureManifestParams,
+ boolean returnHashInputData,
+ String trustProfileID,
+ boolean extendedValidation);
/**
* Create a new <code>VerifySignatureInfo</code> object.
- *
- * @param verifySignatureEnvironment The signature environment containing
- * the signature to be verified.
- * @param verifySignatureLocation The location of the signature within the
- * signature environment.
+ *
+ * @param verifySignatureEnvironment The signature environment containing the
+ * signature to be verified.
+ * @param verifySignatureLocation The location of the signature within the
+ * signature environment.
* @return The new <code>VerifySignatureInfo</code> containing the above data.
- *
+ *
* @pre verifySignatureEnvironment != null
* @pre verifySignatureLocation != null
* @post return != null
*/
public abstract VerifySignatureInfo createVerifySignatureInfo(
- Content verifySignatureEnvironment,
- VerifySignatureLocation verifySignatureLocation);
+ Content verifySignatureEnvironment,
+ VerifySignatureLocation verifySignatureLocation);
/**
* Create a new <code>VerifySignatureLocation</code> object.
- *
- * @param xPathExpression The XPath expression to select the signature
- * element within the signature environment.
+ *
+ * @param xPathExpression The XPath expression to select the signature
+ * element within the signature environment.
* @param namespaceDeclarations The namespace prefix to URI mapping to apply
- * while evaluating the XPath expression.
+ * while evaluating the XPath expression.
* @return The new <code>VerifySignatureLocation</code> containing the above
- * data.
- *
+ * data.
+ *
* @pre xPathExpression != null
* @pre namespaceDeclarations != null
* @post return != null
*/
public abstract VerifySignatureLocation createVerifySignatureLocation(
- String xPathExpression,
- Map namespaceDeclarations);
+ String xPathExpression,
+ Map namespaceDeclarations);
/**
- * Create a new <code>SupplementProfile</code> object containing a reference
- * to a locally stored profile.
- *
+ * Create a new <code>SupplementProfile</code> object containing a reference to
+ * a locally stored profile.
+ *
* @param profileID The profile ID to resolve during signature verification.
* @return The <code>SupplementProfile</code> containing the profile ID.
- *
+ *
* @pre profileID != null && profileID.length() > 0
* @post return != null
*/
@@ -703,7 +698,7 @@ public abstract class SPSSFactory {
/**
* Create a new <code>SupplementProfile</code> object by providing the profile
* data explicitly.
- *
+ *
* @param supplementProfile The profile data.
* @return The <code>SupplementProfile</code> containing the profile data.
*/
@@ -711,231 +706,227 @@ public abstract class SPSSFactory {
/**
* Create a new <code>SignatureManifestCheckParams</code> object.
- *
- * @param referenceInfos Information for checking the validity of a
- * a reference.
- * @param returnReferenceInputData If <code>true</code>, the input data to
- * the calculation of reference digest values will be returned in the
- * response, otherwise not.
- * @return The <code>SignatureManifestCheckParams</code> containing the
- * above data.
- *
+ *
+ * @param referenceInfos Information for checking the validity of a a
+ * reference.
+ * @param returnReferenceInputData If <code>true</code>, the input data to the
+ * calculation of reference digest values will
+ * be returned in the response, otherwise not.
+ * @return The <code>SignatureManifestCheckParams</code> containing the above
+ * data.
+ *
* @pre referenceInfos != null && referenceInfos.size() > 0
- * @pre forall Object o in referenceInfos |
- * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo
+ * @pre forall Object o in referenceInfos | o instanceof
+ * at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo
* @post return != null
*/
public abstract SignatureManifestCheckParams createSignatureManifestCheckParams(
- List referenceInfos,
- boolean returnReferenceInputData);
+ List referenceInfos,
+ boolean returnReferenceInputData);
/**
* Create a new <code>ReferenceInfo</code> object.
- *
- * @param verifyTransformsInfoProfiles The transformation profiles valid for
- * the associated reference.
- * @return The <code>ReferenceInfo</code> containing the transformation
- * profiles.
- *
- * @pre verifyTransformsInfoProfiles != null &&
- * verifyTransformsInfoProfiles.size() > 0
- * @pre forall Object o in verifyTransformsInfoProfiles |
- * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfile
+ *
+ * @param verifyTransformsInfoProfiles The transformation profiles valid for the
+ * associated reference.
+ * @return The <code>ReferenceInfo</code> containing the transformation
+ * profiles.
+ *
+ * @pre verifyTransformsInfoProfiles != null &&
+ * verifyTransformsInfoProfiles.size() > 0
+ * @pre forall Object o in verifyTransformsInfoProfiles | o instanceof
+ * at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfile
* @post return != null
*/
public abstract ReferenceInfo createReferenceInfo(List verifyTransformsInfoProfiles);
/**
- * Create a new <code>VerifyTransformsInfoProfile</code> object containing
- * a reference to a locally stored profile.
- *
+ * Create a new <code>VerifyTransformsInfoProfile</code> object containing a
+ * reference to a locally stored profile.
+ *
* @param profileID The profile ID to resolve during signature verification.
- * @return The <code>VerifyTransformsInfoProfile</code> containing the
- * given profile ID.
- *
+ * @return The <code>VerifyTransformsInfoProfile</code> containing the given
+ * profile ID.
+ *
* @pre profileID != null && profileID.length() > 0
* @post return != null
*/
public abstract VerifyTransformsInfoProfile createVerifyTransformsInfoProfile(String profileID);
/**
- * Create a new <code>VerifyTransformsInfoProfile</code> object by providing
- * the profile data explicitly.
- *
- * @param transforms A valid chain of transformations for the reference.
- * May be <code>null</code>.
+ * Create a new <code>VerifyTransformsInfoProfile</code> object by providing the
+ * profile data explicitly.
+ *
+ * @param transforms A valid chain of transformations for the
+ * reference. May be <code>null</code>.
* @param transformParameters Additional transformation information.
* @return The <code>VerifyTransformsInfoProfile</code> containing the above
- * data.
- *
- * @pre transforms != null implies
- * (transforms.size() > 0 &&
- * forall Object o in transforms | o instanceof Transform)
- * @pre transformParameters != null implies
- * forall Object o in transformParameters |
- * o instanceof at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter
+ * data.
+ *
+ * @pre transforms != null implies (transforms.size() > 0 && forall Object o in
+ * transforms | o instanceof Transform)
+ * @pre transformParameters != null implies forall Object o in
+ * transformParameters | o instanceof
+ * at.gv.egovernment.moa.spss.api.xmlverify.TransformParameter
* @post return != null
*/
public abstract VerifyTransformsInfoProfile createVerifyTransformsInfoProfile(
- List transforms,
- List transformParameters);
+ List transforms,
+ List transformParameters);
/**
- * Create a new <code>TransformParameter</code> object with the data
- * contained at the given URI.
- *
+ * Create a new <code>TransformParameter</code> object with the data contained
+ * at the given URI.
+ *
* @param URI The URI identifying the data. The URI will be resolved during
- * signature verification.
- * @return The <code>TransformParameter</code> containing the URI of the
- * data.
- *
+ * signature verification.
+ * @return The <code>TransformParameter</code> containing the URI of the data.
+ *
* @pre URI != null
* @post return != null
*/
public abstract TransformParameter createTransformParameter(String URI);
/**
- * Creata a new <code>TransformParameter</code> object containing the
- * binary data.
- *
- * @param URI The URI identifying the data.
- * @param binaryData The binary data.
+ * Creata a new <code>TransformParameter</code> object containing the binary
+ * data.
+ *
+ * @param URI The URI identifying the data.
+ * @param binaryData The binary data.
* @return The <code>TransformParameter</code> containig the binary data.
- *
+ *
* @pre URI != null
* @pre binary != null
* @post return != null
*/
public abstract TransformParameter createTransformParameter(
- String URI,
- InputStream binaryData);
+ String URI,
+ InputStream binaryData);
/**
- * Create a new <code>TransformParameter</code> object containing the hash
- * value of the transformation data.
- *
- * @param URI The URI identifying the data. It will be resolved during
- * signature verification.
- * @param digestMethod The digest method used for calculating the digest
- * value.
- * @param digestValue The hash value of the transformation data.
+ * Create a new <code>TransformParameter</code> object containing the hash value
+ * of the transformation data.
+ *
+ * @param URI The URI identifying the data. It will be resolved during
+ * signature verification.
+ * @param digestMethod The digest method used for calculating the digest value.
+ * @param digestValue The hash value of the transformation data.
* @return The <code>TransformParameter</code> containing the above data.
- *
+ *
* @pre URI != null
* @pre digestMethod != null
* @pre digestValue != null
*/
public abstract TransformParameter createTransformParameter(
- String URI,
- String digestMethod,
- byte[] digestValue);
+ String URI,
+ String digestMethod,
+ byte[] digestValue);
/**
* Create a new <code>VerifyXMLSignatureResponse</code> object.
- *
- * @param signerInfo Information about the signer certificate.
- * @param hashInputDatas The signed data objects. May be <code>null</code>.
- * @param referenceInputDatas The reference input data objects.
- * May be <code>null</code>.
- * @param signatureCheck Status information about the signature check.
- * @param signatureManifestCheck Status information about the signature
- * manifest check.
- * @param xmlDsigManifestChecks Status information about each XMLDsig manifest
- * check.
- * @param certificateCheck Status information about the signer certificate
- * check.
+ *
+ * @param signerInfo Information about the signer certificate.
+ * @param hashInputDatas The signed data objects. May be
+ * <code>null</code>.
+ * @param referenceInputDatas The reference input data objects. May be
+ * <code>null</code>.
+ * @param signatureCheck Status information about the signature check.
+ * @param signatureManifestCheck Status information about the signature manifest
+ * check.
+ * @param xmlDsigManifestChecks Status information about each XMLDsig manifest
+ * check.
+ * @param certificateCheck Status information about the signer certificate
+ * check.
* @return The <code>VerifyXMLSignatureResponse</code> containing the above
- * data.
- *
+ * data.
+ *
* @pre signerInfo != null
- * @pre hashInputDatas != null implies
- * forall Object o in hashInputDatas |
- * o instanceof at.gv.egovernment.moa.spss.api.common.Content
- * @pre referenceInputDatas != null implies
- * forall Object o in referenceInputDatas |
- * o instanceof at.gv.egovernment.moa.spss.api.common.Content
+ * @pre hashInputDatas != null implies forall Object o in hashInputDatas | o
+ * instanceof at.gv.egovernment.moa.spss.api.common.Content
+ * @pre referenceInputDatas != null implies forall Object o in
+ * referenceInputDatas | o instanceof
+ * at.gv.egovernment.moa.spss.api.common.Content
* @pre signatureCheck != null
- * @pre xmlDsigManifestChecks != null implies
- * forall Object o in xmlDsigManifestChecks |
- * o instanceof at.gv.egovernment.moa.spss.api.xmlverifyManifestRefsCheckResult
+ * @pre xmlDsigManifestChecks != null implies forall Object o in
+ * xmlDsigManifestChecks | o instanceof
+ * at.gv.egovernment.moa.spss.api.xmlverifyManifestRefsCheckResult
* @pre certificateCheck != null
* @post return != null
*/
public abstract VerifyXMLSignatureResponse createVerifyXMLSignatureResponse(
- SignerInfo signerInfo,
- List hashInputDatas,
- List referenceInputDatas,
- ReferencesCheckResult signatureCheck,
- ReferencesCheckResult signatureManifestCheck,
- List xmlDsigManifestChecks,
- CheckResult certificateCheck,
- List adesFormResults,
- ExtendedCertificateCheckResult extCheckResult);
+ SignerInfo signerInfo,
+ List hashInputDatas,
+ List referenceInputDatas,
+ ReferencesCheckResult signatureCheck,
+ ReferencesCheckResult signatureManifestCheck,
+ List xmlDsigManifestChecks,
+ CheckResult certificateCheck,
+ List adesFormResults,
+ ExtendedCertificateCheckResult extCheckResult,
+ String signatureAlgorithm);
/**
* Create a new <code>ReferencesCheckResult</code> object.
- *
+ *
* @param code The status code.
* @param info Additional information about the reference check.
* @return The <code>ReferencesCheckResult</code> containing the above data.
- *
+ *
* @pre code >= 0
* @post return != null
*/
public abstract ReferencesCheckResult createReferencesCheckResult(
- int code,
- ReferencesCheckResultInfo info);
+ int code,
+ ReferencesCheckResultInfo info);
/**
* Create a new <code>ReferencesCheckResultInfo</code> object.
- *
- * @param anyOtherInfo Arbitrary XML content describing the check result.
- * May be <code>null</code>.
- * @param failedReferences The indexes of the failed references. May be
- * <code>null</code>.
- * @return The <code>ReferencesCheckResultInfo</code> containing the above
- * data.
- *
+ *
+ * @param anyOtherInfo Arbitrary XML content describing the check result.
+ * May be <code>null</code>.
+ * @param failedReferences The indexes of the failed references. May be
+ * <code>null</code>.
+ * @return The <code>ReferencesCheckResultInfo</code> containing the above data.
+ *
* @post return != null
*/
public abstract ReferencesCheckResultInfo createReferencesCheckResultInfo(
- NodeList anyOtherInfo,
- int[] failedReferences);
+ NodeList anyOtherInfo,
+ int[] failedReferences);
/**
* Create a new <code>ManifestRefsCheckResult</code> object.
- *
+ *
* @param code The status code.
* @param info Additional information about the manifest check. May be
- * <code>null</code>.
- * @return The <code>ManifestRefsCheckResult</code> containing the above
- * data.
- *
+ * <code>null</code>.
+ * @return The <code>ManifestRefsCheckResult</code> containing the above data.
+ *
* @pre code >= 0
* @post return != null
*/
public abstract ManifestRefsCheckResult createManifestRefsCheckResult(
- int code,
- ManifestRefsCheckResultInfo info);
+ int code,
+ ManifestRefsCheckResultInfo info);
/**
* Create a new <code>ManifestRefsCheckResultInfo</code> object.
- *
- * @param anyOtherInfo Arbitrary XML content describing the check result.
- * May be <code>null</code>.
- * @param failedReferences The indexes of the failed references. May be
- * <code>null</code>.
+ *
+ * @param anyOtherInfo Arbitrary XML content describing the check
+ * result. May be <code>null</code>.
+ * @param failedReferences The indexes of the failed references. May be
+ * <code>null</code>.
* @param referringSigReference The index of the reference in the signature.
- * @return The <code>ManifestRefsCheckResultInfo</code> containing the
- * above data.
- *
+ * @return The <code>ManifestRefsCheckResultInfo</code> containing the above
+ * data.
+ *
* @pre referringSigReference > 0
* @post return != null
*/
public abstract ManifestRefsCheckResultInfo createManifestRefsCheckResultInfo(
- NodeList anyOtherInfo,
- int[] failedReferences,
- int referringSigReference);
+ NodeList anyOtherInfo,
+ int[] failedReferences,
+ int referringSigReference);
//
// Factory methods for common objects
@@ -943,10 +934,10 @@ public abstract class SPSSFactory {
/**
* Create a new <code>Content</code> object referencing data via a URI.
- *
+ *
* @param referenceURI The URI pointing to the content.
* @return The <code>Content</code> object containing the reference.
- *
+ *
* @pre referenceURI != null && referenceURI.length() > 0
* @post return != null
*/
@@ -954,41 +945,43 @@ public abstract class SPSSFactory {
/**
* Create a new <code>Content</code> object containing binary data.
- *
- * @param binaryData An <code>InputStream</code> containing the binary data.
+ *
+ * @param binaryData An <code>InputStream</code> containing the binary data.
* @param referenceURI An URI identifying the data. May be <code>null</code>.
* @return The <code>Content</code> object containing the data.
- *
+ *
* @pre binaryData != null
* @post return != null
*/
public abstract Content createContent(
- InputStream binaryData,
- String referenceURI);
+ InputStream binaryData,
+ String referenceURI);
/**
- * Create a new <code>Content</code> object containing location reference data.
- *
- * @param locationReferenceURI a URI pointing to the actual remote location of the content.
- *
- * @param referenceURI An URI identifying the data. May be <code>null</code>.
- *
- * @return The <code>Content</code> object containing the data.
- *
- * @pre locationReferenceURI != null
- * @post return != null
- */
- public abstract Content createContent(
- String locationReferenceURI,
- String referenceURI);
+ * Create a new <code>Content</code> object containing location reference data.
+ *
+ * @param locationReferenceURI a URI pointing to the actual remote location of
+ * the content.
+ *
+ * @param referenceURI An URI identifying the data. May be
+ * <code>null</code>.
+ *
+ * @return The <code>Content</code> object containing the data.
+ *
+ * @pre locationReferenceURI != null
+ * @post return != null
+ */
+ public abstract Content createContent(
+ String locationReferenceURI,
+ String referenceURI);
/**
* Create a new <code>Content</code> object containing XML data.
- *
- * @param xmlData The XML data contained in the new <code>Content</code>.
+ *
+ * @param xmlData The XML data contained in the new <code>Content</code>.
* @param referenceURI An URI identifying the data. May be <code>null</code>.
* @return The <code>Content</code> object containing the data.
- *
+ *
* @pre xmlData != null
* @post return != null
*/
@@ -996,13 +989,11 @@ public abstract class SPSSFactory {
/**
* Create a new <code>XMLDataObjectAssociation</code> object.
- *
- * @param metaInfo Information about the content type. May be
- * <code>null</code>.
- * @param content The <code>Content</code> object containing the data.
- * @return The <code>XMLDataObjectAssociation</code> containing the above
- * data.
- *
+ *
+ * @param metaInfo Information about the content type. May be <code>null</code>.
+ * @param content The <code>Content</code> object containing the data.
+ * @return The <code>XMLDataObjectAssociation</code> containing the above data.
+ *
* @pre content != null
* @pre content.getContentType() == Content.CONTENT_XML ||
* content.getContentType() == Contetn.CONTENT_BINARY
@@ -1010,34 +1001,36 @@ public abstract class SPSSFactory {
* @post return != null
*/
public abstract XMLDataObjectAssociation createXMLDataObjectAssociation(
- MetaInfo metaInfo,
- Content content);
+ MetaInfo metaInfo,
+ Content content);
/**
* Create a new <code>MetaInfo</code> object.
- *
- * @param mimeType The MIME type part of the meta information.
+ *
+ * @param mimeType The MIME type part of the meta information.
* @param description Descriptive meta information. May be <code>null</code>.
- * @param otherInfo XML meta information. May be <code>null</code>.
- * @param type Type information for XML signature creation. May be <code>null</code>.
+ * @param otherInfo XML meta information. May be <code>null</code>.
+ * @param type Type information for XML signature creation. May be
+ * <code>null</code>.
* @return The <code>MetaInfo</code> object containing the above data.
- *
+ *
* @pre mimeType != null && mimeType.length() > 0
- * @pre otherInfo != null implies
- * forall Node n in otherInfo | n.getNodeType() == Node.ELEMENT
+ * @pre otherInfo != null implies forall Node n in otherInfo | n.getNodeType()
+ * == Node.ELEMENT
*/
public abstract MetaInfo createMetaInfo(
- String mimeType,
- String description,
- NodeList otherInfo,
- String type);
+ String mimeType,
+ String description,
+ NodeList otherInfo,
+ String type);
/**
- * Create a <code>CanonicalizationTransform</code> type of <code>Transform</code>.
- *
+ * Create a <code>CanonicalizationTransform</code> type of
+ * <code>Transform</code>.
+ *
* @param algorithmURI The algorithm URI of the canonicalization.
* @return The created <code>CanonicalizationTransform</code> object.
- *
+ *
* @pre CanonicalizationTransform.CANONICAL_XML.equals(algorithmURI) ||
* CanonicalizationTransform.CANONICAL_XML_WITH_COMMENTS.equals(algorithmURI)
* @post return != null
@@ -1047,95 +1040,95 @@ public abstract class SPSSFactory {
/**
* Create an <code>ExclusiveCanonicalizationTransform</code> type of
* <code>Transform</code>.
- *
- * @param algorithmURI The algorithm URI of the exclusive canonicalization.
- * @param inclusiveNamespacePrefixes The prefixes of the namespaces to
- * treat according to canonical XML.
+ *
+ * @param algorithmURI The algorithm URI of the exclusive
+ * canonicalization.
+ * @param inclusiveNamespacePrefixes The prefixes of the namespaces to treat
+ * according to canonical XML.
* @return The new <code>ExclusiveCanonicalizationTransform</code>
- *
- * @pre ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML.equals(algorithmURI) ||
+ *
+ * @pre ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML.equals(algorithmURI)
+ * ||
* ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS.equals(algorithmURI)
* @pre inclusiveNamespacePrefixes != null
- * @pre forall Object o in inclusiveNamespacePrefixes | o instanceof String
+ * @pre forall Object o in inclusiveNamespacePrefixes | o instanceof String
* @post return != null
*/
public abstract Transform createExclusiveCanonicalizationTransform(
- String algorithmURI,
- List inclusiveNamespacePrefixes);
+ String algorithmURI,
+ List inclusiveNamespacePrefixes);
/**
* Create a <code>Base64Transform</code> type of <code>Transform</code>.
- *
+ *
* @return A <code>Transform</code> denoting a Base64 decoding.
- *
+ *
* @post return != null
*/
public abstract Transform createBase64Transform();
/**
- * Create a <code>EnvelopedSignatureTransform</code> type of
+ * Create a <code>EnvelopedSignatureTransform</code> type of
* <code>Transform</code>.
- *
+ *
* @return A <code>Transform</code> denoting an enveloped signature.
- *
+ *
* @post return != null
*/
public abstract Transform createEnvelopedSignatureTransform();
/**
* Create an <code>XSLTTransform</code> type of <code>Transform</code>.
- *
- * @param styleSheet The XSLT stylesheet contained in the
- * <code>Transform</code>.
+ *
+ * @param styleSheet The XSLT stylesheet contained in the
+ * <code>Transform</code>.
* @return A <code>Transform</code> containing the XSLT stylesheet.
- *
+ *
* @post return != null
*/
public abstract Transform createXSLTTransform(Element styleSheet);
/**
* Create an <code>XPathTransform</code> type of <code>Transform</code>.
- *
- * @param xPathExpression The XPath expression to use in the created
- * <code>Transform</code>.
- * @param namespaceDeclarations The namespace prefix to URI mapping to
- * apply on evaluation of the XPath expression.
+ *
+ * @param xPathExpression The XPath expression to use in the created
+ * <code>Transform</code>.
+ * @param namespaceDeclarations The namespace prefix to URI mapping to apply on
+ * evaluation of the XPath expression.
* @return The <code>XPathTransform</code> containing the above data.
- *
+ *
* @pre xPathExpression != null
* @pre namespaceDeclarations != null
* @post return != null
*/
public abstract Transform createXPathTransform(
- String xPathExpression,
- Map namespaceDeclarations);
+ String xPathExpression,
+ Map namespaceDeclarations);
/**
- * Create a new <code>XPathFilter2Transform</code> type of
- * <code>Transform</code>.
- *
+ * Create a new <code>XPathFilter2Transform</code> type of
+ * <code>Transform</code>.
+ *
* @param xPathFilters The filters contained in the newly created
- * <code>XPathFilter2Transform</code>.
- * @return The <code>XPathFilter2Transform</code> containing the given
- * filters.
- *
- * @pre xPathFilters != null &&
- * forall Object o in xPathFilters |
- * o instanceof at.gv.egovernment.moa.spss.api.common.XPathFilter
+ * <code>XPathFilter2Transform</code>.
+ * @return The <code>XPathFilter2Transform</code> containing the given filters.
+ *
+ * @pre xPathFilters != null && forall Object o in xPathFilters | o instanceof
+ * at.gv.egovernment.moa.spss.api.common.XPathFilter
* @post return != null
*/
public abstract Transform createXPathFilter2Transform(List xPathFilters);
/**
* Create a new <code>XPathFilter</code> object.
- *
- * @param filterType The type of filter.
- * @param xPathExpression The XPath expression contained in this filter.
- * @param namespaceDeclarations The namespace prefix to URI mapping to apply
- * on evaluation of the XPath expression.
+ *
+ * @param filterType The type of filter.
+ * @param xPathExpression The XPath expression contained in this filter.
+ * @param namespaceDeclarations The namespace prefix to URI mapping to apply on
+ * evaluation of the XPath expression.
* @return The <code>XPathFilter</code> containing the above data.
- *
- * @pre XPathFilter.SUBTRACT_TYPE.equals(filterType) ||
+ *
+ * @pre XPathFilter.SUBTRACT_TYPE.equals(filterType) ||
* XPathFilter.INTERSECT_TYPE.equals(filterType) ||
* XPathFilter.UNION_TYPE.equals(filterType)
* @pre xPathExpression != null
@@ -1143,73 +1136,76 @@ public abstract class SPSSFactory {
* @post return != null
*/
public abstract XPathFilter createXPathFilter(
- String filterType,
- String xPathExpression,
- Map namespaceDeclarations);
+ String filterType,
+ String xPathExpression,
+ Map namespaceDeclarations);
/**
* Create a new <code>CheckResult</code> object.
- *
+ *
* @param code The check code.
* @param info Verbose information about the check. May be <code>null</code>.
* @return The <code>CheckResult</code> containing the above data.
- *
+ *
* @pre code >= 0
* @post return != null
*/
public abstract CheckResult createCheckResult(int code, NodeList info);
-
-
/**
* Create a new <code>SignerInfo</code> object.
- *
- * @param signerCertificate The signer certificate in binary form.
- * @param qualifiedCertificate <code>true</code>, if the signer certificate is
- * a qualified certificate, otherwise <code>false</code>.
- * @param qcSourceTSL <code>true</code>, if the QC information comes from the TSL,
- * otherwise <code>false</code>.
- * @param publicAuthority <code>true</code>, if the signer certificate is a
- * public authority certificate, otherwise <code>false</code>.
- * @param publicAuthorityID The identification of the public authority
- * (if <code>publicAuthority</code> is <code>true</code>). May be
- * <code>null</code>.
- * @param sscd <code>true</code>, if the TSL check verifies the
- * signature based on a SSDC, otherwise <code>false</code>.
- * @param sscdSourceTSL <code>true</code>, if the SSCD information comes from the TSL,
- * otherwise <code>false</code>.
- * @param issuerCountryCode contains the signer certificate issuer country code.
- * @param tslInfos contains information from Trust-Status List for the signer certificate
+ *
+ * @param signerCertificate The signer certificate in binary form.
+ * @param qualifiedCertificate <code>true</code>, if the signer certificate is a
+ * qualified certificate, otherwise
+ * <code>false</code>.
+ * @param qcSourceTSL <code>true</code>, if the QC information comes
+ * from the TSL, otherwise <code>false</code>.
+ * @param publicAuthority <code>true</code>, if the signer certificate is a
+ * public authority certificate, otherwise
+ * <code>false</code>.
+ * @param publicAuthorityID The identification of the public authority (if
+ * <code>publicAuthority</code> is
+ * <code>true</code>). May be <code>null</code>.
+ * @param sscd <code>true</code>, if the TSL check verifies the
+ * signature based on a SSDC, otherwise
+ * <code>false</code>.
+ * @param sscdSourceTSL <code>true</code>, if the SSCD information comes
+ * from the TSL, otherwise <code>false</code>.
+ * @param issuerCountryCode contains the signer certificate issuer country
+ * code.
+ * @param tslInfos contains information from Trust-Status List for
+ * the signer certificate
* @return The <code>SignerInfo</code> containing the above data.
- *
+ *
* @pre signerCertSubjectName != null
* @pre signerCertIssuerSerial != null
* @pre signerCertificate != null
*/
public abstract SignerInfo createSignerInfo(
- X509Certificate signerCertificate,
- boolean qualifiedCertificate,
- boolean qcSourceTSL,
- boolean publicAuthority,
- String publicAuthorityID,
- boolean sscd,
- boolean sscdSourceTSL,
- String issuerCountryCode,
- Date signingTime,
- TslInfos tslInfos);
-
+ X509Certificate signerCertificate,
+ boolean qualifiedCertificate,
+ boolean qcSourceTSL,
+ boolean publicAuthority,
+ String publicAuthorityID,
+ boolean sscd,
+ boolean sscdSourceTSL,
+ String issuerCountryCode,
+ Date signingTime,
+ TslInfos tslInfos);
+
/**
* Create a new <code>X509IssuerSerial</code> object.
- *
- * @param issuerName The distinguished name of the issuer.
+ *
+ * @param issuerName The distinguished name of the issuer.
* @param issuerSerial The certificate serial number.
* @return The <code>X509IssuerSerial</code> containing the above data.
- *
+ *
* @pre issuerName != null
* @pre issuerSerial != null
*/
public abstract X509IssuerSerial createX509IssuerSerial(
- String issuerName,
- BigInteger issuerSerial);
+ String issuerName,
+ BigInteger issuerSerial);
}
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 05271fb..4019ad7 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
@@ -21,18 +21,16 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api;
import at.gv.egovernment.moa.spss.MOAException;
-
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.SignatureCreationServiceImpl;
/**
* Interface providing functions for signature creation.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -40,42 +38,40 @@ public abstract class SignatureCreationService {
/** The default implementation class. */
private static final String DEFAULT_IMPLEMENTATION =
- "at.gv.egovernment.moa.spss.server.invoke.SignatureCreationServiceImpl";
-
- /** The single instance of this class. */
+ "at.gv.egovernment.moa.spss.server.invoke.SignatureCreationServiceImpl";
+
+ /** The single instance of this class. */
private static SignatureCreationService instance = null;
/**
* Get an instance of the <code>SignatureCreationService</code>.
- *
+ *
* @return A concrete instance of the <code>SignatureCreationService</code>.
*/
public static synchronized SignatureCreationService getInstance() {
if (instance == null) {
try {
- /*
- DiscoverClass discover = new DiscoverClass();
- instance =
- (SignatureCreationService) discover.newInstance(
- SignatureCreationService.class,
- DEFAULT_IMPLEMENTATION);*/
+ /*
+ * DiscoverClass discover = new DiscoverClass(); instance =
+ * (SignatureCreationService) discover.newInstance(
+ * SignatureCreationService.class, DEFAULT_IMPLEMENTATION);
+ */
instance = new SignatureCreationServiceImpl();
- } catch (Exception e) {
- // this can not happen since we provide a valid default
+ } catch (final Exception e) {
+ // this can not happen since we provide a valid default
// implementation
}
}
return instance;
}
-
+
/**
* Create an XML signature.
- *
+ *
* @param request Information on how to create the signature.
- * @return A <code>CreateXMLSignatureResponse</code> containing the
- * signature.
+ * @return A <code>CreateXMLSignatureResponse</code> containing the signature.
* @throws MOAException Error in server side MOA module.
*/
public abstract CreateXMLSignatureResponse createXMLSignature(CreateXMLSignatureRequest request)
- throws MOAException;
+ throws MOAException;
}
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 2433e20..7d95d3a 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
@@ -21,7 +21,6 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api;
import at.gv.egovernment.moa.spss.MOAException;
@@ -33,7 +32,7 @@ import at.gv.egovernment.moa.spss.server.invoke.SignatureVerificationServiceImpl
/**
* Interface providing functions for verifying signatures.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -41,28 +40,27 @@ public abstract class SignatureVerificationService {
/** The default implementation class. */
private static final String DEFAULT_IMPLEMENTATION =
- "at.gv.egovernment.moa.spss.server.invoke.SignatureVerificationServiceImpl";
+ "at.gv.egovernment.moa.spss.server.invoke.SignatureVerificationServiceImpl";
/** The single instance of this class. */
private static SignatureVerificationService instance = null;
/**
* Get an instance of the <code>SignatureVerificationService</code>.
- *
- * @return A concrete instance of the
- * <code>SignatureVerificationService</code>.
+ *
+ * @return A concrete instance of the <code>SignatureVerificationService</code>.
*/
public static synchronized SignatureVerificationService getInstance() {
if (instance == null) {
try {
- /*DiscoverClass discover = new DiscoverClass();
- instance =
- (SignatureVerificationService) discover.newInstance(
- SignatureVerificationService.class,
- DEFAULT_IMPLEMENTATION);*/
- instance = new SignatureVerificationServiceImpl();
- } catch (Exception e) {
- // this can not happen since we provide a valid default
+ /*
+ * DiscoverClass discover = new DiscoverClass(); instance =
+ * (SignatureVerificationService) discover.newInstance(
+ * SignatureVerificationService.class, DEFAULT_IMPLEMENTATION);
+ */
+ instance = new SignatureVerificationServiceImpl();
+ } catch (final Exception e) {
+ // this can not happen since we provide a valid default
// implementation
}
}
@@ -71,23 +69,24 @@ public abstract class SignatureVerificationService {
/**
* Verify a CMS signature.
- *
+ *
* @param request Detailed information on the verification that should be
- * performed.
+ * performed.
* @return A <code>VerifyCMSSignatureResponse</code> object that contains
- * information about the performed verification.
+ * information about the performed verification.
* @throws MOAException Error in server side MOA module.
*/
public abstract VerifyCMSSignatureResponse verifyCMSSignature(VerifyCMSSignatureRequest request)
- throws MOAException;
+ throws MOAException;
+
/**
* Verfiy an XML Signature.
- *
- * @param request information on the verification that should be performed.
+ *
+ * @param request information on the verification that should be performed.
* @return A <code>VerifyXMLSignatureResponse</code> object that contains
- * information about the performed verification.
+ * information about the performed verification.
* @throws MOAException Error in server side MOA module.
*/
public abstract VerifyXMLSignatureResponse verifyXMLSignature(VerifyXMLSignatureRequest request)
- throws MOAException;
+ throws MOAException;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CMSSignatureResponse.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CMSSignatureResponse.java
index 10db676..958bd7d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CMSSignatureResponse.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CMSSignatureResponse.java
@@ -21,21 +21,19 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmssign;
-
/**
* Contains the signature if the signature creation was successful.
- *
+ *
* @version $Id$
*/
public interface CMSSignatureResponse
- extends CreateCMSSignatureResponseElement {
- /**
+ extends CreateCMSSignatureResponseElement {
+ /**
* Gets the CMS signature (Base64 encoded).
- *
+ *
* @return The CMS signature
*/
- public String getCMSSignature();
+ String getCMSSignature();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureRequest.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureRequest.java
index 9d5cd7a..c971451 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureRequest.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureRequest.java
@@ -21,29 +21,28 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmssign;
import java.util.List;
-
/**
* Object that encapsulates a request to create a CMS Signature.
- *
- *
+ *
+ *
* @version $Id$
*/
public interface CreateCMSSignatureRequest {
/**
* Gets the identifier for the keys to be used for the signature.
- *
+ *
* @return The identifier for the keys to be used.
*/
- public String getKeyIdentifier();
+ String getKeyIdentifier();
+
/**
- * Gets the information of the singleSignatureInfo elements.
- *
+ * Gets the information of the singleSignatureInfo elements.
+ *
* @return The information of singleSignatureInfo elements.
*/
- public List getSingleSignatureInfos();
+ List getSingleSignatureInfos();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponse.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponse.java
index 6062a11..e81a2bc 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponse.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponse.java
@@ -21,22 +21,21 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmssign;
import java.util.List;
/**
- * Object that encapsulates the response on to a
+ * Object that encapsulates the response on to a
* <code>CreateCMSSignatureRequest</code> to create an XML signature.
- *
+ *
* @version $Id$
*/
public interface CreateCMSSignatureResponse {
/**
* Gets the response elements.
- *
+ *
* @return The response elements.
*/
- public List getResponseElements();
+ List getResponseElements();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponseElement.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponseElement.java
index 8e4e611..a8d0ebd 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponseElement.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/CreateCMSSignatureResponseElement.java
@@ -21,31 +21,29 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmssign;
/**
- * Base class for <code>CMSSignature</code> and
- * <code>ErrorResponse</code> elements in a
- * <code>CreateXMLSignatureResponse</code>.
- *
+ * Base class for <code>CMSSignature</code> and <code>ErrorResponse</code>
+ * elements in a <code>CreateXMLSignatureResponse</code>.
+ *
* @version $Id$
*/
public interface CreateCMSSignatureResponseElement {
/**
* Indicates that this object contains a <code>CMSSignature</code>.
*/
- public static final int CMS_SIGNATURE = 0;
+ int CMS_SIGNATURE = 0;
/**
* Indicates that this objet contains an <code>ErrorResponse</code>.
*/
- public static final int ERROR_RESPONSE = 1;
-
+ int ERROR_RESPONSE = 1;
+
/**
* Gets the type of response object.
- *
- * @return The type of response object, either
- * <code>CMS_SIGNATURE</code> or <code>ERROR_RESPONSE</code>.
+ *
+ * @return The type of response object, either <code>CMS_SIGNATURE</code> or
+ * <code>ERROR_RESPONSE</code>.
*/
- public int getResponseType();
+ int getResponseType();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/DataObjectInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/DataObjectInfo.java
index b9f3630..4f97e5a 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/DataObjectInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/DataObjectInfo.java
@@ -21,38 +21,37 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmssign;
import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject;
/**
* Encapsulates information required to create a single signature.
- *
+ *
* @version $Id$
*/
public interface DataObjectInfo {
/**
* Indicates that a detached signature will be created.
*/
- public static final String STRUCTURE_DETACHED = "detached";
+ String STRUCTURE_DETACHED = "detached";
/**
* Indicates that an enveloping signature will be created.
*/
- public static final String STRUCTURE_ENVELOPING = "enveloping";
+ String STRUCTURE_ENVELOPING = "enveloping";
/**
* Gets the structure of the signature.
- *
+ *
* @return The structure of the signature.
*/
- public String getStructure();
+ String getStructure();
/**
* Gets information related to a single data object.
- *
+ *
* @return Information related to a single data object.
*/
- public CMSDataObject getDataObject();
-
+ CMSDataObject getDataObject();
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/SingleSignatureInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/SingleSignatureInfo.java
index 1f87a50..2bff558 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/SingleSignatureInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmssign/SingleSignatureInfo.java
@@ -21,14 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmssign;
-
-
/**
* Encapsulates data to create a single signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,16 +33,24 @@ package at.gv.egovernment.moa.spss.api.cmssign;
public interface SingleSignatureInfo {
/**
* Gets the dataObjectInfo information.
- *
+ *
* @return The dataObjectInfo information.
*/
- public DataObjectInfo getDataObjectInfo();
-
+ DataObjectInfo getDataObjectInfo();
+
/**
* Check whether a Security Layer conform signature manifest will be created.
- *
- * @return <code>true</code>, if a Security Layer conform signature manifest
- * will be created, <code>false</code> otherwise.
+ *
+ * @return <code>true</code>, if a Security Layer conform signature manifest
+ * will be created, <code>false</code> otherwise.
+ */
+ boolean isSecurityLayerConform();
+
+ /**
+ * Check whether a PAdES conform CAdES signature will be created
+ *
+ * @return <code>true</code>, if a PAdES conform CAdES signature will be
+ * created, <code>false</code> otherwise.
*/
- public boolean isSecurityLayerConform();
+ boolean isPAdESConform();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java
index 4c2c1cc..f240da8 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContent.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmsverify;
/**
* Base class for objects containing CMS content.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -35,18 +34,18 @@ public interface CMSContent {
/**
* Indicates that this object contains a reference to the CMS content.
*/
- public static final int REFERENCE_CONTENT = 0;
+ int REFERENCE_CONTENT = 0;
/**
* Indicates that this object contains the CMS content explicitly.
*/
- public static final int EXPLICIT_CONTENT = 1;
-
+ int EXPLICIT_CONTENT = 1;
+
/**
* Gets the type of the contained content.
- *
+ *
* @return The type of content, either <code>REFERENCE_CONTENT</code> or
- * <code>EXPLICIT_CONTENT</code>.
+ * <code>EXPLICIT_CONTENT</code>.
*/
- public int getContentType();
-
+ int getContentType();
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java
index 7fc6029..1c6506c 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentExcplicit.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmsverify;
import java.io.InputStream;
/**
* Encapsulates binary CMS content.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,8 +35,8 @@ import java.io.InputStream;
public interface CMSContentExcplicit extends CMSContent {
/**
* Gets the content as a stream.
- *
+ *
* @return A stream containing the binary content.
*/
- public InputStream getBinaryContent();
+ InputStream getBinaryContent();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java
index ade197d..c7366ff 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSContentReference.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmsverify;
/**
* Encapsulates CMS content that is referenced by an URI.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -34,8 +33,8 @@ package at.gv.egovernment.moa.spss.api.cmsverify;
public interface CMSContentReference extends CMSContent {
/**
* Gets the reference URI from wher the content can be retrieved.
- *
+ *
* @return The reference URI.
*/
- public String getReference();
+ String getReference();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java
index f9a6846..ffd31e1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.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.cmsverify;
import java.math.BigDecimal;
@@ -30,7 +29,7 @@ import at.gv.egovernment.moa.spss.api.common.MetaInfo;
/**
* A data object used for verification of CMS signatures.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -38,20 +37,20 @@ import at.gv.egovernment.moa.spss.api.common.MetaInfo;
public interface CMSDataObject {
/**
* Gets the meta information of the content.
- *
+ *
* @return An object containig the meta information.
*/
- public MetaInfo getMetaInfo();
+ MetaInfo getMetaInfo();
+
/**
* Gets the actual content of the data object.
- *
+ *
* @return The actual content.
*/
- public CMSContent getContent();
-
-
- public BigDecimal getExcludeByteRangeFrom();
-
- public BigDecimal getExcludeByteRangeTo();
-
- }
+ CMSContent getContent();
+
+ BigDecimal getExcludeByteRangeFrom();
+
+ BigDecimal getExcludeByteRangeTo();
+
+}
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 6294fb1..5ce51cf 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
@@ -21,7 +21,6 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmsverify;
import java.io.InputStream;
@@ -29,7 +28,7 @@ import java.util.Date;
/**
* Object that encapsulates a request to verify a CMS signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -38,42 +37,48 @@ public interface VerifyCMSSignatureRequest {
/**
* Indicates, that signature checks for all signatories must be returned.
*/
- public static int[] ALL_SIGNATORIES = new int[] { -1 };
+ int[] ALL_SIGNATORIES = new int[] { -1 };
+
/**
* Gets the positions of signatories whose signature must be verified.
- *
+ *
* @return The positions of signatories.
*/
- public int[] getSignatories();
+ int[] getSignatories();
+
/**
- * Gets the date and time for which the signature verification has to
- * be performed.
- *
- * @return Date and time for which the signature verification has
- * to be performed.
+ * Gets the date and time for which the signature verification has to be
+ * performed.
+ *
+ * @return Date and time for which the signature verification has to be
+ * performed.
*/
- public Date getDateTime();
+ Date getDateTime();
+
/**
* Gets the binary CMS signature.
- *
- * @return An <code>InputStream</code> from which the binary CMS signature
- * can be read.
+ *
+ * @return An <code>InputStream</code> from which the binary CMS signature can
+ * be read.
*/
- public InputStream getCMSSignature();
- /**
+ InputStream getCMSSignature();
+
+ /**
* Gets the data object necessary for the verification.
- *
+ *
* @return The data object necessary for verification.
*/
- public CMSDataObject getDataObject();
+ CMSDataObject getDataObject();
+
/**
* Gets the profile ID of trusted certificates to be used for signature
* verification.
- *
+ *
* @return The profile ID of trusted certificates.
*/
- public String getTrustProfileId();
-
- public boolean isPDF();
- public boolean isExtended();
+ String getTrustProfileId();
+
+ boolean isPDF();
+
+ boolean isExtended();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java
index 33924cb..9f58c43 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponse.java
@@ -21,16 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.cmsverify;
import java.util.List;
-
/**
- * Object that encapsulates the response on a request to verify a CMS
- * signature.
- *
+ * Object that encapsulates the response on a request to verify a CMS signature.
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -38,8 +35,8 @@ import java.util.List;
public interface VerifyCMSSignatureResponse {
/**
* Gets the response elements.
- *
- * @return The response elements.
+ *
+ * @return The response elements.
*/
- public List getResponseElements();
+ List getResponseElements();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java
index 6b08471..35bdf6e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/VerifyCMSSignatureResponseElement.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.cmsverify;
import java.util.List;
@@ -32,7 +31,7 @@ import at.gv.egovernment.moa.spss.api.common.SignerInfo;
/**
* Contains detailed information about the verification of a signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -40,31 +39,39 @@ import at.gv.egovernment.moa.spss.api.common.SignerInfo;
public interface VerifyCMSSignatureResponseElement {
/**
* Gets a SignerInfo element according to CMS.
- *
+ *
* @return The SignerInfo element according to CMS.
*/
- public SignerInfo getSignerInfo();
+ SignerInfo getSignerInfo();
+
/**
* Gets the result of the signature verification.
- *
+ *
* @return The result of the signature verification.
*/
- public CheckResult getSignatureCheck();
+ CheckResult getSignatureCheck();
+
/**
* Gets the result of the certificate verification.
- *
+ *
* @return The result of the certificate verification.
*/
- public CheckResult getCertificateCheck();
-
+ CheckResult getCertificateCheck();
+
/**
* Gets AdES Form results
- *
+ *
* This might be null!
- *
+ *
* @return The result of the AdES Form validation
*/
- public List getAdESFormResults();
-
- public ExtendedCertificateCheckResult getExtendedCertificateCheck();
+ List getAdESFormResults();
+
+ ExtendedCertificateCheckResult getExtendedCertificateCheck();
+
+ String getSignatureAlgorithm();
+
+ Boolean getCoversFullDocument();
+
+ int[] getByteRangeOfSignature();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java
index 6050d5b..e1c650f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Base64Transform.java
@@ -21,17 +21,16 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
/**
* A <code>Transform</code> performing a Base64 decoding.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface Base64Transform extends Transform {
/** Algorithm URI of the Base64 <code>Transform</code> type. */
- public static final String BASE64_DECODING =
- "http://www.w3.org/2000/09/xmldsig#base64";
+ String BASE64_DECODING =
+ "http://www.w3.org/2000/09/xmldsig#base64";
}
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 05977c5..680061d 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
@@ -21,21 +21,20 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import at.gv.egovernment.moaspss.util.Constants;
/**
* A canonicalization type of <code>Transform</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface CanonicalizationTransform extends Transform {
/** Algorithm URI of canonical XML. */
- public static final String CANONICAL_XML = Constants.C14N_URI;
+ String CANONICAL_XML = Constants.C14N_URI;
/** Algorithm URI of canonical XML with comments. */
- public static final String CANONICAL_XML_WITH_COMMENTS =
- Constants.C14N_WITH_COMMENTS_URI;
+ String CANONICAL_XML_WITH_COMMENTS =
+ Constants.C14N_WITH_COMMENTS_URI;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java
index 5c94981..4a9ff27 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/CheckResult.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import org.w3c.dom.NodeList;
/**
* Object encapsulating the result of a signature verification.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,14 +35,15 @@ import org.w3c.dom.NodeList;
public interface CheckResult {
/**
* Gets the result code.
- *
+ *
* @return The result code.
*/
- public int getCode();
+ int getCode();
+
/**
* Gets descriptive information.
- *
+ *
* @return Descriptive information.
*/
- public NodeList getInfo();
+ NodeList getInfo();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java
index efde1eb..d9adb68 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Content.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
/**
* Encapsulates content data.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @author Gregor Karlinger
@@ -35,37 +34,38 @@ package at.gv.egovernment.moa.spss.api.common;
public interface Content {
/**
- * Indicates that this object contains a URI reference to some content.
+ * Indicates that this object contains a URI reference to some content.
*/
- public static final int REFERENCE_CONTENT = 0;
+ int REFERENCE_CONTENT = 0;
/**
* Indicates that this object contains binary content.
*/
- public static final int BINARY_CONTENT = 1;
+ int BINARY_CONTENT = 1;
/**
* Indicates that this object contains XML content.
*/
- public static final int XML_CONTENT = 2;
-
+ int XML_CONTENT = 2;
+
/**
* Indicates that this object contains a location reference content.
*/
- public static final int LOCREF_CONTENT = 3;
+ int LOCREF_CONTENT = 3;
/**
* Gets the type of content contained in this object.
- *
- * @return The type of content, one of <code>BINARY_CONTENT</code>, <code>XML_CONTENT</code>, <code>
+ *
+ * @return The type of content, one of <code>BINARY_CONTENT</code>,
+ * <code>XML_CONTENT</code>, <code>
* REFERENCE_CONTENT</code> or <code>LOCREF_CONTENT</code>.
*/
- public int getContentType();
+ int getContentType();
/**
* Gets the reference to the content data (a URI).
- *
+ *
* @return The reference to the content data.
*/
- public String getReference();
+ String getReference();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java
index 77ec9dd..a30c5f8 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentBinary.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import java.io.InputStream;
/**
* Encapsulates binary content.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,10 +35,10 @@ import java.io.InputStream;
public interface ContentBinary extends Content {
/**
* Get the binary content.
- *
- * @return An <code>InputStream</code> from which the binary content can
- * be read.
+ *
+ * @return An <code>InputStream</code> from which the binary content can be
+ * read.
*/
- public InputStream getBinaryContent();
-
+ InputStream getBinaryContent();
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java
index d1ef096..59c96cb 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java
@@ -21,21 +21,20 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
/**
* Encapsulates location reference content.
- *
+ *
* @author Gregor Karlinger
* @version $Id$
*/
-public interface ContentLocRef extends Content
-{
+public interface ContentLocRef extends Content {
/**
- * Gets the location reference URI pointing to the actual remote location of the content.
- *
+ * Gets the location reference URI pointing to the actual remote location of the
+ * content.
+ *
* @return the location reference URI.
*/
- public String getLocationReferenceURI();
+ String getLocationReferenceURI();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java
index 8c4a658..5650939 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentReference.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
/**
* Content containing a reference to content data.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java
index d41f6a6..1f294b1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ContentXML.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import org.w3c.dom.NodeList;
/**
* Encapsulates arbitrary XML content.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,8 +35,8 @@ import org.w3c.dom.NodeList;
public interface ContentXML extends Content {
/**
* Gets the XML content stored in this object.
- *
+ *
* @return The XML content.
*/
- public NodeList getXMLContent();
+ NodeList getXMLContent();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java
index b446c5f..9d29d9b 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ElementSelector.java
@@ -21,32 +21,32 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import java.util.Map;
/**
- * A class containing data for selecting single elements using an XPath
+ * A class containing data for selecting single elements using an XPath
* expression.
- *
+ *
* Derived classes are used to point to the <code>CreateSignatureLocation</code>
* and the <code>VerifySignatureLocation</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface ElementSelector {
/**
* Gets the XPath expression pointing to a single element.
- *
+ *
* @return The XPath expression to select the signature parent element.
*/
- public String getXPathExpression();
+ String getXPathExpression();
+
/**
* Gets the namespace prefix to URI mapping to use when evaluating the XPath.
- *
+ *
* @return The namespace prefix to URI mapping.
*/
- public Map getNamespaceDeclarations();
+ Map getNamespaceDeclarations();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java
index 8e6de87..816576a 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/EnvelopedSignatureTransform.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
/**
* An enveloped signature type of <code>Transform</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -34,6 +33,6 @@ public interface EnvelopedSignatureTransform extends Transform {
/**
* Algorithm URI of the enveloped signature type of <code>Transform</code>.
*/
- public static final String ENVELOPED_SIGNATURE =
- "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
+ String ENVELOPED_SIGNATURE =
+ "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
}
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 557ff21..18e452c 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
@@ -21,7 +21,6 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import java.util.List;
@@ -30,22 +29,22 @@ import at.gv.egovernment.moaspss.util.Constants;
/**
* An exclusive canonicalization type of <code>Transform</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface ExclusiveCanonicalizationTransform extends Transform {
/** Algorithm URI of exclusive canonical XML. */
- public static final String EXCLUSIVE_CANONICAL_XML = Constants.EXC_C14N_URI;
+ String EXCLUSIVE_CANONICAL_XML = Constants.EXC_C14N_URI;
/** Algorithm URI of exclusive canonical XML with comments. */
- public static final String EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS =
- Constants.EXC_C14N_WITH_COMMENTS_URI;
+ String EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS =
+ Constants.EXC_C14N_WITH_COMMENTS_URI;
/**
* Sets the namespace prefixes that are handled in the same manner as in
* canonical XML.
- *
+ *
* @return The inclusive namespace prefixes.
*/
- public List getInclusiveNamespacePrefixes();
+ List getInclusiveNamespacePrefixes();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExtendedCertificateCheckResult.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExtendedCertificateCheckResult.java
index 494b216..afc783e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExtendedCertificateCheckResult.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/ExtendedCertificateCheckResult.java
@@ -1,33 +1,31 @@
package at.gv.egovernment.moa.spss.api.common;
-import org.w3c.dom.NodeList;
-
public interface ExtendedCertificateCheckResult {
- /**
- * Gets the result code.
- *
- * @return The result code.
- */
- public int getMajorCode();
+ /**
+ * Gets the result code.
+ *
+ * @return The result code.
+ */
+ int getMajorCode();
- /**
- * Gets descriptive information.
- *
- * @return Descriptive information.
- */
- public String getMajorInfo();
+ /**
+ * Gets descriptive information.
+ *
+ * @return Descriptive information.
+ */
+ String getMajorInfo();
- /**
- * Gets the result code.
- *
- * @return The result code.
- */
- public int getMinorCode();
+ /**
+ * Gets the result code.
+ *
+ * @return The result code.
+ */
+ int getMinorCode();
- /**
- * Gets descriptive information.
- *
- * @return Descriptive information.
- */
- public String getMinorInfo();
+ /**
+ * Gets descriptive information.
+ *
+ * @return Descriptive information.
+ */
+ String getMinorInfo();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java
index 8c940cd..b9c75bb 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/InputData.java
@@ -21,45 +21,42 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
/**
- * Interface specifying accessors for two attributes needed for returning
- * <code>HashInputData</code> and <code>ReferenceInputData</code> information
- * as part of <code>VerifyXMLSignatureResponse</code>.
- *
+ * Interface specifying accessors for two attributes needed for returning
+ * <code>HashInputData</code> and <code>ReferenceInputData</code> information as
+ * part of <code>VerifyXMLSignatureResponse</code>.
+ *
* @author Gregor Karlinger
- *
+ *
* @version $Id$
*/
-public interface InputData extends Content
-{
+public interface InputData extends Content {
/**
- * Possible value returned by {@link #getPartOf}.
+ * Possible value returned by {@link #getPartOf}.
*/
- public static String CONTAINER_SIGNEDINFO_ = "SignedInfo";
+ String CONTAINER_SIGNEDINFO_ = "SignedInfo";
/**
- * Possible value returned by {@link #getPartOf}.
+ * Possible value returned by {@link #getPartOf}.
*/
- public static String CONTAINER_XMLDSIGMANIFEST_ = "XMLDSIGManifest";
-
+ String CONTAINER_XMLDSIGMANIFEST_ = "XMLDSIGManifest";
+
/**
* Value returned by {link getReferringReferenceNumber}, signalling that the
* attribute is not used.
*/
- public static int REFERER_NONE_ = -1;
-
+ int REFERER_NONE_ = -1;
+
/**
- * Returns a <code>String</code> signalling what kind of container the
- * XMLDSIG <code>Reference</code> this <code>InputData</code> belongs
- * to is part of.
- *
- * @return the kind of container.
+ * Returns a <code>String</code> signalling what kind of container the XMLDSIG
+ * <code>Reference</code> this <code>InputData</code> belongs to is part of.
+ *
+ * @return the kind of container.
*/
- public String getPartOf();
-
+ String getPartOf();
+
/**
* If this <code>InputData</code> belongs to an XMLDSIG <code>Reference</code>
* being part of either a XMLDSIGManifest or a SignatureManifest, this method
@@ -67,5 +64,14 @@ public interface InputData extends Content
* of the XMLDSIG <code>SignedInfo</code> referring to the XMLDSIGManifest or
* SignatureManifest respectively.
*/
- public int getReferringReferenceNumber();
+ int getReferringReferenceNumber();
+
+ /**
+ * Returns an identifier of the hash algorithm that is used to hash this
+ * {@link InputData}
+ *
+ * @return
+ */
+ String getHashAlgorithm();
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java
index 2413229..8c1b270 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/MetaInfo.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import org.w3c.dom.NodeList;
/**
* Object encapsulating descriptive meta information.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,26 +35,29 @@ import org.w3c.dom.NodeList;
public interface MetaInfo {
/**
* Gets the mime type of the associated object.
- *
+ *
* @return The mimetype of the associated object.
*/
- public String getMimeType();
+ String getMimeType();
+
/**
* Gets the descriptive information (URI).
- *
+ *
* @return URI referencing the descriptive information.
*/
- public String getDescription();
+ String getDescription();
+
/**
* Gets the elemental informations.
- *
+ *
* @return The elemental informations.
- */
- public NodeList getAnyElements();
+ */
+ NodeList getAnyElements();
+
/**
* Gets the XML signature creation type information of the associated object.
- *
+ *
* @return the XML signature creation type information of the associated object.
*/
- public String getType();
+ String getType();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java
index bb3dfdf..07b5f7f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java
@@ -21,16 +21,14 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import java.security.cert.X509Certificate;
import java.util.Date;
-
/**
* Contains information about the signer.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -38,65 +36,69 @@ import java.util.Date;
public interface SignerInfo {
/**
* Gets the signer certificate.
- *
+ *
* @return The signer certificate.
- */
- public X509Certificate getSignerCertificate();
+ */
+ X509Certificate getSignerCertificate();
+
/**
* Checks, whether the certificate contained in this object is qualified.
- *
+ *
* @return <code>true</code>, if the certificate is qualified, otherwise
- * <code>false</code>.
+ * <code>false</code>.
*/
- public boolean isQualifiedCertificate();
-
-
+ boolean isQualifiedCertificate();
+
/**
* Checks, whether the signature is based on a SSCD.
- *
+ *
* @return <code>true</code>, if the signature is based on a SSCD, otherwise
- * <code>false</code>.
+ * <code>false</code>.
*/
- public boolean isSSCD();
-
+ boolean isSSCD();
+
/**
- * Returns the source of the SSCD check (TSL or Certificate) *
+ * Returns the source of the SSCD check (TSL or Certificate) *
*/
- public String getSSCDSource();
+ String getSSCDSource();
/**
- * Returns the source of the QC check (TSL or Certificate) *
+ * Returns the source of the QC check (TSL or Certificate) *
*/
- public String getQCSource();
+ String getQCSource();
/**
* Returns the signer certificate issuer country code
+ *
* @return
*/
- public String getIssuerCountryCode();
+ String getIssuerCountryCode();
+
/**
- * Checks, whether the certificate contained in this object is a
- * public authority certificate.
- *
- * @return <code>true</code>, if the certificate is a public authority
- * certificate, otherwise <code>false</code>.
+ * Checks, whether the certificate contained in this object is a public
+ * authority certificate.
+ *
+ * @return <code>true</code>, if the certificate is a public authority
+ * certificate, otherwise <code>false</code>.
*/
- public boolean isPublicAuthority();
+ boolean isPublicAuthority();
+
/**
- * Gets the public authority ID, if the certificate contained in this
- * object is from a public authority.
- *
+ * Gets the public authority ID, if the certificate contained in this object is
+ * from a public authority.
+ *
* @return The public authority ID.
- */
- public String getPublicAuhtorityID();
+ */
+ String getPublicAuhtorityID();
+
+ Date getSigningTime();
- public Date getSigningTime();
-
/**
* Gets information from the Trust-Status List for this certificate
- *
- * @return {@link TslInfos} if the certificate is on the Trust-Status List, otherwise null
+ *
+ * @return {@link TslInfos} if the certificate is on the Trust-Status List,
+ * otherwise null
*/
- public TslInfos getTslInfos();
-
+ TslInfos getTslInfos();
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TSLConfiguration.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TSLConfiguration.java
index 642c28d..8d0a9fa 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TSLConfiguration.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TSLConfiguration.java
@@ -21,67 +21,64 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
-
-import iaik.xml.crypto.utils.URI;
-
import java.util.Date;
import java.util.List;
+import iaik.xml.crypto.utils.URI;
/**
* Contains TSL configuration information.
- *
+ *
* @author kstranacher
*/
public interface TSLConfiguration {
-
- /** Default URL of EU TSL */
- public String DEFAULT_EU_TSL_URL = "https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl-mp.xml";
-
- /** Default period (1day=86400000 msec) for update schedule */
- public String DEFAULT_UPDATE_SCHEDULE_PERIOD = "86400000";
-
- /** Default start time (2:00 AM) for update schedule */
- public String DEFAULT_UPDATE_SCHEDULE_STARTTIME = "02:00:00";
-
- public String DEFAULT_WORKING_DIR = "tslworking";
-
+
+ /** Default URL of EU TSL */
+ String DEFAULT_EU_TSL_URL = "https://ec.europa.eu/tools/lotl/eu-lotl.xml";
+
+ /** Default period (1day=86400000 msec) for update schedule */
+ String DEFAULT_UPDATE_SCHEDULE_PERIOD = "86400000";
+
+ /** Default start time (2:00 AM) for update schedule */
+ String DEFAULT_UPDATE_SCHEDULE_STARTTIME = "02:00:00";
+
+ String DEFAULT_WORKING_DIR = "tslworking";
+
/**
* Gets the EU TSL URL.
- *
+ *
* @return The EU TSL URL.
- */
- public String getEuTSLUrl();
+ */
+ String getEuTSLUrl();
/**
- *
+ *
* @return
*/
- public Date getUpdateScheduleStartTime();
-
+ Date getUpdateScheduleStartTime();
+
/**
- *
+ *
* @return
*/
- public long getUpdateSchedulePeriod();
-
+ long getUpdateSchedulePeriod();
+
/**
- *
+ *
* @return
*/
- public String getWorkingDirectory();
-
+ String getWorkingDirectory();
+
/**
- *
+ *
* @return
*/
- public URI getWorkingDirectoryAsURI();
-
- public List<java.net.URI> getQualifierForQC();
+ URI getWorkingDirectoryAsURI();
+
+ List<java.net.URI> getQualifierForQC();
- public List<java.net.URI> getQualifierForSSCD();
+ List<java.net.URI> getQualifierForSSCD();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java
index ad050b4..5b924c3 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/Transform.java
@@ -21,20 +21,19 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
/**
* Base class for XMLDsig <code>Transform</code> elements.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface Transform {
/**
* Gets the algorithm URI of this <code>Transform</code>.
- *
+ *
* @return The algorithm URI of this <code>Transform</code>.
*/
- public String getAlgorithmURI();
+ String getAlgorithmURI();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TslInfos.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TslInfos.java
index 2a04f96..34d28c4 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TslInfos.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/TslInfos.java
@@ -3,47 +3,49 @@ package at.gv.egovernment.moa.spss.api.common;
import java.util.List;
/**
- * Trust-Status list information for a specific certificate
- * All informations and identifiers are according to the Trust-Status List specification
- *
+ * Trust-Status list information for a specific certificate All informations and
+ * identifiers are according to the Trust-Status List specification
+ *
* @author tlenz
*
*/
public interface TslInfos {
- /**
- * Gets the issuer country of the TSL
- *
- * @return
- */
- public String getTslIssuerCountry();
-
- /**
- * Gets the Service-Type Status of the TSP, which issues the analyzed certificate
- *
- * @return
- */
- public String getServiceTypeStatus();
-
- /**
- * Gets the Service-Type Identifier of the TSP, which issues the analyzed certificate
- *
- * @return
- */
- public String getServiceTypeIdentifier();
-
- /**
- * Gets additional qualifiers for the analyzed certificate
- *
- * @return
- */
- public List<String> getQualifiers();
-
- /**
- * Gets additional service information for the analyzed certificate
- *
- * @return
- */
- public List<String> getAdditionalServiceInformation();
-
+ /**
+ * Gets the issuer country of the TSL
+ *
+ * @return
+ */
+ String getTslIssuerCountry();
+
+ /**
+ * Gets the Service-Type Status of the TSP, which issues the analyzed
+ * certificate
+ *
+ * @return
+ */
+ String getServiceTypeStatus();
+
+ /**
+ * Gets the Service-Type Identifier of the TSP, which issues the analyzed
+ * certificate
+ *
+ * @return
+ */
+ String getServiceTypeIdentifier();
+
+ /**
+ * Gets additional qualifiers for the analyzed certificate
+ *
+ * @return
+ */
+ List<String> getQualifiers();
+
+ /**
+ * Gets additional service information for the analyzed certificate
+ *
+ * @return
+ */
+ List<String> getAdditionalServiceInformation();
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java
index 39ec807..007fbe8 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/X509IssuerSerial.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import java.math.BigInteger;
/**
* Contains an X.509 issuer distinguished name/serial number pair.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,14 +35,15 @@ import java.math.BigInteger;
public interface X509IssuerSerial {
/**
* Gets the issuer distinguished name.
- *
+ *
* @return The issuer distinguished name.
*/
- public String getX509IssuerName();
+ String getX509IssuerName();
+
/**
* Gets the issuer serial number.
- *
+ *
* @return The issuer serial number.
*/
- public BigInteger getX509SerialNumber();
+ BigInteger getX509SerialNumber();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java
index fe2a795..7b3f830 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XMLDataObjectAssociation.java
@@ -21,14 +21,12 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
-
/**
* Object encapsulating arbitrary content and optional descriptive meta
* information.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,14 +34,15 @@ package at.gv.egovernment.moa.spss.api.common;
public interface XMLDataObjectAssociation {
/**
* Gets descriptive meta information.
- *
+ *
* @return The descriptive meta information.
*/
- public MetaInfo getMetaInfo();
+ MetaInfo getMetaInfo();
+
/**
* Gets the actual content.
- *
+ *
* @return The content of this association.
*/
- public Content getContent();
+ Content getContent();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java
index 06a49a2..f3a12dc 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter.java
@@ -21,42 +21,43 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import java.util.Map;
/**
* An XPath expression set operation.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface XPathFilter {
/** Subtract this filter's node set from the resulting node set. */
- public static final String SUBTRACT_TYPE = "subtract";
+ String SUBTRACT_TYPE = "subtract";
/** Intersect this filter's node set with the resulting node set. */
- public static final String INTERSECT_TYPE = "intersect";
+ String INTERSECT_TYPE = "intersect";
/** Compute the union of this filter's node set and the resulting node set. */
- public static final String UNION_TYPE = "union";
-
+ String UNION_TYPE = "union";
+
/**
* Gets the type of this <code>XPathFilter</code>.
- *
+ *
* @return The type of this <code>XPathFilter</code>.
*/
- public String getFilterType();
+ String getFilterType();
+
/**
* Gets the XPath expression for selecting the nodes.
- *
+ *
* @return The XPath expression for selecting the nodes.
*/
- public String getXPathExpression();
+ String getXPathExpression();
+
/**
- * Gets The namespace prefix to URI mapping used during evaluation of the
- * XPath expression.
- *
+ * Gets The namespace prefix to URI mapping used during evaluation of the XPath
+ * expression.
+ *
* @return The namespace prefix to URI mapping.
*/
- public Map getNamespaceDeclarations();
+ Map getNamespaceDeclarations();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java
index 6f05710..b5899a4 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathFilter2Transform.java
@@ -21,29 +21,28 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import java.util.List;
/**
* An XPath type of <code>Transform</code> containing multiple filters for
- * performing set operations on XPath selections.
- *
+ * performing set operations on XPath selections.
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface XPathFilter2Transform extends Transform {
/** Algorithm URI for the XPath Filter2 <code>Transform</code>. */
- public static final String XPATH_FILTER2 =
- "http://www.w3.org/2002/06/xmldsig-filter2";
+ String XPATH_FILTER2 =
+ "http://www.w3.org/2002/06/xmldsig-filter2";
/**
- * Gets the <code>XPathFilter</code>s contained in this
+ * Gets the <code>XPathFilter</code>s contained in this
* <code>XPathFilter2Transform</code>.
- *
+ *
* @return The <code>XPathFilter</code>s.
*/
- public List getFilters();
+ List getFilters();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java
index 99eda2a..41227c5 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XPathTransform.java
@@ -21,34 +21,34 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import java.util.Map;
/**
* A <code>Transform</code> performing an XPath selection.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface XPathTransform extends Transform {
/** Algorithm URI of the XPath <code>Transform</code>. */
- public static final String XPATH =
- "http://www.w3.org/TR/1999/REC-xpath-19991116";
+ String XPATH =
+ "http://www.w3.org/TR/1999/REC-xpath-19991116";
/**
* Gets the XPath expression used for selection.
- *
+ *
* @return The XPath expression used for selection.
*/
- public String getXPathExpression();
+ String getXPathExpression();
+
/**
- * Gets The namespace prefix to URI mapping used during evaluation of the
- * XPath expression.
- *
+ * Gets The namespace prefix to URI mapping used during evaluation of the XPath
+ * expression.
+ *
* @return The namespace prefix to URI mapping.
*/
- public Map getNamespaceDeclarations();
-
+ Map getNamespaceDeclarations();
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java
index 8cb6c8e..bdfd2eb 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/XSLTTransform.java
@@ -21,27 +21,26 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.common;
import org.w3c.dom.Element;
/**
* A <code>Transform</code> containing an XSLT stylesheet.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface XSLTTransform extends Transform {
/** Algorithm URI for the XSLT type of <code>Transform</code>. */
- public static final String XSLT =
- "http://www.w3.org/TR/1999/REC-xslt-19991116";
+ String XSLT =
+ "http://www.w3.org/TR/1999/REC-xslt-19991116";
/**
* Gets the XSLT stylesheet element used for the transformation.
- *
+ *
* @return The XSLT stylesheet element used for the transformation.
*/
- public Element getStylesheet();
+ Element getStylesheet();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/AdESFormResultsImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/AdESFormResultsImpl.java
index c186c54..46710c0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/AdESFormResultsImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/AdESFormResultsImpl.java
@@ -4,39 +4,39 @@ import at.gv.egovernment.moa.spss.api.xmlverify.AdESFormResults;
public class AdESFormResultsImpl implements AdESFormResults {
- private Integer code;
- private String info;
- private String name;
-
- public synchronized void setCode(Integer code) {
- this.code = code;
- }
-
- public synchronized void setInfo(String info) {
- this.info = info;
- }
-
- public synchronized void setName(String name) {
- this.name = name;
- }
-
- @Override
- public Integer getCode() {
- return this.code;
- }
-
- @Override
- public String getInfo() {
- return this.info;
- }
-
- @Override
- public String getName() {
- return this.name;
- }
-
- @Override
- public String toString() {
- return "AdESFormResultsImpl [code=" + code + ", info=" + info + ", name=" + name + "]";
- }
+ private Integer code;
+ private String info;
+ private String name;
+
+ public synchronized void setCode(Integer code) {
+ this.code = code;
+ }
+
+ public synchronized void setInfo(String info) {
+ this.info = info;
+ }
+
+ public synchronized void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public Integer getCode() {
+ return this.code;
+ }
+
+ @Override
+ public String getInfo() {
+ return this.info;
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String toString() {
+ return "AdESFormResultsImpl [code=" + code + ", info=" + info + ", name=" + name + "]";
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java
index f708bab..b08c74c 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/Base64TransformImpl.java
@@ -21,20 +21,19 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.common.Base64Transform;
/**
* Default implementation of <code>Base64Transform</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class Base64TransformImpl
- extends TransformImpl
- implements Base64Transform {
+ extends TransformImpl
+ implements Base64Transform {
/**
* Create a new <code>Base64TransformImpl</code> object.
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java
index 8dede90..f6c1574 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentExplicitImpl.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;
@@ -30,33 +29,35 @@ import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentExcplicit;
/**
* Default implementation of <code>CMSContentExplicit</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CMSContentExplicitImpl implements CMSContentExcplicit {
-
+
/** The binary content, as a stream. */
private InputStream binaryContent;
/**
* Sets the binary content as a stream.
- *
+ *
* @param content The binary content as a stream.
*/
public void setBinaryContent(InputStream content) {
this.binaryContent = content;
}
+ @Override
public InputStream getBinaryContent() {
return binaryContent;
}
/**
* Gets the type of content.
- *
+ *
* @return EXPLICIT_CONTENT
*/
+ @Override
public int getContentType() {
return EXPLICIT_CONTENT;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java
index fb90c5f..a14ea90 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSContentReferenceImpl.java
@@ -21,40 +21,41 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentReference;
/**
* Default implementation of <code>CMSContentReference</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CMSContentReferenceImpl implements CMSContentReference {
-
+
/** The reference pointing to the actual data. */
private String reference;
/**
* Sets the reference URI.
- *
+ *
* @param referenceURI The URI pointing to the content data.
*/
public void setReference(String referenceURI) {
this.reference = referenceURI;
}
+ @Override
public String getReference() {
return reference;
}
/**
* Gets the content type.
- *
+ *
* @return REFERENCE_CONTENT
*/
+ @Override
public int getContentType() {
return REFERENCE_CONTENT;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java
index 20a9b56..e9b4fea 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.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.math.BigDecimal;
@@ -32,60 +31,64 @@ import at.gv.egovernment.moa.spss.api.common.MetaInfo;
/**
* Default implementation of <code>CMLSDataObject</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CMSDataObjectImpl implements CMSDataObject {
-
+
/** The <code>MetaInfo</code> associated with the CMS data object. */
private MetaInfo metaInfo;
/** The <code>CMSContent</code> contained in this data object. */
private CMSContent cmsContent;
-
+
private BigDecimal excludeByteRangeFrom;
private BigDecimal excludeByteRangeTo;
/**
* Sets the meta information associated with the CMS data object.
- *
+ *
* @param metaInfo The meta information.
*/
public void setMetaInfo(MetaInfo metaInfo) {
this.metaInfo = metaInfo;
}
+ @Override
public MetaInfo getMetaInfo() {
return metaInfo;
}
/**
* Sets the data of this <code>CMSDataObject</code>.
- *
+ *
* @param cmsContent The actual data of this <code>CMSDataObject</code>.
*/
public void setContent(CMSContent cmsContent) {
this.cmsContent = cmsContent;
}
+ @Override
public CMSContent getContent() {
return cmsContent;
}
public void setExcludeByteRangeFrom(BigDecimal excludeByteRangeFrom) {
- this.excludeByteRangeFrom = excludeByteRangeFrom;
+ this.excludeByteRangeFrom = excludeByteRangeFrom;
}
-
+
+ @Override
public BigDecimal getExcludeByteRangeFrom() {
- return excludeByteRangeFrom;
+ return excludeByteRangeFrom;
}
-
+
public void setExcludeByteRangeTo(BigDecimal excludeByteRangeTo) {
- this.excludeByteRangeTo = excludeByteRangeTo;
+ this.excludeByteRangeTo = excludeByteRangeTo;
}
-
+
+ @Override
public BigDecimal getExcludeByteRangeTo() {
- return excludeByteRangeTo;
- }
-
+ return excludeByteRangeTo;
+ }
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSSignatureResponseImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSSignatureResponseImpl.java
index b512dd0..77ef137 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSSignatureResponseImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSSignatureResponseImpl.java
@@ -21,42 +21,41 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
-import org.w3c.dom.Element;
-
import at.gv.egovernment.moa.spss.api.cmssign.CMSSignatureResponse;
/**
* Default implementation of <code>CMSSignatureResponse</code>.
- *
+ *
* @version $Id$
*/
public class CMSSignatureResponseImpl
- implements CMSSignatureResponse {
+ implements CMSSignatureResponse {
/** The base64 value of the CMS signature. */
private String cmsSignature;
- /**
+ /**
* Sets the CMS signature.
- *
+ *
* @param cmsSignature The Base64 encoded value CMS signature.
*/
public void setCMSSignature(String cmsSignature) {
this.cmsSignature = cmsSignature;
}
+ @Override
public String getCMSSignature() {
return cmsSignature;
}
/**
* Gets the type of <code>CreateCMSSignatureResponseElement</code>.
- *
+ *
* @return CMS_SIGNATURE
*/
+ @Override
public int getResponseType() {
return CMS_SIGNATURE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java
index f8efe26..e931c4b 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CanonicalizationTransformImpl.java
@@ -21,26 +21,25 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform;
/**
* Default implementation of <code>CanonicalizationTransform</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CanonicalizationTransformImpl
- extends TransformImpl
- implements CanonicalizationTransform {
-
+ extends TransformImpl
+ implements CanonicalizationTransform {
+
/**
* Create a new <code>CanonicalizationTransformImpl</code> object.
- *
- * @param algorithmURI Algorithm URI of the canonicalization
- * <code>Transform</code> type.
+ *
+ * @param algorithmURI Algorithm URI of the canonicalization
+ * <code>Transform</code> type.
*/
public CanonicalizationTransformImpl(String algorithmURI) {
setAlgorithmURI(algorithmURI);
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java
index 5bb6e60..a57c4e6 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CheckResultImpl.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 org.w3c.dom.NodeList;
@@ -30,20 +29,20 @@ import at.gv.egovernment.moa.spss.api.common.CheckResult;
/**
* Default implementation of <code>CheckResult</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CheckResultImpl implements CheckResult {
/** The result code. */
private int code;
-
- /** Additional information. */
+
+ /** Additional information. */
private NodeList info;
/**
* Sets a result code.
- *
+ *
* @param code The result code.
*/
public void setCode(int code) {
@@ -53,13 +52,14 @@ public class CheckResultImpl implements CheckResult {
/**
* @see at.gv.egovernment.moa.spss.api.common.CheckResult#getCode()
*/
+ @Override
public int getCode() {
return code;
}
/**
* Sets a descriptive information.
- *
+ *
* @param info The descriptive information.
*/
public void setInfo(NodeList info) {
@@ -69,6 +69,7 @@ public class CheckResultImpl implements CheckResult {
/**
* @see at.gv.egovernment.moa.spss.api.common.CheckResult#getInfo()
*/
+ @Override
public NodeList getInfo() {
return info;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java
index 7fe1cf9..aa49375 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentBinaryImpl.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;
@@ -30,33 +29,35 @@ import at.gv.egovernment.moa.spss.api.common.ContentBinary;
/**
* Default implementation of <code>ContentBinary</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class ContentBinaryImpl extends ContentImpl implements ContentBinary {
- /** The binary content as a stream. */
+ /** The binary content as a stream. */
private InputStream binaryContent;
/**
* Sets the binary content as a stream.
- *
+ *
* @param binaryContent The binary content as a stream.
*/
public void setBinaryContent(InputStream binaryContent) {
this.binaryContent = binaryContent;
}
+ @Override
public InputStream getBinaryContent() {
return binaryContent;
}
/**
* Gets the type of content.
- *
+ *
* @return BINARY_CONTENT
*/
+ @Override
public int getContentType() {
return BINARY_CONTENT;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java
index d061747..4c73795 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentImpl.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.common.Content;
/**
* Default base class for <code>Content</code> implementations.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -38,13 +37,14 @@ public abstract class ContentImpl implements Content {
/**
* Sets the reference pointing to the content data.
- *
+ *
* @param referenceURI The URI of the content data.
*/
public void setReference(String referenceURI) {
this.reference = referenceURI;
}
+ @Override
public String getReference() {
return reference;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java
index aa01a93..7d763c1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java
@@ -21,47 +21,47 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.common.ContentLocRef;
/**
* Default implementation of <code>ContentLocRef</code>.
- *
+ *
* @author Gregor Karlinger
* @version $Id$
*/
-public class ContentLocRefImpl extends ContentImpl implements ContentLocRef
-{
+public class ContentLocRefImpl extends ContentImpl implements ContentLocRef {
/**
- * The location reference URI pointing to the actual remote location of the content.
+ * The location reference URI pointing to the actual remote location of the
+ * content.
*/
private String locationReferenceURI_;
-
- /**
+
+ /**
* @see at.gv.egovernment.moa.spss.api.common.ContentLocRef#getLocationReferenceURI()
*/
- public String getLocationReferenceURI()
- {
+ @Override
+ public String getLocationReferenceURI() {
return locationReferenceURI_;
}
-
+
/**
- * Sets the location reference URI pointing to the actual remote location of the content.
- *
+ * Sets the location reference URI pointing to the actual remote location of the
+ * content.
+ *
* @param locationReferenceURI the location reference URI.
*/
- public void setLocationReferenceURI(String locationReferenceURI)
- {
+ public void setLocationReferenceURI(String locationReferenceURI) {
locationReferenceURI_ = locationReferenceURI;
}
-
+
/**
* Gets the type of content.
- *
+ *
* @return LOCREF_CONTENT.
*/
+ @Override
public int getContentType() {
return LOCREF_CONTENT;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java
index ab5c3b4..de0e1cf 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentReferenceImpl.java
@@ -21,26 +21,26 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.common.ContentReference;
/**
* Default implementation of <code>ContentReference</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ContentReferenceImpl
- extends ContentImpl
- implements ContentReference {
+ extends ContentImpl
+ implements ContentReference {
/**
* Gets the type of content.
- *
+ *
* @return REFERENCE_CONTENT
*/
+ @Override
public int getContentType() {
return REFERENCE_CONTENT;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java
index dcc1935..496550f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ContentXMLImpl.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 org.w3c.dom.NodeList;
@@ -30,7 +29,7 @@ import at.gv.egovernment.moa.spss.api.common.ContentXML;
/**
* Default implementation of <code>ContentXML</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -38,25 +37,27 @@ public class ContentXMLImpl extends ContentImpl implements ContentXML {
/** The nodes making up the XML content. */
private NodeList xmlContent;
-
+
/**
* Sets the nodes making up the XML content.
- *
+ *
* @param xmlContent The XML content.
*/
public void setXMLContent(NodeList xmlContent) {
this.xmlContent = xmlContent;
}
+ @Override
public NodeList getXMLContent() {
return xmlContent;
}
/**
* Gets the type of content.
- *
+ *
* @return XML_CONTENT
*/
+ @Override
public int getContentType() {
return XML_CONTENT;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureRequestImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureRequestImpl.java
index e8408bc..dcdb77f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureRequestImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureRequestImpl.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;
@@ -32,44 +31,46 @@ import at.gv.egovernment.moa.spss.api.cmssign.CreateCMSSignatureRequest;
/**
* Default implementation of <code>CreateCMSSignatureRequest</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CreateCMSSignatureRequestImpl
- implements CreateCMSSignatureRequest {
+ implements CreateCMSSignatureRequest {
- /** The identifier for selecting the private keys for creating the signature.*/
+ /** The identifier for selecting the private keys for creating the signature. */
private String keyIdentifier;
/** Information for creating a single signature. */
private List singleSignatureInfos = new ArrayList();
/**
- * Sets the identifier for selecting the private keys for creating the
+ * Sets the identifier for selecting the private keys for creating the
* signature.
- *
+ *
* @param keyIdentifier The identifier for selecting the private keys.
*/
public void setKeyIdentifier(String keyIdentifier) {
this.keyIdentifier = keyIdentifier;
}
+ @Override
public String getKeyIdentifier() {
return keyIdentifier;
}
/**
* Sets the information for creating single signatures.
- *
+ *
* @param singleSignaureInfos The information for creating single signatures.
*/
public void setSingleSignatureInfos(List singleSignaureInfos) {
this.singleSignatureInfos =
- singleSignaureInfos != null
- ? Collections.unmodifiableList(new ArrayList(singleSignaureInfos))
- : null;
+ singleSignaureInfos != null
+ ? Collections.unmodifiableList(new ArrayList(singleSignaureInfos))
+ : null;
}
+ @Override
public List getSingleSignatureInfos() {
return singleSignatureInfos;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureResponseImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureResponseImpl.java
index d596058..ae64195 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureResponseImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateCMSSignatureResponseImpl.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;
@@ -32,27 +31,28 @@ import at.gv.egovernment.moa.spss.api.cmssign.CreateCMSSignatureResponse;
/**
* Default implementation of <code>CreateCMSSignatureResponse</code>.
- *
+ *
* @version $Id$
*/
public class CreateCMSSignatureResponseImpl
- implements CreateCMSSignatureResponse {
+ implements CreateCMSSignatureResponse {
/** The elements contained in the response. */
private List responseElements = new ArrayList();
/**
* Sets the elements contained in the response.
- *
+ *
* @param responseElements The response elements.
*/
public void setResponseElements(List responseElements) {
this.responseElements =
- responseElements != null
- ? Collections.unmodifiableList(new ArrayList(responseElements))
- : null;
+ responseElements != null
+ ? Collections.unmodifiableList(new ArrayList(responseElements))
+ : null;
}
+ @Override
public List getResponseElements() {
return responseElements;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java
index 9fe8eaf..3d5279f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileExplicitImpl.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;
@@ -32,14 +31,14 @@ import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileE
import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation;
/**
- * Default implementation of
+ * Default implementation of
* <codeCreateSignatureEnvironmentProfileExplicit</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class CreateSignatureEnvironmentProfileExplicitImpl
- implements CreateSignatureEnvironmentProfileExplicit {
+ implements CreateSignatureEnvironmentProfileExplicit {
/** The insertion location of the signature to be created. */
private CreateSignatureLocation createSignatureLocation;
@@ -49,40 +48,42 @@ public class CreateSignatureEnvironmentProfileExplicitImpl
/**
* Sets the insertion location of the signature to be created.
- *
- * @param createSignatureLocation The insertion location of the signature to
- * be created.
+ *
+ * @param createSignatureLocation The insertion location of the signature to be
+ * created.
*/
public void setCreateSignatureLocation(CreateSignatureLocation createSignatureLocation) {
this.createSignatureLocation = createSignatureLocation;
}
+ @Override
public CreateSignatureLocation getCreateSignatureLocation() {
return createSignatureLocation;
}
/**
- * Sets the supplemental information for evaluating the signature
- * environment.
- *
+ * Sets the supplemental information for evaluating the signature environment.
+ *
* @param supplements The supplemental information.
*/
public void setSupplements(List supplements) {
this.supplements =
- supplements != null
- ? Collections.unmodifiableList(new ArrayList(supplements))
- : null;
+ supplements != null
+ ? Collections.unmodifiableList(new ArrayList(supplements))
+ : null;
}
+ @Override
public List getSupplements() {
return supplements;
}
/**
* Gets the type of profile.
- *
+ *
* @return EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE
*/
+ @Override
public int getCreateSignatureEnvironmentProfileType() {
return EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java
index 5edbf4f..4818f9e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureEnvironmentProfileIDImpl.java
@@ -21,41 +21,42 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileID;
/**
* Default implementation of <code>CreateSignatureEnvironmentProfileID</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class CreateSignatureEnvironmentProfileIDImpl
- implements CreateSignatureEnvironmentProfileID {
+ implements CreateSignatureEnvironmentProfileID {
/** The profile ID. */
private String createSignatureEnvironmentProfileID;
/**
* Sets the profile ID.
- *
+ *
* @param profileID The profile ID.
*/
public void setCreateSignatureEnvironmentProfileID(String profileID) {
this.createSignatureEnvironmentProfileID = profileID;
}
+ @Override
public String getCreateSignatureEnvironmentProfileID() {
return createSignatureEnvironmentProfileID;
}
/**
* Gets the type of profile.
- *
+ *
* @return ID_CREATESIGNATUREENVIRONMENTPROFILE
*/
+ @Override
public int getCreateSignatureEnvironmentProfileType() {
return ID_CREATESIGNATUREENVIRONMENTPROFILE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java
index 7111633..7a97cd5 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureInfoImpl.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 at.gv.egovernment.moa.spss.api.common.Content;
@@ -30,29 +29,30 @@ import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureInfo;
/**
* Default implementation of <code>CreateSignatureInfo</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CreateSignatureInfoImpl implements CreateSignatureInfo {
-
- /** The signature environment that will contain the newly created
- * signature. */
+
+ /**
+ * The signature environment that will contain the newly created signature.
+ */
private Content createSignatureEnvironment;
/** Additional information about the signature environment. */
private CreateSignatureEnvironmentProfile createSignatureEnvironmentProfile;
/**
- * Sets the signature environment that will contain the newly created
- * signature.
- *
+ * Sets the signature environment that will contain the newly created signature.
+ *
* @param createSignatureEnvironment The signature environment.
*/
public void setCreateSignatureEnvironment(Content createSignatureEnvironment) {
this.createSignatureEnvironment = createSignatureEnvironment;
}
+ @Override
public Content getCreateSignatureEnvironment() {
return createSignatureEnvironment;
}
@@ -60,13 +60,14 @@ public class CreateSignatureInfoImpl implements CreateSignatureInfo {
/**
* Sets the signature environment profile containing additional information
* about the signature environment.
- *
+ *
* @param profile The signature environment profile.
*/
public void setCreateSignatureEnvironmentProfile(CreateSignatureEnvironmentProfile profile) {
this.createSignatureEnvironmentProfile = profile;
}
+ @Override
public CreateSignatureEnvironmentProfile getCreateSignatureEnvironmentProfile() {
return createSignatureEnvironmentProfile;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java
index 6f3101f..121dcf0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateSignatureLocationImpl.java
@@ -21,33 +21,33 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureLocation;
/**
* Default implementation of <code>CreateSignatureLocation</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CreateSignatureLocationImpl
- extends ElementSelectorImpl
- implements CreateSignatureLocation {
+ extends ElementSelectorImpl
+ implements CreateSignatureLocation {
/** The index of the newly created signature. */
private int index;
/**
* Sets the index of the newly created signature.
- *
+ *
* @param index The index of the newly created signature.
*/
public void setIndex(int index) {
this.index = index;
}
+ @Override
public int getIndex() {
return index;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java
index d53f103..24e4abc 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoImpl.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;
@@ -33,7 +32,7 @@ import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfo;
/**
* Default implementation of <code>CreateTransformsInfo</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -45,29 +44,31 @@ public class CreateTransformsInfoImpl implements CreateTransformsInfo {
/**
* Sets the transforms.
- *
+ *
* @param transforms The transforms.
*/
public void setTransforms(List transforms) {
this.transforms =
- transforms != null
- ? Collections.unmodifiableList(new ArrayList(transforms))
- : null;
+ transforms != null
+ ? Collections.unmodifiableList(new ArrayList(transforms))
+ : null;
}
+ @Override
public List getTransforms() {
return transforms;
}
/**
* Sets the meta information about the data resulting from the transforms.
- *
+ *
* @param finalDataMetaInfo The meta information.
*/
public void setFinalDataMetaInfo(MetaInfo finalDataMetaInfo) {
this.finalDataMetaInfo = finalDataMetaInfo;
}
+ @Override
public MetaInfo getFinalDataMetaInfo() {
return finalDataMetaInfo;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java
index b6b9d52..3ffc8e3 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileExplicitImpl.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;
@@ -33,12 +32,12 @@ import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplici
/**
* Default implementation of <code>CreateTransformsInfoProfileExplicit</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CreateTransformsInfoProfileExplicitImpl
- implements CreateTransformsInfoProfileExplicit {
+ implements CreateTransformsInfoProfileExplicit {
/** Transformation information. */
private CreateTransformsInfo transformsInfo;
@@ -47,38 +46,41 @@ public class CreateTransformsInfoProfileExplicitImpl
/**
* Sets the transformation information.
- *
+ *
* @param transformsInfo The transformation information.
*/
public void setCreateTransformsInfo(CreateTransformsInfo transformsInfo) {
this.transformsInfo = transformsInfo;
}
+ @Override
public CreateTransformsInfo getCreateTransformsInfo() {
return transformsInfo;
}
/**
* Sets the additional data for the transformations.
- *
+ *
* @param supplements The additional data.
*/
public void setSupplements(List supplements) {
this.supplements =
- supplements != null
- ? Collections.unmodifiableList(new ArrayList(supplements))
- : null;
+ supplements != null
+ ? Collections.unmodifiableList(new ArrayList(supplements))
+ : null;
}
+ @Override
public List getSupplements() {
return supplements;
}
/**
* Gets the type of profile.
- *
+ *
* @return EXPLICIT_CREATETRANSFORMSINFOPROFILE
*/
+ @Override
public int getCreateTransformsInfoProfileType() {
return EXPLICIT_CREATETRANSFORMSINFOPROFILE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java
index 55d0ca6..e86c7de 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateTransformsInfoProfileIDImpl.java
@@ -21,40 +21,42 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileID;
/**
* Default implementation of <code>CreateTransformsInfoProfileID</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CreateTransformsInfoProfileIDImpl
- implements CreateTransformsInfoProfileID {
+ implements CreateTransformsInfoProfileID {
/** The profile ID. */
private String createTransformsID;
/**
* Sets the profile ID.
+ *
* @param createTransformsID The profile ID.
*/
public void setCreateTransformsInfoProfileID(String createTransformsID) {
this.createTransformsID = createTransformsID;
}
+ @Override
public String getCreateTransformsInfoProfileID() {
return createTransformsID;
}
/**
* Gets the type of profile.
- *
+ *
* @return ID_CREATETRANSFORMSINFOPROFILE
*/
+ @Override
public int getCreateTransformsInfoProfileType() {
return ID_CREATETRANSFORMSINFOPROFILE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java
index aaffaa7..30779a3 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureRequestImpl.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;
@@ -32,44 +31,46 @@ import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest;
/**
* Default implementation of <code>CreateXMLSignatureRequest</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CreateXMLSignatureRequestImpl
- implements CreateXMLSignatureRequest {
+ implements CreateXMLSignatureRequest {
- /** The identifier for selecting the private keys for creating the signature.*/
+ /** The identifier for selecting the private keys for creating the signature. */
private String keyIdentifier;
/** Information for creating a single signature. */
private List singleSignatureInfos = new ArrayList();
/**
- * Sets the identifier for selecting the private keys for creating the
+ * Sets the identifier for selecting the private keys for creating the
* signature.
- *
+ *
* @param keyIdentifier The identifier for selecting the private keys.
*/
public void setKeyIdentifier(String keyIdentifier) {
this.keyIdentifier = keyIdentifier;
}
+ @Override
public String getKeyIdentifier() {
return keyIdentifier;
}
/**
* Sets the information for creating single signatures.
- *
+ *
* @param singleSignaureInfos The information for creating single signatures.
*/
public void setSingleSignatureInfos(List singleSignaureInfos) {
this.singleSignatureInfos =
- singleSignaureInfos != null
- ? Collections.unmodifiableList(new ArrayList(singleSignaureInfos))
- : null;
+ singleSignaureInfos != null
+ ? Collections.unmodifiableList(new ArrayList(singleSignaureInfos))
+ : null;
}
+ @Override
public List getSingleSignatureInfos() {
return singleSignatureInfos;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java
index 7a8359f..80cd6dc 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CreateXMLSignatureResponseImpl.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;
@@ -32,28 +31,29 @@ import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse;
/**
* Default implementation of <code>CreateXMLSignatureResponse</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class CreateXMLSignatureResponseImpl
- implements CreateXMLSignatureResponse {
+ implements CreateXMLSignatureResponse {
/** The elements contained in the response. */
private List responseElements = new ArrayList();
/**
* Sets the elements contained in the response.
- *
+ *
* @param responseElements The response elements.
*/
public void setResponseElements(List responseElements) {
this.responseElements =
- responseElements != null
- ? Collections.unmodifiableList(new ArrayList(responseElements))
- : null;
+ responseElements != null
+ ? Collections.unmodifiableList(new ArrayList(responseElements))
+ : null;
}
+ @Override
public List getResponseElements() {
return responseElements;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoCMSImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoCMSImpl.java
index 702086b..f65816a 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoCMSImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoCMSImpl.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 at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo;
@@ -29,7 +28,7 @@ import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject;
/**
* Default implementation of <code>DataObjectInfo</code> for CMS.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -41,27 +40,28 @@ public class DataObjectInfoCMSImpl implements DataObjectInfo {
/**
* Sets the signature structure type.
- *
+ *
* @param structure The signature structure type.
*/
public void setStructure(String structure) {
this.stucture = structure;
}
+ @Override
public String getStructure() {
return stucture;
}
-
/**
* Sets the data object to be signed.
- *
+ *
* @param dataObject The data object to be signed.
*/
public void setDataObject(CMSDataObject dataObject) {
this.dataObject = dataObject;
}
+ @Override
public CMSDataObject getDataObject() {
return dataObject;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java
index 7a25a97..4099d89 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/DataObjectInfoImpl.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 at.gv.egovernment.moa.spss.api.common.Content;
@@ -30,15 +29,16 @@ import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo;
/**
* Default implementation of <code>DataObjectInfo</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class DataObjectInfoImpl implements DataObjectInfo {
/** The signature structure type. */
private String stucture;
- /** Whether a reference will be placed in the signature itself or in the
- * manifest */
+ /**
+ * Whether a reference will be placed in the signature itself or in the manifest
+ */
private boolean childOfManifest;
/** The data object to be signed. */
private Content dataObject;
@@ -47,13 +47,14 @@ public class DataObjectInfoImpl implements DataObjectInfo {
/**
* Sets the signature structure type.
- *
+ *
* @param structure The signature structure type.
*/
public void setStructure(String structure) {
this.stucture = structure;
}
+ @Override
public String getStructure() {
return stucture;
}
@@ -61,41 +62,44 @@ public class DataObjectInfoImpl implements DataObjectInfo {
/**
* Sets whether a reference will be placed in the signature itself or in the
* manifest.
- *
- * @param childOfManifest Whether to put the reference in the signature of
- * in the manifest.
+ *
+ * @param childOfManifest Whether to put the reference in the signature of in
+ * the manifest.
*/
public void setChildOfManifest(boolean childOfManifest) {
this.childOfManifest = childOfManifest;
}
+ @Override
public boolean isChildOfManifest() {
return childOfManifest;
}
/**
* Sets the data object to be signed.
- *
+ *
* @param dataObject The data object to be signed.
*/
public void setDataObject(Content dataObject) {
this.dataObject = dataObject;
}
+ @Override
public Content getDataObject() {
return dataObject;
}
/**
* Sets additional information for the transformations.
- *
+ *
* @param profile The profile containing additional information for the
- * transformations.
+ * transformations.
*/
public void setCreateTransformsInfoProfile(CreateTransformsInfoProfile profile) {
this.createTransformsInfoProfile = profile;
}
+ @Override
public CreateTransformsInfoProfile getCreateTransformsInfoProfile() {
return createTransformsInfoProfile;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java
index 7de0660..e505440 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ElementSelectorImpl.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.HashMap;
@@ -31,7 +30,7 @@ import at.gv.egovernment.moa.spss.api.common.ElementSelector;
/**
* Default implementation of <code>ElementSelector</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -43,27 +42,29 @@ public class ElementSelectorImpl implements ElementSelector {
/**
* Sets the XPath expression pointing to the element.
- *
+ *
* @param xPathExpression XPath expression pointing to the element.
*/
public void setXPathExpression(String xPathExpression) {
this.xPathExpression = xPathExpression;
}
+ @Override
public String getXPathExpression() {
return xPathExpression;
}
/**
* Sets namespace declarations to apply for evaluating the XPath.
- *
- * @param namespaceDeclarations The namespace declarations to apply for
- * evaluating the XPath.
+ *
+ * @param namespaceDeclarations The namespace declarations to apply for
+ * evaluating the XPath.
*/
public void setNamespaceDeclarations(Map namespaceDeclarations) {
this.namespaceDeclarations = namespaceDeclarations;
}
+ @Override
public Map getNamespaceDeclarations() {
return namespaceDeclarations;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java
index 121037f..40a579b 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/EnvelopedSignatureTransformImpl.java
@@ -21,20 +21,19 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform;
/**
* Default implementation of <code>EnvelopedSignatureTransform</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class EnvelopedSignatureTransformImpl
- extends TransformImpl
- implements EnvelopedSignatureTransform {
+ extends TransformImpl
+ implements EnvelopedSignatureTransform {
/**
* Create a <code>EnvelopedSignatureTransformImpl</code>.
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java
index a2a59a7..e55b69b 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ErrorResponseImpl.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse;
/**
* Default implementation of <code>ErrorResponse</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -40,35 +39,38 @@ public class ErrorResponseImpl implements ErrorResponse {
/**
* Sets the error code.
- *
+ *
* @param code The error code.
*/
public void setErrorCode(int code) {
this.code = code;
}
+ @Override
public int getErrorCode() {
return code;
}
/**
* Sets the verbose error information.
- *
+ *
* @param info The verbose error information.
*/
public void setInfo(String info) {
this.info = info;
}
+ @Override
public String getInfo() {
return info;
}
/**
* Gets the response type.
- *
- * @return ERROR_RESPONSE
+ *
+ * @return ERROR_RESPONSE
*/
+ @Override
public int getResponseType() {
return ERROR_RESPONSE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java
index eea09c0..fd0e276 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExclusiveCanonicalizationTransformImpl.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;
@@ -32,22 +31,22 @@ import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform;
/**
* Default implementation of <code>ExclusiveCanonicalizationTransform</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ExclusiveCanonicalizationTransformImpl
- extends TransformImpl
- implements ExclusiveCanonicalizationTransform {
+ extends TransformImpl
+ implements ExclusiveCanonicalizationTransform {
/** The namespaces to treat according to canonical XML. */
private List inclusiveNamespacePrefixes;
-
- /**
+
+ /**
* Create a <code>ExclusiveCanonicalizationTransformImpl</code> object.
- *
+ *
* @param algorithmURI The algorithm URI identifying the transformation
- * algorithm.
+ * algorithm.
*/
public ExclusiveCanonicalizationTransformImpl(String algorithmURI) {
setAlgorithmURI(algorithmURI);
@@ -55,16 +54,18 @@ public class ExclusiveCanonicalizationTransformImpl
/**
* Sets the namespaces to treat according to canonical XML.
- * @param inclusiveNamespacePrefixes The namespaces to treat according to
- * canonical XML.
+ *
+ * @param inclusiveNamespacePrefixes The namespaces to treat according to
+ * canonical XML.
*/
public void setInclusiveNamespacePrefixes(List inclusiveNamespacePrefixes) {
this.inclusiveNamespacePrefixes =
- inclusiveNamespacePrefixes != null
- ? Collections.unmodifiableList(new ArrayList(inclusiveNamespacePrefixes))
- : null;
+ inclusiveNamespacePrefixes != null
+ ? Collections.unmodifiableList(new ArrayList(inclusiveNamespacePrefixes))
+ : null;
}
+ @Override
public List getInclusiveNamespacePrefixes() {
return inclusiveNamespacePrefixes;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExtendedCertificateCheckResultImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExtendedCertificateCheckResultImpl.java
index f36760c..21db8e0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExtendedCertificateCheckResultImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ExtendedCertificateCheckResultImpl.java
@@ -3,42 +3,42 @@ package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.common.ExtendedCertificateCheckResult;
public class ExtendedCertificateCheckResultImpl implements ExtendedCertificateCheckResult {
- private int majorCode;
- private String majorInfo;
-
- private int minorCode;
- private String minorInfo;
-
- public ExtendedCertificateCheckResultImpl(int majorCode, String majorInfo) {
- this(majorCode, majorInfo, -1, "");
- }
-
- public ExtendedCertificateCheckResultImpl(int majorCode, String majorInfo,
- int minorCode, String minorInfo) {
- this.majorCode = majorCode;
- this.majorInfo = majorInfo;
- this.minorCode = minorCode;
- this.minorInfo = minorInfo;
- }
-
- @Override
- public int getMajorCode() {
- return this.majorCode;
- }
-
- @Override
- public String getMajorInfo() {
- return this.majorInfo;
- }
-
- @Override
- public int getMinorCode() {
- return this.minorCode;
- }
-
- @Override
- public String getMinorInfo() {
- return this.minorInfo;
- }
+ private final int majorCode;
+ private final String majorInfo;
+
+ private final int minorCode;
+ private final String minorInfo;
+
+ public ExtendedCertificateCheckResultImpl(int majorCode, String majorInfo) {
+ this(majorCode, majorInfo, -1, "");
+ }
+
+ public ExtendedCertificateCheckResultImpl(int majorCode, String majorInfo,
+ int minorCode, String minorInfo) {
+ this.majorCode = majorCode;
+ this.majorInfo = majorInfo;
+ this.minorCode = minorCode;
+ this.minorInfo = minorInfo;
+ }
+
+ @Override
+ public int getMajorCode() {
+ return this.majorCode;
+ }
+
+ @Override
+ public String getMajorInfo() {
+ return this.majorInfo;
+ }
+
+ @Override
+ public int getMinorCode() {
+ return this.minorCode;
+ }
+
+ @Override
+ public String getMinorInfo() {
+ return this.minorInfo;
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java
index 27f6f85..a806f16 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataBinaryImpl.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;
@@ -32,92 +31,104 @@ import at.gv.egovernment.moa.spss.api.common.ContentBinary;
import at.gv.egovernment.moa.spss.api.common.InputData;
/**
- * Content wrapper decorating a binary content with two additional attributes
+ * Content wrapper decorating a binary content with two additional attributes
* needed for returning <code>HashInputData</code> and <code>ReferenceInputData
* </code> information as part of <code>VerifyXMLSignatureResponse</code>.
- *
+ *
* @author Gregor Karlinger
- *
+ *
* @version $Id$
*/
-public class InputDataBinaryImpl implements ContentBinary, InputData
-{
+public class InputDataBinaryImpl implements ContentBinary, InputData {
/**
* The wrapped <code>Content</code>.
*/
protected ContentBinary wrapped_;
-
+
/**
- * This attribute signals what kind of container the XMLDSIG <code>Reference</code>
- * this <code>InputData</code> belongs to is part of.
+ * This attribute signals what kind of container the XMLDSIG
+ * <code>Reference</code> this <code>InputData</code> belongs to is part of.
*/
protected String partOf_;
-
+
/**
* If this <code>InputData</code> belongs to an XMLDSIG <code>Reference</code>
* being part of either a XMLDSIGManifest or a SignatureManifest, this attribute
- * (a positive int) signals the particular <code>Reference</code> of the XMLDSIG
+ * (a positive int) signals the particular <code>Reference</code> of the XMLDSIG
* <code>SignedInfo</code> referring to the XMLDSIGManifest or SignatureManifest
* respectively.
*/
protected int referringReferenceNumber_;
-
+
+ protected String hashAlg = null;
+
/**
* Creates a new instance.
- *
- * @param wrapped The wrapped <code>Content</code>. Must be of type {@link Content#BINARY_CONTENT}.
- *
- * @param partOf see {@link InputData}
- *
+ *
+ * @param wrapped The wrapped <code>Content</code>. Must be of
+ * type {@link Content#BINARY_CONTENT}.
+ *
+ * @param partOf see {@link InputData}
+ *
* @param referringReferenceNumber see {@link InputData}
+ *
+ * @param hashAlg see {@link InputData}
*/
- public InputDataBinaryImpl(Content wrapped, String partOf, int referringReferenceNumber) throws MOARuntimeException
- {
- if (wrapped.getContentType() != Content.BINARY_CONTENT) throw new MOARuntimeException("9901", null);
-
+ public InputDataBinaryImpl(Content wrapped, String partOf, int referringReferenceNumber, String hashAlg)
+ throws MOARuntimeException {
+ if (wrapped.getContentType() != Content.BINARY_CONTENT) {
+ throw new MOARuntimeException("9901", null);
+ }
+
wrapped_ = (ContentBinary) wrapped;
- partOf_ = partOf;
+ partOf_ = partOf;
referringReferenceNumber_ = referringReferenceNumber;
+ this.hashAlg = hashAlg;
}
-
- /**
+
+ /**
* @see at.gv.egovernment.moa.spss.api.common.Content#getContentType()
*/
- public int getContentType()
- {
+ @Override
+ public int getContentType() {
return wrapped_.getContentType();
}
/**
* @see at.gv.egovernment.moa.spss.api.common.Content#getReference()
*/
- public String getReference()
- {
+ @Override
+ public String getReference() {
return wrapped_.getReference();
}
/**
* @see at.gv.egovernment.moa.spss.api.common.ContentBinary#getBinaryContent()
*/
- public InputStream getBinaryContent()
- {
+ @Override
+ public InputStream getBinaryContent() {
return wrapped_.getBinaryContent();
}
/**
* @see at.gv.egovernment.moa.spss.api.common.InputData#getPartOf()
*/
- public String getPartOf()
- {
+ @Override
+ public String getPartOf() {
return partOf_;
}
/**
* @see at.gv.egovernment.moa.spss.api.common.InputData#getReferringReferenceNumber()
*/
- public int getReferringReferenceNumber()
- {
+ @Override
+ public int getReferringReferenceNumber() {
return referringReferenceNumber_;
}
+ @Override
+ public String getHashAlgorithm() {
+ return this.hashAlg;
+ }
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java
index 432e1a2..fd97bf8 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/InputDataXMLImpl.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 org.w3c.dom.NodeList;
@@ -32,92 +31,103 @@ import at.gv.egovernment.moa.spss.api.common.ContentXML;
import at.gv.egovernment.moa.spss.api.common.InputData;
/**
- * Content wrapper decorating an XML content with two additional attributes
+ * Content wrapper decorating an XML content with two additional attributes
* needed for returning <code>HashInputData</code> and <code>ReferenceInputData
* </code> information as part of <code>VerifyXMLSignatureResponse</code>.
- *
+ *
* @author Gregor Karlinger
- *
+ *
* @version $Id$
*/
-public class InputDataXMLImpl implements ContentXML, InputData
-{
+public class InputDataXMLImpl implements ContentXML, InputData {
/**
* The wrapped <code>ContentXML</code>.
*/
protected ContentXML wrapped_;
-
+
/**
- * This attribute signals what kind of container the XMLDSIG <code>Reference</code>
- * this <code>InputData</code> belongs to is part of.
+ * This attribute signals what kind of container the XMLDSIG
+ * <code>Reference</code> this <code>InputData</code> belongs to is part of.
*/
protected String partOf_;
-
+
/**
* If this <code>InputData</code> belongs to an XMLDSIG <code>Reference</code>
* being part of either a XMLDSIGManifest or a SignatureManifest, this attribute
- * (a positive int) signals the particular <code>Reference</code> of the XMLDSIG
+ * (a positive int) signals the particular <code>Reference</code> of the XMLDSIG
* <code>SignedInfo</code> referring to the XMLDSIGManifest or SignatureManifest
* respectively.
*/
protected int referringReferenceNumber_;
-
+
+ protected String hashAlg = null;
+
/**
* Creates a new instance.
- *
- * @param wrapped The wrapped <code>ContentBinary</code>. Must be of type {@link Content#XML_CONTENT}.
- *
- * @param partOf see {@link InputData}
- *
+ *
+ * @param wrapped The wrapped <code>ContentBinary</code>. Must
+ * be of type {@link Content#XML_CONTENT}.
+ *
+ * @param partOf see {@link InputData}
+ *
* @param referringReferenceNumber see {@link InputData}
+ *
+ * @param hashAlg see {@link InputData}
*/
- public InputDataXMLImpl(Content wrapped, String partOf, int referringReferenceNumber)
- {
- if (wrapped.getContentType() != Content.XML_CONTENT) throw new MOARuntimeException("9901", null);
+ public InputDataXMLImpl(Content wrapped, String partOf, int referringReferenceNumber, String hashAlg) {
+ if (wrapped.getContentType() != Content.XML_CONTENT) {
+ throw new MOARuntimeException("9901", null);
+ }
wrapped_ = (ContentXML) wrapped;
- partOf_ = partOf;
+ partOf_ = partOf;
referringReferenceNumber_ = referringReferenceNumber;
+ this.hashAlg = hashAlg;
}
-
- /**
+
+ /**
* @see at.gv.egovernment.moa.spss.api.common.Content#getContentType()
*/
- public int getContentType()
- {
+ @Override
+ public int getContentType() {
return wrapped_.getContentType();
}
/**
* @see at.gv.egovernment.moa.spss.api.common.Content#getReference()
*/
- public String getReference()
- {
+ @Override
+ public String getReference() {
return wrapped_.getReference();
}
/**
* @see at.gv.egovernment.moa.spss.api.common.ContentXML#getXMLContent()
*/
- public NodeList getXMLContent()
- {
+ @Override
+ public NodeList getXMLContent() {
return wrapped_.getXMLContent();
}
/**
* @see at.gv.egovernment.moa.spss.api.common.InputData#getPartOf()
*/
- public String getPartOf()
- {
+ @Override
+ public String getPartOf() {
return partOf_;
}
/**
* @see at.gv.egovernment.moa.spss.api.common.InputData#getReferringReferenceNumber()
*/
- public int getReferringReferenceNumber()
- {
+ @Override
+ public int getReferringReferenceNumber() {
return referringReferenceNumber_;
}
+ @Override
+ public String getHashAlgorithm() {
+ return this.hashAlg;
+ }
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java
index e5b7f40..752fec0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultImpl.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 at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResult;
@@ -29,7 +28,7 @@ import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResultInfo;
/**
* Default implementation of <code>ManifestRefsCheckResult</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -41,26 +40,28 @@ public class ManifestRefsCheckResultImpl implements ManifestRefsCheckResult {
/**
* Sets the check code.
- *
+ *
* @param code A numerical representation of the result of the manifest check.
*/
public void setCode(int code) {
this.code = code;
}
+ @Override
public int getCode() {
return code;
}
/**
* Sets a reference to the manifest.
- *
+ *
* @param info The reference to the manifest.
*/
public void setInfo(ManifestRefsCheckResultInfo info) {
this.info = info;
}
+ @Override
public ManifestRefsCheckResultInfo getInfo() {
return info;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java
index f0ef1c5..68405a1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ManifestRefsCheckResultInfoImpl.java
@@ -21,34 +21,37 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResultInfo;
/**
* Default implementation of <code>ManifestRefsCheckResultInfo</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class ManifestRefsCheckResultInfoImpl
- extends ReferencesCheckResultInfoImpl
- implements ManifestRefsCheckResultInfo {
+ extends ReferencesCheckResultInfoImpl
+ implements ManifestRefsCheckResultInfo {
- /** The position of the signature reference containing the reference to the
- * manifest being described by this object.*/
+ /**
+ * The position of the signature reference containing the reference to the
+ * manifest being described by this object.
+ */
private int referringSignatureReference;
/**
- * Sets the position of the signature reference containing the reference to
- * the manifest being described by this object.
+ * Sets the position of the signature reference containing the reference to the
+ * manifest being described by this object.
+ *
* @param referringSignatureReference The position of the signature reference.
*/
public void setReferringSignatureReference(int referringSignatureReference) {
this.referringSignatureReference = referringSignatureReference;
}
+ @Override
public int getReferringSignatureReference() {
return referringSignatureReference;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java
index e3a06c6..9f6d882 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/MetaInfoImpl.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 org.w3c.dom.NodeList;
@@ -30,6 +29,7 @@ import at.gv.egovernment.moa.spss.api.common.MetaInfo;
/**
* Default implementation of <code>MetaInfo</code>.
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -45,55 +45,58 @@ public class MetaInfoImpl implements MetaInfo {
/**
* Sets the MIME type.
- *
+ *
* @param mimeType The MIME type to set.
*/
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
+ @Override
public String getMimeType() {
return mimeType;
}
/**
* Sets the URI pointing to a description of the content.
- *
+ *
* @param description The URI pointing to a description of the content.
*/
public void setDescription(String description) {
this.description = description;
}
+ @Override
public String getDescription() {
return description;
}
/**
* Sets descriptive XML content.
- *
+ *
* @param anyElements The elements to set.
*/
public void setAnyElements(NodeList anyElements) {
- this.anyElements = anyElements;
+ this.anyElements = anyElements;
}
+ @Override
public NodeList getAnyElements() {
return anyElements;
}
/**
* Sets the XML signature creation type information.
- *
+ *
* @param type the XML signature creation type information to set.
*/
public void setType(String type) {
this.type = type;
}
+ @Override
public String getType() {
return type;
}
-
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java
index 8bd81a7..c9e44f1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferenceInfoImpl.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;
@@ -32,7 +31,7 @@ import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo;
/**
* Default implementation of <code>ReferenceInfo</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -41,20 +40,21 @@ public class ReferenceInfoImpl implements ReferenceInfo {
private List verifyTransformsInfoProfiles;
/**
- * Sets the transforms profile used for verifying the transforms contained
- * in the signature.
- *
+ * Sets the transforms profile used for verifying the transforms contained in
+ * the signature.
+ *
* @param verifyTransformsInfoProfiles The profiles containing the transforms
- * allowed in the signature.
+ * allowed in the signature.
*/
public void setVerifyTransformsInfoProfiles(List verifyTransformsInfoProfiles) {
this.verifyTransformsInfoProfiles =
- verifyTransformsInfoProfiles != null
- ? Collections.unmodifiableList(
- new ArrayList(verifyTransformsInfoProfiles))
- : null;
+ verifyTransformsInfoProfiles != null
+ ? Collections.unmodifiableList(
+ new ArrayList(verifyTransformsInfoProfiles))
+ : null;
}
+ @Override
public List getVerifyTransformsInfoProfiles() {
return verifyTransformsInfoProfiles;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java
index d4cbab0..02e8634 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultImpl.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 at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult;
@@ -29,7 +28,7 @@ import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo;
/**
* Default implementation of <code>ReferencesCheckResult</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -41,30 +40,31 @@ public class ReferencesCheckResultImpl implements ReferencesCheckResult {
/**
* Sets the check code.
- *
- * @param code A numerical representation of the result of the reference
- * check.
+ *
+ * @param code A numerical representation of the result of the reference check.
*/
public void setCode(int code) {
this.code = code;
}
-
+
+ @Override
public int getCode() {
return code;
}
/**
* Sets additional information about the reference check.
- *
- * @param manifestRefsCheckResultInfo Additional information about the
- * reference check.
+ *
+ * @param manifestRefsCheckResultInfo Additional information about the reference
+ * check.
*/
public void setInfo(ReferencesCheckResultInfo manifestRefsCheckResultInfo) {
this.info = manifestRefsCheckResultInfo;
}
-
+
+ @Override
public ReferencesCheckResultInfo getInfo() {
return info;
- }
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java
index a696988..a9073ed 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/ReferencesCheckResultInfoImpl.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 org.w3c.dom.NodeList;
@@ -30,39 +29,42 @@ import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo;
/**
* Default implementation of <code>ReferencesCheckResultInfo</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ReferencesCheckResultInfoImpl
- implements ReferencesCheckResultInfo {
+ implements ReferencesCheckResultInfo {
/** Additional information about the references check. */
private NodeList anyOtherInfo;
/** The indexes of the failed references. */
private int[] failedReferences = new int[0];
-
+
/**
* Sets additional information about the references check.
+ *
* @param anyOtherInfo Additional information about the references check.
*/
public void setAnyOtherInfo(NodeList anyOtherInfo) {
this.anyOtherInfo = anyOtherInfo;
}
-
+
+ @Override
public NodeList getAnyOtherInfo() {
return anyOtherInfo;
}
/**
* Sets the indexes of the failed references.
- *
+ *
* @param failedReferences The indexes of the failed references.
*/
public void setFailedReferences(int[] failedReferences) {
this.failedReferences = failedReferences;
}
+ @Override
public int[] getFailedReferences() {
return failedReferences;
}
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 ea8d295..0831aec 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
@@ -80,485 +80,577 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse;
/**
* Default implementation of <code>SPSSFactory</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class SPSSFactoryImpl extends SPSSFactory {
- public CreateXMLSignatureRequest createCreateXMLSignatureRequest(String keyIdentifier, List singleSignatureInfos) {
- CreateXMLSignatureRequestImpl createXMLSignatureRequest = new CreateXMLSignatureRequestImpl();
- createXMLSignatureRequest.setKeyIdentifier(keyIdentifier);
- createXMLSignatureRequest.setSingleSignatureInfos(singleSignatureInfos);
- return createXMLSignatureRequest;
- }
-
- public 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,
- ExtendedCertificateCheckResult extendedCertificateCheckResult) {
- VerifyCMSSignatureResponseElementImpl verifyCMSSignatureResponseElement = new VerifyCMSSignatureResponseElementImpl();
- verifyCMSSignatureResponseElement.setSignerInfo(signerInfo);
- verifyCMSSignatureResponseElement.setSignatureCheck(signatureCheck);
- verifyCMSSignatureResponseElement.setCertificateCheck(certificateCheck);
- verifyCMSSignatureResponseElement.setAdESFormResults(adesResult);
- verifyCMSSignatureResponseElement.setExtendedCertificateCheck(extendedCertificateCheckResult);
- 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, ExtendedCertificateCheckResult extCheckResult) {
- 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);
- verifyXMLSignatureResponse.setExtendedCertificateCheck(extCheckResult);
- 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, Date signingTime, TslInfos tslInfos) {
- 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);
- signerInfo.setSigningTime(signingTime);
- signerInfo.setTslInfos(tslInfos);
- 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;
- }
+ @Override
+ public CreateXMLSignatureRequest createCreateXMLSignatureRequest(String keyIdentifier,
+ List singleSignatureInfos) {
+ final CreateXMLSignatureRequestImpl createXMLSignatureRequest = new CreateXMLSignatureRequestImpl();
+ createXMLSignatureRequest.setKeyIdentifier(keyIdentifier);
+ createXMLSignatureRequest.setSingleSignatureInfos(singleSignatureInfos);
+ return createXMLSignatureRequest;
+ }
+
+ @Override
+ public CreateCMSSignatureRequest createCreateCMSSignatureRequest(String keyIdentifier,
+ List singleSignatureInfos) {
+ final CreateCMSSignatureRequestImpl createCMSSignatureRequest = new CreateCMSSignatureRequestImpl();
+ createCMSSignatureRequest.setKeyIdentifier(keyIdentifier);
+ createCMSSignatureRequest.setSingleSignatureInfos(singleSignatureInfos);
+ return createCMSSignatureRequest;
+
+ }
+
+ @Override
+ public CreateCMSSignatureResponse createCreateCMSSignatureResponse(List responseElements) {
+ final CreateCMSSignatureResponseImpl createCMSSignatureResponse = new CreateCMSSignatureResponseImpl();
+ createCMSSignatureResponse.setResponseElements(responseElements);
+ return createCMSSignatureResponse;
+ }
+
+ @Override
+ public CMSSignatureResponse createCMSSignatureResponse(String base64value) {
+ final CMSSignatureResponseImpl cmsSignatureResponse = new CMSSignatureResponseImpl();
+ cmsSignatureResponse.setCMSSignature(base64value);
+
+ return cmsSignatureResponse;
+ }
+
+ @Override
+ public SingleSignatureInfo createSingleSignatureInfo(List dataObjectInfos,
+ CreateSignatureInfo createSignatureInfo,
+ boolean securityLayerConform) {
+ final SingleSignatureInfoImpl singleSignatureInfo = new SingleSignatureInfoImpl();
+ singleSignatureInfo.setDataObjectInfos(dataObjectInfos);
+ singleSignatureInfo.setCreateSignatureInfo(createSignatureInfo);
+ singleSignatureInfo.setSecurityLayerConform(securityLayerConform);
+ return singleSignatureInfo;
+ }
+
+ @Override
+ public at.gv.egovernment.moa.spss.api.cmssign.SingleSignatureInfo createSingleSignatureInfoCMS(
+ at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo dataObjectInfo, boolean securityLayerConform,
+ boolean isPAdESConform) {
+ final SingleSignatureInfoCMSImpl singleSignatureInfo = new SingleSignatureInfoCMSImpl();
+ singleSignatureInfo.setDataObjectInfo(dataObjectInfo);
+ singleSignatureInfo.setSecurityLayerConform(securityLayerConform);
+ singleSignatureInfo.setPAdESConform(isPAdESConform);
+ return singleSignatureInfo;
+ }
+
+ @Override
+ public DataObjectInfo createDataObjectInfo(String structure, boolean childOfManifest, Content dataObject,
+ CreateTransformsInfoProfile createTransformsInfoProfile) {
+ final DataObjectInfoImpl dataObjectInfo = new DataObjectInfoImpl();
+ dataObjectInfo.setStructure(structure);
+ dataObjectInfo.setChildOfManifest(childOfManifest);
+ dataObjectInfo.setDataObject(dataObject);
+ dataObjectInfo.setCreateTransformsInfoProfile(createTransformsInfoProfile);
+ return dataObjectInfo;
+ }
+
+ @Override
+ public at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo createDataObjectInfo(String structure,
+ CMSDataObject dataObject) {
+ final DataObjectInfoCMSImpl dataObjectInfo = new DataObjectInfoCMSImpl();
+ dataObjectInfo.setStructure(structure);
+ dataObjectInfo.setDataObject(dataObject);
+ return dataObjectInfo;
+ }
+
+ @Override
+ public CreateTransformsInfoProfile createCreateTransformsInfoProfile(String profileID) {
+
+ final CreateTransformsInfoProfileIDImpl createTransformsInfoProfile =
+ new CreateTransformsInfoProfileIDImpl();
+ createTransformsInfoProfile.setCreateTransformsInfoProfileID(profileID);
+ return createTransformsInfoProfile;
+ }
+
+ @Override
+ public CreateTransformsInfoProfile createCreateTransformsInfoProfile(CreateTransformsInfo transformsInfo,
+ List supplements) {
+ final CreateTransformsInfoProfileExplicitImpl createTransformsInfoProfile =
+ new CreateTransformsInfoProfileExplicitImpl();
+ createTransformsInfoProfile.setCreateTransformsInfo(transformsInfo);
+ createTransformsInfoProfile.setSupplements(supplements);
+ return createTransformsInfoProfile;
+ }
+
+ @Override
+ public CreateTransformsInfo createCreateTransformsInfo(List transforms, MetaInfo finalDataMetaInfo) {
+ final CreateTransformsInfoImpl createTransformsInfo = new CreateTransformsInfoImpl();
+
+ createTransformsInfo.setTransforms(transforms);
+ createTransformsInfo.setFinalDataMetaInfo(finalDataMetaInfo);
+ return createTransformsInfo;
+ }
+
+ @Override
+ public CreateSignatureInfo createCreateSignatureInfo(Content createSignatureEnvironment,
+ CreateSignatureEnvironmentProfile createSignatureEnvironmentProfile) {
+ final CreateSignatureInfoImpl createSignatureInfo = new CreateSignatureInfoImpl();
+ createSignatureInfo.setCreateSignatureEnvironment(createSignatureEnvironment);
+ createSignatureInfo.setCreateSignatureEnvironmentProfile(createSignatureEnvironmentProfile);
+ return createSignatureInfo;
+ }
+
+ @Override
+ public CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile(
+ CreateSignatureLocation createSignatureLocation, List supplements) {
+ final CreateSignatureEnvironmentProfileExplicitImpl createSignatureEnvironmentProfile =
+ new CreateSignatureEnvironmentProfileExplicitImpl();
+ createSignatureEnvironmentProfile.setCreateSignatureLocation(createSignatureLocation);
+ createSignatureEnvironmentProfile.setSupplements(supplements);
+ return createSignatureEnvironmentProfile;
+ }
+
+ @Override
+ public CreateSignatureLocation createCreateSignatureLocation(String signatureLocationXPath,
+ int signatureLocationIndex, Map namespaceDeclarations) {
+ final CreateSignatureLocationImpl createSignatureLocation = new CreateSignatureLocationImpl();
+ createSignatureLocation.setIndex(signatureLocationIndex);
+ createSignatureLocation.setNamespaceDeclarations(namespaceDeclarations);
+ createSignatureLocation.setXPathExpression(signatureLocationXPath);
+ return createSignatureLocation;
+ }
+
+ @Override
+ public CreateSignatureEnvironmentProfile createCreateSignatureEnvironmentProfile(String profileID) {
+ final CreateSignatureEnvironmentProfileIDImpl createSignatureEnvironmentProfile =
+ new CreateSignatureEnvironmentProfileIDImpl();
+ createSignatureEnvironmentProfile.setCreateSignatureEnvironmentProfileID(profileID);
+ return createSignatureEnvironmentProfile;
+ }
+
+ @Override
+ public CreateXMLSignatureResponse createCreateXMLSignatureResponse(List responseElements) {
+ final CreateXMLSignatureResponseImpl createXMLSignatureResponse = new CreateXMLSignatureResponseImpl();
+ createXMLSignatureResponse.setResponseElements(responseElements);
+ return createXMLSignatureResponse;
+ }
+
+ @Override
+ public SignatureEnvironmentResponse createSignatureEnvironmentResponse(Element signatureEnvironment) {
+ final SignatureEnvironmentResponseImpl signatureEnvironmentResponse =
+ new SignatureEnvironmentResponseImpl();
+ signatureEnvironmentResponse.setSignatureEnvironment(signatureEnvironment);
+ return signatureEnvironmentResponse;
+ }
+
+ @Override
+ public ErrorResponse createErrorResponse(int code, String info) {
+ final ErrorResponseImpl errorResponse = new ErrorResponseImpl();
+ errorResponse.setErrorCode(code);
+ errorResponse.setInfo(info);
+ return errorResponse;
+ }
+
+ @Override
+ 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);
+ }
+
+ @Override
+ public VerifyCMSSignatureRequest createVerifyCMSSignatureRequest(int[] signatories, Date dateTime,
+ InputStream cmsSignature, CMSDataObject dataObject, String trustProfileID, boolean pdf,
+ boolean extended) {
+ final 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;
+ }
+
+ @Override
+ public CMSDataObject createCMSDataObject(MetaInfo metaInfo, CMSContent content,
+ BigDecimal excludeByteRangeFrom,
+ BigDecimal excludeByteRangeTo) {
+
+ final CMSDataObjectImpl cmsDataObject = new CMSDataObjectImpl();
+ cmsDataObject.setMetaInfo(metaInfo);
+ cmsDataObject.setContent(content);
+ cmsDataObject.setExcludeByteRangeFrom(excludeByteRangeFrom);
+ cmsDataObject.setExcludeByteRangeTo(excludeByteRangeTo);
+
+ return cmsDataObject;
+ }
+
+ @Override
+ public CMSContent createCMSContent(InputStream binaryContent) {
+ final CMSContentExplicitImpl cmsContent = new CMSContentExplicitImpl();
+
+ cmsContent.setBinaryContent(binaryContent);
+ return cmsContent;
+ }
+
+ @Override
+ public CMSContent createCMSContent(String referenceURI) {
+ final CMSContentReferenceImpl cmsContent = new CMSContentReferenceImpl();
+
+ cmsContent.setReference(referenceURI);
+ return cmsContent;
+ }
+
+ public CMSDataObject createCMSDataObject(MetaInfo metaInfo, String referenceURI) {
+ final CMSDataObjectImpl cmsDataObject = new CMSDataObjectImpl();
+ final CMSContentReferenceImpl cmsContent = new CMSContentReferenceImpl();
+ cmsDataObject.setMetaInfo(metaInfo);
+ cmsContent.setReference(referenceURI);
+ return cmsDataObject;
+ }
+
+ @Override
+ public VerifyCMSSignatureResponse createVerifyCMSSignatureResponse(List responseElements) {
+ final VerifyCMSSinatureResponseImpl verifyCMSSignatureResponse = new VerifyCMSSinatureResponseImpl();
+ verifyCMSSignatureResponse.setResponseElements(responseElements);
+ return verifyCMSSignatureResponse;
+ }
+
+ @Override
+ public VerifyCMSSignatureResponseElement createVerifyCMSSignatureResponseElement(SignerInfo signerInfo,
+ CheckResult signatureCheck, CheckResult certificateCheck, List adesResult,
+ ExtendedCertificateCheckResult extendedCertificateCheckResult, String usedAlgorithm,
+ Boolean coversFullDocument,
+ int[] byteRangeOfSignature) {
+ final VerifyCMSSignatureResponseElementImpl verifyCMSSignatureResponseElement =
+ new VerifyCMSSignatureResponseElementImpl();
+ verifyCMSSignatureResponseElement.setSignerInfo(signerInfo);
+ verifyCMSSignatureResponseElement.setSignatureCheck(signatureCheck);
+ verifyCMSSignatureResponseElement.setCertificateCheck(certificateCheck);
+ verifyCMSSignatureResponseElement.setAdESFormResults(adesResult);
+ verifyCMSSignatureResponseElement.setExtendedCertificateCheck(extendedCertificateCheckResult);
+ verifyCMSSignatureResponseElement.setSignatureAlgorithm(usedAlgorithm);
+ verifyCMSSignatureResponseElement.setCoversFullDocument(coversFullDocument);
+ verifyCMSSignatureResponseElement.setByteRangeOfSignature(byteRangeOfSignature);
+ return verifyCMSSignatureResponseElement;
+ }
+
+ @Override
+ 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);
+ }
+
+ @Override
+ public VerifySignatureInfo createVerifySignatureInfo(Content verifySignatureEnvironment,
+ VerifySignatureLocation verifySignatureLocation) {
+ final VerifySignatureInfoImpl verifySignatureInfo = new VerifySignatureInfoImpl();
+ verifySignatureInfo.setVerifySignatureEnvironment(verifySignatureEnvironment);
+ verifySignatureInfo.setVerifySignatureLocation(verifySignatureLocation);
+ return verifySignatureInfo;
+ }
+
+ @Override
+ public VerifySignatureLocation createVerifySignatureLocation(String xPathExpression,
+ Map namespaceDeclarations) {
+ final VerifySignatureLocationImpl verifySignatureLocation = new VerifySignatureLocationImpl();
+ verifySignatureLocation.setXPathExpression(xPathExpression);
+ verifySignatureLocation.setNamespaceDeclarations(namespaceDeclarations);
+ return verifySignatureLocation;
+ }
+
+ @Override
+ public SupplementProfile createSupplementProfile(String profileID) {
+ final SupplementProfileIDImpl supplementProfileID = new SupplementProfileIDImpl();
+ supplementProfileID.setSupplementProfileID(profileID);
+ return supplementProfileID;
+ }
+
+ @Override
+ public SupplementProfile createSupplementProfile(XMLDataObjectAssociation supplementProfile) {
+ final SupplementProfileExplicitImpl supplementProfileExplicit = new SupplementProfileExplicitImpl();
+ supplementProfileExplicit.setSupplementProfile(supplementProfile);
+ return supplementProfileExplicit;
+ }
+
+ @Override
+ public SignatureManifestCheckParams createSignatureManifestCheckParams(List referenceInfos,
+ boolean returnReferenceInputData) {
+ final SignatureManifestCheckParamsImpl signatureManifestCheckParams =
+ new SignatureManifestCheckParamsImpl();
+ signatureManifestCheckParams.setReferenceInfos(referenceInfos);
+ signatureManifestCheckParams.setReturnReferenceInputData(returnReferenceInputData);
+ return signatureManifestCheckParams;
+ }
+
+ @Override
+ public ReferenceInfo createReferenceInfo(List verifyTransformsInfoProfiles) {
+ final ReferenceInfoImpl referenceInfo = new ReferenceInfoImpl();
+ referenceInfo.setVerifyTransformsInfoProfiles(verifyTransformsInfoProfiles);
+ return referenceInfo;
+ }
+
+ @Override
+ public VerifyTransformsInfoProfile createVerifyTransformsInfoProfile(List transforms,
+ List transformParameters) {
+ final VerifyTransformsInfoProfileExplicitImpl verifyTransformsInfoProfile =
+ new VerifyTransformsInfoProfileExplicitImpl();
+
+ verifyTransformsInfoProfile.setTransforms(transforms);
+ verifyTransformsInfoProfile.setTransformParameters(transformParameters);
+
+ return verifyTransformsInfoProfile;
+ }
+
+ @Override
+ public VerifyTransformsInfoProfile createVerifyTransformsInfoProfile(String profileID) {
+ final VerifyTransformsInfoProfileIDImpl verifyTransformsInfoProfile =
+ new VerifyTransformsInfoProfileIDImpl();
+ verifyTransformsInfoProfile.setVerifyTransformsInfoProfileID(profileID);
+ return verifyTransformsInfoProfile;
+ }
+
+ @Override
+ public TransformParameter createTransformParameter(String URI, String digestMethod, byte[] digestValue) {
+ final TransformPatameterHashImpl transformParameter = new TransformPatameterHashImpl();
+ transformParameter.setURI(URI);
+ transformParameter.setDigestMethod(digestMethod);
+ transformParameter.setDigestValue(digestValue);
+ return transformParameter;
+ }
+
+ @Override
+ public TransformParameter createTransformParameter(String URI, InputStream binaryData) {
+ final TransformParameterBinaryImpl transformParameter = new TransformParameterBinaryImpl();
+ transformParameter.setURI(URI);
+ transformParameter.setBinaryContent(binaryData);
+ return transformParameter;
+ }
+
+ @Override
+ public TransformParameter createTransformParameter(String URI) {
+ final TransformParameterURIImpl transformParameter = new TransformParameterURIImpl();
+ transformParameter.setURI(URI);
+ return transformParameter;
+ }
+
+ @Override
+ public VerifyXMLSignatureResponse createVerifyXMLSignatureResponse(SignerInfo signerInfo,
+ List hashInputDatas,
+ List referenceInputDatas, ReferencesCheckResult signatureCheck,
+ ReferencesCheckResult signatureManifestCheck, List xmlDsigManifestChecks, CheckResult certificateCheck,
+ List adesFormResults, ExtendedCertificateCheckResult extCheckResult, String signatureAlgorithm) {
+ final VerifyXMLSignatureResponseImpl verifyXMLSignatureResponse = new VerifyXMLSignatureResponseImpl();
+ verifyXMLSignatureResponse.setSignerInfo(signerInfo);
+ verifyXMLSignatureResponse.setHashInputDatas(hashInputDatas);
+ verifyXMLSignatureResponse.setReferenceInputDatas(referenceInputDatas);
+ verifyXMLSignatureResponse.setSignatureAlgorithm(signatureAlgorithm);
+ verifyXMLSignatureResponse.setSignatureCheck(signatureCheck);
+ verifyXMLSignatureResponse.setSignatureManifestCheck(signatureManifestCheck);
+ verifyXMLSignatureResponse.setXMLDsigManifestChecks(xmlDsigManifestChecks);
+ verifyXMLSignatureResponse.setCertificateCheck(certificateCheck);
+ verifyXMLSignatureResponse.setAdESFormResults(adesFormResults);
+ verifyXMLSignatureResponse.setExtendedCertificateCheck(extCheckResult);
+ return verifyXMLSignatureResponse;
+ }
+
+ @Override
+ public ReferencesCheckResult createReferencesCheckResult(int code, ReferencesCheckResultInfo info) {
+ final ReferencesCheckResultImpl referencesCheckResult = new ReferencesCheckResultImpl();
+ referencesCheckResult.setCode(code);
+ referencesCheckResult.setInfo(info);
+ return referencesCheckResult;
+ }
+
+ @Override
+ public ReferencesCheckResultInfo createReferencesCheckResultInfo(NodeList anyOtherInfo,
+ int[] failedReferences) {
+ final ReferencesCheckResultInfoImpl referencesCheckResultInfo = new ReferencesCheckResultInfoImpl();
+ referencesCheckResultInfo.setAnyOtherInfo(anyOtherInfo);
+ referencesCheckResultInfo.setFailedReferences(failedReferences);
+ return referencesCheckResultInfo;
+ }
+
+ @Override
+ public ManifestRefsCheckResult createManifestRefsCheckResult(int code, ManifestRefsCheckResultInfo info) {
+ final ManifestRefsCheckResultImpl manifestRefsCheckResult = new ManifestRefsCheckResultImpl();
+ manifestRefsCheckResult.setCode(code);
+ manifestRefsCheckResult.setInfo(info);
+ return manifestRefsCheckResult;
+ }
+
+ @Override
+ public ManifestRefsCheckResultInfo createManifestRefsCheckResultInfo(NodeList anyOtherInfo,
+ int[] failedReferences,
+ int referringSigReference) {
+ final ManifestRefsCheckResultInfoImpl manifestRefsCheckResultInfo = new ManifestRefsCheckResultInfoImpl();
+ manifestRefsCheckResultInfo.setAnyOtherInfo(anyOtherInfo);
+ manifestRefsCheckResultInfo.setReferringSignatureReference(referringSigReference);
+ manifestRefsCheckResultInfo.setFailedReferences(failedReferences);
+ return manifestRefsCheckResultInfo;
+ }
+
+ @Override
+ public Content createContent(InputStream binaryData, String referenceURI) {
+ final ContentBinaryImpl content = new ContentBinaryImpl();
+ content.setBinaryContent(binaryData);
+ content.setReference(referenceURI);
+ return content;
+ }
+
+ @Override
+ public Content createContent(String locationReferenceURI, String referenceURI) {
+ final ContentLocRefImpl content = new ContentLocRefImpl();
+ content.setLocationReferenceURI(locationReferenceURI);
+ content.setReference(referenceURI);
+ return content;
+ }
+
+ @Override
+ public Content createContent(String referenceURI) {
+ final ContentReferenceImpl content = new ContentReferenceImpl();
+ content.setReference(referenceURI);
+ return content;
+ }
+
+ @Override
+ public Content createContent(NodeList xmlData, String referenceURI) {
+ final ContentXMLImpl content = new ContentXMLImpl();
+ content.setXMLContent(xmlData);
+ content.setReference(referenceURI);
+ return content;
+ }
+
+ @Override
+ public XMLDataObjectAssociation createXMLDataObjectAssociation(MetaInfo metaInfo, Content xmlContent) {
+ final XMLDataObjectAssociationImpl xmlDataObjectAssociation = new XMLDataObjectAssociationImpl();
+ xmlDataObjectAssociation.setMetaInfo(metaInfo);
+ xmlDataObjectAssociation.setContent(xmlContent);
+ return xmlDataObjectAssociation;
+ }
+
+ @Override
+ public MetaInfo createMetaInfo(String mimeType, String description, NodeList otherInfo, String type) {
+ final MetaInfoImpl metaInfo = new MetaInfoImpl();
+ metaInfo.setMimeType(mimeType);
+ metaInfo.setDescription(description);
+ metaInfo.setAnyElements(otherInfo);
+ metaInfo.setType(type);
+ return metaInfo;
+ }
+
+ @Override
+ public Transform createCanonicalizationTransform(String algorithmURI) {
+ final CanonicalizationTransformImpl transform = new CanonicalizationTransformImpl(algorithmURI);
+ return transform;
+ }
+
+ @Override
+ public Transform createExclusiveCanonicalizationTransform(String algorithmURI,
+ List inclusiveNamespacePrefixes) {
+ final ExclusiveCanonicalizationTransformImpl transform = new ExclusiveCanonicalizationTransformImpl(
+ algorithmURI);
+ transform.setInclusiveNamespacePrefixes(inclusiveNamespacePrefixes);
+ return transform;
+ }
+
+ @Override
+ public Transform createBase64Transform() {
+ final Base64TransformImpl transform = new Base64TransformImpl();
+ return transform;
+ }
+
+ @Override
+ public Transform createEnvelopedSignatureTransform() {
+ final EnvelopedSignatureTransformImpl transform = new EnvelopedSignatureTransformImpl();
+ return transform;
+ }
+
+ @Override
+ public Transform createXSLTTransform(Element styleSheet) {
+ final XSLTransformImpl transform = new XSLTransformImpl();
+ transform.setStylesheet(styleSheet);
+ return transform;
+ }
+
+ @Override
+ public Transform createXPathTransform(String xPathExpression, Map namespaceDeclarations) {
+ final XPathTransformImpl transform = new XPathTransformImpl();
+ transform.setXPathExpression(xPathExpression);
+ transform.setNamespaceDelcarations(namespaceDeclarations);
+ return transform;
+ }
+
+ @Override
+ public Transform createXPathFilter2Transform(List xPathFilters) {
+ final XPathFilter2TransformImpl transform = new XPathFilter2TransformImpl();
+ transform.setFilters(xPathFilters);
+ return transform;
+ }
+
+ @Override
+ public XPathFilter createXPathFilter(String filterType, String xPathExpression, Map namespaceDeclarations) {
+ final XPathFilterImpl xPathFilter = new XPathFilterImpl();
+ xPathFilter.setFilterType(filterType);
+ xPathFilter.setXPathExpression(xPathExpression);
+ xPathFilter.setNamespaceDelcarations(namespaceDeclarations);
+ return xPathFilter;
+ }
+
+ @Override
+ public CheckResult createCheckResult(int code, NodeList info) {
+ final CheckResultImpl checkResult = new CheckResultImpl();
+ checkResult.setCode(code);
+ checkResult.setInfo(info);
+ return checkResult;
+ }
+
+ @Override
+ public SignerInfo createSignerInfo(X509Certificate signerCertificate, boolean qualifiedCertificate,
+ boolean qcSourceTSL, boolean publicAuthority, String publicAuthorityID, boolean sscd,
+ boolean sscdSourceTSL,
+ String issuerCountryCode, Date signingTime, TslInfos tslInfos) {
+ final 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);
+ signerInfo.setSigningTime(signingTime);
+ signerInfo.setTslInfos(tslInfos);
+ return signerInfo;
+ }
+
+ @Override
+ public X509IssuerSerial createX509IssuerSerial(String issuerName, BigInteger serialNumber) {
+ final 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) {
+ final 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/SignatureEnvironmentResponseImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java
index 4b50d89..1fc3cdc 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureEnvironmentResponseImpl.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 org.w3c.dom.Element;
@@ -30,34 +29,36 @@ import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse;
/**
* Default implementation of <code>SignatureEnvironmentResponse</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class SignatureEnvironmentResponseImpl
- implements SignatureEnvironmentResponse {
+ implements SignatureEnvironmentResponse {
/** The signature environment containing the XML signature. */
private Element signatureEnvironment;
- /**
+ /**
* Sets the XML structure which contains the signature.
- *
+ *
* @param signatureEnvironment A general XML structure containing the signature.
*/
public void setSignatureEnvironment(Element signatureEnvironment) {
this.signatureEnvironment = signatureEnvironment;
}
+ @Override
public Element getSignatureEnvironment() {
return signatureEnvironment;
}
/**
* Gets the type of <code>CreateXMLSignatureResponseElement</code>.
- *
+ *
* @return SIGNATURE_ENVIRONMENT_RESPONSE
*/
+ @Override
public int getResponseType() {
return SIGNATURE_ENVIRONMENT_RESPONSE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java
index 40e87e7..4d4fb64 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignatureManifestCheckParamsImpl.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;
@@ -32,12 +31,12 @@ import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams;
/**
* Default implementation of <code>SignatureManifestCheckParams</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class SignatureManifestCheckParamsImpl
- implements SignatureManifestCheckParams {
+ implements SignatureManifestCheckParams {
/** Referential information. */
private List referenceInfos;
@@ -46,29 +45,31 @@ public class SignatureManifestCheckParamsImpl
/**
* Sets the referantial information.
- *
+ *
* @param referenceInfos The referential information.
*/
public void setReferenceInfos(List referenceInfos) {
this.referenceInfos =
- referenceInfos != null
- ? Collections.unmodifiableList(new ArrayList(referenceInfos))
- : null;
+ referenceInfos != null
+ ? Collections.unmodifiableList(new ArrayList(referenceInfos))
+ : null;
}
+ @Override
public List getReferenceInfos() {
return referenceInfos;
}
-
+
/**
* Sets whether to return signature source data.
- *
+ *
* @param returnReferenceInputData Whether to return signature source data.
*/
public void setReturnReferenceInputData(boolean returnReferenceInputData) {
this.returnReferenceInputData = returnReferenceInputData;
}
+ @Override
public boolean getReturnReferenceInputData() {
return returnReferenceInputData;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java
index 57a60a6..988ae00 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.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.security.cert.X509Certificate;
@@ -32,7 +31,7 @@ import at.gv.egovernment.moa.spss.api.common.TslInfos;
/**
* Default implementation of <code>SignerInfo</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -40,145 +39,161 @@ public class SignerInfoImpl implements SignerInfo {
/** The signer certificate. */
private X509Certificate signerCertificate;
- /** Determines, whether <code>signerCertificate</code> is a qualified
- * certificate. */
+ /**
+ * Determines, whether <code>signerCertificate</code> is a qualified
+ * certificate.
+ */
private boolean qualifiedCertificate;
- /** Determines, whether <code>signerCertificate</code> is from a public
- * authority. */
+ /**
+ * Determines, whether <code>signerCertificate</code> is from a public
+ * authority.
+ */
private boolean publicAuthority;
/** The public authority ID of the <code>signerCertificate</code>. */
private String publicAuthorityID;
/** Determines, whether the signature is based on an SSCD */
private boolean sscd;
-
+
/** Determines, if the SSCD check bases upon on TSL */
private boolean sscdSourceTSL;
-
+
/** Determines, if the QC check bases upon on TSL */
private boolean qcSourceTSL;
-
+
/** The certificate issuer country code */
private String issuerCountryCode;
- private Date signingTime;
- private TslInfos tslInfos;
+ private Date signingTime;
+ private TslInfos tslInfos;
/**
- * Sets the signer certificate.
- *
- * @param signerCertificate The signer certificate.
- */
+ * Sets the signer certificate.
+ *
+ * @param signerCertificate The signer certificate.
+ */
public void setSignerCertificate(X509Certificate signerCertificate) {
this.signerCertificate = signerCertificate;
}
+ @Override
public X509Certificate getSignerCertificate() {
return signerCertificate;
}
/**
* Sets, whether the certificate contained in this object is qualified or not.
- *
- * @param qualifiedCertificate Is <code>true</code>, if the certificate is
- * qualified, otherwise <code>false</code>.
+ *
+ * @param qualifiedCertificate Is <code>true</code>, if the certificate is
+ * qualified, otherwise <code>false</code>.
*/
public void setQualifiedCertificate(boolean qualifiedCertificate) {
this.qualifiedCertificate = qualifiedCertificate;
}
+ @Override
public boolean isQualifiedCertificate() {
return qualifiedCertificate;
}
/**
* Sets, whether the signature is based on an SSCS or not.
- *
- * @param sscd Is <code>true</code>, if the signature is
- * based on an SSCD, otherwise <code>false</code>.
+ *
+ * @param sscd Is <code>true</code>, if the signature is based on an SSCD,
+ * otherwise <code>false</code>.
*/
public void setSSCD(boolean sscd) {
this.sscd = sscd;
}
+
+ @Override
public boolean isSSCD() {
- return sscd;
+ return sscd;
}
-
+
public void setSSCDSourceTSL(boolean sscdSourceTSL) {
- this.sscdSourceTSL = sscdSourceTSL;
+ this.sscdSourceTSL = sscdSourceTSL;
}
-
+
+ @Override
public String getSSCDSource() {
- if (sscdSourceTSL)
- return "TSL";
- else
- return "Certificate";
+ if (sscdSourceTSL) {
+ return "TSL";
+ } else {
+ return "Certificate";
+ }
}
- public Date getSigningTime() {
- return signingTime;
- }
+ @Override
+ public Date getSigningTime() {
+ return signingTime;
+ }
- public void setSigningTime(Date signingTime) {
- this.signingTime = signingTime;
- }
+ public void setSigningTime(Date signingTime) {
+ this.signingTime = signingTime;
+ }
- public void setQCSourceTSL(boolean qcSourceTSL) {
- this.qcSourceTSL = qcSourceTSL;
+ public void setQCSourceTSL(boolean qcSourceTSL) {
+ this.qcSourceTSL = qcSourceTSL;
}
-
+
+ @Override
public String getQCSource() {
- if (this.qcSourceTSL)
- return "TSL";
- else
- return "Certificate";
+ if (this.qcSourceTSL) {
+ return "TSL";
+ } else {
+ return "Certificate";
+ }
}
-
+
public void setIssuerCountryCode(String issuerCountryCode) {
- this.issuerCountryCode = issuerCountryCode;
+ this.issuerCountryCode = issuerCountryCode;
}
- public String getIssuerCountryCode() {
- return issuerCountryCode;
- }
-
+
+ @Override
+ public String getIssuerCountryCode() {
+ return issuerCountryCode;
+ }
+
/**
- * Sets, whether the certificate contained in this object is an
- * e-government certificate or not.
- *
- * @param publicAuthority Is <code>true</code>, if the certificate is
- * public authority certificate, otherwise <code>false</code>.
+ * Sets, whether the certificate contained in this object is an e-government
+ * certificate or not.
+ *
+ * @param publicAuthority Is <code>true</code>, if the certificate is public
+ * authority certificate, otherwise <code>false</code>.
*/
public void setPublicAuthority(boolean publicAuthority) {
this.publicAuthority = publicAuthority;
}
+ @Override
public boolean isPublicAuthority() {
return publicAuthority;
}
/**
* Sets the public authority ID of the signer certificate.
- *
+ *
* @param publicAuhtorityID The public authority ID of the signer certificate.
*/
public void setPublicAuhtorityID(String publicAuhtorityID) {
this.publicAuthorityID = publicAuhtorityID;
}
+ @Override
public String getPublicAuhtorityID() {
return publicAuthorityID;
}
@Override
public TslInfos getTslInfos() {
- return this.tslInfos;
-
- }
+ return this.tslInfos;
+ }
public void setTslInfos(TslInfos tslInfos) {
- this.tslInfos = tslInfos;
-
+ this.tslInfos = tslInfos;
+
}
-
- }
+
+}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoCMSImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoCMSImpl.java
index cb36515..bbe3ea5 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoCMSImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoCMSImpl.java
@@ -21,13 +21,8 @@
* 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;
-import java.util.Collections;
-import java.util.List;
-
import at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo;
import at.gv.egovernment.moa.spss.api.cmssign.SingleSignatureInfo;
@@ -38,23 +33,32 @@ public class SingleSignatureInfoCMSImpl implements SingleSignatureInfo {
private DataObjectInfo dataObjectInfo = null;
-
private boolean securityLayerConform = true;
+ private boolean padesConform = false;
public void setDataObjectInfo(DataObjectInfo dataObjectInfo) {
this.dataObjectInfo = dataObjectInfo;
}
+ @Override
public DataObjectInfo getDataObjectInfo() {
return dataObjectInfo;
}
+ @Override
+ public boolean isPAdESConform() {
+ return padesConform;
+ }
+ public void setPAdESConform(boolean padesConform) {
+ this.padesConform = padesConform;
+ }
public void setSecurityLayerConform(boolean securityLayerConform) {
this.securityLayerConform = securityLayerConform;
}
+ @Override
public boolean isSecurityLayerConform() {
return securityLayerConform;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java
index 3d43068..1fc20a0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SingleSignatureInfoImpl.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;
@@ -45,11 +44,12 @@ public class SingleSignatureInfoImpl implements SingleSignatureInfo {
public void setDataObjectInfos(List dataObjectInfos) {
this.dataObjectInfos =
- dataObjectInfos != null
- ? Collections.unmodifiableList(new ArrayList(dataObjectInfos))
- : null;
+ dataObjectInfos != null
+ ? Collections.unmodifiableList(new ArrayList(dataObjectInfos))
+ : null;
}
+ @Override
public List getDataObjectInfos() {
return dataObjectInfos;
}
@@ -58,6 +58,7 @@ public class SingleSignatureInfoImpl implements SingleSignatureInfo {
this.createSignatureInfo = createSignatureInfo;
}
+ @Override
public CreateSignatureInfo getCreateSignatureInfo() {
return createSignatureInfo;
}
@@ -66,6 +67,7 @@ public class SingleSignatureInfoImpl implements SingleSignatureInfo {
this.securityLayerConform = securityLayerConform;
}
+ @Override
public boolean isSecurityLayerConform() {
return securityLayerConform;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java
index 7f80388..82a1a0d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileExplicitImpl.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 at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation;
@@ -29,7 +28,7 @@ import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfileExplicit;
/**
* Default implementation of <code>SupplementProfileExplicit</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -40,22 +39,24 @@ public class SupplementProfileExplicitImpl implements SupplementProfileExplicit
/**
* Sets the supplemental information for verifying a signature.
- *
+ *
* @param supplement The supplemental information for verifying a signature.
*/
public void setSupplementProfile(XMLDataObjectAssociation supplement) {
this.supplement = supplement;
}
-
+
+ @Override
public XMLDataObjectAssociation getSupplementProfile() {
return supplement;
}
/**
* Gets the type of <code>SupplementProfile</code>.
- *
+ *
* @return EXPLICIT_SUPPLEMENTPROFILE
*/
+ @Override
public int getSupplementProfileType() {
return EXPLICIT_SUPPLEMENTPROFILE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java
index e73ce60..7e64c93 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SupplementProfileIDImpl.java
@@ -21,39 +21,40 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlverify.SupplementProfileID;
/**
* Default implementation of <code>SupplementProfileID</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class SupplementProfileIDImpl implements SupplementProfileID {
/** The profile ID. */
private String profileID;
-
+
/**
* Sets the <code>SupplementProfile</code> profile ID.
- *
+ *
* @param profileID The profile ID.
*/
public void setSupplementProfileID(String profileID) {
this.profileID = profileID;
}
+ @Override
public String getSupplementProfileID() {
return profileID;
}
/**
* Gets the type of <code>SupplementProfile</code>.
- *
+ *
* @return ID_SUPPLEMENTPROFILE
*/
+ @Override
public int getSupplementProfileType() {
return ID_SUPPLEMENTPROFILE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TSLConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TSLConfigurationImpl.java
index 6fa813f..cf3bfc7 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TSLConfigurationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TSLConfigurationImpl.java
@@ -21,99 +21,101 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
-import iaik.xml.crypto.utils.URI;
-
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import at.gv.egovernment.moa.spss.api.common.TSLConfiguration;
+import iaik.xml.crypto.utils.URI;
/**
* Default implementation of <code>TSLConfiguration</code>.
- *
+ *
* @author kstranacher
*/
public class TSLConfigurationImpl implements TSLConfiguration {
-
-
- /** The EU TSL URL. */
- private String euTSLUrl;
-
- /** update period in milliseconds */
- private long updateSchedulePeriod;
-
- /** Time of the first update */
- private Date updateScheduleStartTime;
-
- /** Working directory */
- private String workingDirectory;
-
- /** Working directory */
- private URI workingDirectoryAsURI;
-
- private List<java.net.URI> qualifierForQC = new ArrayList<java.net.URI>();
- private List<java.net.URI> qualifierForSSCD = new ArrayList<java.net.URI>();
-
+ /** The EU TSL URL. */
+ private String euTSLUrl;
+
+ /** update period in milliseconds */
+ private long updateSchedulePeriod;
+
+ /** Time of the first update */
+ private Date updateScheduleStartTime;
+
+ /** Working directory */
+ private String workingDirectory;
+
+ /** Working directory */
+ private URI workingDirectoryAsURI;
+
+ private final List<java.net.URI> qualifierForQC = new ArrayList<>();
+ private final List<java.net.URI> qualifierForSSCD = new ArrayList<>();
+
+ @Override
public String getEuTSLUrl() {
- return this.euTSLUrl;
+ return this.euTSLUrl;
}
+ @Override
public long getUpdateSchedulePeriod() {
- return this.updateSchedulePeriod;
+ return this.updateSchedulePeriod;
}
+ @Override
public Date getUpdateScheduleStartTime() {
- return this.updateScheduleStartTime;
+ return this.updateScheduleStartTime;
}
+ @Override
public String getWorkingDirectory() {
- return this.workingDirectory;
+ return this.workingDirectory;
}
-
+
+ @Override
public URI getWorkingDirectoryAsURI() {
- return this.workingDirectoryAsURI;
+ return this.workingDirectoryAsURI;
}
- public void setEuTSLUrl(String euTSLUrl) {
- this.euTSLUrl = euTSLUrl;
- }
-
- public void setUpdateSchedulePeriod(long updateSchedulePeriod) {
- this.updateSchedulePeriod = updateSchedulePeriod;
- }
-
- public void setUpdateScheduleStartTime(Date updateScheduleStartTime) {
- this.updateScheduleStartTime = updateScheduleStartTime;
- }
-
- public void setWorkingDirectory(String workingDirectory) {
- this.workingDirectory = workingDirectory;
- }
-
- public void setWorkingDirectoryURI(URI workingDirectoryAsURI) {
- this.workingDirectoryAsURI = workingDirectoryAsURI;
- }
-
- public List<java.net.URI> getQualifierForQC() {
- return qualifierForQC;
- }
-
- public List<java.net.URI> getQualifierForSSCD() {
- return qualifierForSSCD;
- }
-
- public void addQualifierForQC(java.net.URI qualifier) {
- qualifierForQC.add(qualifier);
- }
-
- public void addQualifierForSSCD(java.net.URI qualifier) {
- qualifierForSSCD.add(qualifier);
- }
-
+ public void setEuTSLUrl(String euTSLUrl) {
+ this.euTSLUrl = euTSLUrl;
+ }
+
+ public void setUpdateSchedulePeriod(long updateSchedulePeriod) {
+ this.updateSchedulePeriod = updateSchedulePeriod;
+ }
+
+ public void setUpdateScheduleStartTime(Date updateScheduleStartTime) {
+ this.updateScheduleStartTime = updateScheduleStartTime;
+ }
+
+ public void setWorkingDirectory(String workingDirectory) {
+ this.workingDirectory = workingDirectory;
+ }
+
+ public void setWorkingDirectoryURI(URI workingDirectoryAsURI) {
+ this.workingDirectoryAsURI = workingDirectoryAsURI;
+ }
+
+ @Override
+ public List<java.net.URI> getQualifierForQC() {
+ return qualifierForQC;
+ }
+
+ @Override
+ public List<java.net.URI> getQualifierForSSCD() {
+ return qualifierForSSCD;
+ }
+
+ public void addQualifierForQC(java.net.URI qualifier) {
+ qualifierForQC.add(qualifier);
+ }
+
+ public void addQualifierForSSCD(java.net.URI qualifier) {
+ qualifierForSSCD.add(qualifier);
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java
index 37a05f9..c72a445 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformImpl.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 at.gv.egovernment.moa.spss.api.common.Transform;
@@ -36,13 +35,14 @@ public class TransformImpl implements Transform {
/**
* Sets the URI identifying the transformation algorithm.
- *
+ *
* @param algorithmURI The URI identifying the transformation algorithm.
*/
public void setAlgorithmURI(String algorithmURI) {
this.algorithmURI = algorithmURI;
}
+ @Override
public String getAlgorithmURI() {
return algorithmURI;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java
index 691f3a9..915aff3 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterBinaryImpl.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;
@@ -30,35 +29,37 @@ import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterBinary;
/**
* Default implementation of <code>TransformParameterBinary</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class TransformParameterBinaryImpl
- extends TransformParameterImpl
- implements TransformParameterBinary {
-
+ extends TransformParameterImpl
+ implements TransformParameterBinary {
+
/** The binary content as a stream. */
private InputStream binaryContent;
/**
* Sets the binary content as a stream.
- *
+ *
* @param binaryContent The binary content as a stream.
*/
public void setBinaryContent(InputStream binaryContent) {
this.binaryContent = binaryContent;
}
+ @Override
public InputStream getBinaryContent() {
return binaryContent;
}
/**
* Gets the <code>TransformParameter</code> type.
- *
+ *
* @return BINARY_TRANSFORMPARAMETER
*/
+ @Override
public int getTransformParameterType() {
return BINARY_TRANSFORMPARAMETER;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java
index 1399c6e..1837d0f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterImpl.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
/**
* Default base implementation of <code>TransformParameter</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -36,6 +35,7 @@ public abstract class TransformParameterImpl {
/**
* Sets the URI identifying the <code>TransformParameter</code>.
+ *
* @param uri The URI identifying the <code>TransformParameter</code>.
*/
public void setURI(String uri) {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java
index 77810be..2671623 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformParameterURIImpl.java
@@ -21,26 +21,26 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterURI;
/**
* Default implementation of <code>TransformParameterURI</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class TransformParameterURIImpl
- extends TransformParameterImpl
- implements TransformParameterURI {
+ extends TransformParameterImpl
+ implements TransformParameterURI {
/**
* Gets the type of <code>TransformParameter</code>.
- *
+ *
* @return URI_TRANSFORMPARAMETER
*/
+ @Override
public int getTransformParameterType() {
return URI_TRANSFORMPARAMETER;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java
index 7fcd72c..79fd640 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TransformPatameterHashImpl.java
@@ -21,20 +21,19 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlverify.TransformParameterHash;
/**
* Default implementation of <code>TransformParameterHash</code>
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class TransformPatameterHashImpl
- extends TransformParameterImpl
- implements TransformParameterHash {
+ extends TransformParameterImpl
+ implements TransformParameterHash {
/** The method used to calculate the digest value. */
private String digestMethod;
@@ -43,34 +42,38 @@ public class TransformPatameterHashImpl
/**
* Sets method used to calculate the digest value.
+ *
* @param digestMethod The method used to calculate the digest value.
*/
public void setDigestMethod(String digestMethod) {
this.digestMethod = digestMethod;
}
+ @Override
public String getDigestMethod() {
return digestMethod;
}
/**
* Sets the digest value.
- *
+ *
* @param digestValue The digest value.
*/
public void setDigestValue(byte[] digestValue) {
this.digestValue = digestValue;
}
-
+
+ @Override
public byte[] getDigestValue() {
return digestValue;
}
/**
* Gets the type of <code>TransformParameter</code>.
- *
+ *
* @return HASH_TRANSFORMPARAMETER
*/
+ @Override
public int getTransformParameterType() {
return HASH_TRANSFORMPARAMETER;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TslInfosImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TslInfosImpl.java
index fad42e6..26905c2 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TslInfosImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/TslInfosImpl.java
@@ -8,55 +8,55 @@ import at.gv.egovernment.moa.spss.api.common.TslInfos;
public class TslInfosImpl implements TslInfos {
- private String tslServiceTypeIdentifier;
- private String tslServiceTypeStatus;
- private List<String> tslServiceQualifier = new ArrayList<String>();
- private List<String> tslAdditionalServiceInformation = new ArrayList<String>();
- private String tslCountry;
-
- public TslInfosImpl(String country, String tslServiceTypeStatus, String tslServiceTypeIdentifier,
- List<URI> tslCertificateQualifier, List<String> additionalServiceInformation) {
- this.tslCountry = country;
- this.tslServiceTypeStatus = tslServiceTypeStatus;
- this.tslServiceTypeIdentifier = tslServiceTypeIdentifier;
-
- if (tslCertificateQualifier != null) {
- for (URI el : tslCertificateQualifier)
- this.tslServiceQualifier.add(el.toString());
-
- }
-
- if (additionalServiceInformation != null)
- this.tslAdditionalServiceInformation.addAll(additionalServiceInformation);
-
- }
-
-
- @Override
- public String getTslIssuerCountry() {
- return tslCountry;
- }
-
- @Override
- public String getServiceTypeStatus() {
- return tslServiceTypeStatus;
- }
-
- @Override
- public String getServiceTypeIdentifier() {
- return tslServiceTypeIdentifier;
- }
-
- @Override
- public List<String> getQualifiers() {
- return tslServiceQualifier;
- }
-
-
- @Override
- public List<String> getAdditionalServiceInformation() {
- return this.tslAdditionalServiceInformation;
-
- }
+ private final String tslServiceTypeIdentifier;
+ private final String tslServiceTypeStatus;
+ private final List<String> tslServiceQualifier = new ArrayList<>();
+ private final List<String> tslAdditionalServiceInformation = new ArrayList<>();
+ private final String tslCountry;
+
+ public TslInfosImpl(String country, String tslServiceTypeStatus, String tslServiceTypeIdentifier,
+ List<URI> tslCertificateQualifier, List<String> additionalServiceInformation) {
+ this.tslCountry = country;
+ this.tslServiceTypeStatus = tslServiceTypeStatus;
+ this.tslServiceTypeIdentifier = tslServiceTypeIdentifier;
+
+ if (tslCertificateQualifier != null) {
+ for (final URI el : tslCertificateQualifier) {
+ this.tslServiceQualifier.add(el.toString());
+ }
+
+ }
+
+ if (additionalServiceInformation != null) {
+ this.tslAdditionalServiceInformation.addAll(additionalServiceInformation);
+ }
+
+ }
+
+ @Override
+ public String getTslIssuerCountry() {
+ return tslCountry;
+ }
+
+ @Override
+ public String getServiceTypeStatus() {
+ return tslServiceTypeStatus;
+ }
+
+ @Override
+ public String getServiceTypeIdentifier() {
+ return tslServiceTypeIdentifier;
+ }
+
+ @Override
+ public List<String> getQualifiers() {
+ return tslServiceQualifier;
+ }
+
+ @Override
+ public List<String> getAdditionalServiceInformation() {
+ return this.tslAdditionalServiceInformation;
+
+ }
}
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 e16717d..f041835 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
@@ -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;
@@ -32,12 +31,12 @@ import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest;
/**
* Default implementation of <code>VerifyCMSSignatureRequest</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class VerifyCMSSignatureRequestImpl
- implements VerifyCMSSignatureRequest {
+ implements VerifyCMSSignatureRequest {
/** The indexes of the signatories whose signature should be verified. */
private int[] signatories;
@@ -49,39 +48,42 @@ public class VerifyCMSSignatureRequestImpl
private InputStream cmsSignature;
/** The date for which to verify the signature. */
private Date dateTime;
-
+
private boolean pdf = false;
private boolean extended = false;
/**
* Sets the indexes of the signatories whose signature should be verified.
- *
- * @param signatories The indexes of the signatories whose signature should be
- * verified.
+ *
+ * @param signatories The indexes of the signatories whose signature should be
+ * verified.
*/
public void setSignatories(int[] signatories) {
this.signatories = signatories;
}
+ @Override
public int[] getSignatories() {
return signatories;
}
/**
* Sets the date for which to verify the signature.
- *
+ *
* @param dateTime The date for which to verify the signature.
*/
public void setDateTime(Date dateTime) {
this.dateTime = dateTime;
}
+ @Override
public Date getDateTime() {
return dateTime;
}
/**
* Sets the CMS signature to verify.
+ *
* @param signature The CMS signature to verify.
*/
public void setCMSSignature(InputStream signature) {
@@ -89,48 +91,55 @@ public class VerifyCMSSignatureRequestImpl
}
+ @Override
public InputStream getCMSSignature() {
return cmsSignature;
}
/**
* Sets the data object necessary for signature verification.
+ *
* @param dataObject The data object necessary for signature verification.
*/
public void setDataObject(CMSDataObject dataObject) {
this.dataObject = dataObject;
}
+ @Override
public CMSDataObject getDataObject() {
return dataObject;
}
/**
* Sets the profile ID of trusted certificates.
+ *
* @param trustProfileId The profile ID of trusted certificates.
*/
public void setTrustProfileId(String trustProfileId) {
this.trustProfileId = trustProfileId;
}
+ @Override
public String getTrustProfileId() {
return trustProfileId;
}
public void setPDF(boolean value) {
- this.pdf = value;
+ this.pdf = value;
}
-
+
+ @Override
public boolean isPDF() {
- return this.pdf;
+ return this.pdf;
}
-public synchronized boolean isExtended() {
- return extended;
-}
+ @Override
+ public synchronized boolean isExtended() {
+ return extended;
+ }
-public synchronized void setExtended(boolean extended) {
- this.extended = 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/VerifyCMSSignatureResponseElementImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java
index 9b7881c..f9e8e4d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSignatureResponseElementImpl.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.List;
@@ -33,12 +32,12 @@ import at.gv.egovernment.moa.spss.api.common.SignerInfo;
/**
* Default implementation of <code>VerifyCMSSignatureResponseElement</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class VerifyCMSSignatureResponseElementImpl
- implements VerifyCMSSignatureResponseElement {
+ implements VerifyCMSSignatureResponseElement {
/** Information about the signer certificate. */
private SignerInfo signerInfo;
@@ -46,65 +45,102 @@ public class VerifyCMSSignatureResponseElementImpl
private CheckResult signatureCheck;
/** Information about the certificate check. */
private CheckResult certificateCheck;
-
+
private ExtendedCertificateCheckResult extendedResult;
-
+
private List adesResults = null;
-
+
+ private String usedAlgorithm = null;
+
+ private Boolean coversFullDocument = null;
+
+ private int[] byteRangeOfSignature = null;
+
/**
* Sets a SignerInfo element according to CMS.
- *
+ *
* @param signerInfo The SignerInfo element according to CMS.
*/
public void setSignerInfo(SignerInfo signerInfo) {
this.signerInfo = signerInfo;
}
+ @Override
public SignerInfo getSignerInfo() {
return signerInfo;
}
/**
* Sets a result of the signature verification.
- *
+ *
* @param signatureCheck The result of the signature verification.
*/
public void setSignatureCheck(CheckResult signatureCheck) {
this.signatureCheck = signatureCheck;
}
+ @Override
public CheckResult getSignatureCheck() {
return signatureCheck;
}
/**
* Sets a result of the certificate verification.
- *
+ *
* @param certificateCheck The result of the certificate verification.
*/
public void setCertificateCheck(CheckResult certificateCheck) {
this.certificateCheck = certificateCheck;
}
+ @Override
public CheckResult getCertificateCheck() {
return certificateCheck;
}
public void setAdESFormResults(List adesResults) {
- this.adesResults = adesResults;
+ this.adesResults = adesResults;
}
-
+
+ @Override
public List getAdESFormResults() {
- return adesResults;
+ return adesResults;
}
public void setExtendedCertificateCheck(ExtendedCertificateCheckResult r) {
- this.extendedResult = r;
- }
-
- @Override
- public ExtendedCertificateCheckResult getExtendedCertificateCheck() {
- return extendedResult;
- }
-
+ this.extendedResult = r;
+ }
+
+ @Override
+ public ExtendedCertificateCheckResult getExtendedCertificateCheck() {
+ return extendedResult;
+ }
+
+ @Override
+ public String getSignatureAlgorithm() {
+ return usedAlgorithm;
+ }
+
+ public void setSignatureAlgorithm(String usedAlgorithm) {
+ this.usedAlgorithm = usedAlgorithm;
+ }
+
+ @Override
+ public Boolean getCoversFullDocument() {
+ return coversFullDocument;
+ }
+
+ public void setCoversFullDocument(Boolean coversFullDocument) {
+ this.coversFullDocument = coversFullDocument;
+ }
+
+ @Override
+ public int[] getByteRangeOfSignature() {
+ return byteRangeOfSignature;
+ }
+
+ public void setByteRangeOfSignature(int[] byteRangeOfSignature) {
+ this.byteRangeOfSignature = byteRangeOfSignature;
+ }
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java
index 44fb474..c7fd29f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyCMSSinatureResponseImpl.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;
@@ -32,28 +31,29 @@ import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse;
/**
* Default implementation of <code>VerifyCMSSignatureResponse</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class VerifyCMSSinatureResponseImpl
- implements VerifyCMSSignatureResponse {
+ implements VerifyCMSSignatureResponse {
/** The elements contained in the response. */
private List responseElements;
/**
* Sets the elements contained in the response.
- *
+ *
* @param responseElements The elements contained in the response.
*/
public void setResponseElements(List responseElements) {
this.responseElements =
- responseElements != null
- ? Collections.unmodifiableList(new ArrayList(responseElements))
- : null;
+ responseElements != null
+ ? Collections.unmodifiableList(new ArrayList(responseElements))
+ : null;
}
+ @Override
public List getResponseElements() {
return responseElements;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java
index d022ae4..f8ab10d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureInfoImpl.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 at.gv.egovernment.moa.spss.api.common.Content;
@@ -30,7 +29,7 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureLocation;
/**
* Default implementation of <code>VerifySignatureInfo</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -42,28 +41,29 @@ public class VerifySignatureInfoImpl implements VerifySignatureInfo {
/**
* Sets the location of the signature to be verified.
- *
- * @param verifySignatureLocation The location of the signature to be
- * verified.
+ *
+ * @param verifySignatureLocation The location of the signature to be verified.
*/
public void setVerifySignatureLocation(VerifySignatureLocation verifySignatureLocation) {
this.verifySignatureLocation = verifySignatureLocation;
}
+ @Override
public VerifySignatureLocation getVerifySignatureLocation() {
return verifySignatureLocation;
}
/**
* Sets the signature environment containing the signature to be verified.
- *
- * @param verifySignatureEnvironment The signature environment containing the
- * signature to be verified.
+ *
+ * @param verifySignatureEnvironment The signature environment containing the
+ * signature to be verified.
*/
public void setVerifySignatureEnvironment(Content verifySignatureEnvironment) {
this.verifySignatureEnvironment = verifySignatureEnvironment;
}
+ @Override
public Content getVerifySignatureEnvironment() {
return verifySignatureEnvironment;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java
index 8e183bb..7f3b381 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifySignatureLocationImpl.java
@@ -21,19 +21,18 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureLocation;
/**
* Default implementation of <code>VerifySignatureLocation</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class VerifySignatureLocationImpl
- extends ElementSelectorImpl
- implements VerifySignatureLocation {
+ extends ElementSelectorImpl
+ implements VerifySignatureLocation {
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java
index 25b5c39..d1eebca 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsDataImpl.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;
@@ -32,7 +31,7 @@ import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo;
/**
* Default implementation of <codeReferenceInfo</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -42,18 +41,19 @@ public class VerifyTransformsDataImpl implements ReferenceInfo {
/**
* Sets the information about the transformations contained in the signature.
- *
+ *
* @param verifyTransformsInfoProfiles The profiles containing transformation
- * information.
+ * information.
*/
public void setVerifyTransformsInfoProfiles(List verifyTransformsInfoProfiles) {
this.verifyTransformsInfoProfiles =
- verifyTransformsInfoProfiles != null
- ? Collections.unmodifiableList(
- new ArrayList(verifyTransformsInfoProfiles))
- : null;
+ verifyTransformsInfoProfiles != null
+ ? Collections.unmodifiableList(
+ new ArrayList(verifyTransformsInfoProfiles))
+ : null;
}
+ @Override
public List getVerifyTransformsInfoProfiles() {
return verifyTransformsInfoProfiles;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java
index 2ce5f39..0e1e46e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileExplicitImpl.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;
@@ -32,12 +31,12 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileExpli
/**
* Default implementation of <code>VerifyTransformsInfoProfileExplicit</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class VerifyTransformsInfoProfileExplicitImpl
- implements VerifyTransformsInfoProfileExplicit {
+ implements VerifyTransformsInfoProfileExplicit {
/** The transforms contained in this profile. */
private List transforms;
@@ -46,38 +45,41 @@ public class VerifyTransformsInfoProfileExplicitImpl
/**
* Sets the transforms contained in this profile.
- *
+ *
* @param transforms The transforms contained in this profile.
*/
public void setTransforms(List transforms) {
this.transforms =
- transforms != null
- ? Collections.unmodifiableList(new ArrayList(transforms))
- : null;
+ transforms != null
+ ? Collections.unmodifiableList(new ArrayList(transforms))
+ : null;
}
+ @Override
public List getTransforms() {
return transforms;
}
/**
* Sets additional information for the transforms.
- *
+ *
* @param transformParameters Additional information for the transforms.
*/
public void setTransformParameters(List transformParameters) {
this.transformParameters = new ArrayList(transformParameters);
}
+ @Override
public List getTransformParameters() {
return transformParameters;
}
/**
* Gets the type of <code>VerifyTransformsInfoProfile</code>.
- *
+ *
* @return EXPLICIT_VERIFYTRANSFORMSINFOPROFILE
*/
+ @Override
public int getVerifyTransformsInfoProfileType() {
return EXPLICIT_VERIFYTRANSFORMSINFOPROFILE;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java
index a545535..56fc9e2 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyTransformsInfoProfileIDImpl.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.impl;
import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileID;
/**
* Default implementation of <code>VerifyTransformsInfoProfileID</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -39,22 +38,24 @@ public class VerifyTransformsInfoProfileIDImpl implements VerifyTransformsInfoPr
/**
* Sets the profile ID.
- *
+ *
* @param profileID The profile ID.
*/
public void setVerifyTransformsInfoProfileID(String profileID) {
this.verifyTransformsInfoProfileID = profileID;
}
+ @Override
public String getVerifyTransformsInfoProfileID() {
return verifyTransformsInfoProfileID;
}
/**
* Gets the type of <code>VerifyTransformsInfoProfile</code>.
- *
+ *
* @return ID_VERIFYTRANSFORMSINFOPROFILE
*/
+ @Override
public int getVerifyTransformsInfoProfileType() {
return ID_VERIFYTRANSFORMSINFOPROFILE;
}
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 91d1917..b5094b4 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
@@ -34,118 +34,120 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest;
/**
* Default implementation of <code>VerifyXMLSignatureRequest</code>.
- *
+ *
* @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;
- 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;
- }
+ /** 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;
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ 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/impl/VerifyXMLSignatureResponseImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java
index 60ac3be..85af8d4 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/VerifyXMLSignatureResponseImpl.java
@@ -39,154 +39,168 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse;
*/
public class VerifyXMLSignatureResponseImpl implements VerifyXMLSignatureResponse {
- /** Information about the signer certificate. */
- private SignerInfo signerInfo;
-
- private ExtendedCertificateCheckResult extendedResult;
-
- /**
- * The hash input data objects. The list consists of
- * {@link at.gv.egovernment.moa.spss.api.common.InputData}s.
- */
- private List hashInputDatas = new ArrayList();
-
- /**
- * The reference input data objects. The list consists of
- * {@link at.gv.egovernment.moa.spss.api.common.InputData}s.
- */
- private List referenceInputDatas = new ArrayList();
-
- /**
- * The list of form validation results
- */
- private List adesFormResults = new ArrayList();
-
- /** Information about the signature check. */
- private ReferencesCheckResult signatureCheck;
- /** Information about the signature manifest check. */
- private ReferencesCheckResult signatureManifestCheck;
- /** Information about the XMLDsig manifest check. */
- private List xmlDsigManifestChecks = new ArrayList();
- /** Information about the certificate check. */
- private CheckResult certificateCheck;
-
- /**
- * Sets information about the signer certificate.
- *
- * @param signerInfo
- * Information about the signer certificate.
- */
- public void setSignerInfo(SignerInfo signerInfo) {
- this.signerInfo = signerInfo;
- }
-
- public SignerInfo getSignerInfo() {
- return signerInfo;
- }
-
- /**
- * Sets data signed by the signatory.
- *
- * @param hashInputDatas
- * The signed datas.
- */
- public void setHashInputDatas(List hashInputDatas) {
- this.hashInputDatas = hashInputDatas != null ? Collections.unmodifiableList(new ArrayList(hashInputDatas))
- : null;
- }
-
- public List getHashInputDatas() {
- return hashInputDatas;
- }
-
- /**
- * Sets the source data elements.
- *
- * @param referenceInputDatas
- * The source data elements.
- */
- public void setReferenceInputDatas(List referenceInputDatas) {
- this.referenceInputDatas = referenceInputDatas != null
- ? Collections.unmodifiableList(new ArrayList(referenceInputDatas)) : null;
- }
-
- public List getReferenceInputDatas() {
- return referenceInputDatas;
- }
-
- /**
- * Sets the result of the signature verification.
- *
- * @param signatureCheck
- * The result of the signature verification.
- */
- public void setSignatureCheck(ReferencesCheckResult signatureCheck) {
- this.signatureCheck = signatureCheck;
- }
-
- public ReferencesCheckResult getSignatureCheck() {
- return signatureCheck;
- }
-
- /**
- * Sets the result of the signature manifest verification.
- *
- * @param signatureManifestCheck
- * The result of the signature manifest verification.
- */
- public void setSignatureManifestCheck(ReferencesCheckResult signatureManifestCheck) {
- this.signatureManifestCheck = signatureManifestCheck;
- }
-
- public ReferencesCheckResult getSignatureManifestCheck() {
- return signatureManifestCheck;
- }
-
- /**
- * Sets the result of the certification verification.
- *
- * @param certificateCheck
- * The result of the certificate verification.
- */
- public void setCertificateCheck(CheckResult certificateCheck) {
- this.certificateCheck = certificateCheck;
- }
-
- public CheckResult getCertificateCheck() {
- return certificateCheck;
- }
-
- /**
- * Sets the XMLDSigManifestChecks.
- *
- * @param xmlDsigManifestChecks
- * The XMLDSigManifestChecks.
- */
- public void setXMLDsigManifestChecks(List xmlDsigManifestChecks) {
- this.xmlDsigManifestChecks = xmlDsigManifestChecks != null
- ? Collections.unmodifiableList(new ArrayList(xmlDsigManifestChecks)) : null;
- }
-
- public List getXMLDsigManifestChecks() {
- return xmlDsigManifestChecks;
- }
-
- public void setAdESFormResults(List adesFormResults) {
- this.adesFormResults = adesFormResults;
- }
-
- @Override
- public List getAdESFormResults() {
- return this.adesFormResults;
- }
-
- public void setExtendedCertificateCheck(ExtendedCertificateCheckResult r) {
- this.extendedResult = r;
- }
-
- @Override
- public ExtendedCertificateCheckResult getExtendedCertificateCheck() {
- return extendedResult;
- }
+ /** Information about the signer certificate. */
+ private SignerInfo signerInfo;
+
+ private ExtendedCertificateCheckResult extendedResult;
+
+ /**
+ * The hash input data objects. The list consists of
+ * {@link at.gv.egovernment.moa.spss.api.common.InputData}s.
+ */
+ private List hashInputDatas = new ArrayList();
+
+ /**
+ * The reference input data objects. The list consists of
+ * {@link at.gv.egovernment.moa.spss.api.common.InputData}s.
+ */
+ private List referenceInputDatas = new ArrayList();
+
+ /**
+ * The list of form validation results
+ */
+ private List adesFormResults = new ArrayList();
+
+ /** Information about the signature check. */
+ private ReferencesCheckResult signatureCheck;
+ /** Information about the signature manifest check. */
+ private ReferencesCheckResult signatureManifestCheck;
+ /** Information about the XMLDsig manifest check. */
+ private List xmlDsigManifestChecks = new ArrayList();
+ /** Information about the certificate check. */
+ private CheckResult certificateCheck;
+
+ private String signatureAlgorithm = null;
+
+ /**
+ * Sets information about the signer certificate.
+ *
+ * @param signerInfo Information about the signer certificate.
+ */
+ public void setSignerInfo(SignerInfo signerInfo) {
+ this.signerInfo = signerInfo;
+ }
+
+ @Override
+ public SignerInfo getSignerInfo() {
+ return signerInfo;
+ }
+
+ /**
+ * Sets data signed by the signatory.
+ *
+ * @param hashInputDatas The signed datas.
+ */
+ public void setHashInputDatas(List hashInputDatas) {
+ this.hashInputDatas = hashInputDatas != null ? Collections.unmodifiableList(new ArrayList(hashInputDatas))
+ : null;
+ }
+
+ @Override
+ public List getHashInputDatas() {
+ return hashInputDatas;
+ }
+
+ /**
+ * Sets the source data elements.
+ *
+ * @param referenceInputDatas The source data elements.
+ */
+ public void setReferenceInputDatas(List referenceInputDatas) {
+ this.referenceInputDatas = referenceInputDatas != null
+ ? Collections.unmodifiableList(new ArrayList(referenceInputDatas))
+ : null;
+ }
+
+ @Override
+ public List getReferenceInputDatas() {
+ return referenceInputDatas;
+ }
+
+ /**
+ * Sets the result of the signature verification.
+ *
+ * @param signatureCheck The result of the signature verification.
+ */
+ public void setSignatureCheck(ReferencesCheckResult signatureCheck) {
+ this.signatureCheck = signatureCheck;
+ }
+
+ @Override
+ public ReferencesCheckResult getSignatureCheck() {
+ return signatureCheck;
+ }
+
+ /**
+ * Sets the result of the signature manifest verification.
+ *
+ * @param signatureManifestCheck The result of the signature manifest
+ * verification.
+ */
+ public void setSignatureManifestCheck(ReferencesCheckResult signatureManifestCheck) {
+ this.signatureManifestCheck = signatureManifestCheck;
+ }
+
+ @Override
+ public ReferencesCheckResult getSignatureManifestCheck() {
+ return signatureManifestCheck;
+ }
+
+ /**
+ * Sets the result of the certification verification.
+ *
+ * @param certificateCheck The result of the certificate verification.
+ */
+ public void setCertificateCheck(CheckResult certificateCheck) {
+ this.certificateCheck = certificateCheck;
+ }
+
+ @Override
+ public CheckResult getCertificateCheck() {
+ return certificateCheck;
+ }
+
+ /**
+ * Sets the XMLDSigManifestChecks.
+ *
+ * @param xmlDsigManifestChecks The XMLDSigManifestChecks.
+ */
+ public void setXMLDsigManifestChecks(List xmlDsigManifestChecks) {
+ this.xmlDsigManifestChecks = xmlDsigManifestChecks != null
+ ? Collections.unmodifiableList(new ArrayList(xmlDsigManifestChecks))
+ : null;
+ }
+
+ @Override
+ public List getXMLDsigManifestChecks() {
+ return xmlDsigManifestChecks;
+ }
+
+ public void setAdESFormResults(List adesFormResults) {
+ this.adesFormResults = adesFormResults;
+ }
+
+ @Override
+ public List getAdESFormResults() {
+ return this.adesFormResults;
+ }
+
+ public void setExtendedCertificateCheck(ExtendedCertificateCheckResult r) {
+ this.extendedResult = r;
+ }
+
+ @Override
+ public ExtendedCertificateCheckResult getExtendedCertificateCheck() {
+ return extendedResult;
+ }
+
+ @Override
+ public String getSignatureAlgorithm() {
+ return signatureAlgorithm;
+ }
+
+ public void setSignatureAlgorithm(String signatureAlgorithm) {
+ this.signatureAlgorithm = signatureAlgorithm;
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java
index aff7e10..ac2886c 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/X509IssuerSerialImpl.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.math.BigInteger;
@@ -30,7 +29,7 @@ import at.gv.egovernment.moa.spss.api.common.X509IssuerSerial;
/**
* Default implementation of <code>X509IssuerSerial</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -42,26 +41,28 @@ public class X509IssuerSerialImpl implements X509IssuerSerial {
/**
* Sets the issuer distinguished name.
- *
+ *
* @param x509IssuerName The issuer distinguished name.
*/
public void setX509IssuerName(String x509IssuerName) {
this.x509IssuerName = x509IssuerName;
}
+ @Override
public String getX509IssuerName() {
return x509IssuerName;
}
/**
* Sets the certificate serial number.
- *
+ *
* @param x509SerialNumber The issuer serial number.
*/
public void setX509SerialNumber(BigInteger x509SerialNumber) {
this.x509SerialNumber = x509SerialNumber;
}
+ @Override
public BigInteger getX509SerialNumber() {
return x509SerialNumber;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java
index dabf29d..7769e5a 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XMLDataObjectAssociationImpl.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 at.gv.egovernment.moa.spss.api.common.Content;
@@ -30,7 +29,7 @@ import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation;
/**
* Default implementation of <code>XMLDataObjectAssociation</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -43,25 +42,28 @@ public class XMLDataObjectAssociationImpl implements XMLDataObjectAssociation {
/**
* Sets meta information about the <code>Content</code> object.
+ *
* @param metaInfo Meta information about the <code>Content</code> object.
*/
public void setMetaInfo(MetaInfo metaInfo) {
this.metaInfo = metaInfo;
}
+ @Override
public MetaInfo getMetaInfo() {
return metaInfo;
}
/**
* Sets the actual data contained in this object.
- *
+ *
* @param content The actual data contained in this object.
*/
public void setContent(Content content) {
this.content = content;
}
+ @Override
public Content getContent() {
return content;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java
index 175de3a..9eb4df1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilter2TransformImpl.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;
@@ -31,17 +30,17 @@ import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform;
/**
* Default implementation of <code>XPathFilter2Transform</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class XPathFilter2TransformImpl
- extends TransformImpl
- implements XPathFilter2Transform {
-
+ extends TransformImpl
+ implements XPathFilter2Transform {
+
/** The XPath filters. */
private List filters;
-
+
/**
* Create a new <code>XPathFilter2TransformImpl</code> object.
*/
@@ -50,16 +49,16 @@ public class XPathFilter2TransformImpl
}
/**
- * Sets the XPath filters contained in this
- * <code>XPathFilter2Transform</code>.
- *
- * @param filters The XPath filters contained in this
- * <code>XPathFilter2Transform</code>.
- */
+ * Sets the XPath filters contained in this <code>XPathFilter2Transform</code>.
+ *
+ * @param filters The XPath filters contained in this
+ * <code>XPathFilter2Transform</code>.
+ */
public void setFilters(List filters) {
this.filters = new ArrayList(filters);
}
+ @Override
public List getFilters() {
return filters;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java
index 6615e9f..800270f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathFilterImpl.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.HashMap;
@@ -31,7 +30,7 @@ import at.gv.egovernment.moa.spss.api.common.XPathFilter;
/**
* Default implementation of <code>XPathFilter</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -40,47 +39,51 @@ public class XPathFilterImpl implements XPathFilter {
private String filterType;
/** The XPath expression of the filter. */
private String xPathExpression;
- /** The namespace prefix to URI mapping to while evaluating the XPath
- * expression. */
+ /**
+ * The namespace prefix to URI mapping to while evaluating the XPath expression.
+ */
private Map namespaceDeclarations = new HashMap();
/**
* Sets the type of filter.
- *
+ *
* @param filterType The type of filter.
*/
public void setFilterType(String filterType) {
this.filterType = filterType;
}
+ @Override
public String getFilterType() {
return filterType;
}
/**
* Sets the XPath expression of the filter.
- *
+ *
* @param xPathExpression The XPath expression of the filter.
*/
public void setXPathExpression(String xPathExpression) {
this.xPathExpression = xPathExpression;
}
+ @Override
public String getXPathExpression() {
return xPathExpression;
}
/**
- * Sets the namespace prefix to URI mapping to while evaluating the XPath
+ * Sets the namespace prefix to URI mapping to while evaluating the XPath
* expression.
- *
- * @param namespaceDeclarations The namespace prefix to URI mapping to while
- * evaluating the XPath expression.
+ *
+ * @param namespaceDeclarations The namespace prefix to URI mapping to while
+ * evaluating the XPath expression.
*/
public void setNamespaceDelcarations(Map namespaceDeclarations) {
this.namespaceDeclarations = namespaceDeclarations;
}
+ @Override
public Map getNamespaceDeclarations() {
return namespaceDeclarations;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java
index f626a95..92f7170 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XPathTransformImpl.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.HashMap;
@@ -31,18 +30,19 @@ import at.gv.egovernment.moa.spss.api.common.XPathTransform;
/**
* Default implementation of <code>XPathTransform</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class XPathTransformImpl
- extends TransformImpl
- implements XPathTransform {
-
+ extends TransformImpl
+ implements XPathTransform {
+
/** The XPath expression to evaluate. */
private String xPathExpression;
- /** The namespace prefix to URI mapping to while evaluating the XPath
- * expression. */
+ /**
+ * The namespace prefix to URI mapping to while evaluating the XPath expression.
+ */
private Map namespaceDeclarations = new HashMap();
/**
@@ -54,28 +54,30 @@ public class XPathTransformImpl
/**
* Sets the XPath expression to evaluate.
- *
+ *
* @param xPathExpression The XPath expression to evaluate.
*/
public void setXPathExpression(String xPathExpression) {
this.xPathExpression = xPathExpression;
}
+ @Override
public String getXPathExpression() {
return xPathExpression;
}
/**
- * Sets the namespace prefix to URI mapping to while evaluating the XPath
+ * Sets the namespace prefix to URI mapping to while evaluating the XPath
* expression.
- *
- * @param namespaceDeclarations The namespace prefix to URI mapping to while
- * evaluating the XPath expression.
+ *
+ * @param namespaceDeclarations The namespace prefix to URI mapping to while
+ * evaluating the XPath expression.
*/
public void setNamespaceDelcarations(Map namespaceDeclarations) {
this.namespaceDeclarations = namespaceDeclarations;
}
+ @Override
public Map getNamespaceDeclarations() {
return namespaceDeclarations;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java
index 3fd4cc1..5995c73 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/XSLTransformImpl.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 org.w3c.dom.Element;
@@ -30,14 +29,14 @@ import at.gv.egovernment.moa.spss.api.common.XSLTTransform;
/**
* Default implementation of <code>XSLTTransform</code>.
- *
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
public class XSLTransformImpl extends TransformImpl implements XSLTTransform {
/** The XSLT stylesheet to apply. */
private Element styleSheet;
-
+
/**
* Create a new <code>XSLTransformImpl</code> object.
*/
@@ -47,13 +46,14 @@ public class XSLTransformImpl extends TransformImpl implements XSLTTransform {
/**
* Sets the XSLT stylesheet to apply.
- *
+ *
* @param styleSheet The XSLT stylesheet to apply.
*/
public void setStylesheet(Element styleSheet) {
this.styleSheet = styleSheet;
}
+ @Override
public Element getStylesheet() {
return styleSheet;
}
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 3550c27..579fb51 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
@@ -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.io.InputStream;
@@ -49,7 +48,7 @@ import at.gv.egovernment.moaspss.util.XPathUtils;
/**
* A parser to parse <code>CreateCMSSignatureRequest</code> DOM trees into
* <code>CreateCMSSignatureRequest</code> API objects.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -60,24 +59,23 @@ public class CreateCMSSignatureRequestParser {
//
private static final String MOA = Constants.MOA_PREFIX + ":";
private static final String KEY_IDENTIFIER_XPATH =
- "/" + MOA + "CreateCMSSignatureRequest/" + MOA + "KeyIdentifier";
+ "/" + MOA + "CreateCMSSignatureRequest/" + MOA + "KeyIdentifier";
private static final String SINGLE_SIGNATURE_INFO_XPATH =
- "/" + MOA + "CreateCMSSignatureRequest/" + MOA + "SingleSignatureInfo";
+ "/" + MOA + "CreateCMSSignatureRequest/" + MOA + "SingleSignatureInfo";
private static final String DATA_OBJECT_INFO_XPATH = MOA + "DataObjectInfo";
private static final String DATA_OBJECT_XPATH = MOA + "DataObject";
-
+
private static final String SL_CONFORM_ATTR_NAME = "SecurityLayerConformity";
+ private static final String IS_PADES_SIGNATURE_ATTR_NAME = "PAdESConformity";
private static final String META_INFO_XPATH = MOA + "MetaInfo";
private static final String CONTENT_XPATH = MOA + "Content";
private static final String BASE64_CONTENT_XPATH = MOA + "Base64Content";
private static final String EXCLUDEBYTERANGE_FROM_XPATH = MOA + "ExcludedByteRange/" + MOA + "From";
private static final String EXCLUDEBYTERANGE_TO_XPATH = MOA + "ExcludedByteRange/" + MOA + "To";
-
-
/** The factory to create API objects. */
- private SPSSFactory factory;
+ private final SPSSFactory factory;
/**
* Create a new <code>CreateCMSSignatureRequestParser</code>.
@@ -87,44 +85,43 @@ public class CreateCMSSignatureRequestParser {
}
/**
- * Parse a <code>CreateCMSSignatureRequest</code> DOM element, as defined
- * by the MOA schema.
- *
+ * Parse a <code>CreateCMSSignatureRequest</code> DOM element, as defined by the
+ * MOA schema.
+ *
* @param requestElem The <code>CreateCMSSignatureRequest</code> to parse. The
- * request must have been successfully parsed against the schema for this
- * method to succeed.
- * @return A <code>CreateCMSSignatureRequest</code> API object containing
- * the data from the DOM element.
+ * request must have been successfully parsed against the
+ * schema for this method to succeed.
+ * @return A <code>CreateCMSSignatureRequest</code> API object containing the
+ * data from the DOM element.
* @throws MOAApplicationException An error occurred parsing the request.
*/
public CreateCMSSignatureRequest parse(Element requestElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- List singleSignatureInfos = parseSingleSignatureInfos(requestElem);
- String keyIdentifier =
- XPathUtils.getElementValue(requestElem, KEY_IDENTIFIER_XPATH, null);
+ final List singleSignatureInfos = parseSingleSignatureInfos(requestElem);
+ final String keyIdentifier =
+ XPathUtils.getElementValue(requestElem, KEY_IDENTIFIER_XPATH, null);
return factory.createCreateCMSSignatureRequest(
- keyIdentifier,
- singleSignatureInfos);
+ keyIdentifier,
+ singleSignatureInfos);
}
/**
- * Parse all <code>SingleSignatureInfo</code> elements of the
+ * Parse all <code>SingleSignatureInfo</code> elements of the
* <code>CreateCMSSignatureRequest</code>.
- *
+ *
* @param requestElem The <code>CreateCMSSignatureRequest</code> to parse.
- * @return A <code>List</code> of <code>SingleSignatureInfo</code> API
- * objects.
- * @throws MOAApplicationException An error occurred parsing on of the
- * <code>SingleSignatureInfo</code> elements.
+ * @return A <code>List</code> of <code>SingleSignatureInfo</code> API objects.
+ * @throws MOAApplicationException An error occurred parsing on of the
+ * <code>SingleSignatureInfo</code> elements.
*/
private List parseSingleSignatureInfos(Element requestElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- List singleSignatureInfos = new ArrayList();
- NodeIterator sigInfoElems =
- XPathUtils.selectNodeIterator(requestElem, SINGLE_SIGNATURE_INFO_XPATH);
+ final List singleSignatureInfos = new ArrayList();
+ final NodeIterator sigInfoElems =
+ XPathUtils.selectNodeIterator(requestElem, SINGLE_SIGNATURE_INFO_XPATH);
Element sigInfoElem;
while ((sigInfoElem = (Element) sigInfoElems.nextNode()) != null) {
@@ -136,126 +133,130 @@ public class CreateCMSSignatureRequestParser {
/**
* Parse a <code>SingleSignatureInfo</code> DOM element.
- *
- * @param sigInfoElem The <code>SingleSignatureInfo</code> DOM element to
- * parse.
- * @return A <code>SingleSignatureInfo</code> API object containing the
- * information of <code>sigInfoElem</code>.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>SingleSignatureInfo</code>.
+ *
+ * @param sigInfoElem The <code>SingleSignatureInfo</code> DOM element to parse.
+ * @return A <code>SingleSignatureInfo</code> API object containing the
+ * information of <code>sigInfoElem</code>.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>SingleSignatureInfo</code>.
*/
private SingleSignatureInfo parseSingleSignatureInfo(Element sigInfoElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- DataObjectInfo dataObjectInfo = parseDataObjectInfo(sigInfoElem);
+ final DataObjectInfo dataObjectInfo = parseDataObjectInfo(sigInfoElem);
boolean securityLayerConform;
+ boolean isPAdESSignature = false;
if (sigInfoElem.hasAttribute(SL_CONFORM_ATTR_NAME)) {
securityLayerConform =
- BoolUtils.valueOf(sigInfoElem.getAttribute(SL_CONFORM_ATTR_NAME));
+ BoolUtils.valueOf(sigInfoElem.getAttribute(SL_CONFORM_ATTR_NAME));
} else {
securityLayerConform = true;
}
+ if (sigInfoElem.hasAttribute(IS_PADES_SIGNATURE_ATTR_NAME)) {
+ isPAdESSignature = BoolUtils.valueOf(sigInfoElem.getAttribute(IS_PADES_SIGNATURE_ATTR_NAME));
+ }
+
return factory.createSingleSignatureInfoCMS(
- dataObjectInfo,
- securityLayerConform);
+ dataObjectInfo,
+ securityLayerConform,
+ isPAdESSignature);
}
/**
* Parse the <code>DataObjectInfo</code> DOM elements contained in the given
* <code>SingleSignatureInfo</code> DOM element.
- *
- * @param sigInfoElem The <code>SingleSignatureInfo</code> DOM element
- * whose <code>DataObjectInfo</code>s to parse.
+ *
+ * @param sigInfoElem The <code>SingleSignatureInfo</code> DOM element whose
+ * <code>DataObjectInfo</code>s to parse.
* @return A <code>List</code> of <code>DataObjectInfo</code> API objects
- * containing the data from the <code>DataObjectInfo</code> DOM elements.
+ * containing the data from the <code>DataObjectInfo</code> DOM
+ * elements.
* @throws MOAApplicationException An error occurred parsing one of the
- * <code>DataObjectInfo</code>s.
+ * <code>DataObjectInfo</code>s.
*/
private DataObjectInfo parseDataObjectInfo(Element sigInfoElem)
- throws MOAApplicationException {
-
- Element dataObjInfoElem = (Element)XPathUtils.selectSingleNode(sigInfoElem, DATA_OBJECT_INFO_XPATH);
-
- String structure = dataObjInfoElem.getAttribute("Structure");
- Element dataObjectElem =
- (Element) XPathUtils.selectSingleNode(dataObjInfoElem, DATA_OBJECT_XPATH);
-
- CMSDataObject dataObject = parseDataObject(dataObjectElem);
-
- return factory.createDataObjectInfo(
- structure,
- dataObject);
-
- }
-
-
+ throws MOAApplicationException {
+
+ final Element dataObjInfoElem = (Element) XPathUtils.selectSingleNode(sigInfoElem,
+ DATA_OBJECT_INFO_XPATH);
+
+ final String structure = dataObjInfoElem.getAttribute("Structure");
+ final Element dataObjectElem =
+ (Element) XPathUtils.selectSingleNode(dataObjInfoElem, DATA_OBJECT_XPATH);
-
+ final CMSDataObject dataObject = parseDataObject(dataObjectElem);
+
+ return factory.createDataObjectInfo(
+ structure,
+ dataObject);
+
+ }
/**
- * Parse a the <code>DataObject</code> DOM element contained in a given
+ * Parse a the <code>DataObject</code> DOM element contained in a given
* <code>CreateCMSSignatureRequest</code> DOM element.
- *
- * @param requestElem The DataObject DOM element of the <code>VerifyCMSSignatureRequest</code>
- * to parse.
- * @return The <code>CMSDataObject</code> API object containing the data
- * from the <code>DataObject</code> DOM element.
+ *
+ * @param requestElem The DataObject DOM element of the
+ * <code>VerifyCMSSignatureRequest</code> to parse.
+ * @return The <code>CMSDataObject</code> API object containing the data from
+ * the <code>DataObject</code> DOM element.
*/
private CMSDataObject parseDataObject(Element dataObjectElem) {
if (dataObjectElem != null) {
- Element metaInfoElem = (Element) XPathUtils.selectSingleNode(dataObjectElem, META_INFO_XPATH);
+ final Element metaInfoElem = (Element) XPathUtils.selectSingleNode(dataObjectElem, META_INFO_XPATH);
MetaInfo metaInfo = null;
- Element contentElem = (Element) XPathUtils.selectSingleNode(dataObjectElem, CONTENT_XPATH);
- CMSContent content = parseContent(contentElem);
+ final Element contentElem = (Element) XPathUtils.selectSingleNode(dataObjectElem, CONTENT_XPATH);
+ final CMSContent content = parseContent(contentElem);
if (metaInfoElem != null) {
metaInfo = RequestParserUtils.parseMetaInfo(metaInfoElem);
}
- String excludeByteRangeFromStr = XPathUtils.getElementValue(dataObjectElem, EXCLUDEBYTERANGE_FROM_XPATH, null);
- String excludeByteRangeToStr = XPathUtils.getElementValue(dataObjectElem, EXCLUDEBYTERANGE_TO_XPATH, null);
-
+ final String excludeByteRangeFromStr = XPathUtils.getElementValue(dataObjectElem,
+ EXCLUDEBYTERANGE_FROM_XPATH, null);
+ final String excludeByteRangeToStr = XPathUtils.getElementValue(dataObjectElem,
+ EXCLUDEBYTERANGE_TO_XPATH, null);
+
BigDecimal excludeByteRangeFrom = null;
BigDecimal excludeByteRangeTo = null;
-
- if (excludeByteRangeFromStr != null)
- excludeByteRangeFrom = new BigDecimal(excludeByteRangeFromStr);
- if (excludeByteRangeToStr != null)
- excludeByteRangeTo = new BigDecimal(excludeByteRangeToStr);
-
+
+ if (excludeByteRangeFromStr != null) {
+ excludeByteRangeFrom = new BigDecimal(excludeByteRangeFromStr);
+ }
+ if (excludeByteRangeToStr != null) {
+ excludeByteRangeTo = new BigDecimal(excludeByteRangeToStr);
+ }
+
return factory.createCMSDataObject(metaInfo, content, excludeByteRangeFrom, excludeByteRangeTo);
- }
- else {
+ } else {
return null;
}
}
-
-
- /**
- * Parse the content contained in a <code>CMSContentBaseType</code> kind of
- * DOM element.
- *
- * @param contentElem The <code>CMSContentBaseType</code> kind of element to
- * parse.
- * @return A <code>CMSDataObject</code> API object containing the data
- * from the given DOM element.
- */
- private CMSContent parseContent(Element contentElem) {
- Element base64ContentElem =
+ /**
+ * Parse the content contained in a <code>CMSContentBaseType</code> kind of DOM
+ * element.
+ *
+ * @param contentElem The <code>CMSContentBaseType</code> kind of element to
+ * parse.
+ * @return A <code>CMSDataObject</code> API object containing the data from the
+ * given DOM element.
+ */
+ private CMSContent parseContent(Element contentElem) {
+ final Element base64ContentElem =
(Element) XPathUtils.selectSingleNode(contentElem, BASE64_CONTENT_XPATH);
- if (base64ContentElem != null) {
- String base64Str = DOMUtils.getText(base64ContentElem);
- InputStream binaryContent = Base64Utils.decodeToStream(base64Str, true);
- return factory.createCMSContent(binaryContent);
- } else {
- return factory.createCMSContent(
+ if (base64ContentElem != null) {
+ final String base64Str = DOMUtils.getText(base64ContentElem);
+ final InputStream binaryContent = Base64Utils.decodeToStream(base64Str, true);
+ return factory.createCMSContent(binaryContent);
+ } else {
+ return factory.createCMSContent(
contentElem.getAttribute("Reference"));
- }
- }
+ }
+ }
} \ No newline at end of file
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 d808f2b..12b408b 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
@@ -21,14 +21,10 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlbind;
-import java.io.IOException;
import java.util.Iterator;
-import javax.xml.transform.TransformerException;
-
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -37,102 +33,108 @@ import at.gv.egovernment.moa.spss.api.cmssign.CMSSignatureResponse;
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.moaspss.util.Constants;
-import at.gv.egovernment.moaspss.util.DOMUtils;
/**
- * Convert a <code>CreateCMSSignatureResponse</code> API object into its
- * XML representation, according to the MOA XML schema.
- *
+ * Convert a <code>CreateCMSSignatureResponse</code> API object into its XML
+ * representation, according to the MOA XML schema.
+ *
* @version $Id$
*/
public class CreateCMSSignatureResponseBuilder {
private static final String MOA_NS_URI = Constants.MOA_NS_URI;
/** The XML document containing the response element. */
- private Document responseDoc;
+ private final Document responseDoc;
/** The response <code>CreateCMSSignatureResponse</code> DOM element. */
- private Element responseElem;
+ private final Element responseElem;
/**
* Create a new <code>CreateCMSSignatureResponseBuilder</code>:
- *
- * @throws MOASystemException An error occurred setting up the resulting
- * XML document.
+ *
+ * @throws MOASystemException An error occurred setting up the resulting XML
+ * document.
*/
public CreateCMSSignatureResponseBuilder() throws MOASystemException {
responseDoc =
- ResponseBuilderUtils.createResponse("CreateCMSSignatureResponse");
+ ResponseBuilderUtils.createResponse("CreateCMSSignatureResponse");
responseElem = responseDoc.getDocumentElement();
}
/**
- * Build a document containing a <code>CreateCMSSignatureResponse</code>
- * DOM element being the XML representation of the given
+ * Build a document containing a <code>CreateCMSSignatureResponse</code> DOM
+ * element being the XML representation of the given
* <code>CreateCMSSignatureResponse</code> API object.
- *
- * @param response The <code>CreateCMSSignatureResponse</code> to convert
- * to XML.
- * @return A document containing the <code>CreateCMSSignatureResponse</code>
- * DOM element.
+ *
+ * @param response The <code>CreateCMSSignatureResponse</code> to convert to
+ * XML.
+ * @return A document containing the <code>CreateCMSSignatureResponse</code> DOM
+ * element.
*/
public Document build(CreateCMSSignatureResponse response) {
Iterator iter;
-
for (iter = response.getResponseElements().iterator(); iter.hasNext();) {
- CreateCMSSignatureResponseElement responseElement =
- (CreateCMSSignatureResponseElement) iter.next();
-
- switch (responseElement.getResponseType()) {
- case CreateCMSSignatureResponseElement.CMS_SIGNATURE :
- CMSSignatureResponse cmsSignatureResponse = (CMSSignatureResponse) responseElement;
- addCMSSignature(cmsSignatureResponse);
- break;
-
- case CreateCMSSignatureResponseElement.ERROR_RESPONSE :
- ErrorResponse errorResponse = (ErrorResponse) responseElement;
- addErrorResponse(errorResponse);
- break;
+
+ final Object responseObj = iter.next();
+
+ if (responseObj instanceof ErrorResponse) {
+ final ErrorResponse errorResponse = (ErrorResponse) responseObj;
+ addErrorResponse(errorResponse);
+
+ } else if (responseObj instanceof CreateCMSSignatureResponseElement) {
+ final CMSSignatureResponse cmsSignatureResponse = (CMSSignatureResponse) responseObj;
+ addCMSSignature(cmsSignatureResponse);
+
}
+// CreateCMSSignatureResponseElement responseElement =
+// (CreateCMSSignatureResponseElement) iter.next();
+//
+// switch (responseElement.getResponseType()) {
+// case CreateCMSSignatureResponseElement.CMS_SIGNATURE :
+//
+// break;
+//
+// case CreateCMSSignatureResponseElement.ERROR_RESPONSE :
+//
+// break;
+// }
+
}
return responseDoc;
}
-
-
/**
* Add a <code>CMSSignature</code> element to the response.
- *
+ *
* @param cmsSignatureResponse The content to put under the
- * <code>CMSSignature</code> element.
+ * <code>CMSSignature</code> element.
*/
private void addCMSSignature(CMSSignatureResponse cmsSignatureResponse) {
- String base64Value = cmsSignatureResponse.getCMSSignature();
-
- Element cmsSignature = responseDoc.createElementNS(MOA_NS_URI, "CMSSignature");
- cmsSignature.setTextContent(base64Value);
-
- responseElem.appendChild(cmsSignature);
-
-}
-
+ final String base64Value = cmsSignatureResponse.getCMSSignature();
+
+ final Element cmsSignature = responseDoc.createElementNS(MOA_NS_URI, "CMSSignature");
+ cmsSignature.setTextContent(base64Value);
+
+ responseElem.appendChild(cmsSignature);
+
+ }
+
/**
* Add a <code>ErrorResponse</code> element to the response.
- *
+ *
* @param errorResponse The API object containing the information to put into
- * the <code>ErrorResponse</code> DOM element.
+ * the <code>ErrorResponse</code> DOM element.
*/
private void addErrorResponse(ErrorResponse errorResponse) {
- Element errorElem =
- responseDoc.createElementNS(MOA_NS_URI, "ErrorResponse");
- Element errorCodeElem =
- responseDoc.createElementNS(MOA_NS_URI, "ErrorCode");
- Element infoElem = responseDoc.createElementNS(MOA_NS_URI, "Info");
- String errorCodeStr = Integer.toString(errorResponse.getErrorCode());
+ final Element errorElem =
+ responseDoc.createElementNS(MOA_NS_URI, "ErrorResponse");
+ final Element errorCodeElem =
+ responseDoc.createElementNS(MOA_NS_URI, "ErrorCode");
+ final Element infoElem = responseDoc.createElementNS(MOA_NS_URI, "Info");
+ final String errorCodeStr = Integer.toString(errorResponse.getErrorCode());
errorCodeElem.appendChild(responseDoc.createTextNode(errorCodeStr));
errorElem.appendChild(errorCodeElem);
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 d677f88..8898aaf 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
@@ -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;
@@ -47,7 +46,7 @@ import at.gv.egovernment.moaspss.util.XPathUtils;
/**
* A parser to parse <code>CreateXMLSignatureRequest</code> DOM trees into
* <code>CreateXMLSignatureRequest</code> API objects.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -58,25 +57,25 @@ public class CreateXMLSignatureRequestParser {
//
private static final String MOA = Constants.MOA_PREFIX + ":";
private static final String KEY_IDENTIFIER_XPATH =
- "/" + MOA + "CreateXMLSignatureRequest/" + MOA + "KeyIdentifier";
+ "/" + MOA + "CreateXMLSignatureRequest/" + MOA + "KeyIdentifier";
private static final String SINGLE_SIGNATURE_INFO_XPATH =
- "/" + MOA + "CreateXMLSignatureRequest/" + MOA + "SingleSignatureInfo";
+ "/" + MOA + "CreateXMLSignatureRequest/" + MOA + "SingleSignatureInfo";
private static final String DATA_OBJECT_INFO_XPATH = MOA + "DataObjectInfo";
private static final String DATA_OBJECT_XPATH = MOA + "DataObject";
private static final String CREATE_SIGNATURE_INFO_XPATH =
- MOA + "CreateSignatureInfo";
+ MOA + "CreateSignatureInfo";
private static final String CREATE_TRANSFORMS_INFO_PROFILE_XPATH =
- (MOA + "CreateTransformsInfoProfile | ")
- + (MOA + "CreateTransformsInfoProfileID");
+ MOA + "CreateTransformsInfoProfile | "
+ + MOA + "CreateTransformsInfoProfileID";
private static final String CREATE_SIGNATURE_ENVIRONMENT_XPATH =
- MOA + "CreateSignatureEnvironment";
+ MOA + "CreateSignatureEnvironment";
private static final String CREATE_SIGNATURE_ENVIRONMENT_PROFILE_XPATH =
- (MOA + "CreateSignatureEnvironmentProfile | ")
- + (MOA + "CreateSignatureEnvironmentProfileID");
+ MOA + "CreateSignatureEnvironmentProfile | "
+ + MOA + "CreateSignatureEnvironmentProfileID";
private static final String SL_CONFORM_ATTR_NAME = "SecurityLayerConformity";
-
+
/** The factory to create API objects. */
- private SPSSFactory factory;
+ private final SPSSFactory factory;
/**
* Create a new <code>CreateXMLSignatureRequestParser</code>.
@@ -86,44 +85,43 @@ public class CreateXMLSignatureRequestParser {
}
/**
- * Parse a <code>CreateXMLSignatureRequest</code> DOM element, as defined
- * by the MOA schema.
- *
+ * Parse a <code>CreateXMLSignatureRequest</code> DOM element, as defined by the
+ * MOA schema.
+ *
* @param requestElem The <code>CreateXMLSignatureRequest</code> to parse. The
- * request must have been successfully parsed against the schema for this
- * method to succeed.
- * @return A <code>CreateXMLSignatureRequest</code> API object containing
- * the data from the DOM element.
+ * request must have been successfully parsed against the
+ * schema for this method to succeed.
+ * @return A <code>CreateXMLSignatureRequest</code> API object containing the
+ * data from the DOM element.
* @throws MOAApplicationException An error occurred parsing the request.
*/
public CreateXMLSignatureRequest parse(Element requestElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- List singleSignatureInfos = parseSingleSignatureInfos(requestElem);
- String keyIdentifier =
- XPathUtils.getElementValue(requestElem, KEY_IDENTIFIER_XPATH, null);
+ final List singleSignatureInfos = parseSingleSignatureInfos(requestElem);
+ final String keyIdentifier =
+ XPathUtils.getElementValue(requestElem, KEY_IDENTIFIER_XPATH, null);
return factory.createCreateXMLSignatureRequest(
- keyIdentifier,
- singleSignatureInfos);
+ keyIdentifier,
+ singleSignatureInfos);
}
/**
- * Parse all <code>SingleSignatureInfo</code> elements of the
+ * Parse all <code>SingleSignatureInfo</code> elements of the
* <code>CreateXMLSignatureRequest</code>.
- *
+ *
* @param requestElem The <code>CreateXMLSignatureRequest</code> to parse.
- * @return A <code>List</code> of <code>SingleSignatureInfo</code> API
- * objects.
- * @throws MOAApplicationException An error occurred parsing on of the
- * <code>SingleSignatureInfo</code> elements.
+ * @return A <code>List</code> of <code>SingleSignatureInfo</code> API objects.
+ * @throws MOAApplicationException An error occurred parsing on of the
+ * <code>SingleSignatureInfo</code> elements.
*/
private List parseSingleSignatureInfos(Element requestElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- List singleSignatureInfos = new ArrayList();
- NodeIterator sigInfoElems =
- XPathUtils.selectNodeIterator(requestElem, SINGLE_SIGNATURE_INFO_XPATH);
+ final List singleSignatureInfos = new ArrayList();
+ final NodeIterator sigInfoElems =
+ XPathUtils.selectNodeIterator(requestElem, SINGLE_SIGNATURE_INFO_XPATH);
Element sigInfoElem;
while ((sigInfoElem = (Element) sigInfoElems.nextNode()) != null) {
@@ -135,52 +133,52 @@ public class CreateXMLSignatureRequestParser {
/**
* Parse a <code>SingleSignatureInfo</code> DOM element.
- *
- * @param sigInfoElem The <code>SingleSignatureInfo</code> DOM element to
- * parse.
- * @return A <code>SingleSignatureInfo</code> API object containing the
- * information of <code>sigInfoElem</code>.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>SingleSignatureInfo</code>.
+ *
+ * @param sigInfoElem The <code>SingleSignatureInfo</code> DOM element to parse.
+ * @return A <code>SingleSignatureInfo</code> API object containing the
+ * information of <code>sigInfoElem</code>.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>SingleSignatureInfo</code>.
*/
private SingleSignatureInfo parseSingleSignatureInfo(Element sigInfoElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- List dataObjectInfos = parseDataObjectInfos(sigInfoElem);
- CreateSignatureInfo createSignatureInfo =
- parseCreateSignatureInfo(sigInfoElem);
+ final List dataObjectInfos = parseDataObjectInfos(sigInfoElem);
+ final CreateSignatureInfo createSignatureInfo =
+ parseCreateSignatureInfo(sigInfoElem);
boolean securityLayerConform;
if (sigInfoElem.hasAttribute(SL_CONFORM_ATTR_NAME)) {
securityLayerConform =
- BoolUtils.valueOf(sigInfoElem.getAttribute(SL_CONFORM_ATTR_NAME));
+ BoolUtils.valueOf(sigInfoElem.getAttribute(SL_CONFORM_ATTR_NAME));
} else {
securityLayerConform = true;
}
return factory.createSingleSignatureInfo(
- dataObjectInfos,
- createSignatureInfo,
- securityLayerConform);
+ dataObjectInfos,
+ createSignatureInfo,
+ securityLayerConform);
}
/**
* Parse the <code>DataObjectInfo</code> DOM elements contained in the given
* <code>SingleSignatureInfo</code> DOM element.
- *
- * @param sigInfoElem The <code>SingleSignatureInfo</code> DOM element
- * whose <code>DataObjectInfo</code>s to parse.
+ *
+ * @param sigInfoElem The <code>SingleSignatureInfo</code> DOM element whose
+ * <code>DataObjectInfo</code>s to parse.
* @return A <code>List</code> of <code>DataObjectInfo</code> API objects
- * containing the data from the <code>DataObjectInfo</code> DOM elements.
+ * containing the data from the <code>DataObjectInfo</code> DOM
+ * elements.
* @throws MOAApplicationException An error occurred parsing one of the
- * <code>DataObjectInfo</code>s.
+ * <code>DataObjectInfo</code>s.
*/
private List parseDataObjectInfos(Element sigInfoElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- List dataObjectInfos = new ArrayList();
- NodeIterator dataObjInfoElems =
- XPathUtils.selectNodeIterator(sigInfoElem, DATA_OBJECT_INFO_XPATH);
+ final List dataObjectInfos = new ArrayList();
+ final NodeIterator dataObjInfoElems =
+ XPathUtils.selectNodeIterator(sigInfoElem, DATA_OBJECT_INFO_XPATH);
Element dataObjInfoElem;
while ((dataObjInfoElem = (Element) dataObjInfoElems.nextNode()) != null) {
@@ -191,91 +189,91 @@ public class CreateXMLSignatureRequestParser {
/**
* Parse a <code>DataObjectInfo</code> DOM element.
- *
- * @param dataObjInfoElem The <code>DataObjectInfo</code> DOM element to
- * parse.
- * @return A <code>DataObjectInfo</code> API element containing the data
- * from <code>dataObjInfoElem</code>.
+ *
+ * @param dataObjInfoElem The <code>DataObjectInfo</code> DOM element to parse.
+ * @return A <code>DataObjectInfo</code> API element containing the data from
+ * <code>dataObjInfoElem</code>.
* @throws MOAApplicationException An error occurred parsing the
- * <code>DataObjectInfo</code>.
+ * <code>DataObjectInfo</code>.
*/
private DataObjectInfo parseDataObjectInfo(Element dataObjInfoElem)
- throws MOAApplicationException {
-
- String structure = dataObjInfoElem.getAttribute("Structure");
- Element dataObjectElem =
- (Element) XPathUtils.selectSingleNode(dataObjInfoElem, DATA_OBJECT_XPATH);
- Content dataObject = RequestParserUtils.parseContent(dataObjectElem);
- CreateTransformsInfoProfile createTransformsInfoProfile =
- parseCreateTransformsInfoProfile(dataObjInfoElem);
+ throws MOAApplicationException {
+
+ final String structure = dataObjInfoElem.getAttribute("Structure");
+ final Element dataObjectElem =
+ (Element) XPathUtils.selectSingleNode(dataObjInfoElem, DATA_OBJECT_XPATH);
+ final Content dataObject = RequestParserUtils.parseContent(dataObjectElem);
+ final CreateTransformsInfoProfile createTransformsInfoProfile =
+ parseCreateTransformsInfoProfile(dataObjInfoElem);
boolean childOfManifest;
if (dataObjInfoElem.hasAttribute("ChildOfManifest")) {
childOfManifest =
- BoolUtils.valueOf(dataObjInfoElem.getAttribute("ChildOfManifest"));
+ BoolUtils.valueOf(dataObjInfoElem.getAttribute("ChildOfManifest"));
} else {
childOfManifest = false;
}
return factory.createDataObjectInfo(
- structure,
- childOfManifest,
- dataObject,
- createTransformsInfoProfile);
+ structure,
+ childOfManifest,
+ dataObject,
+ createTransformsInfoProfile);
}
/**
* Parse a <code>CreateTransformsInfoProfile</code> DOM element.
- *
- * @param dataObjInfoElem The <code>DataObjectInfo</code> DOM element
- * containing the <code>CreateTransformsInfoProfile</code>.
+ *
+ * @param dataObjInfoElem The <code>DataObjectInfo</code> DOM element containing
+ * the <code>CreateTransformsInfoProfile</code>.
* @return The <code>CreateTransformsInfoProfile</code> API object containing
- * the profile found in <code>dataObjInfoElem</code>.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>CreateTransformsInfoProfile</code>.
+ * the profile found in <code>dataObjInfoElem</code>.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>CreateTransformsInfoProfile</code>.
*/
private CreateTransformsInfoProfile parseCreateTransformsInfoProfile(Element dataObjInfoElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- Element profileElem =
- (Element) XPathUtils.selectSingleNode(
- dataObjInfoElem,
- CREATE_TRANSFORMS_INFO_PROFILE_XPATH);
+ final Element profileElem =
+ (Element) XPathUtils.selectSingleNode(
+ dataObjInfoElem,
+ CREATE_TRANSFORMS_INFO_PROFILE_XPATH);
if ("CreateTransformsInfoProfile".equals(profileElem.getLocalName())) {
- ProfileParser profileParser = new ProfileParser();
+ final ProfileParser profileParser = new ProfileParser();
return profileParser.parseCreateTransformsInfoProfile(profileElem);
} else {
- String profileID = DOMUtils.getText(profileElem);
+ final String profileID = DOMUtils.getText(profileElem);
return factory.createCreateTransformsInfoProfile(profileID);
}
}
/**
- * Parse the <code>CreateSignatureInfo</code> DOM element contained in
- * a <code>SingleSignatureInfo</code>.
- *
+ * Parse the <code>CreateSignatureInfo</code> DOM element contained in a
+ * <code>SingleSignatureInfo</code>.
+ *
* @param sigInfoElem The <code>SingleSignatureInfo</code> DOM element
- * containing the <code>CreateSignatureInfo</code> to be parsed.
- * @return A <code>CreateSignatureInfo</code> API object containing the
- * data from the <code>CreateSignatureInfo</code> DOM element, or
- * <code>null</code>, if none was found.
+ * containing the <code>CreateSignatureInfo</code> to be
+ * parsed.
+ * @return A <code>CreateSignatureInfo</code> API object containing the data
+ * from the <code>CreateSignatureInfo</code> DOM element, or
+ * <code>null</code>, if none was found.
*/
private CreateSignatureInfo parseCreateSignatureInfo(Element sigInfoElem) {
- Element createInfoElem =
- (Element) XPathUtils.selectSingleNode(
- sigInfoElem,
- CREATE_SIGNATURE_INFO_XPATH);
+ final Element createInfoElem =
+ (Element) XPathUtils.selectSingleNode(
+ sigInfoElem,
+ CREATE_SIGNATURE_INFO_XPATH);
if (createInfoElem != null) {
- Element environmentElem =
- (Element) XPathUtils.selectSingleNode(
- createInfoElem,
- CREATE_SIGNATURE_ENVIRONMENT_XPATH);
- Content environment = RequestParserUtils.parseContent(environmentElem);
- CreateSignatureEnvironmentProfile environmentProfile =
- parseCreateSignatureEnvironmentProfile(createInfoElem);
+ final Element environmentElem =
+ (Element) XPathUtils.selectSingleNode(
+ createInfoElem,
+ CREATE_SIGNATURE_ENVIRONMENT_XPATH);
+ final Content environment = RequestParserUtils.parseContent(environmentElem);
+ final CreateSignatureEnvironmentProfile environmentProfile =
+ parseCreateSignatureEnvironmentProfile(createInfoElem);
return factory.createCreateSignatureInfo(environment, environmentProfile);
} else {
@@ -284,26 +282,25 @@ public class CreateXMLSignatureRequestParser {
}
/**
- * Parse the <code>CreateSignatureEnvironmentProfile</code> contained in
- * the given <code>CreateSignatureInfo</code> DOM element.
- *
- * @param createInfoElem <code>CreateSignatureInfo</code> DOM element to
- * parse.
- * @return The <code>CreateSignatureEnvironmentProfile</code> contained
- * in the given <code>CreateSignatureInfo</code> DOM element..
+ * Parse the <code>CreateSignatureEnvironmentProfile</code> contained in the
+ * given <code>CreateSignatureInfo</code> DOM element.
+ *
+ * @param createInfoElem <code>CreateSignatureInfo</code> DOM element to parse.
+ * @return The <code>CreateSignatureEnvironmentProfile</code> contained in the
+ * given <code>CreateSignatureInfo</code> DOM element..
*/
private CreateSignatureEnvironmentProfile parseCreateSignatureEnvironmentProfile(Element createInfoElem) {
- Element profileElem =
- (Element) XPathUtils.selectSingleNode(
- createInfoElem,
- CREATE_SIGNATURE_ENVIRONMENT_PROFILE_XPATH);
+ final Element profileElem =
+ (Element) XPathUtils.selectSingleNode(
+ createInfoElem,
+ CREATE_SIGNATURE_ENVIRONMENT_PROFILE_XPATH);
if ("CreateSignatureEnvironmentProfile"
- .equals(profileElem.getLocalName())) {
- ProfileParser profileParser = new ProfileParser();
+ .equals(profileElem.getLocalName())) {
+ final ProfileParser profileParser = new ProfileParser();
return profileParser.parseCreateSignatureEnvironmentProfile(profileElem);
} else {
- String profileID = DOMUtils.getText(profileElem);
+ final String profileID = DOMUtils.getText(profileElem);
return factory.createCreateSignatureEnvironmentProfile(profileID);
}
}
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 3c93fce..d6af889 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
@@ -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.Iterator;
@@ -38,9 +37,9 @@ import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse;
import at.gv.egovernment.moaspss.util.Constants;
/**
- * Convert a <code>CreateXMLSignatureResponse</code> API object into its
- * XML representation, according to the MOA XML schema.
- *
+ * Convert a <code>CreateXMLSignatureResponse</code> API object into its XML
+ * representation, according to the MOA XML schema.
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -48,48 +47,48 @@ public class CreateXMLSignatureResponseBuilder {
private static final String MOA_NS_URI = Constants.MOA_NS_URI;
/** The XML document containing the response element. */
- private Document responseDoc;
+ private final Document responseDoc;
/** The response <code>CreateXMLSignatureResponse</code> DOM element. */
- private Element responseElem;
+ private final Element responseElem;
/**
* Create a new <code>CreateXMLSignatureResponseBuilder</code>:
- *
- * @throws MOASystemException An error occurred setting up the resulting
- * XML document.
+ *
+ * @throws MOASystemException An error occurred setting up the resulting XML
+ * document.
*/
public CreateXMLSignatureResponseBuilder() throws MOASystemException {
responseDoc =
- ResponseBuilderUtils.createResponse("CreateXMLSignatureResponse");
+ ResponseBuilderUtils.createResponse("CreateXMLSignatureResponse");
responseElem = responseDoc.getDocumentElement();
}
/**
- * Build a document containing a <code>CreateXMLSignatureResponse</code>
- * DOM element being the XML representation of the given
+ * Build a document containing a <code>CreateXMLSignatureResponse</code> DOM
+ * element being the XML representation of the given
* <code>CreateXMLSignatureResponse</code> API object.
- *
- * @param response The <code>CreateXMLSignatureResponse</code> to convert
- * to XML.
- * @return A document containing the <code>CreateXMLSignatureResponse</code>
- * DOM element.
+ *
+ * @param response The <code>CreateXMLSignatureResponse</code> to convert to
+ * XML.
+ * @return A document containing the <code>CreateXMLSignatureResponse</code> DOM
+ * element.
*/
public Document build(CreateXMLSignatureResponse response) {
Iterator iter;
for (iter = response.getResponseElements().iterator(); iter.hasNext();) {
- CreateXMLSignatureResponseElement responseElement =
- (CreateXMLSignatureResponseElement) iter.next();
+ final CreateXMLSignatureResponseElement responseElement =
+ (CreateXMLSignatureResponseElement) iter.next();
switch (responseElement.getResponseType()) {
- case CreateXMLSignatureResponseElement.SIGNATURE_ENVIRONMENT_RESPONSE :
- SignatureEnvironmentResponse envResponse =
- (SignatureEnvironmentResponse) responseElement;
+ case CreateXMLSignatureResponseElement.SIGNATURE_ENVIRONMENT_RESPONSE:
+ final SignatureEnvironmentResponse envResponse =
+ (SignatureEnvironmentResponse) responseElement;
addSignatureEnvironment(envResponse);
break;
- case CreateXMLSignatureResponseElement.ERROR_RESPONSE :
- ErrorResponse errorResponse = (ErrorResponse) responseElement;
+ case CreateXMLSignatureResponseElement.ERROR_RESPONSE:
+ final ErrorResponse errorResponse = (ErrorResponse) responseElement;
addErrorResponse(errorResponse);
break;
}
@@ -101,35 +100,36 @@ public class CreateXMLSignatureResponseBuilder {
/**
* Add a <code>SignatureEnvironment</code> element to the response.
- *
+ *
* @param envResponse The content to put under the
- * <code>SignatureEnvironment</code> element. This should either be a
- * <code>dsig:Signature</code> element (in case of a detached signature) or
- * the signature environment containing the signature (in case of
- * an enveloping signature).
+ * <code>SignatureEnvironment</code> element. This should
+ * either be a <code>dsig:Signature</code> element (in case
+ * of a detached signature) or the signature environment
+ * containing the signature (in case of an enveloping
+ * signature).
*/
private void addSignatureEnvironment(SignatureEnvironmentResponse envResponse) {
- Element content = envResponse.getSignatureEnvironment();
- Node importedSignature = responseDoc.importNode(content, true);
- Element signatureEnvironment =
- responseDoc.createElementNS(MOA_NS_URI, "SignatureEnvironment");
+ final Element content = envResponse.getSignatureEnvironment();
+ final Node importedSignature = responseDoc.importNode(content, true);
+ final Element signatureEnvironment =
+ responseDoc.createElementNS(MOA_NS_URI, "SignatureEnvironment");
signatureEnvironment.appendChild(importedSignature);
responseElem.appendChild(signatureEnvironment);
}
/**
* Add a <code>ErrorResponse</code> element to the response.
- *
+ *
* @param errorResponse The API object containing the information to put into
- * the <code>ErrorResponse</code> DOM element.
+ * the <code>ErrorResponse</code> DOM element.
*/
private void addErrorResponse(ErrorResponse errorResponse) {
- Element errorElem =
- responseDoc.createElementNS(MOA_NS_URI, "ErrorResponse");
- Element errorCodeElem =
- responseDoc.createElementNS(MOA_NS_URI, "ErrorCode");
- Element infoElem = responseDoc.createElementNS(MOA_NS_URI, "Info");
- String errorCodeStr = Integer.toString(errorResponse.getErrorCode());
+ final Element errorElem =
+ responseDoc.createElementNS(MOA_NS_URI, "ErrorResponse");
+ final Element errorCodeElem =
+ responseDoc.createElementNS(MOA_NS_URI, "ErrorCode");
+ final Element infoElem = responseDoc.createElementNS(MOA_NS_URI, "Info");
+ final String errorCodeStr = Integer.toString(errorResponse.getErrorCode());
errorCodeElem.appendChild(responseDoc.createTextNode(errorCodeStr));
errorElem.appendChild(errorCodeElem);
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 6b34922..b8cb361 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
@@ -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.io.IOException;
@@ -52,85 +51,86 @@ import at.gv.egovernment.moaspss.util.XPathUtils;
/**
* Parse the various profile elements contained in the MOA web service requests
* and given as separate files in the MOA configuration.
- *
+ *
* The profiles parsed must be schema valid according to the MOA XML schema.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ProfileParser {
-
+
//
// XPath expressions to select parts of the profiles
//
private static final String MOA = Constants.MOA_PREFIX + ":";
private static final String DSIG = Constants.DSIG_PREFIX + ":";
private static final String CREATE_TRANSFORMS_XPATH =
- MOA + "CreateTransformsInfo/" + DSIG + "Transforms";
+ MOA + "CreateTransformsInfo/" + DSIG + "Transforms";
private static final String FINAL_DATA_META_INFO_XPATH =
- MOA + "CreateTransformsInfo/" + MOA + "FinalDataMetaInfo";
+ MOA + "CreateTransformsInfo/" + MOA + "FinalDataMetaInfo";
private static final String CREATE_SIGNATURE_LOCATION_XPATH =
- MOA + "CreateSignatureLocation";
+ MOA + "CreateSignatureLocation";
private static final String SUPPLEMENT_XPATH = MOA + "Supplement";
private static final String VERIFY_TRANSFORMS_XPATH = DSIG + "Transforms";
private static final String TRANSFORM_PARAMETER_XPATH =
- MOA + "TransformParameter";
+ MOA + "TransformParameter";
private static final String TRANSFORM_PARAMETER_CONTENT_XPATH =
- MOA + "Base64Content | " + MOA + "Hash";
+ MOA + "Base64Content | " + MOA + "Hash";
private static final String DIGEST_METHOD_XPATH = DSIG + "DigestMethod";
private static final String DIGEST_VALUE_XPATH = DSIG + "DigestValue";
/** The factory used to create API objects. */
- private SPSSFactory factory = SPSSFactory.getInstance();
+ private final SPSSFactory factory = SPSSFactory.getInstance();
/**
* Parse a <code>CreateTransformsInfoProfile</code> DOM element.
- *
- * @param profileElem The <code>CreateTransformsInfoProfile</code> element
- * to parse.
+ *
+ * @param profileElem The <code>CreateTransformsInfoProfile</code> element to
+ * parse.
* @return The <code>CreateTransformsInfoProfile</code> API object containing
- * the data from the <code>profileElem</code>.
- * @throws MOAApplicationException An error occurred parsing the DOM element.
+ * the data from the <code>profileElem</code>.
+ * @throws MOAApplicationException An error occurred parsing the DOM element.
*/
public CreateTransformsInfoProfile parseCreateTransformsInfoProfile(Element profileElem)
- throws MOAApplicationException {
- CreateTransformsInfo createTransformsInfo =
- parseCreateTransformsInfo(profileElem);
- List supplements = parseSupplements(profileElem);
+ throws MOAApplicationException {
+ final CreateTransformsInfo createTransformsInfo =
+ parseCreateTransformsInfo(profileElem);
+ final List supplements = parseSupplements(profileElem);
return factory.createCreateTransformsInfoProfile(
- createTransformsInfo,
- supplements);
+ createTransformsInfo,
+ supplements);
}
/**
- * Parse the <code>CreateTransformsInfo</code> DOM element contained in a
+ * Parse the <code>CreateTransformsInfo</code> DOM element contained in a
* <code>CreateTransformsInfoProfile</code>.
- *
- * @param profileElem The <code>CreateTransformsInfoProfile</code> DOM
- * element containing the <code>CreateTransformsInfo</code>.
- * @return The <code>CreateTransformsInfo</code> API object containinig the
- * data from the <code>CreateTransformsInfo</code> DOM element.
+ *
+ * @param profileElem The <code>CreateTransformsInfoProfile</code> DOM element
+ * containing the <code>CreateTransformsInfo</code>.
+ * @return The <code>CreateTransformsInfo</code> API object containinig the data
+ * from the <code>CreateTransformsInfo</code> DOM element.
* @throws MOAApplicationException An error occurred parsing the
- * <code>CreateTransformsInfo</code> DOM element.
+ * <code>CreateTransformsInfo</code> DOM
+ * element.
*/
private CreateTransformsInfo parseCreateTransformsInfo(Element profileElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- Element transformsElem =
- (Element) XPathUtils.selectSingleNode(
- profileElem,
- CREATE_TRANSFORMS_XPATH);
- Element metaInfoElem =
- (Element) XPathUtils.selectSingleNode(
- profileElem,
- FINAL_DATA_META_INFO_XPATH);
+ final Element transformsElem =
+ (Element) XPathUtils.selectSingleNode(
+ profileElem,
+ CREATE_TRANSFORMS_XPATH);
+ final Element metaInfoElem =
+ (Element) XPathUtils.selectSingleNode(
+ profileElem,
+ FINAL_DATA_META_INFO_XPATH);
MetaInfo finalDataMetaInfo;
List transforms;
- // parse the dsig:Transforms
+ // parse the dsig:Transforms
if (transformsElem != null) {
- TransformParser transformsParser = new TransformParser();
+ final TransformParser transformsParser = new TransformParser();
transforms = transformsParser.parseTransforms(transformsElem);
} else {
transforms = null;
@@ -144,65 +144,66 @@ public class ProfileParser {
/**
* Parse a <code>CreateSignatureEnvironmentProfile</code> DOM element.
- *
- * @param profileElem The <code>CreateSignatureEnvironmentProfile</code>
- * DOM element to parse.
+ *
+ * @param profileElem The <code>CreateSignatureEnvironmentProfile</code> DOM
+ * element to parse.
* @return The <code>CreateSignatureEnvironmentProfile</code> API object
- * containing the data from the <code>profileElem</code>.
+ * containing the data from the <code>profileElem</code>.
*/
public CreateSignatureEnvironmentProfile parseCreateSignatureEnvironmentProfile(Element profileElem) {
- CreateSignatureLocation createSignatureLocation =
- parseCreateSignatureLocation(profileElem);
- List supplements = parseSupplements(profileElem);
+ final CreateSignatureLocation createSignatureLocation =
+ parseCreateSignatureLocation(profileElem);
+ final List supplements = parseSupplements(profileElem);
return factory.createCreateSignatureEnvironmentProfile(
- createSignatureLocation,
- supplements);
+ createSignatureLocation,
+ supplements);
}
/**
- * Parse a <code>CreateSignatureLocation</code> DOM element contained in
- * a <code>CreateSignatureEnvironmentProfile</code>.
- *
+ * Parse a <code>CreateSignatureLocation</code> DOM element contained in a
+ * <code>CreateSignatureEnvironmentProfile</code>.
+ *
* @param profileElem The <code>CreateSignatureEnvironmentProfile</code> DOM
- * element containing the <code>CreateSignatureLocation</code>.
- * @return The <code>CreateSignatureLocation</code> API object containing
- * the data from the <code>CreateSignatureLocation</code> DOM element.
+ * element containing the
+ * <code>CreateSignatureLocation</code>.
+ * @return The <code>CreateSignatureLocation</code> API object containing the
+ * data from the <code>CreateSignatureLocation</code> DOM element.
*/
private CreateSignatureLocation parseCreateSignatureLocation(Element profileElem) {
- Element locationElem =
- (Element) XPathUtils.selectSingleNode(
- profileElem,
- CREATE_SIGNATURE_LOCATION_XPATH);
- String xPathExpression = DOMUtils.getText(locationElem);
- Map namespaceDeclarations = DOMUtils.getNamespaceDeclarations(locationElem);
- String indexStr = locationElem.getAttribute("Index");
- int index = Integer.parseInt(indexStr);
+ final Element locationElem =
+ (Element) XPathUtils.selectSingleNode(
+ profileElem,
+ CREATE_SIGNATURE_LOCATION_XPATH);
+ final String xPathExpression = DOMUtils.getText(locationElem);
+ final Map namespaceDeclarations = DOMUtils.getNamespaceDeclarations(locationElem);
+ final String indexStr = locationElem.getAttribute("Index");
+ final int index = Integer.parseInt(indexStr);
return factory.createCreateSignatureLocation(
- xPathExpression,
- index,
- namespaceDeclarations);
+ xPathExpression,
+ index,
+ namespaceDeclarations);
}
/**
- * Parse all <code>Supplement</code> DOM elements contained in a given
- * parent DOM element.
- *
+ * Parse all <code>Supplement</code> DOM elements contained in a given parent
+ * DOM element.
+ *
* @param supplementsParentElem The DOM element being the parent of the
- * <code>Supplement</code>s.
- * @return A <code>List</code> of <code>Supplement</code> API objects
- * containing the data from the <code>Supplement</code> DOM elements.
+ * <code>Supplement</code>s.
+ * @return A <code>List</code> of <code>Supplement</code> API objects containing
+ * the data from the <code>Supplement</code> DOM elements.
*/
private List parseSupplements(Element supplementsParentElem) {
- List supplements = new ArrayList();
- NodeIterator supplementElems =
- XPathUtils.selectNodeIterator(supplementsParentElem, SUPPLEMENT_XPATH);
+ final List supplements = new ArrayList();
+ final NodeIterator supplementElems =
+ XPathUtils.selectNodeIterator(supplementsParentElem, SUPPLEMENT_XPATH);
Element supplementElem;
while ((supplementElem = (Element) supplementElems.nextNode()) != null) {
- XMLDataObjectAssociation supplement =
- RequestParserUtils.parseXMLDataObjectAssociation(supplementElem);
+ final XMLDataObjectAssociation supplement =
+ RequestParserUtils.parseXMLDataObjectAssociation(supplementElem);
supplements.add(supplement);
}
return supplements;
@@ -210,44 +211,44 @@ public class ProfileParser {
/**
* Parse a <code>SupplementProfile</code> DOM element.
- *
+ *
* @param profileElem The <code>SupplementProfile</code> DOM element to parse.
- * @return The <code>SupplementProfile</code> API object containing the
- * data from the <code>SupplementProfile</code> DOM element.
+ * @return The <code>SupplementProfile</code> API object containing the data
+ * from the <code>SupplementProfile</code> DOM element.
*/
public SupplementProfile parseSupplementProfile(Element profileElem) {
- XMLDataObjectAssociation supplementProfile =
- RequestParserUtils.parseXMLDataObjectAssociation(profileElem);
+ final XMLDataObjectAssociation supplementProfile =
+ RequestParserUtils.parseXMLDataObjectAssociation(profileElem);
return factory.createSupplementProfile(supplementProfile);
}
/**
- * Parse a <code>VerifyTransformsInfoProfile</code> DOM element.
- *
- * @param profileElem The <code>VerifyTransformsInfoProfile</code> DOM
- * element to parse.
- * @return A <code>VerifyTransformsInfoProfile</code> API object containing
- * the information from the <code>VerifyTransformsInfoProfile</code> DOM
- * element.
+ * Parse a <code>VerifyTransformsInfoProfile</code> DOM element.
+ *
+ * @param profileElem The <code>VerifyTransformsInfoProfile</code> DOM element
+ * to parse.
+ * @return A <code>VerifyTransformsInfoProfile</code> API object containing the
+ * information from the <code>VerifyTransformsInfoProfile</code> DOM
+ * element.
* @throws MOAApplicationException An error occurred parsing the
- * <code>VerifyTransformsInfoProfile</code>.
+ * <code>VerifyTransformsInfoProfile</code>.
*/
public VerifyTransformsInfoProfile parseVerifyTransformsInfoProfile(Element profileElem)
- throws MOAApplicationException {
- Element transformsElem =
- (Element) XPathUtils.selectSingleNode(
- profileElem,
- VERIFY_TRANSFORMS_XPATH);
+ throws MOAApplicationException {
+ final Element transformsElem =
+ (Element) XPathUtils.selectSingleNode(
+ profileElem,
+ VERIFY_TRANSFORMS_XPATH);
List transforms = null;
- NodeIterator paramElems =
- XPathUtils.selectNodeIterator(profileElem, TRANSFORM_PARAMETER_XPATH);
+ final NodeIterator paramElems =
+ XPathUtils.selectNodeIterator(profileElem, TRANSFORM_PARAMETER_XPATH);
Element paramElem;
- List transformParameters = new ArrayList();
+ final List transformParameters = new ArrayList();
// parse the dsig:Transforms
if (transformsElem != null) {
- TransformParser transformsParser = new TransformParser();
+ final TransformParser transformsParser = new TransformParser();
transforms = transformsParser.parseTransforms(transformsElem);
}
@@ -257,51 +258,50 @@ public class ProfileParser {
}
return factory.createVerifyTransformsInfoProfile(
- transforms,
- transformParameters);
+ transforms,
+ transformParameters);
}
/**
* Parse a <code>TransformParameter</code> DOM element.
- *
- * @param paramElem The <code>TransformParameter</code> DOM element to
- * parse.
+ *
+ * @param paramElem The <code>TransformParameter</code> DOM element to parse.
* @return The <code>TransformParameter</code> API object containing the
- * information from the <code>TransformParameter</code> DOM element.
+ * information from the <code>TransformParameter</code> DOM element.
* @throws MOAApplicationException An error occurred parsing the
- * <code>TransformParameter</code> DOM element.
+ * <code>TransformParameter</code> DOM element.
*/
- private TransformParameter parseTransformParameter(Element paramElem)
- throws MOAApplicationException {
- String uri = paramElem.getAttribute("URI");
- Element contentElem =
- (Element) XPathUtils.selectSingleNode(
- paramElem,
- TRANSFORM_PARAMETER_CONTENT_XPATH);
+ private TransformParameter parseTransformParameter(Element paramElem)
+ throws MOAApplicationException {
+ final String uri = paramElem.getAttribute("URI");
+ final Element contentElem =
+ (Element) XPathUtils.selectSingleNode(
+ paramElem,
+ TRANSFORM_PARAMETER_CONTENT_XPATH);
if (contentElem == null) {
return factory.createTransformParameter(uri);
} else if ("Base64Content".equals(contentElem.getLocalName())) {
- String base64Str = DOMUtils.getText(contentElem);
- InputStream binaryContent = Base64Utils.decodeToStream(base64Str, true);
+ final String base64Str = DOMUtils.getText(contentElem);
+ final InputStream binaryContent = Base64Utils.decodeToStream(base64Str, true);
return factory.createTransformParameter(uri, binaryContent);
} else { // "Hash".equals(contentElem.getLocalName())
- String digestMethodStr =
- XPathUtils.getElementValue(contentElem, DIGEST_METHOD_XPATH, "");
- String digestValueStr =
- XPathUtils.getElementValue(contentElem, DIGEST_VALUE_XPATH, "");
+ final String digestMethodStr =
+ XPathUtils.getElementValue(contentElem, DIGEST_METHOD_XPATH, "");
+ final String digestValueStr =
+ XPathUtils.getElementValue(contentElem, DIGEST_VALUE_XPATH, "");
byte[] digestValue = null;
try {
digestValue = Base64Utils.decode(digestValueStr, true);
- } catch (IOException e) {
- throw new MOAApplicationException("2270", null);
+ } catch (final IOException e) {
+ throw new MOAApplicationException("2270", null);
}
return factory.createTransformParameter(
- uri,
- digestMethodStr,
- digestValue);
+ uri,
+ digestMethodStr,
+ digestValue);
}
}
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 99a64d9..173ecbf 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
@@ -42,165 +42,163 @@ import at.gv.egovernment.moaspss.util.XPathUtils;
/**
* Utility methods for parsing XML requests definied in the MOA XML schema.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class RequestParserUtils {
- //
- // XPath expressions for parsing parts of a request
- //
- private static final String MOA = Constants.MOA_PREFIX + ":";
- private static final String REFERENCE_ATTR_NAME = "Reference";
- private static final String MIME_TYPE_XPATH = MOA + "MimeType";
- private static final String DESCRIPTION_XPATH = MOA + "Description";
- private static final String TYPE_XPATH = MOA + "Type";
- private static final String XML_ASSOC_CONTENT_XPATH = MOA + "Content";
- private static final String CONTENT_XPATH = MOA + "Base64Content | " + MOA + "XMLContent |" + MOA + "LocRefContent";
- private static final String ANY_OTHER_XPATH = "*[namespace-uri() != \"" + Constants.MOA_NS_URI + "\"]";
-
- /**
- * Parse a <code>XMLDataObjectAssociationType</code> kind of DOM element.
- *
- * @param assocElem
- * The <code>XMLDataObjectAssociationType</code> kind of DOM
- * elmeent to parse.
- * @return The <code>XMLDataObjectAssociation</code> API object containing
- * the data from the <code>XMLDataObjectAssociationType</code> 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 <code>MetaInfoType</code> kind of DOM element.
- *
- * @param metaInfoElem
- * The <code>MetaInfoType</code> kind of DOM element.
- * @return The <code>MetaInfo</code> API object containing the data from the
- * <code>metaInfoElem</code>.
- */
- 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 <code>ContentOptionalRefType</code> or
- * <code>ContentRequiredRefType</code> kind of DOM element.
- *
- * @param contentParentElem
- * The DOM element being the parent of the content element.
- * @return The <code>Content</code> 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 <code>Verify(CMS|XML)SignatureRequest</code> DOM element.
- * @param dateTimeXPath
- * The XPath to lookup the <code>DateTime</code> element within
- * the request.
- * @return Date The date and time corresponding to the <code>DateTime</code>
- * element in the request. If no <code>DateTime</code> element
- * exists in the request, <code>null</code> is returned.
- * @throws MOAApplicationException
- * An error occurred during a parsing the <code>DateTime</code>
- * 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 <code>Verify(CMS|XML)SignatureRequest</code> DOM element.
- * @param dateTimeXPath
- * The XPath to lookup the <code>DateTime</code> element within
- * the request.
- * @return Date The date and time corresponding to the <code>DateTime</code>
- * element in the request. If no <code>DateTime</code> element
- * exists in the request, <code>null</code> is returned.
- * @throws MOAApplicationException
- * An error occurred during a parsing the <code>DateTime</code>
- * 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;
- if("true".equalsIgnoreCase(xsdBoolean) ||
- "1".equalsIgnoreCase(xsdBoolean)) {
- return true;
- } else {
- return false;
- }
- } else {
- return defaultValue;
- }
- }
+ //
+ // 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 <code>XMLDataObjectAssociationType</code> kind of DOM element.
+ *
+ * @param assocElem The <code>XMLDataObjectAssociationType</code> kind of DOM
+ * elmeent to parse.
+ * @return The <code>XMLDataObjectAssociation</code> API object containing the
+ * data from the <code>XMLDataObjectAssociationType</code> DOM element.
+ */
+ public static XMLDataObjectAssociation parseXMLDataObjectAssociation(Element assocElem) {
+ final SPSSFactory factory = SPSSFactory.getInstance();
+ final MetaInfo metaInfo = parseMetaInfo(assocElem);
+ final Element contentElem = (Element) XPathUtils.selectSingleNode(assocElem, XML_ASSOC_CONTENT_XPATH);
+ final Content content = parseContent(contentElem);
+
+ return factory.createXMLDataObjectAssociation(metaInfo, content);
+ }
+
+ /**
+ * Parse a <code>MetaInfoType</code> kind of DOM element.
+ *
+ * @param metaInfoElem The <code>MetaInfoType</code> kind of DOM element.
+ * @return The <code>MetaInfo</code> API object containing the data from the
+ * <code>metaInfoElem</code>.
+ */
+ public static MetaInfo parseMetaInfo(Element metaInfoElem) {
+ final SPSSFactory factory = SPSSFactory.getInstance();
+ final String mimeType = XPathUtils.getElementValue(metaInfoElem, MIME_TYPE_XPATH, null);
+ final String description = XPathUtils.getElementValue(metaInfoElem, DESCRIPTION_XPATH, null);
+ final NodeList anyOther = XPathUtils.selectNodeList(metaInfoElem, ANY_OTHER_XPATH);
+ final String type = XPathUtils.getElementValue(metaInfoElem, TYPE_XPATH, null);
+
+ return factory.createMetaInfo(mimeType, description, anyOther, type);
+ }
+
+ /**
+ * Parse a <code>ContentOptionalRefType</code> or
+ * <code>ContentRequiredRefType</code> kind of DOM element.
+ *
+ * @param contentParentElem The DOM element being the parent of the content
+ * element.
+ * @return The <code>Content</code> API object containing the data from the
+ * given DOM element.
+ */
+ public static Content parseContent(Element contentParentElem) {
+ final SPSSFactory factory = SPSSFactory.getInstance();
+ final String referenceURI = contentParentElem.hasAttribute(REFERENCE_ATTR_NAME)
+ ? contentParentElem.getAttribute(REFERENCE_ATTR_NAME)
+ : null;
+ final Element contentElem = (Element) XPathUtils.selectSingleNode(contentParentElem, CONTENT_XPATH);
+
+ if (contentElem == null) {
+ return factory.createContent(referenceURI);
+ }
+
+ if ("Base64Content".equals(contentElem.getLocalName())) {
+ final String base64String = DOMUtils.getText(contentElem);
+ return factory.createContent(Base64Utils.decodeToStream(base64String, true), referenceURI);
+ } else if ("LocRefContent".equals(contentElem.getLocalName())) {
+ final 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 <code>Verify(CMS|XML)SignatureRequest</code> DOM
+ * element.
+ * @param dateTimeXPath The XPath to lookup the <code>DateTime</code> element
+ * within the request.
+ * @return Date The date and time corresponding to the <code>DateTime</code>
+ * element in the request. If no <code>DateTime</code> element exists in
+ * the request, <code>null</code> is returned.
+ * @throws MOAApplicationException An error occurred during a parsing the
+ * <code>DateTime</code> 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 (final 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 <code>Verify(CMS|XML)SignatureRequest</code> DOM
+ * element.
+ * @param dateTimeXPath The XPath to lookup the <code>DateTime</code> element
+ * within the request.
+ * @return Date The date and time corresponding to the <code>DateTime</code>
+ * element in the request. If no <code>DateTime</code> element exists in
+ * the request, <code>null</code> is returned.
+ * @throws MOAApplicationException An error occurred during a parsing the
+ * <code>DateTime</code> 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);
+ final String xsdBoolean = dateTimeText.trim();
+ if ("".equals(xsdBoolean)) {
+ return defaultValue;
+ }
+ if ("true".equalsIgnoreCase(xsdBoolean) ||
+ "1".equalsIgnoreCase(xsdBoolean)) {
+ return true;
+ } else {
+ 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 91dc6b9..dff1fcc 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
@@ -21,16 +21,14 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlbind;
import java.io.IOException;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
-import java.text.SimpleDateFormat;
+import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
-import java.util.Calendar;
import java.util.TimeZone;
import javax.xml.bind.DatatypeConverter;
@@ -38,13 +36,12 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.apache.commons.lang3.StringUtils;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-import iaik.utils.RFC2253NameParser;
-import iaik.utils.RFC2253NameParserException;
import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.MOASystemException;
import at.gv.egovernment.moa.spss.api.common.ExtendedCertificateCheckResult;
@@ -52,10 +49,12 @@ import at.gv.egovernment.moa.spss.api.common.TslInfos;
import at.gv.egovernment.moaspss.util.Base64Utils;
import at.gv.egovernment.moaspss.util.Constants;
import at.gv.egovernment.moaspss.util.MiscUtil;
+import iaik.utils.RFC2253NameParser;
+import iaik.utils.RFC2253NameParserException;
/**
* Utility methods used by the verious <code>ResponseBuilder</code> classes.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -70,35 +69,35 @@ public class ResponseBuilderUtils {
/**
* Add an DOM element with a specific name as child to a root element
- *
+ *
* @param elementName Name of the DOM element
- * @param response Full document with namespace information
+ * @param response Full document with namespace information
* @param rootElement Root element
* @return new child DOM element
*/
public static Element addChildElement(String elementName, Document response,
- Element rootElement) {
- Element childElement = response.createElementNS(MOA_NS_URI, elementName);
- rootElement.appendChild(childElement);
- return childElement;
-
+ Element rootElement) {
+ final Element childElement = response.createElementNS(MOA_NS_URI, elementName);
+ rootElement.appendChild(childElement);
+ return childElement;
+
}
-
+
/**
* Create a response element with all the namespaces set.
- *
+ *
* @param responseName The name of the response root element.
* @return A DOM document containing the response root element and predefined
- * MOA, DSIG and XML namespace declarations.
+ * MOA, DSIG and XML namespace declarations.
* @throws MOASystemException An error building the response document.
*/
public static Document createResponse(String responseName)
- throws MOASystemException {
+ throws MOASystemException {
try {
- DocumentBuilder docBuilder =
- DocumentBuilderFactory.newInstance().newDocumentBuilder();
- DOMImplementation impl = docBuilder.getDOMImplementation();
+ final DocumentBuilder docBuilder =
+ DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ final DOMImplementation impl = docBuilder.getDOMImplementation();
Document response;
Element root;
String attrValue;
@@ -112,159 +111,170 @@ public class ResponseBuilderUtils {
root.setAttributeNS(XMLNS_NS_URI, attrValue, DSIG_NS_URI);
return response;
- } catch (ParserConfigurationException e) {
+ } catch (final ParserConfigurationException e) {
throw new MOASystemException("2200", null, e);
}
}
/**
* Add a <code>SignerInfo</code> element to the response.
- *
- * @param response The response document, in order to create new elements in
- * it.
- * @param root The root element into which the <code>SignerInfo</code> element
- * will be inserted.
- * @param cert The signer certificate to add.
- * @param isQualified Indicates, whether <code>cert</code> is a qualified
- * certificate.
- * @param isPublicAuthority Indicates, whether <code>cert</code> is
- * certificate owned by a public authority.
+ *
+ * @param response The response document, in order to create new
+ * elements in it.
+ * @param root The root element into which the
+ * <code>SignerInfo</code> element will be inserted.
+ * @param cert The signer certificate to add.
+ * @param isQualified Indicates, whether <code>cert</code> is a qualified
+ * certificate.
+ * @param isPublicAuthority Indicates, whether <code>cert</code> is certificate
+ * owned by a public authority.
* @param publicAuthorityID Information about the public authority owning
- * <code>cert</code>. Must not be <code>null</code>, if
- * <code>isPublicAuthority ! = null</code>.
+ * <code>cert</code>. Must not be <code>null</code>, if
+ * <code>isPublicAuthority ! = null</code>.
* @throws MOAApplicationException An error occurred reading data from the
- * certificate.
+ * certificate.
*/
public static void addSignerInfo(
- Document response,
- Element root,
- X509Certificate cert,
- boolean isQualified,
- String qcSource,
- boolean isPublicAuthority,
- String publicAuthorityID,
- boolean isSSCD,
- String sscdSource,
- String issuerCountryCode,
- TslInfos tslInfos)
- throws MOAApplicationException {
-
- Element signerInfoElem = response.createElementNS(MOA_NS_URI, "SignerInfo");
- Element x509DataElem =
- response.createElementNS(DSIG_NS_URI, DSIG + "X509Data");
- Element x509IssuerSerialElem =
- response.createElementNS(DSIG_NS_URI, DSIG + "X509IssuerSerial");
- Element x509IssuerElem =
- response.createElementNS(DSIG_NS_URI, DSIG + "X509IssuerName");
- String issuer = cert.getIssuerDN().getName();
- Element x509SerialNumberElem =
- response.createElementNS(DSIG_NS_URI, DSIG + "X509SerialNumber");
- String serialNumber = cert.getSerialNumber().toString();
- Element x509SubjectNameElem =
- response.createElementNS(DSIG_NS_URI, DSIG + "X509SubjectName");
- Element x509CertificateElem =
- response.createElementNS(DSIG_NS_URI, DSIG + "X509Certificate");
- Element qualifiedCertificateElem =
- isQualified
- ? response.createElementNS(MOA_NS_URI, "QualifiedCertificate")
- : null;
- Element sscdElem =
- isSSCD
- ? response.createElementNS(MOA_NS_URI, "SecureSignatureCreationDevice")
- : null;
+ Document response,
+ Element root,
+ X509Certificate cert,
+ boolean isQualified,
+ String qcSource,
+ boolean isPublicAuthority,
+ String publicAuthorityID,
+ boolean isSSCD,
+ String sscdSource,
+ String issuerCountryCode,
+ TslInfos tslInfos)
+ throws MOAApplicationException {
+
+ final Element signerInfoElem = response.createElementNS(MOA_NS_URI, "SignerInfo");
+ final Element x509DataElem =
+ response.createElementNS(DSIG_NS_URI, DSIG + "X509Data");
+ final Element x509IssuerSerialElem =
+ response.createElementNS(DSIG_NS_URI, DSIG + "X509IssuerSerial");
+ final Element x509IssuerElem =
+ response.createElementNS(DSIG_NS_URI, DSIG + "X509IssuerName");
+ final String issuer = cert.getIssuerDN().getName();
+ final Element x509SerialNumberElem =
+ response.createElementNS(DSIG_NS_URI, DSIG + "X509SerialNumber");
+ final String serialNumber = cert.getSerialNumber().toString();
+ final Element x509SubjectNameElem =
+ response.createElementNS(DSIG_NS_URI, DSIG + "X509SubjectName");
+ final Element x509CertificateElem =
+ response.createElementNS(DSIG_NS_URI, DSIG + "X509Certificate");
+ final Element qualifiedCertificateElem =
+ isQualified
+ ? response.createElementNS(MOA_NS_URI, "QualifiedCertificate")
+ : null;
+ final Element sscdElem =
+ isSSCD
+ ? response.createElementNS(MOA_NS_URI, "SecureSignatureCreationDevice")
+ : null;
Element issuerCountryCodeElem = null;
if (issuerCountryCode != null) {
- issuerCountryCodeElem = response.createElementNS(MOA_NS_URI, "IssuerCountryCode");
- issuerCountryCodeElem.setTextContent(issuerCountryCode);
+ issuerCountryCodeElem = response.createElementNS(MOA_NS_URI, "IssuerCountryCode");
+ issuerCountryCodeElem.setTextContent(issuerCountryCode);
}
-
- //add TSL infos
+
+ // add TSL infos
Element tslInfoElement = null;
if (tslInfos != null) {
- tslInfoElement = response.createElementNS(MOA_NS_URI, "TSLInformation");
-
- //append TSL issuer country-code
- if (MiscUtil.isNotEmpty(tslInfos.getTslIssuerCountry())); {
- Element tslIssuerCountryCodeElem = response.createElementNS(MOA_NS_URI, "TSLIssuerCountryCode");
- tslIssuerCountryCodeElem.setTextContent(tslInfos.getTslIssuerCountry());
- tslInfoElement.appendChild(tslIssuerCountryCodeElem);
-
- }
-
- //append Service-Type Status
- if (MiscUtil.isNotEmpty(tslInfos.getServiceTypeStatus())); {
- Element tslServiceInfo = response.createElementNS(MOA_NS_URI, "ServiceTypeStatus");
- tslServiceInfo.setTextContent(tslInfos.getServiceTypeStatus());
- tslInfoElement.appendChild(tslServiceInfo);
-
- }
-
- //append Service-Type Identifier
- if (MiscUtil.isNotEmpty(tslInfos.getServiceTypeIdentifier())); {
- Element tslServiceInfo = response.createElementNS(MOA_NS_URI, "ServiceTypeIdentifier");
- tslServiceInfo.setTextContent(tslInfos.getServiceTypeIdentifier());
- tslInfoElement.appendChild(tslServiceInfo);
-
- }
-
- //append qualifiers
- if (tslInfos.getQualifiers() != null && tslInfos.getQualifiers().size() > 0) {
- Element tslQualifiers = response.createElementNS(MOA_NS_URI, "Qualifiers");
-
- for (String el : tslInfos.getQualifiers()) {
- Element tslQualifier = response.createElementNS(MOA_NS_URI, "Qualifier");
- tslQualifier.setTextContent(el);
- tslQualifiers.appendChild(tslQualifier);
-
- }
-
- tslInfoElement.appendChild(tslQualifiers);
-
- }
-
- //append additional service information
- if (tslInfos.getAdditionalServiceInformation() != null
- && tslInfos.getAdditionalServiceInformation().size() > 0) {
- Element tslAdditionalServiceInformations = response.createElementNS(MOA_NS_URI, "AdditionalServiceInformations");
-
- for (String el : tslInfos.getAdditionalServiceInformation()) {
- Element tslAdditionalServiceInformation = response.createElementNS(MOA_NS_URI, "AdditionalServiceInformation");
- tslAdditionalServiceInformation.setTextContent(el);
- tslAdditionalServiceInformations.appendChild(tslAdditionalServiceInformation);
-
- }
- tslInfoElement.appendChild(tslAdditionalServiceInformations);
-
- }
+ tslInfoElement = response.createElementNS(MOA_NS_URI, "TSLInformation");
+
+ // append TSL issuer country-code
+ if (MiscUtil.isNotEmpty(tslInfos.getTslIssuerCountry())) {
+ ;
+ }
+ {
+ final Element tslIssuerCountryCodeElem = response.createElementNS(MOA_NS_URI, "TSLIssuerCountryCode");
+ tslIssuerCountryCodeElem.setTextContent(tslInfos.getTslIssuerCountry());
+ tslInfoElement.appendChild(tslIssuerCountryCodeElem);
+
+ }
+
+ // append Service-Type Status
+ if (MiscUtil.isNotEmpty(tslInfos.getServiceTypeStatus())) {
+ ;
+ }
+ {
+ final Element tslServiceInfo = response.createElementNS(MOA_NS_URI, "ServiceTypeStatus");
+ tslServiceInfo.setTextContent(tslInfos.getServiceTypeStatus());
+ tslInfoElement.appendChild(tslServiceInfo);
+
+ }
+
+ // append Service-Type Identifier
+ if (MiscUtil.isNotEmpty(tslInfos.getServiceTypeIdentifier())) {
+ ;
+ }
+ {
+ final Element tslServiceInfo = response.createElementNS(MOA_NS_URI, "ServiceTypeIdentifier");
+ tslServiceInfo.setTextContent(tslInfos.getServiceTypeIdentifier());
+ tslInfoElement.appendChild(tslServiceInfo);
+
+ }
+
+ // append qualifiers
+ if (tslInfos.getQualifiers() != null && tslInfos.getQualifiers().size() > 0) {
+ final Element tslQualifiers = response.createElementNS(MOA_NS_URI, "Qualifiers");
+
+ for (final String el : tslInfos.getQualifiers()) {
+ final Element tslQualifier = response.createElementNS(MOA_NS_URI, "Qualifier");
+ tslQualifier.setTextContent(el);
+ tslQualifiers.appendChild(tslQualifier);
+
+ }
+
+ tslInfoElement.appendChild(tslQualifiers);
+
+ }
+
+ // append additional service information
+ if (tslInfos.getAdditionalServiceInformation() != null
+ && tslInfos.getAdditionalServiceInformation().size() > 0) {
+ final Element tslAdditionalServiceInformations = response.createElementNS(MOA_NS_URI,
+ "AdditionalServiceInformations");
+
+ for (final String el : tslInfos.getAdditionalServiceInformation()) {
+ final Element tslAdditionalServiceInformation = response.createElementNS(MOA_NS_URI,
+ "AdditionalServiceInformation");
+ tslAdditionalServiceInformation.setTextContent(el);
+ tslAdditionalServiceInformations.appendChild(tslAdditionalServiceInformation);
+
+ }
+ tslInfoElement.appendChild(tslAdditionalServiceInformations);
+
+ }
}
-
- Element publicAuthorityElem =
- isPublicAuthority
- ? response.createElementNS(MOA_NS_URI, "PublicAuthority")
- : null;
- Element codeElem =
- publicAuthorityID != null
- ? response.createElementNS(MOA_NS_URI, "Code")
- : null;
+
+ final Element publicAuthorityElem =
+ isPublicAuthority
+ ? response.createElementNS(MOA_NS_URI, "PublicAuthority")
+ : null;
+ final Element codeElem =
+ publicAuthorityID != null
+ ? response.createElementNS(MOA_NS_URI, "Code")
+ : null;
// fill in text
x509IssuerElem.appendChild(response.createTextNode(issuer));
x509SerialNumberElem.appendChild(response.createTextNode(serialNumber));
try {
- RFC2253NameParser parser =
- new RFC2253NameParser(cert.getSubjectDN().getName());
- String subjectRfc2253 = parser.parse().getRFC2253String();
+ final RFC2253NameParser parser =
+ new RFC2253NameParser(cert.getSubjectDN().getName());
+ final String subjectRfc2253 = parser.parse().getRFC2253String();
x509SubjectNameElem.appendChild(response.createTextNode(subjectRfc2253));
- } catch (RFC2253NameParserException e) {
+ } catch (final RFC2253NameParserException e) {
x509SubjectNameElem.appendChild(
- response.createTextNode(cert.getSubjectDN().getName()));
+ response.createTextNode(cert.getSubjectDN().getName()));
}
try {
x509CertificateElem.appendChild(
- response.createTextNode(Base64Utils.encode(cert.getEncoded())));
- } catch (CertificateEncodingException e) {
+ response.createTextNode(Base64Utils.encode(cert.getEncoded())));
+ } catch (final CertificateEncodingException e) {
throw new MOAApplicationException("2245", null, e);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new MOAApplicationException("2245", null, e);
}
@@ -275,10 +285,11 @@ public class ResponseBuilderUtils {
x509DataElem.appendChild(x509IssuerSerialElem);
x509DataElem.appendChild(x509CertificateElem);
if (isQualified) {
- if (qcSource.compareToIgnoreCase("TSL") == 0)
- qualifiedCertificateElem.setAttributeNS(MOA_NS_URI, "Source", qcSource);
-
- x509DataElem.appendChild(qualifiedCertificateElem);
+ if (qcSource.compareToIgnoreCase("TSL") == 0) {
+ qualifiedCertificateElem.setAttributeNS(MOA_NS_URI, "Source", qcSource);
+ }
+
+ x509DataElem.appendChild(qualifiedCertificateElem);
}
if (isPublicAuthority) {
x509DataElem.appendChild(publicAuthorityElem);
@@ -288,16 +299,18 @@ public class ResponseBuilderUtils {
}
}
if (isSSCD) {
- sscdElem.setAttributeNS(MOA_NS_URI, "Source", sscdSource);
- x509DataElem.appendChild(sscdElem);
- }
- if (issuerCountryCodeElem != null)
- x509DataElem.appendChild(issuerCountryCodeElem);
-
- //add TSL infos to X509Date if TSL infos exists
- if (tslInfoElement != null)
- x509DataElem.appendChild(tslInfoElement);
-
+ sscdElem.setAttributeNS(MOA_NS_URI, "Source", sscdSource);
+ x509DataElem.appendChild(sscdElem);
+ }
+ if (issuerCountryCodeElem != null) {
+ x509DataElem.appendChild(issuerCountryCodeElem);
+ }
+
+ // add TSL infos to X509Date if TSL infos exists
+ if (tslInfoElement != null) {
+ x509DataElem.appendChild(tslInfoElement);
+ }
+
signerInfoElem.appendChild(x509DataElem);
root.appendChild(signerInfoElem);
}
@@ -305,24 +318,24 @@ public class ResponseBuilderUtils {
/**
* Add an element containing <code>Code</code> and <code>Info</code>
* subelements.
- *
- * @param response The response document, in order to create new elements in
- * it.
- * @param root The root element into which to insert the newly created
- * element.
+ *
+ * @param response The response document, in order to create new elements in
+ * it.
+ * @param root The root element into which to insert the newly created
+ * element.
* @param elementName The name of the newly created element.
- * @param code The content of the <code>Code</code> subelement.
- * @param info The content of the <code>Info</code> subelement.
+ * @param code The content of the <code>Code</code> subelement.
+ * @param info The content of the <code>Info</code> subelement.
*/
public static void addCodeInfoElement(
- Document response,
- Element root,
- String elementName,
- int code,
- NodeList info) {
-
- Element codeInfoElem = response.createElementNS(MOA_NS_URI, elementName);
- Element codeElem = response.createElementNS(MOA_NS_URI, "Code");
+ Document response,
+ Element root,
+ String elementName,
+ int code,
+ NodeList info) {
+
+ final Element codeInfoElem = response.createElementNS(MOA_NS_URI, elementName);
+ final Element codeElem = response.createElementNS(MOA_NS_URI, "Code");
Element infoElem;
int i;
@@ -338,34 +351,34 @@ public class ResponseBuilderUtils {
}
root.appendChild(codeInfoElem);
}
-
+
/**
* Add an element containing <code>Code</code> and <code>Info</code>
* subelements.
- *
- * @param response The response document, in order to create new elements in
- * it.
- * @param root The root element into which to insert the newly created
- * element.
+ *
+ * @param response The response document, in order to create new elements in
+ * it.
+ * @param root The root element into which to insert the newly created
+ * element.
* @param elementName The name of the newly created element.
- * @param code The content of the <code>Code</code> subelement.
- * @param info The content of the <code>Info</code> subelement.
+ * @param code The content of the <code>Code</code> subelement.
+ * @param info The content of the <code>Info</code> subelement.
*/
public static void addCodeInfoElement(
- Document response,
- Element root,
- String elementName,
- int code,
- String info) {
-
- Element codeInfoElem = response.createElementNS(MOA_NS_URI, elementName);
- Element codeElem = response.createElementNS(MOA_NS_URI, "Code");
+ Document response,
+ Element root,
+ String elementName,
+ int code,
+ String info) {
+
+ final Element codeInfoElem = response.createElementNS(MOA_NS_URI, elementName);
+ final Element codeElem = response.createElementNS(MOA_NS_URI, "Code");
Element infoElem;
- int i;
+ final int i;
codeElem.appendChild(response.createTextNode(Integer.toString(code)));
codeInfoElem.appendChild(codeElem);
-
+
if (info != null) {
infoElem = response.createElementNS(MOA_NS_URI, "Info");
infoElem.appendChild(response.createTextNode(info));
@@ -375,86 +388,138 @@ public class ResponseBuilderUtils {
}
public static void addSigningTime(Document response,
- Element root,
- Date signingTime) {
- if(signingTime != null) {
- Element extElem = response.createElementNS(MOA_NS_URI, "SigningTime");
- TimeZone tz = TimeZone.getTimeZone("UTC");
- Calendar calendar = new GregorianCalendar();
+ Element root,
+ Date signingTime) {
+ if (signingTime != null) {
+ final Element extElem = response.createElementNS(MOA_NS_URI, "SigningTime");
+ final TimeZone tz = TimeZone.getTimeZone("UTC");
+ final Calendar calendar = new GregorianCalendar();
calendar.setTimeZone(tz);
calendar.setTime(signingTime);
- String date = DatatypeConverter.printDateTime(calendar);
+ final String date = DatatypeConverter.printDateTime(calendar);
extElem.appendChild(response.createTextNode(date));
root.appendChild(extElem);
}
}
+ public static void addSignatureAlgorithm(Document response,
+ Element root,
+ String algorithm) {
+ if (algorithm != null) {
+ final Element extElem = response.createElementNS(MOA_NS_URI, "SignatureAlgorithm");
+ extElem.appendChild(response.createTextNode(algorithm));
+ root.appendChild(extElem);
+ }
+ }
+
+ public static void addSignatureCoversFullPDF(Document response,
+ Element root,
+ Boolean coversFull) {
+ if (coversFull != null) {
+ final Element extElem = response.createElementNS(MOA_NS_URI, "SignatureCoversFullPDF");
+ extElem.appendChild(response.createTextNode(String.valueOf(coversFull)));
+ root.appendChild(extElem);
+ }
+ }
+
+ public static void addSignatureByteRange(Document response,
+ Element root,
+ int[] byteRange) {
+ if (byteRange != null) {
+ String byteRangeTextual = StringUtils.EMPTY;
+ for (final int el : byteRange) {
+ byteRangeTextual += "," + String.valueOf(el);
+ }
+
+ final Element extElem = response.createElementNS(MOA_NS_URI, "SignatureByteRange");
+ extElem.appendChild(response.createTextNode(byteRangeTextual.substring(1)));
+ root.appendChild(extElem);
+ }
+ }
+
+ public static Element createAndAddChildElement(Document response, Element root, String name) {
+ final Element element = response.createElementNS(MOA_NS_URI, name);
+ root.appendChild(element);
+ return element;
+
+ }
+
+ public static void addHashAlgorithm(Document response,
+ Element root,
+ String algorithm) {
+ if (algorithm != null) {
+ final Element extElem = response.createElementNS(MOA_NS_URI, "HashAlgorithm");
+ extElem.appendChild(response.createTextNode(algorithm));
+ root.appendChild(extElem);
+ }
+ }
+
public static void addExtendendResult(Document response,
- Element root,
- ExtendedCertificateCheckResult result) {
- Element extElem = response.createElementNS(MOA_NS_URI, "ExtendedCertificateCheck");
-
- Element extMajorElem = response.createElementNS(MOA_NS_URI, "Major");
-
- Element codeMajorCodeElem = response.createElementNS(MOA_NS_URI, "Code");
- Element codeMajorNameElem = response.createElementNS(MOA_NS_URI, "Name");
- codeMajorCodeElem.appendChild(response.createTextNode(Integer.toString(
- result.getMajorCode())));
- codeMajorNameElem.appendChild(response.createTextNode(result.getMajorInfo()));
-
- extMajorElem.appendChild(codeMajorCodeElem);
- extMajorElem.appendChild(codeMajorNameElem);
-
- extElem.appendChild(extMajorElem);
-
- if(result.getMinorCode() >= 0) {
- Element extMinorElem = response.createElementNS(MOA_NS_URI, "Minor");
- Element codeMinorCodeElem = response.createElementNS(MOA_NS_URI, "Code");
- Element codeMinorNameElem = response.createElementNS(MOA_NS_URI, "Name");
- codeMinorCodeElem.appendChild(response.createTextNode(Integer.toString(
- result.getMinorCode())));
- codeMinorNameElem.appendChild(response.createTextNode(result.getMinorInfo()));
-
- extMinorElem.appendChild(codeMinorCodeElem);
- extMinorElem.appendChild(codeMinorNameElem);
-
- extElem.appendChild(extMinorElem);
- }
-
- root.appendChild(extElem);
+ Element root,
+ ExtendedCertificateCheckResult result) {
+ final Element extElem = response.createElementNS(MOA_NS_URI, "ExtendedCertificateCheck");
+
+ final Element extMajorElem = response.createElementNS(MOA_NS_URI, "Major");
+
+ final Element codeMajorCodeElem = response.createElementNS(MOA_NS_URI, "Code");
+ final Element codeMajorNameElem = response.createElementNS(MOA_NS_URI, "Name");
+ codeMajorCodeElem.appendChild(response.createTextNode(Integer.toString(
+ result.getMajorCode())));
+ codeMajorNameElem.appendChild(response.createTextNode(result.getMajorInfo()));
+
+ extMajorElem.appendChild(codeMajorCodeElem);
+ extMajorElem.appendChild(codeMajorNameElem);
+
+ extElem.appendChild(extMajorElem);
+
+ if (result.getMinorCode() >= 0) {
+ final Element extMinorElem = response.createElementNS(MOA_NS_URI, "Minor");
+ final Element codeMinorCodeElem = response.createElementNS(MOA_NS_URI, "Code");
+ final Element codeMinorNameElem = response.createElementNS(MOA_NS_URI, "Name");
+ codeMinorCodeElem.appendChild(response.createTextNode(Integer.toString(
+ result.getMinorCode())));
+ codeMinorNameElem.appendChild(response.createTextNode(result.getMinorInfo()));
+
+ extMinorElem.appendChild(codeMinorCodeElem);
+ extMinorElem.appendChild(codeMinorNameElem);
+
+ extElem.appendChild(extMinorElem);
+ }
+
+ root.appendChild(extElem);
}
-
+
/**
* Add an element containing <code>Code</code> and <code>Info</code>
* subelements.
- *
- * @param response The response document, in order to create new elements in
- * it.
- * @param root The root element into which to insert the newly created
- * element.
+ *
+ * @param response The response document, in order to create new elements in
+ * it.
+ * @param root The root element into which to insert the newly created
+ * element.
* @param elementName The name of the newly created element.
- * @param code The content of the <code>Code</code> subelement.
- * @param info The content of the <code>Info</code> subelement.
+ * @param code The content of the <code>Code</code> subelement.
+ * @param info The content of the <code>Info</code> subelement.
*/
public static void addFormCheckElement(
- Document response,
- Element root,
- String elementName,
- int code,
- String name) {
-
- Element codeInfoElem = response.createElementNS(MOA_NS_URI, elementName);
- Element codeElem = response.createElementNS(MOA_NS_URI, "Code");
+ Document response,
+ Element root,
+ String elementName,
+ int code,
+ String name) {
+
+ final Element codeInfoElem = response.createElementNS(MOA_NS_URI, elementName);
+ final Element codeElem = response.createElementNS(MOA_NS_URI, "Code");
Element infoElem;
-
+
codeElem.appendChild(response.createTextNode(Integer.toString(code)));
codeInfoElem.appendChild(codeElem);
-
+
infoElem = response.createElementNS(MOA_NS_URI, "Name");
infoElem.appendChild(response.createTextNode(name));
codeInfoElem.appendChild(infoElem);
-
+
root.appendChild(codeInfoElem);
}
-
+
}
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 6dc4803..7a246d6 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
@@ -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;
@@ -48,9 +47,9 @@ import at.gv.egovernment.moaspss.util.DOMUtils;
import at.gv.egovernment.moaspss.util.XPathUtils;
/**
- * A parser to parse XMLDsig <code>Transform</code> DOM elements into their
- * MOA SPSS API representation.
- *
+ * A parser to parse XMLDsig <code>Transform</code> DOM elements into their MOA
+ * SPSS API representation.
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -60,39 +59,38 @@ public class TransformParser {
//
private static final String DSIG = Constants.DSIG_PREFIX + ":";
private static final String DSIG_FILTER2 =
- Constants.DSIG_FILTER2_PREFIX + ":";
+ Constants.DSIG_FILTER2_PREFIX + ":";
private static final String XSLT = Constants.XSLT_PREFIX + ":";
private static final String EC = Constants.DSIG_EC_PREFIX + ":";
private static final String TRANSFORM_XPATH = DSIG + "Transform";
private static final String XPATH_XPATH = DSIG + "XPath";
private static final String XSLT_ELEMENT_XPATH = XSLT + "stylesheet";
private static final String XPATH2_XPATH =
- (DSIG_FILTER2 + "XPath[@Filter=\"intersect\"] | ")
- + (DSIG_FILTER2 + "XPath[@Filter=\"subtract\"] | ")
- + (DSIG_FILTER2 + "XPath[@Filter=\"union\"]");
+ DSIG_FILTER2 + "XPath[@Filter=\"intersect\"] | "
+ + DSIG_FILTER2 + "XPath[@Filter=\"subtract\"] | "
+ + DSIG_FILTER2 + "XPath[@Filter=\"union\"]";
private static final String INCLUSIVE_NAMESPACES_XPATH =
- EC + "InclusiveNamespaces";
+ EC + "InclusiveNamespaces";
/**
* The <code>SPSSFactory</code> to use for creating new API objects.
*/
- private SPSSFactory factory = SPSSFactory.getInstance();
+ private final SPSSFactory factory = SPSSFactory.getInstance();
/**
* Parse an XMLDsig <code>Transforms</code> DOM element.
- *
+ *
* @param transformsElem The <code>Transforms</code> DOM element to parse.
- * @return A <code>List</code> of <code>Transform</code> API objects
- * containing the data from the individual <code>Transform</code> DOM
- * elements.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>Transforms</code> DOM element.
+ * @return A <code>List</code> of <code>Transform</code> API objects containing
+ * the data from the individual <code>Transform</code> DOM elements.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>Transforms</code> DOM element.
*/
public List parseTransforms(Element transformsElem)
- throws MOAApplicationException {
- List transforms = new ArrayList();
- NodeIterator transformElems =
- XPathUtils.selectNodeIterator(transformsElem, TRANSFORM_XPATH);
+ throws MOAApplicationException {
+ final List transforms = new ArrayList();
+ final NodeIterator transformElems =
+ XPathUtils.selectNodeIterator(transformsElem, TRANSFORM_XPATH);
Element transformElem;
Transform transform;
@@ -106,34 +104,31 @@ public class TransformParser {
/**
* Parse an XMLDsig <code>Transform</code> DOM element.
- *
+ *
* @param transformElem <code>Transform</code> DOM element to parse.
- * @return The <code>Transform</code> API object containing the data
- * from the <code>Transform</code> DOM element.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>Transform</code> DOM element.
+ * @return The <code>Transform</code> API object containing the data from the
+ * <code>Transform</code> DOM element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>Transform</code> DOM element.
*/
public Transform parseTransform(Element transformElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- String algorithmUri = transformElem.getAttribute("Algorithm");
+ final String algorithmUri = transformElem.getAttribute("Algorithm");
if (CanonicalizationTransform.CANONICAL_XML.equals(algorithmUri)
- || CanonicalizationTransform.CANONICAL_XML_WITH_COMMENTS.equals(
- algorithmUri)) {
+ || CanonicalizationTransform.CANONICAL_XML_WITH_COMMENTS.equals(
+ algorithmUri)) {
return factory.createCanonicalizationTransform(algorithmUri);
- } else if (
- ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML.equals(
+ } else if (ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML.equals(
algorithmUri)
- || ExclusiveCanonicalizationTransform
- .EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS
- .equals(
- algorithmUri)) {
+ || ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS
+ .equals(
+ algorithmUri)) {
return parseExclusiveC14nTransform(algorithmUri, transformElem);
} else if (Base64Transform.BASE64_DECODING.equals(algorithmUri)) {
return factory.createBase64Transform();
- } else if (
- EnvelopedSignatureTransform.ENVELOPED_SIGNATURE.equals(algorithmUri)) {
+ } else if (EnvelopedSignatureTransform.ENVELOPED_SIGNATURE.equals(algorithmUri)) {
return factory.createEnvelopedSignatureTransform();
} else if (XPathTransform.XPATH.equals(algorithmUri)) {
return parseXPathTransform(transformElem);
@@ -148,49 +143,47 @@ public class TransformParser {
/**
* Parse an exclusive canonicalization type of transform.
- *
- * @param algorithmUri The algorithm URI of the canonicalization algorithm.
+ *
+ * @param algorithmUri The algorithm URI of the canonicalization algorithm.
* @param transformElem The <code>Transform</code> DOM element to parse.
* @return An <code>ExclusiveCanonicalizationTransform</code> API object
- * containing the data from the <code>transformElem</code>.
+ * containing the data from the <code>transformElem</code>.
*/
private Transform parseExclusiveC14nTransform(
- String algorithmUri,
- Element transformElem)
- {
+ String algorithmUri,
+ Element transformElem) {
- Element inclusiveNamespacesElem =
- (Element) XPathUtils.selectSingleNode(
- transformElem,
- INCLUSIVE_NAMESPACES_XPATH);
+ final Element inclusiveNamespacesElem =
+ (Element) XPathUtils.selectSingleNode(
+ transformElem,
+ INCLUSIVE_NAMESPACES_XPATH);
- List inclusiveNamespaces = new ArrayList();
- if (inclusiveNamespacesElem != null)
- {
- StringTokenizer tokenizer = new StringTokenizer(inclusiveNamespacesElem.getAttribute("PrefixList"));
- while (tokenizer.hasMoreTokens())
- {
+ final List inclusiveNamespaces = new ArrayList();
+ if (inclusiveNamespacesElem != null) {
+ final StringTokenizer tokenizer = new StringTokenizer(inclusiveNamespacesElem.getAttribute(
+ "PrefixList"));
+ while (tokenizer.hasMoreTokens()) {
inclusiveNamespaces.add(tokenizer.nextToken());
}
}
return factory.createExclusiveCanonicalizationTransform(
- algorithmUri,
- inclusiveNamespaces);
+ algorithmUri,
+ inclusiveNamespaces);
}
/**
* Parse an <code>XPath</code> type of <code>Transform</code>.
- *
+ *
* @param transformElem The <code>Transform</code> DOM element to parse.
* @return The <code>Transform</code> API object representation of the
- * <code>Transform</code> DOM element.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>Transform</code> DOM element.
+ * <code>Transform</code> DOM element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>Transform</code> DOM element.
*/
private Transform parseXPathTransform(Element transformElem)
- throws MOAApplicationException {
- Element xPathElem =
- (Element) XPathUtils.selectSingleNode(transformElem, XPATH_XPATH);
+ throws MOAApplicationException {
+ final Element xPathElem =
+ (Element) XPathUtils.selectSingleNode(transformElem, XPATH_XPATH);
Map nsDecls;
if (xPathElem == null) {
@@ -205,22 +198,22 @@ public class TransformParser {
/**
* Parse an <code>XPathFilter2</code> type of <code>Transform</code>.
- *
+ *
* @param transformElem The <code>Transform</code> DOM element to parse.
* @return The <code>Transform</code> API object representation of the
- * <code>Transform</code> DOM element.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>Transform</code> DOM element.
+ * <code>Transform</code> DOM element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>Transform</code> DOM element.
*/
private Transform parseXPathFilter2Transform(Element transformElem)
- throws MOAApplicationException {
- List filters = new ArrayList();
- NodeIterator iter =
- XPathUtils.selectNodeIterator(transformElem, XPATH2_XPATH);
+ throws MOAApplicationException {
+ final List filters = new ArrayList();
+ final NodeIterator iter =
+ XPathUtils.selectNodeIterator(transformElem, XPATH2_XPATH);
Element filterElem;
while ((filterElem = (Element) iter.nextNode()) != null) {
- String filterAttr = filterElem.getAttribute("Filter");
+ final String filterAttr = filterElem.getAttribute("Filter");
String filterType;
String expression;
Map nsDecls;
@@ -247,17 +240,17 @@ public class TransformParser {
/**
* Parse an <code>XSLT</code> type of <code>Transform</code>.
- *
+ *
* @param transformElem The <code>Transform</code> DOM element to parse.
* @return The <code>Transform</code> API object representation of the
- * <code>Transform</code> DOM element.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>Transform</code> DOM element.
+ * <code>Transform</code> DOM element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>Transform</code> DOM element.
*/
private Transform parseXSLTTransform(Element transformElem)
- throws MOAApplicationException {
- Element xsltElem =
- (Element) XPathUtils.selectSingleNode(transformElem, XSLT_ELEMENT_XPATH);
+ throws MOAApplicationException {
+ final Element xsltElem =
+ (Element) XPathUtils.selectSingleNode(transformElem, XSLT_ELEMENT_XPATH);
if (xsltElem == null) {
throw new MOAApplicationException("2215", null);
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 cb07b34..bcab978 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
@@ -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.io.InputStream;
@@ -39,7 +38,6 @@ 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.logging.Logger;
import at.gv.egovernment.moaspss.util.Base64Utils;
import at.gv.egovernment.moaspss.util.CollectionUtils;
import at.gv.egovernment.moaspss.util.Constants;
@@ -49,7 +47,7 @@ import at.gv.egovernment.moaspss.util.XPathUtils;
/**
* A parser to parse <code>VerifyCMSSignatureRequest</code> DOM trees into
* <code>VerifyCMSSignatureRequest</code> API objects.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -63,7 +61,7 @@ public class VerifyCMSSignatureRequestParser {
private static final String EXTENDED_VALIDATION_XPATH = MOA + "ExtendedValidation";
private static final String CMS_SIGNATURE_XPATH = MOA + "CMSSignature";
private static final String PDF_SIGNATURE_XPATH = MOA + "PDFSignature";
-
+
private static final String TRUST_PROFILE_ID_XPATH = MOA + "TrustProfileID";
private static final String DATA_OBJECT_XPATH = MOA + "DataObject";
private static final String META_INFO_XPATH = MOA + "MetaInfo";
@@ -72,110 +70,109 @@ public class VerifyCMSSignatureRequestParser {
private static final String EXCLUDEBYTERANGE_FROM_XPATH = MOA + "ExcludedByteRange/" + MOA + "From";
private static final String EXCLUDEBYTERANGE_TO_XPATH = MOA + "ExcludedByteRange/" + MOA + "To";
-
/** The <code>SPSSFactory</code> for creating new API objects. */
- private SPSSFactory factory = SPSSFactory.getInstance();
+ private final SPSSFactory factory = SPSSFactory.getInstance();
/**
- * Parse a <code>VerifyCMSSignatureRequest</code> DOM element, as defined
- * by the MOA schema.
- *
+ * Parse a <code>VerifyCMSSignatureRequest</code> DOM element, as defined by the
+ * MOA schema.
+ *
* @param requestElem The <code>VerifyCMSSignatureRequest</code> to parse. The
- * request must have been successfully parsed against the schema for this
- * method to succeed.
- * @return A <code>VerifyCMSSignatureRequest</code> API objects containing
- * the data from the DOM element.
+ * request must have been successfully parsed against the
+ * schema for this method to succeed.
+ * @return A <code>VerifyCMSSignatureRequest</code> 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, PDF_SIGNATURE_XPATH, "");
- CMSDataObject dataObject = parseDataObject(requestElem);
- String trustProfileID =
- XPathUtils.getElementValue(requestElem, TRUST_PROFILE_ID_XPATH, null);
- //Logger.info("CMSSignature: " + cmsSignatureStr);
- InputStream cmsSignature =
- Base64Utils.decodeToStream(cmsSignatureStr, true);
+ throws MOAApplicationException {
+
+ final int[] signatories = parseSignatories(requestElem);
+ final Date dateTime =
+ RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH);
+ final boolean extendedValidation =
+ RequestParserUtils.parseExtendedValidation(requestElem, EXTENDED_VALIDATION_XPATH, false);
+
+ final String cmsSignatureStr =
+ XPathUtils.getElementValue(requestElem, PDF_SIGNATURE_XPATH, "");
+ final CMSDataObject dataObject = parseDataObject(requestElem);
+ final String trustProfileID =
+ XPathUtils.getElementValue(requestElem, TRUST_PROFILE_ID_XPATH, null);
+ // Logger.info("CMSSignature: " + cmsSignatureStr);
+ final InputStream cmsSignature =
+ Base64Utils.decodeToStream(cmsSignatureStr, true);
return factory.createVerifyCMSSignatureRequest(
- signatories,
- dateTime,
- cmsSignature,
- dataObject,
- trustProfileID,
- true,
- extendedValidation);
+ signatories,
+ dateTime,
+ cmsSignature,
+ dataObject,
+ trustProfileID,
+ true,
+ extendedValidation);
}
-
+
/**
- * Parse a <code>VerifyCMSSignatureRequest</code> DOM element, as defined
- * by the MOA schema.
- *
+ * Parse a <code>VerifyCMSSignatureRequest</code> DOM element, as defined by the
+ * MOA schema.
+ *
* @param requestElem The <code>VerifyCMSSignatureRequest</code> to parse. The
- * request must have been successfully parsed against the schema for this
- * method to succeed.
- * @return A <code>VerifyCMSSignatureRequest</code> API objects containing
- * the data from the DOM element.
+ * request must have been successfully parsed against the
+ * schema for this method to succeed.
+ * @return A <code>VerifyCMSSignatureRequest</code> API objects containing the
+ * data from the DOM element.
* @throws MOAApplicationException An error occurred parsing the request.
*/
public VerifyCMSSignatureRequest parse(Element requestElem)
- throws MOAApplicationException {
-
- int[] signatories = parseSignatories(requestElem);
- Date dateTime =
- RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH);
- 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);
+ throws MOAApplicationException {
+
+ final int[] signatories = parseSignatories(requestElem);
+ final Date dateTime =
+ RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH);
+ final boolean extendedValidation =
+ RequestParserUtils.parseExtendedValidation(requestElem, EXTENDED_VALIDATION_XPATH, false);
+
+ final String cmsSignatureStr =
+ XPathUtils.getElementValue(requestElem, CMS_SIGNATURE_XPATH, "");
+ final CMSDataObject dataObject = parseDataObject(requestElem);
+ final String trustProfileID =
+ XPathUtils.getElementValue(requestElem, TRUST_PROFILE_ID_XPATH, null);
+ final InputStream cmsSignature =
+ Base64Utils.decodeToStream(cmsSignatureStr, true);
return factory.createVerifyCMSSignatureRequest(
- signatories,
- dateTime,
- cmsSignature,
- dataObject,
- trustProfileID,
- false,
- extendedValidation);
+ signatories,
+ dateTime,
+ cmsSignature,
+ dataObject,
+ trustProfileID,
+ false,
+ extendedValidation);
}
/**
- * Parse the <code>Signatories</code> attribute contained in the
+ * Parse the <code>Signatories</code> attribute contained in the
* <code>VerifyCMSSignatureRequest</code> DOM element.
- *
+ *
* @param requestElem The <code>VerifyCMSSignatureRequest</code> DOM element.
- * @return The signatories contained in the given
- * <code>VerifyCMSSignatureRequest</code> DOM element.
+ * @return The signatories contained in the given
+ * <code>VerifyCMSSignatureRequest</code> DOM element.
*/
private int[] parseSignatories(Element requestElem) {
- String signatoriesStr = requestElem.getAttribute("Signatories");
+ final String signatoriesStr = requestElem.getAttribute("Signatories");
if ("all".equals(signatoriesStr)) {
return VerifyCMSSignatureRequest.ALL_SIGNATORIES;
} else {
- StringTokenizer tokenizer = new StringTokenizer(signatoriesStr);
- List signatoriesList = new ArrayList();
+ final StringTokenizer tokenizer = new StringTokenizer(signatoriesStr);
+ final List signatoriesList = new ArrayList();
int[] signatories;
// put the signatories into a List
while (tokenizer.hasMoreTokens()) {
try {
signatoriesList.add(new Integer(tokenizer.nextToken()));
- } catch (NumberFormatException e) {
+ } catch (final NumberFormatException e) {
// this cannot occur if the request has been validated
}
}
@@ -188,44 +185,47 @@ public class VerifyCMSSignatureRequestParser {
}
/**
- * Parse a the <code>DataObject</code> DOM element contained in a given
+ * Parse a the <code>DataObject</code> DOM element contained in a given
* <code>VerifyCMSSignatureRequest</code> DOM element.
- *
- * @param requestElem The <code>VerifyCMSSignatureRequest</code> DOM element
- * to parse.
- * @return The <code>CMSDataObject</code> API object containing the data
- * from the <code>DataObject</code> DOM element.
+ *
+ * @param requestElem The <code>VerifyCMSSignatureRequest</code> DOM element to
+ * parse.
+ * @return The <code>CMSDataObject</code> API object containing the data from
+ * the <code>DataObject</code> DOM element.
*/
private CMSDataObject parseDataObject(Element requestElem) {
- Element dataObjectElem =
- (Element) XPathUtils.selectSingleNode(requestElem, DATA_OBJECT_XPATH);
+ final Element dataObjectElem =
+ (Element) XPathUtils.selectSingleNode(requestElem, DATA_OBJECT_XPATH);
if (dataObjectElem != null) {
- Element metaInfoElem =
- (Element) XPathUtils.selectSingleNode(dataObjectElem, META_INFO_XPATH);
+ final Element metaInfoElem =
+ (Element) XPathUtils.selectSingleNode(dataObjectElem, META_INFO_XPATH);
MetaInfo metaInfo = null;
- Element contentElem =
- (Element) XPathUtils.selectSingleNode(dataObjectElem, CONTENT_XPATH);
- CMSContent content = parseContent(contentElem);
+ final Element contentElem =
+ (Element) XPathUtils.selectSingleNode(dataObjectElem, CONTENT_XPATH);
+ final CMSContent content = parseContent(contentElem);
if (metaInfoElem != null) {
metaInfo = RequestParserUtils.parseMetaInfo(metaInfoElem);
}
- String excludeByteRangeFromStr = XPathUtils.getElementValue(dataObjectElem, EXCLUDEBYTERANGE_FROM_XPATH, null);
- String excludeByteRangeToStr = XPathUtils.getElementValue(dataObjectElem, EXCLUDEBYTERANGE_TO_XPATH, null);
-
+ final String excludeByteRangeFromStr = XPathUtils.getElementValue(dataObjectElem,
+ EXCLUDEBYTERANGE_FROM_XPATH, null);
+ final String excludeByteRangeToStr = XPathUtils.getElementValue(dataObjectElem,
+ EXCLUDEBYTERANGE_TO_XPATH, null);
+
BigDecimal excludeByteRangeFrom = null;
BigDecimal excludeByteRangeTo = null;
-
- if (excludeByteRangeFromStr != null)
- excludeByteRangeFrom = new BigDecimal(excludeByteRangeFromStr);
- if (excludeByteRangeToStr != null)
- excludeByteRangeTo = new BigDecimal(excludeByteRangeToStr);
+
+ if (excludeByteRangeFromStr != null) {
+ excludeByteRangeFrom = new BigDecimal(excludeByteRangeFromStr);
+ }
+ if (excludeByteRangeToStr != null) {
+ excludeByteRangeTo = new BigDecimal(excludeByteRangeToStr);
+ }
return factory.createCMSDataObject(metaInfo, content, excludeByteRangeFrom, excludeByteRangeTo);
-
-
+
} else {
return null;
}
@@ -233,25 +233,25 @@ public class VerifyCMSSignatureRequestParser {
}
/**
- * Parse the content contained in a <code>CMSContentBaseType</code> kind of
- * DOM element.
- *
+ * Parse the content contained in a <code>CMSContentBaseType</code> kind of DOM
+ * element.
+ *
* @param contentElem The <code>CMSContentBaseType</code> kind of element to
- * parse.
- * @return A <code>CMSDataObject</code> API object containing the data
- * from the given DOM element.
+ * parse.
+ * @return A <code>CMSDataObject</code> API object containing the data from the
+ * given DOM element.
*/
private CMSContent parseContent(Element contentElem) {
- Element base64ContentElem =
- (Element) XPathUtils.selectSingleNode(contentElem, BASE64_CONTENT_XPATH);
+ final Element base64ContentElem =
+ (Element) XPathUtils.selectSingleNode(contentElem, BASE64_CONTENT_XPATH);
if (base64ContentElem != null) {
- String base64Str = DOMUtils.getText(base64ContentElem);
- InputStream binaryContent = Base64Utils.decodeToStream(base64Str, true);
+ final String base64Str = DOMUtils.getText(base64ContentElem);
+ final InputStream binaryContent = Base64Utils.decodeToStream(base64Str, true);
return factory.createCMSContent(binaryContent);
} else {
return factory.createCMSContent(
- contentElem.getAttribute("Reference"));
+ contentElem.getAttribute("Reference"));
}
}
}
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 30bf3c4..265d0f3 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
@@ -21,13 +21,10 @@
* 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 at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse;
-import at.gv.egovernment.moaspss.util.Constants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -38,132 +35,138 @@ import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElemen
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.moaspss.util.Constants;
/**
- * Convert a <code>VerifyCMSSignatureResponse</code> API object into its
- * XML representation, according to the MOA XML schema.
- *
+ * Convert a <code>VerifyCMSSignatureResponse</code> API object into its XML
+ * representation, according to the MOA XML schema.
+ *
* @author Patrick Peck
* @version $Id$
*/
public class VerifyCMSSignatureResponseBuilder {
/** The XML document containing the response element. */
- private Document responseDoc;
+ private final Document responseDoc;
/** The response <code>VerifyCMSSignatureResponse</code> DOM element. */
- private Element responseElem;
+ private final Element responseElem;
private boolean includeSigningTime = false;
/**
* Create a new <code>VerifyCMSSignatureResponseBuilder</code>:
- *
- * @throws MOASystemException An error occurred setting up the resulting
- * XML document.
+ *
+ * @throws MOASystemException An error occurred setting up the resulting XML
+ * document.
*/
public VerifyCMSSignatureResponseBuilder() throws MOASystemException {
responseDoc =
- ResponseBuilderUtils.createResponse("VerifyCMSSignatureResponse");
+ ResponseBuilderUtils.createResponse("VerifyCMSSignatureResponse");
responseElem = responseDoc.getDocumentElement();
}
- public VerifyCMSSignatureResponseBuilder(Document responseDoc, String name, boolean includeSigningTime) throws MOASystemException {
- this.responseDoc = responseDoc;
- responseElem = responseDoc.createElementNS(Constants.MOA_NS_URI, name);
- this.includeSigningTime = includeSigningTime;
- }
+ public VerifyCMSSignatureResponseBuilder(Document responseDoc, String name, boolean includeSigningTime)
+ throws MOASystemException {
+ this.responseDoc = responseDoc;
+ responseElem = responseDoc.createElementNS(Constants.MOA_NS_URI, name);
+ this.includeSigningTime = includeSigningTime;
+ }
+
+ public Element buildElement(VerifyCMSSignatureResponse response) throws MOAApplicationException {
+ this.build(response);
+ return responseElem;
+ }
- public Element buildElement(VerifyCMSSignatureResponse response) throws MOAApplicationException {
- this.build(response);
- return responseElem;
- }
-
/**
- * Build a document containing a <code>VerifyCMSSignatureResponse</code>
- * DOM element being the XML representation of the given
+ * Build a document containing a <code>VerifyCMSSignatureResponse</code> DOM
+ * element being the XML representation of the given
* <code>VerifyCMSSignatureResponse</code> API object.
- *
- * @param response The <code>VerifyCMSSignatureResponse</code> to convert
- * to XML.
- * @return A document containing the <code>VerifyCMSSignatureResponse</code>
- * DOM element.
+ *
+ * @param response The <code>VerifyCMSSignatureResponse</code> to convert to
+ * XML.
+ * @return A document containing the <code>VerifyCMSSignatureResponse</code> DOM
+ * element.
* @throws MOAApplicationException An error occurred building the response.
*/
public Document build(VerifyCMSSignatureResponse response)
- throws MOAApplicationException {
+ throws MOAApplicationException {
Iterator iter;
for (iter = response.getResponseElements().iterator(); iter.hasNext();) {
- VerifyCMSSignatureResponseElement responseElement =
- (VerifyCMSSignatureResponseElement) iter.next();
+ final 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 {
+ throws MOAApplicationException {
+
+ final SignerInfo signerInfo = responseElement.getSignerInfo();
+ final CheckResult signatureCheck = responseElement.getSignatureCheck();
+ final CheckResult certCheck = responseElement.getCertificateCheck();
- 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(),
- signerInfo.getTslInfos());
-
- if(this.includeSigningTime) {
+ responseDoc,
+ responseElem,
+ signerInfo.getSignerCertificate(),
+ signerInfo.isQualifiedCertificate(),
+ signerInfo.getQCSource(),
+ signerInfo.isPublicAuthority(),
+ signerInfo.getPublicAuhtorityID(),
+ signerInfo.isSSCD(),
+ signerInfo.getSSCDSource(),
+ signerInfo.getIssuerCountryCode(),
+ signerInfo.getTslInfos());
+
+ if (this.includeSigningTime) {
ResponseBuilderUtils.addSigningTime(responseDoc,
- responseElem, signerInfo.getSigningTime());
+ responseElem, signerInfo.getSigningTime());
}
+ ResponseBuilderUtils.addSignatureAlgorithm(responseDoc,
+ responseElem,
+ responseElement.getSignatureAlgorithm());
+
ResponseBuilderUtils.addCodeInfoElement(
- responseDoc,
- responseElem,
- "SignatureCheck",
- signatureCheck.getCode(),
- signatureCheck.getInfo());
+ responseDoc,
+ responseElem,
+ "SignatureCheck",
+ signatureCheck.getCode(),
+ signatureCheck.getInfo());
ResponseBuilderUtils.addCodeInfoElement(
- responseDoc,
- responseElem,
- "CertificateCheck",
- certCheck.getCode(),
- certCheck.getInfo());
-
+ 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());
-
- }
- }
-
- if(responseElement.getExtendedCertificateCheck() != null) {
- ResponseBuilderUtils.addExtendendResult(responseDoc, responseElem, responseElement.getExtendedCertificateCheck());
- }
-
+ final Iterator formIterator = responseElement.getAdESFormResults().iterator();
+
+ while (formIterator.hasNext()) {
+ final AdESFormResults adESFormResult = (AdESFormResults) formIterator.next();
+ // add the CertificateCheck
+ ResponseBuilderUtils.addFormCheckElement(responseDoc, responseElem, "FormCheckResult",
+ adESFormResult.getCode().intValue(), adESFormResult.getName());
+
+ }
+ }
+
+ if (responseElement.getExtendedCertificateCheck() != null) {
+ ResponseBuilderUtils.addExtendendResult(responseDoc, responseElem, responseElement
+ .getExtendedCertificateCheck());
+ }
+
}
}
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
index 0ca6f8f..b9b7d26 100644
--- 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
@@ -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.Iterator;
@@ -39,127 +38,144 @@ import at.gv.egovernment.moa.spss.api.xmlverify.AdESFormResults;
import at.gv.egovernment.moaspss.logging.Logger;
/**
- * Convert a <code>VerifyCMSSignatureResponse</code> API object into its
- * XML representation, according to the MOA XML schema.
- *
+ * Convert a <code>VerifyCMSSignatureResponse</code> 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;
+ private final Document responseDoc;
/** The response <code>VerifyCMSSignatureResponse</code> DOM element. */
- private Element responseRootElem;
+ private final Element responseRootElem;
/**
* Create a new <code>VerifyCMSSignatureResponseBuilder</code>:
- *
- * @throws MOASystemException An error occurred setting up the resulting
- * XML document.
+ *
+ * @throws MOASystemException An error occurred setting up the resulting XML
+ * document.
*/
public VerifyPDFSignatureResponseBuilder() throws MOASystemException {
responseDoc =
- ResponseBuilderUtils.createResponse("VerifyPDFSignatureResponse");
+ ResponseBuilderUtils.createResponse("VerifyPDFSignatureResponse");
responseRootElem = responseDoc.getDocumentElement();
}
-
+
/**
- * Build a document containing a <code>VerifyCMSSignatureResponse</code>
- * DOM element being the XML representation of the given
+ * Build a document containing a <code>VerifyCMSSignatureResponse</code> DOM
+ * element being the XML representation of the given
* <code>VerifyCMSSignatureResponse</code> API object.
- *
- * @param response The <code>VerifyCMSSignatureResponse</code> to convert
- * to XML.
- * @return A document containing the <code>VerifyCMSSignatureResponse</code>
- * DOM element.
+ *
+ * @param response The <code>VerifyCMSSignatureResponse</code> to convert to
+ * XML.
+ * @return A document containing the <code>VerifyCMSSignatureResponse</code> DOM
+ * element.
* @throws MOAApplicationException An error occurred building the response.
*/
public Document build(VerifyCMSSignatureResponse response)
- throws MOAApplicationException {
+ throws MOAApplicationException {
Iterator iter;
-
for (iter = response.getResponseElements().iterator(); iter.hasNext();) {
- VerifyCMSSignatureResponseElement responseElement =
- (VerifyCMSSignatureResponseElement) iter.next();
- Element signatureResult = ResponseBuilderUtils.addChildElement("SignatureResult", responseDoc, responseRootElem);
+ final VerifyCMSSignatureResponseElement responseElement =
+ (VerifyCMSSignatureResponseElement) iter.next();
+ final Element signatureResult = ResponseBuilderUtils.addChildElement("SignatureResult", responseDoc,
+ responseRootElem);
addResponseElement(responseElement, signatureResult);
-
+
}
-
+
return responseDoc;
}
/**
* Add an element to the response.
- *
+ *
* @param responseElement The element to add to the response.
- * @param signatureResult
+ * @param signatureResult
* @throws MOAApplicationException An error occurred adding the element.
*/
private void addResponseElement(VerifyCMSSignatureResponseElement responseElement, Element responseElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
+
+ final SignerInfo signerInfo = responseElement.getSignerInfo();
+ final CheckResult signatureCheck = responseElement.getSignatureCheck();
+ final CheckResult certCheck = responseElement.getCertificateCheck();
- SignerInfo signerInfo = responseElement.getSignerInfo();
- CheckResult signatureCheck = responseElement.getSignatureCheck();
- CheckResult certCheck = responseElement.getCertificateCheck();
-
if (signerInfo != null) {
- ResponseBuilderUtils.addSignerInfo(
- responseDoc,
- responseElem,
- signerInfo.getSignerCertificate(),
- signerInfo.isQualifiedCertificate(),
- signerInfo.getQCSource(),
- signerInfo.isPublicAuthority(),
- signerInfo.getPublicAuhtorityID(),
- signerInfo.isSSCD(),
- signerInfo.getSSCDSource(),
- signerInfo.getIssuerCountryCode(),
- signerInfo.getTslInfos());
-
- ResponseBuilderUtils.addSigningTime(responseDoc,
- responseElem,
- signerInfo.getSigningTime());
-
+ ResponseBuilderUtils.addSignerInfo(
+ responseDoc,
+ responseElem,
+ signerInfo.getSignerCertificate(),
+ signerInfo.isQualifiedCertificate(),
+ signerInfo.getQCSource(),
+ signerInfo.isPublicAuthority(),
+ signerInfo.getPublicAuhtorityID(),
+ signerInfo.isSSCD(),
+ signerInfo.getSSCDSource(),
+ signerInfo.getIssuerCountryCode(),
+ signerInfo.getTslInfos());
+
+ ResponseBuilderUtils.addSigningTime(responseDoc,
+ responseElem,
+ signerInfo.getSigningTime());
+
} else {
- Logger.info("Find signature result with no 'SignerInfo'. Maybe a signature verification Failed");
-
+ Logger.info("Find signature result with no 'SignerInfo'. Maybe a signature verification Failed");
+
}
+ ResponseBuilderUtils.addSignatureAlgorithm(responseDoc,
+ responseElem,
+ responseElement.getSignatureAlgorithm());
+
ResponseBuilderUtils.addCodeInfoElement(
- responseDoc,
- responseElem,
- "SignatureCheck",
- signatureCheck.getCode(),
- signatureCheck.getInfo());
+ responseDoc,
+ responseElem,
+ "SignatureCheck",
+ signatureCheck.getCode(),
+ signatureCheck.getInfo());
ResponseBuilderUtils.addCodeInfoElement(
- responseDoc,
- responseElem,
- "CertificateCheck",
- certCheck.getCode(),
- certCheck.getInfo());
-
+ 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());
-
- }
- }
-
- if(responseElement.getExtendedCertificateCheck() != null) {
- ResponseBuilderUtils.addExtendendResult(responseDoc, responseElem, responseElement.getExtendedCertificateCheck());
- }
-
+ final Iterator formIterator = responseElement.getAdESFormResults().iterator();
+
+ while (formIterator.hasNext()) {
+ final AdESFormResults adESFormResult = (AdESFormResults) formIterator.next();
+ // add the CertificateCheck
+ ResponseBuilderUtils.addFormCheckElement(responseDoc, responseElem, "FormCheckResult",
+ adESFormResult.getCode().intValue(), adESFormResult.getName());
+
+ }
+ }
+
+ if (responseElement.getExtendedCertificateCheck() != null) {
+ ResponseBuilderUtils.addExtendendResult(responseDoc, responseElem, responseElement
+ .getExtendedCertificateCheck());
+ }
+
+ // add additional PDF signature properteis
+ if (responseElement.getCoversFullDocument() != null ||
+ responseElement.getByteRangeOfSignature() != null) {
+ final Element pdfSigProps = ResponseBuilderUtils.createAndAddChildElement(responseDoc, responseElem,
+ "SignatureProperties");
+ ResponseBuilderUtils.addSignatureCoversFullPDF(responseDoc,
+ pdfSigProps,
+ responseElement.getCoversFullDocument());
+ ResponseBuilderUtils.addSignatureByteRange(responseDoc,
+ pdfSigProps,
+ responseElement.getByteRangeOfSignature());
+ }
+
}
}
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 f1bb1d7..1360c5f 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
@@ -51,236 +51,230 @@ import at.gv.egovernment.moaspss.util.XPathUtils;
*/
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 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 <code>SPSSFactory</code> for creating new API objects. */
- private SPSSFactory factory = SPSSFactory.getInstance();
-
- /**
- * Parse a <code>VerifyXMLSignatureRequest</code> DOM element, as defined
- * by the MOA schema.
- *
+ //
+ // 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 <code>SPSSFactory</code> for creating new API objects. */
+ private final SPSSFactory factory = SPSSFactory.getInstance();
+
+ /**
+ * Parse a <code>VerifyXMLSignatureRequest</code> DOM element, as defined by the
+ * MOA schema.
+ *
* @param requestElem The <code>VerifyXMLSignatureRequest</code> to parse. The
- * request must have been successfully parsed against the schema for this
- * method to succeed.
- * @return A <code>VerifyXMLSignatureRequest</code> API object containing
- * the data from the DOM element.
+ * request must have been successfully parsed against the
+ * schema for this method to succeed.
+ * @return A <code>VerifyXMLSignatureRequest</code> API object containing the
+ * data from the DOM element.
* @throws MOAApplicationException An error occurred parsing the request.
*/
public VerifyXMLSignatureRequest parse(Element requestElem)
- throws MOAApplicationException {
-
- Date dateTime =
- RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH);
-
- boolean extendedValidation =
- RequestParserUtils.parseExtendedValidation(requestElem, EXTENDED_VALIDATION_XPATH, false);
-
- VerifySignatureInfo verifySignatureInfo =
- parseVerifySignatureInfo(requestElem);
- List supplementProfiles = parseSupplementProfiles(requestElem);
- SignatureManifestCheckParams signatureManifestCheckParams =
- parseSignatureManifestCheckParams(requestElem);
- boolean returnHashInputData =
- XPathUtils.selectSingleNode(requestElem, RETURN_HASH_INPUT_DATA_XPATH)
- != null;
- String trustProfileID =
- XPathUtils.getElementValue(requestElem, TRUST_PROFILE_ID_XPATH, null);
+ throws MOAApplicationException {
+
+ final Date dateTime =
+ RequestParserUtils.parseDateTime(requestElem, DATE_TIME_XPATH);
+
+ final boolean extendedValidation =
+ RequestParserUtils.parseExtendedValidation(requestElem, EXTENDED_VALIDATION_XPATH, false);
+
+ final VerifySignatureInfo verifySignatureInfo =
+ parseVerifySignatureInfo(requestElem);
+ final List supplementProfiles = parseSupplementProfiles(requestElem);
+ final SignatureManifestCheckParams signatureManifestCheckParams =
+ parseSignatureManifestCheckParams(requestElem);
+ final boolean returnHashInputData =
+ XPathUtils.selectSingleNode(requestElem, RETURN_HASH_INPUT_DATA_XPATH) != null;
+ final String trustProfileID =
+ XPathUtils.getElementValue(requestElem, TRUST_PROFILE_ID_XPATH, null);
return factory.createVerifyXMLSignatureRequest(
- dateTime,
- verifySignatureInfo,
- supplementProfiles,
- signatureManifestCheckParams,
- returnHashInputData,
- trustProfileID,
- extendedValidation);
+ dateTime,
+ verifySignatureInfo,
+ supplementProfiles,
+ signatureManifestCheckParams,
+ returnHashInputData,
+ trustProfileID,
+ extendedValidation);
}
- /**
- * Parse the <code>VerifySignatureInfo</code> DOM element contained in the
- * <code>VerifyXMLSignatureRequest</code> DOM element.
- *
- * @param requestElem
- * The <code>VerifyXMLSignatureRequest</code> DOM element
- * containing the <code>VerifySignatureInfo</code> DOM element.
- * @return The <code>VerifySignatureInfo</code> 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 <code>VerifySignatureLocation</code> DOM element contained in
- * the given <code>VerifyXMLSignatureRequest</code> DOM element.
- *
- * @param requestElem
- * The <code>VerifyXMLSignatureRequst</code> DOM element.
- * @return The <code>VerifySignatureLocation</code> 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
- * <code>VerifyXMLSignatureRequest</code> DOM element.
- *
- * @param requestElem
- * The <code>VerifyXMLSignatureRequest</code> DOM element.
- * @return A <code>List</code> of <code>SupplementProfile</code> API objects
- * containing the data from the <code>SupplementProfile</code> 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 <code>SignatureManifestCheckParams</code> DOM element contained
- * in the given <code>VerifyXMLSignatureRequest</code> DOM element.
- *
- * @param requestElem
- * The <code>VerifyXMLSignatureRequest</code> DOM element.
- * @return The <code>SignatureManifestCheckParams</code> API object
- * containing the data from the
- * <code>SignatureManifestCheckParams</code> DOM element.
- * @throws MOAApplicationException
- * An error occurred parsing the
- * <code>SignatureManifestCheckParams</code> 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 <code>ReferenceInfo</code> DOM elements contained in a
- * <code>SignatureManifestCheckParams</code> DOM element.
- *
- * @param paramsElem
- * The <code>SignatureManifestCheckParams</code> DOM element
- * containing the <code>ReferenceInfo</code> DOM elements.
- * @return A <code>List</code> of <code>RefernceInfo</code> API objects
- * containing the data from the <code>ReferenceInfo</code> DOM
- * elements.
- * @throws MOAApplicationException
- * An error occurred parsing the <code>ReferenceInfo</code> 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 <code>ReferenceInfo</code> DOM element.
- *
- * @param refInfoElem
- * The <code>ReferenceInfo</code> DOM element to parse.
- * @return The <code>ReferenceInfo</code> API object containing the data
- * from the given <code>ReferenceInfo</code> DOM element.
- * @throws MOAApplicationException
- * An error occurred parsing the <code>ReferenceInfo</code> DOM
- * element.
- */
- private ReferenceInfo parseReferenceInfo(Element refInfoElem) throws MOAApplicationException {
- List profiles = parseVerifyTransformsInfoProfiles(refInfoElem);
- return factory.createReferenceInfo(profiles);
- }
-
- /**
- * Parse the <code>VerifyTransformsInfoProfile</code> DOM elements contained
- * in a <code>ReferenceInfo</code> DOM element.
- *
- * @param refInfoElem
- * <code>ReferenceInfo</code> DOM element containing the
- * <code>VerifyTransformsInfoProfile</code> DOM elements.
- * @return A <code>List</code> of <code>VerifyTransformsInfoProfile</code>
- * API objects containing the profile data.
- * @throws MOAApplicationException
- * An error occurred building the
- * <code>VerifyTransformsInfoProfile</code>s.
- */
- 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 <code>VerifySignatureInfo</code> DOM element contained in the
+ * <code>VerifyXMLSignatureRequest</code> DOM element.
+ *
+ * @param requestElem The <code>VerifyXMLSignatureRequest</code> DOM element
+ * containing the <code>VerifySignatureInfo</code> DOM
+ * element.
+ * @return The <code>VerifySignatureInfo</code> API object containing the data
+ * from the DOM element.
+ */
+ private VerifySignatureInfo parseVerifySignatureInfo(Element requestElem) {
+ final Element verifySignatureEnvironmentElem = (Element) XPathUtils.selectSingleNode(requestElem,
+ VERIFY_SIGNATURE_ENVIRONMENT_XPATH);
+ final Content verifySignatureEnvironment = RequestParserUtils.parseContent(
+ verifySignatureEnvironmentElem);
+ final VerifySignatureLocation verifySignatureLocation = parseVerifySignatureLocation(requestElem);
+
+ return factory.createVerifySignatureInfo(verifySignatureEnvironment, verifySignatureLocation);
+ }
+
+ /**
+ * Parse the <code>VerifySignatureLocation</code> DOM element contained in the
+ * given <code>VerifyXMLSignatureRequest</code> DOM element.
+ *
+ * @param requestElem The <code>VerifyXMLSignatureRequst</code> DOM element.
+ * @return The <code>VerifySignatureLocation</code> API object containing the
+ * data from the DOM element.
+ */
+ private VerifySignatureLocation parseVerifySignatureLocation(Element requestElem) {
+ final Element locationElem = (Element) XPathUtils.selectSingleNode(requestElem,
+ VERIFY_SIGNATURE_LOCATION_XPATH);
+ final String xPathExpression = DOMUtils.getText(locationElem);
+ final Map namespaceDeclarations = DOMUtils.getNamespaceDeclarations(locationElem);
+
+ return factory.createVerifySignatureLocation(xPathExpression, namespaceDeclarations);
+ }
+
+ /**
+ * Parse the supplement profiles contained in the given
+ * <code>VerifyXMLSignatureRequest</code> DOM element.
+ *
+ * @param requestElem The <code>VerifyXMLSignatureRequest</code> DOM element.
+ * @return A <code>List</code> of <code>SupplementProfile</code> API objects
+ * containing the data from the <code>SupplementProfile</code> DOM
+ * elements.
+ */
+ private List parseSupplementProfiles(Element requestElem) {
+ final List supplementProfiles = new ArrayList();
+ final NodeIterator profileElems = XPathUtils.selectNodeIterator(requestElem, SUPPLEMENT_PROFILE_XPATH);
+ Element profileElem;
+
+ while ((profileElem = (Element) profileElems.nextNode()) != null) {
+ SupplementProfile profile;
+
+ if ("SupplementProfile".equals(profileElem.getLocalName())) {
+ final ProfileParser profileParser = new ProfileParser();
+ profile = profileParser.parseSupplementProfile(profileElem);
+ } else {
+ final String profileID = DOMUtils.getText(profileElem);
+ profile = factory.createSupplementProfile(profileID);
+ }
+ supplementProfiles.add(profile);
+ }
+ return supplementProfiles;
+ }
+
+ /**
+ * Parse the <code>SignatureManifestCheckParams</code> DOM element contained in
+ * the given <code>VerifyXMLSignatureRequest</code> DOM element.
+ *
+ * @param requestElem The <code>VerifyXMLSignatureRequest</code> DOM element.
+ * @return The <code>SignatureManifestCheckParams</code> API object containing
+ * the data from the <code>SignatureManifestCheckParams</code> DOM
+ * element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>SignatureManifestCheckParams</code> DOM
+ * element.
+ */
+ private SignatureManifestCheckParams parseSignatureManifestCheckParams(Element requestElem)
+ throws MOAApplicationException {
+ final Element paramsElem = (Element) XPathUtils.selectSingleNode(requestElem,
+ SIGNATURE_MANIFEST_CHECK_PARAMS_XPATH);
+
+ if (paramsElem != null) {
+ final String returnReferenceInputDataStr = paramsElem.getAttribute("ReturnReferenceInputData");
+ final boolean returnReferencInputData = BoolUtils.valueOf(returnReferenceInputDataStr);
+ final List referenceInfos = parseReferenceInfos(paramsElem);
+
+ return factory.createSignatureManifestCheckParams(referenceInfos, returnReferencInputData);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Parse the <code>ReferenceInfo</code> DOM elements contained in a
+ * <code>SignatureManifestCheckParams</code> DOM element.
+ *
+ * @param paramsElem The <code>SignatureManifestCheckParams</code> DOM element
+ * containing the <code>ReferenceInfo</code> DOM elements.
+ * @return A <code>List</code> of <code>RefernceInfo</code> API objects
+ * containing the data from the <code>ReferenceInfo</code> DOM elements.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>ReferenceInfo</code> DOM elements.
+ */
+ private List parseReferenceInfos(Element paramsElem) throws MOAApplicationException {
+
+ final List referenceInfos = new ArrayList();
+ final NodeIterator refInfoElems = XPathUtils.selectNodeIterator(paramsElem, REFERENCE_INFO_XPATH);
+ Element refInfoElem;
+
+ while ((refInfoElem = (Element) refInfoElems.nextNode()) != null) {
+ final ReferenceInfo referenceInfo = parseReferenceInfo(refInfoElem);
+
+ referenceInfos.add(referenceInfo);
+ }
+
+ return referenceInfos;
+ }
+
+ /**
+ * Parse a <code>ReferenceInfo</code> DOM element.
+ *
+ * @param refInfoElem The <code>ReferenceInfo</code> DOM element to parse.
+ * @return The <code>ReferenceInfo</code> API object containing the data from
+ * the given <code>ReferenceInfo</code> DOM element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>ReferenceInfo</code> DOM element.
+ */
+ private ReferenceInfo parseReferenceInfo(Element refInfoElem) throws MOAApplicationException {
+ final List profiles = parseVerifyTransformsInfoProfiles(refInfoElem);
+ return factory.createReferenceInfo(profiles);
+ }
+
+ /**
+ * Parse the <code>VerifyTransformsInfoProfile</code> DOM elements contained in
+ * a <code>ReferenceInfo</code> DOM element.
+ *
+ * @param refInfoElem <code>ReferenceInfo</code> DOM element containing the
+ * <code>VerifyTransformsInfoProfile</code> DOM elements.
+ * @return A <code>List</code> of <code>VerifyTransformsInfoProfile</code> API
+ * objects containing the profile data.
+ * @throws MOAApplicationException An error occurred building the
+ * <code>VerifyTransformsInfoProfile</code>s.
+ */
+ private List parseVerifyTransformsInfoProfiles(Element refInfoElem) throws MOAApplicationException {
+
+ final List profiles = new ArrayList();
+ final NodeIterator profileElems = XPathUtils.selectNodeIterator(refInfoElem,
+ VERIFY_TRANSFORMS_INFO_PROFILE_XPATH);
+ Element profileElem;
+
+ while ((profileElem = (Element) profileElems.nextNode()) != null) {
+ if ("VerifyTransformsInfoProfile".equals(profileElem.getLocalName())) {
+ final ProfileParser profileParser = new ProfileParser();
+ profiles.add(profileParser.parseVerifyTransformsInfoProfile(profileElem));
+ } else {
+ final 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 0042464..48206c9 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,6 @@ import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-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;
@@ -45,303 +42,315 @@ import at.gv.egovernment.moa.spss.api.xmlverify.AdESFormResults;
import at.gv.egovernment.moa.spss.api.xmlverify.ManifestRefsCheckResult;
import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult;
import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse;
-import at.gv.egovernment.moa.spss.server.config.ConfigurationException;
-import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
+import at.gv.egovernment.moaspss.util.Base64Utils;
+import at.gv.egovernment.moaspss.util.Constants;
+import at.gv.egovernment.moaspss.util.MiscUtil;
/**
* Convert a <code>VerifyXMLSignatureResponse</code> API object into its XML
* representation, according to the MOA XML schema.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class VerifyXMLSignatureResponseBuilder {
- private static final String MOA_NS_URI = Constants.MOA_NS_URI;
-
- /** The XML document containing the response element. */
- private Document responseDoc;
- /** The response <code>VerifyXMLSignatureResponse</code> DOM element. */
- private Element responseElem;
-
- private boolean includeSigningTime = false;
- /**
- * Create a new <code>VerifyXMLSignatureResponseBuilder</code>:
- *
- * @throws MOASystemException
- * An error occurred setting up the resulting XML document.
- */
- public VerifyXMLSignatureResponseBuilder() throws MOASystemException {
- responseDoc = ResponseBuilderUtils.createResponse("VerifyXMLSignatureResponse");
- responseElem = responseDoc.getDocumentElement();
- }
-
- public VerifyXMLSignatureResponseBuilder(Document responseDoc, String name, boolean includeSigningTime) throws MOASystemException {
- this.responseDoc = responseDoc;
- responseElem = responseDoc.createElementNS(MOA_NS_URI, name);
- this.includeSigningTime = includeSigningTime;
- }
-
- public Element buildElement(VerifyXMLSignatureResponse response) throws MOAApplicationException {
- this.build(response);
- return responseElem;
- }
-
- /**
- * Build a document containing a <code>VerifyXMLSignatureResponse</code> DOM
- * element being the XML representation of the given
- * <code>VerifyXMLSignatureResponse</code> API object.
- *
- * @param response
- * The <code>VerifyXMLSignatureResponse</code> to convert to XML.
- * @return A document containing the <code>VerifyXMLSignatureResponse</code>
- * DOM element.
- * @throws MOAApplicationException
- * An error occurred building the response.
- */
- public Document build(VerifyXMLSignatureResponse response) throws MOAApplicationException {
-
- Iterator iter;
- List responseData;
-
- // add the SignerInfo
- ResponseBuilderUtils.addSignerInfo(responseDoc, responseElem, response.getSignerInfo().getSignerCertificate(),
- response.getSignerInfo().isQualifiedCertificate(), response.getSignerInfo().getQCSource(),
- response.getSignerInfo().isPublicAuthority(), response.getSignerInfo().getPublicAuhtorityID(),
- response.getSignerInfo().isSSCD(), response.getSignerInfo().getSSCDSource(),
- response.getSignerInfo().getIssuerCountryCode(),
- response.getSignerInfo().getTslInfos());
-
- if(this.includeSigningTime) {
- ResponseBuilderUtils.addSigningTime(responseDoc,
- responseElem, response.getSignerInfo().getSigningTime());
- }
-
- // add HashInputData elements
- responseData = response.getHashInputDatas();
- if (responseData != null && !responseData.isEmpty()) {
- for (iter = responseData.iterator(); iter.hasNext();) {
- InputData inputData = (InputData) iter.next();
- addContent("HashInputData", inputData);
- }
- }
-
- // add ReferenceInputData elements
- responseData = response.getReferenceInputDatas();
- if (responseData != null && !responseData.isEmpty()) {
- for (iter = responseData.iterator(); iter.hasNext();) {
- InputData inputData = (InputData) iter.next();
- addContent("ReferenceInputData", inputData);
- }
- }
-
- // add the SignatureCheck
- addReferencesCheckResult("SignatureCheck", response.getSignatureCheck());
-
- // add the SignatureManifestCheck
- if (response.getSignatureManifestCheck() != null) {
- addReferencesCheckResult("SignatureManifestCheck", response.getSignatureManifestCheck());
- }
-
- // add the XMLDsigManifestChecks
- responseData = response.getXMLDsigManifestChecks();
- if (responseData != null && !responseData.isEmpty()) {
- for (iter = responseData.iterator(); iter.hasNext();) {
- ManifestRefsCheckResult checkResult = (ManifestRefsCheckResult) iter.next();
- addManifestRefsCheckResult("XMLDSIGManifestCheck", checkResult);
- }
- }
-
- // add the CertificateCheck
- ResponseBuilderUtils.addCodeInfoElement(responseDoc, responseElem, "CertificateCheck",
- response.getCertificateCheck().getCode(), response.getCertificateCheck().getInfo());
-
- if (response.getAdESFormResults() != null) {
-
- 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());
-
- }
- }
-
- if(response.getExtendedCertificateCheck() != null) {
- ResponseBuilderUtils.addExtendendResult(responseDoc, responseElem, response.getExtendedCertificateCheck());
- }
-
- return responseDoc;
- }
-
- /**
- * Add an element of type <code>ContentBaseType</code> to the response.
- *
- * @param elementName
- * The name of the element.
- *
- * @param inputData
- * The <code>InputData</code> to add. Based on the type of
- *
- * the <code>InputData</code>, either a
- * <code>Base64Content</code> element or a
- * <code>XMLContent</code> subelement will be added. An <code>
- * InputDataBinaryImpl</code> will be added as a <code>Base64Content</code>
- * child element. An<code>InputDataXMLImpl</code> will be added
- * as <code>
- * XMLContent</code> child element.
- *
- * @throws MOAApplicationException
- * An error occurred adding the content.
- */
- private void addContent(String elementName, InputData inputData) throws MOAApplicationException {
-
- Element contentElem = responseDoc.createElementNS(MOA_NS_URI, elementName);
-
- contentElem.setAttributeNS(null, "PartOf", inputData.getPartOf());
- if (inputData.getReferringReferenceNumber() != InputData.REFERER_NONE_)
- contentElem.setAttributeNS(null, "ReferringSigReference",
- Integer.toString(inputData.getReferringReferenceNumber()));
-
- switch (inputData.getContentType()) {
- case Content.XML_CONTENT:
- ContentXML contentXml = (ContentXML) inputData;
- NodeList nodes = contentXml.getXMLContent();
- Element xmlElem;
- int i;
-
- xmlElem = responseDoc.createElementNS(MOA_NS_URI, "XMLContent");
- // xmlElem.setAttributeNS(XML_NS_URI, "xml:space", "preserve");
- xmlElem.setAttribute("xml:space", "preserve");
-
- for (i = 0; i < nodes.getLength(); i++) {
- xmlElem.appendChild(responseDoc.importNode(nodes.item(i), true));
- }
- contentElem.appendChild(xmlElem);
- responseElem.appendChild(contentElem);
- break;
- case Content.BINARY_CONTENT:
- Element binaryElem = responseDoc.createElementNS(MOA_NS_URI, "Base64Content");
- ContentBinary contentBinary = (ContentBinary) inputData;
- String base64Str;
-
- try {
- base64Str = Base64Utils.encode(contentBinary.getBinaryContent());
- } catch (IOException e) {
- throw new MOAApplicationException("2200", null, e);
- }
- binaryElem.appendChild(responseDoc.createTextNode(base64Str));
- contentElem.appendChild(binaryElem);
- responseElem.appendChild(contentElem);
- break;
- }
- }
-
- /**
- * Add a <code>ReferencesCheckResult</code> to the response.
- *
- * @param elementName
- * The DOM element name to use.
- * @param checkResult
- * The <code>ReferencesCheckResult</code> to add.
- */
- private void addReferencesCheckResult(String elementName, ReferencesCheckResult checkResult) {
-
- NodeList info = null;
-
- if (checkResult.getInfo() != null) {
- DocumentFragment fragment = responseDoc.createDocumentFragment();
- NodeList anyOtherInfo = checkResult.getInfo().getAnyOtherInfo();
- int[] failedReferences = checkResult.getInfo().getFailedReferences();
-
- if (anyOtherInfo != null) {
- addAnyOtherInfo(fragment, checkResult.getInfo().getAnyOtherInfo());
- }
-
- if (failedReferences != null) {
- addFailedReferences(fragment, failedReferences);
- }
-
- info = fragment.getChildNodes();
- }
-
- ResponseBuilderUtils.addCodeInfoElement(responseDoc, responseElem, elementName, checkResult.getCode(), info);
- }
-
- /**
- * Add a <code>ManifestRefsCheckResult</code> to the response.
- *
- * @param elementName
- * The DOM element name to use.
- * @param checkResult
- * The <code>ManifestRefsCheckResult</code> to add.
- */
- private void addManifestRefsCheckResult(String elementName, ManifestRefsCheckResult checkResult) {
-
- DocumentFragment fragment = responseDoc.createDocumentFragment();
- NodeList anyOtherInfo = checkResult.getInfo().getAnyOtherInfo();
- int[] failedReferences = checkResult.getInfo().getFailedReferences();
- Element referringSigRefElem;
- String referringSigRefStr;
-
- // add any other elements
- if (anyOtherInfo != null) {
- addAnyOtherInfo(fragment, checkResult.getInfo().getAnyOtherInfo());
- }
-
- // add the failed references
- if (failedReferences != null) {
- addFailedReferences(fragment, failedReferences);
- }
-
- // add the ReferringSigReference
- referringSigRefElem = responseDoc.createElementNS(MOA_NS_URI, "ReferringSigReference");
- referringSigRefStr = Integer.toString(checkResult.getInfo().getReferringSignatureReference());
- referringSigRefElem.appendChild(responseDoc.createTextNode(referringSigRefStr));
- fragment.appendChild(referringSigRefElem);
-
- // add XMLDSIGManifestCheckResult to the response
- ResponseBuilderUtils.addCodeInfoElement(responseDoc, responseElem, elementName, checkResult.getCode(),
- fragment.getChildNodes());
- }
-
- /**
- * Add arbitrary XML content to a DOM <code>DocumentFragment</code>.
- *
- * @param fragment
- * The fragment to add the XML content to.
- * @param anyOtherInfo
- * The XML content to add.
- */
- private void addAnyOtherInfo(DocumentFragment fragment, NodeList anyOtherInfo) {
-
- int i;
-
- for (i = 0; i < anyOtherInfo.getLength(); i++) {
- fragment.appendChild(responseDoc.importNode(anyOtherInfo.item(i), true));
- }
- }
-
- /**
- * Add the failed references as <code>FailedReference</code> DOM elements to
- * the fragment.
- *
- * @param fragment
- * The DOM document fragment to add the
- * <code>FailedReference</code> elements to.
- * @param failedReferences
- * The indexes of the failed references.
- */
- private void addFailedReferences(DocumentFragment fragment, int[] failedReferences) {
- Element failedReferenceElem;
- int i;
-
- for (i = 0; i < failedReferences.length; i++) {
- failedReferenceElem = responseDoc.createElementNS(MOA_NS_URI, "FailedReference");
- failedReferenceElem.appendChild(responseDoc.createTextNode(Integer.toString(failedReferences[i])));
- fragment.appendChild(failedReferenceElem);
- }
- }
+ private static final String MOA_NS_URI = Constants.MOA_NS_URI;
+
+ /** The XML document containing the response element. */
+ private final Document responseDoc;
+ /** The response <code>VerifyXMLSignatureResponse</code> DOM element. */
+ private final Element responseElem;
+
+ private boolean includeSigningTime = false;
+
+ /**
+ * Create a new <code>VerifyXMLSignatureResponseBuilder</code>:
+ *
+ * @throws MOASystemException An error occurred setting up the resulting XML
+ * document.
+ */
+ public VerifyXMLSignatureResponseBuilder() throws MOASystemException {
+ responseDoc = ResponseBuilderUtils.createResponse("VerifyXMLSignatureResponse");
+ responseElem = responseDoc.getDocumentElement();
+ }
+
+ public VerifyXMLSignatureResponseBuilder(boolean includeSigningTime) throws MOASystemException {
+ responseDoc = ResponseBuilderUtils.createResponse("VerifyXMLSignatureResponse");
+ responseElem = responseDoc.getDocumentElement();
+ this.includeSigningTime = includeSigningTime;
+ }
+
+ public VerifyXMLSignatureResponseBuilder(Document responseDoc, String name, boolean includeSigningTime)
+ throws MOASystemException {
+ this.responseDoc = responseDoc;
+ responseElem = responseDoc.createElementNS(MOA_NS_URI, name);
+ this.includeSigningTime = includeSigningTime;
+ }
+
+ public Element buildElement(VerifyXMLSignatureResponse response) throws MOAApplicationException {
+ this.build(response);
+ return responseElem;
+ }
+
+ /**
+ * Build a document containing a <code>VerifyXMLSignatureResponse</code> DOM
+ * element being the XML representation of the given
+ * <code>VerifyXMLSignatureResponse</code> API object.
+ *
+ * @param response The <code>VerifyXMLSignatureResponse</code> to convert to
+ * XML.
+ * @return A document containing the <code>VerifyXMLSignatureResponse</code> DOM
+ * element.
+ * @throws MOAApplicationException An error occurred building the response.
+ */
+ public Document build(VerifyXMLSignatureResponse response) throws MOAApplicationException {
+
+ Iterator iter;
+ List responseData;
+
+ // add the SignerInfo
+ ResponseBuilderUtils.addSignerInfo(responseDoc, responseElem, response.getSignerInfo()
+ .getSignerCertificate(),
+ response.getSignerInfo().isQualifiedCertificate(), response.getSignerInfo().getQCSource(),
+ response.getSignerInfo().isPublicAuthority(), response.getSignerInfo().getPublicAuhtorityID(),
+ response.getSignerInfo().isSSCD(), response.getSignerInfo().getSSCDSource(),
+ response.getSignerInfo().getIssuerCountryCode(),
+ response.getSignerInfo().getTslInfos());
+
+ if (this.includeSigningTime) {
+ ResponseBuilderUtils.addSigningTime(responseDoc,
+ responseElem, response.getSignerInfo().getSigningTime());
+ }
+
+ // add HashInputData elements
+ responseData = response.getHashInputDatas();
+ if (responseData != null && !responseData.isEmpty()) {
+ for (iter = responseData.iterator(); iter.hasNext();) {
+ final InputData inputData = (InputData) iter.next();
+ addContent("HashInputData", inputData);
+ }
+ }
+
+ // add ReferenceInputData elements
+ responseData = response.getReferenceInputDatas();
+ if (responseData != null && !responseData.isEmpty()) {
+ for (iter = responseData.iterator(); iter.hasNext();) {
+ final InputData inputData = (InputData) iter.next();
+ addContent("ReferenceInputData", inputData);
+ }
+ }
+
+ // add hash algorithm
+ ResponseBuilderUtils.addSignatureAlgorithm(responseDoc, responseElem, response.getSignatureAlgorithm());
+
+ // add the SignatureCheck
+ addReferencesCheckResult("SignatureCheck", response.getSignatureCheck());
+
+ // add the SignatureManifestCheck
+ if (response.getSignatureManifestCheck() != null) {
+ addReferencesCheckResult("SignatureManifestCheck", response.getSignatureManifestCheck());
+ }
+
+ // add the XMLDsigManifestChecks
+ responseData = response.getXMLDsigManifestChecks();
+ if (responseData != null && !responseData.isEmpty()) {
+ for (iter = responseData.iterator(); iter.hasNext();) {
+ final ManifestRefsCheckResult checkResult = (ManifestRefsCheckResult) iter.next();
+ addManifestRefsCheckResult("XMLDSIGManifestCheck", checkResult);
+ }
+ }
+
+ // add the CertificateCheck
+ ResponseBuilderUtils.addCodeInfoElement(responseDoc, responseElem, "CertificateCheck",
+ response.getCertificateCheck().getCode(), response.getCertificateCheck().getInfo());
+
+ if (response.getAdESFormResults() != null) {
+
+ final Iterator formIterator = response.getAdESFormResults().iterator();
+
+ while (formIterator.hasNext()) {
+ final AdESFormResults adESFormResult = (AdESFormResults) formIterator.next();
+ // add the CertificateCheck
+ ResponseBuilderUtils.addFormCheckElement(responseDoc, responseElem, "FormCheckResult",
+ adESFormResult.getCode().intValue(), adESFormResult.getName());
+
+ }
+ }
+
+ if (response.getExtendedCertificateCheck() != null) {
+ ResponseBuilderUtils.addExtendendResult(responseDoc, responseElem, response
+ .getExtendedCertificateCheck());
+ }
+
+ return responseDoc;
+ }
+
+ /**
+ * Add an element of type <code>ContentBaseType</code> to the response.
+ *
+ * @param elementName The name of the element.
+ *
+ * @param inputData The <code>InputData</code> to add. Based on the type of
+ *
+ * the <code>InputData</code>, either a
+ * <code>Base64Content</code> element or a
+ * <code>XMLContent</code> subelement will be added. An
+ * <code>
+ * InputDataBinaryImpl</code> will be added as a <code>Base64Content</code>
+ * child element. An<code>InputDataXMLImpl</code> will be
+ * added as <code>
+ * XMLContent</code> child element.
+ *
+ * @throws MOAApplicationException An error occurred adding the content.
+ */
+ private void addContent(String elementName, InputData inputData) throws MOAApplicationException {
+
+ final Element contentElem = responseDoc.createElementNS(MOA_NS_URI, elementName);
+
+ contentElem.setAttributeNS(null, "PartOf", inputData.getPartOf());
+ if (inputData.getReferringReferenceNumber() != InputData.REFERER_NONE_) {
+ contentElem.setAttributeNS(null, "ReferringSigReference",
+ Integer.toString(inputData.getReferringReferenceNumber()));
+ }
+
+ if (MiscUtil.isNotEmpty(inputData.getHashAlgorithm())) {
+ contentElem.setAttribute("HashAlgorithm", inputData.getHashAlgorithm());
+
+ }
+
+ switch (inputData.getContentType()) {
+ case Content.XML_CONTENT:
+ final ContentXML contentXml = (ContentXML) inputData;
+ final NodeList nodes = contentXml.getXMLContent();
+ Element xmlElem;
+ int i;
+
+ xmlElem = responseDoc.createElementNS(MOA_NS_URI, "XMLContent");
+ // xmlElem.setAttributeNS(XML_NS_URI, "xml:space", "preserve");
+ xmlElem.setAttribute("xml:space", "preserve");
+
+ for (i = 0; i < nodes.getLength(); i++) {
+ xmlElem.appendChild(responseDoc.importNode(nodes.item(i), true));
+ }
+ contentElem.appendChild(xmlElem);
+ responseElem.appendChild(contentElem);
+ break;
+ case Content.BINARY_CONTENT:
+ final Element binaryElem = responseDoc.createElementNS(MOA_NS_URI, "Base64Content");
+ final ContentBinary contentBinary = (ContentBinary) inputData;
+ String base64Str;
+
+ try {
+ base64Str = Base64Utils.encode(contentBinary.getBinaryContent());
+ } catch (final IOException e) {
+ throw new MOAApplicationException("2200", null, e);
+ }
+ binaryElem.appendChild(responseDoc.createTextNode(base64Str));
+ contentElem.appendChild(binaryElem);
+ responseElem.appendChild(contentElem);
+ break;
+ }
+
+ }
+
+ /**
+ * Add a <code>ReferencesCheckResult</code> to the response.
+ *
+ * @param elementName The DOM element name to use.
+ * @param checkResult The <code>ReferencesCheckResult</code> to add.
+ */
+ private void addReferencesCheckResult(String elementName, ReferencesCheckResult checkResult) {
+
+ NodeList info = null;
+
+ if (checkResult.getInfo() != null) {
+ final DocumentFragment fragment = responseDoc.createDocumentFragment();
+ final NodeList anyOtherInfo = checkResult.getInfo().getAnyOtherInfo();
+ final int[] failedReferences = checkResult.getInfo().getFailedReferences();
+
+ if (anyOtherInfo != null) {
+ addAnyOtherInfo(fragment, checkResult.getInfo().getAnyOtherInfo());
+ }
+
+ if (failedReferences != null) {
+ addFailedReferences(fragment, failedReferences);
+ }
+
+ info = fragment.getChildNodes();
+ }
+
+ ResponseBuilderUtils.addCodeInfoElement(responseDoc, responseElem, elementName, checkResult.getCode(),
+ info);
+
+ }
+
+ /**
+ * Add a <code>ManifestRefsCheckResult</code> to the response.
+ *
+ * @param elementName The DOM element name to use.
+ * @param checkResult The <code>ManifestRefsCheckResult</code> to add.
+ */
+ private void addManifestRefsCheckResult(String elementName, ManifestRefsCheckResult checkResult) {
+
+ final DocumentFragment fragment = responseDoc.createDocumentFragment();
+ final NodeList anyOtherInfo = checkResult.getInfo().getAnyOtherInfo();
+ final int[] failedReferences = checkResult.getInfo().getFailedReferences();
+ Element referringSigRefElem;
+ String referringSigRefStr;
+
+ // add any other elements
+ if (anyOtherInfo != null) {
+ addAnyOtherInfo(fragment, checkResult.getInfo().getAnyOtherInfo());
+ }
+
+ // add the failed references
+ if (failedReferences != null) {
+ addFailedReferences(fragment, failedReferences);
+ }
+
+ // add the ReferringSigReference
+ referringSigRefElem = responseDoc.createElementNS(MOA_NS_URI, "ReferringSigReference");
+ referringSigRefStr = Integer.toString(checkResult.getInfo().getReferringSignatureReference());
+ referringSigRefElem.appendChild(responseDoc.createTextNode(referringSigRefStr));
+ fragment.appendChild(referringSigRefElem);
+
+ // add XMLDSIGManifestCheckResult to the response
+ ResponseBuilderUtils.addCodeInfoElement(responseDoc, responseElem, elementName, checkResult.getCode(),
+ fragment.getChildNodes());
+ }
+
+ /**
+ * Add arbitrary XML content to a DOM <code>DocumentFragment</code>.
+ *
+ * @param fragment The fragment to add the XML content to.
+ * @param anyOtherInfo The XML content to add.
+ */
+ private void addAnyOtherInfo(DocumentFragment fragment, NodeList anyOtherInfo) {
+
+ int i;
+
+ for (i = 0; i < anyOtherInfo.getLength(); i++) {
+ fragment.appendChild(responseDoc.importNode(anyOtherInfo.item(i), true));
+ }
+ }
+
+ /**
+ * Add the failed references as <code>FailedReference</code> DOM elements to the
+ * fragment.
+ *
+ * @param fragment The DOM document fragment to add the
+ * <code>FailedReference</code> elements to.
+ * @param failedReferences The indexes of the failed references.
+ */
+ private void addFailedReferences(DocumentFragment fragment, int[] failedReferences) {
+ Element failedReferenceElem;
+ int i;
+
+ for (i = 0; i < failedReferences.length; i++) {
+ failedReferenceElem = responseDoc.createElementNS(MOA_NS_URI, "FailedReference");
+ failedReferenceElem.appendChild(responseDoc.createTextNode(Integer.toString(failedReferences[i])));
+ fragment.appendChild(failedReferenceElem);
+ }
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java
index 4b40b9c..3b98dc4 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfile.java
@@ -21,13 +21,12 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
/**
- * Base class for signature environment profile data used in XML signature
+ * Base class for signature environment profile data used in XML signature
* creation.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -35,20 +34,20 @@ public interface CreateSignatureEnvironmentProfile {
/**
* Indicates that the profile data is given explicitly.
*/
- public static int EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE = 0;
+ int EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE = 0;
/**
- * Indicates that the profile data is stored in the configuration and resolved
+ * Indicates that the profile data is stored in the configuration and resolved
* using an ID.
*/
- public static int ID_CREATESIGNATUREENVIRONMENTPROFILE = 1;
-
+ int ID_CREATESIGNATUREENVIRONMENTPROFILE = 1;
+
/**
* Gets the type of this object.
- *
- * @return The type of <code>CreateSignatureEnvironmentProfile</code> denoted
- * by this object. Either
- * <code>EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE</code> or
- * <code>ID_CREATESIGNATUREENVIRONMENTPROFILE</code>.
+ *
+ * @return The type of <code>CreateSignatureEnvironmentProfile</code> denoted by
+ * this object. Either
+ * <code>EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE</code> or
+ * <code>ID_CREATESIGNATUREENVIRONMENTPROFILE</code>.
*/
- public int getCreateSignatureEnvironmentProfileType();
+ int getCreateSignatureEnvironmentProfileType();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java
index 0bce94c..5f761f1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileExplicit.java
@@ -21,34 +21,33 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
import java.util.List;
/**
- * A <code>CreateSignatureEnvironmentProfile</code> containing the profile
- * data explicitly.
- *
+ * A <code>CreateSignatureEnvironmentProfile</code> containing the profile data
+ * explicitly.
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface CreateSignatureEnvironmentProfileExplicit
- extends CreateSignatureEnvironmentProfile {
-
+ extends CreateSignatureEnvironmentProfile {
+
/**
* Gets the location and index of where to insert the signature into the
* signature environment.
- *
- * @return The location and index of the signature in the signature
- * environment.
+ *
+ * @return The location and index of the signature in the signature environment.
*/
- public CreateSignatureLocation getCreateSignatureLocation();
+ CreateSignatureLocation getCreateSignatureLocation();
+
/**
* Gets the supplemental information.
- *
+ *
* @return The supplemental information.
*/
- public List getSupplements();
+ List getSupplements();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java
index 73e4f52..8066d37 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureEnvironmentProfileID.java
@@ -21,24 +21,23 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
/**
* A <code>CreateSignatureEnvironmentProfile</code> containing a profile ID
* pointing to locally stored profile data.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface CreateSignatureEnvironmentProfileID
- extends CreateSignatureEnvironmentProfile {
+ extends CreateSignatureEnvironmentProfile {
/**
* Gets the profile ID.
- *
+ *
* @return The profile ID.
*/
- public String getCreateSignatureEnvironmentProfileID();
-
+ String getCreateSignatureEnvironmentProfileID();
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java
index 9363408..e26ca1e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureInfo.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
import at.gv.egovernment.moa.spss.api.common.Content;
/**
* Encapsulates a signature object used during signature creation.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -39,11 +38,12 @@ public interface CreateSignatureInfo {
*
* @return The XML structure where the signature will be inserted.
*/
- public Content getCreateSignatureEnvironment();
+ Content getCreateSignatureEnvironment();
+
/**
* Gets the supplemental data for the signature environment.
*
* @return The supplemental data for the signature envoronment.
*/
- public CreateSignatureEnvironmentProfile getCreateSignatureEnvironmentProfile();
+ CreateSignatureEnvironmentProfile getCreateSignatureEnvironmentProfile();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java
index 9a0b798..39a85b4 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateSignatureLocation.java
@@ -21,18 +21,17 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
import at.gv.egovernment.moa.spss.api.common.ElementSelector;
/**
* Specifies where to insert the newly created signature.
- *
+ *
* An XPath expression is used to select the signature parent element. An
- * additional index specifies the node index after which to insert the
- * signature into the parent element.
- *
+ * additional index specifies the node index after which to insert the signature
+ * into the parent element.
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -40,8 +39,8 @@ public interface CreateSignatureLocation extends ElementSelector {
/**
* Gets the node index, after which the signature will be inserted into the
* parent elemen.
- *
+ *
* @return The index of the node after which the signature will be inserted.
*/
- public int getIndex();
+ int getIndex();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java
index fbb0000..1793365 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfo.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.xmlsign;
import java.util.List;
@@ -30,7 +29,7 @@ import at.gv.egovernment.moa.spss.api.common.MetaInfo;
/**
* Encapsulates information used for the transformation of the data object.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -38,14 +37,15 @@ import at.gv.egovernment.moa.spss.api.common.MetaInfo;
public interface CreateTransformsInfo {
/**
* Gets the XMLDSig transforms.
- *
+ *
* @return A <code>List</code> of <code>Transform</code> objects.
*/
- public List getTransforms();
+ List getTransforms();
+
/**
* Gets meta information about the data resulting from the transformation.
- *
+ *
* @return Meta information about the resulting data.
*/
- public MetaInfo getFinalDataMetaInfo();
+ MetaInfo getFinalDataMetaInfo();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java
index 5babdae..9832972 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfile.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
/**
* Base class for transformation informations used in signature creation.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -35,18 +34,18 @@ public interface CreateTransformsInfoProfile {
/**
* Indicates transformation information given explicitly.
*/
- public static final int EXPLICIT_CREATETRANSFORMSINFOPROFILE = 0;
+ int EXPLICIT_CREATETRANSFORMSINFOPROFILE = 0;
/**
* Indicates transformation information given as an ID.
*/
- public static final int ID_CREATETRANSFORMSINFOPROFILE = 1;
-
+ int ID_CREATETRANSFORMSINFOPROFILE = 1;
+
/**
* Gets the type of profile information this object contains.
- *
+ *
* @return The type of transformation information, either
- * <code>EXPLICIT_CREATETRANSFORMSINFOPROFILE</code> or
- * <code>ID_CREATETRANSFORMSINFOPROFILE</code>.
+ * <code>EXPLICIT_CREATETRANSFORMSINFOPROFILE</code> or
+ * <code>ID_CREATETRANSFORMSINFOPROFILE</code>.
*/
- public int getCreateTransformsInfoProfileType();
+ int getCreateTransformsInfoProfileType();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java
index 9aae8cb..39580d6 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileExplicit.java
@@ -21,30 +21,30 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
import java.util.List;
/**
* Encapsulates explicit transformation informations.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
*/
public interface CreateTransformsInfoProfileExplicit
- extends CreateTransformsInfoProfile {
+ extends CreateTransformsInfoProfile {
/**
* Gets the transformation information of the data object.
- *
+ *
* @return Transformation information of the data object.
*/
- public CreateTransformsInfo getCreateTransformsInfo();
+ CreateTransformsInfo getCreateTransformsInfo();
+
/**
* Gets the supplemental information.
- *
+ *
* @return The supplemental information.
*/
- public List getSupplements();
+ List getSupplements();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java
index 69c3629..fc9d869 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateTransformsInfoProfileID.java
@@ -21,22 +21,21 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
/**
* Encapsulates transformation information given via an identifier.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
*/
public interface CreateTransformsInfoProfileID
- extends CreateTransformsInfoProfile {
+ extends CreateTransformsInfoProfile {
/**
* Gets the ID of the transformation.
- *
+ *
* @return The transformation profile ID.
*/
- public String getCreateTransformsInfoProfileID();
+ String getCreateTransformsInfoProfileID();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java
index 351b16e..0f8c8a2 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureRequest.java
@@ -21,15 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
import java.util.List;
-
/**
* Object that encapsulates a request to create an XML Signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -37,14 +35,15 @@ import java.util.List;
public interface CreateXMLSignatureRequest {
/**
* Gets the identifier for the keys to be used for the signature.
- *
+ *
* @return The identifier for the keys to be used.
*/
- public String getKeyIdentifier();
+ String getKeyIdentifier();
+
/**
- * Gets the information of the singleSignatureInfo elements.
- *
+ * Gets the information of the singleSignatureInfo elements.
+ *
* @return The information of singleSignatureInfo elements.
*/
- public List getSingleSignatureInfos();
+ List getSingleSignatureInfos();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java
index c1b1c30..1b59d7d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponse.java
@@ -21,15 +21,14 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
import java.util.List;
/**
- * Object that encapsulates the response on to a
+ * Object that encapsulates the response on to a
* <code>CreateXMLSignatureRequest</code> to create an XML signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -37,8 +36,8 @@ import java.util.List;
public interface CreateXMLSignatureResponse {
/**
* Gets the response elements.
- *
+ *
* @return The response elements.
*/
- public List getResponseElements();
+ List getResponseElements();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java
index b9bd334..fe6cbbb 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/CreateXMLSignatureResponseElement.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
/**
- * Base class for <code>SignatureEnvironmentResponse</code> and
- * <code>ErrorResponse</code> elements in a
+ * Base class for <code>SignatureEnvironmentResponse</code> and
+ * <code>ErrorResponse</code> elements in a
* <code>CreateXMLSignatureResponse</code>.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -37,17 +36,18 @@ public interface CreateXMLSignatureResponseElement {
/**
* Indicates that this object contains a <code>SignatureEnvironment</code>.
*/
- public static final int SIGNATURE_ENVIRONMENT_RESPONSE = 0;
+ int SIGNATURE_ENVIRONMENT_RESPONSE = 0;
/**
* Indicates that this objet contains an <code>ErrorResponse</code>.
*/
- public static final int ERROR_RESPONSE = 1;
-
+ int ERROR_RESPONSE = 1;
+
/**
* Gets the type of response object.
- *
- * @return The type of response object, either
- * <code>SIGNATURE_ENVIRONMENT_RESPONSE</code> or <code>ERROR_RESPONSE</code>.
+ *
+ * @return The type of response object, either
+ * <code>SIGNATURE_ENVIRONMENT_RESPONSE</code> or
+ * <code>ERROR_RESPONSE</code>.
*/
- public int getResponseType();
+ int getResponseType();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java
index 620e3b3..053ff00 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/DataObjectInfo.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
import at.gv.egovernment.moa.spss.api.common.Content;
/**
* Encapsulates information required to create a single signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -37,36 +36,39 @@ public interface DataObjectInfo {
/**
* Indicates that a detached signature will be created.
*/
- public static final String STRUCTURE_DETACHED = "detached";
+ String STRUCTURE_DETACHED = "detached";
/**
* Indicates that an enveloping signature will be created.
*/
- public static final String STRUCTURE_ENVELOPING = "enveloping";
+ String STRUCTURE_ENVELOPING = "enveloping";
/**
* Gets the structure of the signature.
- *
+ *
* @return The structure of the signature.
*/
- public String getStructure();
+ String getStructure();
+
/**
- * Checks whether a refercence will be placed in the signature itself or
- * in the manifest.
- *
+ * Checks whether a refercence will be placed in the signature itself or in the
+ * manifest.
+ *
* @return <code>true</code> if a reference will be placed in the manifest,
- * <code>false</code> if it will be placed in the signature.
+ * <code>false</code> if it will be placed in the signature.
*/
- public boolean isChildOfManifest();
+ boolean isChildOfManifest();
+
/**
* Gets information related to a single data object.
- *
+ *
* @return Information related to a single data object.
*/
- public Content getDataObject();
+ Content getDataObject();
+
/**
* Gets information for the transformation of the data object.
- *
+ *
* @return The transformation information.
*/
- public CreateTransformsInfoProfile getCreateTransformsInfoProfile();
+ CreateTransformsInfoProfile getCreateTransformsInfoProfile();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java
index 6dfa843..d1b838d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/ErrorResponse.java
@@ -21,13 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
-
/**
* Object containing detailed error information.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -35,14 +33,15 @@ package at.gv.egovernment.moa.spss.api.xmlsign;
public interface ErrorResponse extends CreateXMLSignatureResponseElement {
/**
* Gets the error code.
- *
+ *
* @return The error code.
*/
- public int getErrorCode();
+ int getErrorCode();
+
/**
* Gets verbose error information.
- *
+ *
* @return Verbose error information.
*/
- public String getInfo();
+ String getInfo();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java
index 47c4ce7..ecf57ce 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SignatureEnvironmentResponse.java
@@ -21,24 +21,23 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
import org.w3c.dom.Element;
/**
* Contains the signature if the signature creation was successful.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
*/
public interface SignatureEnvironmentResponse
- extends CreateXMLSignatureResponseElement {
- /**
+ extends CreateXMLSignatureResponseElement {
+ /**
* Gets the XML structure which contains the signature.
- *
+ *
* @return A general XML structure containing the signature.
*/
- public Element getSignatureEnvironment();
+ Element getSignatureEnvironment();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java
index 3355739..7b94bc0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlsign/SingleSignatureInfo.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlsign;
import java.util.List;
/**
* Encapsulates data to create a single signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,21 +35,23 @@ import java.util.List;
public interface SingleSignatureInfo {
/**
* Gets the dataObjectInfo information.
- *
+ *
* @return The dataObjectInfo information.
*/
- public List getDataObjectInfos();
+ List getDataObjectInfos();
+
/**
* Gets the signature object.
- *
+ *
* @return The signature object used during signature creation.
*/
- public CreateSignatureInfo getCreateSignatureInfo();
+ CreateSignatureInfo getCreateSignatureInfo();
+
/**
* Check whether a Security Layer conform signature manifest will be created.
- *
- * @return <code>true</code>, if a Security Layer conform signature manifest
- * will be created, <code>false</code> otherwise.
+ *
+ * @return <code>true</code>, if a Security Layer conform signature manifest
+ * will be created, <code>false</code> otherwise.
*/
- public boolean isSecurityLayerConform();
+ boolean isSecurityLayerConform();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/AdESFormResults.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/AdESFormResults.java
index e12c39b..2730c18 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/AdESFormResults.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/AdESFormResults.java
@@ -1,7 +1,9 @@
package at.gv.egovernment.moa.spss.api.xmlverify;
public interface AdESFormResults {
- public Integer getCode();
- public String getInfo();
- public String getName();
+ Integer getCode();
+
+ String getInfo();
+
+ String getName();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java
index 8ff4617..6e5aeda 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResult.java
@@ -21,13 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
-
/**
* Contains the results of manifest checks according to XMLDsig.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -35,14 +33,15 @@ package at.gv.egovernment.moa.spss.api.xmlverify;
public interface ManifestRefsCheckResult {
/**
* Gets the check code.
- *
+ *
* @return A numerical representation of the result of the manifest check.
*/
- public int getCode();
+ int getCode();
+
/**
* Gets the reference to the manifest.
- *
+ *
* @return The reference to the manifest.
*/
- public ManifestRefsCheckResultInfo getInfo();
+ ManifestRefsCheckResultInfo getInfo();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java
index 4b0a4fb..f8973b2 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ManifestRefsCheckResultInfo.java
@@ -21,23 +21,21 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
-
/**
* Encapsulates information referring to the manifest of the check.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
*/
public interface ManifestRefsCheckResultInfo extends ReferencesCheckResultInfo {
/**
- * Gets the position of the signature reference containing the
- * reference to the manifest being described by this object.
- *
+ * Gets the position of the signature reference containing the reference to the
+ * manifest being described by this object.
+ *
* @return The position of the signature reference.
*/
- public int getReferringSignatureReference();
+ int getReferringSignatureReference();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java
index 95a2b92..40bfe48 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferenceInfo.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
import java.util.List;
/**
* Contains transformation parameters which are locally available.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,8 +35,8 @@ import java.util.List;
public interface ReferenceInfo {
/**
* Gets the transformation info.
- *
+ *
* @return The transformation info.
*/
- public List getVerifyTransformsInfoProfiles();
+ List getVerifyTransformsInfoProfiles();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java
index dd1f482..bf41109 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResult.java
@@ -21,27 +21,27 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
/**
- * Contains information about the verification status of references contained
- * in the signature.
- *
+ * Contains information about the verification status of references contained in
+ * the signature.
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface ReferencesCheckResult {
/**
* Gets the check code.
- *
+ *
* @return A numerical representation of the result of the reference check.
*/
- public int getCode();
+ int getCode();
+
/**
* Gets the additional information about the result.
- *
+ *
* @return Additional information about the result.
*/
- public ReferencesCheckResultInfo getInfo();
+ ReferencesCheckResultInfo getInfo();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java
index fc87c98..2a2511e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/ReferencesCheckResultInfo.java
@@ -21,29 +21,29 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
import org.w3c.dom.NodeList;
/**
* Additional information contained in a <code>ReferencesCheckResult</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public interface ReferencesCheckResultInfo {
/**
* Gets the additional info of the failed <code>dsig:reference</code> element.
- *
+ *
* @return The info elements.
*/
- public NodeList getAnyOtherInfo();
+ NodeList getAnyOtherInfo();
+
/**
* Gets the positions of the failed signature references containing the
* references to the manifests being described by this object.
- *
- * @return The positions of the failed signature references.
+ *
+ * @return The positions of the failed signature references.
*/
- public int[] getFailedReferences();
+ int[] getFailedReferences();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java
index 524d4b8..d1e621e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SignatureManifestCheckParams.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
import java.util.List;
/**
* Contains parameters used to check the signature manifest.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,15 +35,16 @@ import java.util.List;
public interface SignatureManifestCheckParams {
/**
* Gets the referential information.
- *
+ *
* @return The referential information.
*/
- public List getReferenceInfos();
+ List getReferenceInfos();
+
/**
* Gets information on whether signature source data should be returned.
- *
+ *
* @return <code>true</code>, if signature source data should be returned,
- * otherwise <code>false</code>.
+ * otherwise <code>false</code>.
*/
- public boolean getReturnReferenceInputData();
+ boolean getReturnReferenceInputData();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java
index 934e7c6..a906195 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfile.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
/**
* Base class for supplementary information.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -35,18 +34,19 @@ public interface SupplementProfile {
/**
* Indicates that this object contains explicit supplementary information.
*/
- public static final int EXPLICIT_SUPPLEMENTPROFILE = 0;
+ int EXPLICIT_SUPPLEMENTPROFILE = 0;
/**
* Indicates that this object contains a profile id where supplementary
* information can be found.
*/
- public static final int ID_SUPPLEMENTPROFILE = 1;
+ int ID_SUPPLEMENTPROFILE = 1;
/**
* Gets the type of supplementary information contained in this object.
- *
+ *
* @return The type of supplementary information contained in this object,
- * either <code>EXPLICIT_SUPPLEMENT</code> or <code>ID_SUPPLEMENT</code>.
+ * either <code>EXPLICIT_SUPPLEMENT</code> or
+ * <code>ID_SUPPLEMENT</code>.
*/
- public int getSupplementProfileType();
+ int getSupplementProfileType();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java
index d01abec..e0da05d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileExplicit.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation;
/**
* Encapsulates explicit supplementary information.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,8 +35,8 @@ import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation;
public interface SupplementProfileExplicit extends SupplementProfile {
/**
* Gets the supplemental object.
- *
+ *
* @return The supplemental object.
*/
- public XMLDataObjectAssociation getSupplementProfile();
+ XMLDataObjectAssociation getSupplementProfile();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java
index beeb2f0..b890c3a 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/SupplementProfileID.java
@@ -21,22 +21,20 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
/**
* Encapsulates supplementary information stored in a profile.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
*/
public interface SupplementProfileID extends SupplementProfile {
/**
- * Gets the id of the profile where the supplementary information can be
- * found.
- *
+ * Gets the id of the profile where the supplementary information can be found.
+ *
* @return The profile id.
*/
- public String getSupplementProfileID();
+ String getSupplementProfileID();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java
index 7ecd1b8..6eeb759 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameter.java
@@ -21,44 +21,44 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
/**
- * Object encapsulating transform parameters either as a URI, binary or
- * hashed.
- *
+ * Object encapsulating transform parameters either as a URI, binary or hashed.
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
*/
public interface TransformParameter {
/**
- * Indicates that this object contains a transform parameter given as
- * a URI.
+ * Indicates that this object contains a transform parameter given as a URI.
*/
- public static final int URI_TRANSFORMPARAMETER = 0;
+ int URI_TRANSFORMPARAMETER = 0;
/**
* Indicates that this object contains binary transform parameter.
*/
- public static final int BINARY_TRANSFORMPARAMETER = 1;
+ int BINARY_TRANSFORMPARAMETER = 1;
/**
* Indicatest that this object contains a binary hash of the transform
* parameter.
*/
- public static final int HASH_TRANSFORMPARAMETER = 2;
-
+ int HASH_TRANSFORMPARAMETER = 2;
+
/**
* Gets the type of transform parameter contained in this object.
- *
- * @return The type of transform parameter, being one of
- * <code>URI_TRANSFORMPARAMETER</code>, <code>BINARY_TRANSFORMPARAMETER</code>
- * or <code>HASH_TRANSFORMPARAMETER</code>.
+ *
+ * @return The type of transform parameter, being one of
+ * <code>URI_TRANSFORMPARAMETER</code>,
+ * <code>BINARY_TRANSFORMPARAMETER</code> or
+ * <code>HASH_TRANSFORMPARAMETER</code>.
*/
- public int getTransformParameterType();
+ int getTransformParameterType();
+
/**
* Gets the transform parameter URI.
- *
+ *
* @return The transform parameter URI.
*/
- public String getURI();}
+ String getURI();
+}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java
index 388c5d0..afd3a89 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterBinary.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
import java.io.InputStream;
/**
* Encapsulates a binary transform parameter.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,10 +35,10 @@ import java.io.InputStream;
public interface TransformParameterBinary extends TransformParameter {
/**
* Gets the binary transform parameter.
- *
- * @return An <code>InputStream</code> from which the binary content can
- * be read.
+ *
+ * @return An <code>InputStream</code> from which the binary content can be
+ * read.
*/
- public InputStream getBinaryContent();
+ InputStream getBinaryContent();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java
index 2ff6f39..11ad51e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterHash.java
@@ -21,13 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
-
/**
* Contains a hash of the transform parameter.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -35,16 +33,16 @@ package at.gv.egovernment.moa.spss.api.xmlverify;
public interface TransformParameterHash extends TransformParameter {
/**
* Gets the method used for calculating the digest value.
- *
+ *
* @return The digest method.
*/
- public String getDigestMethod();
+ String getDigestMethod();
+
/**
* Gets the binary hash of the transform parameter.
- *
+ *
* @return A binary representation of the hash.
*/
- public byte[] getDigestValue();
-
+ byte[] getDigestValue();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java
index bc73e95..743ecb1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/TransformParameterURI.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
/**
* Encapsulates a transform parameter given as a URI.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java
index 5d6e0eb..f910747 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureInfo.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
import at.gv.egovernment.moa.spss.api.common.Content;
/**
* Encapsulates a signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,16 +35,17 @@ import at.gv.egovernment.moa.spss.api.common.Content;
public interface VerifySignatureInfo {
/**
* Gets the content of the <code>VerifySignatureEnvironment</code> element.
- *
- * @return A <code>MOAElement</code> containing the
- * <code>VerifySignatureEnvironment</code> in a DOM-like structure.
+ *
+ * @return A <code>MOAElement</code> containing the
+ * <code>VerifySignatureEnvironment</code> in a DOM-like structure.
*/
- public Content getVerifySignatureEnvironment();
+ Content getVerifySignatureEnvironment();
+
/**
* Gets the location of the signature.
- *
+ *
* @return The location of the signature within the signature environment.
- */
- public VerifySignatureLocation getVerifySignatureLocation();
+ */
+ VerifySignatureLocation getVerifySignatureLocation();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java
index 56a2567..8cd1d4a 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifySignatureLocation.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
import at.gv.egovernment.moa.spss.api.common.ElementSelector;
/**
* Specifies where to find the signature to be verified.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java
index a55d55e..8a821d6 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfile.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
/**
* Object for explicitly specifying a transformation path.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -35,18 +34,18 @@ public interface VerifyTransformsInfoProfile {
/**
* Indicates that this object contains the transformation path explicitly.
*/
- public static final int EXPLICIT_VERIFYTRANSFORMSINFOPROFILE = 0;
+ int EXPLICIT_VERIFYTRANSFORMSINFOPROFILE = 0;
/**
* Indicatest that this object contains a transformation info id.
*/
- public static final int ID_VERIFYTRANSFORMSINFOPROFILE = 1;
-
+ int ID_VERIFYTRANSFORMSINFOPROFILE = 1;
+
/**
* Gets the type of transformation information contained in this object.
- *
- * @return The type of transformation information, either
- * <code>EXPLICIT_VERIFYTRANSFORMSINFOPROFILE</code> or
- * <code>ID_VERIFYTRANSFORMSINFOPROFILE</code>.
+ *
+ * @return The type of transformation information, either
+ * <code>EXPLICIT_VERIFYTRANSFORMSINFOPROFILE</code> or
+ * <code>ID_VERIFYTRANSFORMSINFOPROFILE</code>.
*/
- public int getVerifyTransformsInfoProfileType();
+ int getVerifyTransformsInfoProfileType();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java
index cc29ace..bd91a28 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileExplicit.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
import java.util.List;
/**
* Encapsulates explicit transformation information.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -36,14 +35,15 @@ import java.util.List;
public interface VerifyTransformsInfoProfileExplicit extends VerifyTransformsInfoProfile {
/**
* Gets the XMLDSig transforms element.
- *
+ *
* @return The <code>List</code> of <code>Transform</code>s.
*/
- public List getTransforms();
+ List getTransforms();
+
/**
* Gets the transformation parameters.
- *
+ *
* @return The transformation parameters.
*/
- public List getTransformParameters();
+ List getTransformParameters();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java
index eeb28da..ef083ba 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyTransformsInfoProfileID.java
@@ -21,12 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
/**
* Encapsulates transformation info id for signature verification.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -34,9 +33,9 @@ package at.gv.egovernment.moa.spss.api.xmlverify;
public interface VerifyTransformsInfoProfileID extends VerifyTransformsInfoProfile {
/**
* Gets the identifier referencing the transformation info.
- *
+ *
* @return The identifier referencing the transformation info.
*/
- public String getVerifyTransformsInfoProfileID();
+ String getVerifyTransformsInfoProfileID();
}
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 c4a0fd1..666164a 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
@@ -21,67 +21,70 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlverify;
import java.util.Date;
import java.util.List;
-
/**
* Object that encapsulates a request to verify an XML signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
*/
public interface VerifyXMLSignatureRequest {
/**
- * Gets the date and time for which the signature verification has to
- * be performed.
- *
- * @return Date and time for which the signature verification has
- * to be performed.
+ * Gets the date and time for which the signature verification has to be
+ * performed.
+ *
+ * @return Date and time for which the signature verification has to be
+ * performed.
*/
- public Date getDateTime();
+ Date getDateTime();
+
/**
* Gets the signature to be verified.
- *
+ *
* @return The signature to be verified.
*/
- public VerifySignatureInfo getSignatureInfo();
+ VerifySignatureInfo getSignatureInfo();
+
/**
* Gets the supplemental information.
- *
+ *
* @return The supplemental information.
- */
- public List getSupplementProfiles();
+ */
+ List getSupplementProfiles();
+
/**
* Gets parameters for Security Layer signature verification.
- *
+ *
* @return Parameters for Security Layer signature verification.
*/
- public SignatureManifestCheckParams getSignatureManifestCheckParams();
+ SignatureManifestCheckParams getSignatureManifestCheckParams();
+
/**
* Checks, whether actually signed data shall be returned.
- *
- * @return <code>true</code>, if signed data will be returned,
- * otherwise <code>false</code>.
+ *
+ * @return <code>true</code>, if signed data will be returned, otherwise
+ * <code>false</code>.
*/
- public boolean getReturnHashInputData();
+ boolean getReturnHashInputData();
+
/**
* Gets the profile id of the set of trusted certificates to be used for
* signature verification.
- *
+ *
* @return The id of the trusted certificates.
*/
- public String getTrustProfileId();
-
+ String getTrustProfileId();
+
/**
* Should perform extended validation
- *
- * @return <code>true</code>, if signed data will be returned,
- * otherwise <code>false</code>.
+ *
+ * @return <code>true</code>, if signed data will be returned, otherwise
+ * <code>false</code>.
*/
- public boolean getExtendedValidaiton();
+ boolean getExtendedValidaiton();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java
index 0ed12bf..33fcf24 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlverify/VerifyXMLSignatureResponse.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.xmlverify;
import java.util.List;
@@ -33,7 +32,7 @@ import at.gv.egovernment.moa.spss.api.common.SignerInfo;
/**
* Object that encapsulates the response on a request to verify an XML
* signature.
- *
+ *
* @author Patrick Peck
* @author Stephan Grill
* @version $Id$
@@ -41,55 +40,63 @@ import at.gv.egovernment.moa.spss.api.common.SignerInfo;
public interface VerifyXMLSignatureResponse {
/**
* Gets a <code>SignerInfo</code> element according to XMLDSig.
- *
+ *
* @return A <code>SignerInfo</code> element according to XMLDSig.
*/
- public SignerInfo getSignerInfo();
+ SignerInfo getSignerInfo();
+
/**
* Gets datas signed by the signatory.
- *
+ *
* @return The signed datas.
*/
- public List getHashInputDatas();
+ List getHashInputDatas();
+
/**
* Gets source datas elements.
- *
+ *
* @return The source datas elements.
*/
- public List getReferenceInputDatas();
+ List getReferenceInputDatas();
+
/**
- * Gets the result of the signature verification.
- *
- * @return The result of the signature verification.
- */
- public ReferencesCheckResult getSignatureCheck();
+ * Gets the result of the signature verification.
+ *
+ * @return The result of the signature verification.
+ */
+ ReferencesCheckResult getSignatureCheck();
+
/**
* Gets the result of the signature manifest verification.
- *
+ *
* @return The result of the signature manifest verification.
*/
- public ReferencesCheckResult getSignatureManifestCheck();
+ ReferencesCheckResult getSignatureManifestCheck();
+
/**
* Gets XMLDSigManifestCheck elements.
- *
+ *
* @return The XMLDSigManifestCheck elements.
*/
- public List getXMLDsigManifestChecks();
+ List getXMLDsigManifestChecks();
+
/**
* Gets the result of the certification verification.
- *
+ *
* @return The result of the certificate verification.
*/
- public CheckResult getCertificateCheck();
-
+ CheckResult getCertificateCheck();
+
/**
* Gets AdES Form results
- *
+ *
* This might be null!
- *
+ *
* @return The result of the AdES Form validation
*/
- public List getAdESFormResults();
-
- public ExtendedCertificateCheckResult getExtendedCertificateCheck();
+ List getAdESFormResults();
+
+ ExtendedCertificateCheckResult getExtendedCertificateCheck();
+
+ String getSignatureAlgorithm();
}
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 b2389a4..bf11240 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
@@ -23,10 +23,6 @@
package at.gv.egovernment.moa.spss.server.config;
-import iaik.asn1.structures.Name;
-import iaik.pki.revocation.RevocationSourceTypes;
-import iaik.utils.RFC2253NameParserException;
-
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
@@ -34,144 +30,151 @@ import java.util.StringTokenizer;
import at.gv.egovernment.moa.spss.util.MessageProvider;
import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
+import iaik.asn1.structures.Name;
+import iaik.pki.revocation.RevocationSourceTypes;
+import iaik.utils.RFC2253NameParserException;
/**
* A class representing a CRL distribution point.
- *
+ *
* @author Sven Aigner
* @author Patrick Peck
* @version $Id$
*/
-public class CRLDistributionPoint extends DistributionPoint implements iaik.pki.revocation.CRLDistributionPoint {
-
- private static Map RC_MAPPING = new HashMap();
-
- static {
-
- // create the mapping between reason code strings and their integer
- // values
- RC_MAPPING.put("unused", new Integer(iaik.asn1.structures.DistributionPoint.unused));
- RC_MAPPING.put("keyCompromise", new Integer(iaik.asn1.structures.DistributionPoint.keyCompromise));
- RC_MAPPING.put("cACompromise", new Integer(iaik.asn1.structures.DistributionPoint.cACompromise));
- RC_MAPPING.put("affiliationChanged", new Integer(iaik.asn1.structures.DistributionPoint.affiliationChanged));
- RC_MAPPING.put("superseded", new Integer(iaik.asn1.structures.DistributionPoint.superseded));
- RC_MAPPING.put("cessationOfOperation",
- new Integer(iaik.asn1.structures.DistributionPoint.cessationOfOperation));
- RC_MAPPING.put("certificateHold", new Integer(iaik.asn1.structures.DistributionPoint.certificateHold));
- RC_MAPPING.put("privilegeWithdrawn", new Integer(iaik.asn1.structures.DistributionPoint.privilegeWithdrawn));
- RC_MAPPING.put("aACompromise", new Integer(iaik.asn1.structures.DistributionPoint.aACompromise));
- }
-
- /**
- * The name of the CA issuing the CRL referred to by this DP.
- */
- private String issuerName_;
-
- /**
- * The reason codes applicable for the distribution point.
- */
- private int reasonCodes;
-
- /**
- * Create a <code>CRLDistributionPoint</code>.
- *
- * @param issuerName
- * The name of the CA issuing the CRL referred to by this DP.
- *
- * @param uri
- * The URI of the distribution point.
- *
- * @param reasonCodeStr
- * A list of reason codes (a space-separated enumeration).
- */
- public CRLDistributionPoint(String issuerName, String uri, String reasonCodeStr) {
- super(uri);
- issuerName_ = issuerName;
- this.reasonCodes = extractReasonCodes(reasonCodeStr);
- }
-
- /**
- * @see DistributionPoint#getType()
- */
- public String getType() {
- return RevocationSourceTypes.CRL;
- }
-
- /**
- * Convert a list of reason codes provided as a <code>String</code> to a
- * binary representation.
- *
- * @param reasonCodeStr
- * A <code>String</code> containing a blank-separated, textual
- * representation of reason codes.
- * @return int A binary representation of reason codes.
- * @see iaik.asn1.structures.DistributionPoint
- */
- private int extractReasonCodes(String reasonCodeStr) {
- int codes = 0;
- StringTokenizer tokenizer = new StringTokenizer(reasonCodeStr);
- String token;
- Integer reasonCode;
-
- while (tokenizer.hasMoreTokens()) {
- token = tokenizer.nextToken();
- reasonCode = (Integer) RC_MAPPING.get(token);
- if (reasonCode != null) {
- codes |= reasonCode.intValue();
- } else {
- MessageProvider msg = MessageProvider.getInstance();
- Logger.warn(new LogMsg(msg.getMessage("config.07", new Object[] { token })));
- }
- }
-
- // If reasonCodeStr is empty, set all possible reason codes
- if (codes == 0)
- codes = iaik.asn1.structures.DistributionPoint.unused | iaik.asn1.structures.DistributionPoint.keyCompromise
- | iaik.asn1.structures.DistributionPoint.cACompromise
- | iaik.asn1.structures.DistributionPoint.affiliationChanged
- | iaik.asn1.structures.DistributionPoint.superseded
- | iaik.asn1.structures.DistributionPoint.cessationOfOperation
- | iaik.asn1.structures.DistributionPoint.certificateHold
- | iaik.asn1.structures.DistributionPoint.privilegeWithdrawn
- | iaik.asn1.structures.DistributionPoint.aACompromise;
-
- return codes;
- }
-
- /**
- * Return a binary representation of the reason codes of this distribution
- * point.
- *
- * @return The binary representation of the reason codes.
- */
- public int getReasonCodes() {
- return reasonCodes;
- }
-
- /**
- * Return a <code>String</code> representation of this distribution point.
- *
- * @return The <code>String</code> representation of this distribution
- * point.
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "(DistributionPoint - " + ("URI<" + getUri()) + ("> REASONCODES<" + getReasonCodes() + ">)");
- }
-
- /**
- * @see iaik.pki.revocation.CRLDistributionPoint#getIssuerName()
- */
- public String getIssuerName() {
- return issuerName_;
- }
-
- @Override
- public Name getIssuerDN() {
- try {
- return new Name(this.issuerName_);
- } catch (RFC2253NameParserException e) {
- throw new RuntimeException(e);
- }
- }
+public class CRLDistributionPoint extends DistributionPoint implements
+ iaik.pki.revocation.CRLDistributionPoint {
+
+ private static Map RC_MAPPING = new HashMap();
+
+ static {
+
+ // create the mapping between reason code strings and their integer
+ // values
+ RC_MAPPING.put("unused", new Integer(iaik.asn1.structures.DistributionPoint.unused));
+ RC_MAPPING.put("keyCompromise", new Integer(iaik.asn1.structures.DistributionPoint.keyCompromise));
+ RC_MAPPING.put("cACompromise", new Integer(iaik.asn1.structures.DistributionPoint.cACompromise));
+ RC_MAPPING.put("affiliationChanged", new Integer(
+ iaik.asn1.structures.DistributionPoint.affiliationChanged));
+ RC_MAPPING.put("superseded", new Integer(iaik.asn1.structures.DistributionPoint.superseded));
+ RC_MAPPING.put("cessationOfOperation",
+ new Integer(iaik.asn1.structures.DistributionPoint.cessationOfOperation));
+ RC_MAPPING.put("certificateHold", new Integer(iaik.asn1.structures.DistributionPoint.certificateHold));
+ RC_MAPPING.put("privilegeWithdrawn", new Integer(
+ iaik.asn1.structures.DistributionPoint.privilegeWithdrawn));
+ RC_MAPPING.put("aACompromise", new Integer(iaik.asn1.structures.DistributionPoint.aACompromise));
+ }
+
+ /**
+ * The name of the CA issuing the CRL referred to by this DP.
+ */
+ private final String issuerName_;
+
+ /**
+ * The reason codes applicable for the distribution point.
+ */
+ private final int reasonCodes;
+
+ /**
+ * Create a <code>CRLDistributionPoint</code>.
+ *
+ * @param issuerName The name of the CA issuing the CRL referred to by this
+ * DP.
+ *
+ * @param uri The URI of the distribution point.
+ *
+ * @param reasonCodeStr A list of reason codes (a space-separated enumeration).
+ */
+ public CRLDistributionPoint(String issuerName, String uri, String reasonCodeStr) {
+ super(uri);
+ issuerName_ = issuerName;
+ this.reasonCodes = extractReasonCodes(reasonCodeStr);
+ }
+
+ /**
+ * @see DistributionPoint#getType()
+ */
+ @Override
+ public String getType() {
+ return RevocationSourceTypes.CRL;
+ }
+
+ /**
+ * Convert a list of reason codes provided as a <code>String</code> to a binary
+ * representation.
+ *
+ * @param reasonCodeStr A <code>String</code> containing a blank-separated,
+ * textual representation of reason codes.
+ * @return int A binary representation of reason codes.
+ * @see iaik.asn1.structures.DistributionPoint
+ */
+ private int extractReasonCodes(String reasonCodeStr) {
+ int codes = 0;
+ final StringTokenizer tokenizer = new StringTokenizer(reasonCodeStr);
+ String token;
+ Integer reasonCode;
+
+ while (tokenizer.hasMoreTokens()) {
+ token = tokenizer.nextToken();
+ reasonCode = (Integer) RC_MAPPING.get(token);
+ if (reasonCode != null) {
+ codes |= reasonCode.intValue();
+ } else {
+ final MessageProvider msg = MessageProvider.getInstance();
+ Logger.warn(new LogMsg(msg.getMessage("config.07", new Object[] { token })));
+ }
+ }
+
+ // If reasonCodeStr is empty, set all possible reason codes
+ if (codes == 0) {
+ codes = iaik.asn1.structures.DistributionPoint.unused
+ | iaik.asn1.structures.DistributionPoint.keyCompromise
+ | iaik.asn1.structures.DistributionPoint.cACompromise
+ | iaik.asn1.structures.DistributionPoint.affiliationChanged
+ | iaik.asn1.structures.DistributionPoint.superseded
+ | iaik.asn1.structures.DistributionPoint.cessationOfOperation
+ | iaik.asn1.structures.DistributionPoint.certificateHold
+ | iaik.asn1.structures.DistributionPoint.privilegeWithdrawn
+ | iaik.asn1.structures.DistributionPoint.aACompromise;
+ }
+
+ return codes;
+ }
+
+ /**
+ * Return a binary representation of the reason codes of this distribution
+ * point.
+ *
+ * @return The binary representation of the reason codes.
+ */
+ @Override
+ public int getReasonCodes() {
+ return reasonCodes;
+ }
+
+ /**
+ * Return a <code>String</code> representation of this distribution point.
+ *
+ * @return The <code>String</code> representation of this distribution point.
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "(DistributionPoint - " + "URI<" + getUri() + "> REASONCODES<" + getReasonCodes() + ">)";
+ }
+
+ /**
+ * @see iaik.pki.revocation.CRLDistributionPoint#getIssuerName()
+ */
+ public String getIssuerName() {
+ return issuerName_;
+ }
+
+ @Override
+ public Name getIssuerDN() {
+ try {
+ return new Name(this.issuerName_);
+ } catch (final RFC2253NameParserException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java
index 6546e88..13f1de9 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationException.java
@@ -21,27 +21,26 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
import at.gv.egovernment.moa.spss.MOASystemException;
/**
* Exception signalling an error in the configuration.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ConfigurationException extends MOASystemException {
/**
- *
- */
- private static final long serialVersionUID = -1934466124930228755L;
+ *
+ */
+ private static final long serialVersionUID = -1934466124930228755L;
-/**
+ /**
* Create a <code>ConfigurationException</code>.
- *
+ *
* @see at.gv.egovernment.moa.spss.MOAException#MOAException(String, Object[])
*/
public ConfigurationException(String messageId, Object[] parameters) {
@@ -50,12 +49,14 @@ public class ConfigurationException extends MOASystemException {
/**
* Create a <code>ConfigurationException</code>.
- * @see at.gv.egovernment.moa.spss.MOAException#MOAException(String, Object[], Throwable)
+ *
+ * @see at.gv.egovernment.moa.spss.MOAException#MOAException(String, Object[],
+ * Throwable)
*/
public ConfigurationException(
- String messageId,
- Object[] parameters,
- Throwable wrapped) {
+ String messageId,
+ Object[] parameters,
+ Throwable wrapped) {
super(messageId, parameters, wrapped);
}
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 15e44eb..8fe31c5 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
@@ -20,22 +20,8 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
-import iaik.asn1.structures.Name;
-//import iaik.ixsil.exceptions.URIException;
-//import iaik.ixsil.util.URI;
-import iaik.pki.pathvalidation.ChainingModes;
-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.utils.RFC2253NameParser;
-import iaik.utils.RFC2253NameParserException;
-import iaik.xml.crypto.utils.URI;
-import iaik.xml.crypto.utils.URIException;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -70,14 +56,25 @@ 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.MiscUtil;
import at.gv.egovernment.moaspss.util.StringUtils;
import at.gv.egovernment.moaspss.util.XPathUtils;
+import iaik.asn1.structures.Name;
+//import iaik.ixsil.exceptions.URIException;
+//import iaik.ixsil.util.URI;
+import iaik.pki.pathvalidation.ChainingModes;
+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.utils.RFC2253NameParser;
+import iaik.utils.RFC2253NameParserException;
+import iaik.xml.crypto.utils.URI;
+import iaik.xml.crypto.utils.URIException;
/**
* A class that builds configuration data from a DOM based representation.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -102,264 +99,274 @@ public class ConfigurationPartsBuilder {
//
private static final String ROOT = "/" + CONF + "MOAConfiguration/";
-
+
private static final String PDFAS_CONFIGURATION_XPATH =
- ROOT + CONF + "Common/" + CONF + "PDFASConfig";
-
+ ROOT + CONF + "Common/" + CONF + "PDFASConfig";
+
private static final String FORMRESULT_CONFIGURATION_XPATH =
- ROOT + CONF + "Common/" + CONF + "AdESFormResult";
-
+ ROOT + CONF + "Common/" + CONF + "AdESFormResult";
+
private static final String DIGEST_METHOD_XPATH =
- ROOT + CONF + "SignatureCreation/"
- + CONF + "XMLDSig/"
- + CONF + "DigestMethodAlgorithm";
+ ROOT + CONF + "SignatureCreation/"
+ + CONF + "XMLDSig/"
+ + CONF + "DigestMethodAlgorithm";
private static final String XADES_VERSION_XPATH =
- ROOT + CONF + "SignatureCreation/"
- + CONF + "XAdES/"
- + CONF + "Version";
+ ROOT + CONF + "SignatureCreation/"
+ + CONF + "XAdES/"
+ + CONF + "Version";
private static final String C14N_ALGORITHM_XPATH =
- ROOT + CONF + "SignatureCreation/"
- + CONF + "XMLDSig/"
- + CONF + "CanonicalizationAlgorithm";
+ ROOT + CONF + "SignatureCreation/"
+ + CONF + "XMLDSig/"
+ + CONF + "CanonicalizationAlgorithm";
private static final String HARDWARE_CRYPTO_MODULE_XPATH =
- ROOT + CONF + "Common/"
- + CONF + "HardwareCryptoModule";
+ ROOT + CONF + "Common/"
+ + CONF + "HardwareCryptoModule";
private static final String PERMIT_EXTERNAL_URIS_XPATH =
- ROOT + CONF + "Common/"
- + CONF + "PermitExternalUris";
+ ROOT + CONF + "Common/"
+ + CONF + "PermitExternalUris";
private static final String BLACK_LIST_URIS_XPATH =
- ROOT + CONF + "Common/"
- + CONF + "PermitExternalUris/"
- + CONF + "BlackListUri";
+ ROOT + CONF + "Common/"
+ + CONF + "PermitExternalUris/"
+ + CONF + "BlackListUri";
private static final String FORBID_EXTERNAL_URIS_XPATH =
- ROOT + CONF + "Common/"
- + CONF + "ForbidExternalUris";
+ ROOT + CONF + "Common/"
+ + CONF + "ForbidExternalUris";
private static final String WHITE_LIST_URIS_XPATH =
- ROOT + CONF + "Common/"
- + CONF + "ForbidExternalUris/"
- + CONF + "WhiteListUri";
-
+ ROOT + CONF + "Common/"
+ + CONF + "ForbidExternalUris/"
+ + CONF + "WhiteListUri";
+
private static final String HARDWARE_KEY_XPATH =
- ROOT + CONF + "SignatureCreation/"
- + CONF + "KeyModules/"
- + CONF + "HardwareKeyModule";
+ ROOT + CONF + "SignatureCreation/"
+ + CONF + "KeyModules/"
+ + CONF + "HardwareKeyModule";
private static final String SOFTWARE_KEY_XPATH =
- ROOT + CONF + "SignatureCreation/"
- + CONF + "KeyModules/"
- + CONF + "SoftwareKeyModule";
- private static final String KEYGROUP_XPATH =
- ROOT + CONF + "SignatureCreation/"
- + CONF + "KeyGroup";
+ ROOT + CONF + "SignatureCreation/"
+ + CONF + "KeyModules/"
+ + CONF + "SoftwareKeyModule";
+ private static final String KEYGROUP_XPATH =
+ ROOT + CONF + "SignatureCreation/"
+ + CONF + "KeyGroup";
private static final String KEYGROUP_MAPPING_XPATH =
- ROOT + CONF + "SignatureCreation/"
- + CONF + "KeyGroupMapping";
- private static final String ISSUER_XPATH =
- DSIG + "X509IssuerName";
- private static final String SERIAL_XPATH =
- DSIG + "X509SerialNumber";
+ ROOT + CONF + "SignatureCreation/"
+ + CONF + "KeyGroupMapping";
+ private static final String ISSUER_XPATH =
+ DSIG + "X509IssuerName";
+ private static final String SERIAL_XPATH =
+ DSIG + "X509SerialNumber";
private static final String CERTSTORE_LOCATION_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "PathConstruction/"
- + CONF + "CertificateStore/"
- + CONF + "DirectoryStore/"
- + CONF + "Location";
- private static final String AUTO_ADD_CERTIFICATES_XPATH_ =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "PathConstruction/"
- + CONF + "AutoAddCertificates";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "PathConstruction/"
+ + CONF + "CertificateStore/"
+ + CONF + "DirectoryStore/"
+ + CONF + "Location";
+ private static final String AUTO_ADD_CERTIFICATES_XPATH_ =
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "PathConstruction/"
+ + CONF + "AutoAddCertificates";
+
+ private static final String AUTO_ADD_EE_CERTIFICATES_XPATH_ =
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "PathConstruction/"
+ + CONF + "AutoAddEECertificates";
+
private static final String USE_AUTHORITY_INFO_ACCESS_XPATH_ =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "PathConstruction/"
- + CONF + "UseAuthorityInformationAccess";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "PathConstruction/"
+ + CONF + "UseAuthorityInformationAccess";
private static final String CHAINING_MODES_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "PathValidation/"
- + CONF + "ChainingMode";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "PathValidation/"
+ + CONF + "ChainingMode";
private static final String CHAINING_MODES_DEFAULT_XPATH =
- CHAINING_MODES_XPATH + "/"
- + CONF + "DefaultMode";
+ CHAINING_MODES_XPATH + "/"
+ + CONF + "DefaultMode";
private static final String TRUST_ANCHOR_XPATH =
- CHAINING_MODES_XPATH + "/"
- + CONF + "TrustAnchor";
+ CHAINING_MODES_XPATH + "/"
+ + CONF + "TrustAnchor";
private static final String TRUST_PROFILE_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "PathValidation/"
- + CONF + "TrustProfile";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "PathValidation/"
+ + CONF + "TrustProfile";
private static final String DISTRIBUTION_POINTS_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "RevocationChecking/"
- + CONF + "DistributionPoint";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "RevocationChecking/"
+ + CONF + "DistributionPoint";
private static final String CRL_RETENTION_INTERVALS_CA_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "RevocationChecking/"
- + CONF + "CrlRetentionIntervals/"
- + CONF + "CA";
- private static final String ENABLE_REVOCATION_CHECKING_XPATH_ =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "RevocationChecking/"
- + CONF + "EnableChecking";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "RevocationChecking/"
+ + CONF + "CrlRetentionIntervals/"
+ + CONF + "CA";
+ private static final String ENABLE_REVOCATION_CHECKING_XPATH_ =
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "RevocationChecking/"
+ + CONF + "EnableChecking";
private static final String MAX_REVOCATION_AGE_XPATH_ =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "RevocationChecking/"
- + CONF + "MaxRevocationAge";
- private static final String REVOCATION_SERVICEORDER_XPATH_ =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "RevocationChecking/"
- + CONF + "ServiceOrder/"
- + CONF + "Service";
- private static final String ENABLE_ARCHIVING_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "RevocationChecking/"
- + CONF + "Archiving/"
- + CONF + "EnableArchiving";
- private static final String CRL_ARCHIVE_DURATION_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "RevocationChecking/"
- + CONF + "Archiving/"
- + CONF + "ArchiveDuration";
- private static final String ACHIVE_JDBC_URL_ =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "RevocationChecking/"
- + CONF + "Archiving/"
- + CONF + "Archive/"
- + CONF + "DatabaseArchive/"
- + CONF + "JDBCURL";
- private static final String ACHIVE_JDBC_DRIVER_CLASS_ =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "RevocationChecking/"
- + CONF + "Archiving/"
- + CONF + "Archive/"
- + CONF + "DatabaseArchive/"
- + CONF + "JDBCDriverClassName";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "RevocationChecking/"
+ + CONF + "MaxRevocationAge";
+ private static final String REVOCATION_SERVICEORDER_XPATH_ =
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "RevocationChecking/"
+ + CONF + "ServiceOrder/"
+ + CONF + "Service";
+ private static final String ENABLE_ARCHIVING_XPATH =
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "RevocationChecking/"
+ + CONF + "Archiving/"
+ + CONF + "EnableArchiving";
+ private static final String CRL_ARCHIVE_DURATION_XPATH =
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "RevocationChecking/"
+ + CONF + "Archiving/"
+ + CONF + "ArchiveDuration";
+ private static final String ACHIVE_JDBC_URL_ =
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "RevocationChecking/"
+ + CONF + "Archiving/"
+ + CONF + "Archive/"
+ + CONF + "DatabaseArchive/"
+ + CONF + "JDBCURL";
+ private static final String ACHIVE_JDBC_DRIVER_CLASS_ =
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "RevocationChecking/"
+ + CONF + "Archiving/"
+ + CONF + "Archive/"
+ + CONF + "DatabaseArchive/"
+ + CONF + "JDBCDriverClassName";
private static final String CREATE_TRANSFORMS_INFO_PROFILE_XPATH =
- ROOT + CONF + "SignatureCreation/"
- + CONF + "CreateTransformsInfoProfile";
+ ROOT + CONF + "SignatureCreation/"
+ + CONF + "CreateTransformsInfoProfile";
private static final String CREATE_SIGNATURE_ENVIRONMENT_PROFILE_XPATH =
- ROOT + CONF + "SignatureCreation/"
- + CONF + "CreateSignatureEnvironmentProfile";
+ ROOT + CONF + "SignatureCreation/"
+ + CONF + "CreateSignatureEnvironmentProfile";
private static final String VERIFY_TRANSFORMS_INFO_PROFILE_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "VerifyTransformsInfoProfile";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "VerifyTransformsInfoProfile";
private static final String SUPPLEMENT_PROFILE_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "SupplementProfile";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "SupplementProfile";
private static final String PERMIT_FILE_URIS_XPATH =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "PermitFileURIs";
-
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "PermitFileURIs";
+
private static final String CONNECTION_TIMEOUT_XPATH_ =
- ROOT + CONF + "SignatureVerification/"
- + CONF + "CertificateValidation/"
- + CONF + "ConnectionTimeout";
-
+ 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/"
- + CONF + "TSLConfiguration/";
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "ReadTimeout";
+
+ private static final String TSL_CONFIGURATION_XPATH =
+ ROOT + CONF + "SignatureVerification/"
+ + CONF + "CertificateValidation/"
+ + CONF + "TSLConfiguration/";
//
- // default values for configuration parameters
+ // default values for configuration parameters
//
/** The accepted canonicalization algorithm URIs, as an array */
private static final String[] ACCEPTED_C14N_ALGORITHMS_ARRAY =
- {
- Constants.C14N_URI,
- Constants.C14N_WITH_COMMENTS_URI,
- Constants.EXC_C14N_URI,
- Constants.EXC_C14N_WITH_COMMENTS_URI };
+ {
+ Constants.C14N_URI,
+ Constants.C14N_WITH_COMMENTS_URI,
+ Constants.EXC_C14N_URI,
+ Constants.EXC_C14N_WITH_COMMENTS_URI };
/** The accepted canonicalization algorithm URIs, as a Set */
private static final Set ACCEPTED_C14N_ALGORITHMS =
- new HashSet(Arrays.asList(ACCEPTED_C14N_ALGORITHMS_ARRAY));
+ new HashSet(Arrays.asList(ACCEPTED_C14N_ALGORITHMS_ARRAY));
/** Default canonicalization algorithm, if none/illegal has been configured */
private static final String C14N_ALGORITHM_DEFAULT = Constants.C14N_URI;
/** The accepted digest method algorithm URIs, as an array */
private static final String[] ACCEPTED_DIGEST_ALGORITHMS_ARRAY =
- { Constants.SHA1_URI,
- Constants.SHA256_URI,
- Constants.SHA384_URI,
- Constants.SHA512_URI};
+ { Constants.SHA1_URI,
+ Constants.SHA256_URI,
+ Constants.SHA384_URI,
+ Constants.SHA512_URI };
/** The accepted digest method algorithm URIs, as a Set */
private static final Set ACCEPTED_DIGEST_ALGORITHMS =
- new HashSet(Arrays.asList(ACCEPTED_DIGEST_ALGORITHMS_ARRAY));
-
-
- /** Default digest algorithm URI, if none/illegal has been configured (for XAdES 1.1.1) */
+ new HashSet(Arrays.asList(ACCEPTED_DIGEST_ALGORITHMS_ARRAY));
+
+ /**
+ * Default digest algorithm URI, if none/illegal has been configured (for XAdES
+ * 1.1.1)
+ */
private static final String DIGEST_ALGORITHM_DEFAULT_XADES_1_1_1 = Constants.SHA1_URI;
-
- /** Default digest algorithm URI, if none/illegal has been configured (for XAdES 1.4.2) */
+
+ /**
+ * Default digest algorithm URI, if none/illegal has been configured (for XAdES
+ * 1.4.2)
+ */
private static final String DIGEST_ALGORITHM_DEFAULT_XADES_1_4_2 = Constants.SHA256_URI;
-
+
/** The root element of the MOA configuration */
- private Element configElem;
-
+ private final Element configElem;
+
/**
* The directory containing the underlying configuration file.
*/
- private File configRoot_;
+ private final File configRoot_;
/** Whether any warnings were encountered building the configuration. */
- private List warnings = new ArrayList();
+ private final List warnings = new ArrayList();
/**
* Create a new <code>ConfigurationPartsBuilder</code>.
- *
+ *
* @param configElem The root element of the MOA configuration.
- *
+ *
* @param configRoot The directory containing the underlying configuration file.
*/
- public ConfigurationPartsBuilder(Element configElem, File configRoot)
- {
+ public ConfigurationPartsBuilder(Element configElem, File configRoot) {
this.configElem = configElem;
configRoot_ = configRoot;
}
/**
- * Returns the root element of the MOA configuration.
- *
+ * Returns the root element of the MOA configuration.
+ *
* @return The root element of the MOA configuration.
*/
public Element getConfigElem() {
return configElem;
}
-
- /**
+
+ /**
* Returns the directory containing the underlying configuration file.
- *
+ *
* @return the directory containing the underlying configuration file.
*/
- public File getConfigRoot()
- {
+ public File getConfigRoot() {
return configRoot_;
}
/**
* Returns the warnings encountered during building the configuration.
- *
- * @return A <code>List</code> of <code>String</code>s, containing the
- * warning messages.
+ *
+ * @return A <code>List</code> of <code>String</code>s, containing the warning
+ * messages.
*/
public List getWarnings() {
return warnings;
@@ -367,129 +374,115 @@ public class ConfigurationPartsBuilder {
/**
* Returns the digest method algorithm name.
- *
+ *
* @return The digest method algorithm name from the configuration.
*/
- public String getDigestMethodAlgorithmName()
- {
+ public String getDigestMethodAlgorithmName() {
String digestMethod = getElementValue(getConfigElem(), DIGEST_METHOD_XPATH, null);
-
- if (digestMethod == null || !ACCEPTED_DIGEST_ALGORITHMS.contains(digestMethod))
- {
- String xadesVersion = this.getXAdESVersion();
- if (xadesVersion == null) {
- info(
- "config.23",
- new Object[] { "DigestMethodAlgorithm", DIGEST_ALGORITHM_DEFAULT_XADES_1_1_1 });
- digestMethod = DIGEST_ALGORITHM_DEFAULT_XADES_1_1_1;
- }
- else {
- info(
- "config.23",
- new Object[] { "DigestMethodAlgorithm", DIGEST_ALGORITHM_DEFAULT_XADES_1_4_2 });
- digestMethod = DIGEST_ALGORITHM_DEFAULT_XADES_1_4_2;
- }
-
-
+
+ if (digestMethod == null || !ACCEPTED_DIGEST_ALGORITHMS.contains(digestMethod)) {
+ final String xadesVersion = this.getXAdESVersion();
+ if (xadesVersion == null) {
+ info(
+ "config.23",
+ new Object[] { "DigestMethodAlgorithm", DIGEST_ALGORITHM_DEFAULT_XADES_1_1_1 });
+ digestMethod = DIGEST_ALGORITHM_DEFAULT_XADES_1_1_1;
+ } else {
+ info(
+ "config.23",
+ new Object[] { "DigestMethodAlgorithm", DIGEST_ALGORITHM_DEFAULT_XADES_1_4_2 });
+ digestMethod = DIGEST_ALGORITHM_DEFAULT_XADES_1_4_2;
+ }
+
}
return digestMethod;
}
-
+
/**
* Returns the digest method algorithm name.
- *
+ *
* @return The digest method algorithm name from the configuration.
*/
- public String getXAdESVersion()
- {
- String xadesVersion = getElementValue(getConfigElem(), XADES_VERSION_XPATH, null);
-
+ public String getXAdESVersion() {
+ final String xadesVersion = getElementValue(getConfigElem(), XADES_VERSION_XPATH, null);
+
return xadesVersion;
}
-
+
/**
* Returns the digest method algorithm name.
- *
+ *
* @return The digest method algorithm name from the configuration.
*/
- public String getPDFASConfiguration()
- {
- String pdfasConfiguration = getElementValue(getConfigElem(), PDFAS_CONFIGURATION_XPATH, null);
-
+ public String getPDFASConfiguration() {
+ final String pdfasConfiguration = getElementValue(getConfigElem(), PDFAS_CONFIGURATION_XPATH, null);
+
return pdfasConfiguration;
}
-
+
/**
* Get the connection timeout to set-up a network connection
*
* @return timeout in milliseconds [ms]
*/
- public int getConnectionTimeout()
- {
- String connectionTimeout = getElementValue(getConfigElem(), CONNECTION_TIMEOUT_XPATH_, "30");
+ public int getConnectionTimeout() {
+ final String connectionTimeout = getElementValue(getConfigElem(), CONNECTION_TIMEOUT_XPATH_, "30");
int defaultConnectionTimeout = 30;
-
- if(connectionTimeout != null) {
- try {
- defaultConnectionTimeout = Integer.parseInt(connectionTimeout);
- } catch(NumberFormatException e) {
- Logger.warn("Configuration value " + CONNECTION_TIMEOUT_XPATH_ + " should be a number defaulting to 30");
- }
+
+ if (connectionTimeout != null) {
+ try {
+ defaultConnectionTimeout = Integer.parseInt(connectionTimeout);
+ } catch (final NumberFormatException e) {
+ Logger.warn("Configuration value " + CONNECTION_TIMEOUT_XPATH_
+ + " should be a number defaulting to 30");
+ }
}
-
- if(defaultConnectionTimeout < 0) {
- defaultConnectionTimeout = 30;
+
+ if (defaultConnectionTimeout < 0) {
+ defaultConnectionTimeout = 30;
}
-
+
return defaultConnectionTimeout * 1000;
}
- /**
- * Get the timeout to receive data from a network connection that is already open
- *
- * @return timeout in milliseconds [ms]
- */
- public int getReadTimeout()
- {
- String connectionTimeout = getElementValue(getConfigElem(), READ_TIMEOUT_XPATH_, "30");
+ public int getReadTimeout() {
+ final String connectionTimeout = getElementValue(getConfigElem(), READ_TIMEOUT_XPATH_, "30");
+
int defaultConnectionTimeout = 30;
-
- if(connectionTimeout != null) {
- try {
- defaultConnectionTimeout = Integer.parseInt(connectionTimeout);
- } catch(NumberFormatException e) {
- Logger.warn("Configuration value " + READ_TIMEOUT_XPATH_ + " should be a number defaulting to 30");
- }
+
+ if (connectionTimeout != null) {
+ try {
+ defaultConnectionTimeout = Integer.parseInt(connectionTimeout);
+ } catch (final NumberFormatException e) {
+ Logger.warn("Configuration value " + READ_TIMEOUT_XPATH_ + " should be a number defaulting to 30");
+ }
}
-
- if(defaultConnectionTimeout < 0) {
- defaultConnectionTimeout = 30;
+
+ if (defaultConnectionTimeout < 0) {
+ defaultConnectionTimeout = 30;
}
-
+
return defaultConnectionTimeout * 1000;
}
-
- public boolean getAdesFormResult()
- {
- String enableArchiving = getElementValue(getConfigElem(), FORMRESULT_CONFIGURATION_XPATH, null);
- return Boolean.valueOf(enableArchiving).booleanValue();
+
+ public boolean getAdesFormResult() {
+ final String enableArchiving = getElementValue(getConfigElem(), FORMRESULT_CONFIGURATION_XPATH, null);
+ return Boolean.valueOf(enableArchiving).booleanValue();
}
-
+
/**
* Returns the canonicalization algorithm name.
- *
+ *
* @return The canonicalization algorithm name from the configuration.
*/
- public String getCanonicalizationAlgorithmName()
- {
+ public String getCanonicalizationAlgorithmName() {
String c14nAlgorithm = getElementValue(getConfigElem(), C14N_ALGORITHM_XPATH, null);
- if (c14nAlgorithm == null || !ACCEPTED_C14N_ALGORITHMS.contains(c14nAlgorithm))
- {
+ if (c14nAlgorithm == null || !ACCEPTED_C14N_ALGORITHMS.contains(c14nAlgorithm)) {
info(
- "config.23",
- new Object[] { "CanonicalizationAlgorithm", C14N_ALGORITHM_DEFAULT });
+ "config.23",
+ new Object[] { "CanonicalizationAlgorithm", C14N_ALGORITHM_DEFAULT });
c14nAlgorithm = C14N_ALGORITHM_DEFAULT;
}
@@ -498,189 +491,172 @@ public class ConfigurationPartsBuilder {
/**
* Build the configured hardware crypto modules.
- *
+ *
* @return The hardware crypto modules from the configuration.
*/
- public List buildHardwareCryptoModules()
- {
- List modules = new ArrayList();
- NodeIterator modIter = XPathUtils.selectNodeIterator(
- getConfigElem(),
- HARDWARE_CRYPTO_MODULE_XPATH);
+ public List buildHardwareCryptoModules() {
+ final List modules = new ArrayList();
+ final NodeIterator modIter = XPathUtils.selectNodeIterator(
+ getConfigElem(),
+ HARDWARE_CRYPTO_MODULE_XPATH);
Element modElem;
while ((modElem = (Element) modIter.nextNode()) != null) {
- String name = getElementValue(modElem, CONF + "Name", null);
- String slotId = getElementValue(modElem, CONF + "SlotId", null);
- String userPIN = getElementValue(modElem, CONF + "UserPIN", null);
- HardwareCryptoModule module = new HardwareCryptoModule(name, slotId, userPIN);
+ final String name = getElementValue(modElem, CONF + "Name", null);
+ final String slotId = getElementValue(modElem, CONF + "SlotId", null);
+ final String userPIN = getElementValue(modElem, CONF + "UserPIN", null);
+ final HardwareCryptoModule module = new HardwareCryptoModule(name, slotId, userPIN);
modules.add(module);
}
return modules;
}
-
+
/**
- *
+ *
* @return
*/
public boolean allowExternalUris() {
- Element permitExtUris = (Element)XPathUtils.selectSingleNode(getConfigElem(), PERMIT_EXTERNAL_URIS_XPATH);
-
- // if PermitExternalUris element does not exist - don't allow external uris
- if (permitExtUris == null) {
- // set permitExtUris for iaik-moa
- ExternalReferenceChecker.setPermitExternalURLs(false);
- return false;
- }
- else {
- // set permitExtUris for iaik-moa
- ExternalReferenceChecker.setPermitExternalURLs(true);
- return true;
- }
+ final Element permitExtUris = (Element) XPathUtils.selectSingleNode(getConfigElem(),
+ PERMIT_EXTERNAL_URIS_XPATH);
+
+ // if PermitExternalUris element does not exist - don't allow external uris
+ if (permitExtUris == null) {
+ // set permitExtUris for iaik-moa
+ ExternalReferenceChecker.setPermitExternalURLs(false);
+ return false;
+ } else {
+ // set permitExtUris for iaik-moa
+ ExternalReferenceChecker.setPermitExternalURLs(true);
+ return true;
+ }
}
-
-
+
/**
- *
+ *
* @return
*/
public List buildPermitExternalUris() {
-
- info("config.33", null);
-
- List blacklist = new ArrayList();
- List blackListIaikMoa = new ArrayList();
-
- NodeIterator permitExtIter = XPathUtils.selectNodeIterator(
- getConfigElem(),
- BLACK_LIST_URIS_XPATH);
-
- Element permitExtElem = null;
- while ((permitExtElem = (Element) permitExtIter.nextNode()) != null) {
- String host = getElementValue(permitExtElem, CONF + "IP", null);
- String port = getElementValue(permitExtElem, CONF + "Port", null);
-
- BlackListEntry entry =null;
- if (port == null) {
- entry = new BlackListEntry(host, -1);
- info("config.34", new Object[]{host});
- }
- else {
- entry = new BlackListEntry(host, new Integer(port).intValue());
- info("config.34", new Object[]{host + ":" + port});
- }
-
- // add entry to iaik-moa blacklist
- blackListIaikMoa.add(entry);
-
-
- String array[] = new String[2];
- array[0] = host;
- array[1] = port;
- blacklist.add(array);
-
- }
-
-
- // set blacklist for iaik-moa
- ExternalReferenceChecker.setBlacklist(blackListIaikMoa);
-
-
- if(blacklist.isEmpty()) // no blacklisted uris given
- info("config.36", null);
-
-
- return blacklist;
+
+ info("config.33", null);
+
+ final List blacklist = new ArrayList();
+ final List blackListIaikMoa = new ArrayList();
+
+ final NodeIterator permitExtIter = XPathUtils.selectNodeIterator(
+ getConfigElem(),
+ BLACK_LIST_URIS_XPATH);
+
+ Element permitExtElem = null;
+ while ((permitExtElem = (Element) permitExtIter.nextNode()) != null) {
+ final String host = getElementValue(permitExtElem, CONF + "IP", null);
+ final String port = getElementValue(permitExtElem, CONF + "Port", null);
+
+ BlackListEntry entry = null;
+ if (port == null) {
+ entry = new BlackListEntry(host, -1);
+ info("config.34", new Object[] { host });
+ } else {
+ entry = new BlackListEntry(host, new Integer(port).intValue());
+ info("config.34", new Object[] { host + ":" + port });
+ }
+
+ // add entry to iaik-moa blacklist
+ blackListIaikMoa.add(entry);
+
+ final String array[] = new String[2];
+ array[0] = host;
+ array[1] = port;
+ blacklist.add(array);
+
+ }
+
+ // set blacklist for iaik-moa
+ ExternalReferenceChecker.setBlacklist(blackListIaikMoa);
+
+ if (blacklist.isEmpty()) {
+ info("config.36", null);
+ }
+
+ return blacklist;
}
-
+
/**
- *
+ *
* @return
*/
public List buildForbidExternalUris() {
-
- //info("config.47", null);
-
- List whitelist = new ArrayList();
- List whiteListIaikMoa = new ArrayList();
-
- NodeIterator forbidExtIter = XPathUtils.selectNodeIterator(
- getConfigElem(),
- WHITE_LIST_URIS_XPATH);
-
- Element permitExtElem = null;
- while ((permitExtElem = (Element) forbidExtIter.nextNode()) != null) {
- String host = getElementValue(permitExtElem, CONF + "IP", null);
- String port = getElementValue(permitExtElem, CONF + "Port", null);
-
- // WhiteListeEntry
- WhiteListEntry entry =null;
- if (port == null) {
- entry = new WhiteListEntry(host, -1);
- info("config.49", new Object[]{host});
+
+ // info("config.47", null);
+
+ final List whitelist = new ArrayList();
+ final List whiteListIaikMoa = new ArrayList();
+
+ final NodeIterator forbidExtIter = XPathUtils.selectNodeIterator(
+ getConfigElem(),
+ WHITE_LIST_URIS_XPATH);
+
+ Element permitExtElem = null;
+ while ((permitExtElem = (Element) forbidExtIter.nextNode()) != null) {
+ final String host = getElementValue(permitExtElem, CONF + "IP", null);
+ final String port = getElementValue(permitExtElem, CONF + "Port", null);
+
+ // WhiteListeEntry
+ WhiteListEntry entry = null;
+ if (port == null) {
+ entry = new WhiteListEntry(host, -1);
+ info("config.49", new Object[] { host });
+ } else {
+ entry = new WhiteListEntry(host, new Integer(port).intValue());
+ info("config.49", new Object[] { host + ":" + port });
}
- else {
- entry = new WhiteListEntry(host, new Integer(port).intValue());
- info("config.49", new Object[]{host + ":" + port});
- }
-
- // add entry to iaik-moa whitelist
- whiteListIaikMoa.add(entry);
-
-
- String array[] = new String[2];
- array[0] = host;
- array[1] = port;
- whitelist.add(array);
-
- }
-
-
- // set whitelist for iaik-moa
- ExternalReferenceChecker.setWhitelist(whiteListIaikMoa);
-
-
- if(whitelist.isEmpty()) // no whitelisted uris given
- info("config.48", null);
-
-
- return whitelist;
+
+ // add entry to iaik-moa whitelist
+ whiteListIaikMoa.add(entry);
+
+ final String array[] = new String[2];
+ array[0] = host;
+ array[1] = port;
+ whitelist.add(array);
+
+ }
+
+ // set whitelist for iaik-moa
+ ExternalReferenceChecker.setWhitelist(whiteListIaikMoa);
+
+ if (whitelist.isEmpty()) {
+ info("config.48", null);
+ }
+
+ return whitelist;
}
-
-
/**
- * Build the configured hardware keys.
- *
- * @param keyModules The keyModules that the configuration already knows about. To
- * prevent multiple key modules with the same ID.
+ * Build the configured hardware keys.
+ *
+ * @param keyModules The keyModules that the configuration already knows about.
+ * To prevent multiple key modules with the same ID.
* @return The hardware keys contained in the configuration.
*/
- public List buildHardwareKeyModules(List keyModules)
- {
- Set existingIds = toIdSet(keyModules);
- List hardwareKeys = new ArrayList();
- NodeIterator hkIter =
- XPathUtils.selectNodeIterator(getConfigElem(), HARDWARE_KEY_XPATH);
+ public List buildHardwareKeyModules(List keyModules) {
+ final Set existingIds = toIdSet(keyModules);
+ final List hardwareKeys = new ArrayList();
+ final NodeIterator hkIter =
+ XPathUtils.selectNodeIterator(getConfigElem(), HARDWARE_KEY_XPATH);
Element keyElem;
- while ((keyElem = (Element) hkIter.nextNode()) != null)
- {
- String id = getElementValue(keyElem, CONF + "Id", null);
- String name = getElementValue(keyElem, CONF + "Name", null);
- String slotId = getElementValue(keyElem, CONF + "SlotId", null);
- String userPIN = getElementValue(keyElem, CONF + "UserPIN", null);
+ while ((keyElem = (Element) hkIter.nextNode()) != null) {
+ final String id = getElementValue(keyElem, CONF + "Id", null);
+ final String name = getElementValue(keyElem, CONF + "Name", null);
+ final String slotId = getElementValue(keyElem, CONF + "SlotId", null);
+ final String userPIN = getElementValue(keyElem, CONF + "UserPIN", null);
- if (existingIds.contains(id))
- {
+ if (existingIds.contains(id)) {
warn(
- "config.04",
- new Object[] { "Hardware- oder SoftwareKeyModule", id });
- }
- else
- {
- KeyModule key = new HardwareKeyModule(id, name, slotId, userPIN);
+ "config.04",
+ new Object[] { "Hardware- oder SoftwareKeyModule", id });
+ } else {
+ final KeyModule key = new HardwareKeyModule(id, name, slotId, userPIN);
hardwareKeys.add(key);
existingIds.add(id);
}
@@ -692,34 +668,29 @@ public class ConfigurationPartsBuilder {
/**
* Build the configured software keys.
- *
- * @param keyModules The keyModules that the configuration already knows about. To
- * prevent multiple key modules with the same ID.
+ *
+ * @param keyModules The keyModules that the configuration already knows about.
+ * To prevent multiple key modules with the same ID.
*
* @return The software keys contained in the configuration.
*/
- public List buildSoftwareKeyModules(List keyModules)
- {
- Set existingIds = toIdSet(keyModules);
- List softwareKeys = new ArrayList();
- NodeIterator skIter =
- XPathUtils.selectNodeIterator(getConfigElem(), SOFTWARE_KEY_XPATH);
+ public List buildSoftwareKeyModules(List keyModules) {
+ final Set existingIds = toIdSet(keyModules);
+ final List softwareKeys = new ArrayList();
+ final NodeIterator skIter =
+ XPathUtils.selectNodeIterator(getConfigElem(), SOFTWARE_KEY_XPATH);
Element keyElem;
- while ((keyElem = (Element) skIter.nextNode()) != null)
- {
- String id = getElementValue(keyElem, CONF + "Id", null);
- String fileName = getElementValue(keyElem, CONF + "FileName", null);
- String passWord = getElementValue(keyElem, CONF + "Password", null);
+ while ((keyElem = (Element) skIter.nextNode()) != null) {
+ final String id = getElementValue(keyElem, CONF + "Id", null);
+ final String fileName = getElementValue(keyElem, CONF + "FileName", null);
+ final String passWord = getElementValue(keyElem, CONF + "Password", null);
- if (existingIds.contains(id))
- {
+ if (existingIds.contains(id)) {
warn(
- "config.04",
- new Object[] { "Hardware- oder SoftwareKeyModule", id });
- }
- else
- {
+ "config.04",
+ new Object[] { "Hardware- oder SoftwareKeyModule", id });
+ } else {
File keyFile;
KeyModule key;
@@ -731,7 +702,7 @@ public class ConfigurationPartsBuilder {
// check for existence
if (!keyFile.exists() || keyFile.isDirectory()) {
- warn("config.25", new Object[] { id, keyFile.getAbsolutePath()});
+ warn("config.25", new Object[] { id, keyFile.getAbsolutePath() });
} else {
// create a new key module
key = new SoftwareKeyModule(id, keyFile.getAbsolutePath(), passWord);
@@ -746,39 +717,36 @@ public class ConfigurationPartsBuilder {
/**
* Build the key group configuration.
- *
- * @param keyModules The <code>KeyModule</code>s that the configuration
- * knows about. Used to check for errors in the configuration.
+ *
+ * @param keyModules The <code>KeyModule</code>s that the configuration knows
+ * about. Used to check for errors in the configuration.
* @return The mapping between key group IDs and key groups.
*/
- public Map buildKeyGroups(List keyModules)
- {
- Set keyModuleIds = toIdSet(keyModules);
- Map keyGroups = new HashMap();
+ public Map buildKeyGroups(List keyModules) {
+ final Set keyModuleIds = toIdSet(keyModules);
+ final Map keyGroups = new HashMap();
NodeIterator kgIter;
Element keyGroupElem;
// select all KeyGroup elements and build the KeyGroup objects from them
kgIter = XPathUtils.selectNodeIterator(getConfigElem(), KEYGROUP_XPATH);
- while ((keyGroupElem = (Element) kgIter.nextNode()) != null)
- {
+ while ((keyGroupElem = (Element) kgIter.nextNode()) != null) {
String keyGroupId = getElementValue(keyGroupElem, CONF + "Id", null);
- //switch all keyGroupIds to lower case, only
- if (MiscUtil.isNotEmpty(keyGroupId))
- keyGroupId = keyGroupId.trim().toLowerCase();
-
- String keyGroupDigestMethodAlgorithm = getElementValue(keyGroupElem, CONF + "DigestMethodAlgorithm", null);
- Set keyGroupEntries =
- buildKeyGroupEntries(keyGroupId, keyModuleIds, keyGroupElem);
- KeyGroup keyGroup = new KeyGroup(keyGroupId, keyGroupEntries, keyGroupDigestMethodAlgorithm);
+ // switch all keyGroupIds to lower case, only
+ if (MiscUtil.isNotEmpty(keyGroupId)) {
+ keyGroupId = keyGroupId.trim().toLowerCase();
+ }
- if (keyGroups.containsKey(keyGroupId))
- {
+ final String keyGroupDigestMethodAlgorithm = getElementValue(keyGroupElem, CONF
+ + "DigestMethodAlgorithm", null);
+ final Set keyGroupEntries =
+ buildKeyGroupEntries(keyGroupId, keyModuleIds, keyGroupElem);
+ final KeyGroup keyGroup = new KeyGroup(keyGroupId, keyGroupEntries, keyGroupDigestMethodAlgorithm);
+
+ if (keyGroups.containsKey(keyGroupId)) {
warn("config.04", new Object[] { "KeyGroup", keyGroupId });
- }
- else
- {
+ } else {
keyGroups.put(keyGroup.getId(), keyGroup);
}
}
@@ -788,17 +756,16 @@ public class ConfigurationPartsBuilder {
/**
* Return the set of IDs contained in the given <code>KeyModule</code>s.
- *
- * @param keyModules The <code>KeyModule</code>s from which to extract the
- * IDs.
+ *
+ * @param keyModules The <code>KeyModule</code>s from which to extract the IDs.
* @return The IDs from the given <code>KeyModule</code>s.
*/
private Set toIdSet(List keyModules) {
- Set ids = new HashSet();
+ final Set ids = new HashSet();
Iterator iter;
for (iter = keyModules.iterator(); iter.hasNext();) {
- KeyModule keyModule = (KeyModule) iter.next();
+ final KeyModule keyModule = (KeyModule) iter.next();
ids.add(keyModule.getId());
}
@@ -807,35 +774,36 @@ public class ConfigurationPartsBuilder {
/**
* Build the key entries belonging to a key group.
- *
- * @param keyGroupId The ID of the key group we are building here. Passed
- * for logging purposes.
+ *
+ * @param keyGroupId The ID of the key group we are building here. Passed for
+ * logging purposes.
* @param keyModuleIds The IDs of the <code>HardwareKeyModule</code>s and
- * <code>SoftwareKeyModule</code>s that exist in the configuration.
+ * <code>SoftwareKeyModule</code>s that exist in the
+ * configuration.
* @param keyGroupElem The <code>KeyGroup</code> DOM element to parse.
* @return A <code>Set</code> of <code>KeyGroupEntry</code> objects.
*/
private Set buildKeyGroupEntries(
- String keyGroupId,
- Set keyModuleIds,
- Element keyGroupElem) {
+ String keyGroupId,
+ Set keyModuleIds,
+ Element keyGroupElem) {
- Set entries = new HashSet();
+ final Set entries = new HashSet();
NodeIterator keyEntryIter;
Element keyEntryElem;
// select all Key elements and put them into the Map
keyEntryIter = XPathUtils.selectNodeIterator(keyGroupElem, CONF + "Key");
- while ((keyEntryElem = (Element) keyEntryIter.nextNode()) != null)
- {
- String keyModuleId = getElementValue(keyEntryElem, CONF + "KeyModuleId", "");
- Element keyCertElem = (Element) XPathUtils.selectSingleNode(keyEntryElem, CONF + "KeyCertIssuerSerial");
- IssuerAndSerial issuerSerial = buildIssuerAndSerial(keyCertElem);
+ while ((keyEntryElem = (Element) keyEntryIter.nextNode()) != null) {
+ final String keyModuleId = getElementValue(keyEntryElem, CONF + "KeyModuleId", "");
+ final Element keyCertElem = (Element) XPathUtils.selectSingleNode(keyEntryElem, CONF
+ + "KeyCertIssuerSerial");
+ final IssuerAndSerial issuerSerial = buildIssuerAndSerial(keyCertElem);
if (!keyModuleIds.contains(keyModuleId)) {
warn("config.26", new Object[] { keyGroupId, keyModuleId });
} else if (issuerSerial != null) {
- KeyGroupEntry entry = new KeyGroupEntry(keyModuleId, issuerSerial);
+ final KeyGroupEntry entry = new KeyGroupEntry(keyModuleId, issuerSerial);
entries.add(entry);
}
}
@@ -844,34 +812,31 @@ public class ConfigurationPartsBuilder {
/**
* Build the key group mapping.
- *
+ *
* @param keyGroups The available key groups.
* @param anonymous The <code>IssuerAndSerial</code> to be used for key group
- * mappings not protected by a certificate.
+ * mappings not protected by a certificate.
* @return The key group mapping.
*/
public Map buildKeyGroupMappings(Map keyGroups, IssuerAndSerial anonymous) {
- Map mappings = new HashMap();
+ final Map mappings = new HashMap();
NodeIterator mappingIter;
Element mappingElem;
// select all KeyGroupMapping elements
mappingIter =
- XPathUtils.selectNodeIterator(getConfigElem(), KEYGROUP_MAPPING_XPATH);
+ XPathUtils.selectNodeIterator(getConfigElem(), KEYGROUP_MAPPING_XPATH);
// build the mapping for each KeyGroupMapping element
- while ((mappingElem = (Element) mappingIter.nextNode()) != null)
- {
- Element issuerSerialElem = (Element) XPathUtils.selectSingleNode(mappingElem, CONF + "CustomerId");
+ while ((mappingElem = (Element) mappingIter.nextNode()) != null) {
+ final Element issuerSerialElem = (Element) XPathUtils.selectSingleNode(mappingElem, CONF
+ + "CustomerId");
// build the IssuerAndSerial who has access to the key groups
IssuerAndSerial issuerAndSerial;
- if (issuerSerialElem != null)
- {
+ if (issuerSerialElem != null) {
issuerAndSerial = buildIssuerAndSerial(issuerSerialElem);
- }
- else
- {
+ } else {
// IssuerSerial element: the keygroup is generally available
issuerAndSerial = anonymous;
}
@@ -882,8 +847,7 @@ public class ConfigurationPartsBuilder {
NodeIterator keyGroupIter;
Element keyGroupElem;
- if (groups == null)
- {
+ if (groups == null) {
// no mapping exist -> build one
groups = new HashMap();
mappings.put(issuerAndSerial, groups);
@@ -891,16 +855,13 @@ public class ConfigurationPartsBuilder {
// select the available key groups and add them to the mapping
keyGroupIter = XPathUtils.selectNodeIterator(mappingElem, CONF + "KeyGroupId");
- while ((keyGroupElem = (Element) keyGroupIter.nextNode()) != null)
- {
- String keyGroupId = getElementValue(keyGroupElem, ".", null);
- KeyGroup keyGroup = (KeyGroup) keyGroups.get(keyGroupId.trim().toLowerCase());
-
- if (keyGroup != null)
- {
+ while ((keyGroupElem = (Element) keyGroupIter.nextNode()) != null) {
+ final String keyGroupId = getElementValue(keyGroupElem, ".", null);
+ final KeyGroup keyGroup = (KeyGroup) keyGroups.get(keyGroupId.trim().toLowerCase());
+
+ if (keyGroup != null) {
groups.put(keyGroupId, keyGroup);
- } else
- {
+ } else {
warn("config.00", new Object[] { keyGroupId });
}
}
@@ -912,15 +873,14 @@ public class ConfigurationPartsBuilder {
/**
* Returns the default chaining mode from the configuration.
- *
+ *
* @return The default chaining mode.
*/
- public String getDefaultChainingMode()
- {
- String defaultChaining = getElementValue(
- getConfigElem(),
- CHAINING_MODES_DEFAULT_XPATH,
- CM_PKIX);
+ public String getDefaultChainingMode() {
+ final String defaultChaining = getElementValue(
+ getConfigElem(),
+ CHAINING_MODES_DEFAULT_XPATH,
+ CM_PKIX);
return translateChainingMode(defaultChaining);
@@ -928,23 +888,20 @@ public class ConfigurationPartsBuilder {
/**
* Build the chaining modes for all configured trust anchors.
- *
+ *
* @return The mapping from trust anchors to chaining modes.
*/
- public Map buildChainingModes()
- {
- Map chainingModes = new HashMap();
- NodeIterator trustIter = XPathUtils.selectNodeIterator(getConfigElem(), TRUST_ANCHOR_XPATH);
+ public Map buildChainingModes() {
+ final Map chainingModes = new HashMap();
+ final NodeIterator trustIter = XPathUtils.selectNodeIterator(getConfigElem(), TRUST_ANCHOR_XPATH);
Element trustAnchorElem;
- while ((trustAnchorElem = (Element) trustIter.nextNode()) != null)
- {
- IssuerAndSerial issuerAndSerial = buildIssuerAndSerial(
- (Element)XPathUtils.selectSingleNode(trustAnchorElem, CONF + "Identification"));
- String mode = getElementValue(trustAnchorElem, CONF + "Mode", null);
+ while ((trustAnchorElem = (Element) trustIter.nextNode()) != null) {
+ final IssuerAndSerial issuerAndSerial = buildIssuerAndSerial(
+ (Element) XPathUtils.selectSingleNode(trustAnchorElem, CONF + "Identification"));
+ final String mode = getElementValue(trustAnchorElem, CONF + "Mode", null);
- if (issuerAndSerial != null)
- {
+ if (issuerAndSerial != null) {
chainingModes.put(issuerAndSerial, translateChainingMode(mode));
}
}
@@ -954,26 +911,26 @@ public class ConfigurationPartsBuilder {
/**
* Build an <code>IssuerAndSerial</code> from the DOM representation.
- *
+ *
* @param root The root element (being of type <code>dsig:
* X509IssuerSerialType</code>.
* @return The issuer and serial number contained in the <code>root</code>
- * element or <code>null</code> if could not be built for any reason.
+ * element or <code>null</code> if could not be built for any reason.
*/
private IssuerAndSerial buildIssuerAndSerial(Element root) {
- String issuer = getElementValue(root, ISSUER_XPATH, null);
- String serial = getElementValue(root, SERIAL_XPATH, null);
+ final String issuer = getElementValue(root, ISSUER_XPATH, null);
+ final String serial = getElementValue(root, SERIAL_XPATH, null);
if (issuer != null && serial != null) {
try {
- RFC2253NameParser nameParser = new RFC2253NameParser(issuer);
- Principal issuerDN = nameParser.parse();
+ final RFC2253NameParser nameParser = new RFC2253NameParser(issuer);
+ final Principal issuerDN = nameParser.parse();
return new IssuerAndSerial(issuerDN, new BigInteger(serial));
- } catch (RFC2253NameParserException e) {
+ } catch (final RFC2253NameParserException e) {
warn("config.16", new Object[] { issuer, serial }, e);
return null;
- } catch (NumberFormatException e) {
+ } catch (final NumberFormatException e) {
warn("config.16", new Object[] { issuer, serial }, e);
return null;
}
@@ -984,10 +941,10 @@ public class ConfigurationPartsBuilder {
/**
* Translate the chaining mode from the configuration file to one used in the
* IAIK MOA API.
- *
+ *
* @param chainingMode The chaining mode from the configuration.
* @return The chaining mode as provided by the <code>ChainingModes</code>
- * interface.
+ * interface.
* @see iaik.pki.pathvalidation.ChainingModes
*/
private String translateChainingMode(String chainingMode) {
@@ -1002,55 +959,50 @@ public class ConfigurationPartsBuilder {
/**
* Build the distribution points mapping.
- *
+ *
* @return The mapping from certificate authorities to distribution points.
*/
- public Map buildDistributionPoints()
- {
- Map dPs = new HashMap();
+ public Map buildDistributionPoints() {
+ final Map dPs = new HashMap();
NodeIterator dPIter;
Element dPElem;
- // select all DistributionPoint elements
+ // select all DistributionPoint elements
dPIter = XPathUtils.selectNodeIterator(getConfigElem(), DISTRIBUTION_POINTS_XPATH);
- // build the mapping of CA name to distribution points
+ // build the mapping of CA name to distribution points
while ((dPElem = (Element) dPIter.nextNode()) != null) {
- String caIssuerDNText = getElementValue(dPElem, CONF + "CAIssuerDN", "");
- RFC2253NameParser nameParser = new RFC2253NameParser(caIssuerDNText);
- NodeIterator cRLDPIter = XPathUtils.selectNodeIterator(dPElem, CONF + "CRLDP");
- NodeIterator oCSPDPPIter = XPathUtils.selectNodeIterator(dPElem, CONF + "OCSPDP");
+ final String caIssuerDNText = getElementValue(dPElem, CONF + "CAIssuerDN", "");
+ final RFC2253NameParser nameParser = new RFC2253NameParser(caIssuerDNText);
+ final NodeIterator cRLDPIter = XPathUtils.selectNodeIterator(dPElem, CONF + "CRLDP");
+ final NodeIterator oCSPDPPIter = XPathUtils.selectNodeIterator(dPElem, CONF + "OCSPDP");
- try
- {
- String caIssuerDN = nameParser.parse().getName();
+ try {
+ final String caIssuerDN = nameParser.parse().getName();
- // check, if a mapping exists or make a new mapping
+ // check, if a mapping exists or make a new mapping
Set dPsForCA = (Set) dPs.get(caIssuerDN);
- if (dPsForCA == null)
- {
+ if (dPsForCA == null) {
dPsForCA = new HashSet();
dPs.put(caIssuerDN, dPsForCA);
}
// add the CRL distribution points of this CA to the set
Element cRLDPElem;
- while ((cRLDPElem = (Element) cRLDPIter.nextNode()) != null)
- {
- CRLDistributionPoint cRLDP = (CRLDistributionPoint) buildDistributionPoint(cRLDPElem, caIssuerDN);
+ while ((cRLDPElem = (Element) cRLDPIter.nextNode()) != null) {
+ final CRLDistributionPoint cRLDP = (CRLDistributionPoint) buildDistributionPoint(cRLDPElem,
+ caIssuerDN);
dPsForCA.add(cRLDP);
}
// add the OCSP distribution points of this CA to the set
Element oCSPPElem;
- while ((oCSPPElem = (Element) oCSPDPPIter.nextNode()) != null)
- {
- OCSPDistributionPoint oCSPDP = (OCSPDistributionPoint) buildDistributionPoint(oCSPPElem, null);
+ while ((oCSPPElem = (Element) oCSPDPPIter.nextNode()) != null) {
+ final OCSPDistributionPoint oCSPDP = (OCSPDistributionPoint) buildDistributionPoint(oCSPPElem,
+ null);
dPsForCA.add(oCSPDP);
}
-}
- catch (RFC2253NameParserException e)
- {
+ } catch (final RFC2253NameParserException e) {
warn("config.13", new Object[] { caIssuerDNText }, e);
}
@@ -1061,143 +1013,126 @@ public class ConfigurationPartsBuilder {
/**
* Build a distribution point from the DOM representation.
- *
- * @param dpElem The root element of the distribution point.
- *
- * @param issuerName The name of the CA issuing the CRL referred to by this DP, or <code>null</code>
- * if this DP refers to an OCSP responder.
- *
+ *
+ * @param dpElem The root element of the distribution point.
+ *
+ * @param issuerName The name of the CA issuing the CRL referred to by this DP,
+ * or <code>null</code> if this DP refers to an OCSP
+ * responder.
+ *
* @return The distribution point.
*/
- private DistributionPoint buildDistributionPoint(Element dpElem, String issuerName)
- {
- String uri = getElementValue(dpElem, CONF + "Location", null);
-
- if ("CRLDP".equals(dpElem.getLocalName()))
- {
- NodeIterator reasonCodesIter = XPathUtils.selectNodeIterator(dpElem, CONF + "ReasonCode");
+ private DistributionPoint buildDistributionPoint(Element dpElem, String issuerName) {
+ final String uri = getElementValue(dpElem, CONF + "Location", null);
+
+ if ("CRLDP".equals(dpElem.getLocalName())) {
+ final NodeIterator reasonCodesIter = XPathUtils.selectNodeIterator(dpElem, CONF + "ReasonCode");
Element reasonCodeElem;
- StringBuffer reasonCodesSB = new StringBuffer();
- while ((reasonCodeElem = (Element)reasonCodesIter.nextNode()) != null)
- {
- if (reasonCodesSB.length() > 0) reasonCodesSB.append(" ");
+ final StringBuffer reasonCodesSB = new StringBuffer();
+ while ((reasonCodeElem = (Element) reasonCodesIter.nextNode()) != null) {
+ if (reasonCodesSB.length() > 0) {
+ reasonCodesSB.append(" ");
+ }
reasonCodesSB.append(getElementValue(reasonCodeElem, ".", "").trim());
}
return new CRLDistributionPoint(issuerName, uri, reasonCodesSB.toString());
- }
- else
- {
+ } else {
return new OCSPDistributionPoint(uri);
}
}
/**
* Return the CRL archive duration.
- *
- * @return The value of the CRL archive duration setting from the configuration, or <code>0</code> if
- * no value is set in the configuration.
+ *
+ * @return The value of the CRL archive duration setting from the configuration,
+ * or <code>0</code> if no value is set in the configuration.
*/
- public int getRevocationArchiveDuration()
- {
- String archiveDuration = getElementValue(getConfigElem(), CRL_ARCHIVE_DURATION_XPATH, null);
- try
- {
+ public int getRevocationArchiveDuration() {
+ final String archiveDuration = getElementValue(getConfigElem(), CRL_ARCHIVE_DURATION_XPATH, null);
+ try {
return Integer.parseInt(archiveDuration);
- }
- catch (NumberFormatException e)
- {
+ } catch (final NumberFormatException e) {
warn("config.01", null);
return 365;
}
}
/**
- * Build the <code>CreateTransformsInfoProfile</code>s.
- *
+ * Build the <code>CreateTransformsInfoProfile</code>s.
+ *
* @return The mapping from profile ID to profile.
*/
- public Map buildCreateTransformsInfoProfiles()
- {
+ public Map buildCreateTransformsInfoProfiles() {
return loadProfiles(CREATE_TRANSFORMS_INFO_PROFILE_XPATH, "CreateTransformsInfoProfile");
}
/**
* Build the <code>CreateSignatureEnvironmentProfile</code>s.
- *
+ *
* @return The mapping from profile ID to profile.
*/
- public Map buildCreateSignatureEnvironmentProfiles()
- {
+ public Map buildCreateSignatureEnvironmentProfiles() {
return loadProfiles(CREATE_SIGNATURE_ENVIRONMENT_PROFILE_XPATH, "CreateSignatureEnvironmentProfile");
}
/**
* Build the <code>VerifyTransformsInfoProfile</code>s.
- *
+ *
* @return The mapping from profile ID to profile.
*/
- public Map buildVerifyTransformsInfoProfiles()
- {
+ public Map buildVerifyTransformsInfoProfiles() {
return loadProfiles(VERIFY_TRANSFORMS_INFO_PROFILE_XPATH, "VerifyTransformsInfoProfile");
}
/**
* Build the <code>SupplementProfile</code>s.
- *
+ *
* @return The mapping from profile ID to profile.
*/
- public Map buildSupplementProfiles()
- {
+ public Map buildSupplementProfiles() {
return loadProfiles(SUPPLEMENT_PROFILE_XPATH, "SupplementProfile");
}
/**
* Load a profile mapping.
- *
- * @param xpath The XPath to select the profiles from the configuration.
- *
+ *
+ * @param xpath The XPath to select the profiles from the configuration.
+ *
* @param profileRoot The name of the profile root element.
- *
+ *
* @return Map The profile ID to profile mapping.
*/
- private Map loadProfiles(String xpath, String profileRoot)
- {
- Map profiles = new HashMap();
- NodeIterator profileIter = XPathUtils.selectNodeIterator(getConfigElem(), xpath);
+ private Map loadProfiles(String xpath, String profileRoot) {
+ final Map profiles = new HashMap();
+ final NodeIterator profileIter = XPathUtils.selectNodeIterator(getConfigElem(), xpath);
Element profileElem;
- while ((profileElem = (Element) profileIter.nextNode()) != null)
- {
- String id = getElementValue(profileElem, CONF + "Id", null);
- String fileName = getElementValue(profileElem, CONF + "Location", null);
+ while ((profileElem = (Element) profileIter.nextNode()) != null) {
+ final String id = getElementValue(profileElem, CONF + "Id", null);
+ final String fileName = getElementValue(profileElem, CONF + "Location", null);
- if (profiles.containsKey(id))
- {
+ if (profiles.containsKey(id)) {
warn("config.04", new Object[] { profileRoot, id });
- }
- else
- {
- try
- {
+ } else {
+ try {
File profileFile = new File(fileName);
// make profileFile absolute
- if (!profileFile.isAbsolute()) profileFile = new File(configRoot_, fileName);
+ if (!profileFile.isAbsolute()) {
+ profileFile = new File(configRoot_, fileName);
+ }
// load the profile
- info("config.22", new Object[] { profileRoot, id, profileFile.getAbsoluteFile()});
- Element profile = loadProfile(profileFile);
+ info("config.22", new Object[] { profileRoot, id, profileFile.getAbsoluteFile() });
+ final Element profile = loadProfile(profileFile);
- if (Constants.MOA_NS_URI.equals(profile.getNamespaceURI()) &&
- profile.getLocalName().equals(profileRoot))
- {
+ if (Constants.MOA_NS_URI.equals(profile.getNamespaceURI()) &&
+ profile.getLocalName().equals(profileRoot)) {
profiles.put(id, profile);
- }
- else
- {
+ } else {
warn("config.02", new Object[] { profileRoot, id, fileName });
}
- } catch (ConfigurationException e) {
+ } catch (final ConfigurationException e) {
warn("config.03", new Object[] { profileRoot, id });
}
}
@@ -1208,8 +1143,9 @@ public class ConfigurationPartsBuilder {
/**
* Load a profile from a file.
- *
- * @param root The absolute directory path of the main configuration file.
+ *
+ * @param root The absolute directory path of the main configuration
+ * file.
* @param profileFile The file containing the profile.
* @return The profile in its DOM representation.
* @throws ConfigurationException An error occurred loading the profile.
@@ -1220,7 +1156,7 @@ public class ConfigurationPartsBuilder {
try {
profile = parseXml(new FileInputStream(profileFile));
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new ConfigurationException("config.12", null, e);
}
@@ -1229,146 +1165,136 @@ public class ConfigurationPartsBuilder {
/**
* Build the trust profile mapping.
- *
+ *
* @return The profile ID to profile mapping.
*/
-
- public Map buildTrustProfiles()
- {
- Map trustProfiles = new HashMap();
- NodeIterator profileIter = XPathUtils.selectNodeIterator(getConfigElem(), TRUST_PROFILE_XPATH);
+
+ public Map buildTrustProfiles() {
+ final Map trustProfiles = new HashMap();
+ final NodeIterator profileIter = XPathUtils.selectNodeIterator(getConfigElem(), TRUST_PROFILE_XPATH);
Element profileElem;
- while ((profileElem = (Element) profileIter.nextNode()) != null) {
- //load basic TrustProfile information
-
- //check TrustProfileId
- String id = getElementValue(profileElem, CONF + "Id", null);
- if (MiscUtil.isEmpty(id)) {
- warn("config.52", new Object[]{"Id des TrustProfiles ist leer."});
- continue;
-
- }
- //cast profileId to lowercase (changed in 3.0.1)
- id = id.trim().toLowerCase();
- if (trustProfiles.containsKey(id)) {
- warn("config.04", new Object[] { "TrustProfile", id });
+ while ((profileElem = (Element) profileIter.nextNode()) != null) {
+ // load basic TrustProfile information
+
+ // check TrustProfileId
+ String id = getElementValue(profileElem, CONF + "Id", null);
+ if (MiscUtil.isEmpty(id)) {
+ warn("config.52", new Object[] { "Id des TrustProfiles ist leer." });
+ continue;
+
+ }
+ // cast profileId to lowercase (changed in 3.0.1)
+ id = id.trim().toLowerCase();
+ if (trustProfiles.containsKey(id)) {
+ warn("config.04", new Object[] { "TrustProfile", id });
+ continue;
+ }
+
+ // check location of TrustAnchor directory
+ final String trustAnchorsLocStr = getElementValue(profileElem, CONF + "TrustAnchorsLocation", null);
+ URI trustAnchorsLocURI = null;
+ try {
+ trustAnchorsLocURI = new URI(trustAnchorsLocStr);
+ if (!trustAnchorsLocURI.isAbsolute()) { // make it absolute to the config file
+ trustAnchorsLocURI = new URI(configRoot_.toURL() + trustAnchorsLocStr);
+ }
+ } catch (final URIException e) {
+ warn("config.14", new Object[] { "uri", id, trustAnchorsLocStr }, e);
+ continue;
+ } catch (final MalformedURLException e) {
+ warn("config.15", new Object[] { id }, e);
+ continue;
+ }
+ final File profileDir = new File(trustAnchorsLocURI.getPath());
+ if (!profileDir.exists() || !profileDir.isDirectory()) {
+ warn("config.27", new Object[] { "uri", id });
+ continue;
+ }
+
+ // check signerCertsLocation URL
+ String signerCertsLocStr = getElementValue(profileElem, CONF + "SignerCertsLocation", null);
+ URI signerCertsLocURI = null;
+ if (signerCertsLocStr != null && !"".equals(signerCertsLocStr)) {
+ try {
+ signerCertsLocURI = new URI(signerCertsLocStr);
+ if (!signerCertsLocURI.isAbsolute()) {
+ signerCertsLocURI = new URI(configRoot_.toURL() + signerCertsLocStr);
+ }
+
+ final File signerCertsDir = new File(signerCertsLocURI.getPath());
+ if (!signerCertsDir.exists() || !signerCertsDir.isDirectory()) {
+ warn("config.27", new Object[] { "signerCertsUri", id });
continue;
- }
-
- //check location of TrustAnchor directory
- String trustAnchorsLocStr = getElementValue(profileElem, CONF + "TrustAnchorsLocation", null);
- URI trustAnchorsLocURI = null;
- try
- {
- trustAnchorsLocURI = new URI(trustAnchorsLocStr);
- if (!trustAnchorsLocURI.isAbsolute()) { // make it absolute to the config file
- trustAnchorsLocURI = new URI(configRoot_.toURL() + trustAnchorsLocStr);
}
- }
- catch (URIException e) {
- warn("config.14", new Object[] { "uri", id, trustAnchorsLocStr }, e);
- continue;
- }
- catch (MalformedURLException e)
- {
- warn("config.15", new Object[] {id}, e);
+ } catch (final URIException e) {
+ warn("config.14", new Object[] { "signerCertsUri", id, trustAnchorsLocStr }, e);
continue;
- }
- File profileDir = new File(trustAnchorsLocURI.getPath());
- if (!profileDir.exists() || !profileDir.isDirectory()) {
- warn("config.27", new Object[] { "uri", id });
+ } catch (final MalformedURLException e) {
+ warn("config.15", new Object[] { id }, e);
continue;
}
+ }
+ signerCertsLocStr = signerCertsLocURI != null ? signerCertsLocURI.toString() : null;
+
+ // check if TSL support is enabled
+ final Element eutslElem = (Element) XPathUtils.selectSingleNode(profileElem, CONF + "EUTSL");
+ boolean tslEnabled = false;
+ if (eutslElem != null) {
+ tslEnabled = true;
+ }
+
+ // load TSL configuration
+ final String countries = getElementValue(profileElem, CONF + "EUTSL" + "/" + CONF + "CountrySelection",
+ null);
+ final String allowedTspStatus = getElementValue(profileElem, CONF + "EUTSL" + "/" + CONF
+ + "AllowedTSPStatus", null);
+ final String allowedTspServiceTypes = getElementValue(profileElem, CONF + "EUTSL" + "/" + CONF
+ + "AllowedTSPServiceTypes", null);
+
+ // create profile configuration
+ final TrustProfile profile = new TrustProfile(id, trustAnchorsLocURI.toString(), signerCertsLocStr,
+ tslEnabled, countries, allowedTspStatus, allowedTspServiceTypes);
+ trustProfiles.put(id, profile);
- //check signerCertsLocation URL
- String signerCertsLocStr = getElementValue(profileElem, CONF + "SignerCertsLocation", null);
- URI signerCertsLocURI = null;
- if (signerCertsLocStr != null && !"".equals(signerCertsLocStr))
- {
- try
- {
- signerCertsLocURI = new URI(signerCertsLocStr);
- if (!signerCertsLocURI.isAbsolute()) signerCertsLocURI = new URI(configRoot_.toURL() + signerCertsLocStr);
-
- File signerCertsDir = new File(signerCertsLocURI.getPath());
- if (!signerCertsDir.exists() || !signerCertsDir.isDirectory()) {
- warn("config.27", new Object[] { "signerCertsUri", id });
- continue;
- }
- }
- catch (URIException e) {
- warn("config.14", new Object[] { "signerCertsUri", id, trustAnchorsLocStr }, e);
- continue;
- }
- catch (MalformedURLException e) {
- warn("config.15", new Object[] {id}, e);
- continue;
- }
- }
- signerCertsLocStr = (signerCertsLocURI != null) ? signerCertsLocURI.toString() : null;
-
-
- //check if TSL support is enabled
- Element eutslElem = (Element) XPathUtils.selectSingleNode(profileElem, CONF + "EUTSL");
- boolean tslEnabled = false;
- if (eutslElem != null) //EUTSL element found --> TSL enabled
- tslEnabled = true;
-
- //load TSL configuration
- String countries = getElementValue(profileElem, CONF + "EUTSL" + "/" + CONF + "CountrySelection", null);
- String allowedTspStatus = getElementValue(profileElem, CONF + "EUTSL" + "/" + CONF + "AllowedTSPStatus", null);
- String allowedTspServiceTypes = getElementValue(profileElem, CONF + "EUTSL" + "/" + CONF + "AllowedTSPServiceTypes", null);
-
-
- //create profile configuration
- TrustProfile profile = new TrustProfile(id, trustAnchorsLocURI.toString(), signerCertsLocStr,
- tslEnabled, countries, allowedTspStatus, allowedTspServiceTypes);
- trustProfiles.put(id, profile);
-
}
return trustProfiles;
}
-
+
/**
* Returns the location of the certificate store.
- *
+ *
* @return the location of the certificate store.
*/
- public String getCertStoreLocation()
- {
- String certStoreLocStr = getElementValue(getConfigElem(), CERTSTORE_LOCATION_XPATH, null);
+ public String getCertStoreLocation() {
+ final String certStoreLocStr = getElementValue(getConfigElem(), CERTSTORE_LOCATION_XPATH, null);
File certStoreLocFile;
-
- // No value specified in configuration file: Set it to a reasonable (absolute) default
- if (certStoreLocStr == null)
- return new File(configRoot_, "certstore").getAbsolutePath();
-
+
+ // No value specified in configuration file: Set it to a reasonable (absolute)
+ // default
+ if (certStoreLocStr == null) {
+ return new File(configRoot_, "certstore").getAbsolutePath();
+ }
+
// Make cert store location an absolute value
certStoreLocFile = new File(certStoreLocStr);
- if (!certStoreLocFile.isAbsolute())
- {
+ if (!certStoreLocFile.isAbsolute()) {
certStoreLocFile = new File(configRoot_, certStoreLocStr);
}
-
+
// Check if cert store location exists, eventually try to create it
- if (!certStoreLocFile.isDirectory())
- {
+ if (!certStoreLocFile.isDirectory()) {
boolean created = false;
- try
- {
+ try {
created = certStoreLocFile.mkdirs();
- }
- finally
- {
- if (!created)
- {
+ } finally {
+ if (!created) {
warn("config.32", new Object[] { certStoreLocFile.getAbsolutePath() });
}
}
}
-
+
return certStoreLocFile.getAbsolutePath();
}
@@ -1378,428 +1304,429 @@ public class ConfigurationPartsBuilder {
/**
* Parse a configuration XML file.
- *
+ *
* @param inputStream The stream from which to read the XML data.
* @return The DOM representation of the XML data.
* @throws ParserConfigurationException XML parser not configured properly.
- * @throws SAXException An error parsing the XML file.
- * @throws IOException An error reading the stream.
+ * @throws SAXException An error parsing the XML file.
+ * @throws IOException An error reading the stream.
*/
private static Element parseXml(InputStream inputStream)
- throws ParserConfigurationException, SAXException, IOException {
+ throws ParserConfigurationException, SAXException, IOException {
return DOMUtils
- .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null)
- .getDocumentElement();
+ .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null)
+ .getDocumentElement();
}
/**
* Return the value of an element located by an XPath.
- *
- * @param root The root element from which to evaluate the <code>xpath</code>.
+ *
+ * @param root The root element from which to evaluate the <code>xpath</code>.
* @param xpath The XPath pointing to the element.
- * @param def The default value, if no element can be found with the given
- * <code>xpath</code>.
+ * @param def The default value, if no element can be found with the given
+ * <code>xpath</code>.
* @return The element value or <code>def</code>, if the element cannot be
- * found.
+ * found.
*/
private String getElementValue(Element root, String xpath, String def) {
- Element elem = (Element) XPathUtils.selectSingleNode(root, xpath);
+ final Element elem = (Element) XPathUtils.selectSingleNode(root, xpath);
return elem != null ? DOMUtils.getText(elem) : def;
}
/**
* Return the value of an attribute located by an XPath.
- *
- * @param root The root element from which to evaluate the <code>xpath</code>.
+ *
+ * @param root The root element from which to evaluate the <code>xpath</code>.
* @param xpath The XPath pointing to the attribute.
- * @param def The default value, if no attribute can be found with the given
- * <code>xpath</code>.
+ * @param def The default value, if no attribute can be found with the given
+ * <code>xpath</code>.
* @return The element value or <code>def</code>, if the attribute cannot be
- * found.
+ * found.
*/
private String getAttributeValue(Element root, String xpath, String def) {
- Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath);
+ final Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath);
return attr != null ? attr.getValue() : def;
}
/**
* Log an info message.
- *
- * @param messageId The message ID.
+ *
+ * @param messageId The message ID.
* @param parameters Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private static void info(String messageId, Object[] parameters) {
- MessageProvider msg = MessageProvider.getInstance();
+ final MessageProvider msg = MessageProvider.getInstance();
Logger.info(new LogMsg(msg.getMessage(messageId, parameters)));
}
/**
* Log a warning.
- *
+ *
* @param messageId The message ID.
- * @param args Additional parameters for the message.
+ * @param args Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private void warn(String messageId, Object[] args) {
- MessageProvider msg = MessageProvider.getInstance();
- String txt = msg.getMessage(messageId, args);
+ final MessageProvider msg = MessageProvider.getInstance();
+ final String txt = msg.getMessage(messageId, args);
Logger.warn(new LogMsg(txt));
warnings.add(txt);
}
-
+
/**
* Log a warning.
- *
+ *
* @param messageId The message ID.
- * @param args Additional parameters for the message.
+ * @param args Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private void debug(String messageId, Object[] args) {
- MessageProvider msg = MessageProvider.getInstance();
- String txt = msg.getMessage(messageId, args);
+ final MessageProvider msg = MessageProvider.getInstance();
+ final String txt = msg.getMessage(messageId, args);
Logger.debug(new LogMsg(txt));
-
+
}
-
/**
* Log a debug message.
- *
+ *
* @param messageId The message ID.
- * @param args Additional parameters for the message.
+ * @param args Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private void debug(String message) {
Logger.debug(new LogMsg(message));
}
-
+
/**
* Log a warning.
- *
+ *
* @param messageId The message ID.
- * @param args Additional parameters for the message.
- * @param t An exception being the cause of the warning.
+ * @param args Additional parameters for the message.
+ * @param t An exception being the cause of the warning.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private void warn(String messageId, Object[] args, Throwable t) {
- MessageProvider msg = MessageProvider.getInstance();
- String txt = msg.getMessage(messageId, args);
+ final MessageProvider msg = MessageProvider.getInstance();
+ final String txt = msg.getMessage(messageId, args);
- Logger.warn(new LogMsg(txt), t);
+ Logger.warn(new LogMsg(txt), t);
warnings.add(txt);
}
/**
* Log an error.
- *
+ *
* @param messageId The message ID.
- * @param args Additional parameters for the message.
+ * @param args Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private void error(String messageId, Object[] args) {
- MessageProvider msg = MessageProvider.getInstance();
- String txt = msg.getMessage(messageId, args);
+ final MessageProvider msg = MessageProvider.getInstance();
+ final String txt = msg.getMessage(messageId, args);
Logger.error(new LogMsg(txt));
warnings.add(txt);
}
-
+
/**
* Log an error.
- *
+ *
* @param messageId The message ID.
- * @param args Additional parameters for the message.
- * @param t An exception being the cause of the warning.
+ * @param args Additional parameters for the message.
+ * @param t An exception being the cause of the warning.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private void error(String messageId, Object[] args, Throwable t) {
- MessageProvider msg = MessageProvider.getInstance();
- String txt = msg.getMessage(messageId, args);
+ final MessageProvider msg = MessageProvider.getInstance();
+ final String txt = msg.getMessage(messageId, args);
- Logger.error(new LogMsg(txt), t);
+ Logger.error(new LogMsg(txt), t);
warnings.add(txt);
}
-
+
/**
* Returns whether revocation information should be archived.
- *
+ *
* @return whether revocation information should be archived.
*/
- public boolean getEnableRevocationArchiving()
- {
- String enableArchiving = getElementValue(getConfigElem(), ENABLE_ARCHIVING_XPATH, null);
+ public boolean getEnableRevocationArchiving() {
+ final String enableArchiving = getElementValue(getConfigElem(), ENABLE_ARCHIVING_XPATH, null);
return Boolean.valueOf(enableArchiving).booleanValue();
}
/**
* Returns the JDBC URL for the revocation archive database.
- *
- * @return the JDBC URL for the revocation archive database, or <code>null</code, if the corresponding
- * parameter is not set in the configuration.
+ *
+ * @return the JDBC URL for the revocation archive database, or
+ * <code>null</code, if the corresponding parameter is not set in the
+ * configuration.
*/
- public String getRevocationArchiveJDBCURL()
- {
- String jDBCURL = getElementValue(getConfigElem(), ACHIVE_JDBC_URL_, null);
+ public String getRevocationArchiveJDBCURL() {
+ final String jDBCURL = getElementValue(getConfigElem(), ACHIVE_JDBC_URL_, null);
return jDBCURL;
}
/**
* Returns the JDBC driver class name for the revocation archive database.
- *
- * @return the JDBC driver class name for the revocation archive database, or <code>null</code,
- * if the corresponding parameter is not set in the configuration.
+ *
+ * @return the JDBC driver class name for the revocation archive database, or
+ * <code>null</code, if the corresponding parameter is not set in the
+ * configuration.
*/
- public String getRevocationArchiveJDBCDriverClass()
- {
- String jDBCDriverClass = getElementValue(getConfigElem(), ACHIVE_JDBC_DRIVER_CLASS_, null);
+ public String getRevocationArchiveJDBCDriverClass() {
+ final String jDBCDriverClass = getElementValue(getConfigElem(), ACHIVE_JDBC_DRIVER_CLASS_, null);
return jDBCDriverClass;
}
/**
* Returns whether revocation information should be archived.
*/
- public boolean getEnableRevocationChecking()
- {
- String enableChecking = getElementValue(getConfigElem(), ENABLE_REVOCATION_CHECKING_XPATH_, null);
+ public boolean getEnableRevocationChecking() {
+ final String enableChecking = getElementValue(getConfigElem(), ENABLE_REVOCATION_CHECKING_XPATH_, null);
return Boolean.valueOf(enableChecking).booleanValue();
}
/**
- * Returns the maximum age of a revocation information for considering it
- * still as valid.
- *
- * @return the maximum age of a revocation information for considering it
- * still as valid.
+ * Returns the maximum age of a revocation information for considering it still
+ * as valid.
+ *
+ * @return the maximum age of a revocation information for considering it still
+ * as valid.
*/
- public long getMaxRevocationAge()
- {
- String maxRevocationAge = getElementValue(getConfigElem(), MAX_REVOCATION_AGE_XPATH_, null);
- if (maxRevocationAge == null) return 0;
+ public long getMaxRevocationAge() {
+ final String maxRevocationAge = getElementValue(getConfigElem(), MAX_REVOCATION_AGE_XPATH_, null);
+ if (maxRevocationAge == null) {
+ return 0;
+ }
return Long.valueOf(maxRevocationAge).longValue();
}
/**
* Returns the service order for revocation checking.
- *
+ *
* @return the service order for revocation checking. Valid array entries are
- * {@link RevocationSourceTypes#OCSP} and {@link RevocationSourceTypes#CRL}.
- * An empty array will be returned if no service order is specified in the
- * configuration.
+ * {@link RevocationSourceTypes#OCSP} and
+ * {@link RevocationSourceTypes#CRL}. An empty array will be returned if
+ * no service order is specified in the configuration.
*/
- public String[] getServiceOrder()
- {
- ArrayList list = new ArrayList();
- NodeIterator serviceIter = XPathUtils.selectNodeIterator(getConfigElem(), REVOCATION_SERVICEORDER_XPATH_);
+ public String[] getServiceOrder() {
+ final ArrayList list = new ArrayList();
+ final NodeIterator serviceIter = XPathUtils.selectNodeIterator(getConfigElem(),
+ REVOCATION_SERVICEORDER_XPATH_);
Element currentServiceNode;
- while ((currentServiceNode = (Element)serviceIter.nextNode()) != null)
- {
+ while ((currentServiceNode = (Element) serviceIter.nextNode()) != null) {
list.add(getElementValue(currentServiceNode, ".", null));
}
- Object[] serviceOrder = list.toArray();
- String[] returnValue = new String[serviceOrder.length];
- for (int i = 0; i < serviceOrder.length; i++)
- {
- if (((String)serviceOrder[i]).equalsIgnoreCase(RevocationSourceTypes.CRL)) {
+ final Object[] serviceOrder = list.toArray();
+ final String[] returnValue = new String[serviceOrder.length];
+ for (int i = 0; i < serviceOrder.length; i++) {
+ if (((String) serviceOrder[i]).equalsIgnoreCase(RevocationSourceTypes.CRL)) {
returnValue[i] = RevocationSourceTypes.CRL;
- } else if (((String)serviceOrder[i]).equalsIgnoreCase(RevocationSourceTypes.OCSP)) {
+ } else if (((String) serviceOrder[i]).equalsIgnoreCase(RevocationSourceTypes.OCSP)) {
returnValue[i] = RevocationSourceTypes.OCSP;
}
-
+
}
return returnValue;
}
/**
- * Returns whether the certificate extension Authority Info Access should
- * be used during certificate path construction.
- *
- * @return whether the certificate extension Authority Info Access should
- * be used during certificate path construction.
+ * Returns whether the certificate extension Authority Info Access should be
+ * used during certificate path construction.
+ *
+ * @return whether the certificate extension Authority Info Access should be
+ * used during certificate path construction.
*/
- public boolean getUseAuthorityInfoAccess()
- {
- String useAIA = getElementValue(getConfigElem(), USE_AUTHORITY_INFO_ACCESS_XPATH_, null);
+ public boolean getUseAuthorityInfoAccess() {
+ final String useAIA = getElementValue(getConfigElem(), USE_AUTHORITY_INFO_ACCESS_XPATH_, null);
return Boolean.valueOf(useAIA).booleanValue();
}
/**
- * Returns whether certificates found during certificate path construction
+ * Returns whether certificates found during certificate path construction
* should be added to the certificate store.
- *
- * @return whether certificates found during certificate path construction
+ *
+ * @return whether certificates found during certificate path construction
* should be added to the certificate store.
*/
- public boolean getAutoAddCertificates()
- {
- String autoAdd = getElementValue(getConfigElem(), AUTO_ADD_CERTIFICATES_XPATH_, null);
+ public boolean getAutoAddCertificates() {
+ final String autoAdd = getElementValue(getConfigElem(), AUTO_ADD_CERTIFICATES_XPATH_, null);
return Boolean.valueOf(autoAdd).booleanValue();
}
-
+
+ public boolean getAutoEEAddCertificates() {
+ final String autoAdd = getElementValue(getConfigElem(), AUTO_ADD_EE_CERTIFICATES_XPATH_, null);
+ if (autoAdd != null) {
+ return Boolean.valueOf(autoAdd).booleanValue();
+ } else {
+ return false;
+ }
+
+ }
+
/**
- * Returns whether file URIs are permitted
+ * Returns whether file URIs are permitted
+ *
* @return whether file URIs are permitted
*/
- public boolean getPermitFileURIs()
- {
- String permitFileURIs = getElementValue(getConfigElem(), PERMIT_FILE_URIS_XPATH, "false");
+ public boolean getPermitFileURIs() {
+ final String permitFileURIs = getElementValue(getConfigElem(), PERMIT_FILE_URIS_XPATH, "false");
return Boolean.valueOf(permitFileURIs).booleanValue();
}
-
+
/**
* Returns the TSL configuration from the config file
+ *
* @return
*/
public TSLConfiguration getTSLConfiguration() {
- TSLConfigurationImpl tslconfiguration = new TSLConfigurationImpl();
-
-
- String euTSLUrl = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF + "EUTSLUrl", null);
- if (StringUtils.isEmpty(euTSLUrl)) {
- euTSLUrl = TSLConfiguration.DEFAULT_EU_TSL_URL;
- debug("config.39", new Object[] { "EUTSL", euTSLUrl });
- }
-
- String updateSchedulePeriod = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF + "UpdateSchedule/" + CONF + "Period" , null);
-
- if (StringUtils.isEmpty(updateSchedulePeriod)) {
- updateSchedulePeriod = TSLConfiguration.DEFAULT_UPDATE_SCHEDULE_PERIOD;
- debug("config.39", new Object[] { "UpdateSchedule/Period", updateSchedulePeriod });
- }
-
- String updateScheduleStartTime = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF + "UpdateSchedule/" + CONF + "StartTime", null);
- if (StringUtils.isEmpty(updateScheduleStartTime)) {
- updateScheduleStartTime = TSLConfiguration.DEFAULT_UPDATE_SCHEDULE_STARTTIME;
- debug("config.39", new Object[] { "UpdateSchedule/StartTime", updateScheduleStartTime });
-
- }
-
- String workingDirectoryStr = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF + "WorkingDirectory", null);
- if (StringUtils.isEmpty(workingDirectoryStr)) {
- workingDirectoryStr = TSLConfiguration.DEFAULT_WORKING_DIR;
- debug("config.39", new Object[] { "WorkingDirectory", workingDirectoryStr });
- }
-
- String qcQualifier = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF + "Evaluation/" + CONF + "QCQualifier", null);
- if (MiscUtil.isEmpty(qcQualifier))
- info("config.39", new Object[] { "Evaluation/QCQualifier", " EMPTY" });
-
- else {
- String[] qcQualList = qcQualifier.split(",");
- for (String el : qcQualList) {
- try {
- tslconfiguration.addQualifierForQC(new java.net.URI(el.trim()));
- //info("config.39", new Object[] { "Evaluation/QCQualifier", el.trim() });
-
- } catch (URISyntaxException e) {
- warn("config.39", new Object[] { "Evaluation/QCQualifier", el.trim() }, e);
-
- }
-
- }
- }
-
- String sscdQualifier = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF + "Evaluation/" + CONF + "SSCDQualifier", null);
- if (MiscUtil.isEmpty(qcQualifier))
- info("config.39", new Object[] { "Evaluation/SSCDQualifier", " EMPTY" });
-
- else {
- String[] sscdQualList = sscdQualifier.split(",");
- for (String el : sscdQualList) {
- try {
- tslconfiguration.addQualifierForSSCD(new java.net.URI(el.trim()));
- //info("config.39", new Object[] { "Evaluation/SSCDQualifier", el.trim() });
-
- } catch (URISyntaxException e) {
- warn("config.39", new Object[] { "Evaluation/SSCDQualifier", el.trim() }, e);
-
- }
-
- }
- }
-
- // convert update schedule starting time to Date object
- Calendar Cal = DatatypeConverter.parseDateTime(updateScheduleStartTime);
- Date updateScheduleStartTimeDate = Cal.getTime();
-
- // convert working directory
- URI workingDirectoryURI = null;
- try
- {
- workingDirectoryURI = new URI(workingDirectoryStr);
- if (!workingDirectoryURI.isAbsolute()) { // make it absolute to the config file
- workingDirectoryURI = new URI(configRoot_.toURL() + workingDirectoryStr);
+ final TSLConfigurationImpl tslconfiguration = new TSLConfigurationImpl();
+
+ String euTSLUrl = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF + "EUTSLUrl", null);
+ if (StringUtils.isEmpty(euTSLUrl)) {
+ euTSLUrl = TSLConfiguration.DEFAULT_EU_TSL_URL;
+ debug("config.39", new Object[] { "EUTSL", euTSLUrl });
+ }
+
+ String updateSchedulePeriod = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF
+ + "UpdateSchedule/" + CONF + "Period", null);
+
+ if (StringUtils.isEmpty(updateSchedulePeriod)) {
+ updateSchedulePeriod = TSLConfiguration.DEFAULT_UPDATE_SCHEDULE_PERIOD;
+ debug("config.39", new Object[] { "UpdateSchedule/Period", updateSchedulePeriod });
+ }
+
+ String updateScheduleStartTime = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF
+ + "UpdateSchedule/" + CONF + "StartTime", null);
+ if (StringUtils.isEmpty(updateScheduleStartTime)) {
+ updateScheduleStartTime = TSLConfiguration.DEFAULT_UPDATE_SCHEDULE_STARTTIME;
+ debug("config.39", new Object[] { "UpdateSchedule/StartTime", updateScheduleStartTime });
+
+ }
+
+ String workingDirectoryStr = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF
+ + "WorkingDirectory", null);
+ if (StringUtils.isEmpty(workingDirectoryStr)) {
+ workingDirectoryStr = TSLConfiguration.DEFAULT_WORKING_DIR;
+ debug("config.39", new Object[] { "WorkingDirectory", workingDirectoryStr });
+ }
+
+ final String qcQualifier = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF + "Evaluation/"
+ + CONF + "QCQualifier", null);
+ if (MiscUtil.isEmpty(qcQualifier)) {
+ info("config.39", new Object[] { "Evaluation/QCQualifier", " EMPTY" });
+ } else {
+ final String[] qcQualList = qcQualifier.split(",");
+ for (final String el : qcQualList) {
+ try {
+ tslconfiguration.addQualifierForQC(new java.net.URI(el.trim()));
+ // info("config.39", new Object[] { "Evaluation/QCQualifier", el.trim() });
+
+ } catch (final URISyntaxException e) {
+ warn("config.39", new Object[] { "Evaluation/QCQualifier", el.trim() }, e);
+
}
+
}
- catch (URIException e) {
- warn("config.37", new Object[] { workingDirectoryStr }, e);
- workingDirectoryStr = TSLConfiguration.DEFAULT_WORKING_DIR;
- warn("config.39", new Object[] { "WorkingDirectory", workingDirectoryStr });
- }
- catch (MalformedURLException e)
- {
- warn("config.37", new Object[] { workingDirectoryStr }, e);
- workingDirectoryStr = TSLConfiguration.DEFAULT_WORKING_DIR;
- warn("config.39", new Object[] { "WorkingDirectory", workingDirectoryStr });
- }
+ }
+
+ final String sscdQualifier = getElementValue(getConfigElem(), TSL_CONFIGURATION_XPATH + CONF
+ + "Evaluation/" + CONF + "SSCDQualifier", null);
+ if (MiscUtil.isEmpty(qcQualifier)) {
+ info("config.39", new Object[] { "Evaluation/SSCDQualifier", " EMPTY" });
+ } else {
+ final String[] sscdQualList = sscdQualifier.split(",");
+ for (final String el : sscdQualList) {
+ try {
+ tslconfiguration.addQualifierForSSCD(new java.net.URI(el.trim()));
+ // info("config.39", new Object[] { "Evaluation/SSCDQualifier", el.trim() });
+
+ } catch (final URISyntaxException e) {
+ warn("config.39", new Object[] { "Evaluation/SSCDQualifier", el.trim() }, e);
+
+ }
- File tslWorkingDir = new File(workingDirectoryURI.getPath());
- if (!tslWorkingDir.exists()) {
- tslWorkingDir.mkdir();
}
- if (!tslWorkingDir.isDirectory()) {
- error("config.38", new Object[] { workingDirectoryStr });
- return null;
+ }
+
+ // convert update schedule starting time to Date object
+ final Calendar Cal = DatatypeConverter.parseDateTime(updateScheduleStartTime);
+ final Date updateScheduleStartTimeDate = Cal.getTime();
+
+ // convert working directory
+ URI workingDirectoryURI = null;
+ try {
+ workingDirectoryURI = new URI(workingDirectoryStr);
+ if (!workingDirectoryURI.isAbsolute()) { // make it absolute to the config file
+ workingDirectoryURI = new URI(configRoot_.toURL() + workingDirectoryStr);
}
-
-
- debug("TSL Konfiguration - EUTSLUrl: " + euTSLUrl);
- debug("TSL Konfiguration - UpdateSchedule/Period: " + updateSchedulePeriod);
- debug("TSL Konfiguration - UpdateSchedule/StartTime: " + updateScheduleStartTime);
- debug("TSL Konfiguration - TSLWorkingDirectory: " + tslWorkingDir.getAbsolutePath());
-
-
- // set TSL configuration
- tslconfiguration.setEuTSLUrl(euTSLUrl);
- tslconfiguration.setUpdateSchedulePeriod(Long.valueOf(updateSchedulePeriod).longValue());
- tslconfiguration.setUpdateScheduleStartTime(updateScheduleStartTimeDate);
- tslconfiguration.setWorkingDirectory(tslWorkingDir.getAbsolutePath());
- tslconfiguration.setWorkingDirectoryURI(workingDirectoryURI);
-
- return tslconfiguration;
+ } catch (final URIException e) {
+ warn("config.37", new Object[] { workingDirectoryStr }, e);
+ workingDirectoryStr = TSLConfiguration.DEFAULT_WORKING_DIR;
+ warn("config.39", new Object[] { "WorkingDirectory", workingDirectoryStr });
+ } catch (final MalformedURLException e) {
+ warn("config.37", new Object[] { workingDirectoryStr }, e);
+ workingDirectoryStr = TSLConfiguration.DEFAULT_WORKING_DIR;
+ warn("config.39", new Object[] { "WorkingDirectory", workingDirectoryStr });
+ }
+
+ final File tslWorkingDir = new File(workingDirectoryURI.getPath());
+ if (!tslWorkingDir.exists()) {
+ tslWorkingDir.mkdir();
+ }
+ if (!tslWorkingDir.isDirectory()) {
+ error("config.38", new Object[] { workingDirectoryStr });
+ return null;
+ }
+
+ debug("TSL Konfiguration - EUTSLUrl: " + euTSLUrl);
+ debug("TSL Konfiguration - UpdateSchedule/Period: " + updateSchedulePeriod);
+ debug("TSL Konfiguration - UpdateSchedule/StartTime: " + updateScheduleStartTime);
+ debug("TSL Konfiguration - TSLWorkingDirectory: " + tslWorkingDir.getAbsolutePath());
+
+ // set TSL configuration
+ tslconfiguration.setEuTSLUrl(euTSLUrl);
+ tslconfiguration.setUpdateSchedulePeriod(Long.valueOf(updateSchedulePeriod).longValue());
+ tslconfiguration.setUpdateScheduleStartTime(updateScheduleStartTimeDate);
+ tslconfiguration.setWorkingDirectory(tslWorkingDir.getAbsolutePath());
+ tslconfiguration.setWorkingDirectoryURI(workingDirectoryURI);
+
+ return tslconfiguration;
}
-
+
/**
* Returns a map of CRL retention intervals
+ *
* @return
*/
public Map getCrlRetentionIntervals() {
- Map map = new HashMap();
- NodeIterator modIter = XPathUtils.selectNodeIterator(
- getConfigElem(),
- CRL_RETENTION_INTERVALS_CA_XPATH);
-
- Element modElem;
- while ((modElem = (Element) modIter.nextNode()) != null) {
- String x509IssuerName = getElementValue(modElem, CONF + "X509IssuerName", null);
- String i = getElementValue(modElem, CONF + "Interval", null);
- Integer interval = new Integer(i);
- try {
- RFC2253NameParser parser = new RFC2253NameParser(x509IssuerName);
- Name name = parser.parse();
- map.put(name.getRFC2253String(), interval);
- } catch (RFC2253NameParserException e) {
- map.put(x509IssuerName, interval);
- }
+ final Map map = new HashMap();
+ final NodeIterator modIter = XPathUtils.selectNodeIterator(
+ getConfigElem(),
+ CRL_RETENTION_INTERVALS_CA_XPATH);
- }
+ Element modElem;
+ while ((modElem = (Element) modIter.nextNode()) != null) {
+ final String x509IssuerName = getElementValue(modElem, CONF + "X509IssuerName", null);
+ final String i = getElementValue(modElem, CONF + "Interval", null);
+ final Integer interval = new Integer(i);
+ try {
+ final RFC2253NameParser parser = new RFC2253NameParser(x509IssuerName);
+ final Name name = parser.parse();
+ map.put(name.getRFC2253String(), interval);
+ } catch (final RFC2253NameParserException e) {
+ map.put(x509IssuerName, interval);
+ }
- return map;
+ }
+
+ return map;
}
-
-
+
}
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 7ae83cb..bffa489 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
@@ -21,14 +21,8 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
-import iaik.asn1.structures.Name;
-import iaik.pki.revocation.RevocationSourceTypes;
-import iaik.utils.RFC2253NameParser;
-import iaik.utils.RFC2253NameParserException;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -41,7 +35,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
import org.w3c.dom.Element;
@@ -52,39 +45,45 @@ import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
import at.gv.egovernment.moaspss.util.DOMUtils;
import at.gv.egovernment.moaspss.util.MiscUtil;
+import iaik.asn1.structures.Name;
+import iaik.pki.revocation.RevocationSourceTypes;
+import iaik.utils.RFC2253NameParser;
+import iaik.utils.RFC2253NameParserException;
/**
* A class providing access to the MOA configuration data.
- *
- * <p>Configuration data is read from an XML file, whose location is given by
- * the <code>moa.spss.server.configuration</code> system property.</p>
- * <p>This class implements the Singleton pattern. The <code>reload()</code>
- * method can be used to update the configuration data. Therefore, it is not
- * guaranteed that consecutive calls to <code>getInstance()</code> will return
- * the same <code>ConfigurationProvider</code> all the time. During the
- * processing of a web service request, the current
- * <code>TransactionContext</code> should be used to obtain the
- * <code>ConfigurationProvider</code> local to that request.</p>
- *
+ *
+ * <p>
+ * Configuration data is read from an XML file, whose location is given by the
+ * <code>moa.spss.server.configuration</code> system property.
+ * </p>
+ * <p>
+ * This class implements the Singleton pattern. The <code>reload()</code> method
+ * can be used to update the configuration data. Therefore, it is not guaranteed
+ * that consecutive calls to <code>getInstance()</code> will return the same
+ * <code>ConfigurationProvider</code> all the time. During the processing of a
+ * web service request, the current <code>TransactionContext</code> should be
+ * used to obtain the <code>ConfigurationProvider</code> local to that request.
+ * </p>
+ *
* @author Patrick Peck
* @author Sven Aigner
* @version $Id$
*/
-public class ConfigurationProvider
-{
- /**
- * The name of the system property which contains the file name of the
+public class ConfigurationProvider {
+ /**
+ * The name of the system property which contains the file name of the
* configuration file.
*/
public static final String CONFIG_PROPERTY_NAME =
- "moa.spss.server.configuration";
+ "moa.spss.server.configuration";
- /**
+ /**
* A fake <code>IssuerAndSerial</code> object for storing KeyGroup information
* accessible by all clients.
*/
private static final IssuerAndSerial ANONYMOUS_ISSUER_SERIAL =
- new IssuerAndSerial(new Name(), new BigInteger("0"));
+ new IssuerAndSerial(new Name(), new BigInteger("0"));
/** Singleton instance. <code>null</code>, if none has been created. */
private static ConfigurationProvider instance;
@@ -101,23 +100,23 @@ public class ConfigurationProvider
/** The default canonicalization algorithm name */
private String canonicalizationAlgorithmName;
-
+
/** The XAdES version used for signature creation */
private String xadesVersion;
-
+
/** PDF AS Configuration */
private String pdfAsConfiguration;
-
+
private int connectionTimeout;
private int readTimeout;
-
- /**
- * A <code>List</code> of <code>HardwareCryptoModule</code> objects for
+
+ /**
+ * A <code>List</code> of <code>HardwareCryptoModule</code> objects for
* configuring hardware modules.
*/
private List hardwareCryptoModules;
- /**
+ /**
* A <code>List</code> of <code>HardwareKey</code> objects containing the
* configuration data for hardware keys.
*/
@@ -144,29 +143,29 @@ public class ConfigurationProvider
/** The default chaining mode. */
private String defaultChainingMode;
- /**
+ /**
* A <code>Map</code> which contains the <code>IssuerAndSerial</code> to
* chaining mode (a <code>String</code>) mapping.
*/
private Map chainingModes;
/**
- * A <code>Map</code> which contains the CAIssuerDN (a <code>String</code>)
- * to distribution points (a <code>Set</code> of
- * <code>DistributionPoint</code>s) mapping.
+ * A <code>Map</code> which contains the CAIssuerDN (a <code>String</code>) to
+ * distribution points (a <code>Set</code> of <code>DistributionPoint</code>s)
+ * mapping.
*/
private Map distributionPoints;
- /**
- * The CRL archive duration.
+ /**
+ * The CRL archive duration.
*/
private int cRLArchiveDuration;
-
+
/**
* Indicates whether revocation information should be archived.
*/
private boolean enableRevocationArchiving_;
-
+
/**
* The location of the certificate store.
*/
@@ -180,29 +179,29 @@ public class ConfigurationProvider
private Map createSignatureEnvironmentProfiles;
/**
- * A <code>Map</code> which contains a mapping from
- * CreateTransformsInfoProfile Ids (<code>String</code>) to
- * CreateTransformsInfoProfile elements (an <code>Element</code>).
+ * A <code>Map</code> which contains a mapping from CreateTransformsInfoProfile
+ * Ids (<code>String</code>) to CreateTransformsInfoProfile elements (an
+ * <code>Element</code>).
*/
private Map createTransformsInfoProfiles;
/**
- * A <code>Map</code> which contains a mapping from
- * VerifyTransformsInfoProfile Ids (<code>String</code>) to
- * VerifyTransformsInfoProfile elements (an <code>Element</code>).
+ * A <code>Map</code> which contains a mapping from VerifyTransformsInfoProfile
+ * Ids (<code>String</code>) to VerifyTransformsInfoProfile elements (an
+ * <code>Element</code>).
*/
private Map verifyTransformsInfoProfiles;
/**
- * A <code>Map</code> which contains a mapping from
- * SupplementProfile Ids (<code>String</code>) to SupplementProfile elements
- * (an <code>Element</code>).
+ * A <code>Map</code> which contains a mapping from SupplementProfile Ids
+ * (<code>String</code>) to SupplementProfile elements (an
+ * <code>Element</code>).
*/
private Map supplementProfiles;
/**
- * A <code>Map</code> which contains a TrustProfile Id (a <code>String</code>
- * to trust profile (a <code>TrustProfile</code>) mapping.
+ * A <code>Map</code> which contains a TrustProfile Id (a <code>String</code> to
+ * trust profile (a <code>TrustProfile</code>) mapping.
*/
private Map trustProfiles;
@@ -222,7 +221,8 @@ public class ConfigurationProvider
private boolean enableRevocationChecking_;
/**
- * The maximum age of a revocation information for considering it still as valid.
+ * The maximum age of a revocation information for considering it still as
+ * valid.
*/
private long maxRevocationAge_;
@@ -232,57 +232,58 @@ public class ConfigurationProvider
private String[] serviceOrder_;
private boolean adesFormResults;
-
+
/**
- * Indicates whether certificates found during certificate path construction
+ * Indicates whether certificates found during certificate path construction
* should be added to the certificate store.
*/
private boolean autoAddCertificates_;
+ private boolean autoAddEECertificates_;
+
/**
- * Indicates whether the certificate extension Authority Info Access should
- * be used during certificate path construction.
+ * Indicates whether the certificate extension Authority Info Access should be
+ * used during certificate path construction.
*/
private boolean useAuthorityInfoAccess_;
/**
- * Indicates whether file URIs are allowed or not
+ * Indicates whether file URIs are allowed or not
*/
private boolean permitFileURIs;
-
+
/**
* Indicates the CRL retention intervals
*/
private Map crlRetentionIntervals;
-
+
/**
* Indicates wether external URIs are allowed or not
*/
private boolean allowExternalUris_;
-
+
/**
* A <code>List</code> of black listed URIs (host and port)
*/
private List blackListedUris_;
-
+
/**
* A <code>List</code> of white listed URIs (host and port)
*/
private List whiteListedUris_;
-
+
/**
* A <code>TSLConfiguration</code> that represents the global TSL configuration
*/
private TSLConfiguration tslconfiguration_;
-
-
+
/**
* Return the single instance of configuration data.
- *
+ *
* @return MOAConfigurationProvider The current configuration data.
* @throws ConfigurationException Failure to load the configuration data.
*/
public static synchronized ConfigurationProvider getInstance()
- throws ConfigurationException {
+ throws ConfigurationException {
if (instance == null) {
reload();
@@ -292,21 +293,21 @@ public class ConfigurationProvider
/**
* Reload the configuration data and set it if successful.
- *
+ *
* @return MOAConfigurationProvider The loaded configuration data.
* @throws ConfigurationException Failure to load the configuration data.
*/
public static synchronized ConfigurationProvider reload()
- throws ConfigurationException {
+ throws ConfigurationException {
String fileName = System.getProperty(CONFIG_PROPERTY_NAME);
if (fileName == null) {
// find out where we are running and use the configuration provided
// under WEB-INF/conf/moa-spss/MOA-SPSSConfiguration
- URL url = ConfigurationProvider.class.getResource("/");
+ final URL url = ConfigurationProvider.class.getResource("/");
fileName =
- new File(url.getPath()).getParent()
- + "/conf/moa-spss/MOA-SPSSConfiguration.xml";
+ new File(url.getPath()).getParent()
+ + "/conf/moa-spss/MOA-SPSSConfiguration.xml";
info("config.05", new Object[] { CONFIG_PROPERTY_NAME });
}
@@ -316,7 +317,7 @@ public class ConfigurationProvider
/**
* Constructor for ConfigurationProvider.
- *
+ *
* @param fileName The name of the configuration file.
* @throws ConfigurationException An error occurred loading the configuration.
*/
@@ -325,12 +326,11 @@ public class ConfigurationProvider
}
/**
- * Load the configuration data from XML file with the given name and build
- * the internal data structures representing the MOA configuration.
- *
+ * Load the configuration data from XML file with the given name and build the
+ * internal data structures representing the MOA configuration.
+ *
* @param fileName The name of the XML file to load.
- * @throws ConfigurationException The MOA configuration could not be
- * read/built.
+ * @throws ConfigurationException The MOA configuration could not be read/built.
*/
private void load(String fileName) throws ConfigurationException {
FileInputStream stream = null;
@@ -339,16 +339,15 @@ public class ConfigurationProvider
Element configElem;
ConfigurationPartsBuilder builder;
List allKeyModules;
-
// load the main config file
try {
configFile = new File(fileName);
configRoot = new File(configFile.getParent());
- info("config.21", new Object[] { configFile.getAbsoluteFile()});
+ info("config.21", new Object[] { configFile.getAbsoluteFile() });
stream = new FileInputStream(fileName);
configElem = DOMUtils.parseXmlValidating(new FileInputStream(fileName));
- } catch (Throwable t) {
+ } catch (final Throwable t) {
throw new ConfigurationException("config.10", null, t);
}
@@ -356,29 +355,27 @@ public class ConfigurationProvider
try {
builder = new ConfigurationPartsBuilder(configElem, configRoot);
- //build TSL configuration
+ // build TSL configuration
tslconfiguration_ = builder.getTSLConfiguration();
-
- //build TrustProfile configuration
- trustProfiles = builder.buildTrustProfiles();
-
- //check TSL configuration
+
+ // build TrustProfile configuration
+ trustProfiles = builder.buildTrustProfiles();
+
+ // check TSL configuration
checkTSLConfiguration();
-
-
+
digestMethodAlgorithmName = builder.getDigestMethodAlgorithmName();
canonicalizationAlgorithmName =
- builder.getCanonicalizationAlgorithmName();
+ builder.getCanonicalizationAlgorithmName();
hardwareCryptoModules = builder.buildHardwareCryptoModules();
hardwareKeyModules =
- builder.buildHardwareKeyModules(Collections.EMPTY_LIST);
+ builder.buildHardwareKeyModules(Collections.EMPTY_LIST);
softwareKeyModules =
- builder.buildSoftwareKeyModules(hardwareKeyModules);
+ builder.buildSoftwareKeyModules(hardwareKeyModules);
allKeyModules = new ArrayList(hardwareKeyModules);
allKeyModules.addAll(softwareKeyModules);
keyGroups = builder.buildKeyGroups(allKeyModules);
- keyGroupMappings =
- builder.buildKeyGroupMappings(keyGroups, ANONYMOUS_ISSUER_SERIAL);
+ builder.buildKeyGroupMappings(keyGroups, ANONYMOUS_ISSUER_SERIAL);
this.connectionTimeout = builder.getConnectionTimeout();
Logger.debug("Set 'Connection-Timeout' to " + String.valueOf(this.connectionTimeout) + "[ms]");
@@ -393,9 +390,10 @@ public class ConfigurationProvider
chainingModes = builder.buildChainingModes();
useAuthorityInfoAccess_ = builder.getUseAuthorityInfoAccess();
autoAddCertificates_ = builder.getAutoAddCertificates();
- //trustProfiles = builder.buildTrustProfiles(tslconfiguration_.getWorkingDirectory());
-
-
+ autoAddEECertificates_ = builder.getAutoEEAddCertificates();
+ // trustProfiles =
+ // builder.buildTrustProfiles(tslconfiguration_.getWorkingDirectory());
+
distributionPoints = builder.buildDistributionPoints();
enableRevocationChecking_ = builder.getEnableRevocationChecking();
maxRevocationAge_ = builder.getMaxRevocationAge();
@@ -404,12 +402,10 @@ public class ConfigurationProvider
cRLArchiveDuration = builder.getRevocationArchiveDuration();
revocationArchiveJDBCURL_ = builder.getRevocationArchiveJDBCURL();
revocationArchiveJDBCDriverClass_ = builder.getRevocationArchiveJDBCDriverClass();
-
-
- //TODO!!!!
+
+ // TODO!!!!
certStoreLocation_ = builder.getCertStoreLocation();
-
-
+
createTransformsInfoProfiles = builder.buildCreateTransformsInfoProfiles();
createSignatureEnvironmentProfiles = builder.buildCreateSignatureEnvironmentProfiles();
verifyTransformsInfoProfiles = builder.buildVerifyTransformsInfoProfiles();
@@ -418,41 +414,37 @@ public class ConfigurationProvider
permitFileURIs = builder.getPermitFileURIs();
crlRetentionIntervals = builder.getCrlRetentionIntervals();
- allowExternalUris_= builder.allowExternalUris();
-
- if (allowExternalUris_) {
- blackListedUris_ = builder.buildPermitExternalUris();
- whiteListedUris_ = null;
- }
- else {
- info("config.35", null);
- blackListedUris_ = null;
- whiteListedUris_ = builder.buildForbidExternalUris();
+ allowExternalUris_ = builder.allowExternalUris();
+
+ if (allowExternalUris_) {
+ blackListedUris_ = builder.buildPermitExternalUris();
+ whiteListedUris_ = null;
+ } else {
+ info("config.35", null);
+ blackListedUris_ = null;
+ whiteListedUris_ = builder.buildForbidExternalUris();
}
-
-
-
+
// Set set = crlRetentionIntervals.entrySet();
// Iterator i = set.iterator();
// while(i.hasNext()){
// Map.Entry me = (Map.Entry)i.next();
// System.out.println("Key: " + me.getKey() + " - Value: " + me.getValue() );
// }
-
-
- } catch (Throwable t) {
+
+ } catch (final Throwable t) {
throw new ConfigurationException("config.11", null, t);
} finally {
try {
if (stream != null) {
stream.close();
}
- } catch (IOException e) {
+ } catch (final IOException e) {
// don't complain about this
}
}
}
-
+
// private boolean checkTSLenableTrustprofilesExist()throws ConfigurationException {
// boolean bTSLEnabledTPExist = false;
// Iterator it = trustProfiles.entrySet().iterator();
@@ -462,78 +454,75 @@ public class ConfigurationProvider
// if (tp.isTSLEnabled())
// bTSLEnabledTPExist = bTSLEnabledTPExist || true;
// }
-//
+//
// return bTSLEnabledTPExist;
-//
+//
// }
-
- private void checkTSLConfiguration() throws ConfigurationException {
- boolean bTSLEnabledTPExist = false;
- Iterator it = trustProfiles.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry pairs = (Map.Entry)it.next();
- TrustProfile tp = (TrustProfile) pairs.getValue();
- if (tp.isTSLEnabled())
- bTSLEnabledTPExist = bTSLEnabledTPExist || true;
- }
-
- if (!bTSLEnabledTPExist) {
- // if no trustprofile has TSL support enabled, delete TSL configuration
- tslconfiguration_ = null;
- return;
- }
-
- if (bTSLEnabledTPExist && (tslconfiguration_ == null)) {
- error("config.40", null);
- throw new ConfigurationException("config.40", null);
- }
-
- File workingDir = new File(tslconfiguration_.getWorkingDirectory());
- File eu_trust = new File(workingDir.getAbsolutePath() + "/trust/eu");
- if (!eu_trust.exists()) {
- error("config.51", new Object[] {"Verzeichnis \"trust/eu\" existiert nicht"});
- throw new ConfigurationException("config.51", new Object[] {"Verzeichnis \"trust/eu\" existiert nicht"});
- }
- else {
- File[] eutrustFiles = eu_trust.listFiles();
- if (eutrustFiles == null) {
- error("config.51", new Object[] {"Verzeichnis \"trust/eu\" ist leer"});
- throw new ConfigurationException("config.51", new Object[] {"Verzeichnis \"trust/eu\" ist leer"});
- }
- else {
- if (eutrustFiles.length == 0) {
- error("config.51", new Object[] {"Verzeichnis \"trust/eu\" ist leer"});
- throw new ConfigurationException("config.51", new Object[] {"Verzeichnis \"trust/eu\" ist leer"});
- }
- }
-
- }
-
- File hashcache = new File(tslconfiguration_.getWorkingDirectory(), "hashcache");
- if (!hashcache.exists()) {
- hashcache.mkdir();
+
+ private void checkTSLConfiguration() throws ConfigurationException {
+ boolean bTSLEnabledTPExist = false;
+ final Iterator it = trustProfiles.entrySet().iterator();
+ while (it.hasNext()) {
+ final Map.Entry pairs = (Map.Entry) it.next();
+ final TrustProfile tp = (TrustProfile) pairs.getValue();
+ if (tp.isTSLEnabled()) {
+ bTSLEnabledTPExist = bTSLEnabledTPExist || true;
}
- if (!hashcache.isDirectory()) {
- error("config.38", new Object[] { hashcache.getAbsolutePath() });
- return;
+ }
+
+ if (!bTSLEnabledTPExist) {
+ // if no trustprofile has TSL support enabled, delete TSL configuration
+ tslconfiguration_ = null;
+ return;
+ }
+
+ if (bTSLEnabledTPExist && tslconfiguration_ == null) {
+ error("config.40", null);
+ throw new ConfigurationException("config.40", null);
+ }
+
+ final File workingDir = new File(tslconfiguration_.getWorkingDirectory());
+ final File eu_trust = new File(workingDir.getAbsolutePath() + "/trust/eu");
+ if (!eu_trust.exists()) {
+ error("config.51", new Object[] { "Verzeichnis \"trust/eu\" existiert nicht" });
+ throw new ConfigurationException("config.51", new Object[] {
+ "Verzeichnis \"trust/eu\" existiert nicht" });
+ } else {
+ final File[] eutrustFiles = eu_trust.listFiles();
+ if (eutrustFiles == null) {
+ error("config.51", new Object[] { "Verzeichnis \"trust/eu\" ist leer" });
+ throw new ConfigurationException("config.51", new Object[] { "Verzeichnis \"trust/eu\" ist leer" });
+ } else {
+ if (eutrustFiles.length == 0) {
+ error("config.51", new Object[] { "Verzeichnis \"trust/eu\" ist leer" });
+ throw new ConfigurationException("config.51", new Object[] { "Verzeichnis \"trust/eu\" ist leer" });
+ }
}
+ }
+
+ final File hashcache = new File(tslconfiguration_.getWorkingDirectory(), "hashcache");
+ if (!hashcache.exists()) {
+ hashcache.mkdir();
+ }
+ if (!hashcache.isDirectory()) {
+ error("config.38", new Object[] { hashcache.getAbsolutePath() });
+ return;
+ }
+
// System.setProperty("iaik.xml.crypto.tsl.BinaryHashCache.DIR", hashcache.getAbsolutePath());
// String hashcachedir = System.getProperty("iaik.xml.crypto.tsl.BinaryHashCache.DIR");
// System.out.println("Hashcache: " + hashcachedir);
+ Logger.debug("TSL Konfiguration - Hashcache: " + hashcache.getAbsolutePath());
- Logger.debug("TSL Konfiguration - Hashcache: " + hashcache.getAbsolutePath());
-
-
}
-
/**
* Returns the warnings encountered during building the configuration.
- *
- * @return A <code>List</code> of <code>String</code>s, containing the
- * warning messages.
+ *
+ * @return A <code>List</code> of <code>String</code>s, containing the warning
+ * messages.
*/
public List getWarnings() {
return warnings;
@@ -541,57 +530,58 @@ public class ConfigurationProvider
/**
* Return the name of the digest algorithm used during signature creation.
- *
- * @return The digest method algorithm name, or an empty <code>String</code>,
- * if none has been configured.
+ *
+ * @return The digest method algorithm name, or an empty <code>String</code>, if
+ * none has been configured.
*/
public String getDigestMethodAlgorithmName() {
return digestMethodAlgorithmName;
}
-
+
/**
* Return the XAdES version used for signature creation.
- *
- * @return The XAdES version used for signature creation, or an empty <code>String</code>,
- * if none has been configured.
+ *
+ * @return The XAdES version used for signature creation, or an empty
+ * <code>String</code>, if none has been configured.
*/
public String getXAdESVersion() {
return xadesVersion;
}
-
+
public String getPDFASConfiguration() {
- return pdfAsConfiguration;
+ return pdfAsConfiguration;
}
-
+
public int getConnectionTimeout() {
- return this.connectionTimeout;
+ return this.connectionTimeout;
}
-
+
public int getReadTimeout() {
- return this.readTimeout;
+ return this.readTimeout;
}
-
+
public boolean getAdesFormResults() {
- return this.adesFormResults;
+ return this.adesFormResults;
}
-
+
public boolean getAllowExternalUris() {
- return this.allowExternalUris_;
+ return this.allowExternalUris_;
}
-
+
public List getBlackListedUris() {
- return this.blackListedUris_;
+ return this.blackListedUris_;
}
+
public List getWhiteListedUris() {
- return this.whiteListedUris_;
+ return this.whiteListedUris_;
}
-
+
/**
* Return the name of the canonicalization algorithm used during signature
* creation.
- *
- * @return The canonicalization algorithm name, or an empty
- * <code>String</code> if none has been configured.
+ *
+ * @return The canonicalization algorithm name, or an empty <code>String</code>
+ * if none has been configured.
*/
public String getCanonicalizationAlgorithmName() {
return canonicalizationAlgorithmName;
@@ -599,9 +589,9 @@ public class ConfigurationProvider
/**
* Return the configured hardware crypto modules.
- *
+ *
* @return A <code>List</code> of <code>HardwareCryptoModule</code> objects
- * containing the hardware crypto module configurations.
+ * containing the hardware crypto module configurations.
*/
public List getHardwareCryptoModules() {
return hardwareCryptoModules;
@@ -609,9 +599,9 @@ public class ConfigurationProvider
/**
* Return the hardware key modules configuration.
- *
+ *
* @return A <code>List</code> of <code>HardwareKeyModule</code> objects
- * containing the configuration of the hardware key modules.
+ * containing the configuration of the hardware key modules.
*/
public List getHardwareKeyModules() {
return hardwareKeyModules;
@@ -619,9 +609,9 @@ public class ConfigurationProvider
/**
* Return the software key module configuration.
- *
+ *
* @return A <code>List</code> of <code>SoftwareKeyModule</code> objects
- * containing the configuration of the software key modules.
+ * containing the configuration of the software key modules.
*/
public List getSoftwareKeyModules() {
return softwareKeyModules;
@@ -629,38 +619,38 @@ public class ConfigurationProvider
/**
* Return the key group mapping.
- *
- * @return A mapping from key group ID (a <code>String</code>) to
- * <code>KeyGroup</code> mapping.
+ *
+ * @return A mapping from key group ID (a <code>String</code>) to
+ * <code>KeyGroup</code> mapping.
*/
public Map getKeyGroups() {
return keyGroups;
}
-
+
public KeyGroup getKeyGroup(String keyGroupId) {
- if (MiscUtil.isNotEmpty(keyGroupId))
- return (KeyGroup) keyGroups.get(keyGroupId.trim().toLowerCase());
-
- else
- return null;
+ if (MiscUtil.isNotEmpty(keyGroupId)) {
+ return (KeyGroup) keyGroups.get(keyGroupId.trim().toLowerCase());
+ } else {
+ return null;
+ }
}
/**
* Return the set of <code>KeyGroupEntry</code>s of a given key group, which a
* client (identified by an issuer/serial pair) may access.
- *
- * @param issuer The issuer of the client certificate.
- * @param serial The serial number of the client certificate.
+ *
+ * @param issuer The issuer of the client certificate.
+ * @param serial The serial number of the client certificate.
* @param keyGroupId The ID of the key group.
* @return A <code>Set</code> of all the <code>KeyGroupEntry</code>s in the
- * given key group, if the user may access them. Returns <code>null</code>, if
- * the user may not access the given key group or if the key group does not
- * exist.
+ * given key group, if the user may access them. Returns
+ * <code>null</code>, if the user may not access the given key group or
+ * if the key group does not exist.
*/
public Set getKeyGroupEntries(
- Principal issuer,
- BigInteger serial,
- String keyGroupId) {
+ Principal issuer,
+ BigInteger serial,
+ String keyGroupId) {
IssuerAndSerial issuerAndSerial;
Map mapping;
@@ -673,118 +663,115 @@ public class ConfigurationProvider
// System.out.println("Issuer: " + issuer);
// System.out.println("serial: " + serial);
-//
+//
// Iterator entries = keyGroupMappings.entrySet().iterator();
// while (entries.hasNext()) {
// Entry thisEntry = (Entry) entries.next();
// System.out.println("Entry: " + thisEntry.getKey());
// System.out.println("Value: " + thisEntry.getValue());
// }
-
+
mapping = (Map) keyGroupMappings.get(issuerAndSerial);
if (mapping != null) {
- KeyGroup keyGroup = (KeyGroup) mapping.get(keyGroupId);
+ final KeyGroup keyGroup = (KeyGroup) mapping.get(keyGroupId);
if (keyGroup != null) {
return keyGroup.getKeyGroupEntries();
}
}
-
+
// If no key group is available for a client identified by a certificate,
// try to find a key group in the anonymous key group mapping
- if (issuer != null || serial != null)
- {
+ if (issuer != null || serial != null) {
mapping = (Map) keyGroupMappings.get(ANONYMOUS_ISSUER_SERIAL);
- if (mapping != null)
- {
- KeyGroup keyGroup = (KeyGroup) mapping.get(keyGroupId);
- if (keyGroup != null) return keyGroup.getKeyGroupEntries();
+ if (mapping != null) {
+ final KeyGroup keyGroup = (KeyGroup) mapping.get(keyGroupId);
+ if (keyGroup != null) {
+ return keyGroup.getKeyGroupEntries();
+ }
}
}
-
+
return null;
}
/**
* Return the chaining mode for a given trust anchor.
- *
+ *
* @param trustAnchor The trust anchor for which the chaining mode should be
- * returned.
- * @return The chaining mode for the given trust anchor. If the trust anchor
- * has not been configured separately, the system default will be returned.
+ * returned.
+ * @return The chaining mode for the given trust anchor. If the trust anchor has
+ * not been configured separately, the system default will be returned.
*/
public String getChainingMode(X509Certificate trustAnchor) {
- Principal issuer = trustAnchor.getIssuerDN();
- BigInteger serial = trustAnchor.getSerialNumber();
- IssuerAndSerial issuerAndSerial = new IssuerAndSerial(issuer, serial);
+ final Principal issuer = trustAnchor.getIssuerDN();
+ final BigInteger serial = trustAnchor.getSerialNumber();
+ final IssuerAndSerial issuerAndSerial = new IssuerAndSerial(issuer, serial);
- String mode = (String) chainingModes.get(issuerAndSerial);
+ final String mode = (String) chainingModes.get(issuerAndSerial);
return mode != null ? mode : defaultChainingMode;
}
/**
* Return the distribution points for a given CA.
- *
+ *
* @param cert The certificate for which the distribution points should be
* looked up. The issuer information is used to perform the lookup.
- *
- * @return A <code>Set</code> of <code>DistributionPoint</code> objects. The
- * set will be empty, if no distribution points have been configured
- * for this certificate.
+ *
+ * @return A <code>Set</code> of <code>DistributionPoint</code> objects. The set
+ * will be empty, if no distribution points have been configured for
+ * this certificate.
*/
- public Set getDistributionPoints(X509Certificate cert)
- {
+ public Set getDistributionPoints(X509Certificate cert) {
try {
- RFC2253NameParser nameParser =
- new RFC2253NameParser(cert.getIssuerDN().toString());
- String caIssuerDN = nameParser.parse().getName();
- Set dps = (Set) distributionPoints.get(caIssuerDN);
+ final RFC2253NameParser nameParser =
+ new RFC2253NameParser(cert.getIssuerDN().toString());
+ final String caIssuerDN = nameParser.parse().getName();
+ final Set dps = (Set) distributionPoints.get(caIssuerDN);
if (dps == null) {
return Collections.EMPTY_SET;
}
return dps;
- } catch (RFC2253NameParserException e) {
+ } catch (final RFC2253NameParserException e) {
return Collections.EMPTY_SET;
}
}
/**
* Return the CRL archive duration.
- *
+ *
* @return The duration of how long to keep CRL archive entries (measured in
- * days).
+ * days).
*/
public int getCRLArchiveDuration() {
return cRLArchiveDuration;
}
-
+
/**
* Returns whether revocation information should be archived.
- *
+ *
* @return whether revocation information should be archived.
*/
- public boolean getEnableRevocationArchiving()
- {
+ public boolean getEnableRevocationArchiving() {
return enableRevocationArchiving_;
}
-
+
/**
* Returns the location of the certificate store.
- *
+ *
* @return the location of the certificate store.
*/
- public String getCertStoreLocation()
- {
+ public String getCertStoreLocation() {
return certStoreLocation_;
}
/**
* Return a <code>CreateTransformsInfoProfile</code> with the given ID.
- *
+ *
* @param id The <code>CreateTransformsInfoProfile</code> ID.
- * @return The <code>CreateTransformsInfoProfile</code> with the given
- * ID or <code>null</code>, if none exists.
+ * @return The <code>CreateTransformsInfoProfile</code> with the given ID or
+ * <code>null</code>, if none exists.
*/
public Element getCreateTransformsInfoProfile(String id) {
return (Element) createTransformsInfoProfiles.get(id);
@@ -792,10 +779,10 @@ public class ConfigurationProvider
/**
* Return a <code>CreateSignatureEnvironmentProfile</code> with the given ID.
- *
+ *
* @param id The <code>CreateSignatureEnvironmentProfile</code> ID.
- * @return The <code>CreateSignatureEnvironmentProfile</code> with the given
- * ID or <code>null</code>, if none exists.
+ * @return The <code>CreateSignatureEnvironmentProfile</code> with the given ID
+ * or <code>null</code>, if none exists.
*/
public Element getCreateSignatureEnvironmentProfile(String id) {
return (Element) createSignatureEnvironmentProfiles.get(id);
@@ -803,10 +790,10 @@ public class ConfigurationProvider
/**
* Return a <code>VerifyTransformsInfoProfile</code> with the given ID.
- *
+ *
* @param id The <code>VerifyTransformsInfoProfile</code> ID.
* @return The <code>VerifyTransformsInfoProfile</code> with the given ID or
- * <code>null</code>, if none exists.
+ * <code>null</code>, if none exists.
*/
public Element getVerifyTransformsInfoProfile(String id) {
return (Element) verifyTransformsInfoProfiles.get(id);
@@ -814,10 +801,10 @@ public class ConfigurationProvider
/**
* Return a <code>SupplementProfile</code> with the given ID.
- *
+ *
* @param id The <code>SupplementProfile</code> ID.
* @return The <code>SupplementProfile</code> with the given ID or
- * <code>null</code>, if none exists.
+ * <code>null</code>, if none exists.
*/
public Element getSupplementProfile(String id) {
return (Element) supplementProfiles.get(id);
@@ -825,63 +812,64 @@ public class ConfigurationProvider
/**
* Return a <code>TrustProfile</code> with the given ID.
- *
+ *
* @param id The <code>TrustProfile</code> ID.
- * @return The <code>TrustProfile</code> with the given ID or
- * <code>null</code>, if none exists.
+ * @return The <code>TrustProfile</code> with the given ID or <code>null</code>,
+ * if none exists.
*/
public TrustProfile getTrustProfile(String id) {
- if (MiscUtil.isNotEmpty(id)) {
- id = id.trim().toLowerCase();
- return (TrustProfile) trustProfiles.get(id);
-
- }
-
- return null;
+ if (MiscUtil.isNotEmpty(id)) {
+ id = id.trim().toLowerCase();
+ return (TrustProfile) trustProfiles.get(id);
+
+ }
+
+ return null;
}
-
+
/**
* Returns a map of <code>TrustProfiles</code>
+ *
* @return
*/
public Map getTrustProfiles() {
- return trustProfiles;
+ return trustProfiles;
}
/**
* Log a warning.
- *
- * @param messageId The message ID.
+ *
+ * @param messageId The message ID.
* @param parameters Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private static void info(String messageId, Object[] parameters) {
- MessageProvider msg = MessageProvider.getInstance();
+ final MessageProvider msg = MessageProvider.getInstance();
Logger.info(new LogMsg(msg.getMessage(messageId, parameters)));
}
-
+
/**
* Log a debug message.
- *
- * @param messageId The message ID.
+ *
+ * @param messageId The message ID.
* @param parameters Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private static void debug(String message) {
Logger.debug(message);
}
-
- /**
+
+ /**
* Log a warning.
- *
+ *
* @param messageId The message ID.
- * @param args Additional parameters for the message.
+ * @param args Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private void warn(String messageId, Object[] args) {
- MessageProvider msg = MessageProvider.getInstance();
- String txt = msg.getMessage(messageId, args);
+ final MessageProvider msg = MessageProvider.getInstance();
+ final String txt = msg.getMessage(messageId, args);
Logger.warn(new LogMsg(txt));
warnings.add(txt);
@@ -889,119 +877,126 @@ public class ConfigurationProvider
/**
* Log an error.
- *
+ *
* @param messageId The message ID.
- * @param args Additional parameters for the message.
+ * @param args Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private void error(String messageId, Object[] args) {
- MessageProvider msg = MessageProvider.getInstance();
- String txt = msg.getMessage(messageId, args);
+ final MessageProvider msg = MessageProvider.getInstance();
+ final String txt = msg.getMessage(messageId, args);
Logger.warn(new LogMsg(txt));
// warnings.add(txt);
}
-
+
/**
* Returns the JDBC URL for the revocation archive database.
- *
+ *
* @return the JDBC URL for the revocation archive database.
*/
- public String getRevocationArchiveJDBCURL()
- {
+ public String getRevocationArchiveJDBCURL() {
return revocationArchiveJDBCURL_;
}
/**
* Returns the JDBC driver class name for the revocation archive database.
- *
+ *
* @return the JDBC driver class name for the revocation archive database.
*/
- public String getRevocationArchiveJDBCDriverClass()
- {
+ public String getRevocationArchiveJDBCDriverClass() {
return revocationArchiveJDBCDriverClass_;
}
/**
* Returns whether revocation checking should be done.
- *
+ *
* @return whether revocation checking should be done.
*/
- public boolean getEnableRevocationChecking()
- {
+ public boolean getEnableRevocationChecking() {
return enableRevocationChecking_;
}
/**
- * Returns the maximum age of a revocation information for considering it
- * still as valid.
- *
- * @return the maximum age of a revocation information for considering it
- * still as valid.
+ * Returns the maximum age of a revocation information for considering it still
+ * as valid.
+ *
+ * @return the maximum age of a revocation information for considering it still
+ * as valid.
*/
- public long getMaxRevocationAge()
- {
+ public long getMaxRevocationAge() {
return maxRevocationAge_;
}
/**
* Returns the service order for revocation checking.
- *
+ *
* @return the service order for revocation checking. Valid array entries are
- * {@link RevocationSourceTypes#OCSP} and {@link RevocationSourceTypes#CRL}.
+ * {@link RevocationSourceTypes#OCSP} and
+ * {@link RevocationSourceTypes#CRL}.
*/
- public String[] getServiceOrder()
- {
+ public String[] getServiceOrder() {
return serviceOrder_;
}
/**
- * Returns whether certificates found during certificate path construction
+ * Returns whether certificates found during certificate path construction
* should be added to the certificate store.
- *
- * @return whether certificates found during certificate path construction
+ *
+ * @return whether certificates found during certificate path construction
* should be added to the certificate store.
*/
- public boolean getAutoAddCertificates()
- {
+ public boolean getAutoAddCertificates() {
return autoAddCertificates_;
}
/**
- * Returns whether the certificate extension Authority Info Access should
- * be used during certificate path construction.
- *
- * @return whether the certificate extension Authority Info Access should
- * be used during certificate path construction.
+ * Returns whether EE certificates found during certificate path construction
+ * should be added to the certificate store.
+ *
+ * @return whether certificates found during certificate path construction
+ * should be added to the certificate store.
+ */
+ public boolean getAutoAddEECertificates() {
+ return autoAddEECertificates_;
+ }
+
+ /**
+ * Returns whether the certificate extension Authority Info Access should be
+ * used during certificate path construction.
+ *
+ * @return whether the certificate extension Authority Info Access should be
+ * used during certificate path construction.
*/
- public boolean getUseAuthorityInfoAccess()
- {
+ public boolean getUseAuthorityInfoAccess() {
return useAuthorityInfoAccess_;
}
-
+
/**
* Returns whether the file URIs are permitted or not
+ *
* @return whether the file URIs are permitted or not
*/
- public boolean getPermitFileURIs()
- {
- return permitFileURIs;
+ public boolean getPermitFileURIs() {
+ return permitFileURIs;
}
-
+
/**
* Returns the map of retention intervals
+ *
* @return The map of retention intervals
*/
public Map getCrlRetentionIntervals() {
- return crlRetentionIntervals;
+ return crlRetentionIntervals;
}
-
+
/**
* Returns the global TSL configuration
+ *
* @return The global TSL configuration
*/
public TSLConfiguration getTSLConfiguration() {
- return tslconfiguration_;
+ return tslconfiguration_;
}
-
+
} \ No newline at end of file
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java
index a2e5b93..bf911df 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/DistributionPoint.java
@@ -21,42 +21,40 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
/**
* Abstract base class for distribution points.
- *
+ *
* @author Gregor Karlinger
* @version $Id$
- * */
-public abstract class DistributionPoint implements iaik.pki.revocation.DistributionPoint
-{
- /**
- * The distribution point URI.
+ */
+public abstract class DistributionPoint implements iaik.pki.revocation.DistributionPoint {
+ /**
+ * The distribution point URI.
*/
- private String uri_;
+ private final String uri_;
/**
* Create a <code>DistributionPoint</code> with a URI.
- *
+ *
* @param uri The URI of the distribution point.
*/
- public DistributionPoint(String uri)
- {
+ public DistributionPoint(String uri) {
uri_ = uri;
}
-
+
/**
* @see iaik.pki.revocation.DistributionPoint#getType()
*/
+ @Override
public abstract String getType();
/**
* @see iaik.pki.revocation.DistributionPoint#getUri()
*/
- public String getUri()
- {
+ @Override
+ public String getUri() {
return uri_;
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java
index c0487f6..99ca1c3 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareCryptoModule.java
@@ -21,40 +21,38 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
/**
* Contains configuration data for a hardware crypto module.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class HardwareCryptoModule {
/** The name of the module. */
- private String name;
+ private final String name;
/** The slod ID of the module. */
- private String slotID;
+ private final String slotID;
/** The user PIN of the module. */
- private String userPIN;
-
+ private final String userPIN;
+
/**
* Create a new <code>HardwareCryptoModule</code>.
- *
- * @param name The name of this <code>HardwareCryptoModule</code>.
- * @param slotID The slot ID of this <code>HardwareCryptoModule</code>.
- * @param userPIN The user PIN to access this
- * <code>HardwareCryptoModule</code>.
+ *
+ * @param name The name of this <code>HardwareCryptoModule</code>.
+ * @param slotID The slot ID of this <code>HardwareCryptoModule</code>.
+ * @param userPIN The user PIN to access this <code>HardwareCryptoModule</code>.
*/
public HardwareCryptoModule(String name, String slotID, String userPIN) {
this.name = name;
this.slotID = slotID;
this.userPIN = userPIN;
}
-
+
/**
* Returns the name of this <code>HardwareCryptoModule</code>.
- *
+ *
* @return The name of this <code>HardwareCryptoModule</code>.
*/
public String getName() {
@@ -63,22 +61,20 @@ public class HardwareCryptoModule {
/**
* Returns the slot ID of this <code>HardwareCryptoModule</code>.
- *
+ *
* @return The slot ID.
*/
public String getSlotID() {
return slotID;
}
-
/**
* Returns the user PIN of this <code>HardwareCryptoModule</code>.
- *
+ *
* @return The user PIN used to access the module.
*/
public String getUserPIN() {
return userPIN;
}
-
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java
index 18fd085..5fa408c 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/HardwareKeyModule.java
@@ -21,60 +21,59 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
/**
* A class that contains information about a hardware key module.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class HardwareKeyModule extends KeyModule {
/** The name of the module. */
- private String name;
+ private final String name;
/** The slod ID of the module. */
- private String slotID;
+ private final String slotID;
/** The user PIN of the module. */
- private String userPIN;
-
+ private final String userPIN;
+
/**
* Create a new <code>HardwareKey</code>.
- *
- * @param id The key module ID.
- * @param name The name of the key.
- * @param slotID The slot ID of the key within the hardware module. May be
- * <code>null</code>.
+ *
+ * @param id The key module ID.
+ * @param name The name of the key.
+ * @param slotID The slot ID of the key within the hardware module. May be
+ * <code>null</code>.
* @param userPIN The user PIN to access the key.
*/
public HardwareKeyModule(String id, String name, String slotID, String userPIN) {
super(id);
this.name = name;
this.slotID = slotID;
- this.userPIN = userPIN;
+ this.userPIN = userPIN;
}
-
+
/**
* Return the name of this <code>HardwareKey</code>.
- *
+ *
* @return The name of this <code>HardwareKey</code>.
*/
public String getName() {
return name;
}
-
+
/**
* Return the slot ID of this <code>HardwareKey</code>.
- *
+ *
* @return The slot ID of this <code>HardwareKey</code>.
*/
public String getSlotID() {
return slotID;
}
-
+
/**
* Return the user PIN to access this <code>HardwareKey</code>.
- *
+ *
* @return The user PIN to access this <code>HardwareKey</code>.
*/
public String getUserPIN() {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java
index 38a3ae9..03827f2 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/IssuerAndSerial.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.config;
import java.math.BigInteger;
@@ -34,25 +33,25 @@ import iaik.utils.RFC2253NameParserException;
/**
* A class containing the issuer and serial number of a certificate, which can
* be used to uniquely identify the certificate.
- *
+ *
* The issuer is contained as an RFC2253 encoded <code>String</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class IssuerAndSerial {
/** The issuer distinguished name. */
- private String issuerDN;
+ private final String issuerDN;
/** The certificate serial number. */
- private BigInteger serial;
+ private final BigInteger serial;
/**
* Create an <code>IssuerAndSerial</code> object.
- *
+ *
* The name of the issuer is converted to RFC2253. If it cannot be parsed, the
- * DN contained in the <code>issuer</code> is set.
- *
+ * DN contained in the <code>issuer</code> is set.
+ *
* @param issuer The isser of a certificate.
* @param serial The serial number of the certificate.
*/
@@ -60,28 +59,28 @@ public class IssuerAndSerial {
String issuerDN = null;
if (issuer instanceof Name) {
try {
- issuerDN = ((Name)issuer).getRFC2253String();
- } catch (RFC2253NameParserException e) {
+ issuerDN = ((Name) issuer).getRFC2253String();
+ } catch (final RFC2253NameParserException e) {
// do nothing
}
}
if (issuerDN == null) {
- RFC2253NameParser parser = new RFC2253NameParser(issuer.getName());
+ final RFC2253NameParser parser = new RFC2253NameParser(issuer.getName());
try {
- issuerDN = ((Name)parser.parse()).getRFC2253String();
- } catch (RFC2253NameParserException e) {
+ issuerDN = parser.parse().getRFC2253String();
+ } catch (final RFC2253NameParserException e) {
issuerDN = issuer.getName();
}
}
this.serial = serial;
this.issuerDN = issuerDN;
}
-
+
/**
* Create an <code>IssuerAndSerial</code> object.
- *
+ *
* @param issuerDN The issuer distinguished name. Should be an RFC2253 name.
- * @param serial The serial number of the certificate.
+ * @param serial The serial number of the certificate.
*/
public IssuerAndSerial(String issuerDN, BigInteger serial) {
this.issuerDN = issuerDN;
@@ -90,7 +89,7 @@ public class IssuerAndSerial {
/**
* Return the issuer DN in RFC2253 format.
- *
+ *
* @return The issuer part of this object.
*/
public String getIssuerDN() {
@@ -99,7 +98,7 @@ public class IssuerAndSerial {
/**
* Return the serial number.
- *
+ *
* @return The serial number of this object.
*/
public BigInteger getSerial() {
@@ -108,28 +107,31 @@ public class IssuerAndSerial {
/**
* Compare this <code>IssuerAndSerial</code> to another object.
- *
+ *
* @param other The object to compare this <code>IssuerAndSerial</code> to.
* @return <code>true</code>, if <code>other</code> is an
- * <code>IssuerAndSerial</code> object and the <code>issuer</code> and
- * <code>serial</code> fields are both equal. <code>false</code> otherwise.
+ * <code>IssuerAndSerial</code> object and the <code>issuer</code> and
+ * <code>serial</code> fields are both equal. <code>false</code>
+ * otherwise.
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object other) {
if (other instanceof IssuerAndSerial) {
- IssuerAndSerial ias = (IssuerAndSerial) other;
+ final IssuerAndSerial ias = (IssuerAndSerial) other;
return getIssuerDN().equals(ias.getIssuerDN())
- && getSerial().equals(ias.getSerial());
+ && getSerial().equals(ias.getSerial());
}
return false;
}
/**
* Return the hash code of this <code>IssuerAndSerial</code>.
- *
+ *
* @return The hash code of this <code>IssuerAndSerial</code>.
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return issuerDN.hashCode() ^ serial.hashCode();
}
@@ -137,13 +139,14 @@ public class IssuerAndSerial {
/**
* Return a <code>String</code> representation of this
* <code>IssuerAndSerial</code> object.
- *
+ *
* @return The <code>String</code> representation.
* @see java.lang.Object#toString()
*/
+ @Override
public String toString() {
- return ("(IssuerAndSerial - Issuer<" + getIssuerDN())
- + ("> Serial<" + serial.toString() + ">)");
+ return "(IssuerAndSerial - Issuer<" + getIssuerDN()
+ + "> Serial<" + serial.toString() + ">)";
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java
index c2490f9..faeaf82 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroup.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.config;
import java.util.Iterator;
@@ -29,7 +28,7 @@ import java.util.Set;
/**
* A collection of <code>KeyGroupEntry</code>s with its own ID.
- *
+ *
* @author Sven Aigner
* @author Patrick Peck
* @version $Id$
@@ -37,59 +36,62 @@ import java.util.Set;
public class KeyGroup {
/** The keys belonging to this key group. */
- private Set keyGroupEntries;
+ private final Set keyGroupEntries;
/** The key group ID. */
- private String id;
+ private final String id;
/** The digest method algorithm for the key group */
- private String digestMethodAlgorithm;
+ private final String digestMethodAlgorithm;
/**
* Create a <code>KeyGroup</code>.
- *
- * @param id The ID of this <code>KeyGroup</code>.
- * @param keyGroupEntries The keys belonging to this <code>KeyGroup</code>.
+ *
+ * @param id The ID of this <code>KeyGroup</code>.
+ * @param keyGroupEntries The keys belonging to this
+ * <code>KeyGroup</code>.
* @param digestMethodAlgorithm The signature algorithm used for this key group
*/
public KeyGroup(String id, Set keyGroupEntries, String digestMethodAlgorithm) {
this.id = id;
this.keyGroupEntries = keyGroupEntries;
- this.digestMethodAlgorithm = digestMethodAlgorithm;
+ this.digestMethodAlgorithm = digestMethodAlgorithm;
}
/**
* Return the <code>KeyEntry</code>s contained in this <code>KeyGroup</code>.
- *
+ *
* @return The <code>KeyEntry</code>s contained in this <code>KeyGroup</code>.
*/
public Set getKeyGroupEntries() {
return keyGroupEntries;
}
-
+
/**
* Returnd the digest method algorithm used for this key group
+ *
* @return The digest method signature algorithm used for this key group
*/
public String getDigestMethodAlgorithm() {
- return digestMethodAlgorithm;
+ return digestMethodAlgorithm;
}
/**
* Return the ID of this <code>KeyGroup</code>.
- *
+ *
* @return The <code>KeyGroup</code> ID.
*/
public String getId() {
return id;
}
- /**
+ /**
* Return a <code>String</code> representation of this <code>KeyGroup</code>.
- *
+ *
* @return The <code>String</code> representation.
* @see java.lang.Object#toString()
*/
+ @Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ final StringBuffer sb = new StringBuffer();
Iterator i;
if (getKeyGroupEntries() != null) {
@@ -99,7 +101,8 @@ public class KeyGroup {
sb.append(" " + i.next());
}
}
- return "(KeyGroup - ID:" + id + " " + sb.toString() + ")" + "DigestMethodAlgorithm: " + digestMethodAlgorithm;
+ return "(KeyGroup - ID:" + id + " " + sb.toString() + ")" + "DigestMethodAlgorithm: "
+ + digestMethodAlgorithm;
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java
index fcedfb0..d73b755 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyGroupEntry.java
@@ -21,31 +21,30 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
import java.math.BigInteger;
/**
* A class containing information about an entry in a key group.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class KeyGroupEntry {
/** The module ID of the key. */
- private String moduleID;
+ private final String moduleID;
/** The issuer DN of the certificate identifying the key. */
- private String issuerDN;
+ private final String issuerDN;
/** The serial number of the certificate identifying the key. */
- private BigInteger serialNumber;
+ private final BigInteger serialNumber;
/**
* Create a new <code>KeyGroupEntry</code>.
- *
- * @param moduleID The key module ID to which this entry belongs to.
- * @param issuerAndSerial The issuer and serial number which uniquely
- * identifies a certificate within the key module.
+ *
+ * @param moduleID The key module ID to which this entry belongs to.
+ * @param issuerAndSerial The issuer and serial number which uniquely identifies
+ * a certificate within the key module.
*/
public KeyGroupEntry(String moduleID, IssuerAndSerial issuerAndSerial) {
this.moduleID = moduleID;
@@ -55,25 +54,24 @@ public class KeyGroupEntry {
/**
* Create a new <code>KeyGroupEntry</code>.
- *
- * @param moduleID The key module ID to which this entry belongs to.
- * @param issuerDN The isser DN of the certificate within the key module.
+ *
+ * @param moduleID The key module ID to which this entry belongs to.
+ * @param issuerDN The isser DN of the certificate within the key module.
* @param serialNumber The serial number of the certificate within the key
- * module.
+ * module.
*/
public KeyGroupEntry(
- String moduleID,
- String issuerDN,
- BigInteger serialNumber) {
+ String moduleID,
+ String issuerDN,
+ BigInteger serialNumber) {
this.moduleID = moduleID;
this.issuerDN = issuerDN;
this.serialNumber = serialNumber;
}
/**
- * Return the key module ID to which this <code>KeyGroupEntry</code> belongs
- * to.
- *
+ * Return the key module ID to which this <code>KeyGroupEntry</code> belongs to.
+ *
* @return The key module ID.
*/
public String getModuleID() {
@@ -83,7 +81,7 @@ public class KeyGroupEntry {
/**
* Return the issuer DN of this <code>KeyGroupEntry</code> for identifying the
* certificate within the key module.
- *
+ *
* @return The issuer DN of the certificate.
*/
public String getIssuerDN() {
@@ -93,7 +91,7 @@ public class KeyGroupEntry {
/**
* Return the serial number of this <code>KeyGroupEntry</code> for identifying
* the certificate within the key module.
- *
+ *
* @return The serial number of the certificate.
*/
public BigInteger getSerialNumber() {
@@ -105,26 +103,28 @@ public class KeyGroupEntry {
*
* @param other The <code>KeyGroupEntry</code> to compare to.
* @return <code>true</code>, if module ID, isser DN and serial number of
- * <code>other</code> match the ones contained in this object, otherwise
- * <code>false</code>.
+ * <code>other</code> match the ones contained in this object, otherwise
+ * <code>false</code>.
* @see java.lang.Object#equals(Object)
*/
+ @Override
public boolean equals(Object other) {
if (other instanceof KeyGroupEntry) {
- KeyGroupEntry entry = (KeyGroupEntry) other;
+ final KeyGroupEntry entry = (KeyGroupEntry) other;
return getModuleID().equals(entry.getModuleID())
- && getIssuerDN().equals(entry.getIssuerDN())
- && getSerialNumber().equals(entry.getSerialNumber());
+ && getIssuerDN().equals(entry.getIssuerDN())
+ && getSerialNumber().equals(entry.getSerialNumber());
}
return false;
}
-
+
/**
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getModuleID().hashCode()
- ^ getIssuerDN().hashCode()
- ^ getSerialNumber().hashCode();
+ ^ getIssuerDN().hashCode()
+ ^ getSerialNumber().hashCode();
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java
index 45d8d7e..6a665d6 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/KeyModule.java
@@ -21,23 +21,22 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
/**
* A class that contains information about a key module.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class KeyModule {
/** The key module ID. */
- private String id;
+ private final String id;
/**
* Create a <code>Key</code> object.
- *
+ *
* @param id The key module ID.
*/
public KeyModule(String id) {
@@ -46,7 +45,7 @@ public class KeyModule {
/**
* Return the key ID.
- *
+ *
* @return The key ID.
*/
public String getId() {
@@ -55,10 +54,11 @@ public class KeyModule {
/**
* Return a <code>String</code> representation of this <code>Key</code>.
- *
+ *
* @return The <code>String</code> representation.
* @see java.lang.Object#toString()
*/
+ @Override
public String toString() {
return "(Key - Id<" + id + ">)";
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java
index 2e91c6b..97ced05 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/OCSPDistributionPoint.java
@@ -21,36 +21,33 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
import iaik.pki.revocation.RevocationSourceTypes;
/**
* A class representing a CRL distribution point.
- *
+ *
* @author Gregor Karlinger
* @version $Id$
*/
-public class OCSPDistributionPoint
- extends DistributionPoint
- implements iaik.pki.revocation.DistributionPoint
-{
+public class OCSPDistributionPoint
+ extends DistributionPoint
+ implements iaik.pki.revocation.DistributionPoint {
/**
* Create a <code>OCSPDistributionPoint</code> with a URI.
- *
+ *
* @param uri The URI of the ocsp distribution point.
*/
- public OCSPDistributionPoint(String uri)
- {
+ public OCSPDistributionPoint(String uri) {
super(uri);
}
/**
* @see iaik.pki.revocation.DistributionPoint#getType()
*/
- public String getType()
- {
+ @Override
+ public String getType() {
return RevocationSourceTypes.OCSP;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java
index 0ed83bb..3c038cf 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/SoftwareKeyModule.java
@@ -21,25 +21,24 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.config;
/**
* A class containing information about a software key, stored in PKCS12 format.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class SoftwareKeyModule extends KeyModule {
/** The name of the file containing the keys. */
- private String fileName;
+ private final String fileName;
/** The password for accessing the file. */
- private String passWord;
-
+ private final String passWord;
+
/**
* Create a new <code>SoftwareKey</code>.
- *
- * @param id The key ID.
+ *
+ * @param id The key ID.
* @param fileName The name of the PKCS12 keystore file containing the key.
* @param passWord The password to access the keystore file.
*/
@@ -48,25 +47,24 @@ public class SoftwareKeyModule extends KeyModule {
this.fileName = fileName;
this.passWord = passWord;
}
-
+
/**
* Return the name of the PKCS12 keystore file containing this
* <code>SoftwareKey</code>.
- *
+ *
* @return The name of the PKCS12 keystore file.
*/
public String getFileName() {
return fileName;
}
-
+
/**
* Return the password to access the keystore file.
- *
+ *
* @return The password to access the keystore file.
*/
public String getPassWord() {
return passWord;
}
-
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java
index 0063c7f..94155d6 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/TrustProfile.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.config;
import java.net.URI;
@@ -35,129 +34,139 @@ import java.util.regex.PatternSyntaxException;
import at.gv.egovernment.moa.sig.tsl.TslConstants;
import at.gv.egovernment.moaspss.logging.Logger;
import at.gv.egovernment.moaspss.util.MiscUtil;
-import iaik.x509.X509Certificate;
/**
* Information about a trust profile.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class TrustProfile {
/** The ID of the trust profile. */
- private String id;
+ private final String id;
/** The URI giving the location of the trust profile. */
- private String uri;
+ private final String uri;
/** The URI giving the location of the allowed signer certificates. */
- private String signerCertsUri;
-
- /** Defines if Trustprofile makes use of EU TSL*/
- private boolean tslEnabled;
- /** The countries given */
- private List<String> countries = new ArrayList<String>();
-
- private List<URI> allowedTspStatus = new ArrayList<URI>();
- private List<Pattern> allowedTspServiceTypes = new ArrayList<Pattern>();
-
-
+ private final String signerCertsUri;
+
+ /** Defines if Trustprofile makes use of EU TSL */
+ private final boolean tslEnabled;
+ /** The countries given */
+ private final List<String> countries = new ArrayList<>();
+
+ private final List<URI> allowedTspStatus = new ArrayList<>();
+ private final List<Pattern> allowedTspServiceTypes = new ArrayList<>();
+
/**
* Create a <code>TrustProfile</code>.
- *
- * @param id The ID of the <code>TrustProfile</code> to create.
- * @param uri The URI of the <code>TrustProfile</code> to create.
- * @param signerCertsUri The URI of the location of the allowed signer
- * certificates of the <code>TrustProfile</code> to create.
- * @param allowedTspServiceTypes
- * @param allowedTspStatus
+ *
+ * @param id The ID of the <code>TrustProfile</code> to
+ * create.
+ * @param uri The URI of the <code>TrustProfile</code> to
+ * create.
+ * @param signerCertsUri The URI of the location of the allowed signer
+ * certificates of the <code>TrustProfile</code>
+ * to create.
+ * @param allowedTspServiceTypes
+ * @param allowedTspStatus
*/
- public TrustProfile(String id, String uri, String signerCertsUri,
- boolean tslEnabled, String countries, String allowedTspStatus, String allowedTspServiceTypes) {
+ public TrustProfile(String id, String uri, String signerCertsUri,
+ boolean tslEnabled, String countries, String allowedTspStatus, String allowedTspServiceTypes) {
this.id = id;
this.uri = uri;
this.signerCertsUri = signerCertsUri;
-
- //TSL configuration parameters
+
+ // TSL configuration parameters
this.tslEnabled = tslEnabled;
- if (tslEnabled) {
- setCountries(countries);
- if (!this.countries.isEmpty())
- Logger.info("TrustProfile "+ id + " allows " + Arrays.toString(this.countries.toArray()) + " TSL countries");
- else
- Logger.info("TrustProfile "+ id + " allows " + "ALL" + " TSL countries");
-
- setAllowedTspStatus(allowedTspStatus);
- Logger.info("TrustProfile "+ id + " allows " + Arrays.toString(this.allowedTspStatus.toArray()) + " TSP status identifier");
-
- setAllowedTspServiceTypes(allowedTspServiceTypes);
- Logger.info("TrustProfile "+ id + " allows " + Arrays.toString(this.allowedTspServiceTypes.toArray()) + " TSL service-type identifier");
-
- }
+ if (tslEnabled) {
+ setCountries(countries);
+ if (!this.countries.isEmpty()) {
+ Logger.info("TrustProfile " + id + " allows " + Arrays.toString(this.countries.toArray())
+ + " TSL countries");
+ } else {
+ Logger.info("TrustProfile " + id + " allows " + "ALL" + " TSL countries");
+ }
+
+ setAllowedTspStatus(allowedTspStatus);
+ Logger.info("TrustProfile " + id + " allows " + Arrays.toString(this.allowedTspStatus.toArray())
+ + " TSP status identifier");
+
+ setAllowedTspServiceTypes(allowedTspServiceTypes);
+ Logger.info("TrustProfile " + id + " allows " + Arrays.toString(this.allowedTspServiceTypes.toArray())
+ + " TSL service-type identifier");
+
+ }
}
private void setCountries(String countries) {
- if (MiscUtil.isNotEmpty(countries)) {
- String[] ccArray = countries.split(",");
- for (String el : ccArray)
- this.countries.add(el.trim());
-
- }
+ if (MiscUtil.isNotEmpty(countries)) {
+ final String[] ccArray = countries.split(",");
+ for (final String el : ccArray) {
+ this.countries.add(el.trim());
+ }
+
+ }
}
-
+
private void setAllowedTspStatus(String allowedTspStatus) {
- if (MiscUtil.isNotEmpty(allowedTspStatus)) {
- String[] ccArray = allowedTspStatus.split(",");
- for (String el : ccArray) {
- try {
- this.allowedTspStatus.add(new URI(el.trim()));
-
- } catch (URISyntaxException e) {
- Logger.warn("TrustProfile: " + this.id + " contains a non-valid TSP Status identifier (" + el + ")");
-
- }
-
- }
-
- } else {
- Logger.debug("Use default set of TSP Status identifier");
- this.allowedTspStatus.addAll(
- Arrays.asList(
- TslConstants.SERVICE_STATUS_SORT_TO_URI.get(TslConstants.SERVICE_STATUS_SHORT.granted),
- TslConstants.SERVICE_STATUS_SORT_TO_URI.get(TslConstants.SERVICE_STATUS_SHORT.recognisedatnationallevel),
- TslConstants.SERVICE_STATUS_SORT_TO_URI.get(TslConstants.SERVICE_STATUS_SHORT.accredited),
- TslConstants.SERVICE_STATUS_SORT_TO_URI.get(TslConstants.SERVICE_STATUS_SHORT.undersupervision)));
-
- }
-
+ if (MiscUtil.isNotEmpty(allowedTspStatus)) {
+ final String[] ccArray = allowedTspStatus.split(",");
+ for (final String el : ccArray) {
+ try {
+ this.allowedTspStatus.add(new URI(el.trim()));
+
+ } catch (final URISyntaxException e) {
+ Logger.warn("TrustProfile: " + this.id + " contains a non-valid TSP Status identifier (" + el
+ + ")");
+
+ }
+
+ }
+
+ } else {
+ Logger.debug("Use default set of TSP Status identifier");
+ this.allowedTspStatus.addAll(
+ Arrays.asList(
+ TslConstants.SERVICE_STATUS_SORT_TO_URI.get(TslConstants.SERVICE_STATUS_SHORT.granted),
+ TslConstants.SERVICE_STATUS_SORT_TO_URI.get(
+ TslConstants.SERVICE_STATUS_SHORT.recognisedatnationallevel),
+ TslConstants.SERVICE_STATUS_SORT_TO_URI.get(TslConstants.SERVICE_STATUS_SHORT.accredited),
+ TslConstants.SERVICE_STATUS_SORT_TO_URI.get(
+ TslConstants.SERVICE_STATUS_SHORT.undersupervision)));
+
+ }
+
}
-
+
private void setAllowedTspServiceTypes(String allowedTspServiceTypes) {
- if (MiscUtil.isNotEmpty(allowedTspServiceTypes)) {
- String[] ccArray = allowedTspServiceTypes.split(",");
- for (String el : ccArray) {
- try {
- this.allowedTspServiceTypes.add(Pattern.compile(el.trim()));
-
- } catch (PatternSyntaxException e) {
- Logger.warn("TrustProfile: " + this.id + " contains a non-valid TSP Service-Type identifier Regex pattern(" + el + ")");
-
- }
-
- }
-
- } else {
- Logger.debug("Use default set of TSP Service-Type identifier");
- this.allowedTspServiceTypes.addAll(
- Arrays.asList(
- Pattern.compile(TslConstants.DEFAULT_REGEX_PATTERN_ALLOW_ALL)));
-
- }
-
+ if (MiscUtil.isNotEmpty(allowedTspServiceTypes)) {
+ final String[] ccArray = allowedTspServiceTypes.split(",");
+ for (final String el : ccArray) {
+ try {
+ this.allowedTspServiceTypes.add(Pattern.compile(el.trim()));
+
+ } catch (final PatternSyntaxException e) {
+ Logger.warn("TrustProfile: " + this.id
+ + " contains a non-valid TSP Service-Type identifier Regex pattern(" + el + ")");
+
+ }
+
+ }
+
+ } else {
+ Logger.debug("Use default set of TSP Service-Type identifier");
+ this.allowedTspServiceTypes.addAll(
+ Arrays.asList(
+ Pattern.compile(TslConstants.DEFAULT_REGEX_PATTERN_ALLOW_ALL)));
+
+ }
+
}
-
+
/**
* Return the ID of this <code>TrustProfile</code>.
- *
+ *
* @return The <code>TrustProfile</code> ID.
*/
public String getId() {
@@ -166,49 +175,51 @@ public class TrustProfile {
/**
* Return the URI of this <code>TrustProfile</code>.
- *
+ *
* @return The URI of <code>TrustProfile</code>.
*/
public String getUri() {
return uri;
}
-
/**
- * Return the URI giving the location of the allowed signer certificates
- * of this <code>TrustProfile</code>.
- *
+ * Return the URI giving the location of the allowed signer certificates of this
+ * <code>TrustProfile</code>.
+ *
* @return The URI of <code>TrustProfile</code>.
*/
public String getSignerCertsUri() {
return signerCertsUri;
}
+
/**
* Returns if Trustprofile is TSL enabled
+ *
* @return
*/
public boolean isTSLEnabled() {
- return tslEnabled;
+ return tslEnabled;
}
+
/**
* Returns the given countries
+ *
* @return Given countries
*/
public List<String> getCountries() {
- if (!tslEnabled)
- return null;
- else
- return countries;
+ if (!tslEnabled) {
+ return null;
+ } else {
+ return countries;
+ }
}
public List<URI> getAllowedTspStatus() {
- return allowedTspStatus;
+ return allowedTspStatus;
}
public List<Pattern> getAllowedTspServiceTypes() {
- return allowedTspServiceTypes;
+ return allowedTspServiceTypes;
}
-
-
-
+
}
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 2dc047a..d660c7a 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
@@ -21,17 +21,8 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.cmssign;
-import iaik.server.modules.algorithms.SignatureAlgorithms;
-import iaik.server.modules.cmssign.CMSSignatureCreationProfile;
-import iaik.server.modules.keys.AlgorithmUnavailableException;
-import iaik.server.modules.keys.KeyEntryID;
-import iaik.server.modules.keys.KeyModule;
-import iaik.server.modules.keys.KeyModuleFactory;
-import iaik.server.modules.keys.UnknownKeyException;
-
import java.util.List;
import java.util.Set;
@@ -39,58 +30,71 @@ 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;
+import iaik.server.modules.algorithms.SignatureAlgorithms;
+import iaik.server.modules.cmssign.CMSSignatureCreationProfile;
+import iaik.server.modules.keys.AlgorithmUnavailableException;
+import iaik.server.modules.keys.KeyEntryID;
+import iaik.server.modules.keys.KeyModule;
+import iaik.server.modules.keys.KeyModuleFactory;
+import iaik.server.modules.keys.UnknownKeyException;
/**
* An object providing auxiliary information for creating a CMS signature.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class CMSSignatureCreationProfileImpl
- implements CMSSignatureCreationProfile {
+ implements CMSSignatureCreationProfile {
/** The set of keys available to the signing process. */
private Set keySet;
- /** The MIME type of the data to be signed*/
- private String mimeType;
- /** Whether the created signature is to be Security Layer conform. */
+ /** The MIME type of the data to be signed */
+ private final String mimeType;
+ /** Whether the created signature is to be Security Layer conform. */
private boolean securityLayerConform;
- /** Properties to be signed during signature creation. */
- private List signedProperties;
- /** Specifies whether the content data shall be included in the CMS SignedData or shall be not included. */
- private boolean includeData;
- /** Digest Method algorithm */
+ /** Properties to be signed during signature creation. */
+ private final List signedProperties;
+ /**
+ * Specifies whether the content data shall be included in the CMS SignedData or
+ * shall be not included.
+ */
+ private final boolean includeData;
+ /** Digest Method algorithm */
private String digestMethod;
-
-
+ private final boolean isPAdESConform;
+
/**
* Create a new <code>XMLSignatureCreationProfileImpl</code>.
- *
- * @param createProfileCount Provides external information about the
- * number of calls to the signature creation module, using the same request.
- * @param reservedIDs The set of IDs that must not be used while generating
- * new IDs.
+ *
+ * @param createProfileCount Provides external information about the number of
+ * calls to the signature creation module, using the
+ * same request.
+ * @param reservedIDs The set of IDs that must not be used while
+ * generating new IDs.
*/
public CMSSignatureCreationProfileImpl(
- Set keySet,
- String digestMethod,
- List signedProperties,
- boolean securityLayerConform,
- boolean includeData,
- String mimeType) {
- this.keySet = keySet;
- this.signedProperties = signedProperties;
- this.securityLayerConform = securityLayerConform;
- this.includeData = includeData;
- this.mimeType = mimeType;
- this.digestMethod = digestMethod;
+ Set keySet,
+ String digestMethod,
+ List signedProperties,
+ boolean securityLayerConform,
+ boolean includeData,
+ String mimeType,
+ boolean isPAdESConform) {
+ this.keySet = keySet;
+ this.signedProperties = signedProperties;
+ this.securityLayerConform = securityLayerConform;
+ this.includeData = includeData;
+ this.mimeType = mimeType;
+ this.digestMethod = digestMethod;
+ this.isPAdESConform = isPAdESConform;
}
-
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getKeySet()
*/
+ @Override
public Set getKeySet() {
return keySet;
}
@@ -98,119 +102,116 @@ public class CMSSignatureCreationProfileImpl
/**
* Set the set of <code>KeyEntryID</code>s which may be used for signature
* creation.
- *
+ *
* @param keySet The set of <code>KeyEntryID</code>s to set.
*/
public void setKeySet(Set keySet) {
this.keySet = keySet;
}
-
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignatureAlgorithmName(KeyEntryID)
*/
+ @Override
public String getSignatureAlgorithmName(KeyEntryID selectedKeyID)
- throws AlgorithmUnavailableException {
+ throws AlgorithmUnavailableException {
-
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- TransactionId tid = new TransactionId(context.getTransactionID());
- KeyModule module = KeyModuleFactory.getInstance(tid);
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final TransactionId tid = new TransactionId(context.getTransactionID());
+ final KeyModule module = KeyModuleFactory.getInstance(tid);
Set algorithms;
try {
algorithms = module.getSupportedSignatureAlgorithms(selectedKeyID);
- } catch (UnknownKeyException e) {
+ } catch (final UnknownKeyException e) {
throw new AlgorithmUnavailableException(
- "Unknown key entry: " + selectedKeyID,
- e,
- null);
+ "Unknown key entry: " + selectedKeyID,
+ e,
+ null);
}
-
- if (digestMethod.compareTo("SHA-1") == 0) {
- Logger.warn("SHA-1 is configured as digest algorithm. Please revise a use of a more secure digest algorithm out of the SHA-2 family (e.g. SHA-256, SHA-384, SHA-512)");
-
- if (algorithms.contains(SignatureAlgorithms.SHA1_WITH_RSA)) {
- return SignatureAlgorithms.SHA1_WITH_RSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.ECDSA)) {
- return SignatureAlgorithms.ECDSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
- return SignatureAlgorithms.DSA;
-
- } else {
- throw new AlgorithmUnavailableException(
- "No algorithm for key entry: " + selectedKeyID,
- null,
- null);
- }
-
- } else if (digestMethod.compareTo("SHA-256") == 0) {
- if (algorithms.contains(SignatureAlgorithms.SHA256_WITH_RSA)) {
- return SignatureAlgorithms.SHA256_WITH_RSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.SHA256_WITH_ECDSA)) {
- return SignatureAlgorithms.SHA256_WITH_ECDSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
- return SignatureAlgorithms.DSA;
-
- } else {
- throw new AlgorithmUnavailableException(
- "No algorithm for key entry: " + selectedKeyID,
- null,
- null);
- }
- } else if (digestMethod.compareTo("SHA-384") == 0) {
- if (algorithms.contains(SignatureAlgorithms.SHA384_WITH_RSA)) {
- return SignatureAlgorithms.SHA384_WITH_RSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.SHA384_WITH_ECDSA)) {
- return SignatureAlgorithms.SHA384_WITH_ECDSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
- return SignatureAlgorithms.DSA;
-
- } else {
- throw new AlgorithmUnavailableException(
- "No algorithm for key entry: " + selectedKeyID,
- null,
- null);
- }
- } else if (digestMethod.compareTo("SHA-512") == 0) {
- if (algorithms.contains(SignatureAlgorithms.SHA512_WITH_RSA)) {
- return SignatureAlgorithms.SHA512_WITH_RSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.SHA512_WITH_ECDSA)) {
- return SignatureAlgorithms.SHA512_WITH_ECDSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
- return SignatureAlgorithms.DSA;
-
- } else {
- throw new AlgorithmUnavailableException(
- "No algorithm for key entry: " + selectedKeyID,
- null,
- null);
- }
- }
- else {
- throw new AlgorithmUnavailableException(
- "No signature algorithm found for digest algorithm '" + digestMethod,
- null,
- null);
- }
-
- }
+ if (digestMethod.compareTo("SHA-1") == 0) {
+ Logger.warn(
+ "SHA-1 is configured as digest algorithm. Please revise a use of a more secure digest algorithm out of the SHA-2 family (e.g. SHA-256, SHA-384, SHA-512)");
+
+ if (algorithms.contains(SignatureAlgorithms.SHA1_WITH_RSA)) {
+ return SignatureAlgorithms.SHA1_WITH_RSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.ECDSA)) {
+ return SignatureAlgorithms.ECDSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
+ return SignatureAlgorithms.DSA;
+
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No algorithm for key entry: " + selectedKeyID,
+ null,
+ null);
+ }
+
+ } else if (digestMethod.compareTo("SHA-256") == 0) {
+ if (algorithms.contains(SignatureAlgorithms.SHA256_WITH_RSA)) {
+ return SignatureAlgorithms.SHA256_WITH_RSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.SHA256_WITH_ECDSA)) {
+ return SignatureAlgorithms.SHA256_WITH_ECDSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
+ return SignatureAlgorithms.DSA;
+
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No algorithm for key entry: " + selectedKeyID,
+ null,
+ null);
+ }
+ } else if (digestMethod.compareTo("SHA-384") == 0) {
+ if (algorithms.contains(SignatureAlgorithms.SHA384_WITH_RSA)) {
+ return SignatureAlgorithms.SHA384_WITH_RSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.SHA384_WITH_ECDSA)) {
+ return SignatureAlgorithms.SHA384_WITH_ECDSA;
+ } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
+ return SignatureAlgorithms.DSA;
+
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No algorithm for key entry: " + selectedKeyID,
+ null,
+ null);
+ }
+ } else if (digestMethod.compareTo("SHA-512") == 0) {
+ if (algorithms.contains(SignatureAlgorithms.SHA512_WITH_RSA)) {
+ return SignatureAlgorithms.SHA512_WITH_RSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.SHA512_WITH_ECDSA)) {
+ return SignatureAlgorithms.SHA512_WITH_ECDSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
+ return SignatureAlgorithms.DSA;
+
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No algorithm for key entry: " + selectedKeyID,
+ null,
+ null);
+ }
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No signature algorithm found for digest algorithm '" + digestMethod,
+ null,
+ null);
+ }
+
+ }
-
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignedProperties()
*/
+ @Override
public List getSignedProperties() {
return signedProperties;
}
@@ -218,32 +219,38 @@ public class CMSSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#isSecurityLayerConform()
*/
+ @Override
public boolean isSecurityLayerConform() {
return securityLayerConform;
}
/**
* Sets the security layer conformity.
- *
- * @param securityLayerConform <code>true</code>, if the created signature
- * is to be conform to the Security Layer specification.
+ *
+ * @param securityLayerConform <code>true</code>, if the created signature is to
+ * be conform to the Security Layer specification.
*/
public void setSecurityLayerConform(boolean securityLayerConform) {
this.securityLayerConform = securityLayerConform;
}
-
public void setDigestMethod(String digestMethod) {
- this.digestMethod = digestMethod;
+ this.digestMethod = digestMethod;
}
-
+ @Override
public String getMimeType() {
- return mimeType;
+ return mimeType;
}
+ @Override
public boolean includeData() {
- return this.includeData;
+ return this.includeData;
+ }
+
+ @Override
+ public boolean isPAdESConform() {
+ return this.isPAdESConform;
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java
index ab807ae..2247090 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/cmsverify/CMSSignatureVerificationProfileImpl.java
@@ -24,40 +24,42 @@
package at.gv.egovernment.moa.spss.server.iaik.cmsverify;
import iaik.pki.PKIProfile;
+import iaik.server.modules.SignatureVerificationProfile;
import iaik.server.modules.cmsverify.CMSSignatureVerificationProfile;
/**
* An implementation of the <code>CMSSignatureVerificationProfile</code>
* interface.
- *
+ *
* @see iaik.server.modules.cmsverify.CMSSignatureVerificationProfile
* @author Patrick Peck
* @version $Id$
*/
public class CMSSignatureVerificationProfileImpl implements CMSSignatureVerificationProfile {
- /** The profile for validating the certificate. */
- private PKIProfile certificateValidationProfile;
+ /** The profile for validating the certificate. */
+ private PKIProfile certificateValidationProfile;
- /**
- * @see iaik.server.modules.cmsverify.CMSSignatureVerificationProfile#getCertificateValidationProfile()
- */
- public PKIProfile getCertificateValidationProfile() {
- return certificateValidationProfile;
- }
+ /**
+ * @see iaik.server.modules.cmsverify.CMSSignatureVerificationProfile#getCertificateValidationProfile()
+ */
+ @Override
+ public PKIProfile getCertificateValidationProfile() {
+ return certificateValidationProfile;
+ }
- /**
- * Sets the profile for validating the signer certificate.
- *
- * @param certificateValidationProfile
- * The certificate validation profile to set.
- */
- public void setCertificateValidationProfile(PKIProfile certificateValidationProfile) {
- this.certificateValidationProfile = certificateValidationProfile;
- }
+ /**
+ * Sets the profile for validating the signer certificate.
+ *
+ * @param certificateValidationProfile The certificate validation profile to
+ * set.
+ */
+ public void setCertificateValidationProfile(PKIProfile certificateValidationProfile) {
+ this.certificateValidationProfile = certificateValidationProfile;
+ }
- @Override
- public String getTargetLevel() {
- return CMSSignatureVerificationProfile.LEVEL_LTA;
- }
+ @Override
+ public String getTargetLevel() {
+ return SignatureVerificationProfile.LEVEL_LTA;
+ }
}
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 785c85b..18a9f9c 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
@@ -3,6 +3,6 @@ package at.gv.egovernment.moa.spss.server.iaik.cmsverify;
import iaik.server.modules.pdfverify.PDFSignatureVerificationProfile;
public class PDFSignatureVerificationProfileImpl extends CMSSignatureVerificationProfileImpl
- implements PDFSignatureVerificationProfile {
+ implements PDFSignatureVerificationProfile {
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java
index 90e6793..1cd4b64 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractKeyModuleConfigurationImpl.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.iaik.config;
import iaik.server.modules.keys.KeyModuleConfiguration;
@@ -29,22 +28,22 @@ import iaik.server.modules.keys.KeyModuleConfiguration;
/**
* Base implementation class for the <code>KeyModuleConfiguration</code>
* interface and the interfaces derived from it.
- *
+ *
* @see iaik.server.modules.keys.KeyModuleConfiguration
* @author Patrick Peck
* @version $Id$
*/
public abstract class AbstractKeyModuleConfigurationImpl
- implements KeyModuleConfiguration {
+ implements KeyModuleConfiguration {
+
+ /** The module ID. */
+ private final String moduleID;
- /** The module ID. */
- private String moduleID;
-
/**
* Creata new <code>AbstractKeyModuleConfigurationImpl</code>.
- *
+ *
* @param moduleID The key module ID of this
- * <code>KeyModuleConfiguration</code>.
+ * <code>KeyModuleConfiguration</code>.
*/
public AbstractKeyModuleConfigurationImpl(String moduleID) {
this.moduleID = moduleID;
@@ -53,6 +52,7 @@ public abstract class AbstractKeyModuleConfigurationImpl
/**
* @see iaik.server.modules.keys.KeyModuleConfiguration#getModuleID()
*/
+ @Override
public String getModuleID() {
return moduleID;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java
index e2d828b..a9dfe2d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/AbstractObservableConfiguration.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.iaik.config;
import java.util.ArrayList;
@@ -34,18 +33,19 @@ import iaik.pki.store.observer.Observer;
/**
* A base class for observable configuration data.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public abstract class AbstractObservableConfiguration implements Observable {
/** The observers registered with this <code>Observable</code>. */
- private List observers = new ArrayList();
+ private final List observers = new ArrayList();
/**
* @see iaik.pki.store.observer.Observable#addObserver(iaik.pki.store.observer.Observer)
*/
+ @Override
public void addObserver(Observer observer) {
observers.add(observer);
}
@@ -53,6 +53,7 @@ public abstract class AbstractObservableConfiguration implements Observable {
/**
* @see iaik.pki.store.observer.Observable#removeObserver(iaik.pki.store.observer.Observer)
*/
+ @Override
public boolean removeObserver(Observer observer) {
return observers.remove(observer);
}
@@ -60,13 +61,14 @@ public abstract class AbstractObservableConfiguration implements Observable {
/**
* @see iaik.pki.store.observer.Observable#notify(iaik.pki.store.observer.NotificationData)
*/
+ @Override
public void notify(NotificationData data) {
Iterator iter = observers.iterator();
for (iter = observers.iterator(); iter.hasNext();) {
- Observer observer = (Observer) iter.next();
+ final Observer observer = (Observer) iter.next();
observer.notify(data);
}
}
-
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java
index 4a300a2..ff9927b 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ArchiveConfigurationImpl.java
@@ -21,76 +21,68 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
-import iaik.pki.store.revocation.archive.ArchiveConfiguration;
-import iaik.pki.store.revocation.archive.ArchiveParameters;
-import iaik.pki.store.revocation.archive.ArchiveTypes;
-
import java.sql.Driver;
import java.sql.DriverManager;
import java.util.Enumeration;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
+import iaik.pki.store.revocation.archive.ArchiveConfiguration;
+import iaik.pki.store.revocation.archive.ArchiveParameters;
+import iaik.pki.store.revocation.archive.ArchiveTypes;
/**
- * An implementation of the <code>ArchiveConfiguration</code> interface
- * using configuration data provided by the MOA configuration file.
- *
+ * An implementation of the <code>ArchiveConfiguration</code> interface using
+ * configuration data provided by the MOA configuration file.
+ *
* @see iaik.pki.store.revocation.archive.ArchiveConfiguration
* @author Patrick Peck
* @version $Id$
*/
public class ArchiveConfigurationImpl
- extends AbstractObservableConfiguration
- implements ArchiveConfiguration {
-
+ extends AbstractObservableConfiguration
+ implements ArchiveConfiguration {
+
/** The configuration parameters of the archive. */
- private ArchiveParameters archiveParameters;
+ private final ArchiveParameters archiveParameters;
/**
* Create a new <code>ArchiveConfigurationImpl</code>.
- *
- * @param config The MOA configuration from which the configuration data is being read.
+ *
+ * @param config The MOA configuration from which the configuration data is
+ * being read.
*/
- public ArchiveConfigurationImpl(ConfigurationProvider config)
- {
- String jdbcUrl = config.getRevocationArchiveJDBCURL();
+ public ArchiveConfigurationImpl(ConfigurationProvider config) {
+ final String jdbcUrl = config.getRevocationArchiveJDBCURL();
this.archiveParameters = new DataBaseArchiveParameterImpl(jdbcUrl);
-
- // Register JDBC driver class
- if (jdbcUrl != null)
- {
- String jdbcDriverClass = config.getRevocationArchiveJDBCDriverClass();
- try
- {
+
+ // Register JDBC driver class
+ if (jdbcUrl != null) {
+ final String jdbcDriverClass = config.getRevocationArchiveJDBCDriverClass();
+ try {
Class.forName(jdbcDriverClass);
- }
- catch (ClassNotFoundException e)
- {
+ } catch (final ClassNotFoundException e) {
// TODO 20030709 GK Improve exception handling
- throw new RuntimeException("JDBC driver class \"" + jdbcDriverClass + " could not be found.");
+ throw new RuntimeException("JDBC driver class \"" + jdbcDriverClass + " could not be found.");
}
-
- Enumeration regDrivers = DriverManager.getDrivers();
+
+ final Enumeration regDrivers = DriverManager.getDrivers();
boolean isRegistered = false;
- while (regDrivers.hasMoreElements())
- {
- Object currentDriver = regDrivers.nextElement();
- if (jdbcDriverClass.equals(currentDriver.getClass().getName())) isRegistered = true;
- }
- if (!isRegistered)
- {
- // Workaround for a driver which does not register itselve at invocation of Class.forName(drvname)
- try
- {
- DriverManager.registerDriver((Driver)Class.forName(jdbcDriverClass).newInstance());
+ while (regDrivers.hasMoreElements()) {
+ final Object currentDriver = regDrivers.nextElement();
+ if (jdbcDriverClass.equals(currentDriver.getClass().getName())) {
+ isRegistered = true;
}
- catch (Exception e)
- {
+ }
+ if (!isRegistered) {
+ // Workaround for a driver which does not register itselve at invocation of
+ // Class.forName(drvname)
+ try {
+ DriverManager.registerDriver((Driver) Class.forName(jdbcDriverClass).newInstance());
+ } catch (final Exception e) {
// TODO 20030709 GK Improve exception handling
- throw new RuntimeException("Registering JDBC driver \"" + jdbcDriverClass + " failed.");
+ throw new RuntimeException("Registering JDBC driver \"" + jdbcDriverClass + " failed.");
}
}
}
@@ -98,11 +90,13 @@ public class ArchiveConfigurationImpl
/**
* Return the type of archive.
- *
+ *
* This will always return <code>ArchiveTypes.DATABASE</code>.
+ *
* @return <code>ArchiveTypes.DATABASE</code>.
* @see iaik.pki.store.revocation.archive.ArchiveConfiguration#getType()
*/
+ @Override
public String getType() {
return ArchiveTypes.DATABASE;
}
@@ -110,10 +104,11 @@ public class ArchiveConfigurationImpl
/**
* Return the <code>ArchiveParameters</code> describing this
* <code>ArchiveConfiguration</code>.
- *
+ *
* @return The archive parameters.
* @see iaik.pki.store.revocation.archive.ArchiveConfiguration#getArchiveParameters()
*/
+ @Override
public ArchiveParameters getArchiveParameters() {
return archiveParameters;
}
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 d752a63..d1b776b 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
@@ -23,13 +23,6 @@
package at.gv.egovernment.moa.spss.server.iaik.config;
-import iaik.logging.TransactionId;
-import iaik.pki.revocation.RevocationSourceTypes;
-import iaik.pki.store.revocation.RevocationInfoRetriever;
-import iaik.pki.store.revocation.RevocationSource;
-import iaik.pki.store.revocation.RevocationStoreException;
-import iaik.pki.ldap.Handler;
-
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
@@ -39,6 +32,12 @@ import java.util.Collection;
import java.util.Date;
import at.gv.egovernment.moaspss.logging.Logger;
+import iaik.logging.TransactionId;
+import iaik.pki.ldap.Handler;
+import iaik.pki.revocation.RevocationSourceTypes;
+import iaik.pki.store.revocation.RevocationInfoRetriever;
+import iaik.pki.store.revocation.RevocationSource;
+import iaik.pki.store.revocation.RevocationStoreException;
/**
* A customized implementation of
@@ -47,55 +46,56 @@ import at.gv.egovernment.moaspss.logging.Logger;
* {@link iaik.pki.store.revocation.CRLRetriever} to overcome a classloader
* problem in connection with the {@link java.net.URL} class in a Tomcat
* deployment environment.
- *
+ *
* @author Gregor Karlinger
* @version $$
*/
public class CRLRetriever implements RevocationInfoRetriever {
-
- private int connectTimeout = 5;
- private int readTimeout = 5;
-
-
- public void update(RevocationSource source, Collection supplementalRequestData, TransactionId tid)
- throws RevocationStoreException {
- if (source == null) {
- throw new NullPointerException("RevocationSource parameter mustn't be null.");
- }
- Logger.info("Downloading crl from " + source.getUri());
- if (!source.getType().equals(RevocationSourceTypes.CRL)) {
- throw new RevocationStoreException(source.getType() + " not supported", null, getClass().getName() + ":1");
- }
- try {
- URL crlUrl;
- try {
- crlUrl = new URL(source.getUri());
- } catch (MalformedURLException e) {
- // Workaround for classloader problem with deployment in Tomcat
- // 4.1
- URLStreamHandler handler = new Handler();
- crlUrl = new URL(null, source.getUri(), handler);
- }
- URLConnection con = crlUrl.openConnection();
- con.setConnectTimeout(connectTimeout);
- con.setReadTimeout(readTimeout);
- InputStream crlInputStream = con.getInputStream();
- source.readFrom(crlInputStream, tid);
- source.setDownloadTime(new Date());
- crlInputStream.close();
- } catch (Exception iox) {
- Logger.warn("Cannot retrieve crl", iox);
- throw new RevocationStoreException("Cannot retrieve CRL", iox, getClass().getName() + ":1");
- }
- }
- @Override
- public void setConnectTimeout(int arg0) {
- this.connectTimeout = arg0;
- }
+ private int connectTimeout = 5;
+ private int readTimeout = 5;
+
+ @Override
+ public void update(RevocationSource source, Collection supplementalRequestData, TransactionId tid)
+ throws RevocationStoreException {
+ if (source == null) {
+ throw new NullPointerException("RevocationSource parameter mustn't be null.");
+ }
+ Logger.info("Downloading crl from " + source.getUri());
+ if (!source.getType().equals(RevocationSourceTypes.CRL)) {
+ throw new RevocationStoreException(source.getType() + " not supported", null, getClass().getName()
+ + ":1");
+ }
+ try {
+ URL crlUrl;
+ try {
+ crlUrl = new URL(source.getUri());
+ } catch (final MalformedURLException e) {
+ // Workaround for classloader problem with deployment in Tomcat
+ // 4.1
+ final URLStreamHandler handler = new Handler();
+ crlUrl = new URL(null, source.getUri(), handler);
+ }
+ final URLConnection con = crlUrl.openConnection();
+ con.setConnectTimeout(connectTimeout);
+ con.setReadTimeout(readTimeout);
+ final InputStream crlInputStream = con.getInputStream();
+ source.readFrom(crlInputStream, tid);
+ source.setDownloadTime(new Date());
+ crlInputStream.close();
+ } catch (final Exception iox) {
+ Logger.warn("Cannot retrieve crl", iox);
+ throw new RevocationStoreException("Cannot retrieve CRL", iox, getClass().getName() + ":1");
+ }
+ }
+
+ @Override
+ public void setConnectTimeout(int arg0) {
+ this.connectTimeout = arg0;
+ }
- @Override
- public void setReadTimeout(int arg0) {
- this.readTimeout = arg0;
- }
+ @Override
+ public void setReadTimeout(int arg0) {
+ this.readTimeout = arg0;
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java
index 1aa5f6a..052a3c5 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CertStoreConfigurationImpl.java
@@ -23,74 +23,71 @@
package at.gv.egovernment.moa.spss.server.iaik.config;
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.gv.egovernment.moa.sig.tsl.exception.TslException;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
-import at.gv.egovernment.moa.spss.server.logging.IaikLog;
-import at.gv.egovernment.moa.spss.server.logging.TransactionId;
import at.gv.egovernment.moa.spss.tsl.TSLServiceFactory;
-import iaik.logging.Log;
import iaik.pki.store.certstore.CertStoreConfiguration;
import iaik.pki.store.certstore.CertStoreParameters;
import iaik.pki.store.certstore.directory.DirectoryCertStoreParameters;
-import iaik.pki.store.certstore.directory.DirectoryStoreException;
-import iaik.pki.store.certstore.utils.DirectoryCertStoreConverter;
/**
* An implementation of the <code>CertStoreConfiguration</code> interface based
* on MOA configuration data.
- *
+ *
* @see iaik.pki.store.certstore.CertStoreConfiguration
* @author Patrick Peck
* @version $Id$
*/
-public class CertStoreConfigurationImpl extends AbstractObservableConfiguration implements CertStoreConfiguration {
+public class CertStoreConfigurationImpl extends AbstractObservableConfiguration implements
+ CertStoreConfiguration {
+
+ private static final Logger logger = LoggerFactory.getLogger(CertStoreConfigurationImpl.class);
+
+ /** The configuration parameters of the <code>CertStore</code>. */
+ private CertStoreParameters[] parameters;
+
+ /**
+ * Create a new <code>CertStoreConfigurationImpl</code>.
+ *
+ * @param config The MOA configuration from which the configuration data is
+ * being read.
+ */
+ public CertStoreConfigurationImpl(ConfigurationProvider config) {
+ final String certStoreRoot = config.getCertStoreLocation();
+
+ final DirectoryCertStoreParameters dirParameters = new DirectoryCertStoreParametersImpl(
+ "MOA Directory CertStore",
+ certStoreRoot, true, false);
- private static final Logger logger = LoggerFactory.getLogger(CertStoreConfigurationImpl.class);
+ if (TSLServiceFactory.isInitialized()) {
+ try {
+ final CertStoreParameters tslCertStore = TSLServiceFactory.getTSLServiceClient()
+ .getCertStoreWithTSLCertificates();
+ parameters = new CertStoreParameters[] { dirParameters, tslCertStore };
- /** The configuration parameters of the <code>CertStore</code>. */
- private CertStoreParameters[] parameters;
+ } catch (final TslException e) {
+ logger.warn("TSL based CertStore initialisation FAILED.", e);
+ logger.warn("Only Directory based CertStore is used ... ");
+ parameters = new CertStoreParameters[] { dirParameters };
+ }
- /**
- * Create a new <code>CertStoreConfigurationImpl</code>.
- *
- * @param config
- * The MOA configuration from which the configuration data is
- * being read.
- */
- public CertStoreConfigurationImpl(ConfigurationProvider config) {
- String certStoreRoot = config.getCertStoreLocation();
+ } else {
+ logger.info("Trust-Status List support is not active. Use only Directory based CertStore.");
+ parameters = new CertStoreParameters[] { dirParameters };
- DirectoryCertStoreParameters dirParameters = new DirectoryCertStoreParametersImpl("MOA Directory CertStore",
- certStoreRoot, true, false);
+ }
- if (TSLServiceFactory.isInitialized()) {
- try {
- CertStoreParameters tslCertStore = TSLServiceFactory.getTSLServiceClient().getCertStoreWithTSLCertificates();
- parameters = new CertStoreParameters[] { dirParameters, tslCertStore};
-
- } catch (TslException e) {
- logger.warn("TSL based CertStore initialisation FAILED.", e);
- logger.warn("Only Directory based CertStore is used ... ");
- parameters = new CertStoreParameters[] { dirParameters };
- }
-
- } else
- parameters = new CertStoreParameters[] { dirParameters };
-
- }
+ }
- /**
- * @see iaik.pki.store.certstore.CertStoreConfiguration#getParameters()
- */
- public CertStoreParameters[] getParameters() {
- return parameters;
- }
+ /**
+ * @see iaik.pki.store.certstore.CertStoreConfiguration#getParameters()
+ */
+ @Override
+ public CertStoreParameters[] getParameters() {
+ return parameters;
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java
index dff78d6..891f078 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImpl.java
@@ -21,43 +21,41 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import iaik.logging.LoggerConfig;
-import iaik.pki.PKIConfiguration;
-import iaik.server.ConfigurationData;
-
+import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moa.spss.server.config.HardwareCryptoModule;
import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule;
-import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule;
+import iaik.logging.LoggerConfig;
+import iaik.pki.PKIConfiguration;
+import iaik.server.ConfigurationData;
/**
- * An implementation of the <code>ConfigurationData</code> interface using
- * MOA configuration data.
- *
+ * An implementation of the <code>ConfigurationData</code> interface using MOA
+ * configuration data.
+ *
* @see iaik.server.ConfigurationData
* @author Patrick Peck
* @version $Id$
*/
public class ConfigurationDataImpl implements ConfigurationData {
/** PKI configuration data. */
- private PKIConfiguration pkiConfiguration;
+ private final PKIConfiguration pkiConfiguration;
/** Crypto modules configuration data. */
- private List cryptoModuleConfigurations;
+ private final List cryptoModuleConfigurations;
/** Key modules configuration data. */
- private List keyModuleConfigurations;
+ private final List keyModuleConfigurations;
/** Logging configuration data. */
- private LoggerConfig loggerConfig;
+ private final LoggerConfig loggerConfig;
/**
* Create a new <code>ConfigurationDataImpl</code>.
- *
+ *
* @param config The underlying MOA configuration data.
*/
public ConfigurationDataImpl(ConfigurationProvider config) {
@@ -69,54 +67,55 @@ public class ConfigurationDataImpl implements ConfigurationData {
/**
* Build the list of <code>CryptoModuleConfiguration</code>s.
- *
+ *
* @param config The underlying MOA configuration data.
- * @return The list of <code>CryptoModuleConfiguration</code>s configured in
- * the MOA configuration.
+ * @return The list of <code>CryptoModuleConfiguration</code>s configured in the
+ * MOA configuration.
*/
private List buildCryptoModuleConfigurations(ConfigurationProvider config) {
- List modules = new ArrayList();
- Iterator iter = config.getHardwareCryptoModules().iterator();
-
+ final List modules = new ArrayList();
+ final Iterator iter = config.getHardwareCryptoModules().iterator();
+
while (iter.hasNext()) {
- HardwareCryptoModule module = (HardwareCryptoModule) iter.next();
+ final HardwareCryptoModule module = (HardwareCryptoModule) iter.next();
modules.add(new HardwareCryptoModuleConfigurationImpl(module));
}
-
+
return modules;
}
-
+
/**
* Build the list of <code>KeyModuleConfiguration</code>s.
- *
+ *
* @param config The underlying MOA configuration data.
* @return The list of <code>KeyModuleConfiguration</code>s configured in the
- * MOA configuration.
+ * MOA configuration.
*/
private List buildKeyModuleConfigurations(ConfigurationProvider config) {
- List keys = new ArrayList();
+ final List keys = new ArrayList();
Iterator iter;
-
+
// add the hardware keys
iter = config.getHardwareKeyModules().iterator();
while (iter.hasNext()) {
- HardwareKeyModule key = (HardwareKeyModule) iter.next();
+ final HardwareKeyModule key = (HardwareKeyModule) iter.next();
keys.add(new HardwareKeyModuleConfigurationImpl(key));
}
-
+
// add the software keys
iter = config.getSoftwareKeyModules().iterator();
while (iter.hasNext()) {
- SoftwareKeyModule key = (SoftwareKeyModule) iter.next();
+ final SoftwareKeyModule key = (SoftwareKeyModule) iter.next();
keys.add(new SoftwareKeyModuleConfigurationImpl(key));
}
-
+
return keys;
}
/**
* @see iaik.server.ConfigurationData#getPKIConfiguration()
*/
+ @Override
public PKIConfiguration getPKIConfiguration() {
return pkiConfiguration;
}
@@ -124,6 +123,7 @@ public class ConfigurationDataImpl implements ConfigurationData {
/**
* @see iaik.server.ConfigurationData#getCryptoModuleConfigurations()
*/
+ @Override
public List getCryptoModuleConfigurations() {
return cryptoModuleConfigurations;
}
@@ -131,6 +131,7 @@ public class ConfigurationDataImpl implements ConfigurationData {
/**
* @see iaik.server.ConfigurationData#getKeyModuleConfigurations()
*/
+ @Override
public List getKeyModuleConfigurations() {
return keyModuleConfigurations;
}
@@ -138,6 +139,7 @@ public class ConfigurationDataImpl implements ConfigurationData {
/**
* @see iaik.server.ConfigurationData#getLoggerConfig()
*/
+ @Override
public LoggerConfig getLoggerConfig() {
return loggerConfig;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java
index f4658a2..22cceeb 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DataBaseArchiveParameterImpl.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
import iaik.pki.store.revocation.archive.DataBaseArchiveParameters;
/**
* An implementation of the <code>DataBaseArchiveParameter</code> interface.
- *
+ *
* @see iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter
* @author Patrick Peck
* @version $Id$
@@ -36,11 +35,11 @@ import iaik.pki.store.revocation.archive.DataBaseArchiveParameters;
public class DataBaseArchiveParameterImpl implements DataBaseArchiveParameters {
/** The JDBC URL for accessing the archive. */
- private String jDBCUrl;
+ private final String jDBCUrl;
/**
* Create a new <code>DataBaseArchiveParameterImpl</code>.
- *
+ *
* @param jDBCUrl The JDBC URL of the archive.
*/
public DataBaseArchiveParameterImpl(String jDBCUrl) {
@@ -50,6 +49,7 @@ public class DataBaseArchiveParameterImpl implements DataBaseArchiveParameters {
/**
* @see iaik.pki.store.revocation.archive.db.DataBaseArchiveParameter#getJDBCUrl()
*/
+ @Override
public String getJDBCUrl() {
return jDBCUrl;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java
index 39da9cf..e48c7e7 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/DirectoryCertStoreParametersImpl.java
@@ -21,50 +21,48 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
import java.util.Collections;
import java.util.Set;
-import iaik.pki.store.certstore.CertStoreParameters;
import iaik.pki.store.certstore.CertStoreTypes;
import iaik.pki.store.certstore.directory.DirectoryCertStoreParameters;
/**
* An implementation of the <code>DirectoryCertStoreParameters</code> interface.
- *
+ *
* @see iaik.pki.store.certstore.directory.DirectoryCertStoreParameters
* @author Patrick Peck
* @version $Id$
*/
public class DirectoryCertStoreParametersImpl
- implements DirectoryCertStoreParameters {
+ implements DirectoryCertStoreParameters {
/** The root directory of the <code>CertStore</code>. */
- private String rootDirectory;
+ private final String rootDirectory;
/** Whether a new directory may be created. */
- private boolean createNew;
+ private final boolean createNew;
/** The <code>CertStore</code> ID. */
- private String id;
+ private final String id;
/** Whether the <code>CertStore</code> is read-only. */
- private boolean readOnly;
+ private final boolean readOnly;
/**
* Create a new <code>DirectoryCertStoreParameterImpl</code>.
- *
- * @param id The <code>CertStore</code> ID.
+ *
+ * @param id The <code>CertStore</code> ID.
* @param rootDirectory The root directory of the <code>CertStore</code>.
- * @param createNew Whether a new directory may be created.
- * @param readOnly Whether the <code>CertStore</code> is read-only.
+ * @param createNew Whether a new directory may be created.
+ * @param readOnly Whether the <code>CertStore</code> is read-only.
*/
public DirectoryCertStoreParametersImpl(
- String id,
- String rootDirectory,
- boolean createNew,
- boolean readOnly) {
-
- this.id = id;
+ String id,
+ String rootDirectory,
+ boolean createNew,
+ boolean readOnly) {
+
+ this.id = id;
this.rootDirectory = rootDirectory;
this.createNew = createNew;
this.readOnly = readOnly;
@@ -73,6 +71,7 @@ public class DirectoryCertStoreParametersImpl
/**
* @see iaik.pki.store.certstore.directory.DirectoryCertStoreParameters#getRootDirectory()
*/
+ @Override
public String getRootDirectory() {
return rootDirectory;
}
@@ -80,6 +79,7 @@ public class DirectoryCertStoreParametersImpl
/**
* @see iaik.pki.store.certstore.directory.DirectoryCertStoreParameters#createNew()
*/
+ @Override
public boolean createNew() {
return createNew;
}
@@ -87,6 +87,7 @@ public class DirectoryCertStoreParametersImpl
/**
* @see iaik.pki.store.certstore.CertStoreParameters#getId()
*/
+ @Override
public String getId() {
return id;
}
@@ -94,6 +95,7 @@ public class DirectoryCertStoreParametersImpl
/**
* @see iaik.pki.store.certstore.CertStoreParameters#isReadOnly()
*/
+ @Override
public boolean isReadOnly() {
return readOnly;
}
@@ -102,14 +104,15 @@ public class DirectoryCertStoreParametersImpl
* @return <code>CertStoreTypes.DIRECTORY</code>
* @see iaik.pki.store.certstore.CertStoreParameters#getType()
*/
+ @Override
public String getType() {
return CertStoreTypes.DIRECTORY;
}
-@Override
-public Set getVirtualStores() {
- // TODO AFITZEK IMPLEMENT THIS METHOD
- return Collections.EMPTY_SET;
-}
+ @Override
+ public Set getVirtualStores() {
+ // TODO AFITZEK IMPLEMENT THIS METHOD
+ return Collections.EMPTY_SET;
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java
index c9904c5..6275e08 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareCryptoModuleConfigurationImpl.java
@@ -21,32 +21,30 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
-import iaik.server.modules.crypto.HardwareCryptoModuleConfiguration;
-
import at.gv.egovernment.moa.spss.server.config.HardwareCryptoModule;
+import iaik.server.modules.crypto.HardwareCryptoModuleConfiguration;
/**
* An implementation of the <code>HardwareCryptoModuleConfiguration</code>
* wrapping a <code>HardwareCryptoModule</code> from the MOA configuration.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class HardwareCryptoModuleConfigurationImpl
- implements HardwareCryptoModuleConfiguration {
-
- /** The wrapped <code>HardwareCryptoModule</code>. */
- private HardwareCryptoModule module;
-
+ implements HardwareCryptoModuleConfiguration {
+
+ /** The wrapped <code>HardwareCryptoModule</code>. */
+ private final HardwareCryptoModule module;
+
/**
* Create a new <code>HardwareCryptoModuleConfigurationImpl</code>.
- *
+ *
* @param module The <code>HardwareCryptoModule</code> from the underlying MOA
- * configuration.
- */
+ * configuration.
+ */
public HardwareCryptoModuleConfigurationImpl(HardwareCryptoModule module) {
this.module = module;
}
@@ -54,6 +52,7 @@ public class HardwareCryptoModuleConfigurationImpl
/**
* @see iaik.server.modules.crypto.HardwareCryptoModuleConfiguration#getModuleName()
*/
+ @Override
public String getModuleName() {
return module.getName();
}
@@ -61,6 +60,7 @@ public class HardwareCryptoModuleConfigurationImpl
/**
* @see iaik.server.modules.crypto.HardwareCryptoModuleConfiguration#getSlotID()
*/
+ @Override
public String getSlotID() {
return module.getSlotID();
}
@@ -68,6 +68,7 @@ public class HardwareCryptoModuleConfigurationImpl
/**
* @see iaik.server.modules.crypto.HardwareCryptoModuleConfiguration#getUserPIN()
*/
+ @Override
public char[] getUserPIN() {
return module.getUserPIN().toCharArray();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java
index 05f5633..9b37c60 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/HardwareKeyModuleConfigurationImpl.java
@@ -21,34 +21,32 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
-import iaik.server.modules.keys.HardwareKeyModuleConfiguration;
-
import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule;
+import iaik.server.modules.keys.HardwareKeyModuleConfiguration;
/**
* An implementation of the <code>HardwareKeyModuleConfiguration</code>
* interface wrapping a <code>HardwareKeyModule</code> from the MOA
* configuration.
- *
+ *
* @see iaik.server.modules.keys.HardwareKeyModuleConfiguration
* @author Patrick Peck
* @version $Id$
*/
public class HardwareKeyModuleConfigurationImpl
- extends AbstractKeyModuleConfigurationImpl
- implements HardwareKeyModuleConfiguration {
+ extends AbstractKeyModuleConfigurationImpl
+ implements HardwareKeyModuleConfiguration {
/** The wrapped <code>HardwareKeyModule</code>. */
- private HardwareKeyModule keyModule;
+ private final HardwareKeyModule keyModule;
/**
* Create a new <code>HardwareKeyModuleConfigurationImpl</code>.
- *
- * @param keyModule The <code>HardwareKeyModule</code> from the underlying
- * MOA configuration.
+ *
+ * @param keyModule The <code>HardwareKeyModule</code> from the underlying MOA
+ * configuration.
*/
public HardwareKeyModuleConfigurationImpl(HardwareKeyModule keyModule) {
super(keyModule.getId());
@@ -58,6 +56,7 @@ public class HardwareKeyModuleConfigurationImpl
/**
* @see iaik.server.modules.keys.HardwareKeyModuleConfiguration#getModuleName()
*/
+ @Override
public String getModuleName() {
return keyModule.getName();
}
@@ -65,6 +64,7 @@ public class HardwareKeyModuleConfigurationImpl
/**
* @see iaik.server.modules.keys.HardwareKeyModuleConfiguration#getSlotID()
*/
+ @Override
public String getSlotID() {
return keyModule.getSlotID();
}
@@ -72,6 +72,7 @@ public class HardwareKeyModuleConfigurationImpl
/**
* @see iaik.server.modules.keys.HardwareKeyModuleConfiguration#getUserPIN()
*/
+ @Override
public char[] getUserPIN() {
return keyModule.getUserPIN().toCharArray();
}
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 44600db..8ca19e4 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
@@ -21,29 +21,18 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
-import iaik.cms.IaikCCProvider;
-import iaik.esi.sva.Configuration;
-import iaik.pki.store.revocation.RevocationFactory;
-import iaik.pki.store.revocation.RevocationSourceStore;
-import iaik.pki.store.truststore.TrustStoreFactory;
-import iaik.security.ec.provider.ECCelerate;
-import iaik.server.ConfigurationData;
-import iaik.server.Configurator;
-import iaik.server.modules.keys.KeyEntryID;
-import iaik.server.modules.keys.KeyModule;
-import iaik.server.modules.keys.KeyModuleFactory;
-
-import java.security.Provider;
-import java.security.Security;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.slf4j.LoggerFactory;
+
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;
@@ -54,76 +43,103 @@ 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;
+import iaik.logging.LogFactory;
+import iaik.pki.store.revocation.RevocationFactory;
+import iaik.pki.store.revocation.RevocationSourceStore;
+import iaik.pki.store.truststore.TrustStoreFactory;
+import iaik.server.ConfigurationData;
+import iaik.server.Configurator;
+import iaik.server.modules.keys.KeyEntryID;
+import iaik.server.modules.keys.KeyModule;
+import iaik.server.modules.keys.KeyModuleFactory;
/**
* A class responsible for configuring the IAIK MOA modules.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class IaikConfigurator {
+ private static final org.slf4j.Logger logger = LoggerFactory.getLogger(IaikConfigurator.class);
+
/** The warnings encountered during configuration. */
private List warnings = new ArrayList();
/**
* Configure the IAIK MOA subsystem.
- *
- *
+ *
+ *
* @param moaConfig The underlying MOA configuration.
* @return Returns the config data of the underlying MOA subsystem
- * @throws ConfigurationException An error occurred configuring the IAIK
- * MOA subsystem.
+ * @throws ConfigurationException An error occurred configuring the IAIK MOA
+ * subsystem.
*/
public ConfigurationData configure(ConfigurationProvider moaConfig)
- throws ConfigurationException {
- ConfigurationData configData = new ConfigurationDataImpl(moaConfig);
-
+ throws ConfigurationException {
+ final ConfigurationData configData = new ConfigurationDataImpl(moaConfig);
+
warnings = new ArrayList();
try {
- TransactionId transId = new TransactionId("IaikConfigurator");
-
- //iaik.esi.sva.Configuration config = new Configuration(IaikConfigurator.class.getResourceAsStream("/sva.config"));
-
- //SecProviderUtils.dumpSecProviders("Starting configuration");
-
+ final TransactionId transId = new TransactionId("IaikConfigurator");
+
+ // iaik.esi.sva.Configuration config = new
+ // Configuration(IaikConfigurator.class.getResourceAsStream("/sva.config"));
+
+ // SecProviderUtils.dumpSecProviders("Starting configuration");
+
+ LogFactory.configure(configData.getLoggerConfig());
+
try {
- iaik.pki.Configurator.initCommon(configData.getLoggerConfig(),
- transId);
- //SecProviderUtils.dumpSecProviders("initCommon");
- String certStoreRoot = moaConfig.getCertStoreLocation();
- CertStoreConverter.convert(certStoreRoot, transId);
+ iaik.pki.Configurator.initCommon(configData.getLoggerConfig(),
+ transId);
+ // SecProviderUtils.dumpSecProviders("initCommon");
+ final String certStoreRoot = moaConfig.getCertStoreLocation();
+ CertStoreConverter.convert(certStoreRoot, transId);
} finally {
- //Security.removeProvider(ECCelerate.getInstance().getName());
+ // Security.removeProvider(ECCelerate.getInstance().getName());
}
-
+
Configurator.init(configData, transId);
-
+
SecProviderUtils.dumpSecProviders("Fully configured!");
-
- // Set customized CRL retriever to overcome a classloader problem when MOA is deployed in Tomcat
- RevocationSourceStore rss = RevocationFactory.getInstance(transId).getRevocationSourceStore();
- //rss.setRetriever(new CRLRetriever(), RevocationSourceTypes.CRL);
- if ((moaConfig.getSoftwareKeyModules().size() > 0) || (moaConfig.getHardwareKeyModules().size() > 0)) {
+
+ // Set customized CRL retriever to overcome a classloader problem when MOA is
+ // deployed in Tomcat
+ final RevocationSourceStore rss = RevocationFactory.getInstance(transId).getRevocationSourceStore();
+ // rss.setRetriever(new CRLRetriever(), RevocationSourceTypes.CRL);
+ if (moaConfig.getSoftwareKeyModules().size() > 0 || moaConfig.getHardwareKeyModules().size() > 0) {
dumpKeyEntryIDs();
}
checkKeyGroupConfig(moaConfig);
TrustStoreFactory.reset();
-
+
return configData;
- } catch (iaik.server.ConfigurationException e) {
+ } catch (final iaik.server.ConfigurationException e) {
+ logException(e);
throw new ConfigurationException("config.08", null, e);
- } catch (Throwable t) {
+
+ } catch (final Throwable t) {
+ logException(t);
throw new ConfigurationException("config.08", null, t);
+
}
}
+ private void logException(Throwable e) {
+ final StringWriter out = new StringWriter();
+ final PrintWriter writer = new PrintWriter(out);
+ e.printStackTrace(writer);
+ logger.error("IAIK_Module error: {}", out.toString());
+
+ }
+
/**
* Return the warnings encountered during configuration.
- *
+ *
* @return The warnings.
- */
+ */
public List getWarnings() {
return warnings;
}
@@ -133,71 +149,71 @@ public class IaikConfigurator {
* <code>KeyModule</code>s to the log file.
*/
private void dumpKeyEntryIDs() {
- MessageProvider msg = MessageProvider.getInstance();
- KeyModule module = KeyModuleFactory.getInstance(new TransactionId("dump"));
- Set keyEntryIds = module.getPrivateKeyEntryIDs();
+ final MessageProvider msg = MessageProvider.getInstance();
+ final KeyModule module = KeyModuleFactory.getInstance(new TransactionId("dump"));
+ final Set keyEntryIds = module.getPrivateKeyEntryIDs();
Iterator iter;
for (iter = keyEntryIds.iterator(); iter.hasNext();) {
- KeyEntryID keyEntryId = (KeyEntryID) iter.next();
+ final KeyEntryID keyEntryId = (KeyEntryID) iter.next();
Logger.info(
- new LogMsg(msg.getMessage("config.19", new Object[] { keyEntryId })));
+ new LogMsg(msg.getMessage("config.19", new Object[] { keyEntryId })));
}
}
/**
- * Check that each key group entry in each key group can be resolved to a
+ * Check that each key group entry in each key group can be resolved to a
* KeyEntryID.
- *
+ *
* Logs a warning for each key group entry that cannot be resolved.
- *
+ *
* @param moaConfig The MOA configuration to check.
*/
private void checkKeyGroupConfig(ConfigurationProvider moaConfig) {
- Map keyGroups = moaConfig.getKeyGroups();
+ final Map keyGroups = moaConfig.getKeyGroups();
Iterator iter;
for (iter = keyGroups.values().iterator(); iter.hasNext();) {
- KeyGroup keyGroup = (KeyGroup) iter.next();
- Set keyGroupEntries = keyGroup.getKeyGroupEntries();
+ final KeyGroup keyGroup = (KeyGroup) iter.next();
+ final Set keyGroupEntries = keyGroup.getKeyGroupEntries();
Iterator kgIter;
for (kgIter = keyGroupEntries.iterator(); kgIter.hasNext();) {
- KeyGroupEntry entry = (KeyGroupEntry) kgIter.next();
+ final KeyGroupEntry entry = (KeyGroupEntry) kgIter.next();
if (!findKeyEntryID(entry)) {
warn(
- "config.31",
- new Object[] {
- keyGroup.getId(),
- entry.getModuleID(),
- entry.getIssuerDN(),
- entry.getSerialNumber()});
+ "config.31",
+ new Object[] {
+ keyGroup.getId(),
+ entry.getModuleID(),
+ entry.getIssuerDN(),
+ entry.getSerialNumber() });
}
}
}
}
/**
- * Find out that a certain KeyGroupEntry could be resolved to a KeyEntryID
- * by the Configurator.
+ * Find out that a certain KeyGroupEntry could be resolved to a KeyEntryID by
+ * the Configurator.
*
* @param keyGroupEntry The key group entry to find.
* @return <code>true</code>, if the <code>keyGroupEntry</code> could be
- * resolved to a <code>KeyEntryID</code>; otherwise <code>false</code>.
+ * resolved to a <code>KeyEntryID</code>; otherwise <code>false</code>.
*/
private boolean findKeyEntryID(KeyGroupEntry keyGroupEntry) {
- KeyModule module = KeyModuleFactory.getInstance(new TransactionId("check"));
- Set keyEntryIDs = module.getPrivateKeyEntryIDs();
+ final KeyModule module = KeyModuleFactory.getInstance(new TransactionId("check"));
+ final Set keyEntryIDs = module.getPrivateKeyEntryIDs();
Iterator iter;
for (iter = keyEntryIDs.iterator(); iter.hasNext();) {
- KeyEntryID entry = (KeyEntryID) iter.next();
+ final KeyEntryID entry = (KeyEntryID) iter.next();
if (entry.getCertificateIssuer().equals(keyGroupEntry.getIssuerDN())
- && entry.getCertificateSerialNumber().equals(
- keyGroupEntry.getSerialNumber())
- && entry.getModuleID().equals(keyGroupEntry.getModuleID())) {
+ && entry.getCertificateSerialNumber().equals(
+ keyGroupEntry.getSerialNumber())
+ && entry.getModuleID().equals(keyGroupEntry.getModuleID())) {
return true;
}
}
@@ -207,14 +223,14 @@ public class IaikConfigurator {
/**
* Log a warning.
- *
+ *
* @param messageId The message ID.
- * @param args Additional parameters for the message.
+ * @param args Additional parameters for the message.
* @see at.gv.egovernment.moa.spss.server.util.MessageProvider
*/
private void warn(String messageId, Object[] args) {
- MessageProvider msg = MessageProvider.getInstance();
- String txt = msg.getMessage(messageId, args);
+ final MessageProvider msg = MessageProvider.getInstance();
+ final String txt = msg.getMessage(messageId, args);
Logger.warn(new LogMsg(txt));
warnings.add(txt);
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 317fcca..7ba2122 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
@@ -21,7 +21,6 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
import java.util.Properties;
@@ -32,24 +31,27 @@ import iaik.logging.LoggerConfig;
/**
* Default implementation of the <code>LoggerConfig</code> interface.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class LoggerConfigImpl implements LoggerConfig {
-
+
/** The implementation of iaik.logging.LogFactory. */
- private static final String DEFAULT_IMPLEMENTATION =
- "at.gv.egovernment.moa.spss.server.logging.IaikLogFactory";
+ private static final String DEFAULT_IMPLEMENTATION =
+ "at.gv.egovernment.moa.spss.server.logging.IaikLogFactory";
+ @Override
public String getFactory() {
return DEFAULT_IMPLEMENTATION;
}
+ @Override
public Properties getProperties() throws LogConfigurationException {
return new Properties();
}
+ @Override
public String getNodeId() {
return LoggingContextManager.getInstance().getLoggingContext().getNodeID();
}
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 6341609..d54bcfd 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
@@ -23,93 +23,96 @@
package at.gv.egovernment.moa.spss.server.iaik.config;
+import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import iaik.pki.PKIConfiguration;
import iaik.pki.pathvalidation.ValidationConfiguration;
import iaik.pki.revocation.RevocationConfiguration;
import iaik.pki.store.certstore.CertStoreConfiguration;
import iaik.pki.store.revocation.archive.ArchiveConfiguration;
-import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
/**
* An implementation of the <code>PKIConfiguration</code> interface using data
* from the MOA configuration.
- *
+ *
* @see iaik.pki.PKIConfiguration
* @author Patrick Peck
* @version $Id$
*/
public class PKIConfigurationImpl implements PKIConfiguration {
- /** The <code>CertStore</code> configuration. */
- private CertStoreConfiguration certStoreConfiguration;
- /** The revocation checking configuration. */
- private RevocationConfiguration revocationConfiguration;
- /** The revocation archive configuration. */
- private ArchiveConfiguration archiveConfiguration;
- /** The certificate validation configuration. */
- private ValidationConfiguration validationConfiguration;
- private int connectionTimeout;
- private int readTimeout;
+ /** The <code>CertStore</code> configuration. */
+ private final CertStoreConfiguration certStoreConfiguration;
+ /** The revocation checking configuration. */
+ private final RevocationConfiguration revocationConfiguration;
+ /** The revocation archive configuration. */
+ private ArchiveConfiguration archiveConfiguration;
+ /** The certificate validation configuration. */
+ private final ValidationConfiguration validationConfiguration;
+ private final int connectionTimeout;
+ private final int readTimeout;
- /**
- * Create a new <code>PKIConfigurationImpl</code>.
- *
- * @param config
- * The underlying MOA configuration which will be used to build
- * the configuration data contained in this object.
- */
- public PKIConfigurationImpl(ConfigurationProvider config) {
+ /**
+ * Create a new <code>PKIConfigurationImpl</code>.
+ *
+ * @param config The underlying MOA configuration which will be used to build
+ * the configuration data contained in this object.
+ */
+ public PKIConfigurationImpl(ConfigurationProvider config) {
- this.certStoreConfiguration = new CertStoreConfigurationImpl(config);
- this.revocationConfiguration = new RevocationConfigurationImpl(config);
+ this.certStoreConfiguration = new CertStoreConfigurationImpl(config);
+ this.revocationConfiguration = new RevocationConfigurationImpl(config);
- boolean archiveInfo = config.getEnableRevocationArchiving();
- if (archiveInfo) {
- this.archiveConfiguration = new ArchiveConfigurationImpl(config);
- } else {
- this.archiveConfiguration = null;
- }
+ final boolean archiveInfo = config.getEnableRevocationArchiving();
+ if (archiveInfo) {
+ this.archiveConfiguration = new ArchiveConfigurationImpl(config);
+ } else {
+ this.archiveConfiguration = null;
+ }
- this.validationConfiguration = new ValidationConfigurationImpl(config);
- this.connectionTimeout = config.getConnectionTimeout();
- this.readTimeout = config.getReadTimeout();
- }
+ this.validationConfiguration = new ValidationConfigurationImpl(config);
+ this.connectionTimeout = config.getConnectionTimeout();
+ this.readTimeout = config.getReadTimeout();
+ }
- /**
- * @see iaik.pki.PKIConfiguration#getCertStoreConfiguration()
- */
- public CertStoreConfiguration getCertStoreConfiguration() {
- return certStoreConfiguration;
- }
+ /**
+ * @see iaik.pki.PKIConfiguration#getCertStoreConfiguration()
+ */
+ @Override
+ public CertStoreConfiguration getCertStoreConfiguration() {
+ return certStoreConfiguration;
+ }
- /**
- * @see iaik.pki.PKIConfiguration#getRevocationConfiguration()
- */
- public RevocationConfiguration getRevocationConfiguration() {
- return revocationConfiguration;
- }
+ /**
+ * @see iaik.pki.PKIConfiguration#getRevocationConfiguration()
+ */
+ @Override
+ public RevocationConfiguration getRevocationConfiguration() {
+ return revocationConfiguration;
+ }
- /**
- * @see iaik.pki.PKIConfiguration#getArchiveConfiguration()
- */
- public ArchiveConfiguration getArchiveConfiguration() {
- return archiveConfiguration;
- }
+ /**
+ * @see iaik.pki.PKIConfiguration#getArchiveConfiguration()
+ */
+ @Override
+ public ArchiveConfiguration getArchiveConfiguration() {
+ return archiveConfiguration;
+ }
- /**
- * @see iaik.pki.PKIConfiguration#getValidationConfiguration()
- */
- public ValidationConfiguration getValidationConfiguration() {
- return validationConfiguration;
- }
+ /**
+ * @see iaik.pki.PKIConfiguration#getValidationConfiguration()
+ */
+ @Override
+ public ValidationConfiguration getValidationConfiguration() {
+ return validationConfiguration;
+ }
- @Override
- public int getConnectTimeout() {
- return this.connectionTimeout;
- }
+ @Override
+ public int getConnectTimeout() {
+ return this.connectionTimeout;
+ }
- @Override
- public int getReadTimeout() {
- return this.readTimeout;
- }
+ @Override
+ public int getReadTimeout() {
+ 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 5df84c9..6aa20cf 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
@@ -23,9 +23,6 @@
package at.gv.egovernment.moa.spss.server.iaik.config;
-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;
@@ -33,81 +30,85 @@ import java.util.Map;
import java.util.Set;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
+import iaik.pki.revocation.RevocationConfiguration;
+import iaik.pki.revocation.dbcrl.config.DBCrlConfig;
/**
* An implementation of the <code>RevocationConfiguration</code> interface using
* MOA configuration data.
- *
+ *
* @see iaik.pki.revocation.RevocationConfiguration
* @author Patrick Peck
* @version $Id$
*/
-public class RevocationConfigurationImpl extends AbstractObservableConfiguration implements RevocationConfiguration {
-
- /**
- * The <code>ConfigurationProvider</code> to read the configuration data
- * from.
- */
- private ConfigurationProvider config;
-
- /**
- * Create a new <code>RevocationConfigurationImpl</code>.
- *
- * @param config
- * The underlying MOA configuration containing the configuration
- * data.
- */
- public RevocationConfigurationImpl(ConfigurationProvider config) {
- this.config = config;
- }
-
- /**
- * @see iaik.pki.revocation.RevocationConfiguration#getAlternativeDistributionPoints
- */
- public Set getAlternativeDistributionPoints(X509Certificate cert, X509Certificate issuer, Date date) {
- return config.getDistributionPoints(cert);
- }
-
- /**
- * @see iaik.pki.revocation.RevocationConfiguration#archiveRevocationInfo(java.lang.String,
- * java.lang.String)
- */
- public boolean archiveRevocationInfo(String type, String uri) {
- return config.getEnableRevocationArchiving();
- }
-
- /**
- * @see iaik.pki.revocation.RevocationConfiguration#getCrlRetentionInterval(java.lang.String)
- */
- public Integer getCrlRetentionInterval(String issuername) {
- Map map = config.getCrlRetentionIntervals();
- Integer interval = (Integer) map.get(issuername);
-
- return interval;
- }
-
- @Override
- public DBCrlConfig getDataBaseCRLConfig() {
- // TODO AFITZEK IMPLEMENT THIS METHOD
- return null;
- }
-
- @Override
- public boolean getKeepRevocationInfo() {
- // TODO AFITZEK IMPLEMENT THIS METHOD
- return false;
- }
-
- @Override
- public Set getPositiveOCSPResponders() {
- // TODO AFITZEK IMPLEMENT THIS METHOD
- return Collections.EMPTY_SET;
- }
-
- @Override
- public boolean skipIndirectCRLCheckForAlternativeDistributionPoints() {
- // TODO AFITZEK IMPLEMENT THIS METHOD
- return false;
- }
+public class RevocationConfigurationImpl extends AbstractObservableConfiguration implements
+ RevocationConfiguration {
+
+ /**
+ * The <code>ConfigurationProvider</code> to read the configuration data from.
+ */
+ private final ConfigurationProvider config;
+
+ /**
+ * Create a new <code>RevocationConfigurationImpl</code>.
+ *
+ * @param config The underlying MOA configuration containing the configuration
+ * data.
+ */
+ public RevocationConfigurationImpl(ConfigurationProvider config) {
+ this.config = config;
+ }
+
+ /**
+ * @see iaik.pki.revocation.RevocationConfiguration#getAlternativeDistributionPoints
+ */
+ @Override
+ public Set getAlternativeDistributionPoints(X509Certificate cert, X509Certificate issuer, Date date) {
+ return config.getDistributionPoints(cert);
+ }
+
+ /**
+ * @see iaik.pki.revocation.RevocationConfiguration#archiveRevocationInfo(java.lang.String,
+ * java.lang.String)
+ */
+ @Override
+ public boolean archiveRevocationInfo(String type, String uri) {
+ return config.getEnableRevocationArchiving();
+ }
+
+ /**
+ * @see iaik.pki.revocation.RevocationConfiguration#getCrlRetentionInterval(java.lang.String)
+ */
+ @Override
+ public Integer getCrlRetentionInterval(String issuername) {
+ final Map map = config.getCrlRetentionIntervals();
+ final Integer interval = (Integer) map.get(issuername);
+
+ return interval;
+ }
+
+ @Override
+ public DBCrlConfig getDataBaseCRLConfig() {
+ // TODO AFITZEK IMPLEMENT THIS METHOD
+ return null;
+ }
+
+ @Override
+ public boolean getKeepRevocationInfo() {
+ // TODO AFITZEK IMPLEMENT THIS METHOD
+ return false;
+ }
+
+ @Override
+ public Set getPositiveOCSPResponders() {
+ // TODO AFITZEK IMPLEMENT THIS METHOD
+ return Collections.EMPTY_SET;
+ }
+
+ @Override
+ public boolean skipIndirectCRLCheckForAlternativeDistributionPoints() {
+ // TODO AFITZEK IMPLEMENT THIS METHOD
+ return false;
+ }
}
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 1aed76e..767b3f2 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
@@ -21,40 +21,39 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
-import iaik.server.modules.keys.ConfigurationException;
-import iaik.server.modules.keys.SoftwareKeyModuleConfiguration;
import at.gv.egovernment.moa.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;
+import iaik.server.modules.keys.ConfigurationException;
+import iaik.server.modules.keys.SoftwareKeyModuleConfiguration;
/**
* An implementation of the <code>SoftwareKeyModuleConfiguration</code> wrapping
* a <code>SoftwareKeyModule</code> from the MOA configuration.
- *
+ *
* @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration
* @author Patrick Peck
* @version $Id$
*/
public class SoftwareKeyModuleConfigurationImpl
- extends AbstractKeyModuleConfigurationImpl
- implements SoftwareKeyModuleConfiguration {
+ extends AbstractKeyModuleConfigurationImpl
+ implements SoftwareKeyModuleConfiguration {
/** The wrapped <code>SoftwareKeyModule</code>. */
- private SoftwareKeyModule keyModule;
+ private final SoftwareKeyModule keyModule;
/**
* Create a new <code>SoftwareKeyModuleConfigurationImpl</code>.
- *
+ *
* @param keyModule The <code>SoftwareKeyModule</code> from the underlying MOA
- * configuration.
+ * configuration.
*/
public SoftwareKeyModuleConfigurationImpl(SoftwareKeyModule keyModule) {
super(keyModule.getId());
@@ -64,6 +63,7 @@ public class SoftwareKeyModuleConfigurationImpl
/**
* @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration#getKeyStoreTypeName()
*/
+ @Override
public String getKeyStoreTypeName() {
return KEY_STORE_TYPE_NAME_PKCS12;
}
@@ -71,17 +71,18 @@ public class SoftwareKeyModuleConfigurationImpl
/**
* @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration#getKeyStoreAsStream()
*/
+ @Override
public InputStream getKeyStoreAsStream() {
- MessageProvider msg = MessageProvider.getInstance();
+ final MessageProvider msg = MessageProvider.getInstance();
try {
- String message =
- msg.getMessage("config.18", new Object[] { keyModule.getFileName()});
+ final String message =
+ msg.getMessage("config.18", new Object[] { keyModule.getFileName() });
Logger.info(new LogMsg(message));
return new FileInputStream(keyModule.getFileName());
- } catch (FileNotFoundException e) {
- String message =
- msg.getMessage("config.09", new Object[] { keyModule.getFileName()});
+ } catch (final FileNotFoundException e) {
+ final String message =
+ msg.getMessage("config.09", new Object[] { keyModule.getFileName() });
throw new ConfigurationException(message, e, null);
}
@@ -90,6 +91,7 @@ public class SoftwareKeyModuleConfigurationImpl
/**
* @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration#getKeyStoreAuthenticationData()
*/
+ @Override
public char[] getKeyStoreAuthenticationData() {
return keyModule.getPassWord().toCharArray();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java
index 9e26fb8..50c3926 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/ValidationConfigurationImpl.java
@@ -21,35 +21,34 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.config;
import java.security.cert.X509Certificate;
import java.security.spec.AlgorithmParameterSpec;
-import iaik.pki.pathvalidation.ValidationConfiguration;
-
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
+import iaik.pki.pathvalidation.ValidationConfiguration;
/**
* An implementation of the <code>ValidationConfiguration</code> interface using
* MOA configuration data.
- *
+ *
* @see iaik.pki.pathvalidation.ValidationConfiguration
* @author Patrick Peck
* @version $Id$
*/
public class ValidationConfigurationImpl
- extends AbstractObservableConfiguration
- implements ValidationConfiguration {
+ extends AbstractObservableConfiguration
+ implements ValidationConfiguration {
- /** The <code>ConfigurationProvider</code> to read the configuration data
- * from. */
- private ConfigurationProvider config;
+ /**
+ * The <code>ConfigurationProvider</code> to read the configuration data from.
+ */
+ private final ConfigurationProvider config;
/**
* Create a new <code>ValidationConfigurationImpl</code>.
- *
+ *
* @param config The underlying MOA configuration data.
*/
public ValidationConfigurationImpl(ConfigurationProvider config) {
@@ -59,6 +58,7 @@ public class ValidationConfigurationImpl
/**
* @see iaik.pki.pathvalidation.ValidationConfiguration#getChainingMode(java.security.cert.X509Certificate)
*/
+ @Override
public String getChainingMode(X509Certificate cert) {
return config.getChainingMode(cert);
}
@@ -66,6 +66,7 @@ public class ValidationConfigurationImpl
/**
* @see iaik.pki.pathvalidation.ValidationConfiguration#getPublicKeyParamsAsSpec(java.security.cert.X509Certificate)
*/
+ @Override
public AlgorithmParameterSpec getPublicKeyParamsAsSpec(X509Certificate cert) {
return null;
}
@@ -73,6 +74,7 @@ public class ValidationConfigurationImpl
/**
* @see iaik.pki.pathvalidation.ValidationConfiguration#getPublicKeyParamsAsCert(java.security.cert.X509Certificate)
*/
+ @Override
public X509Certificate getPublicKeyParamsAsCert(X509Certificate cert) {
return null;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java
index b776255..0032dc6 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java
@@ -23,12 +23,6 @@
package at.gv.egovernment.moa.spss.server.iaik.pki;
-import iaik.pki.PKIProfile;
-import iaik.pki.pathvalidation.ValidationProfile;
-import iaik.pki.revocation.RevocationProfile;
-import iaik.pki.store.truststore.TrustStoreProfile;
-import iaik.pki.store.truststore.TrustStoreTypes;
-
import java.util.Arrays;
import at.gv.egovernment.moa.sig.tsl.exception.TslPKIException;
@@ -42,179 +36,195 @@ import at.gv.egovernment.moa.spss.server.iaik.pki.revocation.RevocationProfileIm
import at.gv.egovernment.moa.spss.server.iaik.pki.store.truststore.TrustStoreProfileImpl;
import at.gv.egovernment.moa.spss.tsl.TSLServiceFactory;
import at.gv.egovernment.moaspss.logging.Logger;
+import iaik.pki.PKIProfile;
+import iaik.pki.pathvalidation.ValidationProfile;
+import iaik.pki.revocation.RevocationProfile;
+import iaik.pki.store.truststore.TrustStoreProfile;
/**
* Implementation of the <code>PKIProfile</code> interface containing
* information needed for certificate path validation. It uses configuration
* data from the MOA configuration.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class PKIProfileImpl implements PKIProfile {
- /** Profile information for revocation checking. */
- private RevocationProfile revocationProfile;
- /** Profile information about the trust profile to use. */
- private TrustStoreProfile trustStoreProfile;
- /** Profile information about the certificate validation. */
- private ValidationProfile validationProfile;
- /**
- * The <code>ConfigurationProvider</code> to read the MOA configuration data
- * from.
- */
- private ConfigurationProvider config;
-
- /**
- * Create a new <code>PKIProfileImpl</code>.
- *
- * @param config
- * The MOA configuration providing configuration data about
- * certificate path validation.
- * @param trustProfileID
- * The trust profile ID denoting the location of the trust store.
- * @throws MOAApplicationException
- * An error occurred building the profile.
- */
- public PKIProfileImpl(ConfigurationProvider config, String trustProfileID) throws MOAApplicationException {
-
- this.config = config;
- setRevocationProfile(new RevocationProfileImpl(config));
- setValidationProfile(new ValidationProfileImpl(config));
-
- //generate TrustStoreProfile from TrustStore configuration
- internalTrustProfileBuilder(trustProfileID);
-
- }
-
-
- private void internalTrustProfileBuilder(String trustProfileId) throws MOAApplicationException {
- TrustProfile tp = (TrustProfile) config.getTrustProfile(trustProfileId);
- if (tp != null) {
- //build directory based trust store as default
-
-
- if (tp.isTSLEnabled()) {
- //build TSL truststore if enabled
- TslTrustStoreProfile tslTrustStore;
- try {
- tslTrustStore = TSLServiceFactory.getTSLServiceClient().
- buildTrustStoreProfile(
- tp.getCountries(),
- tp.getAllowedTspStatus(),
- tp.getAllowedTspServiceTypes(),
- trustProfileId + "_TSL");
-
- //build Directory based TrustStore
- TrustStoreProfileImpl directoryTrustStore = new TrustStoreProfileImpl(trustProfileId + "_Directory", tp.getUri());
-
- //generate a virtual truststore that concatenates the TSL TrustStore and the directory TrustStore
- ChainingTrustStoreProfile chainedProfile = new ChainingTrustStoreProfile(
- Arrays.asList(tslTrustStore, directoryTrustStore),
- trustProfileId);
-
- //set this virtual truststore
- setTrustStoreProfile(chainedProfile);
-
- } catch (TslPKIException e) {
- Logger.error("Virtual TSL based TrustProfile generation FAILED.", e);
- throw new MOAApplicationException("2900", new Object[] { trustProfileId });
-
- }
-
- } else
- setTrustStoreProfile(new TrustStoreProfileImpl(trustProfileId, tp.getUri()));
-
- } else {
- throw new MOAApplicationException("2203", new Object[] { trustProfileId });
-
- }
-
- }
-
- /**
- * @see iaik.pki.PKIProfile#autoAddCertificates()
- */
- /*public boolean autoAddCertificates() {
- return useAuthorityInfoAccess() ? true : config.getAutoAddCertificates();
- }*/
-
- /**
- * @see iaik.pki.PKIProfile#getRevocationProfile()
- */
- public RevocationProfile getRevocationProfile() {
- return revocationProfile;
- }
-
- /**
- * Sets the <code>RevocationProfile</code>.
- *
- * @param revocationProfile
- * The <code>RevocationProfile</code> used for revocation
- * checking.
- */
- protected void setRevocationProfile(RevocationProfile revocationProfile) {
- this.revocationProfile = revocationProfile;
- }
-
- /**
- * @see iaik.pki.PKIProfile#getTrustStoreProfile()
- */
- public TrustStoreProfile getTrustStoreProfile() {
- return trustStoreProfile;
- }
-
- /**
- * Sets the <code>TrustStoreProfile</code>.
- *
- * @param trustStoreProfile
- * The <code>TrustStoreProfile</code>.
- */
- protected void setTrustStoreProfile(TrustStoreProfile trustStoreProfile) {
- this.trustStoreProfile = trustStoreProfile;
- }
-
- /**
- * @see iaik.pki.PKIProfile#getValidationProfile()
- */
- public ValidationProfile getValidationProfile() {
- return validationProfile;
- }
-
- /**
- * Sets the <code>ValidationProfile</code>.
- *
- * @param validationProfile
- * The <code>ValidationProfile</code> to set.
- */
- protected void setValidationProfile(ValidationProfile validationProfile) {
- this.validationProfile = validationProfile;
- }
-
- /**
- * @see iaik.pki.PKIProfile#useAuthorityInfoAccess()
- */
- public boolean useAuthorityInfoAccess() {
- return config.getUseAuthorityInfoAccess();
- }
-
- /**
- * @see iaik.pki.PKIProfile#autoAddCertificates()
- */
- @Override
- public int autoAddCertificates() {
- if(config.getAutoAddCertificates()) {
- return PKIProfile.AUTO_ADD_EE_DISABLE;
- } else {
- return PKIProfile.AUTO_ADD_DISABLE;
- }
- // TODO AFITZEK allow saving of end entity certificates
- }
-
- @Override
- public TrustStoreProfile getIndirectRevocationTrustStoreProfile() {
- // TODO AFITZEK IMPLEMENT THIS METHOD
- return null;
- }
+ /** Profile information for revocation checking. */
+ private RevocationProfile revocationProfile;
+ /** Profile information about the trust profile to use. */
+ private TrustStoreProfile trustStoreProfile;
+ /** Profile information about the certificate validation. */
+ private ValidationProfile validationProfile;
+ /**
+ * The <code>ConfigurationProvider</code> to read the MOA configuration data
+ * from.
+ */
+ private final ConfigurationProvider config;
+
+ /**
+ * Create a new <code>PKIProfileImpl</code>.
+ *
+ * @param config The MOA configuration providing configuration data
+ * about certificate path validation.
+ * @param trustProfileID The trust profile ID denoting the location of the trust
+ * store.
+ * @throws MOAApplicationException An error occurred building the profile.
+ */
+ public PKIProfileImpl(ConfigurationProvider config, String trustProfileID) throws MOAApplicationException {
+
+ this.config = config;
+ setRevocationProfile(new RevocationProfileImpl(config));
+ setValidationProfile(new ValidationProfileImpl(config));
+
+ // generate TrustStoreProfile from TrustStore configuration
+ internalTrustProfileBuilder(trustProfileID);
+
+ }
+
+ private void internalTrustProfileBuilder(String trustProfileId) throws MOAApplicationException {
+ final TrustProfile tp = config.getTrustProfile(trustProfileId);
+ if (tp != null) {
+ // build directory based trust store as default
+
+ if (tp.isTSLEnabled()) {
+ TslTrustStoreProfile tslTrustStore;
+ try {
+ if (!TSLServiceFactory.isInitialized()) {
+ Logger.error("Can not build TrustProfile:" + trustProfileId
+ + " Reason: TrustProfile needs TSL support but TSL client NOT initialized.");
+ throw new TslPKIException("Trust Status-List service client is NOT initialized");
+
+ }
+
+ // build TSL truststore if enabled
+ tslTrustStore = TSLServiceFactory.getTSLServiceClient().buildTrustStoreProfile(
+ tp.getCountries(),
+ tp.getAllowedTspStatus(),
+ tp.getAllowedTspServiceTypes(),
+ trustProfileId + "_TSL");
+
+ // build Directory based TrustStore
+ final TrustStoreProfileImpl directoryTrustStore = new TrustStoreProfileImpl(trustProfileId
+ + "_Directory", tp.getUri());
+
+ // generate a virtual truststore that concatenates the TSL TrustStore and the
+ // directory TrustStore
+ final ChainingTrustStoreProfile chainedProfile = new ChainingTrustStoreProfile(
+ Arrays.asList(tslTrustStore, directoryTrustStore),
+ trustProfileId);
+
+ // set this virtual truststore
+ setTrustStoreProfile(chainedProfile);
+
+ } catch (final TslPKIException e) {
+ Logger.error("Virtual TSL based TrustProfile generation FAILED.", e);
+ throw new MOAApplicationException("2900", new Object[] { trustProfileId });
+
+ }
+
+ } else {
+ setTrustStoreProfile(new TrustStoreProfileImpl(trustProfileId, tp.getUri()));
+ }
+
+ } else {
+ throw new MOAApplicationException("2203", new Object[] { trustProfileId });
+
+ }
+
+ }
+
+ /**
+ * @see iaik.pki.PKIProfile#autoAddCertificates()
+ */
+ /*
+ * public boolean autoAddCertificates() { return useAuthorityInfoAccess() ? true
+ * : config.getAutoAddCertificates(); }
+ */
+
+ /**
+ * @see iaik.pki.PKIProfile#getRevocationProfile()
+ */
+ @Override
+ public RevocationProfile getRevocationProfile() {
+ return revocationProfile;
+ }
+
+ /**
+ * Sets the <code>RevocationProfile</code>.
+ *
+ * @param revocationProfile The <code>RevocationProfile</code> used for
+ * revocation checking.
+ */
+ protected void setRevocationProfile(RevocationProfile revocationProfile) {
+ this.revocationProfile = revocationProfile;
+ }
+
+ /**
+ * @see iaik.pki.PKIProfile#getTrustStoreProfile()
+ */
+ @Override
+ public TrustStoreProfile getTrustStoreProfile() {
+ return trustStoreProfile;
+ }
+
+ /**
+ * Sets the <code>TrustStoreProfile</code>.
+ *
+ * @param trustStoreProfile The <code>TrustStoreProfile</code>.
+ */
+ protected void setTrustStoreProfile(TrustStoreProfile trustStoreProfile) {
+ this.trustStoreProfile = trustStoreProfile;
+ }
+
+ /**
+ * @see iaik.pki.PKIProfile#getValidationProfile()
+ */
+ @Override
+ public ValidationProfile getValidationProfile() {
+ return validationProfile;
+ }
+
+ /**
+ * Sets the <code>ValidationProfile</code>.
+ *
+ * @param validationProfile The <code>ValidationProfile</code> to set.
+ */
+ protected void setValidationProfile(ValidationProfile validationProfile) {
+ this.validationProfile = validationProfile;
+ }
+
+ /**
+ * @see iaik.pki.PKIProfile#useAuthorityInfoAccess()
+ */
+ @Override
+ public boolean useAuthorityInfoAccess() {
+ return config.getUseAuthorityInfoAccess();
+ }
+
+ /**
+ * @see iaik.pki.PKIProfile#autoAddCertificates()
+ */
+ @Override
+ public int autoAddCertificates() {
+ if (config.getAutoAddCertificates()) {
+ if (config.getAutoAddEECertificates()) {
+ return PKIProfile.AUTO_ADD_ENABLE;
+ } else {
+ return PKIProfile.AUTO_ADD_EE_DISABLE;
+ }
+
+ } else {
+ return PKIProfile.AUTO_ADD_DISABLE;
+ }
+
+ }
+
+ @Override
+ public TrustStoreProfile getIndirectRevocationTrustStoreProfile() {
+ // TODO AFITZEK IMPLEMENT THIS METHOD
+ return null;
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java
index 7e62d60..76e1ed0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/pathvalidation/ValidationProfileImpl.java
@@ -21,40 +21,39 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.pki.pathvalidation;
-import iaik.pki.pathvalidation.ValidationProfile;
-
import java.util.Collections;
import java.util.Set;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
+import iaik.pki.pathvalidation.ValidationProfile;
/**
* An implementation of the <code>ValidationProfile</code> interface providing
- * information about certificat path validation.
- *
+ * information about certificat path validation.
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ValidationProfileImpl implements ValidationProfile {
- /** The <code>ConfigurationProvider</code> to read the configuration data
- * from. */
- private ConfigurationProvider config;
- private boolean initialAnyPolicyInhibit;
- private boolean initialExplicitPolicy;
- private boolean initialPolicyMappingInhibit;
- private Set initialPolicySet;
- private boolean nameConstraintsProcessing;
- private boolean policyProcessing;
+ /**
+ * The <code>ConfigurationProvider</code> to read the configuration data from.
+ */
+ private final ConfigurationProvider config;
+ private final boolean initialAnyPolicyInhibit;
+ private final boolean initialExplicitPolicy;
+ private final boolean initialPolicyMappingInhibit;
+ private final Set initialPolicySet;
+ private final boolean nameConstraintsProcessing;
+ private final boolean policyProcessing;
/**
* Create a new <code>ValidationProfileImpl</code> object.
- *
+ *
* This objects's fields are preset to the following values:
- *
+ *
* <ul>
* <li><code>initialAnyPolicyInhibit = true</code></li>
* <li><code>initialExplicitPoliy = true</code></li>
@@ -64,9 +63,9 @@ public class ValidationProfileImpl implements ValidationProfile {
* <li><code>nameConstraintsProcessing = false</code></li>
* <li><code>revocationChecking = false</code></li>
* </ul>
- *
- * @param config MOA configuration data for additional configuration
- * information (currently unused).
+ *
+ * @param config MOA configuration data for additional configuration information
+ * (currently unused).
*/
public ValidationProfileImpl(ConfigurationProvider config) {
this.config = config;
@@ -81,6 +80,7 @@ public class ValidationProfileImpl implements ValidationProfile {
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getInitialAnyPolicyInhibit()
*/
+ @Override
public boolean getInitialAnyPolicyInhibit() {
return initialAnyPolicyInhibit;
}
@@ -88,6 +88,7 @@ public class ValidationProfileImpl implements ValidationProfile {
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getInitialExplicitPolicy()
*/
+ @Override
public boolean getInitialExplicitPolicy() {
return initialExplicitPolicy;
}
@@ -95,6 +96,7 @@ public class ValidationProfileImpl implements ValidationProfile {
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getInitialPolicyMappingInhibit()
*/
+ @Override
public boolean getInitialPolicyMappingInhibit() {
return initialPolicyMappingInhibit;
}
@@ -102,6 +104,7 @@ public class ValidationProfileImpl implements ValidationProfile {
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getInitialPolicySet()
*/
+ @Override
public Set getInitialPolicySet() {
return initialPolicySet;
}
@@ -109,6 +112,7 @@ public class ValidationProfileImpl implements ValidationProfile {
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getPolicyProcessing()
*/
+ @Override
public boolean getPolicyProcessing() {
return policyProcessing;
}
@@ -116,6 +120,7 @@ public class ValidationProfileImpl implements ValidationProfile {
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getNameConstraintsProcessing()
*/
+ @Override
public boolean getNameConstraintsProcessing() {
return nameConstraintsProcessing;
}
@@ -123,8 +128,8 @@ public class ValidationProfileImpl implements ValidationProfile {
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getRevocationChecking()
*/
- public boolean getRevocationChecking()
- {
+ @Override
+ public boolean getRevocationChecking() {
return config.getEnableRevocationChecking();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java
index 14627b2..5215131 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/revocation/RevocationProfileImpl.java
@@ -21,37 +21,37 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.pki.revocation;
import java.security.cert.X509Certificate;
+import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import iaik.pki.revocation.RevocationProfile;
import iaik.pki.revocation.RevocationSourceTypes;
-import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
-
/**
* An implementation of the <code>RevocationProfile</code> interface providing
* information about revocation status checking, based on MOA configuration
* data.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class RevocationProfileImpl implements RevocationProfile {
/** The default service order. */
private static final String[] DEFAULT_SERVICE_ORDER =
- { RevocationSourceTypes.CRL, RevocationSourceTypes.OCSP };
- /** The <code>ConfigurationProvider</code> to read the MOA configuration data
- * from. */
- private ConfigurationProvider config;
+ { RevocationSourceTypes.CRL, RevocationSourceTypes.OCSP };
+ /**
+ * The <code>ConfigurationProvider</code> to read the MOA configuration data
+ * from.
+ */
+ private final ConfigurationProvider config;
/** The OCSP request hash algorithm. Currently only "SHA" is supported. */
private static final String oCSPRequestHashAlgorithm = "SHA";
/**
* Create a new <code>RevocationProfileImpl</code>.
- *
+ *
* @param config The MOA configuration data.
*/
public RevocationProfileImpl(ConfigurationProvider config) {
@@ -63,14 +63,15 @@ public class RevocationProfileImpl implements RevocationProfile {
/**
* @see iaik.pki.revocation.RevocationProfile#getMaxRevocationAge(String)
*/
- public long getMaxRevocationAge(String distributionPointUri)
- {
+ @Override
+ public long getMaxRevocationAge(String distributionPointUri) {
return config.getMaxRevocationAge();
}
/**
* @see iaik.pki.revocation.RevocationProfile#getOCSPRequestHashAlgorithm()
*/
+ @Override
public String getOCSPRequestHashAlgorithm() {
return oCSPRequestHashAlgorithm;
}
@@ -78,10 +79,12 @@ public class RevocationProfileImpl implements RevocationProfile {
/**
* @see iaik.pki.revocation.RevocationProfile#getPreferredServiceOrder(java.security.cert.X509Certificate)
*/
- public String[] getPreferredServiceOrder(X509Certificate cert)
- {
- String[] serviceOrder = config.getServiceOrder();
- if (serviceOrder == null || serviceOrder.length == 0) return DEFAULT_SERVICE_ORDER;
+ @Override
+ public String[] getPreferredServiceOrder(X509Certificate cert) {
+ final String[] serviceOrder = config.getServiceOrder();
+ if (serviceOrder == null || serviceOrder.length == 0) {
+ return DEFAULT_SERVICE_ORDER;
+ }
return serviceOrder;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java
index c9f4f28..9ef3764 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/store/truststore/TrustStoreProfileImpl.java
@@ -21,89 +21,82 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.pki.store.truststore;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import iaik.pki.store.truststore.TrustStoreProfile;
-import iaik.pki.store.truststore.TrustStoreTypes;
-import iaik.pki.store.observer.NotificationData;
-import iaik.pki.store.observer.Observer;
-
import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moa.spss.server.config.TrustProfile;
+import iaik.pki.store.observer.NotificationData;
+import iaik.pki.store.observer.Observer;
+import iaik.pki.store.truststore.TrustStoreProfile;
+import iaik.pki.store.truststore.TrustStoreTypes;
/**
* An implementation of the <code>TrustStoreProfile</code> interface, using data
* from the MOA configuration.
- *
- * @see iaik.pki.store.truststore.TrustStoreProfile
+ *
+ * @see iaik.pki.store.truststore.TrustStoreProfile
* @author Patrick Peck
* @version $Id$
*/
public class TrustStoreProfileImpl implements TrustStoreProfile {
/** The observers of this profile. */
- private List observers = new ArrayList();
-
+ private final List observers = new ArrayList();
+
/**
- * The trust profile identifier.
+ * The trust profile identifier.
*/
private String id_;
-
+
/** The type of the trust profile. */
private String type;
- /** The URI of the trust profile.*/
+ /** The URI of the trust profile. */
private String URI;
-
/**
* Create a new <code>TrustStoreProfileImpl</code>.
- *
- * @param config The MOA configuration data, from which trust store
- * configuration data is read.
+ *
+ * @param config The MOA configuration data, from which trust store
+ * configuration data is read.
* @param trustProfileId The trust profile id on which this
- * <code>TrustStoreProfile</code> is based.
- * @throws MOAApplicationException The <code>trustProfileId</code> could not
- * be found in the MOA configuration.
+ * <code>TrustStoreProfile</code> is based.
+ * @throws MOAApplicationException The <code>trustProfileId</code> could not be
+ * found in the MOA configuration.
*/
public TrustStoreProfileImpl(String trustProfileId, String trustProfileUri)
- throws MOAApplicationException {
- id_ = trustProfileId;
- setURI(trustProfileUri);
- setType(TrustStoreTypes.DIRECTORY);
-
+ throws MOAApplicationException {
+ id_ = trustProfileId;
+ setURI(trustProfileUri);
+ setType(TrustStoreTypes.DIRECTORY);
+
}
-
+
/**
* Create a new <code>TrustStoreProfileImpl</code>.
- *
- * @param config The MOA configuration data, from which trust store
- * configuration data is read.
+ *
+ * @param config The MOA configuration data, from which trust store
+ * configuration data is read.
* @param trustProfileId The trust profile id on which this
- * <code>TrustStoreProfile</code> is based.
- * @throws MOAApplicationException The <code>trustProfileId</code> could not
- * be found in the MOA configuration.
+ * <code>TrustStoreProfile</code> is based.
+ * @throws MOAApplicationException The <code>trustProfileId</code> could not be
+ * found in the MOA configuration.
*/
@Deprecated
public TrustStoreProfileImpl(
- ConfigurationProvider config,
- String trustProfileId)
- throws MOAApplicationException {
+ ConfigurationProvider config,
+ String trustProfileId)
+ throws MOAApplicationException {
- TrustProfile tp = (TrustProfile) config.getTrustProfile(trustProfileId);
- if (tp != null)
- {
+ final TrustProfile tp = config.getTrustProfile(trustProfileId);
+ if (tp != null) {
id_ = trustProfileId;
setURI(tp.getUri());
setType(TrustStoreTypes.DIRECTORY);
- }
- else
- {
+ } else {
throw new MOAApplicationException("2203", new Object[] { trustProfileId });
}
}
@@ -111,14 +104,15 @@ public class TrustStoreProfileImpl implements TrustStoreProfile {
/**
* @see iaik.pki.store.truststore.TrustStoreProfile#getType()
*/
+ @Override
public String getType() {
return type;
}
/**
* Sets the the trust store type.
- *
- * @param type The trust store type to set.
+ *
+ * @param type The trust store type to set.
*/
protected void setType(String type) {
this.type = type;
@@ -127,13 +121,14 @@ public class TrustStoreProfileImpl implements TrustStoreProfile {
/**
* @see iaik.pki.store.truststore.TrustStoreProfile#getURI()
*/
+ @Override
public String getURI() {
return URI;
}
/**
* Sets the trust store URI.
- *
+ *
* @param URI The trust store URI to set.
*/
protected void setURI(String URI) {
@@ -162,8 +157,8 @@ public class TrustStoreProfileImpl implements TrustStoreProfile {
* @see iaik.pki.store.observer.Observable#notify(iaik.pki.store.observer.NotificationData)
*/
public void notify(NotificationData notificationData) {
- for (Iterator iter = observers.iterator(); iter.hasNext();) {
- Observer observer = (Observer) iter.next();
+ for (final Object observer2 : observers) {
+ final Observer observer = (Observer) observer2;
observer.notify(notificationData);
}
}
@@ -171,8 +166,8 @@ public class TrustStoreProfileImpl implements TrustStoreProfile {
/**
* @see iaik.pki.store.truststore.TrustStoreProfile#getId()
*/
- public String getId()
- {
+ @Override
+ public String getId() {
return id_;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java
index cc12861..1bba712 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.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.iaik.xml;
import iaik.server.modules.xml.Base64Transformation;
@@ -29,39 +28,39 @@ import iaik.server.modules.xml.Base64Transformation;
/**
* An implementation of the <code>Base64Transformation</code>
* <code>Transformation</code> type.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class Base64TransformationImpl
- extends TransformationImpl
- implements Base64Transformation {
-
+ extends TransformationImpl
+ implements Base64Transformation {
+
/**
* Create a new <code>Base64TransformationImpl</code>.
- *
+ *
* @see java.lang.Object#Object()
- */
+ */
public Base64TransformationImpl() {
setAlgorithmURI(Base64Transformation.BASE64_DECODING);
}
/**
* Compare this <code>Base64Transformation</code> to another.
- *
- * @param other The object to compare this<code>Base64Transformation</code>
- * to.
+ *
+ * @param other The object to compare this<code>Base64Transformation</code> to.
* @return <code>true</code>, if <code>other</code> is a
- * <code>Base64Transformation</code> and the algorithm URIs match, otherwise
- * <code>false</code>.
+ * <code>Base64Transformation</code> and the algorithm URIs match,
+ * otherwise <code>false</code>.
* @see java.lang.Object#equals(Object)
- */
+ */
+ @Override
public boolean equals(Object other) {
if (other instanceof Base64Transformation) {
- Base64Transformation transform = (Base64Transformation) other;
+ final Base64Transformation transform = (Base64Transformation) other;
return getAlgorithmURI().equals(transform.getAlgorithmURI());
}
return false;
}
-
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java
index 4d627d7..e498842 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.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.iaik.xml;
import java.io.ByteArrayInputStream;
@@ -31,22 +30,21 @@ import iaik.server.modules.xml.BinaryDataObject;
/**
* A <code>BinaryDataObject</code> encapsulating Base64 data.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ByteArrayDataObjectImpl
- extends DataObjectImpl
- implements BinaryDataObject {
+ extends DataObjectImpl
+ implements BinaryDataObject {
/** The binary data contained in this <code>BinaryDataObject</code>. */
private byte[] bytes;
/**
* Create a new <code>ByteArrayDataObjectImpl</code>.
- *
- * @param bytes The binary data contained in this
- * <code>BinaryDataObject</code>.
+ *
+ * @param bytes The binary data contained in this <code>BinaryDataObject</code>.
*/
public ByteArrayDataObjectImpl(byte[] bytes) {
setBytes(bytes);
@@ -54,23 +52,22 @@ public class ByteArrayDataObjectImpl
/**
* Set the Base64 data.
- *
- * @param bytes The binary data contained in this
- * <code>BinaryDataObject</code>.
+ *
+ * @param bytes The binary data contained in this <code>BinaryDataObject</code>.
*/
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
/**
- * Return the binary data encoded in the Base64 <code>String</code> as a
- * stream.
- *
+ * Return the binary data encoded in the Base64 <code>String</code> as a stream.
+ *
* @return The binary data contained in this object, as a
- * <code>InputStream</code>. Repeated calls to this function will return a
- * new stream to the Base64 data.
+ * <code>InputStream</code>. Repeated calls to this function will return
+ * a new stream to the Base64 data.
* @see iaik.server.modules.xml.BinaryDataObject#getInputStream()
*/
+ @Override
public InputStream getInputStream() {
return new ByteArrayInputStream(bytes);
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java
index b982c8e..af8ee66 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.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.iaik.xml;
import java.io.InputStream;
@@ -29,21 +28,21 @@ import java.io.InputStream;
import iaik.server.modules.xml.BinaryDataObject;
/**
- * A <code>BinaryDataObject</code> encapsulating binary data from a stream.
- *
+ * A <code>BinaryDataObject</code> encapsulating binary data from a stream.
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ByteStreamDataObjectImpl
- extends DataObjectImpl
- implements BinaryDataObject {
+ extends DataObjectImpl
+ implements BinaryDataObject {
/** The <code>InputStream</code> containing the binary data. */
private InputStream inputStream;
/**
* Create a new <code>ByteStreamDataObjectImpl</code>.
- *
+ *
* @param inputStream The stream from which to read the binary data.
*/
public ByteStreamDataObjectImpl(InputStream inputStream) {
@@ -52,7 +51,7 @@ public class ByteStreamDataObjectImpl
/**
* Set the input stream from which to read the binary data.
- *
+ *
* @param inputStream The input stream from which to read the binary data.
*/
public void setInputStream(InputStream inputStream) {
@@ -61,11 +60,12 @@ public class ByteStreamDataObjectImpl
/**
* Return the binary data from this object as a stream.
- *
+ *
* @return The stream containing the binary data. Calling this function
- * repeatedly will always return the same <code>InputStream</code>.
+ * repeatedly will always return the same <code>InputStream</code>.
* @see iaik.server.modules.xml.BinaryDataObject#getInputStream()
*/
+ @Override
public InputStream getInputStream() {
return inputStream;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java
index 0c3a8da..1e2a651 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.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.iaik.xml;
import iaik.server.modules.xml.Canonicalization;
@@ -29,36 +28,36 @@ import iaik.server.modules.xml.Canonicalization;
/**
* An implementation of the <code>CanonicalizationTransform</code>
* <code>Transformation</code> type.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class CanonicalizationImpl
- extends TransformationImpl
- implements Canonicalization {
-
+ extends TransformationImpl
+ implements Canonicalization {
+
/**
* Create a new <code>CanonicalizationTransformImpl</code> object.
- *
+ *
* @param algorithmURI The canonicalization algorithm URI.
- */
+ */
public CanonicalizationImpl(String algorithmURI) {
setAlgorithmURI(algorithmURI);
}
-
+
/**
* Compare this object to another <code>Canonicalization</code>.
- *
- * @param other The object to compare this
- * <code>Canonicalization</code> to.
+ *
+ * @param other The object to compare this <code>Canonicalization</code> to.
* @return <code>true</code>, if <code>other</code> is a
- * <code>Canonicalization</code> and the algorithm URIs match, otherwise
- * <code>false</code>.
+ * <code>Canonicalization</code> and the algorithm URIs match, otherwise
+ * <code>false</code>.
* @see java.lang.Object#equals(Object)
*/
+ @Override
public boolean equals(Object other) {
if (other instanceof Canonicalization) {
- Canonicalization c14n = (Canonicalization) other;
+ final Canonicalization c14n = (Canonicalization) other;
return getAlgorithmURI().equals(c14n.getAlgorithmURI());
}
return false;
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java
index 702caaf..ac36875 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.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.iaik.xml;
import iaik.server.modules.xml.DataObject;
@@ -29,12 +28,12 @@ import iaik.server.modules.xml.DataObject;
/**
* Abstract base implementation for the classes derived from
* <code>DataObject</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public abstract class DataObjectImpl implements DataObject {
-
+
/** The MIME type of the data object. */
private String mimeType;
/** The refernce ID. */
@@ -43,33 +42,35 @@ public abstract class DataObjectImpl implements DataObject {
private String typeURI;
/** The URI identifying the data. */
private String URI;
-
+
/**
* @see iaik.server.modules.xml.DataObject#getMimeType()
*/
+ @Override
public String getMimeType() {
return mimeType;
}
/**
* Set the mime type.
- *
+ *
* @param mimeType The mime type to set.
*/
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
-
+
/**
* @see iaik.server.modules.xml.DataObject#getReferenceID()
*/
+ @Override
public String getReferenceID() {
return referenceID;
}
-
+
/**
* Set the reference ID.
- *
+ *
* @param referenceID The reference ID.
*/
public void setReferenceID(String referenceID) {
@@ -79,13 +80,14 @@ public abstract class DataObjectImpl implements DataObject {
/**
* @see iaik.server.modules.xml.DataObject#getTypeURI()
*/
+ @Override
public String getTypeURI() {
return typeURI;
}
/**
* Set the type URI.
- *
+ *
* @param typeURI The type URI.
*/
public void setTypeURI(String typeURI) {
@@ -95,13 +97,14 @@ public abstract class DataObjectImpl implements DataObject {
/**
* @see iaik.server.modules.xml.DataObject#getURI()
*/
+ @Override
public String getURI() {
return URI;
}
-
+
/**
* Set the URI.
- *
+ *
* @param URI The URI.
*/
public void setURI(String URI) {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java
index d582594..2c9f0e3 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.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.iaik.xml;
import iaik.server.modules.xml.EnvelopedSignatureTransformation;
@@ -29,13 +28,13 @@ import iaik.server.modules.xml.EnvelopedSignatureTransformation;
/**
* An implementation of the <code>EnvelopedSignatureTransformation</code>
* <code>Transformation</code> type.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class EnvelopedSignatureTransformationImpl
- extends TransformationImpl
- implements EnvelopedSignatureTransformation {
+ extends TransformationImpl
+ implements EnvelopedSignatureTransformation {
/**
* Create a new <code>EnvelopedSignatureTransformationImpl</code>.
@@ -46,18 +45,19 @@ public class EnvelopedSignatureTransformationImpl
/**
* Compare this object to another <code>EnvelopedSignatureTransformation</code>.
- *
- * @param other The object to compare this
- * <code>EnvelopedSignatureTransformation</code> to.
+ *
+ * @param other The object to compare this
+ * <code>EnvelopedSignatureTransformation</code> to.
* @return <code>true</code>, if <code>other</code> is a
- * <code>EnvelopedSignatureTransformation</code>, otherwise
- * <code>false</code>.
+ * <code>EnvelopedSignatureTransformation</code>, otherwise
+ * <code>false</code>.
* @see java.lang.Object#equals(Object)
*/
+ @Override
public boolean equals(Object other) {
if (other instanceof EnvelopedSignatureTransformation) {
- EnvelopedSignatureTransformation transform =
- (EnvelopedSignatureTransformation) other;
+ final EnvelopedSignatureTransformation transform =
+ (EnvelopedSignatureTransformation) other;
return getAlgorithmURI().equals(transform.getAlgorithmURI());
}
return false;
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java
index dfadf0c..ce98e7f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.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.iaik.xml;
import java.util.List;
@@ -29,38 +28,39 @@ import java.util.List;
import iaik.server.modules.xml.ExclusiveCanonicalization;
/**
- * An implementation of the <code>ExclusiveCanonicalization</code> type
- * of <code>Transformation</code>.
- *
+ * An implementation of the <code>ExclusiveCanonicalization</code> type of
+ * <code>Transformation</code>.
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ExclusiveCanonicalizationImpl
- extends TransformationImpl
- implements ExclusiveCanonicalization {
+ extends TransformationImpl
+ implements ExclusiveCanonicalization {
/** The prefixes of the namespaces to treat according to canonical XML. */
private List inclusiveNamespacePrefixes;
/**
* Create a new <code>ExclusiveCanonicalizationImpl</code> object.
- *
- * @param algorithmURI The exclusive canonicalization algorithm URI.
+ *
+ * @param algorithmURI The exclusive canonicalization algorithm
+ * URI.
* @param inclusiveNamespacePrefixes The namespace prefixes to be processed
- * according to canonical XML.
+ * according to canonical XML.
*/
public ExclusiveCanonicalizationImpl(
- String algorithmURI,
- List inclusiveNamespacePrefixes) {
+ String algorithmURI,
+ List inclusiveNamespacePrefixes) {
setAlgorithmURI(algorithmURI);
setInclusiveNamespacePrefixes(inclusiveNamespacePrefixes);
}
/**
* Sets the namespace prefixes to be processed according to canonical XML.
- *
+ *
* @param inclusiveNamespacePrefixes The prefixes of the namespaces to treat
- * according to canonical XML.
+ * according to canonical XML.
*/
protected void setInclusiveNamespacePrefixes(List inclusiveNamespacePrefixes) {
this.inclusiveNamespacePrefixes = inclusiveNamespacePrefixes;
@@ -69,29 +69,32 @@ public class ExclusiveCanonicalizationImpl
/**
* @see iaik.server.modules.xml.ExclusiveCanonicalization#getInclusiveNamespacePrefixes()
*/
+ @Override
public List getInclusiveNamespacePrefixes() {
return inclusiveNamespacePrefixes;
}
/**
* Compare this object to another <code>CanonicalizationTransform</code>.
- *
- * @param other The object to compare this
- * <code>ExclusiveCanonicalization</code> to.
+ *
+ * @param other The object to compare this
+ * <code>ExclusiveCanonicalization</code> to.
* @return <code>true</code>, if <code>other</code> is a
- * <code>ExclusiveCanonicalization</code> and the algorithm URIs match,
- * otherwise <code>false</code>.
+ * <code>ExclusiveCanonicalization</code> and the algorithm URIs match,
+ * otherwise <code>false</code>.
* @see java.lang.Object#equals(Object)
*/
+ @Override
public boolean equals(Object other) {
if (other instanceof ExclusiveCanonicalization) {
- ExclusiveCanonicalization eC14n =
- (ExclusiveCanonicalization) other;
- boolean algURIEquals = getAlgorithmURI().equals(eC14n.getAlgorithmURI());
- boolean inclNSPrefs =
- (getInclusiveNamespacePrefixes() == null || getInclusiveNamespacePrefixes().isEmpty())
- ? eC14n.getInclusiveNamespacePrefixes() == null || eC14n.getInclusiveNamespacePrefixes().isEmpty()
- : getInclusiveNamespacePrefixes().equals(eC14n.getInclusiveNamespacePrefixes());
+ final ExclusiveCanonicalization eC14n =
+ (ExclusiveCanonicalization) other;
+ final boolean algURIEquals = getAlgorithmURI().equals(eC14n.getAlgorithmURI());
+ final boolean inclNSPrefs =
+ getInclusiveNamespacePrefixes() == null || getInclusiveNamespacePrefixes().isEmpty()
+ ? eC14n.getInclusiveNamespacePrefixes() == null || eC14n.getInclusiveNamespacePrefixes()
+ .isEmpty()
+ : getInclusiveNamespacePrefixes().equals(eC14n.getInclusiveNamespacePrefixes());
return algURIEquals && inclNSPrefs;
}
return false;
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java
index 9026d33..9f4e22d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.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.iaik.xml;
import java.util.Date;
@@ -30,18 +29,18 @@ import iaik.server.modules.xml.SigningTime;
/**
* An implementation of the <code>SigningTime</code> <code>Property</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class SigningTimeImpl implements SigningTime {
-
+
/** The signing time. */
- private Date signingTime;
-
+ private final Date signingTime;
+
/**
* Create a new <code>SigningTimeImpl</code>.
- *
+ *
* @param signingTime The signing time.
*/
public SigningTimeImpl(Date signingTime) {
@@ -51,6 +50,7 @@ public class SigningTimeImpl implements SigningTime {
/**
* @see iaik.server.modules.xml.SigningTime#getSigningTime()
*/
+ @Override
public Date getSigningTime() {
return signingTime;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java
index 1595446..fa3401e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java
@@ -21,14 +21,13 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.xml;
import iaik.server.modules.xml.Transformation;
/**
* Base implementation class for <code>Transformation</code> derived classes.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -36,32 +35,34 @@ public abstract class TransformationImpl implements Transformation {
/** The algorithm URI identifying the transformation algorithm. */
private String algorithmURI;
-
+
/**
* @see iaik.server.modules.xml.Transformation#getAlgorithmURI()
*/
+ @Override
public String getAlgorithmURI() {
return algorithmURI;
}
/**
* Sets the algorithm URI.
- *
+ *
* @param algorithmURI The algorithm URI to set.
*/
protected void setAlgorithmURI(String algorithmURI) {
this.algorithmURI = algorithmURI;
}
-
+
/**
* Returns the hash code of the algorithm URI. Should be overridden if a
* transformation distinguishes itself from others by more than just the
* algorithm URI.
- *
+ *
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getAlgorithmURI().hashCode();
}
-
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java
index e8444b9..0688d0e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.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.iaik.xml;
import org.w3c.dom.Element;
@@ -30,22 +29,21 @@ import iaik.server.modules.xml.XMLDataObject;
/**
* A <code>DataObject</code> containing a single DOM element.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XMLDataObjectImpl
- extends DataObjectImpl
- implements XMLDataObject {
-
- /** The XML data contained in this <code>XMLDataObject</code>. */
+ extends DataObjectImpl
+ implements XMLDataObject {
+
+ /** The XML data contained in this <code>XMLDataObject</code>. */
private Element element;
-
+
/**
* Create a new <code>XMLDataObjectImpl</code>.
- *
- * @param element The DOM element contained in this
- * <code>XMLDataObject</code>.
+ *
+ * @param element The DOM element contained in this <code>XMLDataObject</code>.
*/
public XMLDataObjectImpl(Element element) {
setElement(element);
@@ -54,13 +52,14 @@ public class XMLDataObjectImpl
/**
* @see iaik.server.modules.xml.XMLDataObject#getElement()
*/
+ @Override
public Element getElement() {
return element;
}
/**
* Set the DOM element contained in this <code>XMLDataObject</code>.
- *
+ *
* @param element The DOM element to set.
*/
public void setElement(Element element) {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java
index 2fb9df9..51f96f0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.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.iaik.xml;
import org.w3c.dom.NodeList;
@@ -30,22 +29,22 @@ import iaik.server.modules.xml.XMLNodeListDataObject;
/**
* A <code>DataObject</code> containing a list of DOM nodes.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XMLNodeListDataObjectImpl
- extends DataObjectImpl
- implements XMLNodeListDataObject {
+ extends DataObjectImpl
+ implements XMLNodeListDataObject {
/** The nodes contained in this <code>XMLNodeListDataObject</code>. */
private NodeList nodeList;
/**
* Create a new <code>XMLNodeListDataObjectImpl</code>.
- *
+ *
* @param nodeList The list of DOM nodes contained in this
- * <code>XMLNodeListDataObject</code>.
+ * <code>XMLNodeListDataObject</code>.
*/
public XMLNodeListDataObjectImpl(NodeList nodeList) {
setNodeList(nodeList);
@@ -54,7 +53,7 @@ public class XMLNodeListDataObjectImpl
/**
* Set the list of DOM nodes contained in this
* <code>XMLNodeListDataObject</code>.
- *
+ *
* @param nodeList The list of DOM nodes to set.
*/
public void setNodeList(NodeList nodeList) {
@@ -64,6 +63,7 @@ public class XMLNodeListDataObjectImpl
/**
* @see iaik.server.modules.xml.XMLNodeListDataObject#getNodeList()
*/
+ @Override
public NodeList getNodeList() {
return nodeList;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java
index 0774726..1844780 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.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.iaik.xml;
import org.w3c.dom.Element;
@@ -29,28 +28,28 @@ import org.w3c.dom.Element;
import iaik.server.modules.xml.XMLSignature;
/**
- * An object containing an XMLDsig signature in the form of a
+ * An object containing an XMLDsig signature in the form of a
* <code>dsig:Signature</code> DOM element.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XMLSignatureImpl implements XMLSignature {
/** The signature DOM element. */
private Element element;
-
+
/**
* Create a new <code>XMLSignatureImpl</code>.
- *
+ *
* @param element The <code>dsig:Signature</code> DOM element.
*/
public XMLSignatureImpl(Element element) {
setElement(element);
}
-
+
/**
* Set the <code>dsig:Signature</code> DOM element.
- *
+ *
* @param element The <code>dsig:Signature</code> element to set.
*/
public void setElement(Element element) {
@@ -60,6 +59,7 @@ public class XMLSignatureImpl implements XMLSignature {
/**
* @see iaik.server.modules.xml.XMLSignature#getElement()
*/
+ @Override
public Element getElement() {
return element;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java
index d309302..a44196a 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.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.iaik.xml;
import java.util.Map;
@@ -31,7 +30,7 @@ import iaik.server.modules.xml.XPath2Transformation.XPath2Filter;
/**
* An object encapsulating an XPath-Filter2 expression.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -46,17 +45,18 @@ public class XPath2FilterImpl implements XPath2Filter {
/**
* Create a new <code>XPath2FilterImpl</code> object.
- *
- * @param filterType The type of filter. Must be one of the filter type
- * constants declared in <code>iaik.server.modules.xml.XPath2Transformation.XPath2Filter</code>
- * @param xPathExpression The XPath expression belonging to this filter.
+ *
+ * @param filterType The type of filter. Must be one of the filter
+ * type constants declared in
+ * <code>iaik.server.modules.xml.XPath2Transformation.XPath2Filter</code>
+ * @param xPathExpression The XPath expression belonging to this filter.
* @param namespaceDeclarations The namespace declarations visible for this
- * XPath2Filter.
+ * XPath2Filter.
*/
public XPath2FilterImpl(
- String filterType,
- String xPathExpression,
- Map namespaceDeclarations) {
+ String filterType,
+ String xPathExpression,
+ Map namespaceDeclarations) {
setFilterType(filterType);
setXPathExpression(xPathExpression);
@@ -66,13 +66,14 @@ public class XPath2FilterImpl implements XPath2Filter {
/**
* @see iaik.server.modules.xml.XPath2Transformation.XPath2Filter#getFilterType()
*/
+ @Override
public String getFilterType() {
return filterType;
}
/**
* Set the filter type.
- *
+ *
* @param filterType The filter type to set.
*/
protected void setFilterType(String filterType) {
@@ -82,13 +83,14 @@ public class XPath2FilterImpl implements XPath2Filter {
/**
* @see iaik.server.modules.xml.XPath2Transformation.XPath2Filter#getXPathExpression()
*/
+ @Override
public String getXPathExpression() {
return xPathExpression;
}
/**
* Set the XPath expression.
- *
+ *
* @param xPathExpression The XPath expression to set.
*/
protected void setXPathExpression(String xPathExpression) {
@@ -98,15 +100,16 @@ public class XPath2FilterImpl implements XPath2Filter {
/**
* @see iaik.server.modules.xml.XPath2Transformation.XPath2Filter#getNamespaceDeclarations()
*/
+ @Override
public Map getNamespaceDeclarations() {
return namespaceDeclarations;
}
/**
* Set the namespace declarations.
- *
- * @param namespaceDeclarations The mapping between namespace prefixes and
- * their associated URI.
+ *
+ * @param namespaceDeclarations The mapping between namespace prefixes and their
+ * associated URI.
*/
protected void setNamespaceDeclarations(Map namespaceDeclarations) {
this.namespaceDeclarations = namespaceDeclarations;
@@ -114,18 +117,19 @@ public class XPath2FilterImpl implements XPath2Filter {
/**
* Compare this object to another.
- *
+ *
* @param other The object to compare this <code>XPath2Filter</code> to.
* @return <code>true</code>, if <code>other</code> is a
- * <code>XPath2Filter</code> and the filter types match and the XPath
- * expressions match. Otherwise <code>false</code> is returned.
+ * <code>XPath2Filter</code> and the filter types match and the XPath
+ * expressions match. Otherwise <code>false</code> is returned.
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object other) {
if (other instanceof XPath2Transformation.XPath2Filter) {
- XPath2Filter filter = (XPath2Transformation.XPath2Filter) other;
+ final XPath2Filter filter = (XPath2Transformation.XPath2Filter) other;
return getFilterType().equals(filter.getFilterType())
- && getXPathExpression().equals(filter.getXPathExpression());
+ && getXPathExpression().equals(filter.getXPathExpression());
}
return false;
}
@@ -133,6 +137,7 @@ public class XPath2FilterImpl implements XPath2Filter {
/**
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getXPathExpression().hashCode() * 31 + getFilterType().hashCode();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java
index f483b18..b49bd64 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.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.iaik.xml;
import java.util.ArrayList;
@@ -33,20 +32,20 @@ import iaik.server.modules.xml.XPath2Transformation;
/**
* An object encapsulating a <code>Transformation</code> containing several
* XPath-Filter2 expressions.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XPath2TransformationImpl
- extends TransformationImpl
- implements XPath2Transformation {
+ extends TransformationImpl
+ implements XPath2Transformation {
/** The filters contained in this <code>XPath2Transformation</code> */
- private List xPathFilters = new ArrayList();
+ private final List xPathFilters = new ArrayList();
/**
* Create a new <code>XPath2TransformationImpl</code>.
- *
+ *
* The list of XPath-Filter2 expression is initially empty.
*/
public XPath2TransformationImpl() {
@@ -56,13 +55,14 @@ public class XPath2TransformationImpl
/**
* @see iaik.server.modules.xml.XPath2Transformation#getXPathFilters()
*/
+ @Override
public List getXPathFilters() {
return xPathFilters;
}
/**
* Add an XPath-Filter2 expression to the list of filters.
- *
+ *
* @param filter The filter to add.
*/
public void addXPathFilter(XPath2Filter filter) {
@@ -71,18 +71,18 @@ public class XPath2TransformationImpl
/**
* Compare this <code>XPath2Transformation</code> to another.
- *
- * @param other The object to compare this
- * <code>XPath2Transformation</code> to.
+ *
+ * @param other The object to compare this <code>XPath2Transformation</code> to.
* @return <code>true</code>, if <code>other</code> is an
- * <code>XPath2Transformation</code> and <code>getXPathFilters()</code> equals
- * <code>other.getXPathFilters()</code>. Otherwise <code>false</code> is
- * returned.
+ * <code>XPath2Transformation</code> and <code>getXPathFilters()</code>
+ * equals <code>other.getXPathFilters()</code>. Otherwise
+ * <code>false</code> is returned.
* @see java.lang.Object#equals(Object)
*/
+ @Override
public boolean equals(Object other) {
if (other instanceof XPath2Transformation) {
- XPath2Transformation transform = (XPath2Transformation) other;
+ final XPath2Transformation transform = (XPath2Transformation) other;
return getXPathFilters().equals(transform.getXPathFilters());
}
@@ -92,8 +92,9 @@ public class XPath2TransformationImpl
/**
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
- Iterator iter = getXPathFilters().iterator();
+ final Iterator iter = getXPathFilters().iterator();
int hashCode = 0;
while (iter.hasNext()) {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java
index 06cc319..65b33f4 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.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.iaik.xml;
import java.util.Map;
@@ -30,13 +29,13 @@ import iaik.server.modules.xml.XPathTransformation;
/**
* A <code>Transformation</code> containing an XPath expression.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XPathTransformationImpl
- extends TransformationImpl
- implements XPathTransformation {
+ extends TransformationImpl
+ implements XPathTransformation {
/** The XPath expression. */
private String xPathExpression;
@@ -45,16 +44,16 @@ public class XPathTransformationImpl
/**
* Create a new <code>XPathTransformationImpl</code>.
- *
+ *
* The namespace declarations are initialized empty.
- *
- * @param xPathExpression The XPath expression this object will contain.
+ *
+ * @param xPathExpression The XPath expression this object will contain.
* @param namespaceDeclarations The namespace declarations visible for this
- * XPath.
+ * XPath.
*/
public XPathTransformationImpl(
- String xPathExpression,
- Map namespaceDeclarations) {
+ String xPathExpression,
+ Map namespaceDeclarations) {
setAlgorithmURI(XPathTransformation.XPATH);
setXPathExpression(xPathExpression);
@@ -63,7 +62,7 @@ public class XPathTransformationImpl
/**
* Set the XPath expression.
- *
+ *
* @param xPathExpression The XPath expression.
*/
protected void setXPathExpression(String xPathExpression) {
@@ -73,6 +72,7 @@ public class XPathTransformationImpl
/**
* @see iaik.server.modules.xml.XPathTransformation#getXPathExpression()
*/
+ @Override
public String getXPathExpression() {
return xPathExpression;
}
@@ -80,15 +80,16 @@ public class XPathTransformationImpl
/**
* @see iaik.server.modules.xml.XPathTransformation#getNamespaceDeclarations()
*/
+ @Override
public Map getNamespaceDeclarations() {
return namespaceDeclarations;
}
/**
* Set the namespace declarations.
- *
- * @param namespaceDeclarations The mapping between namespace prefixes and
- * their associated URI.
+ *
+ * @param namespaceDeclarations The mapping between namespace prefixes and their
+ * associated URI.
*/
protected void setNamespaceDeclarations(Map namespaceDeclarations) {
this.namespaceDeclarations = namespaceDeclarations;
@@ -96,17 +97,18 @@ public class XPathTransformationImpl
/**
* Compare this <code>XPathTransformation</code> to another.
- *
- * @param other The object to compare this
- * <code>XPathTransformation</code> to.
+ *
+ * @param other The object to compare this <code>XPathTransformation</code> to.
* @return <code>true</code>, if <code>other</code> is an
- * <code>XPathTransformation</code> and if this object contains the same XPath
- * expression as <code>other</code>. Otherwise <code>false</code> is returned.
+ * <code>XPathTransformation</code> and if this object contains the same
+ * XPath expression as <code>other</code>. Otherwise <code>false</code>
+ * is returned.
* @see java.lang.Object#equals(Object)
*/
+ @Override
public boolean equals(Object other) {
if (other instanceof XPathTransformation) {
- XPathTransformation transform = (XPathTransformation) other;
+ final XPathTransformation transform = (XPathTransformation) other;
return getXPathExpression().equals(transform.getXPathExpression());
}
return false;
@@ -115,6 +117,7 @@ public class XPathTransformationImpl
/**
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getXPathExpression().hashCode();
}
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 9dc45fc..6c71f42 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
@@ -45,204 +45,194 @@ 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 <code>Transformation</code> containing an XSLT transformation.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XSLTTransformationImpl extends TransformationImpl implements XSLTTransformation {
- /** The XSLT stylesheet. */
- private Element styleSheetElement;
- /**
- * The hash code of the canonicalized stylesheet. If calculated, this value
- * should be != 0.
- */
- private int hashCode;
-
- /**
- * Create a new <code>XSLTTransformationImpl</code> object.
- *
- * @param styleSheetElement
- * The XSLT stylesheet element.
- */
- public XSLTTransformationImpl(Element styleSheetElement) {
- setAlgorithmURI(XSLTTransformation.XSLT);
- setStyleSheetElement(styleSheetElement);
- }
-
- /**
- * Set the XSLT stylesheet element.
- *
- * @param styleSheetElement
- * The XSLT stylesheet element to set.
- */
- protected void setStyleSheetElement(Element styleSheetElement) {
- this.styleSheetElement = styleSheetElement;
- this.hashCode = 0;
- }
-
- /**
- * @see iaik.server.modules.xml.XSLTTransformation#getStylesheetElement()
- */
- public Element getStylesheetElement() {
- return styleSheetElement;
- }
-
- /**
- * Compare this <code>XSLTTransformation</code> to another.
- *
- * @param other
- * The object to compare this <code>XSLTTransformation</code> to.
- * @return <code>true</code>, if <code>other</code> is an
- * <code>XSLTTransformation</code> and if the canonicalized
- * representations of the stylesheets contained in <code>this</code>
- * and <code>other</code> match. Otherwise, <code>false</code> is
- * returned.
- * @see java.lang.Object#equals(Object)
- */
- public boolean equals(Object other) {
- if (other instanceof XSLTTransformation) {
- XSLTTransformation xslt = (XSLTTransformation) other;
-
- return compareElements(getStylesheetElement(), xslt.getStylesheetElement());
- }
- return false;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- if (hashCode == 0) {
- hashCode = calculateHashCode(getStylesheetElement());
- }
- return hashCode;
- }
-
- /**
- * Calculate the hash code for a DOM element by canonicalizing it.
- *
- * @param element
- * The DOM element for which the hash code is to be calculated.
- * @return int The hash code, or <code>0</code>, if it could not be
- * calculated.
- */
- private static int calculateHashCode(Element element) {
- try {
- InputStream is = canonicalize(element);
- byte[] buf = new byte[256];
- int hashCode = 1;
- int length;
- int i;
-
- while ((length = is.read(buf)) > 0) {
- for (i = 0; i < length; i++) {
- hashCode += buf[i] * 31 + i;
- }
- }
- is.close();
- return hashCode;
- } catch (IOException e) {
- return 0;
- } catch (NoSuchAlgorithmException e) {
- return 0;
- } catch (InvalidAlgorithmParameterException e) {
- return 0;
- } catch (TransformException e) {
- return 0;
- }
- }
-
- /**
- * Compare two DOM elements by canonicalizing their contents and comparing
- * the resulting byte stream.
- *
- * @param elem1
- * The 1st element to compare.
- * @param elem2
- * The 2nd element to compare.
- * @return boolean <code>true</code>, if the elements are considered equal
- * after canonicalization. Otherwise <code>false</code> is returned.
- */
- private static boolean compareElements(Element elem1, Element elem2) {
- try {
- InputStream is1 = canonicalize(elem1);
- InputStream is2 = canonicalize(elem2);
- return StreamUtils.compareStreams(is1, is2);
- } catch (IOException e) {
- return false;
- } catch (NoSuchAlgorithmException e) {
- return false;
- } catch (InvalidAlgorithmParameterException e) {
- return false;
- } catch (TransformException e) {
- return false;
- }
- }
-
- /**
- * Canonicalize a DOM element.
+ /** The XSLT stylesheet. */
+ private Element styleSheetElement;
+ /**
+ * The hash code of the canonicalized stylesheet. If calculated, this value
+ * should be != 0.
+ */
+ private int hashCode;
+
+ /**
+ * Create a new <code>XSLTTransformationImpl</code> object.
+ *
+ * @param styleSheetElement The XSLT stylesheet element.
+ */
+ public XSLTTransformationImpl(Element styleSheetElement) {
+ setAlgorithmURI(XSLTTransformation.XSLT);
+ setStyleSheetElement(styleSheetElement);
+ }
+
+ /**
+ * Set the XSLT stylesheet element.
+ *
+ * @param styleSheetElement The XSLT stylesheet element to set.
+ */
+ protected void setStyleSheetElement(Element styleSheetElement) {
+ this.styleSheetElement = styleSheetElement;
+ this.hashCode = 0;
+ }
+
+ /**
+ * @see iaik.server.modules.xml.XSLTTransformation#getStylesheetElement()
+ */
+ @Override
+ public Element getStylesheetElement() {
+ return styleSheetElement;
+ }
+
+ /**
+ * Compare this <code>XSLTTransformation</code> to another.
+ *
+ * @param other The object to compare this <code>XSLTTransformation</code> to.
+ * @return <code>true</code>, if <code>other</code> is an
+ * <code>XSLTTransformation</code> and if the canonicalized
+ * representations of the stylesheets contained in <code>this</code> and
+ * <code>other</code> match. Otherwise, <code>false</code> is returned.
+ * @see java.lang.Object#equals(Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof XSLTTransformation) {
+ final XSLTTransformation xslt = (XSLTTransformation) other;
+
+ return compareElements(getStylesheetElement(), xslt.getStylesheetElement());
+ }
+ return false;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ if (hashCode == 0) {
+ hashCode = calculateHashCode(getStylesheetElement());
+ }
+ return hashCode;
+ }
+
+ /**
+ * Calculate the hash code for a DOM element by canonicalizing it.
*
+ * @param element The DOM element for which the hash code is to be calculated.
+ * @return int The hash code, or <code>0</code>, if it could not be calculated.
+ */
+ private static int calculateHashCode(Element element) {
+ try {
+ final InputStream is = canonicalize(element);
+ final byte[] buf = new byte[256];
+ int hashCode = 1;
+ int length;
+ int i;
+
+ while ((length = is.read(buf)) > 0) {
+ for (i = 0; i < length; i++) {
+ hashCode += buf[i] * 31 + i;
+ }
+ }
+ is.close();
+ return hashCode;
+ } catch (final IOException e) {
+ return 0;
+ } catch (final NoSuchAlgorithmException e) {
+ return 0;
+ } catch (final InvalidAlgorithmParameterException e) {
+ return 0;
+ } catch (final TransformException e) {
+ return 0;
+ }
+ }
+
+ /**
+ * Compare two DOM elements by canonicalizing their contents and comparing the
+ * resulting byte stream.
+ *
+ * @param elem1 The 1st element to compare.
+ * @param elem2 The 2nd element to compare.
+ * @return boolean <code>true</code>, if the elements are considered equal after
+ * canonicalization. Otherwise <code>false</code> is returned.
+ */
+ private static boolean compareElements(Element elem1, Element elem2) {
+ try {
+ final InputStream is1 = canonicalize(elem1);
+ final InputStream is2 = canonicalize(elem2);
+ return StreamUtils.compareStreams(is1, is2);
+ } catch (final IOException e) {
+ return false;
+ } catch (final NoSuchAlgorithmException e) {
+ return false;
+ } catch (final InvalidAlgorithmParameterException e) {
+ return false;
+ } catch (final TransformException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Canonicalize a DOM element.
+ *
* @param element The element to canonicalize.
* @return InputStream A stream with the canonicalized data.
- * @throws InvalidAlgorithmParameterException
- * @throws IOException
- * @throws TransformException
- * @throws AlgorithmException An error occurred canonicalizing the element.
+ * @throws InvalidAlgorithmParameterException
+ * @throws IOException
+ * @throws TransformException
+ * @throws AlgorithmException An error occurred canonicalizing
+ * the element.
*/
private static InputStream canonicalize(Element element)
- throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, IOException, TransformException {
- // CanonicalizationMethod canonicalizationMethod =
- // MOAXSecProvider.getXMLSignatureFactory().newCanonicalizationMethod(
- // CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec());
-
- //CanonicalizationAlgorithm c14n =
- // new CanonicalizationAlgorithmImplExclusiveCanonicalXML();
- //Traverser traverser = new Traverser(element, true, true);
- //Canonicalizer canonicalizer = new Canonicalizer(traverser, false, true, null);
-
- //return new CanonInputStream(canonicalizer);
-
- CanonicalizationMethod canonicalizationMethod =
- MOAXSecProvider.getXMLSignatureFactory().newCanonicalizationMethod(
- CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec());
-
- //CanonicalizationAlgorithm c14n =
- // new CanonicalizationAlgorithmImplExclusiveCanonicalXML();
- NodeList nodeList;
-
- try {
- nodeList = XPathUtils.selectNodeList(element,
- XPathUtils.ALL_NODES_XPATH);
- } catch (XPathException e) {
- nodeList = new NodeListAdapter(Collections.EMPTY_LIST);
- }
- //c14n.setInput(nodeList);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- canonicalizationMethod.transform(new
- NodeListToNodeSetDataAdapter(nodeList), null, baos);
- baos.close();
- return new ByteArrayInputStream(baos.toByteArray());
- /*
- NodeList nodeList;
-
+ throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, IOException, TransformException {
+ // CanonicalizationMethod canonicalizationMethod =
+ // MOAXSecProvider.getXMLSignatureFactory().newCanonicalizationMethod(
+ // CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec());
+
+ // CanonicalizationAlgorithm c14n =
+ // new CanonicalizationAlgorithmImplExclusiveCanonicalXML();
+ // Traverser traverser = new Traverser(element, true, true);
+ // Canonicalizer canonicalizer = new Canonicalizer(traverser, false, true,
+ // null);
+
+ // return new CanonInputStream(canonicalizer);
+
+ final CanonicalizationMethod canonicalizationMethod =
+ MOAXSecProvider.getXMLSignatureFactory().newCanonicalizationMethod(
+ CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec());
+
+ // CanonicalizationAlgorithm c14n =
+ // new CanonicalizationAlgorithmImplExclusiveCanonicalXML();
+ NodeList nodeList;
+
try {
- nodeList = XPathUtils.selectNodeList(element, XPathUtils.ALL_NODES_XPATH);
- } catch (XPathException e) {
+ nodeList = XPathUtils.selectNodeList(element,
+ XPathUtils.ALL_NODES_XPATH);
+ } catch (final XPathException e) {
nodeList = new NodeListAdapter(Collections.EMPTY_LIST);
}
- //c14n.setInput(nodeList);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ // c14n.setInput(nodeList);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
canonicalizationMethod.transform(new NodeListToNodeSetDataAdapter(nodeList), null, baos);
baos.close();
- return new ByteArrayInputStream(baos.toByteArray());*/
+ return new ByteArrayInputStream(baos.toByteArray());
+ /*
+ * NodeList nodeList;
+ *
+ * try { nodeList = XPathUtils.selectNodeList(element,
+ * XPathUtils.ALL_NODES_XPATH); } catch (XPathException e) { nodeList = new
+ * NodeListAdapter(Collections.EMPTY_LIST); } //c14n.setInput(nodeList);
+ * ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ * canonicalizationMethod.transform(new NodeListToNodeSetDataAdapter(nodeList),
+ * null, baos); baos.close(); return new
+ * ByteArrayInputStream(baos.toByteArray());
+ */
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java
index 310f2dd..6eb565a 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/DataObjectTreatmentImpl.java
@@ -21,19 +21,17 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.xmlsign;
import java.util.List;
-import iaik.server.modules.xmlsign.DataObjectTreatment;
-
import at.gv.egovernment.moa.spss.server.util.IdGenerator;
+import iaik.server.modules.xmlsign.DataObjectTreatment;
/**
* An object encapsulating how to treat an associated <code>DataObject</code>
* when creating a signature.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -51,29 +49,30 @@ public class DataObjectTreatmentImpl implements DataObjectTreatment {
/** Whether to include the associated data object in the manifest. */
private boolean referenceInManifest;
/** The object ID generator. */
- private IdGenerator objIdGen;
-
+ private final IdGenerator objIdGen;
+
/**
* Create a new <code>DataObjectTreatmentImpl</code>.
- *
+ *
* @param objIdGen The <code>IdGenerator</code> for unique object IDs.
*/
public DataObjectTreatmentImpl(IdGenerator objIdGen) {
this.objIdGen = objIdGen;
}
-
+
/**
* @see iaik.server.modules.xmlsign.DataObjectTreatment#getFinalContentType()
*/
+ @Override
public String getFinalContentType() {
return finalContentType;
}
/**
* Sets the final content type.
- *
+ *
* @param finalContentType The final content type to set (a MIME-type type of
- * <code>String</code>).
+ * <code>String</code>).
*/
public void setFinalContentType(String finalContentType) {
this.finalContentType = finalContentType;
@@ -82,13 +81,14 @@ public class DataObjectTreatmentImpl implements DataObjectTreatment {
/**
* @see iaik.server.modules.xmlsign.DataObjectTreatment#getHashAlgorithmName()
*/
+ @Override
public String getHashAlgorithmName() {
return hashAlgorithmName;
}
/**
* Sets the hash algorithm name.
- *
+ *
* @param hashAlgorithmName The hash algorithm name to set.
*/
public void setHashAlgorithmName(String hashAlgorithmName) {
@@ -98,16 +98,18 @@ public class DataObjectTreatmentImpl implements DataObjectTreatment {
/**
* @see iaik.server.modules.xmlsign.DataObjectTreatment#isIncludedInSignature()
*/
+ @Override
public boolean isIncludedInSignature() {
return includedInSignature;
}
/**
- * Sets whether the associated <code>DataObject</code> is to be included in
- * the signature.
- *
+ * Sets whether the associated <code>DataObject</code> is to be included in the
+ * signature.
+ *
* @param includedInSignature If <code>true</code>, the associated
- * <code>DataObject</code> will be included in the signature, otherwise not.
+ * <code>DataObject</code> will be included in the
+ * signature, otherwise not.
*/
public void setIncludedInSignature(boolean includedInSignature) {
this.includedInSignature = includedInSignature;
@@ -116,16 +118,18 @@ public class DataObjectTreatmentImpl implements DataObjectTreatment {
/**
* @see iaik.server.modules.xmlsign.DataObjectTreatment#isReferenceInManifest()
*/
+ @Override
public boolean isReferenceInManifest() {
return referenceInManifest;
}
/**
- * Sets whether the associated <code>DataObject</code> is
- * to be included in the <code>dsig:Manifest</code>.
- *
+ * Sets whether the associated <code>DataObject</code> is to be included in the
+ * <code>dsig:Manifest</code>.
+ *
* @param referenceInManifest If <code>true</code>, the associated
- * <code>DataObject</code> will be included in the manifest, otherwise not.
+ * <code>DataObject</code> will be included in the
+ * manifest, otherwise not.
*/
public void setReferenceInManifest(boolean referenceInManifest) {
this.referenceInManifest = referenceInManifest;
@@ -134,13 +138,14 @@ public class DataObjectTreatmentImpl implements DataObjectTreatment {
/**
* @see iaik.server.modules.xmlsign.DataObjectTreatment#getTransformationList()
*/
+ @Override
public List getTransformationList() {
return transformationList;
}
/**
* Set the list of transformations for the associated <code>DataObject</code>.
- *
+ *
* @param transformationList The transformations to set.
*/
public void setTransformationList(List transformationList) {
@@ -150,6 +155,7 @@ public class DataObjectTreatmentImpl implements DataObjectTreatment {
/**
* @see iaik.server.modules.xmlsign.DataObjectTreatment#getTransformationSupplements()
*/
+ @Override
public List getTransformationSupplements() {
return transformationSupplements;
}
@@ -157,16 +163,17 @@ public class DataObjectTreatmentImpl implements DataObjectTreatment {
/**
* Sets the transformation supplements for the associated
* <code>DataObject</code>.
- *
+ *
* @param transformationSupplements The transformation supplements to set.
*/
public void setTransformationSupplements(List transformationSupplements) {
this.transformationSupplements = transformationSupplements;
}
-
+
/**
* @see iaik.server.modules.xmlsign.DataObjectTreatment#getDsigDataObjectID()
*/
+ @Override
public String getDsigDataObjectID() {
return objIdGen.uniqueId();
}
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 9d6e3d2..516e3d8 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
@@ -21,9 +21,16 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.xmlsign;
+import java.util.List;
+import java.util.Set;
+
+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;
import iaik.server.modules.algorithms.SignatureAlgorithms;
import iaik.server.modules.keys.AlgorithmUnavailableException;
import iaik.server.modules.keys.KeyEntryID;
@@ -34,23 +41,14 @@ import iaik.server.modules.xml.Canonicalization;
import iaik.server.modules.xmlsign.XMLSignatureCreationProfile;
import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation;
-import java.util.List;
-import java.util.Set;
-
-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.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XMLSignatureCreationProfileImpl
- implements XMLSignatureCreationProfile {
+ implements XMLSignatureCreationProfile {
/** The transformations to apply to a data object. */
private List dataObjectTreatmentList;
@@ -58,7 +56,7 @@ public class XMLSignatureCreationProfileImpl
private Set keySet;
/** The type URI of the signature manifest. */
private String securityLayerManifestTypeURI;
- /** Whether the created signature is to be Security Layer conform. */
+ /** Whether the created signature is to be Security Layer conform. */
private boolean securityLayerConform;
/** Where to insert the signature into the signature environment. */
private XMLSignatureInsertionLocation signatureInsertionLocation;
@@ -66,55 +64,55 @@ public class XMLSignatureCreationProfileImpl
private String signatureStructureType;
/** The type of <code>Canonicalization</code> to use for the signed info. */
private Canonicalization signedInfoCanonicalization;
- /** Properties to be signed during signature creation. */
+ /** Properties to be signed during signature creation. */
private List signedProperties;
/** The ID generator for signature IDs. */
- private IdGenerator signatureIDGenerator;
+ private final IdGenerator signatureIDGenerator;
/** The ID generator for manifst IDs. */
- private IdGenerator manifestIDGenerator;
+ private final IdGenerator manifestIDGenerator;
/** The ID generator for XMLDsig manifest IDs. */
- private IdGenerator dsigManifestIDGenerator;
+ private final IdGenerator dsigManifestIDGenerator;
/** The ID generator for signed property IDs. */
- private IdGenerator propertyIDGenerator;
- /** The selected digest method algorithm if XAdES 1.4.2 is used */
- private String digestMethodXAdES142;
-
-
+ private final IdGenerator propertyIDGenerator;
+ /** The selected digest method algorithm if XAdES 1.4.2 is used */
+ private final String digestMethodXAdES142;
+
/**
* Create a new <code>XMLSignatureCreationProfileImpl</code>.
- *
- * @param createProfileCount Provides external information about the
- * number of calls to the signature creation module, using the same request.
- * @param reservedIDs The set of IDs that must not be used while generating
- * new IDs.
+ *
+ * @param createProfileCount Provides external information about the number of
+ * calls to the signature creation module, using the
+ * same request.
+ * @param reservedIDs The set of IDs that must not be used while
+ * generating new IDs.
*/
public XMLSignatureCreationProfileImpl(
- int createProfileCount,
- Set reservedIDs,
- String digestMethodXAdES142) {
+ int createProfileCount,
+ Set reservedIDs,
+ String digestMethodXAdES142) {
signatureIDGenerator =
- new IdGenerator("signature-" + createProfileCount, reservedIDs);
+ new IdGenerator("signature-" + createProfileCount, reservedIDs);
manifestIDGenerator =
- new IdGenerator("manifest-" + createProfileCount, reservedIDs);
+ new IdGenerator("manifest-" + createProfileCount, reservedIDs);
dsigManifestIDGenerator =
- new IdGenerator("dsig-manifest-" + createProfileCount, reservedIDs);
+ new IdGenerator("dsig-manifest-" + createProfileCount, reservedIDs);
propertyIDGenerator =
- new IdGenerator("etsi-signed-" + createProfileCount, reservedIDs);
+ new IdGenerator("etsi-signed-" + createProfileCount, reservedIDs);
this.digestMethodXAdES142 = digestMethodXAdES142;
}
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getDataObjectTreatmentList()
*/
+ @Override
public List getDataObjectTreatmentList() {
return dataObjectTreatmentList;
}
/**
* Sets the list of <code>DataObjectTreatment</code>s.
- *
- * @param dataObjectTreatmentList The <code>DataObjectTreatment</code>s to
- * set.
+ *
+ * @param dataObjectTreatmentList The <code>DataObjectTreatment</code>s to set.
*/
public void setDataObjectTreatmentList(List dataObjectTreatmentList) {
this.dataObjectTreatmentList = dataObjectTreatmentList;
@@ -123,6 +121,7 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getKeySet()
*/
+ @Override
public Set getKeySet() {
return keySet;
}
@@ -130,7 +129,7 @@ public class XMLSignatureCreationProfileImpl
/**
* Set the set of <code>KeyEntryID</code>s which may be used for signature
* creation.
- *
+ *
* @param keySet The set of <code>KeyEntryID</code>s to set.
*/
public void setKeySet(Set keySet) {
@@ -140,15 +139,15 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSecurityLayerManifestTypeURI()
*/
+ @Override
public String getSecurityLayerManifestTypeURI() {
return securityLayerManifestTypeURI;
}
/**
* Set the SecurityLayerManifestTypeURI.
- *
- * @param securityLayerManifestTypeURI The SecurityLayerManifestTypeURI to
- * set.
+ *
+ * @param securityLayerManifestTypeURI The SecurityLayerManifestTypeURI to set.
*/
public void setSecurityLayerManifestTypeURI(String securityLayerManifestTypeURI) {
this.securityLayerManifestTypeURI = securityLayerManifestTypeURI;
@@ -157,132 +156,131 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignatureAlgorithmName(KeyEntryID)
*/
+ @Override
public String getSignatureAlgorithmName(KeyEntryID selectedKeyID)
- throws AlgorithmUnavailableException {
+ throws AlgorithmUnavailableException {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- TransactionId tid = new TransactionId(context.getTransactionID());
- KeyModule module = KeyModuleFactory.getInstance(tid);
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final TransactionId tid = new TransactionId(context.getTransactionID());
+ final KeyModule module = KeyModuleFactory.getInstance(tid);
Set algorithms;
try {
algorithms = module.getSupportedSignatureAlgorithms(selectedKeyID);
- } catch (UnknownKeyException e) {
+ } catch (final UnknownKeyException e) {
throw new AlgorithmUnavailableException(
- "Unknown key entry: " + selectedKeyID,
- e,
- null);
+ "Unknown key entry: " + selectedKeyID,
+ e,
+ null);
}
-
+
if (digestMethodXAdES142 == null) {
- // XAdES 1.4.2 not enabled - legacy MOA
- if (algorithms.contains(SignatureAlgorithms.MD2_WITH_RSA)
- || algorithms.contains(SignatureAlgorithms.MD5_WITH_RSA)
- || algorithms.contains(SignatureAlgorithms.RIPEMD128_WITH_RSA)
- || algorithms.contains(SignatureAlgorithms.RIPEMD160_WITH_RSA)
- || algorithms.contains(SignatureAlgorithms.SHA1_WITH_RSA)
- || algorithms.contains(SignatureAlgorithms.SHA256_WITH_RSA)) {
-
- return SignatureAlgorithms.SHA1_WITH_RSA;
- } else if (
- algorithms.contains(SignatureAlgorithms.ECDSA)) {
- return SignatureAlgorithms.ECDSA;
- } else if (
- algorithms.contains(SignatureAlgorithms.DSA)) {
- return SignatureAlgorithms.DSA;
+ // XAdES 1.4.2 not enabled - legacy MOA
+ if (algorithms.contains(SignatureAlgorithms.MD2_WITH_RSA)
+ || algorithms.contains(SignatureAlgorithms.MD5_WITH_RSA)
+ || algorithms.contains(SignatureAlgorithms.RIPEMD128_WITH_RSA)
+ || algorithms.contains(SignatureAlgorithms.RIPEMD160_WITH_RSA)
+ || algorithms.contains(SignatureAlgorithms.SHA1_WITH_RSA)
+ || algorithms.contains(SignatureAlgorithms.SHA256_WITH_RSA)) {
+
+ return SignatureAlgorithms.SHA1_WITH_RSA;
+ } else if (algorithms.contains(SignatureAlgorithms.ECDSA)) {
+ return SignatureAlgorithms.ECDSA;
+ } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
+ return SignatureAlgorithms.DSA;
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No algorithm for key entry: " + selectedKeyID,
+ null,
+ null);
+ }
+ } else {
+ // XAdES 1.4.2 is enabled: select signature algorithm according to selected
+ // digest method
+ if (digestMethodXAdES142.compareTo("SHA-1") == 0) {
+ Logger.warn(
+ "XAdES version 1.4.2 is enabled, but SHA-1 is configured as digest algorithm. Please revise a use of a more secure digest algorithm out of the SHA-2 family (e.g. SHA-256, SHA-384, SHA-512)");
+
+ if (algorithms.contains(SignatureAlgorithms.SHA1_WITH_RSA)) {
+ return SignatureAlgorithms.SHA1_WITH_RSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.ECDSA)) {
+ return SignatureAlgorithms.ECDSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
+ return SignatureAlgorithms.DSA;
+
} else {
- throw new AlgorithmUnavailableException(
- "No algorithm for key entry: " + selectedKeyID,
- null,
- null);
+ throw new AlgorithmUnavailableException(
+ "No algorithm for key entry: " + selectedKeyID,
+ null,
+ null);
}
+
+ } else if (digestMethodXAdES142.compareTo("SHA-256") == 0) {
+ if (algorithms.contains(SignatureAlgorithms.SHA256_WITH_RSA)) {
+ return SignatureAlgorithms.SHA256_WITH_RSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.SHA256_WITH_ECDSA)) {
+ return SignatureAlgorithms.SHA256_WITH_ECDSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
+ return SignatureAlgorithms.DSA;
+
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No algorithm for key entry: " + selectedKeyID,
+ null,
+ null);
+ }
+ } else if (digestMethodXAdES142.compareTo("SHA-384") == 0) {
+ if (algorithms.contains(SignatureAlgorithms.SHA384_WITH_RSA)) {
+ return SignatureAlgorithms.SHA384_WITH_RSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.SHA384_WITH_ECDSA)) {
+ return SignatureAlgorithms.SHA384_WITH_ECDSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
+ return SignatureAlgorithms.DSA;
+
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No algorithm for key entry: " + selectedKeyID,
+ null,
+ null);
+ }
+ } else if (digestMethodXAdES142.compareTo("SHA-512") == 0) {
+ if (algorithms.contains(SignatureAlgorithms.SHA512_WITH_RSA)) {
+ return SignatureAlgorithms.SHA512_WITH_RSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.SHA512_WITH_ECDSA)) {
+ return SignatureAlgorithms.SHA512_WITH_ECDSA;
+
+ } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
+ return SignatureAlgorithms.DSA;
+
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No algorithm for key entry: " + selectedKeyID,
+ null,
+ null);
+ }
+ } else {
+ throw new AlgorithmUnavailableException(
+ "No signature algorithm found for digest algorithm '" + digestMethodXAdES142,
+ null,
+ null);
+ }
+
}
- else {
- // XAdES 1.4.2 is enabled: select signature algorithm according to selected digest method
- if (digestMethodXAdES142.compareTo("SHA-1") == 0) {
- Logger.warn("XAdES version 1.4.2 is enabled, but SHA-1 is configured as digest algorithm. Please revise a use of a more secure digest algorithm out of the SHA-2 family (e.g. SHA-256, SHA-384, SHA-512)");
-
- if (algorithms.contains(SignatureAlgorithms.SHA1_WITH_RSA)) {
- return SignatureAlgorithms.SHA1_WITH_RSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.ECDSA)) {
- return SignatureAlgorithms.ECDSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
- return SignatureAlgorithms.DSA;
-
- } else {
- throw new AlgorithmUnavailableException(
- "No algorithm for key entry: " + selectedKeyID,
- null,
- null);
- }
-
- } else if (digestMethodXAdES142.compareTo("SHA-256") == 0) {
- if (algorithms.contains(SignatureAlgorithms.SHA256_WITH_RSA)) {
- return SignatureAlgorithms.SHA256_WITH_RSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.SHA256_WITH_ECDSA)) {
- return SignatureAlgorithms.SHA256_WITH_ECDSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
- return SignatureAlgorithms.DSA;
-
- } else {
- throw new AlgorithmUnavailableException(
- "No algorithm for key entry: " + selectedKeyID,
- null,
- null);
- }
- } else if (digestMethodXAdES142.compareTo("SHA-384") == 0) {
- if (algorithms.contains(SignatureAlgorithms.SHA384_WITH_RSA)) {
- return SignatureAlgorithms.SHA384_WITH_RSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.SHA384_WITH_ECDSA)) {
- return SignatureAlgorithms.SHA384_WITH_ECDSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
- return SignatureAlgorithms.DSA;
-
- } else {
- throw new AlgorithmUnavailableException(
- "No algorithm for key entry: " + selectedKeyID,
- null,
- null);
- }
- } else if (digestMethodXAdES142.compareTo("SHA-512") == 0) {
- if (algorithms.contains(SignatureAlgorithms.SHA512_WITH_RSA)) {
- return SignatureAlgorithms.SHA512_WITH_RSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.SHA512_WITH_ECDSA)) {
- return SignatureAlgorithms.SHA512_WITH_ECDSA;
-
- } else if (algorithms.contains(SignatureAlgorithms.DSA)) {
- return SignatureAlgorithms.DSA;
-
- } else {
- throw new AlgorithmUnavailableException(
- "No algorithm for key entry: " + selectedKeyID,
- null,
- null);
- }
- }
- else {
- throw new AlgorithmUnavailableException(
- "No signature algorithm found for digest algorithm '" + digestMethodXAdES142,
- null,
- null);
- }
-
- }
-
}
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignatureInsertionLocation()
*/
+ @Override
public XMLSignatureInsertionLocation getSignatureInsertionLocation() {
return signatureInsertionLocation;
}
@@ -290,7 +288,7 @@ public class XMLSignatureCreationProfileImpl
/**
* Set the location where the signature is to be inserted into the signature
* parent.
- *
+ *
* @param signatureInsertionLocation The location to set.
*/
public void setSignatureInsertionLocation(XMLSignatureInsertionLocation signatureInsertionLocation) {
@@ -300,12 +298,14 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignatureStructureType()
*/
+ @Override
public String getSignatureStructureType() {
return signatureStructureType;
}
/**
* Set the signature structure type.
+ *
* @param signatureStructureType The signature structure type to set.
*/
public void setSignatureStructureType(String signatureStructureType) {
@@ -315,13 +315,14 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignedInfoCanonicalization()
*/
+ @Override
public Canonicalization getSignedInfoCanonicalization() {
return signedInfoCanonicalization;
}
/**
* Sets the canonicalization method to use for the SignedInfo object.
- *
+ *
* @param signedInfoCanonicalization The canonicalization method to set.
*/
public void setSignedInfoCanonicalization(Canonicalization signedInfoCanonicalization) {
@@ -331,13 +332,14 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignedProperties()
*/
+ @Override
public List getSignedProperties() {
return signedProperties;
}
/**
* Set the signed properties.
- *
+ *
* @param signedProperties The signed properties to set.
*/
public void setSignedProperties(List signedProperties) {
@@ -347,15 +349,16 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#isSecurityLayerConform()
*/
+ @Override
public boolean isSecurityLayerConform() {
return securityLayerConform;
}
/**
* Sets the security layer conformity.
- *
- * @param securityLayerConform <code>true</code>, if the created signature
- * is to be conform to the Security Layer specification.
+ *
+ * @param securityLayerConform <code>true</code>, if the created signature is to
+ * be conform to the Security Layer specification.
*/
public void setSecurityLayerConform(boolean securityLayerConform) {
this.securityLayerConform = securityLayerConform;
@@ -364,6 +367,7 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignatureID()
*/
+ @Override
public String getSignatureID() {
return signatureIDGenerator.uniqueId();
}
@@ -371,6 +375,7 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSecurityLayerManifestID()
*/
+ @Override
public String getSecurityLayerManifestID() {
return manifestIDGenerator.uniqueId();
}
@@ -378,6 +383,7 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getDsigManifestID()
*/
+ @Override
public String getDsigManifestID() {
return dsigManifestIDGenerator.uniqueId();
}
@@ -385,13 +391,15 @@ public class XMLSignatureCreationProfileImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getSignedPropertiesID()
*/
+ @Override
public String getSignedPropertiesID() {
return propertyIDGenerator.uniqueId();
}
-
+
/**
* @see iaik.server.modules.xmlsign.XMLSignatureCreationProfile#getPermitFileURIs()
*/
+ @Override
public boolean getPermitFileURIs() {
return false;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java
index 90c1f49..a5290a7 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlsign/XMLSignatureInsertionLocationImpl.java
@@ -21,29 +21,28 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.xmlsign;
import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation;
/**
- * An object giving the location of where the signature will be
- * inserted into the parent element.
- *
+ * An object giving the location of where the signature will be inserted into
+ * the parent element.
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XMLSignatureInsertionLocationImpl
- implements XMLSignatureInsertionLocation {
+ implements XMLSignatureInsertionLocation {
/** Where to put the signature into the signature parent element. */
private int signatureChildIndex;
-
+
/**
* Create a new <code>XMLSignatureInsertLocationImpl</code>.
- *
+ *
* @param signatureChildIndex The position index at which to append the
- * signature to the parent element.
+ * signature to the parent element.
*/
public XMLSignatureInsertionLocationImpl(int signatureChildIndex) {
setSignatureChildIndex(signatureChildIndex);
@@ -52,6 +51,7 @@ public class XMLSignatureInsertionLocationImpl
/**
* @see iaik.server.modules.xmlsign.XMLSignatureInsertionLocation#getSignatureChildIndex()
*/
+ @Override
public int getSignatureChildIndex() {
return signatureChildIndex;
}
@@ -59,7 +59,7 @@ public class XMLSignatureInsertionLocationImpl
/**
* Sets the position index at which to append the signature to the parent
* element.
- *
+ *
* @param signatureChildIndex The position index to set.
*/
public void setSignatureChildIndex(int signatureChildIndex) {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java
index 0ad3d79..6e4883f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xmlverify/XMLSignatureVerificationProfileImpl.java
@@ -21,22 +21,22 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.iaik.xmlverify;
import java.util.List;
import iaik.pki.PKIProfile;
+import iaik.server.modules.SignatureVerificationProfile;
import iaik.server.modules.xmlverify.XMLSignatureVerificationProfile;
/**
* An object providing auxiliary information for verifying an XML signature.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XMLSignatureVerificationProfileImpl
- implements XMLSignatureVerificationProfile {
+ implements XMLSignatureVerificationProfile {
/** Whether to check the Security Layer manifest. */
private boolean checkSecurityLayerManifest;
@@ -52,18 +52,20 @@ public class XMLSignatureVerificationProfileImpl
private boolean includeReferenceInputData;
/** Whether the file URIs are permitted */
private boolean permitFileURIs;
+
/**
* @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#checkSecurityLayerManifest()
*/
+ @Override
public boolean checkSecurityLayerManifest() {
return checkSecurityLayerManifest;
}
/**
* Set whether to check the references in the Security Layer manifest.
- *
- * @param checkSecurityLayerManifest <code>true</code>, if the references
- * in the Security Layer manifest must be checked.
+ *
+ * @param checkSecurityLayerManifest <code>true</code>, if the references in the
+ * Security Layer manifest must be checked.
*/
public void setCheckSecurityLayerManifest(boolean checkSecurityLayerManifest) {
this.checkSecurityLayerManifest = checkSecurityLayerManifest;
@@ -72,15 +74,16 @@ public class XMLSignatureVerificationProfileImpl
/**
* @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#checkXMLDsigManifests()
*/
+ @Override
public boolean checkXMLDsigManifests() {
return checkXMLDsigManifests;
}
/**
* Sets whether to check the references of all XML Dsig manifests.
- *
- * @param checkXMLDSigManifests <code>true</code>, if the references in the
- * XML Dsig manifest must be checked.
+ *
+ * @param checkXMLDSigManifests <code>true</code>, if the references in the XML
+ * Dsig manifest must be checked.
*/
public void setCheckXMLDsigManifests(boolean checkXMLDSigManifests) {
this.checkXMLDsigManifests = checkXMLDSigManifests;
@@ -89,15 +92,16 @@ public class XMLSignatureVerificationProfileImpl
/**
* @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#getCertificateValidationProfile()
*/
+ @Override
public PKIProfile getCertificateValidationProfile() {
return certificateValidationProfile;
}
/**
* Sets the profile for validating the signer certificate.
- *
+ *
* @param certificateValidationProfile The certificate validation profile to
- * set.
+ * set.
*/
public void setCertificateValidationProfile(PKIProfile certificateValidationProfile) {
this.certificateValidationProfile = certificateValidationProfile;
@@ -106,13 +110,14 @@ public class XMLSignatureVerificationProfileImpl
/**
* @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#getTransformationSupplements()
*/
+ @Override
public List getTransformationSupplements() {
return transformationSupplements;
}
/**
* Sets the transformation supplements.
- *
+ *
* @param transformationSupplements The transformation supplements to set.
*/
public void setTransformationSupplements(List transformationSupplements) {
@@ -122,15 +127,16 @@ public class XMLSignatureVerificationProfileImpl
/**
* @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#includeHashInputData()
*/
+ @Override
public boolean includeHashInputData() {
return includeHashInputData;
}
/**
* Set whether to include the hash input data in the result.
- *
- * @param includeHashInputData If <code>true</code>, the hash input data
- * will be returned in the result.
+ *
+ * @param includeHashInputData If <code>true</code>, the hash input data will be
+ * returned in the result.
*/
public void setIncludeHashInputData(boolean includeHashInputData) {
this.includeHashInputData = includeHashInputData;
@@ -139,39 +145,40 @@ public class XMLSignatureVerificationProfileImpl
/**
* @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#includeReferenceInputData()
*/
+ @Override
public boolean includeReferenceInputData() {
return includeReferenceInputData;
}
/**
* Set whether to include the reference input data in the result.
- *
- * @param includeReferenceInputData If <code>true</code>, the reference
- * input data will be included in the result.
+ *
+ * @param includeReferenceInputData If <code>true</code>, the reference input
+ * data will be included in the result.
*/
public void setIncludeReferenceInputData(boolean includeReferenceInputData) {
this.includeReferenceInputData = includeReferenceInputData;
}
-
+
/**
- * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#getPermitFileURIs()
+ * @see iaik.server.modules.xmlverify.XMLSignatureVerificationProfile#getPermitFileURIs()
*/
+ @Override
public boolean getPermitFileURIs() {
return permitFileURIs;
}
-
+
/**
* Set whether the file URIs are permitted or not
- *
+ *
* @param permitFileURIs whether the file URIs are permitted or not
*/
- public void setPermitFileURIs(boolean permitFileURIs)
- {
+ public void setPermitFileURIs(boolean permitFileURIs) {
this.permitFileURIs = permitFileURIs;
}
@Override
public String getTargetLevel() {
- return XMLSignatureVerificationProfile.LEVEL_LTA;
+ return SignatureVerificationProfile.LEVEL_LTA;
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java
index 8ab01d6..5726220 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ConfiguratorImpl.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.init;
import at.gv.egovernment.moa.spss.MOAException;
@@ -29,10 +28,11 @@ import at.gv.egovernment.moa.spss.api.Configurator;
import at.gv.egovernment.moa.spss.server.config.ConfigurationException;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator;
+import iaik.server.ConfigurationData;
/**
* Default implementation of <code>Configurator</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -40,26 +40,45 @@ public class ConfiguratorImpl extends Configurator {
/** whether the configuration has been initialized */
private boolean initialized = false;
- public void init() throws MOAException {
+ StartupConfigurationHolder result;
+
+ @Override
+ public StartupConfigurationHolder getCurrentConfiguration() {
+ return result;
+
+ }
+
+ @Override
+ public StartupConfigurationHolder init() throws MOAException {
if (!initialized) {
- SystemInitializer.init();
+ result = SystemInitializer.init();
initialized = true;
+
}
+
+ return result;
+
}
- public void update() throws MOAException {
+ @Override
+ public StartupConfigurationHolder update() throws MOAException {
if (!initialized) {
- return;
+ return null;
}
-
+
try {
// reconfigure the system
- ConfigurationProvider config = ConfigurationProvider.reload();
- new IaikConfigurator().configure(config);
- } catch (MOAException e) {
+ final ConfigurationProvider config = ConfigurationProvider.reload();
+ final ConfigurationData iaikConfig = new IaikConfigurator().configure(config);
+ result = new StartupConfigurationHolder(config, iaikConfig);
+ return result;
+
+ } catch (final MOAException e) {
throw e;
- } catch (Throwable t) {
- throw new ConfigurationException("", null, t);
+
+ } catch (final Throwable t) {
+ throw new ConfigurationException("MOA-SPSS initialization FAILED with a generic error", null, t);
+
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ExternalInitializer.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ExternalInitializer.java
index 692ee53..73a183f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ExternalInitializer.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/ExternalInitializer.java
@@ -3,5 +3,5 @@ package at.gv.egovernment.moa.spss.server.init;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
public interface ExternalInitializer {
- public void initialize(ConfigurationProvider configurationProvider);
+ void initialize(ConfigurationProvider configurationProvider);
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/StartupConfigurationHolder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/StartupConfigurationHolder.java
new file mode 100644
index 0000000..903b08b
--- /dev/null
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/StartupConfigurationHolder.java
@@ -0,0 +1,40 @@
+package at.gv.egovernment.moa.spss.server.init;
+
+import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
+import iaik.server.ConfigurationData;
+
+public class StartupConfigurationHolder {
+
+ private final ConfigurationProvider moaSpssConfig;
+ private final ConfigurationData iaikConfiguration;
+
+ /**
+ * Holder for IAIK and MOA-SPSS related configuration object.
+ *
+ * @param config MOA-SPSS specific configuration
+ * @param iaikConfig Internal IAIK module configuration
+ */
+ public StartupConfigurationHolder(ConfigurationProvider config, ConfigurationData iaikConfig) {
+ this.moaSpssConfig = config;
+ this.iaikConfiguration = iaikConfig;
+ }
+
+ /**
+ * Get MOA-SPSS configuration object from start-up process.
+ *
+ * @return MOA-SPSS configuration
+ */
+ public ConfigurationProvider getMoaSpssConfig() {
+ return moaSpssConfig;
+ }
+
+ /**
+ * Get configuration object for IAIK modules from start-up process.
+ *
+ * @return IAIK module configuration
+ */
+ public ConfigurationData getIaikConfiguration() {
+ return iaikConfiguration;
+ }
+
+}
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 0e592f0..28231e6 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
@@ -21,15 +21,11 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.init;
-import java.io.FileNotFoundException;
import java.io.IOException;
-import java.security.cert.CertificateException;
import java.util.Calendar;
import java.util.Date;
-import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.ServiceLoader;
import java.util.Timer;
@@ -52,13 +48,13 @@ import at.gv.egovernment.moaspss.logging.LoggingContextManager;
import at.gv.egovernment.moaspss.util.Constants;
import at.gv.egovernment.moaspss.util.DOMUtils;
import iaik.asn1.ObjectID;
-import iaik.pki.store.certstore.CertStoreException;
-import iaik.pki.store.truststore.TrustStoreException;
+import iaik.pkcs.pkcs12.PKCS12KeyStore;
import iaik.server.ConfigurationData;
+import iaik.utils.RFC2253NameParser;
/**
* MOA SP/SS web service initialization.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -69,37 +65,40 @@ public class SystemInitializer {
private static final String LOGGING_HIERARCHY = "moa.spss.server";
/** Whether XML schema grammars have been initialized. */
private static boolean grammarsInitialized = false;
-
+
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(SystemInitializer.class);
- private static ServiceLoader<ExternalInitializer> initializerServices =
- ServiceLoader.load(ExternalInitializer.class);
-
-
+ private static ServiceLoader<ExternalInitializer> initializerServices =
+ ServiceLoader.load(ExternalInitializer.class);
+ private static ConfigurationData iaikConfiguration;
+ private static ConfigurationProvider config;
+
private static void runInitializer(ConfigurationProvider configurationProvider) {
- Iterator<ExternalInitializer> initializerIterator = initializerServices.iterator();
- logger.info("Running external initializers");
- while(initializerIterator.hasNext()) {
- ExternalInitializer externalInitializer = initializerIterator.next();
- externalInitializer.initialize(configurationProvider);
- }
+ final Iterator<ExternalInitializer> initializerIterator = initializerServices.iterator();
+ logger.info("Running external initializers");
+ while (initializerIterator.hasNext()) {
+ final ExternalInitializer externalInitializer = initializerIterator.next();
+ externalInitializer.initialize(configurationProvider);
+ }
}
-
+
/**
* Initialize the MOA SP/SS webservice.
+ *
+ * @return
*/
- public static void init() {
-
- logger.info("##############################################################################");
- logger.info("##############################################################################");
- logger.info("### ###");
- logger.info("### LOADING MOA-SPSS ###");
- logger.info("### ================ ###");
- logger.info("### ###");
- logger.info("##############################################################################");
- logger.info("##############################################################################");
-
- MessageProvider msg = MessageProvider.getInstance();
+ public static StartupConfigurationHolder init() {
+
+ logger.info("##############################################################################");
+ logger.info("##############################################################################");
+ logger.info("### ###");
+ logger.info("### LOADING MOA-SPSS ###");
+ logger.info("### ================ ###");
+ logger.info("### ###");
+ logger.info("##############################################################################");
+ logger.info("##############################################################################");
+
+ final MessageProvider msg = MessageProvider.getInstance();
Thread archiveCleaner;
@@ -108,91 +107,99 @@ public class SystemInitializer {
// set up a logging context for logging the startup
LoggingContextManager.getInstance().setLoggingContext(
- new LoggingContext("startup"));
-
+ new LoggingContext("startup"));
+
// AxisProperties.setProperty("enableNamespacePrefixOptimization","false");
// AxisProperties.setProperty("disablePrettyXML", "true");
// AxisProperties.setProperty("axis.doAutoTypes", "true");
-
- // initialize preparsed Xerces grammar pool for faster XML
+
+ // initialize preparsed Xerces grammar pool for faster XML
// parsing/validating
try {
if (!grammarsInitialized) {
- Class clazz = SystemInitializer.class;
+ final Class clazz = SystemInitializer.class;
// preparse XML schema
DOMUtils.addSchemaToPool(
- clazz.getResourceAsStream(Constants.XML_SCHEMA_LOCATION),
- Constants.XML_NS_URI);
+ clazz.getResourceAsStream(Constants.XML_SCHEMA_LOCATION),
+ Constants.XML_NS_URI);
// preparse XMLDsig Filter2 schema
DOMUtils.addSchemaToPool(
- clazz.getResourceAsStream(Constants.DSIG_FILTER2_SCHEMA_LOCATION),
- Constants.DSIG_FILTER2_NS_URI);
+ clazz.getResourceAsStream(Constants.DSIG_FILTER2_SCHEMA_LOCATION),
+ Constants.DSIG_FILTER2_NS_URI);
// preparse XMLDsig schema
DOMUtils.addSchemaToPool(
- clazz.getResourceAsStream(Constants.DSIG_SCHEMA_LOCATION),
- Constants.DSIG_NS_URI);
+ clazz.getResourceAsStream(Constants.DSIG_SCHEMA_LOCATION),
+ Constants.DSIG_NS_URI);
// preparse MOA schema
DOMUtils.addSchemaToPool(
- clazz.getResourceAsStream(Constants.MOA_SCHEMA_LOCATION),
- Constants.MOA_NS_URI);
+ clazz.getResourceAsStream(Constants.MOA_SCHEMA_LOCATION),
+ Constants.MOA_NS_URI);
grammarsInitialized = true;
}
- } catch (IOException e) {
+ } catch (final IOException e) {
Logger.warn(new LogMsg(msg.getMessage("init.04", null)), e);
}
-
+
// initialize configuration
try {
- Logger.info("Initialize MOA-SP/SS configuration ... ");
- ConfigurationProvider config = ConfigurationProvider.getInstance();
-
- //initialize TSL module
- TSLConfiguration moaSPTslConfig = config.getTSLConfiguration();
- if (moaSPTslConfig != null) {
- Logger.debug("Starting TSL-Service initialization ... ");
- TslConfigurationImpl tslConfig = new TslConfigurationImpl();
- tslConfig.setEuTslURL(moaSPTslConfig.getEuTSLUrl());
- tslConfig.setTslWorkingDirectory(moaSPTslConfig.getWorkingDirectory());
- tslConfig.setNetworkReadTimeout(config.getReadTimeout() / 1000);
-
- Logger.info(new LogMsg(msg.getMessage("config.41", null)));
- TSLServiceFactory.initialize(tslConfig);
- Logger.info("TSL-Service client initialization finished");
-
- //initialize TSL Update Task
- initTSLUpdateTask(moaSPTslConfig);
-
- }
+ Logger.info("Initialize MOA-SP/SS configuration ... ");
+ config = ConfigurationProvider.getInstance();
+
+ // initialize TSL module
+ final TSLConfiguration moaSPTslConfig = config.getTSLConfiguration();
+ if (moaSPTslConfig != null) {
+ Logger.debug("Starting TSL-Service initialization ... ");
+ final TslConfigurationImpl tslConfig = new TslConfigurationImpl();
+ tslConfig.setEuTslURL(moaSPTslConfig.getEuTSLUrl());
+ tslConfig.setTslWorkingDirectory(moaSPTslConfig.getWorkingDirectory());
+ tslConfig.setNetworkReadTimeout(config.getReadTimeout() / 1000);
+
+ Logger.info(new LogMsg(msg.getMessage("config.41", null)));
+ TSLServiceFactory.initialize(tslConfig);
+ Logger.info("TSL-Service client initialization finished");
+
+ // initialize TSL Update Task
+ initTSLUpdateTask(moaSPTslConfig);
+
+ }
+
+ Logger.info("Register additional RFC2253 Object identifier");
+ RFC2253NameParser.register(
+ "organizationIdentifier",
+ new ObjectID("2.5.4.97", "organizationIdentifier", (String) null, false));
+
+ Logger.info("Building IAIK-MOA configuration ... ");
+ iaikConfiguration = new IaikConfigurator().configure(config);
+
+ runInitializer(config);
- Logger.info("Building IAIK-MOA configuration ... ");
- new IaikConfigurator().configure(config);
-
- runInitializer(config);
- Logger.info(new LogMsg(msg.getMessage("init.01", null)));
-
- } catch (MOAException e) {
- Logger.fatal(new LogMsg(msg.getMessage("init.00", null)), e);
+ // set Fallback mode in IAIK KeyStore implementation to 'true' to fix problems default behavior of JVM
+ PKCS12KeyStore.setUseJKSFallBack(true);
+ Logger.info("Set fallback mode in: " + PKCS12KeyStore.class.getSimpleName()
+ + " to :" + PKCS12KeyStore.getUseJKSFallBack());
- } catch (Throwable e) {
- Logger.fatal(new LogMsg(msg.getMessage("init.00", null)), e);
- throw new RuntimeException(e);
-
- } finally {
- logger.info("Configuration initialized");
- }
-
-
-
+ Logger.info(new LogMsg(msg.getMessage("init.01", null)));
+
+ } catch (final MOAException e) {
+ Logger.fatal(new LogMsg(msg.getMessage("init.00", null)), e);
+ throw new RuntimeException(e);
+
+ } catch (final Throwable e) {
+ Logger.fatal(new LogMsg(msg.getMessage("init.00", null)), e);
+ throw new RuntimeException(e);
+
+ }
+
// CHANGE IXSIL to XSECT
// set IXSIL debug output
- //IXSILInit.setPrintDebugLog(
- // Logger.isDebugEnabled(IaikLog.IAIK_LOG_HIERARCHY));
- //Logger.info("Registering XSECT");
- //XSecProvider.addAsProvider(true);
-
+ // IXSILInit.setPrintDebugLog(
+ // Logger.isDebugEnabled(IaikLog.IAIK_LOG_HIERARCHY));
+ // Logger.info("Registering XSECT");
+ // XSecProvider.addAsProvider(true);
+
// start the archive cleanup thread
archiveCleaner =
- new Thread(new RevocationArchiveCleaner(ARCHIVE_CLEANUP_INTERVAL));
+ new Thread(new RevocationArchiveCleaner(ARCHIVE_CLEANUP_INTERVAL));
archiveCleaner.setName("RevocationArchiveCleaner");
archiveCleaner.setDaemon(true);
archiveCleaner.setPriority(Thread.MIN_PRIORITY);
@@ -203,42 +210,57 @@ public class SystemInitializer {
logger.info("==============================================================================");
logger.info("=== CONFIGURATION DONE ===");
logger.info("==============================================================================");
+
+ return new StartupConfigurationHolder(config, iaikConfiguration);
+
+ }
+
+ /**
+ * Get configuration object from IAIK modules.
+ *
+ * @return Configuration or <code>null</code> of it was not configurated yet
+ */
+ public static ConfigurationData getIaikConfiguration() {
+ return iaikConfiguration;
+
}
-
+
private static void initTSLUpdateTask(TSLConfiguration tslconfig) {
- MessageProvider msg = MessageProvider.getInstance();
- if (tslconfig != null) {
- // get start time and period from config
- long period = tslconfig.getUpdateSchedulePeriod();
- Date startConfig = tslconfig.getUpdateScheduleStartTime();
-
- // get hh:mm:ss from config date
- Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
- calendar.setTime(startConfig); // assigns calendar to given date
- int hour = calendar.get(Calendar.HOUR_OF_DAY);
- int min = calendar.get(Calendar.MINUTE);
- int sec = calendar.get(Calendar.SECOND);
-
- // create date with today and time from config
- Calendar cal = Calendar.getInstance();
- Date now = cal.getTime();
- cal.set(Calendar.HOUR_OF_DAY, hour);
- cal.set(Calendar.MINUTE, min);
- cal.set(Calendar.SECOND, sec);
-
- // proposed start time
- Date start = cal.getTime();
-
- // if start time has already passed today - add one day (86400000 milliseconds = 1 day)
- if (start.before(now))
- start = new Date(start.getTime() + 86400000);
-
- Logger.debug(new LogMsg(msg.getMessage("config.46", new String[]{start.toString(), "" + period})));
-
- // start TSL updater task
- Timer timer = new Timer();
- timer.schedule(new TSLUpdaterTimerTask(), start, period);
+ final MessageProvider msg = MessageProvider.getInstance();
+ if (tslconfig != null) {
+ // get start time and period from config
+ final long period = tslconfig.getUpdateSchedulePeriod();
+ final Date startConfig = tslconfig.getUpdateScheduleStartTime();
+
+ // get hh:mm:ss from config date
+ final Calendar calendar = Calendar.getInstance(); // creates a new calendar instance
+ calendar.setTime(startConfig); // assigns calendar to given date
+ final int hour = calendar.get(Calendar.HOUR_OF_DAY);
+ final int min = calendar.get(Calendar.MINUTE);
+ final int sec = calendar.get(Calendar.SECOND);
+
+ // create date with today and time from config
+ final Calendar cal = Calendar.getInstance();
+ final Date now = cal.getTime();
+ cal.set(Calendar.HOUR_OF_DAY, hour);
+ cal.set(Calendar.MINUTE, min);
+ cal.set(Calendar.SECOND, sec);
+
+ // proposed start time
+ Date start = cal.getTime();
+
+ // if start time has already passed today - add one day (86400000 milliseconds =
+ // 1 day)
+ if (start.before(now)) {
+ start = new Date(start.getTime() + 86400000);
}
+
+ Logger.debug(new LogMsg(msg.getMessage("config.46", new String[] { start.toString(), "" + period })));
+
+ // start TSL updater task
+ final Timer timer = new Timer("TSL_DB_Updater");
+ timer.schedule(new TSLUpdaterTimerTask(), start, period);
+ }
}
}
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 8e9380e..2e7445e 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
@@ -21,19 +21,8 @@
* 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.algorithms.HashAlgorithms;
-import iaik.server.modules.cmssign.CMSSignature;
-import iaik.server.modules.cmssign.CMSSignatureCreationException;
-import iaik.server.modules.cmssign.CMSSignatureCreationModule;
-import iaik.server.modules.cmssign.CMSSignatureCreationModuleFactory;
-import iaik.server.modules.cmssign.CMSSignatureCreationProfile;
-import iaik.server.modules.keys.KeyEntryID;
-import iaik.server.modules.keys.KeyModule;
-import iaik.server.modules.keys.KeyModuleFactory;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -76,38 +65,46 @@ 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.util.Constants;
+import iaik.server.modules.algorithms.HashAlgorithms;
+import iaik.server.modules.cmssign.CMSSignature;
+import iaik.server.modules.cmssign.CMSSignatureCreationException;
+import iaik.server.modules.cmssign.CMSSignatureCreationModule;
+import iaik.server.modules.cmssign.CMSSignatureCreationModuleFactory;
+import iaik.server.modules.cmssign.CMSSignatureCreationProfile;
+import iaik.server.modules.keys.KeyEntryID;
+import iaik.server.modules.keys.KeyModule;
+import iaik.server.modules.keys.KeyModuleFactory;
/**
* A class providing an API based interface to the
* <code>CMSSignatureCreationModule</code>.
- *
- * This class performs the invocation of the
+ *
+ * This class performs the invocation of the
* <code>iaik.server.modules.cmssign.CMSSignatureCreationModule</code> from a
* <code>CreateCMSSignatureRequest</code> given as an API object. The result of
* the invocation is integrated into a <code>CreateCMSSignatureResponse</code>
* and returned.
- *
+ *
* @version $Id$
*/
public class CMSSignatureCreationInvoker {
-
- private static Map HASH_ALGORITHM_MAPPING;
-
- static {
- HASH_ALGORITHM_MAPPING = new HashMap();
- HASH_ALGORITHM_MAPPING.put(Constants.SHA1_URI, HashAlgorithms.SHA1);
- HASH_ALGORITHM_MAPPING.put(Constants.SHA256_URI, HashAlgorithms.SHA256);
- HASH_ALGORITHM_MAPPING.put(Constants.SHA384_URI, HashAlgorithms.SHA384);
- HASH_ALGORITHM_MAPPING.put(Constants.SHA512_URI, HashAlgorithms.SHA512);
- }
-
+
+ private static Map HASH_ALGORITHM_MAPPING;
+
+ static {
+ HASH_ALGORITHM_MAPPING = new HashMap();
+ HASH_ALGORITHM_MAPPING.put(Constants.SHA1_URI, HashAlgorithms.SHA1);
+ HASH_ALGORITHM_MAPPING.put(Constants.SHA256_URI, HashAlgorithms.SHA256);
+ HASH_ALGORITHM_MAPPING.put(Constants.SHA384_URI, HashAlgorithms.SHA384);
+ HASH_ALGORITHM_MAPPING.put(Constants.SHA512_URI, HashAlgorithms.SHA512);
+ }
/** The single instance of this class. */
private static CMSSignatureCreationInvoker instance = null;
/**
* Get the only instance of this class.
- *
+ *
* @return The only instance of this class.
*/
public static synchronized CMSSignatureCreationInvoker getInstance() {
@@ -119,290 +116,271 @@ public class CMSSignatureCreationInvoker {
/**
* Create a new <code>CMSSignatureCreationInvoker</code>.
- *
+ *
* Protected to disallow multiple instances.
*/
protected CMSSignatureCreationInvoker() {
}
-
-
/**
* Process the <code>CreateCMSSignatureRequest<code> message and invoke the
* <code>XMLSignatureCreationModule</code> for every
* <code>SingleSignatureInfo</code> contained in the request.
- *
+ *
* @param request A <code>CreateCMSSignatureRequest<code> API object
* containing the information for creating the signature(s).
- * @param reserved A <code>Set</code> of reserved object IDs.
- *
- * @return A <code>CreateCMSSignatureResponse</code> API object containing
- * the created signature(s). The response contains either a
- * <code>SignatureEnvironment</code> or a <code>ErrorResponse</code>
- * for each <code>SingleSignatureInfo</code> in the request.
- * @throws MOAException An error occurred during signature creation.
+ * &#64;param reserved A <code>Set</code> of reserved object IDs.
+ *
+ * @return A <code>CreateCMSSignatureResponse</code> API object containing the
+ * created signature(s). The response contains either a
+ * <code>SignatureEnvironment</code> or a <code>ErrorResponse</code> for
+ * each <code>SingleSignatureInfo</code> in the request.
+ * @throws MOAException An error occurred during signature creation.
*/
public CreateCMSSignatureResponse createCMSSignature(
- CreateCMSSignatureRequest request,
- Set reserved)
- throws MOAException {
+ CreateCMSSignatureRequest request,
+ Set reserved)
+ throws MOAException {
+
+ final TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ // LoggingContext loggingCtx =
+ // LoggingContextManager.getInstance().getLoggingContext();
- TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
- //LoggingContext loggingCtx = LoggingContextManager.getInstance().getLoggingContext();
+ final CreateCMSSignatureResponseBuilder responseBuilder = new CreateCMSSignatureResponseBuilder();
+ final CreateCMSSignatureResponse response = new CreateCMSSignatureResponseImpl();
- CreateCMSSignatureResponseBuilder responseBuilder = new CreateCMSSignatureResponseBuilder();
- CreateCMSSignatureResponse response = new CreateCMSSignatureResponseImpl();
+ boolean isSecurityLayerConform = false;
+ boolean isPAdESConformRequired = false;
+ String structure = null;
+ String mimetype = null;
- boolean isSecurityLayerConform = false;
- String structure = null;
- String mimetype = null;
-
- // select the SingleSignatureInfo elements
- Iterator singleSignatureInfoIter = request.getSingleSignatureInfos().iterator();
+ // select the SingleSignatureInfo elements
+ final Iterator singleSignatureInfoIter = request.getSingleSignatureInfos().iterator();
// iterate over all the SingleSignatureInfo elements in the request
- while (singleSignatureInfoIter.hasNext()) {
- SingleSignatureInfo singleSignatureInfo = (SingleSignatureInfo) singleSignatureInfoIter.next();
- isSecurityLayerConform = singleSignatureInfo.isSecurityLayerConform();
-
-
- DataObjectInfo dataObjectInfo = singleSignatureInfo.getDataObjectInfo();
- structure = dataObjectInfo.getStructure();
-
- CMSDataObject dataobject = dataObjectInfo.getDataObject();
- MetaInfo metainfo = dataobject.getMetaInfo();
- mimetype = metainfo.getMimeType();
-
- CMSContent content = dataobject.getContent();
- InputStream contentIs = null;
- // build the content data
- switch (content.getContentType()) {
- case CMSContent.EXPLICIT_CONTENT :
- contentIs = ((CMSContentExcplicit) content).getBinaryContent();
- break;
- case CMSContent.REFERENCE_CONTENT :
- String reference = ((CMSContentReference) content).getReference();
- if (!"".equals(reference)) {
- ExternalURIResolver resolver = new ExternalURIResolver();
- contentIs = resolver.resolve(reference);
- } else {
- throw new MOAApplicationException("2301", null);
- }
- break;
- default : {
- throw new MOAApplicationException("2301", null);
- }
- }
-
- // create CMSSignatureCreationModuleFactory
- CMSSignatureCreationModule module = CMSSignatureCreationModuleFactory.getInstance();
-
- List signedProperties = null;
- boolean includeData = true;
- if (structure.compareTo("enveloping") == 0)
- includeData = true;
- if (structure.compareTo("detached") == 0)
- includeData = false;
-
- ConfigurationProvider config = context.getConfiguration();
-
- // get the key group id
- String keyGroupID = request.getKeyIdentifier();
- // set the key set
- Set keySet = buildKeySet(keyGroupID);
- if (keySet == null) {
- throw new MOAApplicationException("2231", null);
- } else if (keySet.size() == 0) {
- throw new MOAApplicationException("2232", null);
- }
-
- // get digest algorithm
- String digestAlgorithm = getDigestAlgorithm(config, keyGroupID);
-
- // create CMSSignatureCreation profile:
- CMSSignatureCreationProfile profile = new CMSSignatureCreationProfileImpl(
- keySet,
- digestAlgorithm,
- signedProperties,
- isSecurityLayerConform,
- includeData,
- mimetype);
-
- // create CMSSignature from the CMSSignatureCreationModule
- // build the additionalSignedProperties
- List additionalSignedProperties = buildAdditionalSignedProperties();
- TransactionId tid = new TransactionId(context.getTransactionID());
- try {
- CMSSignature signature = module.createSignature(profile, additionalSignedProperties, tid);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- // get CMS SignedData output stream from the CMSSignature and wrap it around out
- boolean base64 = true;
- OutputStream signedDataStream = signature.getSignature(out, base64);
-
- // now write the data to be signed to the signedDataStream
-
- //
- int byteRead;
- /*
- BigDecimal counter = new BigDecimal("0");
- BigDecimal one = new BigDecimal("1");
-
- ByteArrayOutputStream filteredStream = new ByteArrayOutputStream();
-
- while ((byteRead=contentIs.read()) >= 0) {
- //System.out.println("counterXX: " + counter);
-
- // Wrong behaviour < 3
- // excluded bytes should not be part of the signature as 0 bytes
- // they should be not part of the signature at all!
-
-// if (inRange(counter, dataobject))
-// filteredStream.write(0);
-// else
-// filteredStream.write(byteRead);
-//
-
- // correct behaviour
- if (!inRange(counter, dataobject)) {
- filteredStream.write(byteRead);
- }
-
- counter = counter.add(one);
- }
- byte[] data = filteredStream.toByteArray();
- signedDataStream.write(data, 0, data.length);
- */
- // Stream based, this should have a better performance
- FilteredOutputStream filteredOuputStream = new FilteredOutputStream(
- signedDataStream, 4096, dataobject.getExcludeByteRangeFrom(),
- dataobject.getExcludeByteRangeTo());
-
- IOUtils.copyLarge(contentIs, filteredOuputStream);
- filteredOuputStream.flush();
-// byte[] buf = new byte[4096];
-// int bytesRead;
-// while ((bytesRead = contentIs.read(buf)) >= 0) {
-// signedDataStream.write(buf, 0, bytesRead);
-// }
-//
- // finish SignedData processing by closing signedDataStream
- signedDataStream.close();
- String base64value = out.toString();
-
- responseBuilder.addCMSSignature(base64value);
-
-
- } catch (CMSSignatureCreationException e) {
- MOAException moaException = IaikExceptionMapper.getInstance().map(e);
-
- responseBuilder.addError(
- moaException.getMessageId(),
- moaException.getMessage());
- Logger.warn(moaException.getMessage(), e);
-
- }
- catch (IOException e) {
- throw new MOAApplicationException("2301", null, e);
- }
-
- }
-
+ while (singleSignatureInfoIter.hasNext()) {
+ final SingleSignatureInfo singleSignatureInfo = (SingleSignatureInfo) singleSignatureInfoIter.next();
+ isSecurityLayerConform = singleSignatureInfo.isSecurityLayerConform();
+ isPAdESConformRequired = singleSignatureInfo.isPAdESConform();
+
+ // PAdES conformity always requires SecurityLayer conformity, because
+ // certificates must be included
+ if (isPAdESConformRequired && !isSecurityLayerConform) {
+ isSecurityLayerConform = isPAdESConformRequired;
+ Logger.debug("Set SecurityLayerConformity to 'true' because PAdES conformity is requested");
+
+ }
+
+ final DataObjectInfo dataObjectInfo = singleSignatureInfo.getDataObjectInfo();
+ structure = dataObjectInfo.getStructure();
+
+ final CMSDataObject dataobject = dataObjectInfo.getDataObject();
+ final MetaInfo metainfo = dataobject.getMetaInfo();
+
+ /*
+ * TODO: do not set SigningTime in IAIK-MOA request or any other API
+ * method/parameter when IAIK-MOA API is updated. Maybe also update mimetype
+ * solution below
+ */
+ // does not set mimetype if PAdES conformity is requested
+ if (!isPAdESConformRequired) {
+ mimetype = metainfo.getMimeType();
+
+ } else {
+ Logger.debug("PAdES conformity requested. Does not set mimetype into CAdES signature");
+ }
+
+ final CMSContent content = dataobject.getContent();
+ InputStream contentIs = null;
+ // build the content data
+ switch (content.getContentType()) {
+ case CMSContent.EXPLICIT_CONTENT:
+ contentIs = ((CMSContentExcplicit) content).getBinaryContent();
+ break;
+ case CMSContent.REFERENCE_CONTENT:
+ final String reference = ((CMSContentReference) content).getReference();
+ if (!"".equals(reference)) {
+ final ExternalURIResolver resolver = new ExternalURIResolver();
+ contentIs = resolver.resolve(reference);
+ } else {
+ throw new MOAApplicationException("2301", null);
+ }
+ break;
+ default: {
+ throw new MOAApplicationException("2301", null);
+ }
+ }
+
+ // create CMSSignatureCreationModuleFactory
+ final CMSSignatureCreationModule module = CMSSignatureCreationModuleFactory.getInstance();
+
+ final List signedProperties = null;
+ boolean includeData = true;
+ if (structure.compareTo("enveloping") == 0) {
+ includeData = true;
+ }
+ if (structure.compareTo("detached") == 0) {
+ includeData = false;
+ }
+
+ final ConfigurationProvider config = context.getConfiguration();
+
+ // get the key group id
+ final String keyGroupID = request.getKeyIdentifier();
+ // set the key set
+ final Set keySet = buildKeySet(keyGroupID);
+ if (keySet == null) {
+ throw new MOAApplicationException("2231", null);
+ } else if (keySet.size() == 0) {
+ throw new MOAApplicationException("2232", null);
+ }
+
+ // get digest algorithm
+ final String digestAlgorithm = getDigestAlgorithm(config, keyGroupID);
+
+ // create CMSSignatureCreation profile:
+ final CMSSignatureCreationProfile profile = new CMSSignatureCreationProfileImpl(
+ keySet,
+ digestAlgorithm,
+ signedProperties,
+ isSecurityLayerConform,
+ includeData,
+ mimetype,
+ isPAdESConformRequired);
+
+ // create CMSSignature from the CMSSignatureCreationModule
+ // build the additionalSignedProperties
+ final List additionalSignedProperties = buildAdditionalSignedProperties();
+ final TransactionId tid = new TransactionId(context.getTransactionID());
+ try {
+ final CMSSignature signature = module.createSignature(profile, additionalSignedProperties, tid);
+ final ByteArrayOutputStream out = new ByteArrayOutputStream();
+ // get CMS SignedData output stream from the CMSSignature and wrap it around out
+ final boolean base64 = true;
+ final OutputStream signedDataStream = signature.getSignature(out, base64);
+
+ // now write the data to be signed to the signedDataStream
+ // Stream based, this should have a better performance
+ final FilteredOutputStream filteredOuputStream = new FilteredOutputStream(
+ signedDataStream, 4096, dataobject.getExcludeByteRangeFrom(),
+ dataobject.getExcludeByteRangeTo());
+
+ IOUtils.copyLarge(contentIs, filteredOuputStream);
+ filteredOuputStream.flush();
+
+ // finish SignedData processing by closing signedDataStream
+ signedDataStream.close();
+ final String base64value = out.toString();
+
+ responseBuilder.addCMSSignature(base64value);
+
+ } catch (final CMSSignatureCreationException e) {
+ final MOAException moaException = IaikExceptionMapper.getInstance().map(e);
+
+ responseBuilder.addError(
+ moaException.getMessageId(),
+ moaException.getMessage());
+ Logger.warn(moaException.getMessage(), e);
+
+ } catch (final IOException e) {
+ throw new MOAApplicationException("2301", null, e);
+ }
+
+ }
return responseBuilder.getResponse();
}
-
+
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;
- }
-
-
-
+ final BigDecimal from = dataobject.getExcludeByteRangeFrom();
+ final 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 String getDigestAlgorithm(ConfigurationProvider config, String keyGroupID) throws MOASystemException {
- // get digest method on key group level (if configured)
- String configDigestMethodKG = config.getKeyGroup(keyGroupID).getDigestMethodAlgorithm();
- // get default digest method (if configured)
- String configDigestMethod = config.getDigestMethodAlgorithmName();
-
-
- String digestMethod = null;
- if (configDigestMethodKG != null) {
- // if KG specific digest method is configured
- digestMethod = (String) HASH_ALGORITHM_MAPPING.get(configDigestMethodKG);
- if (digestMethod == null) {
- error(
- "config.17",
- new Object[] { configDigestMethodKG});
- throw new MOASystemException("2900", null);
- }
- Logger.debug("Digest algorithm: " + digestMethod + "(configured in KeyGroup)");
- }
- else {
- // else get default configured digest method
- digestMethod = (String) HASH_ALGORITHM_MAPPING.get(configDigestMethod);
- if (digestMethod == null) {
- error(
- "config.17",
- new Object[] { configDigestMethod});
- throw new MOASystemException("2900", null);
- }
- Logger.debug("Digest algorithm: " + digestMethod + "(default)");
-
- }
- return digestMethod;
+ private String getDigestAlgorithm(ConfigurationProvider config, String keyGroupID)
+ throws MOASystemException {
+ // get digest method on key group level (if configured)
+ final String configDigestMethodKG = config.getKeyGroup(keyGroupID).getDigestMethodAlgorithm();
+ // get default digest method (if configured)
+ final String configDigestMethod = config.getDigestMethodAlgorithmName();
+
+ String digestMethod = null;
+ if (configDigestMethodKG != null) {
+ // if KG specific digest method is configured
+ digestMethod = (String) HASH_ALGORITHM_MAPPING.get(configDigestMethodKG);
+ if (digestMethod == null) {
+ error(
+ "config.17",
+ new Object[] { configDigestMethodKG });
+ throw new MOASystemException("2900", null);
+ }
+ Logger.debug("Digest algorithm: " + digestMethod + "(configured in KeyGroup)");
+ } else {
+ // else get default configured digest method
+ digestMethod = (String) HASH_ALGORITHM_MAPPING.get(configDigestMethod);
+ if (digestMethod == null) {
+ error(
+ "config.17",
+ new Object[] { configDigestMethod });
+ throw new MOASystemException("2900", null);
+ }
+ Logger.debug("Digest algorithm: " + digestMethod + "(default)");
+
+ }
+ return digestMethod;
}
-
+
/**
* Utility function to issue an error message to the log.
- *
- * @param messageId The ID of the message to log.
+ *
+ * @param messageId The ID of the message to log.
* @param parameters Additional message parameters.
*/
private static void error(String messageId, Object[] parameters) {
- MessageProvider msg = MessageProvider.getInstance();
+ final MessageProvider msg = MessageProvider.getInstance();
Logger.error(new LogMsg(msg.getMessage(messageId, parameters)));
}
-
+
/**
* Build the set of <code>KeyEntryID</code>s available to the given
* <code>keyGroupID</code>.
- *
+ *
* @param keyGroupID The keygroup ID for which the available keys should be
- * returned.
- * @return The <code>Set</code> of <code>KeyEntryID</code>s
- * identifying the available keys.
+ * returned.
+ * @return The <code>Set</code> of <code>KeyEntryID</code>s identifying the
+ * available keys.
*/
private Set buildKeySet(String keyGroupID) {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
Set keyGroupEntries;
// get the KeyGroup entries from the configuration
if (context.getClientCertificate() != null) {
- X509Certificate cert = context.getClientCertificate()[0];
- Principal issuer = cert.getIssuerDN();
- BigInteger serialNumber = cert.getSerialNumber();
+ final X509Certificate cert = context.getClientCertificate()[0];
+ final Principal issuer = cert.getIssuerDN();
+ final BigInteger serialNumber = cert.getSerialNumber();
keyGroupEntries =
- config.getKeyGroupEntries(issuer, serialNumber, keyGroupID);
+ config.getKeyGroupEntries(issuer, serialNumber, keyGroupID);
} else {
keyGroupEntries = config.getKeyGroupEntries(null, null, keyGroupID);
}
@@ -413,23 +391,23 @@ public class CMSSignatureCreationInvoker {
} else if (keyGroupEntries.size() == 0) {
return Collections.EMPTY_SET;
} else {
- KeyModule module =
- KeyModuleFactory.getInstance(
- new TransactionId(context.getTransactionID()));
- Set keyEntryIDs = module.getPrivateKeyEntryIDs();
- Set keySet = new HashSet();
+ final KeyModule module =
+ KeyModuleFactory.getInstance(
+ new TransactionId(context.getTransactionID()));
+ final Set keyEntryIDs = module.getPrivateKeyEntryIDs();
+ final Set keySet = new HashSet();
Iterator iter;
// filter out the keys that do not exist in the IAIK configuration
// by walking through the key entries and checking if the exist in the
// keyGroupEntries
for (iter = keyEntryIDs.iterator(); iter.hasNext();) {
- KeyEntryID entryID = (KeyEntryID) iter.next();
- KeyGroupEntry entry =
- new KeyGroupEntry(
- entryID.getModuleID(),
- entryID.getCertificateIssuer(),
- entryID.getCertificateSerialNumber());
+ final KeyEntryID entryID = (KeyEntryID) iter.next();
+ final KeyGroupEntry entry =
+ new KeyGroupEntry(
+ entryID.getModuleID(),
+ entryID.getCertificateIssuer(),
+ entryID.getCertificateSerialNumber());
if (keyGroupEntries.contains(entry)) {
keySet.add(entryID);
}
@@ -440,18 +418,18 @@ public class CMSSignatureCreationInvoker {
/**
* Build the list of additional signed properties.
- *
+ *
* Based on the generic configuration setting
- * <code>ConfigurationProvider.TEST_SIGNING_TIME_PROPERTY</code>, a
- * constant <code>SigningTime</code> will be added to the properties.
- *
+ * <code>ConfigurationProvider.TEST_SIGNING_TIME_PROPERTY</code>, a constant
+ * <code>SigningTime</code> will be added to the properties.
+ *
* @return The <code>List</code> of additional signed properties.
*/
private List buildAdditionalSignedProperties() {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- List additionalSignedProperties = Collections.EMPTY_LIST;
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final List additionalSignedProperties = Collections.EMPTY_LIST;
return additionalSignedProperties;
}
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 c0beced..e18f957 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
@@ -28,11 +28,11 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
-import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
+import at.gv.egovernment.moa.sig.tsl.utils.MiscUtil;
import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.MOAException;
import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent;
@@ -54,12 +54,8 @@ 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;
-import iaik.server.ConfigurationException;
-import iaik.server.modules.AdESConstants;
-import iaik.server.modules.AdESFormVerificationResult;
import iaik.server.modules.IAIKException;
import iaik.server.modules.IAIKRuntimeException;
-import iaik.server.modules.SignatureVerificationProfile;
import iaik.server.modules.cmsverify.CMSSignatureVerificationModule;
import iaik.server.modules.cmsverify.CMSSignatureVerificationModuleFactory;
import iaik.server.modules.cmsverify.CMSSignatureVerificationProfile;
@@ -74,474 +70,459 @@ import iaik.x509.X509Certificate;
/**
* A class providing an interface to the
* <code>CMSSignatureVerificationModule</code>.
- *
+ *
* This class performs the invocation of the
* <code>iaik.server.modules.cmsverify.CMSSignatureVerificationModule</code>
* from a <code>VerifyCMSSignatureRequest</code>. The result of the invocation
* is integrated into a <code>VerifyCMSSignatureResponse</code> returned.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class CMSSignatureVerificationInvoker {
- /** The single instance of this class. */
- private static CMSSignatureVerificationInvoker instance = null;
-
- /**
- * Return the only instance of this class.
- *
- * @return The only instance of this class.
- */
- public static synchronized CMSSignatureVerificationInvoker getInstance() {
- if (instance == null) {
- instance = new CMSSignatureVerificationInvoker();
- }
- return instance;
- }
-
- /**
- * Create a new <code>CMSSignatureVerificationInvoker</code>.
- *
- * Protected to disallow multiple instances.
- */
- protected CMSSignatureVerificationInvoker() {
- }
-
- /**
- * Verify a CMS signature.
- *
- * @param request
- * The <code>VerifyCMSSignatureRequest</code> containing the CMS
- * signature, as well as additional data needed for verification.
- * @return Element A <code>VerifyCMSSignatureResponse</code> containing the
- * answer to the <code>VerifyCMSSignatureRequest</code>.
- * @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()));
- //Logger.info(" Available: " + signature.available());
- module.init(signature, profile, new TransactionId(context.getTransactionID()));
-
- // input = module.getInputStream();
-
- // while (input.read(buf) > 0);
- if(request.isExtended()) {
- Logger.info("Running extended validation");
- results = module.verifyPAdESSignature(signingTime);
- } else {
- Logger.info("Running not extended validation");
- 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()) {
- Logger.info("Running extended validation");
- results = module.verifyCAdESSignature(signingTime);
- } else {
- Logger.info("Running not extended validation");
- 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();
-
- if(resultObject == null) {
- Logger.warn("Result Object is null!");
- return;
- }
-
- CMSSignatureVerificationResult cmsResult = null;
- List adesResults = null;
- ExtendedCertificateCheckResult extCheckResult = null;
- if (resultObject instanceof ExtendedCMSSignatureVerificationResult) {
- Logger.info("Got ExtendedCMSSignatureVerificationResult");
- ExtendedCMSSignatureVerificationResult result = (ExtendedCMSSignatureVerificationResult) resultObject;
- cmsResult = result.getCMSSignatureVerificationResult();
- adesResults = AdESResultUtils.getAdESResult(result.getFormVerificationResult());
-
-
- if (adesResults != null) {
- Iterator adesIterator = adesResults.iterator();
- while (adesIterator.hasNext()) {
- Logger.info("ADES Formresults: " + adesIterator.next().toString());
- }
- }
- try {
- //Logger.info("Extended Validation Report: " + result.getName());
- Logger.info("Extended Validation Code: " + result.getResultCode().toString());
- Logger.info("Extended Validation Info: " + result.getInfo());
-
- extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode());
- } catch (ConfigurationException e) {
- Logger.warn("Cannot generate Extendend Result. Check SVA Configuration!", e);
- } catch (NullPointerException e) {
- Logger.info("No extendend validation result available.");
- }
- } else {
- Logger.info("Got CMSSignatureVerificationResult");
- cmsResult = (CMSSignatureVerificationResult) resultObject;
- }
-
- String issuerCountryCode = null;
- // QC/SSCD check
-
- if(cmsResult.getCertificateValidationResult() != null) {
- 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, cmsResult.getSigningTime(), trustProfile.isTSLEnabled(), ConfigurationProvider.getInstance());
-
- // 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, extCheckResult,
- qcsscdresult.getTslInfos());
- }
-
- private void handlePDFResult(Object resultObject, VerifyCMSSignatureResponseBuilder responseBuilder,
- TrustProfile trustProfile) throws MOAException {
- QCSSCDResult qcsscdresult = new QCSSCDResult();
-
- if(resultObject == null) {
- Logger.warn("Result Object is null!");
- return;
- }
-
- PDFSignatureVerificationResult cmsResult = null;
- List adesResults = null;
-
- ExtendedCertificateCheckResult extCheckResult = null;
- if (resultObject instanceof ExtendedPDFSignatureVerificationResult) {
- Logger.info("Got ExtendedPDFSignatureVerificationResult");
- ExtendedPDFSignatureVerificationResult result = (ExtendedPDFSignatureVerificationResult) resultObject;
- cmsResult = result.getPDFSignatureVerificationResult();
- adesResults = AdESResultUtils.getAdESResult(result.getFormVerificationResult());
-
- if (adesResults != null) {
- Iterator adesIterator = adesResults.iterator();
- while (adesIterator.hasNext()) {
- Logger.info("ADES Formresults: " + adesIterator.next().toString());
- }
- }
- cmsResult = result.getPDFSignatureVerificationResult();
- try {
- //Logger.info("Extended Validation Report: " + result.getName());
- Logger.info("Extended Validation Code: " + result.getResultCode().toString());
- Logger.info("Extended Validation Info: " + result.getInfo());
-
- extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode());
- } catch (ConfigurationException e) {
- Logger.warn("Cannot generate Extendend Result. Check SVA Configuration!", e);
- } catch (NullPointerException e) {
- Logger.info("No extendend validation result available.");
- }
- } else {
- Logger.info("Got PDFSignatureVerificationResult");
- cmsResult = (PDFSignatureVerificationResult) resultObject;
- }
-
- String issuerCountryCode = null;
- // QC/SSCD check
-
- if (cmsResult.getCertificateValidationResult() != null) {
- 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, cmsResult.getSigningTime(), trustProfile.isTSLEnabled(), ConfigurationProvider.getInstance());
-
- // 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,
- extCheckResult, qcsscdresult.getTslInfos());
- }
-
- /**
- * Get the signed content contained either in the request itself or given as
- * a reference to external data.
- *
- * @param request
- * The <code>VerifyCMSSignatureRequest</code> containing the
- * signed content (or the reference to the signed content).
- * @return InputStream A stream providing the signed content data, or
- * <code>null</code> 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(ExtendedCMSSignatureVerificationResult adesFormVerification) throws ConfigurationException {
- if (adesFormVerification == null) {
- // no form information
- return null;
- }
-
- List adesList = new ArrayList();
- Logger.info("Checking AdES Results:");
-
- //AdESResultUtils.buildResult(adesFormVerification.getDetailedExtendedReport(), adesList);
-
- //AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.LONG_TERM_VALIDATION),
- // SignatureVerificationProfile.LEVEL_LTA, adesList);
- AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.LONG_TERM_VALIDATION),
- SignatureVerificationProfile.LEVEL_LT, adesList);
- AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.ADES_T_VALIDATION),
- SignatureVerificationProfile.LEVEL_T, adesList);
- AdESResultUtils.checkSubResult(adesFormVerification.getSubResult("basic report"),
- SignatureVerificationProfile.LEVEL_B, adesList);
-
- return adesList;
- }
-
- private List getAdESResult(ExtendedPDFSignatureVerificationResult adesFormVerification) throws ConfigurationException {
- if (adesFormVerification == null) {
- // no form information
- return null;
- }
-
- List adesList = new ArrayList();
-
- /*checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LTA),
- SignatureVerificationProfile.LEVEL_LTA, adesList);
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LT),
- SignatureVerificationProfile.LEVEL_LT, adesList);
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_T),
- SignatureVerificationProfile.LEVEL_T, adesList);
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_B),
- SignatureVerificationProfile.LEVEL_B, adesList);
- */
-
- AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.LONG_TERM_VALIDATION),
- SignatureVerificationProfile.LEVEL_LT, adesList);
- AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.ADES_T_VALIDATION),
- SignatureVerificationProfile.LEVEL_T, adesList);
- AdESResultUtils.checkSubResult(adesFormVerification.getSubResult("basic report"),
- SignatureVerificationProfile.LEVEL_B, adesList);
-
- return adesList;
- }
+ /** 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 <code>CMSSignatureVerificationInvoker</code>.
+ *
+ * Protected to disallow multiple instances.
+ */
+ protected CMSSignatureVerificationInvoker() {
+ }
+
+ /**
+ * Verify a CMS signature.
+ *
+ * @param request The <code>VerifyCMSSignatureRequest</code> containing the CMS
+ * signature, as well as additional data needed for verification.
+ * @return Element A <code>VerifyCMSSignatureResponse</code> containing the
+ * answer to the <code>VerifyCMSSignatureRequest</code>.
+ * @throws MOAException An error occurred while processing the request.
+ */
+ public VerifyCMSSignatureResponse verifyCMSSignature(VerifyCMSSignatureRequest request)
+ throws MOAException {
+
+ final CMSSignatureVerificationProfileFactory profileFactory = new CMSSignatureVerificationProfileFactory(
+ request);
+ final VerifyCMSSignatureResponseBuilder responseBuilder = new VerifyCMSSignatureResponseBuilder();
+ final TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ final LoggingContext loggingCtx = LoggingContextManager.getInstance().getLoggingContext();
+ InputStream signature;
+ InputStream signedContent = null;
+ Date signingTime;
+ List results;
+ int[] signatories;
+ InputStream input;
+ final byte[] buf = new byte[2048];
+
+ // get the signature
+ signature = request.getCMSSignature();
+
+ // get the actual trustprofile
+ final TrustProfile trustProfile = context.getConfiguration().getTrustProfile(request.getTrustProfileId());
+
+ try {
+ // get the signing time
+ signingTime = request.getDateTime();
+
+ // build the profile
+ if (request.isPDF()) {
+ final PDFSignatureVerificationProfile profile = profileFactory.createPDFProfile();
+ Logger.debug("Sending PDFSignatureVerificationProfile to IAIK-MOA");
+
+ final PDFSignatureVerificationModule module =
+ iaik.server.modules.pdfverify.PDFSignatureVerificationModuleFactory
+ .getInstance();
+
+ module.setLog(new IaikLog(loggingCtx.getNodeID()));
+ // Logger.info(" Available: " + signature.available());
+ module.init(signature, profile, new TransactionId(context.getTransactionID()));
+
+ // input = module.getInputStream();
+
+ // while (input.read(buf) > 0);
+ if (request.isExtended()) {
+ Logger.info("Running extended validation");
+ results = module.verifyPAdESSignature(signingTime);
+ } else {
+ Logger.info("Running not extended validation");
+ results = module.verifySignature(signingTime);
+ }
+
+ // PAdES module had to be closed manually
+ module.closeModule();
+
+ } else {
+ // get the signed content
+ signedContent = getSignedContent(request);
+ final CMSSignatureVerificationProfile profile = profileFactory.createProfile();
+ Logger.debug("Sending CMSSignatureVerificationProfile to IAIK-MOA");
+
+ // verify the signature
+ final 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()) {
+ Logger.info("Running extended validation");
+ results = module.verifyCAdESSignature(signingTime);
+ } else {
+ Logger.info("Running not extended validation");
+ results = module.verifySignature(signingTime);
+ }
+ // results = module.verifySignature(signingTime);
+ }
+
+ } catch (final IAIKException e) {
+ final MOAException moaException = IaikExceptionMapper.getInstance().map(e);
+ throw moaException;
+ } catch (final IAIKRuntimeException e) {
+ final MOAException moaException = IaikExceptionMapper.getInstance().map(e);
+ throw moaException;
+ } catch (final IOException e) {
+ throw new MOAApplicationException("2244", null, e);
+ } catch (final MOAException e) {
+ throw e;
+ } finally {
+ try {
+ if (signedContent != null) {
+ signedContent.close();
+ }
+
+ if (signature != null) {
+ signature.close();
+ }
+
+ } catch (final Throwable t) {
+ // Intentionally do nothing here
+ }
+ }
+
+ final 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();) {
+ final 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++) {
+ final int sigIndex = signatories[i] - 1;
+
+ try {
+ final Object resultObject = results.get(signatories[i] - 1);
+ if (!request.isPDF()) {
+ handleCMSResult(resultObject, responseBuilder, trustProfile);
+ } else {
+ handlePDFResult(resultObject, responseBuilder, trustProfile);
+ }
+ } catch (final 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();
+
+ if (resultObject == null) {
+ Logger.warn("Result Object is null!");
+ return;
+ }
+
+ CMSSignatureVerificationResult cmsResult = null;
+ List adesResults = null;
+ boolean extendedVerification = false;
+
+ ExtendedCertificateCheckResult extCheckResult = null;
+ if (resultObject instanceof ExtendedCMSSignatureVerificationResult) {
+ Logger.info("Got ExtendedCMSSignatureVerificationResult");
+ extendedVerification = true;
+ final ExtendedCMSSignatureVerificationResult result =
+ (ExtendedCMSSignatureVerificationResult) resultObject;
+ cmsResult = result.getCMSSignatureVerificationResult();
+ adesResults = AdESResultUtils.getAdESResult(result.getFormVerificationResult());
+
+ if (Logger.isDebugEnabled() && adesResults != null) {
+ final Iterator adesIterator = adesResults.iterator();
+ while (adesIterator.hasNext()) {
+ Logger.debug("ADES Formresults: " + adesIterator.next().toString());
+ }
+
+ }
+
+ try {
+ // Logger.info("Extended Validation Report: " + result.getName());
+ Logger.debug("Extended Validation Code: " + result.getResultCode().toString());
+ Logger.debug("Extended Validation Info: " + result.getInfo());
+
+ extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode());
+
+ } catch (final NullPointerException e) {
+ Logger.info("No extendend validation result available.");
+
+ }
+ } else {
+ Logger.debug("Got CMSSignatureVerificationResult");
+ cmsResult = (CMSSignatureVerificationResult) resultObject;
+
+ }
+
+ String issuerCountryCode = null;
+ // QC/SSCD check
+
+ if (cmsResult.getCertificateValidationResult() != null) {
+ final List list = cmsResult.getCertificateValidationResult().getCertificateChain();
+ if (list != null) {
+ final X509Certificate[] chain = new X509Certificate[list.size()];
+
+ final Iterator it = list.iterator();
+ int i = 0;
+ while (it.hasNext()) {
+ chain[i] = (X509Certificate) it.next();
+ i++;
+ }
+
+ qcsscdresult = CertificateUtils.checkQCSSCD(chain, cmsResult.getSigningTime(), trustProfile
+ .isTSLEnabled(), ConfigurationProvider.getInstance());
+
+ // 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, extCheckResult,
+ qcsscdresult.getTslInfos(), extendedVerification);
+ }
+
+ private void handlePDFResult(Object resultObject, VerifyCMSSignatureResponseBuilder responseBuilder,
+ TrustProfile trustProfile) throws MOAException {
+ QCSSCDResult qcsscdresult = new QCSSCDResult();
+
+ if (resultObject == null) {
+ Logger.warn("Result Object is null!");
+ return;
+ }
+
+ PDFSignatureVerificationResult cmsResult = null;
+ List adesResults = null;
+ boolean extendedVerification = false;
+ final Boolean coversFullDoc = null;
+ final int[] sigByteRange = null;
+
+ ExtendedCertificateCheckResult extCheckResult = null;
+ if (resultObject instanceof ExtendedPDFSignatureVerificationResult) {
+ Logger.info("Got ExtendedPDFSignatureVerificationResult");
+ extendedVerification = true;
+ final ExtendedPDFSignatureVerificationResult result =
+ (ExtendedPDFSignatureVerificationResult) resultObject;
+ cmsResult = result.getPDFSignatureVerificationResult();
+ adesResults = AdESResultUtils.getAdESResult(result.getFormVerificationResult());
+
+ if (Logger.isDebugEnabled() && adesResults != null) {
+ final Iterator adesIterator = adesResults.iterator();
+ while (adesIterator.hasNext()) {
+ Logger.debug("ADES Formresults: " + adesIterator.next().toString());
+ }
+
+ }
+
+ try {
+ Logger.debug("Extended Validation Code: " + result.getResultCode().toString());
+
+ if (result.getDetailedExtendedReport() != null) {
+ Logger.debug("Extended Validation Info: " + result.getDetailedExtendedReport().getMessage());
+ } else {
+ Logger.debug("Extended Validation Info: " + result.getInfo());
+ }
+
+ Logger.debug("Full extended Validation Infos: " + result.getInfo());
+ extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode());
+
+ } catch (final NullPointerException e) {
+ Logger.info("No extendend validation result available.");
+
+ }
+
+ } else {
+ Logger.debug("Got PDFSignatureVerificationResult");
+ cmsResult = (PDFSignatureVerificationResult) resultObject;
+ }
+
+ if (MiscUtil.isNotEmpty(cmsResult.getError())) {
+ Logger.info("Signature validation stopped with an error: " + cmsResult.getError());
+ }
+
+ String issuerCountryCode = null;
+ // QC/SSCD check
+
+ if (cmsResult.getCertificateValidationResult() != null) {
+ final List list = cmsResult.getCertificateValidationResult().getCertificateChain();
+ if (list != null) {
+ final X509Certificate[] chain = new X509Certificate[list.size()];
+
+ final Iterator it = list.iterator();
+ int i = 0;
+ while (it.hasNext()) {
+ chain[i] = (X509Certificate) it.next();
+ i++;
+ }
+
+ qcsscdresult = CertificateUtils.checkQCSSCD(chain, cmsResult.getSigningTime(), trustProfile
+ .isTSLEnabled(), ConfigurationProvider.getInstance());
+
+ // 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,
+ extCheckResult, qcsscdresult.getTslInfos(), extendedVerification);
+ }
+
+ /**
+ * Get the signed content contained either in the request itself or given as a
+ * reference to external data.
+ *
+ * @param request The <code>VerifyCMSSignatureRequest</code> containing the
+ * signed content (or the reference to the signed content).
+ * @return InputStream A stream providing the signed content data, or
+ * <code>null</code> 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:
+ final String reference = ((CMSContentReference) content).getReference();
+ if (!"".equals(reference)) {
+ final 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;
+
+ final ByteArrayOutputStream contentOs = new ByteArrayOutputStream();
+
+ final CMSDataObject dataobject = request.getDataObject();
+ final BigDecimal from = dataobject.getExcludeByteRangeFrom();
+ final BigDecimal to = dataobject.getExcludeByteRangeTo();
+
+ if (from == null || to == null) {
+ return contentIs;
+ }
+
+ BigDecimal counter = new BigDecimal("0");
+ final 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);
+ }
+
+ final InputStream is = new ByteArrayInputStream(contentOs.toByteArray());
+
+ return is;
+
+ } catch (final IOException e) {
+ throw new MOAApplicationException("2301", null, e);
+ }
+
+ }
+
+ private boolean inRange(BigDecimal counter, CMSDataObject dataobject) {
+ final BigDecimal from = dataobject.getExcludeByteRangeFrom();
+ final 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;
+ }
+ }
+
+ }
}
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 bd5db6d..5e343c4 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
@@ -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 at.gv.egovernment.moa.spss.MOAException;
@@ -39,71 +38,71 @@ import iaik.server.modules.pdfverify.PDFSignatureVerificationProfile;
* A factory to create a <code>CMSSignatureVerificationProfile</code> from a
* <code>VerifyCMSSignatureRequest</code> and the current MOA configuration
* data.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class CMSSignatureVerificationProfileFactory {
- /** The <code>VerifyCMSSignatureRequest</code> to draw profile data from. */
- private VerifyCMSSignatureRequest request;
+ /** The <code>VerifyCMSSignatureRequest</code> to draw profile data from. */
+ private final VerifyCMSSignatureRequest request;
/**
* Create a new <code>CMSSignatureVerificationProfileFactory</code>.
*
- * @param request The <code>VerifyCMSSignatureRequest</code> to draw profile
- * data from.
+ * @param request The <code>VerifyCMSSignatureRequest</code> to draw profile
+ * data from.
*/
public CMSSignatureVerificationProfileFactory(VerifyCMSSignatureRequest request) {
this.request = request;
}
/**
- * Create a <code>CMSSignatureVerificationProfile</code> from the given
- * request and the current MOA configuration.
- *
+ * Create a <code>CMSSignatureVerificationProfile</code> from the given request
+ * and the current MOA configuration.
+ *
* @return The <code>CMSSignatureVerificationProfile</code> for the
- * <code>request</code>, based on the current configuration.
+ * <code>request</code>, based on the current configuration.
* @throws MOAException An error occurred creating the profile.
*/
public PDFSignatureVerificationProfile createPDFProfile()
- throws MOAException {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- PDFSignatureVerificationProfileImpl profile =
- new PDFSignatureVerificationProfileImpl();
+ throws MOAException {
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final PDFSignatureVerificationProfileImpl profile =
+ new PDFSignatureVerificationProfileImpl();
String trustProfileID;
// set the certificate validation profile
trustProfileID = request.getTrustProfileId();
profile.setCertificateValidationProfile(
- new PKIProfileImpl(config, trustProfileID));
+ new PKIProfileImpl(config, trustProfileID));
return profile;
}
-
+
/**
- * Create a <code>CMSSignatureVerificationProfile</code> from the given
- * request and the current MOA configuration.
- *
+ * Create a <code>CMSSignatureVerificationProfile</code> from the given request
+ * and the current MOA configuration.
+ *
* @return The <code>CMSSignatureVerificationProfile</code> for the
- * <code>request</code>, based on the current configuration.
+ * <code>request</code>, based on the current configuration.
* @throws MOAException An error occurred creating the profile.
*/
public CMSSignatureVerificationProfile createProfile()
- throws MOAException {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- CMSSignatureVerificationProfileImpl profile =
- new CMSSignatureVerificationProfileImpl();
+ throws MOAException {
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final CMSSignatureVerificationProfileImpl profile =
+ new CMSSignatureVerificationProfileImpl();
String trustProfileID;
// set the certificate validation profile
trustProfileID = request.getTrustProfileId();
profile.setCertificateValidationProfile(
- new PKIProfileImpl(config, trustProfileID));
+ new PKIProfileImpl(config, trustProfileID));
return profile;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateCMSSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateCMSSignatureResponseBuilder.java
index aa52fe0..bc5d884 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateCMSSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateCMSSignatureResponseBuilder.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 java.util.ArrayList;
@@ -34,29 +33,33 @@ import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse;
/**
* A class to build a <code>CreateCMSSignatureResponse</code>.
- *
- * <p>The methods <code>addSignature()</code> and <code>addError()</code> may be
+ *
+ * <p>
+ * The methods <code>addSignature()</code> and <code>addError()</code> may be
* called in any combination to add <code>CMSignature</code> and
* <code>ErrorResponse</code> elements to the response. One of these functions
- * must be called at least once to produce a
- * <code>CreateCMSSignatureResponse</code>.</p>
- *
- * <p>The <code>getResponseElement()</code> method then returns the
- * <code>CreateXMLSignatureResponse</code> built so far.</p>
- *
+ * must be called at least once to produce a
+ * <code>CreateCMSSignatureResponse</code>.
+ * </p>
+ *
+ * <p>
+ * The <code>getResponseElement()</code> method then returns the
+ * <code>CreateXMLSignatureResponse</code> built so far.
+ * </p>
+ *
* @author Patrick Peck
* @version $Id$
*/
public class CreateCMSSignatureResponseBuilder {
/** The <code>SPSSFactory</code> for creating API objects. */
- private SPSSFactory factory = SPSSFactory.getInstance();
+ private final SPSSFactory factory = SPSSFactory.getInstance();
/** The elements to add to the response. */
- private List responseElements = new ArrayList();
+ private final List responseElements = new ArrayList();
/**
* Get the <code>CreateCMSSignatureResponse</code> built so far.
- *
+ *
* @return The <code>CreateCMSSignatureResponse</code> built so far.
*/
public CreateCMSSignatureResponse getResponse() {
@@ -65,28 +68,29 @@ public class CreateCMSSignatureResponseBuilder {
/**
* Add a <code>SignatureEnvironment</code> element to the response.
- *
+ *
* @param signatureEnvironment The content to put under the
- * <code>SignatureEnvironment</code> element. This should either be a
- * <code>dsig:Signature</code> element (in case of a detached signature) or
- * the signature environment containing the signature (in case of
- * an enveloping signature).
+ * <code>SignatureEnvironment</code> element. This
+ * should either be a <code>dsig:Signature</code>
+ * element (in case of a detached signature) or the
+ * signature environment containing the signature
+ * (in case of an enveloping signature).
*/
public void addCMSSignature(String base64value) {
- CMSSignatureResponse responseElement =
- factory.createCMSSignatureResponse(base64value);
+ final CMSSignatureResponse responseElement =
+ factory.createCMSSignatureResponse(base64value);
responseElements.add(responseElement);
}
/**
* Add a <code>ErrorResponse</code> element to the response.
- *
+ *
* @param errorCode The error code.
- * @param info Additional information about the error.
+ * @param info Additional information about the error.
*/
public void addError(String errorCode, String info) {
- ErrorResponse errorResponse =
- factory.createErrorResponse(Integer.parseInt(errorCode), info);
+ final ErrorResponse errorResponse =
+ factory.createErrorResponse(Integer.parseInt(errorCode), info);
responseElements.add(errorResponse);
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java
index 7a7161d..0a7e70d 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CreateXMLSignatureResponseBuilder.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 java.util.ArrayList;
@@ -36,29 +35,33 @@ import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse;
/**
* A class to build a <code>CreateXMLSignatureResponse</code>.
- *
- * <p>The methods <code>addSignature()</code> and <code>addError()</code> may be
+ *
+ * <p>
+ * The methods <code>addSignature()</code> and <code>addError()</code> may be
* called in any combination to add <code>SignatureEnvironment</code> and
* <code>ErrorResponse</code> elements to the response. One of these functions
- * must be called at least once to produce a
- * <code>CreateXMLSignatureResponse</code>.</p>
- *
- * <p>The <code>getResponseElement()</code> method then returns the
- * <code>CreateXMLSignatureResponse</code> built so far.</p>
- *
+ * must be called at least once to produce a
+ * <code>CreateXMLSignatureResponse</code>.
+ * </p>
+ *
+ * <p>
+ * The <code>getResponseElement()</code> method then returns the
+ * <code>CreateXMLSignatureResponse</code> built so far.
+ * </p>
+ *
* @author Patrick Peck
* @version $Id$
*/
public class CreateXMLSignatureResponseBuilder {
/** The <code>SPSSFactory</code> for creating API objects. */
- private SPSSFactory factory = SPSSFactory.getInstance();
+ private final SPSSFactory factory = SPSSFactory.getInstance();
/** The elements to add to the response. */
- private List responseElements = new ArrayList();
+ private final List responseElements = new ArrayList();
/**
* Get the <code>CreateXMLSignatureResponse</code> built so far.
- *
+ *
* @return The <code>CreateXMLSignatureResponse</code> built so far.
*/
public CreateXMLSignatureResponse getResponse() {
@@ -67,28 +70,29 @@ public class CreateXMLSignatureResponseBuilder {
/**
* Add a <code>SignatureEnvironment</code> element to the response.
- *
+ *
* @param signatureEnvironment The content to put under the
- * <code>SignatureEnvironment</code> element. This should either be a
- * <code>dsig:Signature</code> element (in case of a detached signature) or
- * the signature environment containing the signature (in case of
- * an enveloping signature).
+ * <code>SignatureEnvironment</code> element. This
+ * should either be a <code>dsig:Signature</code>
+ * element (in case of a detached signature) or the
+ * signature environment containing the signature
+ * (in case of an enveloping signature).
*/
public void addSignatureEnvironment(Element signatureEnvironment) {
- SignatureEnvironmentResponse responseElement =
- factory.createSignatureEnvironmentResponse(signatureEnvironment);
+ final SignatureEnvironmentResponse responseElement =
+ factory.createSignatureEnvironmentResponse(signatureEnvironment);
responseElements.add(responseElement);
}
/**
* Add a <code>ErrorResponse</code> element to the response.
- *
+ *
* @param errorCode The error code.
- * @param info Additional information about the error.
+ * @param info Additional information about the error.
*/
public void addError(String errorCode, String info) {
- ErrorResponse errorResponse =
- factory.createErrorResponse(Integer.parseInt(errorCode), info);
+ final ErrorResponse errorResponse =
+ factory.createErrorResponse(Integer.parseInt(errorCode), info);
responseElements.add(errorResponse);
}
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 0740a73..b8d4df5 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
@@ -21,10 +21,8 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.invoke;
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -84,8 +82,8 @@ import iaik.server.modules.xml.XMLDataObject;
import iaik.xml.crypto.utils.URIDereferencerImpl;
/**
- * A class to create <code>DataObject</code>s contained in different
- * locations of the MOA XML request format.
+ * A class to create <code>DataObject</code>s contained in different locations
+ * of the MOA XML request format.
*
* @author Patrick Peck
* @author Gregor Karlinger
@@ -94,15 +92,15 @@ import iaik.xml.crypto.utils.URIDereferencerImpl;
public class DataObjectFactory {
/**
- * XPATH for registering ID attributes of known schemas if
- * validating parsing fails.
+ * XPATH for registering ID attributes of known schemas if validating parsing
+ * fails.
*/
private static final String XPATH =
- "descendant-or-self::node()[" +
- "namespace-uri()='http://www.w3.org/2000/09/xmldsig#' " +
- "or namespace-uri()='http://reference.e-government.gv.at/namespace/persondata/20020228#' " +
- "or starts-with(namespace-uri(), 'http://uri.etsi.org/01903/')" +
- "]/attribute::Id";
+ "descendant-or-self::node()[" +
+ "namespace-uri()='http://www.w3.org/2000/09/xmldsig#' " +
+ "or namespace-uri()='http://reference.e-government.gv.at/namespace/persondata/20020228#' " +
+ "or starts-with(namespace-uri(), 'http://uri.etsi.org/01903/')" +
+ "]/attribute::Id";
/** The single instance of this class. */
private static DataObjectFactory instance = null;
@@ -128,26 +126,27 @@ public class DataObjectFactory {
}
/**
- * Return the signature environment, i.e., the root element of the
- * document, into which the signature will be inserted (if created) or which
- * contains the signature (if verified).
+ * Return the signature environment, i.e., the root element of the document,
+ * into which the signature will be inserted (if created) or which contains the
+ * signature (if verified).
*
- * @param content The <code>Content</code> object containing the signature
- * environment.
+ * @param content The <code>Content</code> object containing the signature
+ * environment.
* @param supplements Additional schema or DTD information.
- * @return The signature environment or <code>null</code>, if no
- * signature environment exists.
- * @throws MOASystemException A system error occurred building the signature
- * environment (see message for details).
+ * @return The signature environment or <code>null</code>, if no signature
+ * environment exists.
+ * @throws MOASystemException A system error occurred building the
+ * signature environment (see message for
+ * details).
* @throws MOAApplicationException An error occurred building the signature
- * environment (see message for details).
+ * environment (see message for details).
*/
public XMLDataObject createSignatureEnvironment(
- Content content,
- List supplements)
- throws MOASystemException, MOAApplicationException {
+ Content content,
+ List supplements)
+ throws MOASystemException, MOAApplicationException {
- String reference = content.getReference();
+ final String reference = content.getReference();
EntityResolver entityResolver;
byte[] contentBytes;
@@ -155,10 +154,10 @@ public class DataObjectFactory {
checkAllowContentAndReference(content, false);
// build the EntityResolver for validating parsing
- if ((supplements == null) || supplements.isEmpty()) {
+ if (supplements == null || supplements.isEmpty()) {
entityResolver = new MOASPSSEntityResolver();
} else {
- EntityResolverChain chain = new EntityResolverChain();
+ final EntityResolverChain chain = new EntityResolverChain();
chain.addEntityResolver(buildSupplementEntityResolver(supplements));
chain.addEntityResolver(new MOASPSSEntityResolver());
@@ -168,83 +167,70 @@ public class DataObjectFactory {
// convert the content into a byte array
try {
switch (content.getContentType()) {
- case Content.BINARY_CONTENT :
- {
- InputStream is = ((ContentBinary) content).getBinaryContent();
- contentBytes = StreamUtils.readStream(is);
- break;
- }
- case Content.LOCREF_CONTENT:
- {
- String locRefURI = ((ContentLocRef) content).getLocationReferenceURI();
- InputStream is = null;
- try
- {
- TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
- is = context.ResolveURI(locRefURI);
- if (is == null) {
- ExternalURIResolver uriResolver = new ExternalURIResolver();
- is = uriResolver.resolve(locRefURI);
- }
- contentBytes = StreamUtils.readStream(is);
- }
- catch (MOAApplicationException e)
- {
- throw new MOAApplicationException("3203", new Object[]{reference, locRefURI}, e);
- }
- finally
- {
- closeInputStream(is);
+ case Content.BINARY_CONTENT: {
+ final InputStream is = ((ContentBinary) content).getBinaryContent();
+ contentBytes = StreamUtils.readStream(is);
+ break;
+ }
+ case Content.LOCREF_CONTENT: {
+ final String locRefURI = ((ContentLocRef) content).getLocationReferenceURI();
+ InputStream is = null;
+ try {
+ final TransactionContext context = TransactionContextManager.getInstance()
+ .getTransactionContext();
+ is = context.ResolveURI(locRefURI);
+ if (is == null) {
+ final ExternalURIResolver uriResolver = new ExternalURIResolver();
+ is = uriResolver.resolve(locRefURI);
}
- break;
+ contentBytes = StreamUtils.readStream(is);
+ } catch (final MOAApplicationException e) {
+ throw new MOAApplicationException("3203", new Object[] { reference, locRefURI }, e);
+ } finally {
+ closeInputStream(is);
}
- case Content.REFERENCE_CONTENT :
- {
- ExternalURIResolver uriResolver = new ExternalURIResolver();
- InputStream is = null;
- try
- {
- is = uriResolver.resolve(reference);
- contentBytes = StreamUtils.readStream(is);
- }
- catch (Exception e)
- {
- throw e;
- }
- finally
- {
- closeInputStream(is);
- }
- break;
+ break;
+ }
+ case Content.REFERENCE_CONTENT: {
+ final ExternalURIResolver uriResolver = new ExternalURIResolver();
+ InputStream is = null;
+ try {
+ is = uriResolver.resolve(reference);
+ contentBytes = StreamUtils.readStream(is);
+ } catch (final Exception e) {
+ throw e;
+ } finally {
+ closeInputStream(is);
}
- case Content.XML_CONTENT :
- {
- Element element =
+ break;
+ }
+ case Content.XML_CONTENT: {
+ final Element element =
checkForSingleElement(((ContentXML) content).getXMLContent());
- contentBytes = DOMUtils.serializeNode(element, "UTF-8");
+ contentBytes = DOMUtils.serializeNode(element, "UTF-8");
- break;
- }
- default : {
+ break;
+ }
+ default: {
contentBytes = null; // this will not happen
}
}
- } catch (MOAApplicationException e) {
+ } catch (final MOAApplicationException e) {
throw e;
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new MOAApplicationException("2219", null);
}
if (Logger.isTraceEnabled()) {
// For logging in Debug-Mode: Mask baseid with xxx
- String logString = new String(contentBytes);
+ final String logString = new String(contentBytes);
// TODO use RegExp
- String startS = "<pr:Identification><pr:Value>";
- String endS = "</pr:Value><pr:Type>urn:publicid:gv.at:baseid</pr:Type>";
+ final String startS = "<pr:Identification><pr:Value>";
+ final String endS = "</pr:Value><pr:Type>urn:publicid:gv.at:baseid</pr:Type>";
String logWithMaskedBaseid = logString;
- int start = logString.indexOf(startS);
+ final int start = logString.indexOf(startS);
if (start > -1) {
- int end = logString.indexOf(endS);
+ final int end = logString.indexOf(endS);
if (end > -1) {
logWithMaskedBaseid = logString.substring(0, start);
logWithMaskedBaseid += startS;
@@ -257,37 +243,37 @@ public class DataObjectFactory {
Logger.trace(">>> parsing the following content: \n" + logWithMaskedBaseid);
}
try {
- ByteArrayInputStream is = new ByteArrayInputStream(contentBytes);
- Document doc =
- DOMUtils.parseDocument(
- is,
- true,
- Constants.ALL_SCHEMA_LOCATIONS,
- null,
- entityResolver,
- new MOAErrorHandler());
+ final ByteArrayInputStream is = new ByteArrayInputStream(contentBytes);
+ final Document doc =
+ DOMUtils.parseDocument(
+ is,
+ true,
+ Constants.ALL_SCHEMA_LOCATIONS,
+ null,
+ entityResolver,
+ new MOAErrorHandler());
Logger.trace("<<< parsed");
return new XMLDataObjectImpl(doc.getDocumentElement());
- } catch (Exception e) {
+ } catch (final Exception e) {
// never mind, we'll try non-validating
- MessageProvider msg = MessageProvider.getInstance();
+ final MessageProvider msg = MessageProvider.getInstance();
Logger.info(new LogMsg(msg.getMessage("invoker.00", null)));
Logger.info(new LogMsg(e.getMessage()));
}
// try to parse non-validating
try {
- ByteArrayInputStream is = new ByteArrayInputStream(contentBytes);
- Document doc = DOMUtils.parseDocument(is, false, null, null);
+ final ByteArrayInputStream is = new ByteArrayInputStream(contentBytes);
+ final Document doc = DOMUtils.parseDocument(is, false, null, null);
// Since the parse tree will not contain any post schema validation information,
// we need to register any attributes known to be of type xsd:Id manually.
- NodeList idAttributes = XPathUtils.selectNodeList(doc.getDocumentElement(), XPATH);
+ final NodeList idAttributes = XPathUtils.selectNodeList(doc.getDocumentElement(), XPATH);
for (int i = 0; i < idAttributes.getLength(); i++) {
- Node item = idAttributes.item(i);
+ final Node item = idAttributes.item(i);
if (item instanceof Attr) {
- Attr attr = (Attr) item;
- Element owner = attr.getOwnerElement();
+ final Attr attr = (Attr) item;
+ final Element owner = attr.getOwnerElement();
// Only available in DOM-Level 3 (Java 1.5):
// owner.setIdAttributeNode(attr, true);
if (doc instanceof CoreDocumentImpl) {
@@ -296,7 +282,7 @@ public class DataObjectFactory {
}
}
return new XMLDataObjectImpl(doc.getDocumentElement());
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new MOAApplicationException("2218", null);
}
}
@@ -305,68 +291,69 @@ public class DataObjectFactory {
* Create an <code>XMLDataObject</code> from the given signature environment.
*
* @param signatureEnvironment The signature environment contained in the
- * result.
- * @param uri The URI identifying the data. This must be either the empty
- * URI, an URI starting with <code>"#xpointer"</code>, <code>"#xmlns"</code>
- * or <code>"#element"</code>; or an URI starting with <code>"#"</code> and
- * followed by an element ID.
- * @param referenceID The reference ID to set for the data object.
+ * result.
+ * @param uri The URI identifying the data. This must be either
+ * the empty URI, an URI starting with
+ * <code>"#xpointer"</code>, <code>"#xmlns"</code>
+ * or <code>"#element"</code>; or an URI starting
+ * with <code>"#"</code> and followed by an element
+ * ID.
+ * @param referenceID The reference ID to set for the data object.
* @return A data object containing the signature environment.
*/
public DataObject createFromSignatureEnvironment(
- Element signatureEnvironment,
- String uri,
- String referenceID)
- throws MOAApplicationException {
+ Element signatureEnvironment,
+ String uri,
+ String referenceID)
+ throws MOAApplicationException {
DataObjectImpl dataObject = null;
if ("".equals(uri)) {
dataObject = new XMLDataObjectImpl(signatureEnvironment);
- } else if (
- uri.startsWith("#xpointer")
+ } else if (uri.startsWith("#xpointer")
|| uri.startsWith("#xmlns")
|| uri.startsWith("#element")) {
try {
- // CHANGE IXSIL to XSECT
- // maybe use URIDereferencerImpl or XPath ...??
- //XPointerReferenceResolver resolver = new XPointerReferenceResolver();
- URIDereferencerImpl uriDereferencer = new URIDereferencerImpl();
- URIReference uriReference = new URIReferenceImpl(uri, null, signatureEnvironment);
- Data returnedData = uriDereferencer.dereference(uriReference, null);
-
- if(returnedData instanceof NodeSetData) {
- NodeSetData nodeSetData = (NodeSetData)returnedData;
- Iterator nodesIterator = nodeSetData.iterator();
- List nodeList = new ArrayList();
-
- while(nodesIterator.hasNext()) {
- nodeList.add(nodesIterator.next());
- }
-
- NodeList nodes = new NodeListImplementation(nodeList);
- dataObject = new XMLNodeListDataObjectImpl(nodes);
- } else if(returnedData instanceof OctetStreamData) {
- OctetStreamData streamData = (OctetStreamData)returnedData;
- dataObject = new ByteStreamDataObjectImpl(streamData.getOctetStream());
+ // CHANGE IXSIL to XSECT
+ // maybe use URIDereferencerImpl or XPath ...??
+ // XPointerReferenceResolver resolver = new XPointerReferenceResolver();
+ final URIDereferencerImpl uriDereferencer = new URIDereferencerImpl();
+ final URIReference uriReference = new URIReferenceImpl(uri, null, signatureEnvironment);
+ final Data returnedData = uriDereferencer.dereference(uriReference, null);
+
+ if (returnedData instanceof NodeSetData) {
+ final NodeSetData nodeSetData = (NodeSetData) returnedData;
+ final Iterator nodesIterator = nodeSetData.iterator();
+ final List nodeList = new ArrayList();
+
+ while (nodesIterator.hasNext()) {
+ nodeList.add(nodesIterator.next());
+ }
+
+ final NodeList nodes = new NodeListImplementation(nodeList);
+ dataObject = new XMLNodeListDataObjectImpl(nodes);
+ } else if (returnedData instanceof OctetStreamData) {
+ final OctetStreamData streamData = (OctetStreamData) returnedData;
+ dataObject = new ByteStreamDataObjectImpl(streamData.getOctetStream());
} else {
- throw new MOAApplicationException("2237", new Object[] { uri });
+ throw new MOAApplicationException("2237", new Object[] { uri });
}
-
- //URI uriObj = new URI(uri);
- //NodeList nodes =
- // resolver.resolveForest(
- // uriObj,
- // signatureEnvironment.getOwnerDocument(),
- // null);
-
- } catch (Exception e) {
+
+ // URI uriObj = new URI(uri);
+ // NodeList nodes =
+ // resolver.resolveForest(
+ // uriObj,
+ // signatureEnvironment.getOwnerDocument(),
+ // null);
+
+ } catch (final Exception e) {
throw new MOAApplicationException("2237", new Object[] { uri });
}
} else if (uri.startsWith("#")) {
- String id = uri.substring(1);
- Element refElem =
- signatureEnvironment.getOwnerDocument().getElementById(id);
+ final String id = uri.substring(1);
+ final Element refElem =
+ signatureEnvironment.getOwnerDocument().getElementById(id);
if (refElem == null) {
throw new MOAApplicationException("2237", new Object[] { id });
@@ -385,87 +372,75 @@ public class DataObjectFactory {
* supplements.
*
* @param supplements The supplements, given as
- * <code>XMLDataObjectAssociation</code>s.
- * @return A <code>StreamEntityResolver</code> mapping the supplements by
- * their reference URI to an <code>InputStream</code> of their respective
- * content.
+ * <code>XMLDataObjectAssociation</code>s.
+ * @return A <code>StreamEntityResolver</code> mapping the supplements by their
+ * reference URI to an <code>InputStream</code> of their respective
+ * content.
*/
private static StreamEntityResolver buildSupplementEntityResolver(List supplements)
- throws MOAApplicationException
- {
- Map entities = new HashMap();
+ throws MOAApplicationException {
+ final Map entities = new HashMap();
Iterator iter;
for (iter = supplements.iterator(); iter.hasNext();) {
- XMLDataObjectAssociation supplement =
- (XMLDataObjectAssociation) iter.next();
- Content content = supplement.getContent();
- String reference = content.getReference();
+ final XMLDataObjectAssociation supplement =
+ (XMLDataObjectAssociation) iter.next();
+ final Content content = supplement.getContent();
+ final String reference = content.getReference();
switch (content.getContentType()) {
- case Content.BINARY_CONTENT :
- {
- entities.put(reference, ((ContentBinary) content).getBinaryContent());
- break;
+ case Content.BINARY_CONTENT: {
+ entities.put(reference, ((ContentBinary) content).getBinaryContent());
+ break;
+ }
+ case Content.LOCREF_CONTENT: {
+ final String locRefURI = ((ContentLocRef) content).getLocationReferenceURI();
+
+ final TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ if (context.FindResolvedEntity(locRefURI) == null) {
+
+ final ExternalURIResolver uriResolver = new ExternalURIResolver();
+ InputStream uriStream = null;
+ byte[] contentBytes;
+ String contentType = null;
+ try {
+ uriStream = uriResolver.resolve(locRefURI);
+ contentBytes = StreamUtils.readStream(uriStream);
+ contentType = uriResolver.getContentType();
+ } catch (final Exception e) {
+ throw new MOAApplicationException("3202", new Object[] { reference, locRefURI }, e);
+ } finally {
+ closeInputStream(uriStream);
+ }
+ context.PutResolvedEntity(locRefURI, contentBytes, contentType);
}
- case Content.LOCREF_CONTENT:
- {
- String locRefURI = ((ContentLocRef) content).getLocationReferenceURI();
-
- TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
- if (context.FindResolvedEntity(locRefURI)==null) {
-
- ExternalURIResolver uriResolver = new ExternalURIResolver();
- InputStream uriStream = null;
- byte[] contentBytes;
- String contentType = null;
- try
- {
- uriStream = uriResolver.resolve(locRefURI);
- contentBytes = StreamUtils.readStream(uriStream);
- contentType = uriResolver.getContentType();
- }
- catch (Exception e)
- {
- throw new MOAApplicationException("3202", new Object[]{reference, locRefURI}, e);
- }
- finally
- {
- closeInputStream(uriStream);
- }
- context.PutResolvedEntity(locRefURI, contentBytes, contentType);
- }
- InputStream contentIS = context.ResolveURI(locRefURI);
- entities.put(reference, contentIS);
- break;
+ final InputStream contentIS = context.ResolveURI(locRefURI);
+ entities.put(reference, contentIS);
+ break;
+ }
+ case Content.XML_CONTENT: {
+ // serialize the first element node that is found in the supplement
+ // and make it available as a stream
+ final NodeList nodes = ((ContentXML) content).getXMLContent();
+ int i = 0;
+
+ // find the first element node
+ while (i < nodes.getLength()
+ && nodes.item(i).getNodeType() != Node.ELEMENT_NODE) {
+ i++;
}
- case Content.XML_CONTENT :
- {
- // serialize the first element node that is found in the supplement
- // and make it available as a stream
- NodeList nodes = ((ContentXML) content).getXMLContent();
- int i = 0;
-
- // find the first element node
- while ((i < nodes.getLength())
- && (nodes.item(i).getNodeType() != Node.ELEMENT_NODE)) {
- i++;
- }
- // serialize the node
- if (i < nodes.getLength()) {
- try
- {
- byte[] serialized = DOMUtils.serializeNode(nodes.item(i), "UTF-8");
- entities.put(reference, new ByteArrayInputStream(serialized));
- }
- catch (Exception e)
- {
- throw new MOAApplicationException("2281", new Object[]{reference}, e);
- }
+ // serialize the node
+ if (i < nodes.getLength()) {
+ try {
+ final byte[] serialized = DOMUtils.serializeNode(nodes.item(i), "UTF-8");
+ entities.put(reference, new ByteArrayInputStream(serialized));
+ } catch (final Exception e) {
+ throw new MOAApplicationException("2281", new Object[] { reference }, e);
}
- break;
}
+ break;
+ }
}
}
@@ -475,82 +450,87 @@ public class DataObjectFactory {
/**
* Create a <code>DataObject</code> from a <code>Content</code> object.
*
- * @param content The <code>Content</code> object containing the data.
- * @param finalDataMetaInfo The meta information corresponding with <code>content</code>.
- * @param referenceID The reference ID to set in the resulting
- * <code>DataObject</code>. May be <code>null</code>.
+ * @param content The <code>Content</code> object containing
+ * the data.
+ * @param finalDataMetaInfo The meta information corresponding with
+ * <code>content</code>.
+ * @param referenceID The reference ID to set in the resulting
+ * <code>DataObject</code>. May be
+ * <code>null</code>.
* @param allowContentAndReference If <code>true</code>, then
- * <code>content</code> is allowed to contain both a <code>Reference</code>
- * attribute and content. Otherwise, either a <code>Reference</code>
- * attribute or content must be set.
- * @param binaryAsXml If <code>true</code>, a content child given as
- * <code>Base64Content</code> must contain XML data.
- * @param xmlAsNodeList If <code>true</code>, the children of a
- * <code>XMLContent</code> child element are returned as a
- * <code>XMLNodeListDataObject</code>. Otherwise, <code>XMLContent</code> may
- * only contain a single child node, which must be an element and which is
- * returned as an <code>XMLDataObject</code>.
- * @param referenceAsXml If <code>true</code>, then content loaded from the
- * URI given as the <code>Reference</code> attribute must be XML data.
- * If <code>false</code>, an attempt is made to parse the data as XML and
- * return an <code>XMLDataObject</code> but if this fails, a
- * <code>BinaryDataObject</code> is returned containing a byte stream to the
- * data.
+ * <code>content</code> is allowed to contain
+ * both a <code>Reference</code> attribute and
+ * content. Otherwise, either a
+ * <code>Reference</code> attribute or content
+ * must be set.
+ * @param binaryAsXml If <code>true</code>, a content child given
+ * as <code>Base64Content</code> must contain
+ * XML data.
+ * @param xmlAsNodeList If <code>true</code>, the children of a
+ * <code>XMLContent</code> child element are
+ * returned as a
+ * <code>XMLNodeListDataObject</code>.
+ * Otherwise, <code>XMLContent</code> may only
+ * contain a single child node, which must be an
+ * element and which is returned as an
+ * <code>XMLDataObject</code>.
+ * @param referenceAsXml If <code>true</code>, then content loaded
+ * from the URI given as the
+ * <code>Reference</code> attribute must be XML
+ * data. If <code>false</code>, an attempt is
+ * made to parse the data as XML and return an
+ * <code>XMLDataObject</code> but if this fails,
+ * a <code>BinaryDataObject</code> is returned
+ * containing a byte stream to the data.
* @return A <code>DataObject</code> representing the data in
- * <code>content</code>. If <code>base64AsXml==true</code> and
- * <code>xmlAsNodeList==false</code> and <code>referenceAsXml==true</code>,
- * then the result can safely be cast to an <code>XMLDataObject</code>.
- * @throws MOASystemException An error indicating an internal problem. See the
- * wrapped exception for details.
+ * <code>content</code>. If <code>base64AsXml==true</code> and
+ * <code>xmlAsNodeList==false</code> and
+ * <code>referenceAsXml==true</code>, then the result can safely be cast
+ * to an <code>XMLDataObject</code>.
+ * @throws MOASystemException An error indicating an internal problem. See
+ * the wrapped exception for details.
* @throws MOAApplicationException An error occurred handling the content
- * (probably while opening a reference or parsing the data). See the wrapped
- * exception for details.
+ * (probably while opening a reference or
+ * parsing the data). See the wrapped exception
+ * for details.
*/
public DataObject createFromContentOptionalRefType(
- Content content,
- MetaInfo finalDataMetaInfo,
- String referenceID,
- boolean allowContentAndReference,
- boolean binaryAsXml,
- boolean xmlAsNodeList,
- boolean referenceAsXml)
- throws MOASystemException, MOAApplicationException {
-
- String reference = content.getReference();
+ Content content,
+ MetaInfo finalDataMetaInfo,
+ String referenceID,
+ boolean allowContentAndReference,
+ boolean binaryAsXml,
+ boolean xmlAsNodeList,
+ boolean referenceAsXml)
+ throws MOASystemException, MOAApplicationException {
+
+ final String reference = content.getReference();
DataObjectImpl dataObject = null;
checkAllowContentAndReference(content, allowContentAndReference);
// ok, build the data object; use content first, if available
- switch (content.getContentType())
- {
- case Content.XML_CONTENT :
- {
- ContentXML contentXml = (ContentXML) content;
+ switch (content.getContentType()) {
+ case Content.XML_CONTENT: {
+ final ContentXML contentXml = (ContentXML) content;
dataObject = createFromXmlContent(contentXml, xmlAsNodeList);
break;
}
- case Content.BINARY_CONTENT :
- {
- ContentBinary contentBinary = (ContentBinary) content;
+ case Content.BINARY_CONTENT: {
+ final ContentBinary contentBinary = (ContentBinary) content;
dataObject = createFromBinaryContent(contentBinary, binaryAsXml, false);
break;
}
- case Content.LOCREF_CONTENT :
- {
- String locRefURI = ((ContentLocRef) content).getLocationReferenceURI();
- try
- {
+ case Content.LOCREF_CONTENT: {
+ final String locRefURI = ((ContentLocRef) content).getLocationReferenceURI();
+ try {
dataObject = createFromURIImpl(locRefURI, referenceAsXml);
- }
- catch (MOAApplicationException e)
- {
- throw new MOAApplicationException("3201", new Object[]{reference, locRefURI}, e);
+ } catch (final MOAApplicationException e) {
+ throw new MOAApplicationException("3201", new Object[] { reference, locRefURI }, e);
}
break;
}
- case Content.REFERENCE_CONTENT :
- {
+ case Content.REFERENCE_CONTENT: {
dataObject = createFromURIImpl(reference, referenceAsXml);
break;
}
@@ -567,97 +547,91 @@ public class DataObjectFactory {
}
/**
- * Check, if content and reference URIs are allowed in the content an throw
- * an exception if an illegal combination of the two occurs.
+ * Check, if content and reference URIs are allowed in the content an throw an
+ * exception if an illegal combination of the two occurs.
*
- * @param content The <code>Content</code> to check.
- * @param allowContentAndReference Whether explicit content and a reference
- * are allowed at the same time.
- * @throws MOAApplicationException If <code>allowContentAndRefernece</code>
- * is <code>false</code> and both explicit content and reference are set,
- * an exception is thrown.
+ * @param content The <code>Content</code> to check.
+ * @param allowContentAndReference Whether explicit content and a reference are
+ * allowed at the same time.
+ * @throws MOAApplicationException If <code>allowContentAndRefernece</code> is
+ * <code>false</code> and both explicit content
+ * and reference are set, an exception is
+ * thrown.
*/
private static void checkAllowContentAndReference(
- Content content,
- boolean allowContentAndReference)
- throws MOAApplicationException {
- String reference = content.getReference();
+ Content content,
+ boolean allowContentAndReference)
+ throws MOAApplicationException {
+ final String reference = content.getReference();
// check for content and reference not being set
- if ((content.getContentType() == Content.REFERENCE_CONTENT)
- && (reference == null)) {
- String errorCode = allowContentAndReference ? "1111" : "1110";
+ if (content.getContentType() == Content.REFERENCE_CONTENT
+ && reference == null) {
+ final String errorCode = allowContentAndReference ? "1111" : "1110";
throw new MOAApplicationException(errorCode, null);
}
// if we only allow either content or reference being set at once, check
if (!allowContentAndReference
- && (content.getContentType() != Content.REFERENCE_CONTENT)
- && (reference != null)) {
+ && content.getContentType() != Content.REFERENCE_CONTENT
+ && reference != null) {
throw new MOAApplicationException("1110", null);
}
}
/**
- * Create a <code>DataObject</code> from a
- * <code>XMLDataObjectAssociation</code> object.
+ * Create a <code>DataObject</code> from a <code>XMLDataObjectAssociation</code>
+ * object.
*
- * @param xmlDataObjAssoc The <code>XMLDataObjectAssociation</code> object.
- * @param xmlContentAllowed Whether the content contained in the
- * <code>xmlDataObjAssoc</code> is allowed to be of type
- * <code>XML_CONTENT</code>.
+ * @param xmlDataObjAssoc The <code>XMLDataObjectAssociation</code>
+ * object.
+ * @param xmlContentAllowed Whether the content contained in the
+ * <code>xmlDataObjAssoc</code> is allowed to be
+ * of type <code>XML_CONTENT</code>.
* @param binaryContentRepeatable If binary content must be provided as a
- * <code>DataObject</code> that can be read multiple times.
+ * <code>DataObject</code> that can be read
+ * multiple times.
* @return A <code>DataObject</code> representing the data in
- * <code>xmlDataObjAssoc</code>.
- * @throws MOASystemException An error indicating an internal problem. See the
- * wrapped exception for details.
+ * <code>xmlDataObjAssoc</code>.
+ * @throws MOASystemException An error indicating an internal problem. See
+ * the wrapped exception for details.
* @throws MOAApplicationException An error occurred handling the content
- * (probably while parsing the data). See the wrapped exception for details.
+ * (probably while parsing the data). See the
+ * wrapped exception for details.
*/
public DataObject createFromXmlDataObjectAssociation(
- XMLDataObjectAssociation xmlDataObjAssoc,
- boolean xmlContentAllowed,
- boolean binaryContentRepeatable)
- throws MOASystemException, MOAApplicationException {
-
- Content content = xmlDataObjAssoc.getContent();
- MetaInfo metaInfo = xmlDataObjAssoc.getMetaInfo();
- String mimeType = metaInfo != null ? metaInfo.getMimeType() : null;
+ XMLDataObjectAssociation xmlDataObjAssoc,
+ boolean xmlContentAllowed,
+ boolean binaryContentRepeatable)
+ throws MOASystemException, MOAApplicationException {
+
+ final Content content = xmlDataObjAssoc.getContent();
+ final MetaInfo metaInfo = xmlDataObjAssoc.getMetaInfo();
+ final String mimeType = metaInfo != null ? metaInfo.getMimeType() : null;
DataObjectImpl dataObject = null;
- switch (content.getContentType())
- {
- case Content.XML_CONTENT :
- {
- if (xmlContentAllowed)
- {
+ switch (content.getContentType()) {
+ case Content.XML_CONTENT: {
+ if (xmlContentAllowed) {
dataObject = createFromXmlContent((ContentXML) content, true);
- }
- else
- {
+ } else {
throw new MOAApplicationException("2280", null);
}
break;
}
- case Content.BINARY_CONTENT :
- {
+ case Content.BINARY_CONTENT: {
dataObject = createFromBinaryContent(
- (ContentBinary) content,
- false,
- binaryContentRepeatable);
+ (ContentBinary) content,
+ false,
+ binaryContentRepeatable);
break;
}
- case Content.LOCREF_CONTENT :
- {
- String locRefURI = ((ContentLocRef) content).getLocationReferenceURI();
- try
- {
+ case Content.LOCREF_CONTENT: {
+ final String locRefURI = ((ContentLocRef) content).getLocationReferenceURI();
+ try {
dataObject = createFromURIImpl(locRefURI, false);
- }
- catch (MOAApplicationException e)
- {
- throw new MOAApplicationException("3201", new Object[]{content.getReference(), locRefURI}, e);
+ } catch (final MOAApplicationException e) {
+ throw new MOAApplicationException("3201", new Object[] { content.getReference(), locRefURI }, e);
}
break;
}
@@ -673,53 +647,49 @@ public class DataObjectFactory {
* object.
*
* @param transformParameter The <code>TransformParameter</code> object
- * containing the data.
- * @return A <code>DataObject</code> representing the data in
- * <code>root</code>.
- * @throws MOASystemException An error indicating an internal problem. See the
- * wrapped exception for details.
+ * containing the data.
+ * @return A <code>DataObject</code> representing the data in <code>root</code>.
+ * @throws MOASystemException An error indicating an internal problem. See
+ * the wrapped exception for details.
* @throws MOAApplicationException An error occurred handling the content
- * (probably while opening a reference or parsing the data). See the wrapped
- * exception for details.
+ * (probably while opening a reference or
+ * parsing the data). See the wrapped exception
+ * for details.
*/
public DataObject createFromTransformParameter(TransformParameter transformParameter)
- throws MOASystemException, MOAApplicationException {
+ throws MOASystemException, MOAApplicationException {
DataObjectImpl dataObject;
switch (transformParameter.getTransformParameterType()) {
- case TransformParameter.BINARY_TRANSFORMPARAMETER :
- TransformParameterBinary tpBinary =
- (TransformParameterBinary) transformParameter;
+ case TransformParameter.BINARY_TRANSFORMPARAMETER:
+ final TransformParameterBinary tpBinary =
+ (TransformParameterBinary) transformParameter;
try {
- //dataObject = new ByteArrayDataObjectImpl(Base64Utils.encode(tpBinary.getBinaryContent()));
+ // dataObject = new
+ // ByteArrayDataObjectImpl(Base64Utils.encode(tpBinary.getBinaryContent()));
dataObject =
- new ByteArrayDataObjectImpl(
- StreamUtils.readStream(tpBinary.getBinaryContent()));
- } catch (Exception e) {
+ new ByteArrayDataObjectImpl(
+ StreamUtils.readStream(tpBinary.getBinaryContent()));
+ } catch (final Exception e) {
return null;
}
- //dataObject = new ByteStreamDataObjectImpl(tpBinary.getBinaryContent());
+ // dataObject = new ByteStreamDataObjectImpl(tpBinary.getBinaryContent());
break;
- default :
+ default:
// resolve uri and build the content
- ExternalURIResolver resolver = new ExternalURIResolver();
- InputStream is = resolver.resolve(transformParameter.getURI());
+ final ExternalURIResolver resolver = new ExternalURIResolver();
+ final InputStream is = resolver.resolve(transformParameter.getURI());
ByteArrayInputStream bis;
- try
- {
+ try {
bis = new ByteArrayInputStream(StreamUtils.readStream(is));
- }
- catch (IOException e)
- {
- throw new MOAApplicationException("2238", new Object[] {transformParameter.getURI()}, e);
- }
- finally
- {
+ } catch (final IOException e) {
+ throw new MOAApplicationException("2238", new Object[] { transformParameter.getURI() }, e);
+ } finally {
closeInputStream(is);
}
- String contentType = resolver.getContentType();
+ final String contentType = resolver.getContentType();
dataObject = new ByteStreamDataObjectImpl(bis);
dataObject.setMimeType(contentType);
break;
@@ -733,62 +703,65 @@ public class DataObjectFactory {
/**
* Create a <code>DataObject</code> from data located at the given URI.
*
- * @param uri The <code>URI</code> where the data is located. This method uses
- * an <code>ExternalURIResolver</code> to resolve URIs.
+ * @param uri The <code>URI</code> where the data is located. This method uses
+ * an <code>ExternalURIResolver</code> to resolve URIs.
* @param asXml If <code>true</code>, a <code>DataObject</code> is only
- * returned, if the content consists of XML data. If it does not consist of
- * XML data, an <code>MOAApplicationException</code> will be thrown. If this
- * parameter is <code>false</code> and the content consists of XML data, this
- * method will still attempt to parse it.
+ * returned, if the content consists of XML data. If it does not
+ * consist of XML data, an <code>MOAApplicationException</code>
+ * will be thrown. If this parameter is <code>false</code> and the
+ * content consists of XML data, this method will still attempt to
+ * parse it.
* @return The <code>DataObject</code> contained at the URI.
- * @throws MOASystemException A system error parsing the XML content.
+ * @throws MOASystemException A system error parsing the XML content.
* @throws MOAApplicationException An error occurred on opening, reading or
- * parsing the data behind the URI.
+ * parsing the data behind the URI.
*/
public DataObject createFromURI(String uri, boolean asXml)
- throws MOASystemException, MOAApplicationException {
+ throws MOASystemException, MOAApplicationException {
return createFromURIImpl(uri, asXml);
}
/**
* Create a <code>DataObject</code> from data located at the given URI.
*
- * @param uri The <code>URI</code> where the data is located. This method uses
- * an <code>ExternalURIResolver</code> to resolve URIs.
+ * @param uri The <code>URI</code> where the data is located. This method uses
+ * an <code>ExternalURIResolver</code> to resolve URIs.
* @param asXml If <code>true</code>, a <code>DataObject</code> is only
- * returned, if the content consists of XML data. If it does not consist of
- * XML data, an <code>MOAApplicationException</code> will be thrown. If this
- * parameter is <code>false</code> and the content type is detected as being
- * XML data, this method will still attemt to parse it.
+ * returned, if the content consists of XML data. If it does not
+ * consist of XML data, an <code>MOAApplicationException</code>
+ * will be thrown. If this parameter is <code>false</code> and the
+ * content type is detected as being XML data, this method will
+ * still attemt to parse it.
* @return The <code>DataObject</code> contained at the URI.
- * @throws MOASystemException A system error parsing the XML content.
+ * @throws MOASystemException A system error parsing the XML content.
* @throws MOAApplicationException An error occurred on opening, reading or
- * parsing the data behind the URI.
+ * parsing the data behind the URI.
*/
private DataObjectImpl createFromURIImpl(String uri, boolean asXml)
- throws MOASystemException, MOAApplicationException {
+ throws MOASystemException, MOAApplicationException {
Logger.trace(">>> resolving uri \"" + uri + "\"");
- ExternalURIResolver resolver = new ExternalURIResolver();
+ final ExternalURIResolver resolver = new ExternalURIResolver();
- TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ final TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
InputStream is = context.ResolveURI(uri);
String contentType = null;
boolean foundURI = false;
if (is == null) {
- is = resolver.resolve(uri);
- contentType = resolver.getContentType();
+ is = resolver.resolve(uri);
+ contentType = resolver.getContentType();
} else {
- foundURI = true;
- contentType = (String) context.FindResolvedEntity(uri).get(1);
- Logger.trace("found \"" + uri + "\" InputStream in preread Supplements!, do not read any more. Content=" + contentType);
+ foundURI = true;
+ contentType = (String) context.FindResolvedEntity(uri).get(1);
+ Logger.trace("found \"" + uri + "\" InputStream in preread Supplements!, do not read any more. Content="
+ + contentType);
}
DataObjectImpl dataObject;
// read the content
- if ((contentType != null) && contentTypeIsXml(contentType)) {
+ if (contentType != null && contentTypeIsXml(contentType)) {
Document doc;
if (asXml) {
@@ -798,15 +771,13 @@ public class DataObjectFactory {
is = resolver.resolve(uri);
doc = DOMUtils.parseDocument(is, false, null, null);
dataObject = new XMLDataObjectImpl(doc.getDocumentElement());
- } catch (ParserConfigurationException e) {
+ } catch (final ParserConfigurationException e) {
throw new MOASystemException("1106", null, e);
- } catch (SAXException e) {
+ } catch (final SAXException e) {
throw new MOAApplicationException("2209", null, e);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new MOAApplicationException("2210", null, e);
- }
- finally
- {
+ } finally {
closeInputStream(is);
}
} else {
@@ -816,22 +787,17 @@ public class DataObjectFactory {
doc = DOMUtils.parseDocument(is, false, null, null);
closeInputStream(is);
dataObject = new XMLDataObjectImpl(doc.getDocumentElement());
- } catch (Exception e) {
+ } catch (final Exception e) {
// this is the last chance: return the data as a byte stream
Logger.trace(">>> reading stream for \"" + uri + "\"");
is = resolver.resolve(uri);
ByteArrayInputStream bis;
- try
- {
+ try {
bis = new ByteArrayInputStream(StreamUtils.readStream(is));
dataObject = new ByteStreamDataObjectImpl(bis);
- }
- catch (IOException e1)
- {
+ } catch (final IOException e1) {
throw new MOAApplicationException("2210", new Object[] { uri }, e1);
- }
- finally
- {
+ } finally {
closeInputStream(is);
}
Logger.trace(">>> read stream for \"" + uri + "\"");
@@ -839,34 +805,26 @@ public class DataObjectFactory {
}
}
- else if (asXml)
- {
+ else if (asXml) {
// if we need XML data, we're in the wrong place here
closeInputStream(is);
throw new MOAApplicationException("2211", new Object[] { uri });
- }
- else
- {
+ } else {
// content is binary: make it available as a binary input stream
Logger.trace(">>> getting binary input for \"" + uri + "\"");
byte[] contentBytes;
ByteArrayInputStream bis;
- try
- {
- contentBytes = StreamUtils.readStream(is);
- bis = new ByteArrayInputStream(contentBytes);
- }
- catch (IOException e)
- {
+ try {
+ contentBytes = StreamUtils.readStream(is);
+ bis = new ByteArrayInputStream(contentBytes);
+ } catch (final IOException e) {
throw new MOAApplicationException("2210", null, e);
- }
- finally
- {
+ } finally {
closeInputStream(is);
}
- if (!foundURI) {
- context.PutResolvedEntity(uri, contentBytes, contentType);
- }
+ if (!foundURI) {
+ context.PutResolvedEntity(uri, contentBytes, contentType);
+ }
dataObject = new ByteStreamDataObjectImpl(bis);
Logger.trace("<<< got binary input for \"" + uri + "\"");
}
@@ -884,16 +842,12 @@ public class DataObjectFactory {
*
* @param is The input stream to be closed.
*/
- private static void closeInputStream(InputStream is)
- {
- try
- {
+ private static void closeInputStream(InputStream is) {
+ try {
if (is != null) {
is.close();
}
- }
- catch (Throwable t)
- {
+ } catch (final Throwable t) {
// Intentionally do nothing here
}
}
@@ -905,42 +859,43 @@ public class DataObjectFactory {
* <code>application/xml</code>.
*
* @param contentType The content MIME type.
- * @return boolean If <code>true</code>, the content type is XML, otherwise
- * not.
+ * @return boolean If <code>true</code>, the content type is XML, otherwise not.
*/
private static boolean contentTypeIsXml(String contentType) {
return contentType.startsWith("text/xml")
- || (contentType.startsWith("application/xml"));
+ || contentType.startsWith("application/xml");
}
/**
* Create a <code>DataObject</code> from a <code>ContentXML</code> object.
*
- * @param xmlContent The <code>ContentXML</code> object from
- * which the <code>DataObject</code> is to be built.
+ * @param xmlContent The <code>ContentXML</code> object from which the
+ * <code>DataObject</code> is to be built.
* @param xmlAsNodeList If <code>true</code>, the children of
- * <code>xmlContent</code> are returned as a
- * <code>XMLNodeListDataObject</code>. Otherwise,
- * <code>xmlContent</code> may only contain a single child node, which must be
- * an element and which is returned as an <code>XMLDataObject</code>.
+ * <code>xmlContent</code> are returned as a
+ * <code>XMLNodeListDataObject</code>. Otherwise,
+ * <code>xmlContent</code> may only contain a single child
+ * node, which must be an element and which is returned as
+ * an <code>XMLDataObject</code>.
* @return A <code>DataObject</code> representing the XML content in
- * <code>xmlContent</code>.
+ * <code>xmlContent</code>.
* @throws MOAApplicationException If <code>xmlAsNodeList</code> is
- * <code>false</code> and <code>xmlContent</code> does not have a single child
- * element.
+ * <code>false</code> and
+ * <code>xmlContent</code> does not have a
+ * single child element.
*/
private DataObjectImpl createFromXmlContent(
- ContentXML xmlContent,
- boolean xmlAsNodeList)
- throws MOAApplicationException {
+ ContentXML xmlContent,
+ boolean xmlAsNodeList)
+ throws MOAApplicationException {
DataObjectImpl dataObject;
if (xmlAsNodeList) {
dataObject = new XMLNodeListDataObjectImpl(xmlContent.getXMLContent());
} else {
- NodeList nodes = xmlContent.getXMLContent();
- Element element = checkForSingleElement(nodes);
+ final NodeList nodes = xmlContent.getXMLContent();
+ final Element element = checkForSingleElement(nodes);
// build the XMLDataObject
dataObject = new XMLDataObjectImpl(element);
@@ -955,10 +910,10 @@ public class DataObjectFactory {
* @param nodes The <code>NodeList</code> to check for a single element.
* @return The single element contained in <code>nodes</code>.
* @throws MOAApplicationException Thrown, if <code>nodes</code> does not
- * contain exactly 1 element node.
+ * contain exactly 1 element node.
*/
private Element checkForSingleElement(NodeList nodes)
- throws MOAApplicationException {
+ throws MOAApplicationException {
Element element = null;
int i;
@@ -986,26 +941,28 @@ public class DataObjectFactory {
* Create a <code>DataObject</code> from a <code>ContentBinary</code> object.
*
* @param binaryContent The <code>ContentBinary</code> object containing the
- * data.
- * @param asXml If <code>true</code>, <code>binaryContent</code> must
- * contain XML data. Otherwise, a <code>BinaryDataObject</code> will be
- * returned containing a byte stream to the decoded Base64 data.
- * @param repeatable If multiple calls to <code>getInputStream()</code> must
- * repeatedly return the content of the data object.
+ * data.
+ * @param asXml If <code>true</code>, <code>binaryContent</code> must
+ * contain XML data. Otherwise, a
+ * <code>BinaryDataObject</code> will be returned
+ * containing a byte stream to the decoded Base64 data.
+ * @param repeatable If multiple calls to <code>getInputStream()</code> must
+ * repeatedly return the content of the data object.
* @return A <code>DataObject</code> representing the content contained in
- * <code>binaryContent</code>.
- * @throws MOASystemException An error indicating an internal problem. See the
- * wrapped exception for details.
+ * <code>binaryContent</code>.
+ * @throws MOASystemException An error indicating an internal problem. See
+ * the wrapped exception for details.
* @throws MOAApplicationException An error occurred handling the content
- * (probably while parsing the data). See the wrapped exception for details.
+ * (probably while parsing the data). See the
+ * wrapped exception for details.
*/
private DataObjectImpl createFromBinaryContent(
- ContentBinary binaryContent,
- boolean asXml,
- boolean repeatable)
- throws MOASystemException, MOAApplicationException {
+ ContentBinary binaryContent,
+ boolean asXml,
+ boolean repeatable)
+ throws MOASystemException, MOAApplicationException {
- InputStream byteStream = binaryContent.getBinaryContent();
+ final InputStream byteStream = binaryContent.getBinaryContent();
DataObjectImpl dataObject;
if (asXml) {
@@ -1014,19 +971,19 @@ public class DataObjectFactory {
try {
doc = DOMUtils.parseDocument(byteStream, false, null, null);
dataObject = new XMLDataObjectImpl(doc.getDocumentElement());
- } catch (ParserConfigurationException e) {
+ } catch (final ParserConfigurationException e) {
throw new MOASystemException("1106", null, e);
- } catch (SAXException e) {
+ } catch (final SAXException e) {
throw new MOAApplicationException("2209", null, e);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new MOAApplicationException("2210", null, e);
}
} else {
if (repeatable) {
try {
dataObject =
- new ByteArrayDataObjectImpl(StreamUtils.readStream(byteStream));
- } catch (IOException e) {
+ new ByteArrayDataObjectImpl(StreamUtils.readStream(byteStream));
+ } catch (final IOException e) {
throw new MOAApplicationException("2210", null);
}
} else {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java
index 933d058..5668a36 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java
@@ -21,12 +21,8 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.invoke;
-import iaik.xml.crypto.utils.URI;
-import iaik.xml.crypto.utils.URIException;
-
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
@@ -38,10 +34,12 @@ import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.server.transaction.TransactionContext;
import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager;
import at.gv.egovernment.moa.spss.util.ExternalURIVerifier;
+import iaik.xml.crypto.utils.URI;
+import iaik.xml.crypto.utils.URIException;
/**
* Resolve external URIs and provide them as a stream.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -52,14 +50,15 @@ public class ExternalURIResolver {
/**
* Return a stream to data at the given URI.
- *
- * This method will try to open an <code>URLConnection</code> to the given
- * URI. Access to the file system is disallowed.
- *
+ *
+ * This method will try to open an <code>URLConnection</code> to the given URI.
+ * Access to the file system is disallowed.
+ *
* @param uriStr The URI to resolve.
* @return InputStream The data contained at the URI.
* @throws MOAApplicationException An error occurred resolving the URI (e.g.,
- * the URI is syntactically incorrect or the stream could not be opened).
+ * the URI is syntactically incorrect or the
+ * stream could not be opened).
*/
public InputStream resolve(String uriStr) throws MOAApplicationException {
URI uri;
@@ -70,7 +69,7 @@ public class ExternalURIResolver {
// build the URI
try {
uri = new URI(uriStr);
- } catch (URIException e) {
+ } catch (final URIException e) {
throw new MOAApplicationException("2207", new Object[] { uriStr });
}
@@ -81,30 +80,30 @@ public class ExternalURIResolver {
// if we have local content (SOAP with attachments)
if ("formdata".equals(uri.getScheme())) {
- TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
- if (context==null) {
- //no transaction
+ final TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ if (context == null) {
+ // no transaction
throw new MOAApplicationException("2282", new Object[] { uri });
} else {
- InputStream attachmentIs = context.getAttachmentInputStream(uri);
+ final InputStream attachmentIs = context.getAttachmentInputStream(uri);
if (attachmentIs != null) {
setContentType(context.getAttachmentContentType(uri.getPath()));
return attachmentIs;
} else {
- //maybe attachments provided but no suiting attachment found
+ // maybe attachments provided but no suiting attachment found
throw new MOAApplicationException("2282", new Object[] { uri });
}
- }
- }
-
+ }
+ }
+
// convert URI to URL
try {
// create the URL
url = new URL(uriStr);
- //System.out.println("ExternalURIResolver: " + url);
+ // System.out.println("ExternalURIResolver: " + url);
ExternalURIVerifier.verify(url.getHost(), url.getPort());
-
- } catch (MalformedURLException e) {
+
+ } catch (final MalformedURLException e) {
throw new MOAApplicationException("2214", new Object[] { uriStr });
}
@@ -112,7 +111,7 @@ public class ExternalURIResolver {
try {
connection = url.openConnection();
if ("http".equals(url.getProtocol())) {
- HttpURLConnection httpConnection = (HttpURLConnection) connection;
+ final HttpURLConnection httpConnection = (HttpURLConnection) connection;
// disallow redirects
httpConnection.setInstanceFollowRedirects(false);
@@ -121,33 +120,31 @@ public class ExternalURIResolver {
throw new MOAApplicationException("2208", new Object[] { uri });
}
} else if ("https".equals(url.getProtocol())) {
- /*
- * this doesn't work because of some interaction between the IAIK
- * JCE and Sun JSSE that results in an "Invalid AVA format" exception
+ /*
+ * this doesn't work because of some interaction between the IAIK JCE and Sun
+ * JSSE that results in an "Invalid AVA format" exception
*/
/*
- HttpsURLConnection httpsConnection = (HttpsURLConnection) connection;
- InputStream trustStore =
- getClass().getResourceAsStream(DEFAULT_TRUST_STORE);
- SSLSocketFactory factory =
- SSLUtils.getSSLSocketFactory("jks", trustStore, "changeit");
- httpsConnection.setSSLSocketFactory(factory);
- httpsConnection.connect();
- if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK) {
- throw new MOAApplicationException("2208", new Object[] { uri });
- }
- */
+ * HttpsURLConnection httpsConnection = (HttpsURLConnection) connection;
+ * InputStream trustStore = getClass().getResourceAsStream(DEFAULT_TRUST_STORE);
+ * SSLSocketFactory factory = SSLUtils.getSSLSocketFactory("jks", trustStore,
+ * "changeit"); httpsConnection.setSSLSocketFactory(factory);
+ * httpsConnection.connect(); if (httpConnection.getResponseCode() !=
+ * HttpURLConnection.HTTP_OK) { throw new MOAApplicationException("2208", new
+ * Object[] { uri }); }
+ */
connection.connect();
} else {
connection.connect();
}
is = connection.getInputStream();
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new MOAApplicationException("2208", new Object[] { uri }, e);
- } /*catch (GeneralSecurityException e) {
- throw new MOAApplicationException("2208", new Object[] { uri }, e);
- }*/
+ } /*
+ * catch (GeneralSecurityException e) { throw new
+ * MOAApplicationException("2208", new Object[] { uri }, e); }
+ */
// set the content type
setContentType(connection.getContentType());
@@ -157,7 +154,7 @@ public class ExternalURIResolver {
/**
* Set the content type of the data at the URI.
- *
+ *
* @param contentType The content type to set.
*/
protected void setContentType(String contentType) {
@@ -167,7 +164,7 @@ public class ExternalURIResolver {
/**
* Return the content type of the data detected at the URI from the previous
* call of <code>resolve()</code>.
- *
+ *
* @return String The content type.
*/
public String getContentType() {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java
index 6e8448b..8817937 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/IaikExceptionMapper.java
@@ -21,12 +21,8 @@
* 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.IAIKException;
-import iaik.server.modules.IAIKRuntimeException;
-
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
@@ -34,12 +30,13 @@ import java.util.Map;
import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.MOAException;
import at.gv.egovernment.moa.spss.MOASystemException;
-
+import iaik.server.modules.IAIKException;
+import iaik.server.modules.IAIKRuntimeException;
/**
* Map an exception from the <code>iaik</code> namespace to a
* <code>MOAException</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -47,57 +44,80 @@ public class IaikExceptionMapper {
/** The argument classes for <code>MOAException</code>s. */
private static final Class[] CONSTRUCTOR_ARGS =
- new Class[] { String.class, Object[].class, Throwable.class };
+ new Class[] { String.class, Object[].class, Throwable.class };
/** The exception mapping, as an array. */
private static final Object[][] MESSAGES =
- {
- { iaik.server.modules.IAIKException.class, "9900", MOASystemException.class },
- { iaik.server.modules.IAIKRuntimeException.class, "9901", MOASystemException.class },
- { iaik.server.modules.xmlsign.XMLSignatureCreationException.class, "2220", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.XMLSignatureCreationRuntimeException.class, "2220", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.InvalidKeyException.class, "2221", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.ManifestException.class, "2222", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.ReferenceException.class, "2223", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.HashUnavailableException.class, "2224", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.SignatureAlgorithmException.class, "2225", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.SignatureEmbeddingException.class, "2226", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.SignatureValueException.class, "2227", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.SignedPropertyException.class, "2228", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.SignerCertificateUnavailableException.class, "2229", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.SupplementException.class, "2230", MOAApplicationException.class },
- { iaik.server.modules.xmlsign.TransformationException.class, "2233", MOAApplicationException.class },
- { iaik.server.modules.cmsverify.CMSSignatureVerificationException.class, "2240", MOAApplicationException.class },
- { iaik.server.modules.cmsverify.CMSSignatureVerificationRuntimeException.class, "2240", MOAApplicationException.class },
- { iaik.server.modules.cmsverify.AlgorithmNotSupportedException.class, "2241", MOAApplicationException.class },
- { iaik.server.modules.cmsverify.CMSSignatureParsingException.class, "2242", MOAApplicationException.class },
- { iaik.server.modules.cmsverify.SignerCertificateUnavailableException.class, "2243", MOAApplicationException.class },
- { iaik.server.modules.cmsverify.CMSSignatureVerificationRuntimeException.class, "2247", MOAApplicationException.class },
- { iaik.server.modules.cmsverify.InitException.class, "2248", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.XMLSignatureVerificationException.class, "2240", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.XMLSignatureVerificationRuntimeException.class, "2240", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.AlgorithmNotSupportedException.class, "2241", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.ManifestException.class, "2262", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.PropertiesException.class, "2263", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.ReferenceException.class, "2264", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.HashUnavailableException.class, "2224", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.SignerCertificateUnavailableException.class, "2243", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.SupplementException.class, "2230", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.TransformationException.class, "2265", MOAApplicationException.class },
- { iaik.server.modules.xmlverify.TransformationParsingException.class, "2269", MOAApplicationException.class },
- { at.gv.egovernment.moa.sig.tsl.exception.TslException.class, "2290", MOAApplicationException.class },
- { iaik.server.modules.cmssign.CMSSignatureCreationException.class, "2300", MOAApplicationException.class } ,
-
-
- };
-
+ {
+ { iaik.server.modules.IAIKException.class, "9900", MOASystemException.class },
+ { iaik.server.modules.IAIKRuntimeException.class, "9901", MOASystemException.class },
+ { iaik.server.modules.xmlsign.XMLSignatureCreationException.class, "2220",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.XMLSignatureCreationRuntimeException.class, "2220",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.InvalidKeyException.class, "2221", MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.ManifestException.class, "2222", MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.ReferenceException.class, "2223", MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.HashUnavailableException.class, "2224",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.SignatureAlgorithmException.class, "2225",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.SignatureEmbeddingException.class, "2226",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.SignatureValueException.class, "2227",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.SignedPropertyException.class, "2228",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.SignerCertificateUnavailableException.class, "2229",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.SupplementException.class, "2230", MOAApplicationException.class },
+ { iaik.server.modules.xmlsign.TransformationException.class, "2233",
+ MOAApplicationException.class },
+ { iaik.server.modules.cmsverify.CMSSignatureVerificationException.class, "2240",
+ MOAApplicationException.class },
+ { iaik.server.modules.cmsverify.CMSSignatureVerificationRuntimeException.class, "2240",
+ MOAApplicationException.class },
+ { iaik.server.modules.cmsverify.AlgorithmNotSupportedException.class, "2241",
+ MOAApplicationException.class },
+ { iaik.server.modules.cmsverify.CMSSignatureParsingException.class, "2242",
+ MOAApplicationException.class },
+ { iaik.server.modules.cmsverify.SignerCertificateUnavailableException.class, "2243",
+ MOAApplicationException.class },
+ { iaik.server.modules.cmsverify.CMSSignatureVerificationRuntimeException.class, "2247",
+ MOAApplicationException.class },
+ { iaik.server.modules.cmsverify.InitException.class, "2248", MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.XMLSignatureVerificationException.class, "2240",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.XMLSignatureVerificationRuntimeException.class, "2240",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.AlgorithmNotSupportedException.class, "2241",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.ManifestException.class, "2262", MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.PropertiesException.class, "2263", MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.ReferenceException.class, "2264", MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.HashUnavailableException.class, "2224",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.SignerCertificateUnavailableException.class, "2243",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.SupplementException.class, "2230", MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.TransformationException.class, "2265",
+ MOAApplicationException.class },
+ { iaik.server.modules.xmlverify.TransformationParsingException.class, "2269",
+ MOAApplicationException.class },
+ { at.gv.egovernment.moa.sig.tsl.exception.TslException.class, "2290",
+ MOAApplicationException.class },
+ { iaik.server.modules.cmssign.CMSSignatureCreationException.class, "2300",
+ MOAApplicationException.class },
+
+ };
+
/** The single instance of this class. */
private static IaikExceptionMapper instance;
/** The exception mapping, as a <code>Map</code> for fast lookup. */
- private Map messages = new HashMap();
+ private final Map messages = new HashMap();
/**
* Get the single instance of this class.
- *
+ *
* @return The single instance of this class.
*/
public static synchronized IaikExceptionMapper getInstance() {
@@ -109,7 +129,7 @@ public class IaikExceptionMapper {
/**
* Create a new <code>IaikExceptionMapper</code>.
- *
+ *
* Protected to disallow multple instances.
*/
protected IaikExceptionMapper() {
@@ -124,59 +144,63 @@ public class IaikExceptionMapper {
for (i = 0; i < MESSAGES.length; i++) {
registerMessage(
- (Class) MESSAGES[i][0],
- (String) MESSAGES[i][1],
- (Class) MESSAGES[i][2]);
+ (Class) MESSAGES[i][0],
+ (String) MESSAGES[i][1],
+ (Class) MESSAGES[i][2]);
}
}
/**
* Register a single <code>IAIKException</code> to message mapping.
- *
- * @param iaikExceptionClass An exception from the <code>iaik</code> package.
- * @param messageId The corresponding error message id.
- * @param moaExceptionClass The type of <code>MOAException</code> that the
- * <code>IAIKException</code> is mapped to (usually
- * <code>MOAApplicationException</code> or <code>MOASystemException</code>).
+ *
+ * @param iaikExceptionClass An exception from the <code>iaik</code> package.
+ * @param messageId The corresponding error message id.
+ * @param moaExceptionClass The type of <code>MOAException</code> that the
+ * <code>IAIKException</code> is mapped to (usually
+ * <code>MOAApplicationException</code> or
+ * <code>MOASystemException</code>).
*/
protected void registerMessage(
- Class iaikExceptionClass,
- String messageId,
- Class moaExceptionClass) {
+ Class iaikExceptionClass,
+ String messageId,
+ Class moaExceptionClass) {
messages.put(
- iaikExceptionClass,
- new ExceptionMappingInfo(messageId, moaExceptionClass));
+ iaikExceptionClass,
+ new ExceptionMappingInfo(messageId, moaExceptionClass));
}
/**
- * Map an <code>iaik.xml.crypto.tsl.ex.TSLSearchException</code> to a <code>MOAException</code>.
- *
- * @param tslSearchException The <code>iaik.xml.crypto.tsl.ex.TSLSearchException</code> to map.
- * @return A <code>MOAException</code> containing the message for the
- * given <code>IAIKException</code>.
+ * Map an <code>iaik.xml.crypto.tsl.ex.TSLSearchException</code> to a
+ * <code>MOAException</code>.
+ *
+ * @param tslSearchException The
+ * <code>iaik.xml.crypto.tsl.ex.TSLSearchException</code>
+ * to map.
+ * @return A <code>MOAException</code> containing the message for the given
+ * <code>IAIKException</code>.
*/
public MOAException map(at.gv.egovernment.moa.sig.tsl.exception.TslException tslSearchException) {
return mapImpl(tslSearchException);
}
-
+
/**
* Map an <code>IAIKException</code> to a <code>MOAException</code>.
- *
- * @param iaikException The <code>IAIKException</code> to map.
- * @return A <code>MOAException</code> containing the message for the
- * given <code>IAIKException</code>.
+ *
+ * @param iaikException The <code>IAIKException</code> to map.
+ * @return A <code>MOAException</code> containing the message for the given
+ * <code>IAIKException</code>.
*/
public MOAException map(IAIKException iaikException) {
return mapImpl(iaikException);
}
-
+
/**
* Map an <code>IAIKRuntimeException</code> to a <code>MOAException</code>.
- *
- * @param iaikException The <code>IAIKException</code> to map.
- * @return A <code>MOAException</code> containing the message for the
- * given <code>IAIKRuntimeException</code>.
+ *
+ * @param iaikException The <code>IAIKException</code> to map.
+ * @return A <code>MOAException</code> containing the message for the given
+ * <code>IAIKRuntimeException</code>.
*/
public MOAException map(IAIKRuntimeException iaikException) {
return mapImpl(iaikException);
@@ -185,14 +209,14 @@ public class IaikExceptionMapper {
/**
* Map an <code>IAIKException</code> or <code>IAIKRuntimeException</code> to a
* <code>MOAException</code>.
- *
+ *
* @param iaikException The <code>IAIKException</code> or
- * <code>IAIKRuntimeException</code> to map.
- * @return A <code>MOAException</code> containing the message for the
- * given <code>IAIKRuntimeException</code>.
+ * <code>IAIKRuntimeException</code> to map.
+ * @return A <code>MOAException</code> containing the message for the given
+ * <code>IAIKRuntimeException</code>.
*/
private MOAException mapImpl(Exception iaikException) {
- MOAException moaException = createMoaException(iaikException);
+ final MOAException moaException = createMoaException(iaikException);
if (moaException == null) {
return new MOASystemException("9999", null, iaikException);
@@ -201,16 +225,16 @@ public class IaikExceptionMapper {
}
/**
- * Create a <code>MOAException</code> from a given <code>IAIKException</code>
- * by looking it up in the mapping.
- *
+ * Create a <code>MOAException</code> from a given <code>IAIKException</code> by
+ * looking it up in the mapping.
+ *
* @param iaikException The <code>IAIKException</code> to map.
- * @return A <code>MOAException</code> with an error code corresponding to
- * the given <code>IAIKException</code>. Returns <code>null</code>, if no
- * mapping could be found.
+ * @return A <code>MOAException</code> with an error code corresponding to the
+ * given <code>IAIKException</code>. Returns <code>null</code>, if no
+ * mapping could be found.
*/
protected MOAException createMoaException(Exception iaikException) {
- ExceptionMappingInfo info = lookupMessage(iaikException.getClass());
+ final ExceptionMappingInfo info = lookupMessage(iaikException.getClass());
Constructor constructor;
if (info == null) {
@@ -220,13 +244,13 @@ public class IaikExceptionMapper {
// instantiate the proper MOAException and return it
try {
constructor =
- info.getMoaExceptionClass().getConstructor(CONSTRUCTOR_ARGS);
+ info.getMoaExceptionClass().getConstructor(CONSTRUCTOR_ARGS);
return (MOAException) constructor.newInstance(
- new Object[] {
- info.getMessageId(),
- new Object[] { iaikException.getMessage()},
- iaikException });
- } catch (Exception e) {
+ new Object[] {
+ info.getMessageId(),
+ new Object[] { iaikException.getMessage() },
+ iaikException });
+ } catch (final Exception e) {
return null;
}
}
@@ -234,19 +258,19 @@ public class IaikExceptionMapper {
/**
* Recursively look up the message associated with an
* <code>IAIKException</code>.
- *
+ *
* This method walks up the exception inheritance hierarchy until it finds a
* mapping.
- *
+ *
* @param iaikExceptionClass The <code>IAIKException</code> to look up.
- * @return Information about the message id and
- * <code>MOAException</code> class that the <code>iaikExceptionClass</code>
- * maps to. If no mapping could be found, <code>null</code> is returned.
+ * @return Information about the message id and <code>MOAException</code> class
+ * that the <code>iaikExceptionClass</code> maps to. If no mapping could
+ * be found, <code>null</code> is returned.
*/
protected ExceptionMappingInfo lookupMessage(Class iaikExceptionClass) {
ExceptionMappingInfo info;
- // break if
+ // break if
if (iaikExceptionClass.equals(Exception.class)) {
return null;
}
@@ -264,21 +288,21 @@ public class IaikExceptionMapper {
/**
* A class containing a mapping from an error message ID to a
* <code>MOAException</code> class.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
class ExceptionMappingInfo {
/** The message ID. */
- private String messageId;
+ private final String messageId;
/** The <code>MOAException</code> class. */
- private Class moaExceptionClass;
+ private final Class moaExceptionClass;
/**
* Create a new <code>ExceptionMappingInfo</code>.
- *
- * @param messageId The message ID.
- * @param moaExceptionClass The <code>MOAException</code> class.
+ *
+ * @param messageId The message ID.
+ * @param moaExceptionClass The <code>MOAException</code> class.
*/
public ExceptionMappingInfo(String messageId, Class moaExceptionClass) {
this.messageId = messageId;
@@ -287,7 +311,7 @@ class ExceptionMappingInfo {
/**
* Return the message ID.
- *
+ *
* @return The message ID.
*/
public String getMessageId() {
@@ -296,7 +320,7 @@ class ExceptionMappingInfo {
/**
* Returns the <code>MOAException</code> class that the message ID maps to.
- *
+ *
* @return The <code>MOAException</code> class.
*/
public Class getMoaExceptionClass() {
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 0128e6a..43c993b 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
@@ -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 org.w3c.dom.Element;
@@ -35,7 +34,7 @@ import at.gv.egovernment.moaspss.util.XPathUtils;
/**
* Utility methods for invoking the IAIK MOA modules.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -43,44 +42,44 @@ public class InvokerUtils {
/**
* Select the signature parent element.
- *
- * @param root The root DOM element which contains the signature parent
- * element somewhere in its subtree.
- * @param location The <code>ElementSelector</code> containing the XPath
- * expression to select the signature parent element from the document.
- * It is also contains the namespace prefix to URI mapping.
+ *
+ * @param root The root DOM element which contains the signature parent
+ * element somewhere in its subtree.
+ * @param location The <code>ElementSelector</code> containing the XPath
+ * expression to select the signature parent element from the
+ * document. It is also contains the namespace prefix to URI
+ * mapping.
* @return Element The signature parent element.
* @throws MOAApplicationException An error occurred evaluating the
- * <code>location</code>.
+ * <code>location</code>.
*/
public static Element evaluateSignatureLocation(
- Element root,
- ElementSelector location)
- throws MOAApplicationException {
+ Element root,
+ ElementSelector location)
+ throws MOAApplicationException {
NodeList nodes;
try {
nodes =
- XPathUtils.selectNodeList(
- root,
- location.getNamespaceDeclarations(),
- location.getXPathExpression());
- } catch (XPathException e) {
+ XPathUtils.selectNodeList(
+ root,
+ location.getNamespaceDeclarations(),
+ location.getXPathExpression());
+ } catch (final XPathException e) {
throw new MOAApplicationException(
- "2212",
- new Object[] { location.getXPathExpression()},
- e);
+ "2212",
+ new Object[] { location.getXPathExpression() },
+ e);
}
if (nodes.getLength() != 1
- || !(nodes.item(0).getNodeType() == Node.ELEMENT_NODE)) {
+ || !(nodes.item(0).getNodeType() == Node.ELEMENT_NODE)) {
throw new MOAApplicationException(
- "2212",
- new Object[] { location.getXPathExpression()});
+ "2212",
+ new Object[] { location.getXPathExpression() });
}
return (Element) nodes.item(0);
}
-
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java
index c6eaa4f..474e74b 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/ProfileMapper.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 java.util.ArrayList;
@@ -48,7 +47,7 @@ import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
/**
* Map ProfileID objects to their explicit represantation.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -58,83 +57,79 @@ public class ProfileMapper {
private static ProfileParser profileParser = new ProfileParser();
/**
- * Map a <code>CreateTransformsInfoProfile</code> to a
+ * Map a <code>CreateTransformsInfoProfile</code> to a
* <code>CreateTransformsInfoProfileExplicit</code>.
- *
+ *
* @param profile The profile object to map.
- * @param config The MOA configuration to use for looking up the profile.
+ * @param config The MOA configuration to use for looking up the profile.
* @return <code>profile</code>, if the given profile is of type
- * <code>EXPLICIT_CREATETRANSFORMSINFOPROFILE</code>, otherwise the profile
- * that is looked up and parsed from the configuration.
+ * <code>EXPLICIT_CREATETRANSFORMSINFOPROFILE</code>, otherwise the
+ * profile that is looked up and parsed from the configuration.
* @throws MOAApplicationException An error occurred parsing the profile.
*/
public static CreateTransformsInfoProfileExplicit mapCreateTransformsInfoProfile(
- CreateTransformsInfoProfile profile,
- ConfigurationProvider config)
- throws MOAApplicationException {
+ CreateTransformsInfoProfile profile,
+ ConfigurationProvider config)
+ throws MOAApplicationException {
switch (profile.getCreateTransformsInfoProfileType()) {
- case CreateTransformsInfoProfile.EXPLICIT_CREATETRANSFORMSINFOPROFILE :
+ case CreateTransformsInfoProfile.EXPLICIT_CREATETRANSFORMSINFOPROFILE:
return (CreateTransformsInfoProfileExplicit) profile;
- case CreateTransformsInfoProfile.ID_CREATETRANSFORMSINFOPROFILE :
- CreateTransformsInfoProfileID profileIdObj =
- (CreateTransformsInfoProfileID) profile;
- String profileID = profileIdObj.getCreateTransformsInfoProfileID();
- Element profileElem = config.getCreateTransformsInfoProfile(profileID);
+ case CreateTransformsInfoProfile.ID_CREATETRANSFORMSINFOPROFILE:
+ final CreateTransformsInfoProfileID profileIdObj =
+ (CreateTransformsInfoProfileID) profile;
+ final String profileID = profileIdObj.getCreateTransformsInfoProfileID();
+ final Element profileElem = config.getCreateTransformsInfoProfile(profileID);
if (profileElem == null) {
throw new MOAApplicationException("2234", new Object[] { profileID });
}
- return (
- CreateTransformsInfoProfileExplicit) profileParser
+ return (CreateTransformsInfoProfileExplicit) profileParser
.parseCreateTransformsInfoProfile(
- profileElem);
+ profileElem);
}
return null; // this will not happen
}
/**
- * Map a <code>CreateSignatureEnvironmentProfile</code> to a
+ * Map a <code>CreateSignatureEnvironmentProfile</code> to a
* <code>CreateSignatureEnvironmentProfileExplicit</code>.
- *
+ *
* @param profile The profile object to map.
- * @param config The MOA configuration to use for looking up the profile.
+ * @param config The MOA configuration to use for looking up the profile.
* @return <code>profile</code>, if the given profile is of type
- * <code>EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE</code>, otherwise the
- * profile that is looked up and parsed from the configuration.
+ * <code>EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE</code>, otherwise
+ * the profile that is looked up and parsed from the configuration.
* @throws MOAApplicationException An error occurred parsing the profile.
*/
public static CreateSignatureEnvironmentProfileExplicit mapCreateSignatureEnvironmentProfile(
- CreateSignatureEnvironmentProfile profile,
- ConfigurationProvider config)
- throws MOAApplicationException {
+ CreateSignatureEnvironmentProfile profile,
+ ConfigurationProvider config)
+ throws MOAApplicationException {
switch (profile.getCreateSignatureEnvironmentProfileType()) {
- case CreateSignatureEnvironmentProfile
- .EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE :
+ case CreateSignatureEnvironmentProfile.EXPLICIT_CREATESIGNATUREENVIRONMENTPROFILE:
return (CreateSignatureEnvironmentProfileExplicit) profile;
- case CreateSignatureEnvironmentProfile
- .ID_CREATESIGNATUREENVIRONMENTPROFILE :
+ case CreateSignatureEnvironmentProfile.ID_CREATESIGNATUREENVIRONMENTPROFILE:
- CreateSignatureEnvironmentProfileID profileIdObj =
- (CreateSignatureEnvironmentProfileID) profile;
- String profileID =
- profileIdObj.getCreateSignatureEnvironmentProfileID();
- Element profileElem =
- config.getCreateSignatureEnvironmentProfile(profileID);
+ final CreateSignatureEnvironmentProfileID profileIdObj =
+ (CreateSignatureEnvironmentProfileID) profile;
+ final String profileID =
+ profileIdObj.getCreateSignatureEnvironmentProfileID();
+ final Element profileElem =
+ config.getCreateSignatureEnvironmentProfile(profileID);
if (profileElem == null) {
throw new MOAApplicationException("2236", new Object[] { profileID });
}
- return (
- CreateSignatureEnvironmentProfileExplicit) profileParser
+ return (CreateSignatureEnvironmentProfileExplicit) profileParser
.parseCreateSignatureEnvironmentProfile(
- profileElem);
+ profileElem);
}
return null;
@@ -142,25 +137,25 @@ public class ProfileMapper {
}
/**
- * Map a <code>List</code> of <code>SupplementProfile</code>s to their
- * explicit representation.
- *
+ * Map a <code>List</code> of <code>SupplementProfile</code>s to their explicit
+ * representation.
+ *
* @param profiles The profiles to map.
- * @param config The MOA configuration to use for looking up profiles.
+ * @param config The MOA configuration to use for looking up profiles.
* @return The mapped profiles.
* @throws MOAApplicationException An error occurred mapping one of the
- * profiles.
+ * profiles.
*/
public static List mapSupplementProfiles(
- List profiles,
- ConfigurationProvider config)
- throws MOAApplicationException {
+ List profiles,
+ ConfigurationProvider config)
+ throws MOAApplicationException {
- List mappedProfiles = new ArrayList();
+ final List mappedProfiles = new ArrayList();
Iterator iter;
for (iter = profiles.iterator(); iter.hasNext();) {
- SupplementProfile profile = (SupplementProfile) iter.next();
+ final SupplementProfile profile = (SupplementProfile) iter.next();
mappedProfiles.add(mapSupplementProfile(profile, config));
}
@@ -168,63 +163,62 @@ public class ProfileMapper {
}
/**
- * Map a <code>SupplementProfile</code> to a
+ * Map a <code>SupplementProfile</code> to a
* <code>SupplementProfileExplicit</code>.
- *
+ *
* @param profile The profile object to map.
- * @param config The MOA configuration to use for looking up the profile.
+ * @param config The MOA configuration to use for looking up the profile.
* @return <code>profile</code>, if the given profile is of type
- * <code>EXPLICIT_SUPPLEMENTPROFILE</code>, otherwise the
- * profile that is looked up and parsed from the configuration.
+ * <code>EXPLICIT_SUPPLEMENTPROFILE</code>, otherwise the profile that
+ * is looked up and parsed from the configuration.
* @throws MOAApplicationException An error occurred parsing the profile.
*/
public static SupplementProfileExplicit mapSupplementProfile(
- SupplementProfile profile,
- ConfigurationProvider config)
- throws MOAApplicationException {
+ SupplementProfile profile,
+ ConfigurationProvider config)
+ throws MOAApplicationException {
switch (profile.getSupplementProfileType()) {
- case SupplementProfile.EXPLICIT_SUPPLEMENTPROFILE :
+ case SupplementProfile.EXPLICIT_SUPPLEMENTPROFILE:
return (SupplementProfileExplicit) profile;
- case SupplementProfile.ID_SUPPLEMENTPROFILE :
- SupplementProfileID profileIdObj = (SupplementProfileID) profile;
- String profileID = profileIdObj.getSupplementProfileID();
- Element profileElem = config.getSupplementProfile(profileID);
+ case SupplementProfile.ID_SUPPLEMENTPROFILE:
+ final SupplementProfileID profileIdObj = (SupplementProfileID) profile;
+ final String profileID = profileIdObj.getSupplementProfileID();
+ final Element profileElem = config.getSupplementProfile(profileID);
if (profileElem == null) {
throw new MOAApplicationException("2267", new Object[] { profileID });
}
- return (
- SupplementProfileExplicit) profileParser.parseSupplementProfile(
- profileElem);
+ return (SupplementProfileExplicit) profileParser.parseSupplementProfile(
+ profileElem);
}
return null;
}
/**
- * Map a <code>List</code> of <code>VerifyTransformsInfoProfile</code>s to
- * their explicit representation.
- *
+ * Map a <code>List</code> of <code>VerifyTransformsInfoProfile</code>s to their
+ * explicit representation.
+ *
* @param profiles The profiles to map.
- * @param config The MOA configuration to use for looking up profiles.
+ * @param config The MOA configuration to use for looking up profiles.
* @return The mapped profiles.
* @throws MOAApplicationException An error occurred mapping one of the
- * profiles.
+ * profiles.
*/
public static List mapVerifyTransformsInfoProfiles(
- List profiles,
- ConfigurationProvider config)
- throws MOAApplicationException {
+ List profiles,
+ ConfigurationProvider config)
+ throws MOAApplicationException {
- List mappedProfiles = new ArrayList();
+ final List mappedProfiles = new ArrayList();
Iterator iter;
for (iter = profiles.iterator(); iter.hasNext();) {
- VerifyTransformsInfoProfile profile =
- (VerifyTransformsInfoProfile) iter.next();
+ final VerifyTransformsInfoProfile profile =
+ (VerifyTransformsInfoProfile) iter.next();
mappedProfiles.add(mapVerifyTransformsInfoProfile(profile, config));
}
@@ -232,40 +226,39 @@ public class ProfileMapper {
}
/**
- * Map a <code>VerifyTransformsInfoProfile</code> to a
+ * Map a <code>VerifyTransformsInfoProfile</code> to a
* <code>VerifyTransformsInfoProfileExplicit</code>.
- *
+ *
* @param profile The profile object to map.
- * @param config The MOA configuration to use for looking up the profile.
+ * @param config The MOA configuration to use for looking up the profile.
* @return <code>profile</code>, if the given profile is of type
- * <code>EXPLICIT_VERIFYTRANSFORMSINFOPROFILE</code>, otherwise the
- * profile that is looked up and parsed from the configuration.
+ * <code>EXPLICIT_VERIFYTRANSFORMSINFOPROFILE</code>, otherwise the
+ * profile that is looked up and parsed from the configuration.
* @throws MOAApplicationException An error occurred parsing the profile.
*/
public static VerifyTransformsInfoProfileExplicit mapVerifyTransformsInfoProfile(
- VerifyTransformsInfoProfile profile,
- ConfigurationProvider config)
- throws MOAApplicationException {
+ VerifyTransformsInfoProfile profile,
+ ConfigurationProvider config)
+ throws MOAApplicationException {
switch (profile.getVerifyTransformsInfoProfileType()) {
- case VerifyTransformsInfoProfile.EXPLICIT_VERIFYTRANSFORMSINFOPROFILE :
+ case VerifyTransformsInfoProfile.EXPLICIT_VERIFYTRANSFORMSINFOPROFILE:
return (VerifyTransformsInfoProfileExplicit) profile;
- case VerifyTransformsInfoProfile.ID_VERIFYTRANSFORMSINFOPROFILE :
- VerifyTransformsInfoProfileID profileIdObj =
- (VerifyTransformsInfoProfileID) profile;
- String profileID = profileIdObj.getVerifyTransformsInfoProfileID();
- Element profileElem =
- config.getVerifyTransformsInfoProfile(profileID);
-
+ case VerifyTransformsInfoProfile.ID_VERIFYTRANSFORMSINFOPROFILE:
+ final VerifyTransformsInfoProfileID profileIdObj =
+ (VerifyTransformsInfoProfileID) profile;
+ final String profileID = profileIdObj.getVerifyTransformsInfoProfileID();
+ final Element profileElem =
+ config.getVerifyTransformsInfoProfile(profileID);
+
if (profileElem == null) {
- throw new MOAApplicationException("2268", new Object[] { profileID });
+ throw new MOAApplicationException("2268", new Object[] { profileID });
}
- return (
- VerifyTransformsInfoProfileExplicit) profileParser
+ return (VerifyTransformsInfoProfileExplicit) profileParser
.parseVerifyTransformsInfoProfile(
- profileElem);
+ profileElem);
}
return null;
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 330ffdd..0674103 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
@@ -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 at.gv.egovernment.moa.spss.server.config.ConfigurationException;
@@ -32,37 +31,38 @@ 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
+ * A utility class for setting up and tearing down thread-local context
* information needed for calling the <code>Invoker</code> classes.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class ServiceContextUtils {
-
+
/**
- * Set up the thread-local context information needed for calling the various
+ * Set up the thread-local context information needed for calling the various
* <code>Invoker</code> classes.
- *
- * @throws ConfigurationException An error occurred setting up the
- * configuration in the <code>TransactionContext</code>.
+ *
+ * @throws ConfigurationException An error occurred setting up the configuration
+ * in the <code>TransactionContext</code>.
*/
public static void setUpContexts() throws ConfigurationException {
- TransactionContextManager txMgr = TransactionContextManager.getInstance();
- LoggingContextManager logMgr = LoggingContextManager.getInstance();
- String transactionID = Thread.currentThread().getName();
-
+ final TransactionContextManager txMgr = TransactionContextManager.getInstance();
+ final LoggingContextManager logMgr = LoggingContextManager.getInstance();
+ final String transactionID = Thread.currentThread().getName();
+
if (txMgr.getTransactionContext() == null) {
- TransactionContext ctx = new TransactionContext(transactionID, null, ConfigurationProvider.getInstance());
+ final TransactionContext ctx = new TransactionContext(transactionID, null, ConfigurationProvider
+ .getInstance());
txMgr.setTransactionContext(ctx);
}
-
+
if (logMgr.getLoggingContext() == null) {
- LoggingContext ctx = new LoggingContext(transactionID);
+ final LoggingContext ctx = new LoggingContext(transactionID);
logMgr.setLoggingContext(ctx);
}
}
-
+
/**
* Tear down thread-local context information.
*/
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java
index b746333..ec4bdd9 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureCreationServiceImpl.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 java.util.Collections;
@@ -33,9 +32,9 @@ import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest;
import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse;
/**
- * An implementation of the <code>SignatureCreationService</code>, using
- * the <code>XMLSignatureCreationInvoker</code>.
- *
+ * An implementation of the <code>SignatureCreationService</code>, using the
+ * <code>XMLSignatureCreationInvoker</code>.
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -43,25 +42,26 @@ public class SignatureCreationServiceImpl extends SignatureCreationService {
/**
* Create an XML signature.
- *
+ *
* @param request The <code>CreateXMLSignatureRequest</code> containing
- * information about the signature(s) to create.
+ * information about the signature(s) to create.
* @return The created signature(s).
* @throws MOAException An error occurred creating the signature(s).
*/
+ @Override
public CreateXMLSignatureResponse createXMLSignature(CreateXMLSignatureRequest request)
- throws MOAException {
+ throws MOAException {
- XMLSignatureCreationInvoker invoker =
- XMLSignatureCreationInvoker.getInstance();
+ final XMLSignatureCreationInvoker invoker =
+ XMLSignatureCreationInvoker.getInstance();
CreateXMLSignatureResponse response;
try {
-
+
Configurator.getInstance().init();
ServiceContextUtils.setUpContexts();
response = invoker.createXMLSignature(request, Collections.EMPTY_SET);
-
+
return response;
} finally {
ServiceContextUtils.tearDownContexts();
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java
index 5b6033c..50b7c53 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/SignatureVerificationServiceImpl.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 at.gv.egovernment.moa.spss.MOAException;
@@ -33,36 +32,37 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest;
import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse;
/**
- * An implementation of the <code>SignatureVerificationService</code> using
- * the <code>XMLSignatureVerificationInvoker</code> and the
+ * An implementation of the <code>SignatureVerificationService</code> using the
+ * <code>XMLSignatureVerificationInvoker</code> and the
* <code>CMSSignatureVerificationInvoker</code>.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class SignatureVerificationServiceImpl
- extends SignatureVerificationService {
+ extends SignatureVerificationService {
/**
* Verify a CMS signature.
- *
- * @param request The <code>VerifyCMSSignatureRequest</code> containing
- * information about the signature verification.
+ *
+ * @param request The <code>VerifyCMSSignatureRequest</code> containing
+ * information about the signature verification.
* @return The result of the signature verification.
* @throws MOAException An error occurred during signature verification.
*/
+ @Override
public VerifyCMSSignatureResponse verifyCMSSignature(VerifyCMSSignatureRequest request)
- throws MOAException {
+ throws MOAException {
- CMSSignatureVerificationInvoker invoker =
- CMSSignatureVerificationInvoker.getInstance();
+ final CMSSignatureVerificationInvoker invoker =
+ CMSSignatureVerificationInvoker.getInstance();
VerifyCMSSignatureResponse response;
try {
Configurator.getInstance().init();
ServiceContextUtils.setUpContexts();
response = invoker.verifyCMSSignature(request);
-
+
return response;
} finally {
ServiceContextUtils.tearDownContexts();
@@ -71,26 +71,26 @@ public class SignatureVerificationServiceImpl
/**
* Verify an XML signature.
- *
+ *
* @param request The <code>VerifyXMLSignatureRequest</code> containinig
- * information about the signature verification.
+ * information about the signature verification.
* @return The result of the signature verification.
* @throws MOAException An error occurred during signature verification.
*/
+ @Override
public VerifyXMLSignatureResponse verifyXMLSignature(VerifyXMLSignatureRequest request)
- throws MOAException {
+ throws MOAException {
- XMLSignatureVerificationInvoker invoker =
- XMLSignatureVerificationInvoker.getInstance();
+ final XMLSignatureVerificationInvoker invoker =
+ XMLSignatureVerificationInvoker.getInstance();
VerifyXMLSignatureResponse response;
try {
-
Configurator.getInstance().init();
ServiceContextUtils.setUpContexts();
response = invoker.verifyXMLSignature(request);
-
+
return response;
} finally {
ServiceContextUtils.tearDownContexts();
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java
index 7842f14..1eec502 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/TransformationFactory.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 java.util.ArrayList;
@@ -30,14 +29,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import iaik.server.modules.xml.Base64Transformation;
-import iaik.server.modules.xml.Canonicalization;
-import iaik.server.modules.xml.EnvelopedSignatureTransformation;
-import iaik.server.modules.xml.Transformation;
-import iaik.server.modules.xml.XPath2Transformation;
-import iaik.server.modules.xml.XPathTransformation;
-import iaik.server.modules.xml.XSLTTransformation;
-
import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform;
import at.gv.egovernment.moa.spss.api.common.Transform;
@@ -53,41 +44,49 @@ import at.gv.egovernment.moa.spss.server.iaik.xml.XPath2FilterImpl;
import at.gv.egovernment.moa.spss.server.iaik.xml.XPath2TransformationImpl;
import at.gv.egovernment.moa.spss.server.iaik.xml.XPathTransformationImpl;
import at.gv.egovernment.moa.spss.server.iaik.xml.XSLTTransformationImpl;
+import iaik.server.modules.xml.Base64Transformation;
+import iaik.server.modules.xml.Canonicalization;
+import iaik.server.modules.xml.EnvelopedSignatureTransformation;
+import iaik.server.modules.xml.Transformation;
+import iaik.server.modules.xml.XPath2Transformation;
+import iaik.server.modules.xml.XPathTransformation;
+import iaik.server.modules.xml.XSLTTransformation;
/**
- * A factory to create <code>Transformation</code> objects from
+ * A factory to create <code>Transformation</code> objects from
* <code>Transform</code> objects.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class TransformationFactory {
-
/** The single instance of this class. */
private static TransformationFactory instance = null;
- /** Maps <code>XPathFilter</code> filter types to
- * <code>XPath2Transformation</code> filter types. */
+ /**
+ * Maps <code>XPathFilter</code> filter types to
+ * <code>XPath2Transformation</code> filter types.
+ */
private static Map FILTER_TYPE_MAPPING;
static {
FILTER_TYPE_MAPPING = new HashMap();
FILTER_TYPE_MAPPING.put(
- XPathFilter.INTERSECT_TYPE,
- XPath2Transformation.XPath2Filter.INTERSECTION);
+ XPathFilter.INTERSECT_TYPE,
+ XPath2Transformation.XPath2Filter.INTERSECTION);
FILTER_TYPE_MAPPING.put(
- XPathFilter.SUBTRACT_TYPE,
- XPath2Transformation.XPath2Filter.SUBTRACTION);
+ XPathFilter.SUBTRACT_TYPE,
+ XPath2Transformation.XPath2Filter.SUBTRACTION);
FILTER_TYPE_MAPPING.put(
- XPathFilter.UNION_TYPE,
- XPath2Transformation.XPath2Filter.UNION);
+ XPathFilter.UNION_TYPE,
+ XPath2Transformation.XPath2Filter.UNION);
}
/**
* Get the single instance of the factory.
- *
+ *
* @return TransformationFactory The single instance.
*/
public static synchronized TransformationFactory getInstance() {
@@ -99,37 +98,36 @@ public class TransformationFactory {
/**
* Create a new <code>TransformationFactory</code>.
- *
+ *
* Protected to disallow multiple instances.
*/
protected TransformationFactory() {
}
/**
- * Create a <code>Transformation</code> based on a
- * <code>Transform</code> object.
- *
- * @param transform The <code>Transform</code> object to extract
- * transformation data from.
- * @return The transformation contained in the <code>transform</code>
+ * Create a <code>Transformation</code> based on a <code>Transform</code>
* object.
+ *
+ * @param transform The <code>Transform</code> object to extract transformation
+ * data from.
+ * @return The transformation contained in the <code>transform</code> object.
* @throws MOAApplicationException An error occured creating the
- * <code>Transformation</code>. See exception message for details.
+ * <code>Transformation</code>. See exception
+ * message for details.
*/
public Transformation createTransformation(Transform transform)
- throws MOAApplicationException {
- String algorithmUri = transform.getAlgorithmURI();
+ throws MOAApplicationException {
+ final String algorithmUri = transform.getAlgorithmURI();
if (Canonicalization.CANONICAL_XML.equals(algorithmUri)
- || Canonicalization.CANONICAL_XML_WITH_COMMENTS.equals(algorithmUri)) {
+ || Canonicalization.CANONICAL_XML_WITH_COMMENTS.equals(algorithmUri)) {
return createC14nTransformation(algorithmUri);
- } else if (
- Canonicalization.EXCLUSIVE_CANONICAL_XML.equals(algorithmUri)
+ } else if (Canonicalization.EXCLUSIVE_CANONICAL_XML.equals(algorithmUri)
|| Canonicalization.EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS.equals(
- algorithmUri)) {
+ algorithmUri)) {
return createExclusiveC14nTransformation(
- (ExclusiveCanonicalizationTransform) transform);
+ (ExclusiveCanonicalizationTransform) transform);
} else if (Base64Transformation.ALL.contains(algorithmUri)) {
return createBase64Transformation();
@@ -147,23 +145,24 @@ public class TransformationFactory {
}
/**
- * Create a <code>List</code> of <code>Transformation</code>s from a
+ * Create a <code>List</code> of <code>Transformation</code>s from a
* <code>List</code> of <code>Transform</code>s.
- *
- * @param transforms The <code>List</code> containing the
- * <code>Transform</code>s.
+ *
+ * @param transforms The <code>List</code> containing the
+ * <code>Transform</code>s.
* @return The <code>List</code> of <code>Transformation</code>s corresponding
- * to the <code>transforms</code>.
+ * to the <code>transforms</code>.
* @throws MOAApplicationException An error occurred building one of the
- * transformations. See exception message for details.
+ * transformations. See exception message for
+ * details.
*/
public List createTransformationList(List transforms)
- throws MOAApplicationException {
- List transformationList = new ArrayList();
+ throws MOAApplicationException {
+ final List transformationList = new ArrayList();
Iterator trIter;
for (trIter = transforms.iterator(); trIter.hasNext();) {
- Transform transform = (Transform) trIter.next();
+ final Transform transform = (Transform) trIter.next();
transformationList.add(createTransformation(transform));
}
@@ -172,7 +171,7 @@ public class TransformationFactory {
/**
* Create a <code>Canonicalization</code>.
- *
+ *
* @param algorithmUri The algorithm URI of the canonicalization.
* @return The <code>Canonicalization</code>.
*/
@@ -182,20 +181,20 @@ public class TransformationFactory {
/**
* Create a <code>ExclusiveCanonicalization</code>.
- *
- * @param transform The <code>ExclusiveCanonicalizationTransform</code>
- * containing the transformation data.
+ *
+ * @param transform The <code>ExclusiveCanonicalizationTransform</code>
+ * containing the transformation data.
* @return The <code>ExclusiveCanonicalization</code>.
*/
private Transformation createExclusiveC14nTransformation(ExclusiveCanonicalizationTransform transform) {
return new ExclusiveCanonicalizationImpl(
- transform.getAlgorithmURI(),
- transform.getInclusiveNamespacePrefixes());
+ transform.getAlgorithmURI(),
+ transform.getInclusiveNamespacePrefixes());
}
/**
* Create a <code>Base64Transformation</code>.
- *
+ *
* @return The <code></code>
*/
private Transformation createBase64Transformation() {
@@ -204,7 +203,7 @@ public class TransformationFactory {
/**
* Create an <code>EnvelopedSignatureTransformation</code>.
- *
+ *
* @return An <code>EnvelopedSignatureTransformation</code>.
*/
private Transformation createEnvelopedSignatureTransformation() {
@@ -213,47 +212,47 @@ public class TransformationFactory {
/**
* Create an <code>XPathTransformation</code>.
- *
- * @param transform The <code>Transform</code> object containing the
- * XPath transformation.
- * @return An <code>XPathTransformation</code> corresponding the
- * transformation given in <code>transform</code>.
- * @throws MOAApplicationException An error occurred creating the
- * <code>Transformation</code>.
+ *
+ * @param transform The <code>Transform</code> object containing the XPath
+ * transformation.
+ * @return An <code>XPathTransformation</code> corresponding the transformation
+ * given in <code>transform</code>.
+ * @throws MOAApplicationException An error occurred creating the
+ * <code>Transformation</code>.
*/
private Transformation createXPathTransformation(XPathTransform transform)
- throws MOAApplicationException {
+ throws MOAApplicationException {
return new XPathTransformationImpl(
- transform.getXPathExpression(),
- transform.getNamespaceDeclarations());
+ transform.getXPathExpression(),
+ transform.getNamespaceDeclarations());
}
/**
* Create an <code>XPath2Transformation</code>.
- *
- * @param transform The <code>Transform</code> object containing the
- * XPath filter transformation.
- * @return An <code>XPath2Transformation</code> corresponding the
- * transformation given in <code>transform</code>.
+ *
+ * @param transform The <code>Transform</code> object containing the XPath
+ * filter transformation.
+ * @return An <code>XPath2Transformation</code> corresponding the transformation
+ * given in <code>transform</code>.
* @throws MOAApplicationException An error occurred creating the
- * <code>Transformation</code>.
+ * <code>Transformation</code>.
*/
private Transformation createXPath2Transformation(XPathFilter2Transform transform)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- XPath2TransformationImpl xpath2 = new XPath2TransformationImpl();
+ final XPath2TransformationImpl xpath2 = new XPath2TransformationImpl();
Iterator iter;
for (iter = transform.getFilters().iterator(); iter.hasNext();) {
- XPathFilter filter = (XPathFilter) iter.next();
- String mappedFilterType =
- (String) FILTER_TYPE_MAPPING.get(filter.getFilterType());
- XPath2FilterImpl mappedFilter =
- new XPath2FilterImpl(
- mappedFilterType,
- filter.getXPathExpression(),
- filter.getNamespaceDeclarations());
+ final XPathFilter filter = (XPathFilter) iter.next();
+ final String mappedFilterType =
+ (String) FILTER_TYPE_MAPPING.get(filter.getFilterType());
+ final XPath2FilterImpl mappedFilter =
+ new XPath2FilterImpl(
+ mappedFilterType,
+ filter.getXPathExpression(),
+ filter.getNamespaceDeclarations());
xpath2.addXPathFilter(mappedFilter);
}
@@ -266,15 +265,15 @@ public class TransformationFactory {
/**
* Create an <code>XSLTTransformation</code>.
- *
+ *
* @param transform The <code>Transform</code> containing the XSLT stylesheet.
* @return An <code>XSLTTransformation</code> corresponding the transformation
- * given in <code>transform</code>.
+ * given in <code>transform</code>.
* @throws MOAApplicationException An error occurred creating the
- * <code>Transformation</code>.
+ * <code>Transformation</code>.
*/
private Transformation createXSLTTransformation(XSLTTransform transform)
- throws MOAApplicationException {
+ throws MOAApplicationException {
return new XSLTTransformationImpl(transform.getStylesheet());
}
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 f4121b0..813d28e 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
@@ -21,13 +21,8 @@
* 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.cmsverify.CMSSignatureVerificationResult;
-import iaik.server.modules.pdfverify.PDFSignatureVerificationResult;
-import iaik.server.cmspdfverify.CertificateValidationResult;
-
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
@@ -41,28 +36,35 @@ import at.gv.egovernment.moa.spss.api.common.ExtendedCertificateCheckResult;
import at.gv.egovernment.moa.spss.api.common.SignerInfo;
import at.gv.egovernment.moa.spss.api.common.TslInfos;
import at.gv.egovernment.moa.spss.server.config.TrustProfile;
+import iaik.server.cmspdfverify.CertificateValidationResult;
+import iaik.server.modules.cmsverify.CMSSignatureVerificationResult;
+import iaik.server.modules.pdfverify.PDFSignatureVerificationResult;
/**
* A class to build a <code>VerifyCMSSignatureResponse</code> object.
- *
- * <p>Via subsequent calls to <code>addResult()</code> a number of results from
- * a CMS signature verification can be added to the response.</p>
- *
- * <p>The <code>getResponseElement()</code> method then returns the
- * <code>VerifyCMSSignatureResponse</code> built so far.</p>
- *
+ *
+ * <p>
+ * Via subsequent calls to <code>addResult()</code> a number of results from a
+ * CMS signature verification can be added to the response.
+ * </p>
+ *
+ * <p>
+ * The <code>getResponseElement()</code> method then returns the
+ * <code>VerifyCMSSignatureResponse</code> built so far.
+ * </p>
+ *
* @author Patrick Peck
* @version $Id$
*/
public class VerifyCMSSignatureResponseBuilder {
/** The <code>SPSSFactory</code> for creating API objects. */
- private SPSSFactory factory = SPSSFactory.getInstance();
+ private final SPSSFactory factory = SPSSFactory.getInstance();
/** The elements making up the response. */
- private List responseElements = new ArrayList();
+ private final List responseElements = new ArrayList();
/**
* Get the <code>VerifyCMSSignatureResponse</code> built so far.
- *
+ *
* @return The <code>VerifyCMSSignatureResponse</code> built so far.
*/
public VerifyCMSSignatureResponse getResponse() {
@@ -71,112 +73,146 @@ public class VerifyCMSSignatureResponseBuilder {
/**
* Add a verification result to the response.
- *
- * @param result The result to add.
- * @param trustprofile The actual trustprofile
- * @param checkQCFromTSL <code>true</code>, if the TSL check verifies the
- * certificate as qualified, otherwise <code>false</code>.
- * @param checkSSCD <code>true</code>, if the TSL check verifies the
- * signature based on a SSDC, otherwise <code>false</code>.
- * @param sscdSourceTSL <code>true</code>, if the SSCD information comes from the TSL,
- * otherwise <code>false</code>.
- * @throws MOAException
+ *
+ * @param result The result to add.
+ * @param trustprofile The actual trustprofile
+ * @param checkQCFromTSL <code>true</code>, if the TSL check verifies the
+ * certificate as qualified, otherwise <code>false</code>.
+ * @param checkSSCD <code>true</code>, if the TSL check verifies the
+ * signature based on a SSDC, otherwise
+ * <code>false</code>.
+ * @param sscdSourceTSL <code>true</code>, if the SSCD information comes from
+ * the TSL, otherwise <code>false</code>.
+ * @throws MOAException
*/
- public void addResult(CMSSignatureVerificationResult result, TrustProfile trustProfile, boolean checkQC, boolean qcSourceTSL, boolean checkSSCD, boolean sscdSourceTSL, String issuerCountryCode, List adesResults,
- ExtendedCertificateCheckResult extendedCertificateCheckResult, TslInfos tslInfos)
- throws MOAException {
-
- CertificateValidationResult certResult =
- result.getCertificateValidationResult();
- int signatureCheckCode =
- result.getSignatureValueVerificationCode().intValue();
- int certificateCheckCode = certResult.getValidationResultCode().intValue();
-
+ public void addResult(CMSSignatureVerificationResult result, TrustProfile trustProfile, boolean checkQC,
+ boolean qcSourceTSL, boolean checkSSCD, boolean sscdSourceTSL, String issuerCountryCode,
+ List adesResults,
+ ExtendedCertificateCheckResult extendedCertificateCheckResult, TslInfos tslInfos,
+ boolean extendedVerification)
+ throws MOAException {
+
+ final int signatureCheckCode = result.getSignatureValueVerificationCode().intValue();
+ final CertificateValidationResult certResult = result.getCertificateValidationResult();
+
VerifyCMSSignatureResponseElement responseElement;
- SignerInfo signerInfo;
+ SignerInfo signerInfo = null;
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,
- result.getSigningTime(),
- tslInfos);
+ final boolean qualifiedCertificate = checkQC;
+
+ // add signature algorithm name in case of extended validation
+ String sigAlgName = null;
+ if (extendedVerification) {
+ sigAlgName = result.getSignatureAlgorithmName();
+
+ }
+
+ // set code 99 if not certcheckresult exists
+ int certificateCheckCode = 99;
+ if (certResult != null) {
+ certificateCheckCode = certResult.getValidationResultCode().intValue();
+
+ // add SignerInfo element
+ signerInfo =
+ factory.createSignerInfo(
+ (X509Certificate) certResult.getCertificateChain().get(0),
+ qualifiedCertificate,
+ qcSourceTSL,
+ certResult.isPublicAuthorityCertificate(),
+ certResult.getPublicAuthorityID(),
+ checkSSCD,
+ sscdSourceTSL,
+ issuerCountryCode,
+ result.getSigningTime(),
+ tslInfos);
+ }
// 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,
- extendedCertificateCheckResult);
+ factory.createVerifyCMSSignatureResponseElement(
+ signerInfo,
+ signatureCheck,
+ certificateCheck,
+ adesResults,
+ extendedCertificateCheckResult,
+ sigAlgName,
+ null,
+ null);
responseElements.add(responseElement);
}
-
+
/**
- * Add a verification result to the response.
*
- * @param result The result to add.
- * @param trustprofile The actual trustprofile
- * @param checkQCFromTSL <code>true</code>, if the TSL check verifies the
- * certificate as qualified, otherwise <code>false</code>.
- * @param checkSSCD <code>true</code>, if the TSL check verifies the
- * signature based on a SSDC, otherwise <code>false</code>.
- * @param sscdSourceTSL <code>true</code>, if the SSCD information comes from the TSL,
- * otherwise <code>false</code>.
- * @throws MOAException
+ * @param result
+ * @param trustProfile
+ * @param checkQC
+ * @param qcSourceTSL
+ * @param checkSSCD
+ * @param sscdSourceTSL
+ * @param issuerCountryCode
+ * @param adesResults
+ * @param extendedCertificateCheckResult
+ * @param tslInfos
+ * @param extendedVerification
+ * @throws MOAException
*/
- public void addResult(PDFSignatureVerificationResult result, TrustProfile trustProfile, boolean checkQC, boolean qcSourceTSL, boolean checkSSCD, boolean sscdSourceTSL, String issuerCountryCode, List adesResults,
- ExtendedCertificateCheckResult extendedCertificateCheckResult, TslInfos tslInfos)
- throws MOAException {
-
- CertificateValidationResult certResult =
- result.getCertificateValidationResult();
- int signatureCheckCode =
- result.getSignatureValueVerificationCode().intValue();
-
+ public void addResult(PDFSignatureVerificationResult result, TrustProfile trustProfile, boolean checkQC,
+ boolean qcSourceTSL, boolean checkSSCD, boolean sscdSourceTSL, String issuerCountryCode,
+ List adesResults,
+ ExtendedCertificateCheckResult extendedCertificateCheckResult, TslInfos tslInfos,
+ boolean extendedVerification)
+ throws MOAException {
+
+ final CertificateValidationResult certResult =
+ result.getCertificateValidationResult();
+ final int signatureCheckCode =
+ result.getSignatureValueVerificationCode().intValue();
+
VerifyCMSSignatureResponseElement responseElement;
SignerInfo signerInfo = null;
CheckResult signatureCheck;
CheckResult certificateCheck;
- boolean qualifiedCertificate = checkQC;
-
- //set code 99 if not certcheckresult exists
+ final boolean qualifiedCertificate = checkQC;
+
+ // add signature algorithm name in case of extended validation
+ String sigAlgName = null;
+ Boolean coversFullDoc = null;
+ int[] sigByteRange = null;
+
+ if (extendedVerification) {
+ sigAlgName = result.getSignatureAlgorithmName();
+ coversFullDoc = result.byteRangeCoversWholeDocument();
+ sigByteRange = result.getByteRange();
+
+ }
+
+ // set code 99 if not certcheckresult exists
int certificateCheckCode = 99;
if (certResult != null) {
- certificateCheckCode = certResult.getValidationResultCode().intValue();
-
- // add SignerInfo element
- signerInfo =
- factory.createSignerInfo(
- (X509Certificate) certResult.getCertificateChain().get(0),
- qualifiedCertificate,
- qcSourceTSL,
- certResult.isPublicAuthorityCertificate(),
- certResult.getPublicAuthorityID(),
- checkSSCD,
- sscdSourceTSL,
- issuerCountryCode,
- result.getSigningTime(),
- tslInfos);
+ certificateCheckCode = certResult.getValidationResultCode().intValue();
+
+ // add SignerInfo element
+ signerInfo =
+ factory.createSignerInfo(
+ (X509Certificate) certResult.getCertificateChain().get(0),
+ qualifiedCertificate,
+ qcSourceTSL,
+ certResult.isPublicAuthorityCertificate(),
+ certResult.getPublicAuthorityID(),
+ checkSSCD,
+ sscdSourceTSL,
+ issuerCountryCode,
+ result.getSigningTime(),
+ tslInfos);
}
// add SignatureCheck element
@@ -184,15 +220,18 @@ public class VerifyCMSSignatureResponseBuilder {
// add CertificateCheck element
certificateCheck = factory.createCheckResult(certificateCheckCode, null);
-
+
// build the response element
responseElement =
- factory.createVerifyCMSSignatureResponseElement(
- signerInfo,
- signatureCheck,
- certificateCheck,
- adesResults,
- extendedCertificateCheckResult);
+ factory.createVerifyCMSSignatureResponseElement(
+ signerInfo,
+ signatureCheck,
+ certificateCheck,
+ adesResults,
+ extendedCertificateCheckResult,
+ sigAlgName,
+ coversFullDoc,
+ sigByteRange);
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 d8ebd85..7e882ed 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
@@ -21,16 +21,15 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.invoke;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Date;
import java.util.Iterator;
import java.util.List;
-import java.util.Date;
import javax.xml.crypto.OctetStreamData;
import javax.xml.crypto.dsig.CanonicalizationMethod;
@@ -69,25 +68,28 @@ import iaik.server.modules.xmlverify.SecurityLayerManifest;
import iaik.server.modules.xmlverify.XMLSignatureVerificationProfile;
import iaik.server.modules.xmlverify.XMLSignatureVerificationResult;
import iaik.x509.X509Certificate;
-import iaik.xml.crypto.alg.transform.C14NTransformService;
import iaik.xml.crypto.dsig.CanonicalizationMethodImpl;
/**
* A class to build a <code>VerifyXMLSignatureResponse</code> object.
- *
- * <p>Via a call to <code>addResult()</code> the only result of the
- * signature verification must be added.</p>
- *
- * <p>The <code>getResponseElement()</code> method then returns the
- * <code>VerifyXMLSignatureResponse</code> built so far.</p>
- *
+ *
+ * <p>
+ * Via a call to <code>addResult()</code> the only result of the signature
+ * verification must be added.
+ * </p>
+ *
+ * <p>
+ * The <code>getResponseElement()</code> method then returns the
+ * <code>VerifyXMLSignatureResponse</code> built so far.
+ * </p>
+ *
* @author Patrick Peck
* @version $Id$
*/
public class VerifyXMLSignatureResponseBuilder {
/** The <code>SPSSFactory</code> for creating API objects. */
- private SPSSFactory factory = SPSSFactory.getInstance();
+ private final SPSSFactory factory = SPSSFactory.getInstance();
/** Information about the signer certificate. */
private SignerInfo signerInfo;
@@ -106,205 +108,203 @@ public class VerifyXMLSignatureResponseBuilder {
private List adesFormResults = null;
private ExtendedCertificateCheckResult extCheckResult = null;
private Date signingTime;
+
+ private String signatureAlgorithm = null;
+
/**
* Get the <code>VerifyMLSignatureResponse</code> built so far.
- *
+ *
* @return The <code>VerifyXMLSignatureResponse</code> built so far.
*/
public VerifyXMLSignatureResponse getResponse() {
return factory.createVerifyXMLSignatureResponse(
- signerInfo,
- hashInputDatas,
- referenceInputDatas,
- signatureCheck,
- signatureManifestCheck,
- xmlDsigManifestChecks,
- certificateCheck,
- adesFormResults,
- extCheckResult);
+ signerInfo,
+ hashInputDatas,
+ referenceInputDatas,
+ signatureCheck,
+ signatureManifestCheck,
+ xmlDsigManifestChecks,
+ certificateCheck,
+ adesFormResults,
+ extCheckResult,
+ signatureAlgorithm);
}
-
+
public void setExtendedCertificateCheckResult(ExtendedCertificateCheckResult extCheckResult) {
- this.extCheckResult = extCheckResult;
+ this.extCheckResult = extCheckResult;
}
-
+
public void setAdESFormResults(List adesForm) {
- this.adesFormResults = adesForm;
+ this.adesFormResults = adesForm;
}
/**
* Sets the verification result to the response.
- *
+ *
* This method must be called exactly once to ensure a valid
* <code>VerifyXMLSignatureResponse</code>.
- *
- * @param result The result to set for the response.
- * @param profile The profile used for verifying the signature.
- * @param transformsSignatureManifestCheck The overall result for the signature
- * manifest check.
- * @param certificateCheck The overall result for the certificate check.
- * @param checkQC <code>true</code>, if the certificate is QC, otherwise <code>false</code>.
- * @param qcSourceTSL <code>true</code>, if the QC information comes from the TSL,
- * otherwise <code>false</code>.
- * @param checkSSCD <code>true</code>, if the signature is created by an SSCD, otherwise <code>false</code>.
- * @param sscdSourceTSL <code>true</code>, if the SSCD information comes from the TSL,
- * otherwise <code>false</code>.
+ *
+ * @param result The result to set for the response.
+ * @param profile The profile used for verifying the
+ * signature.
+ * @param transformsSignatureManifestCheck The overall result for the signature
+ * manifest check.
+ * @param certificateCheck The overall result for the
+ * certificate check.
+ * @param checkQC <code>true</code>, if the certificate
+ * is QC, otherwise <code>false</code>.
+ * @param qcSourceTSL <code>true</code>, if the QC
+ * information comes from the TSL,
+ * otherwise <code>false</code>.
+ * @param checkSSCD <code>true</code>, if the signature
+ * is created by an SSCD, otherwise
+ * <code>false</code>.
+ * @param sscdSourceTSL <code>true</code>, if the SSCD
+ * information comes from the TSL,
+ * otherwise <code>false</code>.
* @throws MOAApplicationException An error occurred adding the result.
*/
public void setResult(
- XMLSignatureVerificationResult result,
- XMLSignatureVerificationProfile profile,
- ReferencesCheckResult transformsSignatureManifestCheck,
- CheckResult certificateCheck,
- boolean checkQC,
- boolean qcSourceTSL,
- boolean checkSSCD,
- boolean sscdSourceTSL,
- boolean isTSLEnabledTrustprofile,
- String issuerCountryCode,
- TslInfos tslInfos)
- throws MOAApplicationException {
-
- CertificateValidationResult certResult =
- result.getCertificateValidationResult();
+ XMLSignatureVerificationResult result,
+ XMLSignatureVerificationProfile profile,
+ ReferencesCheckResult transformsSignatureManifestCheck,
+ CheckResult certificateCheck,
+ boolean checkQC,
+ boolean qcSourceTSL,
+ boolean checkSSCD,
+ boolean sscdSourceTSL,
+ boolean isTSLEnabledTrustprofile,
+ String issuerCountryCode,
+ TslInfos tslInfos,
+ boolean isExtendedValidation)
+ throws MOAApplicationException {
+
+ final CertificateValidationResult certResult =
+ result.getCertificateValidationResult();
List referenceDataList;
- ReferenceData referenceData;
+ final ReferenceData referenceData;
List dsigManifestList;
ReferencesCheckResultInfo checkResultInfo;
int[] failedReferences;
Iterator iter;
boolean qualifiedCertificate = false;
-
+
qualifiedCertificate = checkQC;
-
+
+ if (isExtendedValidation) {
+ signatureAlgorithm = result.getSignatureAlgorithmName();
+ }
+
// create the SignerInfo;
signerInfo =
- factory.createSignerInfo(
- (X509Certificate) certResult.getCertificateChain().get(0),
- qualifiedCertificate,
- qcSourceTSL,
- certResult.isPublicAuthorityCertificate(),
- certResult.getPublicAuthorityID(),
- checkSSCD,
- sscdSourceTSL,
- issuerCountryCode,
- result.getSigningTime(),
- tslInfos);
-
+ factory.createSignerInfo(
+ (X509Certificate) certResult.getCertificateChain().get(0),
+ qualifiedCertificate,
+ qcSourceTSL,
+ certResult.isPublicAuthorityCertificate(),
+ certResult.getPublicAuthorityID(),
+ checkSSCD,
+ sscdSourceTSL,
+ issuerCountryCode,
+ result.getSigningTime(),
+ tslInfos);
+
+ // TODO: add hash algo. infos
// Create HashInputData Content objects
referenceDataList = result.getReferenceDataList();
if (profile.includeHashInputData()) {
hashInputDatas = new ArrayList();
-
+
// Include SignedInfo references
addHashInputDatas(
- hashInputDatas,
- referenceDataList,
- InputData.CONTAINER_SIGNEDINFO_,
- InputData.REFERER_NONE_);
-
+ hashInputDatas,
+ referenceDataList,
+ InputData.CONTAINER_SIGNEDINFO_,
+ InputData.REFERER_NONE_);
+
// Include XMLDSIGManifest references
- List xMLDSIGManifests = result.getDsigManifestList();
- for (iter = xMLDSIGManifests.iterator(); iter.hasNext();)
- {
- DsigManifest currentMF = (DsigManifest) iter.next();
- List xMLDSIGMFReferenceDataList = currentMF.getReferenceDataList();
+ final List xMLDSIGManifests = result.getDsigManifestList();
+ for (iter = xMLDSIGManifests.iterator(); iter.hasNext();) {
+ final DsigManifest currentMF = (DsigManifest) iter.next();
+ final List xMLDSIGMFReferenceDataList = currentMF.getReferenceDataList();
addHashInputDatas(
- hashInputDatas,
- xMLDSIGMFReferenceDataList,
- InputData.CONTAINER_XMLDSIGMANIFEST_,
- currentMF.getReferringReferenceInfo().getReferenceIndex());
+ hashInputDatas,
+ xMLDSIGMFReferenceDataList,
+ InputData.CONTAINER_XMLDSIGMANIFEST_,
+ currentMF.getReferringReferenceInfo().getReferenceIndex());
}
}
// Create the ReferenceInputData Content objects
if (profile.includeReferenceInputData()) {
referenceInputDatas = new ArrayList();
-
+
// Include SignedInfo references
addReferenceInputDatas(
- referenceInputDatas,
- referenceDataList,
- InputData.CONTAINER_SIGNEDINFO_,
- InputData.REFERER_NONE_);
+ referenceInputDatas,
+ referenceDataList,
+ InputData.CONTAINER_SIGNEDINFO_,
+ InputData.REFERER_NONE_);
// Include XMLDSIGManifest references
- List xMLDSIGManifests = result.getDsigManifestList();
- for (iter = xMLDSIGManifests.iterator(); iter.hasNext();)
- {
- DsigManifest currentMF = (DsigManifest) iter.next();
- List xMLDSIGMFReferenceDataList = currentMF.getReferenceDataList();
+ final List xMLDSIGManifests = result.getDsigManifestList();
+ for (iter = xMLDSIGManifests.iterator(); iter.hasNext();) {
+ final DsigManifest currentMF = (DsigManifest) iter.next();
+ final List xMLDSIGMFReferenceDataList = currentMF.getReferenceDataList();
addReferenceInputDatas(
- referenceInputDatas,
- xMLDSIGMFReferenceDataList,
- InputData.CONTAINER_XMLDSIGMANIFEST_,
- currentMF.getReferringReferenceInfo().getReferenceIndex());
+ referenceInputDatas,
+ xMLDSIGMFReferenceDataList,
+ InputData.CONTAINER_XMLDSIGMANIFEST_,
+ currentMF.getReferringReferenceInfo().getReferenceIndex());
}
}
// create the signature check
failedReferences = buildFailedReferences(result.getReferenceDataList());
checkResultInfo =
- failedReferences != null
- ? factory.createReferencesCheckResultInfo(null, failedReferences)
- : null;
+ failedReferences != null
+ ? factory.createReferencesCheckResultInfo(null, failedReferences)
+ : null;
signatureCheck =
- factory.createReferencesCheckResult(
- result.getSignatureValueVerificationCode().intValue(),
- checkResultInfo);
+ factory.createReferencesCheckResult(
+ result.getSignatureValueVerificationCode().intValue(),
+ checkResultInfo);
// create the signature manifest check
- if (profile.checkSecurityLayerManifest())
- {
- if (transformsSignatureManifestCheck.getCode() == 1)
- {
+ if (profile.checkSecurityLayerManifest()) {
+ if (transformsSignatureManifestCheck.getCode() == 1) {
// checking the transforms failed
signatureManifestCheck = transformsSignatureManifestCheck;
- }
- else if (result.isSecurityLayerManifestRequired())
- {
- if (!result.containsSecurityLayerManifest())
- {
+ } else if (result.isSecurityLayerManifestRequired()) {
+ if (!result.containsSecurityLayerManifest()) {
// required security layer manifest is missing in signature
signatureManifestCheck = factory.createReferencesCheckResult(2, null);
- }
- else
- {
+ } else {
// security layer manifest exists, so we have to check its validity
- SecurityLayerManifest slManifest = result.getSecurityLayerManifest();
- int verificationResult = slManifest.getManifestVerificationResult().intValue();
+ final SecurityLayerManifest slManifest = result.getSecurityLayerManifest();
+ final int verificationResult = slManifest.getManifestVerificationResult().intValue();
- if (SecurityLayerManifest.CODE_MANIFEST_VALID.intValue() == verificationResult)
- {
+ if (SecurityLayerManifest.CODE_MANIFEST_VALID.intValue() == verificationResult) {
// security layer manifest exists and is free of errors
signatureManifestCheck = factory.createReferencesCheckResult(0, null);
- }
- else
- {
+ } else {
// security layer manifest exists, but has errors
failedReferences = buildFailedReferences(slManifest.getReferenceDataList());
- checkResultInfo = (failedReferences != null)
- ? factory.createReferencesCheckResultInfo(null, failedReferences)
- : null;
- if (SecurityLayerManifest.CODE_MANIFEST_INCOMPLETE.intValue() == verificationResult)
- {
- signatureManifestCheck = factory.createReferencesCheckResult(3, checkResultInfo);
- }
- else if (SecurityLayerManifest.CODE_REFERENCE_HASH_INVALID.intValue() == verificationResult)
- {
- signatureManifestCheck = factory.createReferencesCheckResult(4, checkResultInfo);
- }
- else
- {
+ checkResultInfo = failedReferences != null
+ ? factory.createReferencesCheckResultInfo(null, failedReferences)
+ : null;
+ if (SecurityLayerManifest.CODE_MANIFEST_INCOMPLETE.intValue() == verificationResult) {
+ signatureManifestCheck = factory.createReferencesCheckResult(3, checkResultInfo);
+ } else if (SecurityLayerManifest.CODE_REFERENCE_HASH_INVALID.intValue() == verificationResult) {
+ signatureManifestCheck = factory.createReferencesCheckResult(4, checkResultInfo);
+ } else {
// Should not happen
throw new RuntimeException("Unexpected result from security layer manifest verification.");
}
}
}
- }
- else
- {
+ } else {
// no security layer manifest is required, so the signature manifest check is ok
signatureManifestCheck = factory.createReferencesCheckResult(0, null);
}
@@ -315,165 +315,181 @@ public class VerifyXMLSignatureResponseBuilder {
xmlDsigManifestChecks = new ArrayList();
dsigManifestList = result.getDsigManifestList();
for (iter = dsigManifestList.iterator(); iter.hasNext();) {
- DsigManifest dsigManifest = (DsigManifest) iter.next();
- int refIndex =
- dsigManifest.getReferringReferenceInfo().getReferenceIndex();
+ final DsigManifest dsigManifest = (DsigManifest) iter.next();
+ final int refIndex =
+ dsigManifest.getReferringReferenceInfo().getReferenceIndex();
ManifestRefsCheckResultInfo manifestCheckResultInfo;
failedReferences =
- buildFailedReferences(dsigManifest.getReferenceDataList());
+ buildFailedReferences(dsigManifest.getReferenceDataList());
manifestCheckResultInfo =
- factory.createManifestRefsCheckResultInfo(
- null,
- failedReferences,
- refIndex);
+ factory.createManifestRefsCheckResultInfo(
+ null,
+ failedReferences,
+ refIndex);
xmlDsigManifestChecks.add(
- factory.createManifestRefsCheckResult(
- dsigManifest.getManifestVerificationResult().intValue(),
- manifestCheckResultInfo));
+ factory.createManifestRefsCheckResult(
+ dsigManifest.getManifestVerificationResult().intValue(),
+ manifestCheckResultInfo));
}
}
- // create the certificate check
+ // create the certificate check
this.certificateCheck = certificateCheck;
-
+
this.signingTime = result.getSigningTime();
-
+
}
/**
- * Adds {@link InputData} entries to the specified <code>inputDatas</code> list. The content of the entry will
- * be created from {@link ReferenceData#getHashInputData()}.
- *
- * @param inputDatas The list to be amended.
- *
- * @param referenceDataList The list of {@link ReferenceData} objects to be investigated.
- *
- * @param containerType The type of container of the {@link InputData} objects to be created.
- *
- * @param refererNumber The number of the referring reference for the {@link InputData} objects to be created.
- *
- * @throws MOAApplicationException if creating an {@link InputData} fails.
+ * Adds {@link InputData} entries to the specified <code>inputDatas</code> list.
+ * The content of the entry will be created from
+ * {@link ReferenceData#getHashInputData()}.
+ *
+ * @param inputDatas The list to be amended.
+ *
+ * @param referenceDataList The list of {@link ReferenceData} objects to be
+ * investigated.
+ *
+ * @param containerType The type of container of the {@link InputData}
+ * objects to be created.
+ *
+ * @param refererNumber The number of the referring reference for the
+ * {@link InputData} objects to be created.
+ *
+ * @throws MOAApplicationException if creating an {@link InputData} fails.
*/
- private void addHashInputDatas(List inputDatas, List referenceDataList, String containerType, int refererNumber)
- throws MOAApplicationException
- {
- for (Iterator iter = referenceDataList.iterator(); iter.hasNext();)
- {
- ReferenceData referenceData = (ReferenceData) iter.next();
+ private void addHashInputDatas(List inputDatas, List referenceDataList, String containerType,
+ int refererNumber)
+ throws MOAApplicationException {
+ for (final Object element : referenceDataList) {
+ final ReferenceData referenceData = (ReferenceData) element;
inputDatas.add(buildInputData(
- referenceData.getHashInputData(),
- containerType,
- refererNumber));
+ referenceData.getHashInputData(),
+ containerType,
+ refererNumber,
+ referenceData.getHashAlgorithmName()));
}
}
-
+
/**
- * Adds {@link InputData} entries to the specified <code>inputDatas</code> list. The content of the entry will
- * be created from {@link ReferenceData#getReferenceInputData()}.
- *
- * @param inputDatas The list to be amended.
- *
- * @param referenceDataList The list of {@link ReferenceData} objects to be investigated.
- *
- * @param containerType The type of container of the {@link InputData} objects to be created.
- *
- * @param refererNumber The number of the referring reference for the {@link InputData} objects to be created.
- *
- * @throws MOAApplicationException if creating an {@link InputData} fails.
+ * Adds {@link InputData} entries to the specified <code>inputDatas</code> list.
+ * The content of the entry will be created from
+ * {@link ReferenceData#getReferenceInputData()}.
+ *
+ * @param inputDatas The list to be amended.
+ *
+ * @param referenceDataList The list of {@link ReferenceData} objects to be
+ * investigated.
+ *
+ * @param containerType The type of container of the {@link InputData}
+ * objects to be created.
+ *
+ * @param refererNumber The number of the referring reference for the
+ * {@link InputData} objects to be created.
+ *
+ * @throws MOAApplicationException if creating an {@link InputData} fails.
*/
- private void addReferenceInputDatas(List inputDatas, List referenceDataList, String containerType, int refererNumber)
- throws MOAApplicationException
- {
- for (Iterator iter = referenceDataList.iterator(); iter.hasNext();)
- {
- ReferenceData referenceData = (ReferenceData) iter.next();
+ private void addReferenceInputDatas(List inputDatas, List referenceDataList, String containerType,
+ int refererNumber)
+ throws MOAApplicationException {
+ for (final Object element : referenceDataList) {
+ final ReferenceData referenceData = (ReferenceData) element;
inputDatas.add(buildInputData(
- referenceData.getReferenceInputData(),
- containerType,
- refererNumber));
+ referenceData.getReferenceInputData(),
+ containerType,
+ refererNumber,
+ referenceData.getHashAlgorithmName()));
}
}
/**
* Build a <code>InputDataBinaryImpl</code> or an <code>InputDataXMLImpl</code>
* object from the given <code>DataObject</code> and the given attributes.
- *
- * @param dataObject The <code>DataObject</code> from which to build the result.
- * Based on the type of this parameter, the type of the result will either be
- * <code>InputDataBinaryImpl</code> or <code>InputDataXMLImpl</code>.
- *
- * @param partof see {@link InputData}
- *
+ *
+ * @param dataObject The <code>DataObject</code> from which to
+ * build the result. Based on the type of this
+ * parameter, the type of the result will either
+ * be <code>InputDataBinaryImpl</code> or
+ * <code>InputDataXMLImpl</code>.
+ *
+ * @param partof see {@link InputData}
+ *
* @param referringReferenceNumber see {@link InputData}
- *
+ *
+ * @param hashAlg see {@link InputData}
+ *
* @return The corresponinding input data implementation.
- *
* @throws MOAApplicationException An error occurred creating the result.
*/
- private Content buildInputData(DataObject dataObject, String partOf, int referringReferenceNumber)
- throws MOAApplicationException {
+ private Content buildInputData(DataObject dataObject, String partOf, int referringReferenceNumber,
+ String hashAlg)
+ throws MOAApplicationException {
if (dataObject instanceof BinaryDataObject) {
- BinaryDataObject binaryData = (BinaryDataObject) dataObject;
+ final BinaryDataObject binaryData = (BinaryDataObject) dataObject;
return new InputDataBinaryImpl(
- factory.createContent(binaryData.getInputStream(), null),
- partOf,
- referringReferenceNumber);
+ factory.createContent(binaryData.getInputStream(), null),
+ partOf,
+ referringReferenceNumber,
+ hashAlg);
} else if (dataObject instanceof XMLDataObject) {
- XMLDataObject xmlData = (XMLDataObject) dataObject;
- List nodes = new ArrayList();
+ final XMLDataObject xmlData = (XMLDataObject) dataObject;
+ final List nodes = new ArrayList();
nodes.add(xmlData.getElement());
return new InputDataXMLImpl(
- factory.createContent(new NodeListAdapter(nodes), null),
- partOf,
- referringReferenceNumber);
+ factory.createContent(new NodeListAdapter(nodes), null),
+ partOf,
+ referringReferenceNumber,
+ hashAlg);
} else { // dataObject instanceof XMLNodeListDataObject
// if the data in the NodeList can be converted back to valid XML,
- // write it as XMLContent; otherwise, write it as Base64Content
- XMLNodeListDataObject nodeData = (XMLNodeListDataObject) dataObject;
- NodeList nodes = nodeData.getNodeList();
-
+ // write it as XMLContent; otherwise, write it as Base64Content
+ final XMLNodeListDataObject nodeData = (XMLNodeListDataObject) dataObject;
+ final NodeList nodes = nodeData.getNodeList();
+
if (DOMUtils.checkAttributeParentsInNodeList(nodes)) {
// insert as XMLContent
try {
- DocumentFragment fragment = DOMUtils.nodeList2DocumentFragment(nodes);
+ final DocumentFragment fragment = DOMUtils.nodeList2DocumentFragment(nodes);
return new InputDataXMLImpl(
- factory.createContent(fragment.getChildNodes(), null),
- partOf,
- referringReferenceNumber);
- } catch (Exception e) {
+ factory.createContent(fragment.getChildNodes(), null),
+ partOf,
+ referringReferenceNumber,
+ hashAlg);
+ } catch (final Exception e) {
// not successful -> fall through to the Base64Content
}
}
-
+
// insert canonicalized NodeList as binary content
try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- for(int i = 0; i < nodes.getLength(); i++) {
- baos.write(DOMUtils.nodeToByteArray(nodes.item(i)));
- }
- baos.close();
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- OctetStreamData inputData = new OctetStreamData(bais);
-
- CanonicalizationMethodImpl canonicalizationMethodImpl = new CanonicalizationMethodImpl(
- CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS, new ExcC14NParameterSpec());
- OctetStreamData data = (OctetStreamData)canonicalizationMethodImpl.transform(inputData, null);
- bais.close();
- //CanonicalizationAlgorithm c14n =
- //new CanonicalizationAlgorithmImplExclusiveCanonicalXMLWithComments();
- InputStream is = data.getOctetStream();
-
- //c14n.setInput(nodes);
- //is = c14n.canonicalize();
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ for (int i = 0; i < nodes.getLength(); i++) {
+ baos.write(DOMUtils.nodeToByteArray(nodes.item(i)));
+ }
+ baos.close();
+ final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ final OctetStreamData inputData = new OctetStreamData(bais);
+
+ final CanonicalizationMethodImpl canonicalizationMethodImpl = new CanonicalizationMethodImpl(
+ CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS, new ExcC14NParameterSpec());
+ final OctetStreamData data = (OctetStreamData) canonicalizationMethodImpl.transform(inputData, null);
+ bais.close();
+ // CanonicalizationAlgorithm c14n =
+ // new CanonicalizationAlgorithmImplExclusiveCanonicalXMLWithComments();
+ final InputStream is = data.getOctetStream();
+
+ // c14n.setInput(nodes);
+ // is = c14n.canonicalize();
return new InputDataBinaryImpl(
- factory.createContent(is, null),
- partOf,
- referringReferenceNumber);
- } catch (Exception e) {
+ factory.createContent(is, null),
+ partOf,
+ referringReferenceNumber,
+ hashAlg);
+ } catch (final Exception e) {
throw new MOAApplicationException("2200", null);
}
}
@@ -481,27 +497,27 @@ public class VerifyXMLSignatureResponseBuilder {
/**
* Build the failed references.
- *
+ *
* Failed references are references for which the <code>isHashValid()</code>
* method returns <code>false</code>.
- *
- * @param refInfos A <code>List</code> containing the
- * <code>ReferenceInfo</code> objects to be checked.
- * @return The indexes of the failed references.
+ *
+ * @param refInfos A <code>List</code> containing the <code>ReferenceInfo</code>
+ * objects to be checked.
+ * @return The indexes of the failed references.
*/
private int[] buildFailedReferences(List refInfos) {
- List failedReferencesList = new ArrayList();
+ final List failedReferencesList = new ArrayList();
int i;
// find out the failed references
for (i = 0; i < refInfos.size(); i++) {
- ReferenceInfo refInfo = (ReferenceInfo) refInfos.get(i);
+ final ReferenceInfo refInfo = (ReferenceInfo) refInfos.get(i);
try {
if (refInfo.isHashCalculated() && !refInfo.isHashValid()) {
failedReferencesList.add(new Integer(i + 1));
}
- } catch (HashUnavailableException e) {
+ } catch (final HashUnavailableException e) {
// nothing to do here because we called refInfo.isHashCalculated first
}
}
@@ -510,7 +526,7 @@ public class VerifyXMLSignatureResponseBuilder {
if (failedReferencesList.isEmpty()) {
return null;
} else {
- int[] failedReferences = CollectionUtils.toIntArray(failedReferencesList);
+ final int[] failedReferences = CollectionUtils.toIntArray(failedReferencesList);
return failedReferences;
}
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 ecdd811..e039cb9 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
@@ -21,18 +21,8 @@
* 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.IAIKException;
-import iaik.server.modules.IAIKRuntimeException;
-import iaik.server.modules.xml.DataObject;
-import iaik.server.modules.xml.XMLDataObject;
-import iaik.server.modules.xml.XMLSignature;
-import iaik.server.modules.xmlsign.XMLSignatureCreationModule;
-import iaik.server.modules.xmlsign.XMLSignatureCreationModuleFactory;
-import iaik.server.modules.xmlsign.XMLSignatureCreationProfile;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -71,17 +61,25 @@ 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;
+import iaik.server.modules.IAIKException;
+import iaik.server.modules.IAIKRuntimeException;
+import iaik.server.modules.xml.DataObject;
+import iaik.server.modules.xml.XMLDataObject;
+import iaik.server.modules.xml.XMLSignature;
+import iaik.server.modules.xmlsign.XMLSignatureCreationModule;
+import iaik.server.modules.xmlsign.XMLSignatureCreationModuleFactory;
+import iaik.server.modules.xmlsign.XMLSignatureCreationProfile;
/**
* A class providing an API based interface to the
* <code>XMLSignatureCreationModule</code>.
- *
- * This class performs the invocation of the
+ *
+ * This class performs the invocation of the
* <code>iaik.server.modules.xmlsign.XMLSignatureCreationModule</code> from a
* <code>CreateXMLSignatureRequest</code> given as an API object. The result of
* the invocation is integrated into a <code>CreateXMLSignatureResponse</code>
* and returned.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -92,7 +90,7 @@ public class XMLSignatureCreationInvoker {
/**
* Get the only instance of this class.
- *
+ *
* @return The only instance of this class.
*/
public static synchronized XMLSignatureCreationInvoker getInstance() {
@@ -104,7 +102,7 @@ public class XMLSignatureCreationInvoker {
/**
* Create a new <code>XMLSignatureCreationInvoker</code>.
- *
+ *
* Protected to disallow multiple instances.
*/
protected XMLSignatureCreationInvoker() {
@@ -114,31 +112,31 @@ public class XMLSignatureCreationInvoker {
* Process the <code>CreateXMLSignatureRequest<code> message and invoke the
* <code>XMLSignatureCreationModule</code> for every
* <code>SingleSignatureInfo</code> contained in the request.
- *
+ *
* @param request A <code>CreateXMLSignatureRequest<code> API object
* containing the information for creating the signature(s).
- * @param reserved A <code>Set</code> of reserved object IDs.
- *
- * @return A <code>CreateXMLSignatureResponse</code> API object containing
- * the created signature(s). The response contains either a
- * <code>SignatureEnvironment</code> or a <code>ErrorResponse</code>
- * for each <code>SingleSignatureInfo</code> in the request.
- * @throws MOAException An error occurred during signature creation.
+ * &#64;param reserved A <code>Set</code> of reserved object IDs.
+ *
+ * @return A <code>CreateXMLSignatureResponse</code> API object containing the
+ * created signature(s). The response contains either a
+ * <code>SignatureEnvironment</code> or a <code>ErrorResponse</code> for
+ * each <code>SingleSignatureInfo</code> in the request.
+ * @throws MOAException An error occurred during signature creation.
*/
public CreateXMLSignatureResponse createXMLSignature(
- CreateXMLSignatureRequest request,
- Set reserved)
- throws MOAException {
-
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- LoggingContext loggingCtx =
- LoggingContextManager.getInstance().getLoggingContext();
+ CreateXMLSignatureRequest request,
+ Set reserved)
+ throws MOAException {
+
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final LoggingContext loggingCtx =
+ LoggingContextManager.getInstance().getLoggingContext();
reserved = new HashSet(reserved);
- XMLSignatureCreationProfileFactory profileFactory =
- new XMLSignatureCreationProfileFactory(request, reserved);
- CreateXMLSignatureResponseBuilder responseBuilder =
- new CreateXMLSignatureResponseBuilder();
+ final XMLSignatureCreationProfileFactory profileFactory =
+ new XMLSignatureCreationProfileFactory(request, reserved);
+ final CreateXMLSignatureResponseBuilder responseBuilder =
+ new CreateXMLSignatureResponseBuilder();
int createCount = 1;
IdGenerator refIdGen;
XMLSignatureCreationModule module;
@@ -153,8 +151,8 @@ public class XMLSignatureCreationInvoker {
// iterate over all the SingleSignatureInfo elements in the request
while (singleSignatureInfoIter.hasNext()) {
- SingleSignatureInfo singleSignatureInfo =
- (SingleSignatureInfo) singleSignatureInfoIter.next();
+ final SingleSignatureInfo singleSignatureInfo =
+ (SingleSignatureInfo) singleSignatureInfoIter.next();
CreateSignatureInfo createSignatureInfo;
List dataObjectList;
XMLSignatureCreationProfile profile;
@@ -170,44 +168,47 @@ public class XMLSignatureCreationInvoker {
// build the signature environment
createSignatureInfo = singleSignatureInfo.getCreateSignatureInfo();
if (createSignatureInfo != null) {
- DataObjectFactory dataObjFactory = DataObjectFactory.getInstance();
+ final DataObjectFactory dataObjFactory = DataObjectFactory.getInstance();
signatureEnvironment =
- dataObjFactory.createSignatureEnvironment(
- createSignatureInfo.getCreateSignatureEnvironment(),
- getCreateSignatureEnvironmentProfileSupplements(singleSignatureInfo));
+ dataObjFactory.createSignatureEnvironment(
+ createSignatureInfo.getCreateSignatureEnvironment(),
+ getCreateSignatureEnvironmentProfileSupplements(singleSignatureInfo));
} else {
signatureEnvironment = null;
}
-
- HashSet sigInfoReservedIDs = new HashSet();
- if (signatureEnvironment != null)
- {
+
+ final HashSet sigInfoReservedIDs = new HashSet();
+ if (signatureEnvironment != null) {
// Find Id attributes of existing XML signatures in signature environment
- HashMap nSMap = new HashMap();
- String dsp = Constants.DSIG_PREFIX;
- nSMap.put(dsp, Constants.DSIG_NS_URI);
- String xPathExpr = "//" + dsp + ":Signature/@Id | //" + dsp + ":Reference/@Id | //"
- + dsp + ":Object/@Id | //" + dsp + ":Manifest/@Id";
- NodeList idAttrs = XPathUtils.selectNodeList(signatureEnvironment.getElement(), nSMap, xPathExpr);
-
- // Add found Id attributes to set of reserved IDs
- for (int i = 0; i < idAttrs.getLength(); i++) sigInfoReservedIDs.add(idAttrs.item(i).getNodeValue());
+ final HashMap nSMap = new HashMap();
+ final String dsp = Constants.DSIG_PREFIX;
+ nSMap.put(dsp, Constants.DSIG_NS_URI);
+ final String xPathExpr = "//" + dsp + ":Signature/@Id | //" + dsp + ":Reference/@Id | //"
+ + dsp + ":Object/@Id | //" + dsp + ":Manifest/@Id";
+ final NodeList idAttrs = XPathUtils.selectNodeList(signatureEnvironment.getElement(), nSMap,
+ xPathExpr);
+
+ // Add found Id attributes to set of reserved IDs
+ for (int i = 0; i < idAttrs.getLength(); i++) {
+ sigInfoReservedIDs.add(idAttrs.item(i).getNodeValue());
+ }
}
// create the reference id generator
- HashSet allReservedIDs = new HashSet(reserved);
+ final HashSet allReservedIDs = new HashSet(reserved);
allReservedIDs.addAll(sigInfoReservedIDs);
refIdGen = new IdGenerator("reference-" + createCount++, allReservedIDs);
// build the list of DataObjects
- List createTransformsProfiles = profileFactory.getCreateTransformsInfoProfiles(singleSignatureInfo);
+ final List createTransformsProfiles = profileFactory.getCreateTransformsInfoProfiles(
+ singleSignatureInfo);
dataObjectList =
- buildDataObjectList(
- singleSignatureInfo,
- createTransformsProfiles,
- signatureEnvironment,
- refIdGen);
+ buildDataObjectList(
+ singleSignatureInfo,
+ createTransformsProfiles,
+ signatureEnvironment,
+ refIdGen);
// build the XMLSignatureCreationProfile
profile = profileFactory.createProfile(singleSignatureInfo, sigInfoReservedIDs);
@@ -218,78 +219,78 @@ public class XMLSignatureCreationInvoker {
// build the signatureParentElement
if (signatureEnvironment != null) {
signatureParent =
- buildSignatureParentElement(
- signatureEnvironment.getElement(),
- singleSignatureInfo);
+ buildSignatureParentElement(
+ signatureEnvironment.getElement(),
+ singleSignatureInfo);
} else {
signatureParent = null;
}
- // make the signature environment the root of the document, if it is
- // not a separate document anyway; this is done to assure that
- // canonicalization of the signature environment contains the correct
+ // make the signature environment the root of the document, if it is
+ // not a separate document anyway; this is done to assure that
+ // canonicalization of the signature environment contains the correct
// namespace declarations
if (signatureEnvironment != null) {
- Document requestDoc =
- signatureEnvironment.getElement().getOwnerDocument();
+ final Document requestDoc =
+ signatureEnvironment.getElement().getOwnerDocument();
requestElement = requestDoc.getDocumentElement();
if (requestElement != signatureEnvironment.getElement()) {
signatureEnvironmentParent =
- signatureEnvironment.getElement().getParentNode();
+ signatureEnvironment.getElement().getParentNode();
requestElement.getOwnerDocument().replaceChild(
- signatureEnvironment.getElement(),
- requestElement);
+ signatureEnvironment.getElement(),
+ requestElement);
}
}
try {
- ConfigurationProvider config = context.getConfiguration();
- String xadesVersion = config.getXAdESVersion();
-
- if (xadesVersion!= null && xadesVersion.compareTo(XMLSignatureCreationModule.XADES_VERSION_1_4_2) == 0) {
- // create the signature (XAdES 1.4.2)
- signature =
- module.createSignature(
+ final ConfigurationProvider config = context.getConfiguration();
+ final String xadesVersion = config.getXAdESVersion();
+
+ if (xadesVersion != null && xadesVersion.compareTo(
+ XMLSignatureCreationModule.XADES_VERSION_1_4_2) == 0) {
+ // create the signature (XAdES 1.4.2)
+ signature =
+ module.createSignature(
dataObjectList,
profile,
additionalSignedProperties,
signatureParent,
XMLSignatureCreationModule.XADES_VERSION_1_4_2,
new TransactionId(context.getTransactionID()));
- }
- else {
- // create the signature (XAdES 1.1.1 = default)
- signature =
- module.createSignature(
+ } else {
+ // create the signature (XAdES 1.1.1 = default)
+ signature =
+ module.createSignature(
dataObjectList,
profile,
additionalSignedProperties,
signatureParent,
XMLSignatureCreationModule.XADES_VERSION_1_1_1,
new TransactionId(context.getTransactionID()));
- }
+ }
// insert the result into the response
if (signatureParent != null) {
responseBuilder.addSignatureEnvironment(
- signatureEnvironment.getElement());
+ signatureEnvironment.getElement());
} else {
responseBuilder.addSignatureEnvironment(signature.getElement());
}
- } catch (IAIKException e) {
- MOAException moaException = IaikExceptionMapper.getInstance().map(e);
+ } catch (final IAIKException e) {
+ final MOAException moaException = IaikExceptionMapper.getInstance().map(e);
responseBuilder.addError(
- moaException.getMessageId(),
- moaException.getMessage());
+ moaException.getMessageId(),
+ moaException.getMessage());
Logger.warn(moaException.getMessage(), e);
- } catch (IAIKRuntimeException e) {
- MOAException moaException = IaikExceptionMapper.getInstance().map(e);
+ } catch (final IAIKRuntimeException e) {
+ final MOAException moaException = IaikExceptionMapper.getInstance().map(e);
responseBuilder.addError(
- moaException.getMessageId(),
- moaException.getMessage());
+ moaException.getMessageId(),
+ moaException.getMessage());
Logger.warn(moaException.getMessage(), e);
}
@@ -297,14 +298,14 @@ public class XMLSignatureCreationInvoker {
if (signatureEnvironment != null) {
if (requestElement != signatureEnvironment.getElement()) {
requestElement.getOwnerDocument().replaceChild(
- requestElement,
- signatureEnvironment.getElement());
+ requestElement,
+ signatureEnvironment.getElement());
signatureEnvironmentParent.appendChild(
- signatureEnvironment.getElement());
+ signatureEnvironment.getElement());
}
}
- } catch (MOAException e) {
+ } catch (final MOAException e) {
responseBuilder.addError(e.getMessageId(), e.getMessage());
Logger.warn(e.getMessage(), e);
}
@@ -317,85 +318,88 @@ public class XMLSignatureCreationInvoker {
/**
* Build the list of <code>DataObject</code>s from the given
* <code>SingleSignatureInfo</code> object.
- *
+ *
* <p>
- * Only the following cases of <code>DataObject</code>s are
- * valid in case of an enveloping signature:
- *
+ * Only the following cases of <code>DataObject</code>s are valid in case of an
+ * enveloping signature:
+ *
* <ul>
- * <li><code>Reference == null && Content != null</code>: The
+ * <li><code>Reference == null && Content != null</code>: The
* <code>Content</code> will be used in the <code>DataObject</code>.</li>
* <li><code>Reference != null && Content == null</code>: Resolve the
- * <code>Reference</code> and use it as <code>DataObject</code>.
- * Set the <code>Reference</code> in the <code>DataObject</code> as well.</li>
+ * <code>Reference</code> and use it as <code>DataObject</code>. Set the
+ * <code>Reference</code> in the <code>DataObject</code> as well.</li>
* </ul>
* </p>
- *
+ *
* <p>
- * Only the following cases of <code>DataObject</code>s are valid in case
- * of a detached signature:
- *
+ * Only the following cases of <code>DataObject</code>s are valid in case of a
+ * detached signature:
+ *
* <ul>
* <li><code>Reference != null && Content == null</code>: Resolve the
- * <code>Reference</code> and use it as <code>DataObject</code>.
- * Set the <code>Reference</code> in the <code>DataObject</code> as well.</li>
+ * <code>Reference</code> and use it as <code>DataObject</code>. Set the
+ * <code>Reference</code> in the <code>DataObject</code> as well.</li>
* <li><code>Reference != null && Content != null</code>: The
- * <code>Content</code> will be used in the <code>DataObject</code>.
- * Set the <code>Reference</code> in the <code>DataObject</code> as well.</li>
+ * <code>Content</code> will be used in the <code>DataObject</code>. Set the
+ * <code>Reference</code> in the <code>DataObject</code> as well.</li>
* </ul>
* </p>
- *
+ *
* <p>
* All other cases will lead to an error.
* </p>
- *
- * @param singleSignatureInfo The <code>SingleSignatureInfo</code> object
- * containing the <code>DataObjectInfo</code> objects.
- * @param createTransformsProfiles A list of objects of type {@link CreateTransformsInfoProfileExplicit},
- * each representing the transforms info profile information for the corresponding <code>DataObject</code>.
- * @param signatureEnvironment The
- * @param idGen The ID generator for <code>DataObject</code> references.
+ *
+ * @param singleSignatureInfo The <code>SingleSignatureInfo</code> object
+ * containing the <code>DataObjectInfo</code>
+ * objects.
+ * @param createTransformsProfiles A list of objects of type
+ * {@link CreateTransformsInfoProfileExplicit},
+ * each representing the transforms info profile
+ * information for the corresponding
+ * <code>DataObject</code>.
+ * @param signatureEnvironment The
+ * @param idGen The ID generator for <code>DataObject</code>
+ * references.
* @return The <code>List</code> of <code>DataObject</code>s contained in the
- * given <code>singleSignatureInfo</code>.
- * @throws MOASystemException A system error occurred building the data
- * objects.
- * @throws MOAApplicationException An error occurred building the data
- * objects.
+ * given <code>singleSignatureInfo</code>.
+ * @throws MOASystemException A system error occurred building the data
+ * objects.
+ * @throws MOAApplicationException An error occurred building the data objects.
*/
private List buildDataObjectList(
- SingleSignatureInfo singleSignatureInfo,
- List createTransformsProfiles,
- XMLDataObject signatureEnvironment,
- IdGenerator idGen)
- throws MOASystemException, MOAApplicationException {
-
- List dataObjInfos = singleSignatureInfo.getDataObjectInfos();
- List dataObjects = new ArrayList();
+ SingleSignatureInfo singleSignatureInfo,
+ List createTransformsProfiles,
+ XMLDataObject signatureEnvironment,
+ IdGenerator idGen)
+ throws MOASystemException, MOAApplicationException {
+
+ final List dataObjInfos = singleSignatureInfo.getDataObjectInfos();
+ final List dataObjects = new ArrayList();
Iterator dtIter;
- Iterator ctpIter = createTransformsProfiles.iterator();
+ final Iterator ctpIter = createTransformsProfiles.iterator();
- for (dtIter = dataObjInfos.iterator(); dtIter.hasNext();)
- {
- DataObjectInfo dataObjInfo = (DataObjectInfo) dtIter.next();
- String structure = dataObjInfo.getStructure();
-
- CreateTransformsInfoProfileExplicit transformsProfile =
- (CreateTransformsInfoProfileExplicit) ctpIter.next();
- MetaInfo finalDataMetaInfo = transformsProfile.getCreateTransformsInfo().getFinalDataMetaInfo();
+ for (dtIter = dataObjInfos.iterator(); dtIter.hasNext();) {
+ final DataObjectInfo dataObjInfo = (DataObjectInfo) dtIter.next();
+ final String structure = dataObjInfo.getStructure();
+
+ final CreateTransformsInfoProfileExplicit transformsProfile =
+ (CreateTransformsInfoProfileExplicit) ctpIter.next();
+ final MetaInfo finalDataMetaInfo = transformsProfile.getCreateTransformsInfo().getFinalDataMetaInfo();
if (DataObjectInfo.STRUCTURE_ENVELOPING.equals(structure)) {
dataObjects.add(
- buildEnvelopingDataObject(
- dataObjInfo.getDataObject(),
- finalDataMetaInfo,
- idGen.uniqueId()));
+ buildEnvelopingDataObject(
+ dataObjInfo.getDataObject(),
+ finalDataMetaInfo,
+ idGen.uniqueId()));
} else if (DataObjectInfo.STRUCTURE_DETACHED.equals(structure)) {
dataObjects.add(
- buildDetachedDataObject(
- dataObjInfo.getDataObject(),
- finalDataMetaInfo,
- signatureEnvironment,
- idGen.uniqueId()));
+ buildDetachedDataObject(
+ dataObjInfo.getDataObject(),
+ finalDataMetaInfo,
+ signatureEnvironment,
+ idGen.uniqueId()));
} else {
throw new MOAApplicationException("1103", new Object[] { structure });
}
@@ -406,126 +410,128 @@ public class XMLSignatureCreationInvoker {
}
/**
- * Build a <code>DataObject</code> to be used in an enveloping
- * signature.
- *
- * @param content The <code>Content</code> object containing the data object.
- * <code>ContentOptionalRefType</code>.
- * @param finalDataMetaInfo The meta information corresponding with <code>content</code>.
- * @param referenceID The reference ID to use in the signature for the
- * <code>DataObject</code> created.
+ * Build a <code>DataObject</code> to be used in an enveloping signature.
+ *
+ * @param content The <code>Content</code> object containing the data
+ * object. <code>ContentOptionalRefType</code>.
+ * @param finalDataMetaInfo The meta information corresponding with
+ * <code>content</code>.
+ * @param referenceID The reference ID to use in the signature for the
+ * <code>DataObject</code> created.
* @return The <code>DataObject</code> representing the data contained in
- * <code>dataObjectElem</code>.
- * @throws MOAApplicationException An error occurred during the creation of
- * the <code>DataObject</code>.
- * @throws MOASystemException A system error occurred during the creation of
- * the <code>DataObject</code>.
+ * <code>dataObjectElem</code>.
+ * @throws MOAApplicationException An error occurred during the creation of the
+ * <code>DataObject</code>.
+ * @throws MOASystemException A system error occurred during the creation
+ * of the <code>DataObject</code>.
*/
private DataObject buildEnvelopingDataObject(
- Content content,
- MetaInfo finalDataMetaInfo,
- String referenceID)
- throws MOASystemException, MOAApplicationException {
+ Content content,
+ MetaInfo finalDataMetaInfo,
+ String referenceID)
+ throws MOASystemException, MOAApplicationException {
- DataObjectFactory factory = DataObjectFactory.getInstance();
+ final DataObjectFactory factory = DataObjectFactory.getInstance();
DataObject dataObject;
dataObject =
- factory.createFromContentOptionalRefType(
- content,
- finalDataMetaInfo,
- referenceID,
- false,
- false,
- true,
- false);
+ factory.createFromContentOptionalRefType(
+ content,
+ finalDataMetaInfo,
+ referenceID,
+ false,
+ false,
+ true,
+ false);
return dataObject;
}
/**
* Build a <code>DataObject</code> to be used in a detached signature.
- *
- * @param content The <code>Content</code> object containing an the data.
- * @param finalDataMetaInfo The meta information corresponding with <code>content</code>.
+ *
+ * @param content The <code>Content</code> object containing an the
+ * data.
+ * @param finalDataMetaInfo The meta information corresponding with
+ * <code>content</code>.
* @param signatureEnvironment The signature environment where the signature
- * will be inserted.
- * @param referenceID The reference ID to use in the signature for the
- * <code>DataObject</code> created.
+ * will be inserted.
+ * @param referenceID The reference ID to use in the signature for the
+ * <code>DataObject</code> created.
* @return The <code>DataObject</code> representing the data contained in
- * <code>dataObjectElem</code>.
- * @throws MOAApplicationException An error occurred during the creation of
- * the <code>DataObject</code>.
- * @throws MOASystemException A system error occurred during the creation of
- * the <code>DataObject</code>.
+ * <code>dataObjectElem</code>.
+ * @throws MOAApplicationException An error occurred during the creation of the
+ * <code>DataObject</code>.
+ * @throws MOASystemException A system error occurred during the creation
+ * of the <code>DataObject</code>.
*/
private DataObject buildDetachedDataObject(
- Content content,
- MetaInfo finalDataMetaInfo,
- XMLDataObject signatureEnvironment,
- String referenceID)
- throws MOASystemException, MOAApplicationException {
-
- String reference = content.getReference();
- DataObjectFactory factory = DataObjectFactory.getInstance();
+ Content content,
+ MetaInfo finalDataMetaInfo,
+ XMLDataObject signatureEnvironment,
+ String referenceID)
+ throws MOASystemException, MOAApplicationException {
+
+ final String reference = content.getReference();
+ final DataObjectFactory factory = DataObjectFactory.getInstance();
DataObject dataObject;
if (reference == null) {
throw new MOAApplicationException("1102", null);
} else if ("".equals(reference) || reference.startsWith("#")) {
dataObject =
- factory.createFromSignatureEnvironment(
- signatureEnvironment.getElement(),
- reference,
- referenceID);
+ factory.createFromSignatureEnvironment(
+ signatureEnvironment.getElement(),
+ reference,
+ referenceID);
} else {
dataObject =
- factory.createFromContentOptionalRefType(
- content,
- finalDataMetaInfo,
- referenceID,
- true,
- false,
- true,
- false);
+ factory.createFromContentOptionalRefType(
+ content,
+ finalDataMetaInfo,
+ referenceID,
+ true,
+ false,
+ true,
+ false);
}
return dataObject;
}
/**
* Build the signature parent element.
- *
- * @param signatureEnvironment The signature environment containing the
- * document in which to insert the signature.
- * @param singleSignatureInfo The <code>SingleSignatureInfo</code>
- * containing the signature parent element.
- * @return An <code>XMLDataObject</code> containing the signature parent
- * element or <code>null</code>, if the <code>CreateSignatureInfo</code> is
- * <code>null</code>.
- * @throws MOAApplicationException An error occurred during the creation of
- * the signature parent.
+ *
+ * @param signatureEnvironment The signature environment containing the document
+ * in which to insert the signature.
+ * @param singleSignatureInfo The <code>SingleSignatureInfo</code> containing
+ * the signature parent element.
+ * @return An <code>XMLDataObject</code> containing the signature parent element
+ * or <code>null</code>, if the <code>CreateSignatureInfo</code> is
+ * <code>null</code>.
+ * @throws MOAApplicationException An error occurred during the creation of the
+ * signature parent.
*/
private XMLDataObject buildSignatureParentElement(
- Element signatureEnvironment,
- SingleSignatureInfo singleSignatureInfo)
- throws MOAApplicationException {
+ Element signatureEnvironment,
+ SingleSignatureInfo singleSignatureInfo)
+ throws MOAApplicationException {
- CreateSignatureInfo createInfo =
- singleSignatureInfo.getCreateSignatureInfo();
+ final CreateSignatureInfo createInfo =
+ singleSignatureInfo.getCreateSignatureInfo();
// evaluate the CreateSignatureLocation
if (createInfo != null) {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- CreateSignatureEnvironmentProfileExplicit createProfile =
- ProfileMapper.mapCreateSignatureEnvironmentProfile(
- createInfo.getCreateSignatureEnvironmentProfile(),
- config);
- CreateSignatureLocation location =
- createProfile.getCreateSignatureLocation();
- Element signatureParent =
- InvokerUtils.evaluateSignatureLocation(signatureEnvironment, location);
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final CreateSignatureEnvironmentProfileExplicit createProfile =
+ ProfileMapper.mapCreateSignatureEnvironmentProfile(
+ createInfo.getCreateSignatureEnvironmentProfile(),
+ config);
+ final CreateSignatureLocation location =
+ createProfile.getCreateSignatureLocation();
+ final Element signatureParent =
+ InvokerUtils.evaluateSignatureLocation(signatureEnvironment, location);
return new XMLDataObjectImpl(signatureParent);
} else {
@@ -534,31 +540,31 @@ public class XMLSignatureCreationInvoker {
}
/**
- * Get the supplements contained in the
- * <code>CreateSignatureEnvironmentProfile</code> of the given
+ * Get the supplements contained in the
+ * <code>CreateSignatureEnvironmentProfile</code> of the given
* <code>SingleSignatureInfo</code>.
- *
- * @param singleSigInfo The <code>SingleSignatureInfo</code> from which
- * to extract the supplements.
- * @return A <code>List</code> of <code>XMLDataObjectAssociation</code>s
- * or <code>null</code>, if the <code>singleSigInfo</code> does not contain
- * supplements.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>CreateSignatureEnvironmentProfile</code>.
+ *
+ * @param singleSigInfo The <code>SingleSignatureInfo</code> from which to
+ * extract the supplements.
+ * @return A <code>List</code> of <code>XMLDataObjectAssociation</code>s or
+ * <code>null</code>, if the <code>singleSigInfo</code> does not contain
+ * supplements.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>CreateSignatureEnvironmentProfile</code>.
*/
private List getCreateSignatureEnvironmentProfileSupplements(SingleSignatureInfo singleSigInfo)
- throws MOAApplicationException {
- CreateSignatureInfo sigInfo = singleSigInfo.getCreateSignatureInfo();
+ throws MOAApplicationException {
+ final CreateSignatureInfo sigInfo = singleSigInfo.getCreateSignatureInfo();
if (sigInfo != null) {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- CreateSignatureEnvironmentProfileExplicit profile =
- ProfileMapper.mapCreateSignatureEnvironmentProfile(
- sigInfo.getCreateSignatureEnvironmentProfile(),
- config);
- List supplements = profile.getSupplements();
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final CreateSignatureEnvironmentProfileExplicit profile =
+ ProfileMapper.mapCreateSignatureEnvironmentProfile(
+ sigInfo.getCreateSignatureEnvironmentProfile(),
+ config);
+ final List supplements = profile.getSupplements();
return supplements;
}
@@ -567,18 +573,18 @@ public class XMLSignatureCreationInvoker {
/**
* Build the list of additional signed properties.
- *
+ *
* Based on the generic configuration setting
- * <code>ConfigurationProvider.TEST_SIGNING_TIME_PROPERTY</code>, a
- * constant <code>SigningTime</code> will be added to the properties.
- *
+ * <code>ConfigurationProvider.TEST_SIGNING_TIME_PROPERTY</code>, a constant
+ * <code>SigningTime</code> will be added to the properties.
+ *
* @return The <code>List</code> of additional signed properties.
*/
private List buildAdditionalSignedProperties() {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- List additionalSignedProperties = Collections.EMPTY_LIST;
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final List additionalSignedProperties = Collections.EMPTY_LIST;
return additionalSignedProperties;
}
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 32eab9e..c097b0c 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
@@ -21,18 +21,8 @@
* 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.algorithms.HashAlgorithms;
-import iaik.server.modules.keys.KeyEntryID;
-import iaik.server.modules.keys.KeyModule;
-import iaik.server.modules.keys.KeyModuleFactory;
-import iaik.server.modules.xml.Canonicalization;
-import iaik.server.modules.xmlsign.SignatureStructureTypes;
-import iaik.server.modules.xmlsign.XMLSignatureCreationProfile;
-import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation;
-
import java.math.BigInteger;
import java.security.Principal;
import java.security.cert.X509Certificate;
@@ -70,12 +60,20 @@ 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.util.Constants;
+import iaik.server.modules.algorithms.HashAlgorithms;
+import iaik.server.modules.keys.KeyEntryID;
+import iaik.server.modules.keys.KeyModule;
+import iaik.server.modules.keys.KeyModuleFactory;
+import iaik.server.modules.xml.Canonicalization;
+import iaik.server.modules.xmlsign.SignatureStructureTypes;
+import iaik.server.modules.xmlsign.XMLSignatureCreationProfile;
+import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation;
/**
* A factory to create <code>XMLSignatureCreationProfile</code>s from a
* <code>CreateXMLSignatureRequest</code>, based on the current MOA
* configuration.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -91,24 +89,25 @@ public class XMLSignatureCreationProfileFactory {
HASH_ALGORITHM_MAPPING.put(Constants.SHA512_URI, HashAlgorithms.SHA512);
}
- /** The <code>CreateXMLSignatureRequest</code> for which to create the
- * profile.*/
- private CreateXMLSignatureRequest request;
+ /**
+ * The <code>CreateXMLSignatureRequest</code> for which to create the profile.
+ */
+ private final CreateXMLSignatureRequest request;
/** How many profiles have been created based on the same request. */
private int createProfileCount;
- /** The <code>Set</code> of reserved object IDs.*/
- private Set reserved;
+ /** The <code>Set</code> of reserved object IDs. */
+ private final Set reserved;
/**
* Create a new <code>XMLSignatureCreationProfileFactory</code>.
- *
- * @param request The request for which to create profiles.
- * @param reserved The <code>Set</code> of reserved object IDs. IDs will
- * be added during signature creation.
+ *
+ * @param request The request for which to create profiles.
+ * @param reserved The <code>Set</code> of reserved object IDs. IDs will be
+ * added during signature creation.
*/
public XMLSignatureCreationProfileFactory(
- CreateXMLSignatureRequest request,
- Set reserved) {
+ CreateXMLSignatureRequest request,
+ Set reserved) {
this.request = request;
this.reserved = reserved;
createProfileCount = 1;
@@ -117,98 +116,98 @@ public class XMLSignatureCreationProfileFactory {
/**
* Create a <code>XMLSignatureCreationProfile</code> for the given
* <code>SingleSignatureInfo</code> object..
- *
+ *
* @param singleSignatureInfo The <code>SingleSignatureInfo</code> object
- * containing information about the creation of a signature.
- * @param sigInfoReservedIDs The <code>Set</code> of reserved ID attribue values
- * for the particular <code>singleSignatureInfo</code>.
+ * containing information about the creation of a
+ * signature.
+ * @param sigInfoReservedIDs The <code>Set</code> of reserved ID attribue
+ * values for the particular
+ * <code>singleSignatureInfo</code>.
* @return The <code>XMLSignatureCreationProfile</code> containing additional
- * information for creating an XML signature.
- * @throws MOASystemException A system error occurred during creation of the
- * profile. See message for details
- * @throws MOAApplicationException An application error occurred during
- * creation of the profile. See message for details.
+ * information for creating an XML signature.
+ * @throws MOASystemException A system error occurred during creation of
+ * the profile. See message for details
+ * @throws MOAApplicationException An application error occurred during creation
+ * of the profile. See message for details.
*/
public XMLSignatureCreationProfile createProfile(SingleSignatureInfo singleSignatureInfo,
- Set sigInfoReservedIDs) throws MOASystemException, MOAApplicationException {
+ Set sigInfoReservedIDs) throws MOASystemException, MOAApplicationException {
- HashSet allReservedIDs = new HashSet(reserved);
+ final HashSet allReservedIDs = new HashSet(reserved);
allReservedIDs.addAll(sigInfoReservedIDs);
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
List dataObjectTreatmentList;
Set keySet;
List transformationSupplements;
List createTransformsProfiles;
// get the key group id
- String keyGroupID = request.getKeyIdentifier();
+ final String keyGroupID = request.getKeyIdentifier();
// get digest method on key group level (if configured)
- KeyGroup keygroup = config.getKeyGroup(keyGroupID);
- if(null == keygroup) {
- Logger.error("Could not find key group '" + keyGroupID + "'");
- throw new MOAApplicationException("2231", null);
+ final KeyGroup keygroup = config.getKeyGroup(keyGroupID);
+ if (null == keygroup) {
+ Logger.error("Could not find key group '" + keyGroupID + "'");
+ throw new MOAApplicationException("2231", null);
}
- String configDigestMethodKG = keygroup.getDigestMethodAlgorithm();
+ final String configDigestMethodKG = keygroup.getDigestMethodAlgorithm();
// get default digest method (if configured)
- String configDigestMethod = config.getDigestMethodAlgorithmName();
-
- String xadesVersion = config.getXAdESVersion();
-
+ final String configDigestMethod = config.getDigestMethodAlgorithmName();
+
+ final String xadesVersion = config.getXAdESVersion();
+
String digestMethodXAdES142 = null;
boolean isXAdES142 = false;
// if XAdES Version 1.4.2 is configured
if (xadesVersion != null && xadesVersion.compareTo("1.4.2") == 0) {
- isXAdES142 = true;
- Logger.debug("XAdES version '" + xadesVersion + "' used");
+ isXAdES142 = true;
+ Logger.debug("XAdES version '" + xadesVersion + "' used");
}
-
+
if (isXAdES142) {
- if (configDigestMethodKG != null) {
- // if KG specific digest method is configured
- digestMethodXAdES142 = (String) HASH_ALGORITHM_MAPPING.get(configDigestMethodKG);
- if (digestMethodXAdES142 == null) {
- error(
- "config.17",
- new Object[] { configDigestMethodKG});
- throw new MOASystemException("2900", null);
- }
- Logger.debug("Digest algorithm: " + digestMethodXAdES142 + "(configured in KeyGroup)");
- }
- else {
- // else get default configured digest method
- digestMethodXAdES142 = (String) HASH_ALGORITHM_MAPPING.get(configDigestMethod);
- if (digestMethodXAdES142 == null) {
- error(
- "config.17",
- new Object[] { configDigestMethod});
- throw new MOASystemException("2900", null);
- }
- Logger.debug("Digest algorithm: " + digestMethodXAdES142 + "(default)");
-
- }
+ if (configDigestMethodKG != null) {
+ // if KG specific digest method is configured
+ digestMethodXAdES142 = (String) HASH_ALGORITHM_MAPPING.get(configDigestMethodKG);
+ if (digestMethodXAdES142 == null) {
+ error(
+ "config.17",
+ new Object[] { configDigestMethodKG });
+ throw new MOASystemException("2900", null);
+ }
+ Logger.debug("Digest algorithm: " + digestMethodXAdES142 + "(configured in KeyGroup)");
+ } else {
+ // else get default configured digest method
+ digestMethodXAdES142 = (String) HASH_ALGORITHM_MAPPING.get(configDigestMethod);
+ if (digestMethodXAdES142 == null) {
+ error(
+ "config.17",
+ new Object[] { configDigestMethod });
+ throw new MOASystemException("2900", null);
+ }
+ Logger.debug("Digest algorithm: " + digestMethodXAdES142 + "(default)");
+
+ }
}
-
- XMLSignatureCreationProfileImpl profile =
- new XMLSignatureCreationProfileImpl(createProfileCount, allReservedIDs, digestMethodXAdES142);
-
+ final XMLSignatureCreationProfileImpl profile =
+ new XMLSignatureCreationProfileImpl(createProfileCount, allReservedIDs, digestMethodXAdES142);
+
// build the transformation supplements
createTransformsProfiles =
- getCreateTransformsInfoProfiles(singleSignatureInfo);
+ getCreateTransformsInfoProfiles(singleSignatureInfo);
transformationSupplements =
- buildTransformationSupplements(createTransformsProfiles);
+ buildTransformationSupplements(createTransformsProfiles);
// build and set the data object treatment list
dataObjectTreatmentList =
- buildDataObjectTreatmentList(
- singleSignatureInfo,
- createTransformsProfiles,
- transformationSupplements,
- allReservedIDs,
- digestMethodXAdES142);
+ buildDataObjectTreatmentList(
+ singleSignatureInfo,
+ createTransformsProfiles,
+ transformationSupplements,
+ allReservedIDs,
+ digestMethodXAdES142);
profile.setDataObjectTreatmentList(dataObjectTreatmentList);
// set the key set
@@ -232,27 +231,28 @@ public class XMLSignatureCreationProfileFactory {
// set insertion location
profile.setSignatureInsertionLocation(
- getSignatureInsertionLocationIndex(singleSignatureInfo));
+ getSignatureInsertionLocationIndex(singleSignatureInfo));
// set the canonicalization algorithm
- String canonicalizationURI = config.getCanonicalizationAlgorithmName();
+ final String canonicalizationURI = config.getCanonicalizationAlgorithmName();
if (Canonicalization.ALL_EXCLUSIVE.contains(canonicalizationURI)) {
- ExclusiveCanonicalizationImpl canonicalization = new ExclusiveCanonicalizationImpl(config.getCanonicalizationAlgorithmName(), null);
- profile.setSignedInfoCanonicalization(canonicalization);
-
+ final ExclusiveCanonicalizationImpl canonicalization = new ExclusiveCanonicalizationImpl(config
+ .getCanonicalizationAlgorithmName(), null);
+ profile.setSignedInfoCanonicalization(canonicalization);
+
} else {
- CanonicalizationImpl canonicalization =
- new CanonicalizationImpl(config.getCanonicalizationAlgorithmName());
- profile.setSignedInfoCanonicalization(canonicalization);
-
+ final CanonicalizationImpl canonicalization =
+ new CanonicalizationImpl(config.getCanonicalizationAlgorithmName());
+ profile.setSignedInfoCanonicalization(canonicalization);
+
}
-
+
// set the signed properties
profile.setSignedProperties(Collections.EMPTY_LIST);
// set security layer conformity
profile.setSecurityLayerConform(
- singleSignatureInfo.isSecurityLayerConform());
+ singleSignatureInfo.isSecurityLayerConform());
// update the createProfileCount
createProfileCount++;
@@ -262,31 +262,32 @@ public class XMLSignatureCreationProfileFactory {
/**
* Get the <code>List</code> of all <code>CreateTransformsInfoProfile</code>s
- * contained in all the <code>DataObjectInfo</code>s of the given
+ * contained in all the <code>DataObjectInfo</code>s of the given
* <code>SingleSignatureInfo</code>.
- *
+ *
* @param singleSignatureInfo The <code>SingleSignatureInfo</code> object from
- * which to extract the <code>CreateTransformsInfoProfile</code>s.
- * @return All <code>CreateTransformsInfoProfile</code>s of all
- * <code>DataObjectInfo</code>s of <code>singleSignatureInfo</code>.
+ * which to extract the
+ * <code>CreateTransformsInfoProfile</code>s.
+ * @return All <code>CreateTransformsInfoProfile</code>s of all
+ * <code>DataObjectInfo</code>s of <code>singleSignatureInfo</code>.
* @throws MOAApplicationException An error occurred creating one of the
- * profiles.
+ * profiles.
*/
List getCreateTransformsInfoProfiles(SingleSignatureInfo singleSignatureInfo)
- throws MOAApplicationException {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- List dataObjInfos = singleSignatureInfo.getDataObjectInfos();
- List profiles = new ArrayList();
+ throws MOAApplicationException {
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final List dataObjInfos = singleSignatureInfo.getDataObjectInfos();
+ final List profiles = new ArrayList();
Iterator dtIter;
for (dtIter = dataObjInfos.iterator(); dtIter.hasNext();) {
- DataObjectInfo dataObjInfo = (DataObjectInfo) dtIter.next();
- CreateTransformsInfoProfileExplicit profile =
- ProfileMapper.mapCreateTransformsInfoProfile(
- dataObjInfo.getCreateTransformsInfoProfile(),
- config);
+ final DataObjectInfo dataObjInfo = (DataObjectInfo) dtIter.next();
+ final CreateTransformsInfoProfileExplicit profile =
+ ProfileMapper.mapCreateTransformsInfoProfile(
+ dataObjInfo.getCreateTransformsInfoProfile(),
+ config);
profiles.add(profile);
}
@@ -296,41 +297,42 @@ public class XMLSignatureCreationProfileFactory {
/**
* Build the <code>List</code> of transformation supplements contained in a
* <code>SingleSignatureInfo</code> object.
- *
- * @param createTransformsInfoProfiles The
- * <code>CreateTransformsInfoProfile</code> object from which to extract the
- * transformation supplements.
+ *
+ * @param createTransformsInfoProfiles The
+ * <code>CreateTransformsInfoProfile</code>
+ * object from which to extract the
+ * transformation supplements.
* @return A <code>List</code> of <code>DataObject</code>s containing the
- * transformation supplements.
- * @throws MOASystemException A system error occurred creating one of the
- * transformation supplements.
+ * transformation supplements.
+ * @throws MOASystemException A system error occurred creating one of the
+ * transformation supplements.
* @throws MOAApplicationException An error occurred creating one of the
- * transformation supplements.
+ * transformation supplements.
*/
private List buildTransformationSupplements(List createTransformsInfoProfiles)
- throws MOASystemException, MOAApplicationException {
+ throws MOASystemException, MOAApplicationException {
- List transformationSupplements = new ArrayList();
- DataObjectFactory factory = DataObjectFactory.getInstance();
+ final List transformationSupplements = new ArrayList();
+ final DataObjectFactory factory = DataObjectFactory.getInstance();
Iterator iter;
for (iter = createTransformsInfoProfiles.iterator(); iter.hasNext();) {
- CreateTransformsInfoProfileExplicit profile =
- (CreateTransformsInfoProfileExplicit) iter.next();
- List supplements = profile.getSupplements();
+ final CreateTransformsInfoProfileExplicit profile =
+ (CreateTransformsInfoProfileExplicit) iter.next();
+ final List supplements = profile.getSupplements();
if (supplements != null) {
Iterator supplIter;
for (supplIter = supplements.iterator(); supplIter.hasNext();) {
- XMLDataObjectAssociation supplement =
- (XMLDataObjectAssociation) supplIter.next();
+ final XMLDataObjectAssociation supplement =
+ (XMLDataObjectAssociation) supplIter.next();
transformationSupplements.add(
- factory.createFromXmlDataObjectAssociation(
- supplement,
- false,
- true));
+ factory.createFromXmlDataObjectAssociation(
+ supplement,
+ false,
+ true));
}
}
}
@@ -341,35 +343,40 @@ public class XMLSignatureCreationProfileFactory {
/**
* Build the <code>List</code> of <code>DataObjectTreatment</code>s for the
* given <code>SingleSignatureInfo</code> object..
- *
- * @param singleSignatureInfo The <code>SingleSignatureInfo</code> object
- * from which to exctract the <code>CreateTransformsInfoProfile</code>s
- * containing the data for the <code>DataObjectTreatment</code>s.
- * @param createTransformsInfoProfiles The
- * <code>CreateTransformsInfoProfile</code>s contained in the
- * <code>singleSignatureInfo</code>.
- * @param transformationSupplements Additional parameters for
- * transformations contained in <code>DataObjectTreatment</code>s.
- * @param reservedIDs The <code>Set</code> of reserved object IDs.
+ *
+ * @param singleSignatureInfo The <code>SingleSignatureInfo</code>
+ * object from which to exctract the
+ * <code>CreateTransformsInfoProfile</code>s
+ * containing the data for the
+ * <code>DataObjectTreatment</code>s.
+ * @param createTransformsInfoProfiles The
+ * <code>CreateTransformsInfoProfile</code>s
+ * contained in the
+ * <code>singleSignatureInfo</code>.
+ * @param transformationSupplements Additional parameters for transformations
+ * contained in
+ * <code>DataObjectTreatment</code>s.
+ * @param reservedIDs The <code>Set</code> of reserved object
+ * IDs.
* @return A <code>List</code> of <code>DataObjectTreatment</code> objects.
* @throws MOAApplicationException An error occurred building one of the
- * <code>DataObjectTreatment</code>s.
- * @throws MOASystemException A system error occurred building one of the
- * <code>DataObjectTreatment</code>s.
+ * <code>DataObjectTreatment</code>s.
+ * @throws MOASystemException A system error occurred building one of the
+ * <code>DataObjectTreatment</code>s.
*/
private List buildDataObjectTreatmentList(
- SingleSignatureInfo singleSignatureInfo,
- List createTransformsInfoProfiles,
- List transformationSupplements,
- Set reservedIDs,
- String digestMethodXAdES142)
- throws MOASystemException, MOAApplicationException {
-
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- List treatments = new ArrayList();
- List dataObjInfos = singleSignatureInfo.getDataObjectInfos();
+ SingleSignatureInfo singleSignatureInfo,
+ List createTransformsInfoProfiles,
+ List transformationSupplements,
+ Set reservedIDs,
+ String digestMethodXAdES142)
+ throws MOASystemException, MOAApplicationException {
+
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final List treatments = new ArrayList();
+ final List dataObjInfos = singleSignatureInfo.getDataObjectInfos();
int dataObjectTreatmentCount = 1;
String hashAlgorithmName;
Iterator dtIter;
@@ -377,44 +384,40 @@ public class XMLSignatureCreationProfileFactory {
prIter = createTransformsInfoProfiles.iterator();
for (dtIter = dataObjInfos.iterator(); dtIter.hasNext();) {
- CreateTransformsInfoProfileExplicit profile =
- (CreateTransformsInfoProfileExplicit) prIter.next();
- DataObjectInfo dataObjInfo = (DataObjectInfo) dtIter.next();
- IdGenerator objIdGen =
- new IdGenerator(
- ("signed-data-" + createProfileCount)
- + ("-" + dataObjectTreatmentCount++),
- reservedIDs);
- DataObjectTreatmentImpl treatment = new DataObjectTreatmentImpl(objIdGen);
+ final CreateTransformsInfoProfileExplicit profile =
+ (CreateTransformsInfoProfileExplicit) prIter.next();
+ final DataObjectInfo dataObjInfo = (DataObjectInfo) dtIter.next();
+ final IdGenerator objIdGen =
+ new IdGenerator(
+ "signed-data-" + createProfileCount
+ + "-" + dataObjectTreatmentCount++,
+ reservedIDs);
+ final DataObjectTreatmentImpl treatment = new DataObjectTreatmentImpl(objIdGen);
treatment.setFinalContentType(
- profile.getCreateTransformsInfo().getFinalDataMetaInfo().getMimeType());
+ profile.getCreateTransformsInfo().getFinalDataMetaInfo().getMimeType());
treatment.setTransformationList(buildTransformationList(profile));
treatment.setReferenceInManifest(dataObjInfo.isChildOfManifest());
// if XAdES version is 1.4.2
if (digestMethodXAdES142 != null) {
- // use configured digest algorithm
- hashAlgorithmName = digestMethodXAdES142;
- }
- else {
- // stay as it is
- hashAlgorithmName = (String) HASH_ALGORITHM_MAPPING.get(
- config.getDigestMethodAlgorithmName());
- if (hashAlgorithmName == null) {
- error(
- "config.17",
- new Object[] { config.getDigestMethodAlgorithmName()});
- throw new MOASystemException("2900", null);
- }
+ // use configured digest algorithm
+ hashAlgorithmName = digestMethodXAdES142;
+ } else {
+ // stay as it is
+ hashAlgorithmName = (String) HASH_ALGORITHM_MAPPING.get(
+ config.getDigestMethodAlgorithmName());
+ if (hashAlgorithmName == null) {
+ error(
+ "config.17",
+ new Object[] { config.getDigestMethodAlgorithmName() });
+ throw new MOASystemException("2900", null);
+ }
}
-
-
-
treatment.setHashAlgorithmName(hashAlgorithmName);
treatment.setIncludedInSignature(
- DataObjectInfo.STRUCTURE_ENVELOPING.equals(dataObjInfo.getStructure()));
+ DataObjectInfo.STRUCTURE_ENVELOPING.equals(dataObjInfo.getStructure()));
treatment.setTransformationSupplements(transformationSupplements);
treatments.add(treatment);
@@ -427,48 +430,48 @@ public class XMLSignatureCreationProfileFactory {
/**
* Build the <code>List</code> of transformations contained in a
* <code>CreateTransformsInfoProfile</code> object.
- *
- * @param profile The <code>CreateTransformsInfoProfile</code> object
- * from which to extract the <code>Transform</code>s.
- * @return A <code>List</code> of <code>Transformation</code>s contained in
- * the given <code>CreateTransformsInfoProfile</code>.
+ *
+ * @param profile The <code>CreateTransformsInfoProfile</code> object from which
+ * to extract the <code>Transform</code>s.
+ * @return A <code>List</code> of <code>Transformation</code>s contained in the
+ * given <code>CreateTransformsInfoProfile</code>.
* @throws MOAApplicationException An error occurred building one of the
- * <code>Transformation</code>s.
+ * <code>Transformation</code>s.
*/
private List buildTransformationList(CreateTransformsInfoProfileExplicit profile)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- TransformationFactory factory = TransformationFactory.getInstance();
- List transforms = profile.getCreateTransformsInfo().getTransforms();
+ final TransformationFactory factory = TransformationFactory.getInstance();
+ final List transforms = profile.getCreateTransformsInfo().getTransforms();
return transforms != null
- ? factory.createTransformationList(transforms)
- : Collections.EMPTY_LIST;
+ ? factory.createTransformationList(transforms)
+ : Collections.EMPTY_LIST;
}
/**
* Build the set of <code>KeyEntryID</code>s available to the given
* <code>keyGroupID</code>.
- *
+ *
* @param keyGroupID The keygroup ID for which the available keys should be
- * returned.
- * @return The <code>Set</code> of <code>KeyEntryID</code>s
- * identifying the available keys.
+ * returned.
+ * @return The <code>Set</code> of <code>KeyEntryID</code>s identifying the
+ * available keys.
*/
private Set buildKeySet(String keyGroupID) {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
Set keyGroupEntries;
// get the KeyGroup entries from the configuration
if (context.getClientCertificate() != null) {
- X509Certificate cert = context.getClientCertificate()[0];
- Principal issuer = cert.getIssuerDN();
- BigInteger serialNumber = cert.getSerialNumber();
+ final X509Certificate cert = context.getClientCertificate()[0];
+ final Principal issuer = cert.getIssuerDN();
+ final BigInteger serialNumber = cert.getSerialNumber();
keyGroupEntries =
- config.getKeyGroupEntries(issuer, serialNumber, keyGroupID);
+ config.getKeyGroupEntries(issuer, serialNumber, keyGroupID);
} else {
keyGroupEntries = config.getKeyGroupEntries(null, null, keyGroupID);
}
@@ -479,23 +482,23 @@ public class XMLSignatureCreationProfileFactory {
} else if (keyGroupEntries.size() == 0) {
return Collections.EMPTY_SET;
} else {
- KeyModule module =
- KeyModuleFactory.getInstance(
- new TransactionId(context.getTransactionID()));
- Set keyEntryIDs = module.getPrivateKeyEntryIDs();
- Set keySet = new HashSet();
+ final KeyModule module =
+ KeyModuleFactory.getInstance(
+ new TransactionId(context.getTransactionID()));
+ final Set keyEntryIDs = module.getPrivateKeyEntryIDs();
+ final Set keySet = new HashSet();
Iterator iter;
// filter out the keys that do not exist in the IAIK configuration
// by walking through the key entries and checking if the exist in the
// keyGroupEntries
for (iter = keyEntryIDs.iterator(); iter.hasNext();) {
- KeyEntryID entryID = (KeyEntryID) iter.next();
- KeyGroupEntry entry =
- new KeyGroupEntry(
- entryID.getModuleID(),
- entryID.getCertificateIssuer(),
- entryID.getCertificateSerialNumber());
+ final KeyEntryID entryID = (KeyEntryID) iter.next();
+ final KeyGroupEntry entry =
+ new KeyGroupEntry(
+ entryID.getModuleID(),
+ entryID.getCertificateIssuer(),
+ entryID.getCertificateSerialNumber());
if (keyGroupEntries.contains(entry)) {
keySet.add(entryID);
}
@@ -507,29 +510,31 @@ public class XMLSignatureCreationProfileFactory {
/**
* Get the signature location index where the signature will be inserted into
* the signature parent element.
- *
+ *
* @param singleSignatureInfo The <code>SingleSignatureInfo</code> object
- * containing the <code>CreateSignatureLocation</code>.
+ * containing the
+ * <code>CreateSignatureLocation</code>.
* @return The index at which to insert the signature into the signature
- * environment.
- * @throws MOAApplicationException An error occurred parsing the
- * <code>CreateSignatureEnvironmentProfile</code>.
+ * environment.
+ * @throws MOAApplicationException An error occurred parsing the
+ * <code>CreateSignatureEnvironmentProfile</code>.
*/
- private XMLSignatureInsertionLocation getSignatureInsertionLocationIndex(SingleSignatureInfo singleSignatureInfo)
- throws MOAApplicationException {
+ private XMLSignatureInsertionLocation getSignatureInsertionLocationIndex(
+ SingleSignatureInfo singleSignatureInfo)
+ throws MOAApplicationException {
- CreateSignatureInfo createInfo =
- singleSignatureInfo.getCreateSignatureInfo();
+ final CreateSignatureInfo createInfo =
+ singleSignatureInfo.getCreateSignatureInfo();
if (createInfo != null) {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- CreateSignatureEnvironmentProfileExplicit profile =
- ProfileMapper.mapCreateSignatureEnvironmentProfile(
- createInfo.getCreateSignatureEnvironmentProfile(),
- config);
- int index = profile.getCreateSignatureLocation().getIndex();
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final CreateSignatureEnvironmentProfileExplicit profile =
+ ProfileMapper.mapCreateSignatureEnvironmentProfile(
+ createInfo.getCreateSignatureEnvironmentProfile(),
+ config);
+ final int index = profile.getCreateSignatureLocation().getIndex();
return new XMLSignatureInsertionLocationImpl(index);
} else {
@@ -539,12 +544,12 @@ public class XMLSignatureCreationProfileFactory {
/**
* Utility function to issue an error message to the log.
- *
- * @param messageId The ID of the message to log.
+ *
+ * @param messageId The ID of the message to log.
* @param parameters Additional message parameters.
*/
private static void error(String messageId, Object[] parameters) {
- MessageProvider msg = MessageProvider.getInstance();
+ final MessageProvider msg = MessageProvider.getInstance();
Logger.error(new LogMsg(msg.getMessage(messageId, parameters)));
}
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 827728c..b97cc95 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
@@ -37,8 +37,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.xml.ws.soap.AddressingFeature.Responses;
-
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -49,7 +47,6 @@ import at.gv.egovernment.moa.spss.api.SPSSFactory;
import at.gv.egovernment.moa.spss.api.common.CheckResult;
import at.gv.egovernment.moa.spss.api.common.ExtendedCertificateCheckResult;
import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation;
-import at.gv.egovernment.moa.spss.api.impl.AdESFormResultsImpl;
import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo;
import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResult;
import at.gv.egovernment.moa.spss.api.xmlverify.ReferencesCheckResultInfo;
@@ -78,12 +75,9 @@ import at.gv.egovernment.moaspss.logging.LoggingContextManager;
import at.gv.egovernment.moaspss.util.CollectionUtils;
import at.gv.egovernment.moaspss.util.Constants;
import iaik.server.ConfigurationException;
-import iaik.server.modules.AdESConstants;
-import iaik.server.modules.AdESFormVerificationResult;
import iaik.server.modules.IAIKException;
import iaik.server.modules.IAIKRuntimeException;
import iaik.server.modules.SignatureVerificationProfile;
-import iaik.server.modules.SignatureVerificationResult;
import iaik.server.modules.xml.DataObject;
import iaik.server.modules.xml.XMLDataObject;
import iaik.server.modules.xml.XMLSignature;
@@ -103,666 +97,667 @@ import iaik.xml.crypto.utils.URIException;
/**
* A class providing a DOM based interface to the
* <code>XMLSignatureVerificationModule</code>.
- *
+ *
* This class performs the invocation of the
* <code>iaik.server.modules.xmlverify.XMLSignatureVerificationModule</code>
* from a <code>VerifyXMLSignatureRequest</code> given as a DOM element. The
* result of the invocation is integrated into a
* <code>VerifyXMLSignatureResponse</code> and returned.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XMLSignatureVerificationInvoker {
- /** The single instance of this class. */
- private static XMLSignatureVerificationInvoker instance = null;
-
- private static Set FILTERED_REF_TYPES;
-
- static {
- FILTERED_REF_TYPES = new HashSet();
- FILTERED_REF_TYPES.add(DsigManifest.XML_DSIG_MANIFEST_TYPE);
- FILTERED_REF_TYPES.add(SecurityLayerManifest.SECURITY_LAYER_MANIFEST_TYPE);
- FILTERED_REF_TYPES.add(SecurityLayerManifest.SECURITY_LAYER_MANIFEST_TYPE_OLD);
- FILTERED_REF_TYPES.add(XMLConstants.NAMESPACE_ETSI_STRING + "SignedProperties");
- FILTERED_REF_TYPES.add("http://uri.etsi.org/01903#SignedProperties");
- }
-
- /**
- * Get the single instance of this class.
- *
- * @return The single instance of this class.
- */
- public static synchronized XMLSignatureVerificationInvoker getInstance() {
- if (instance == null) {
- instance = new XMLSignatureVerificationInvoker();
- }
- return instance;
- }
-
- /**
- * Create a new <code>XMLSignatureCreationInvoker</code>.
- *
- * Protected to disallow multiple instances.
- */
- protected XMLSignatureVerificationInvoker() {
- }
-
- /**
- * Process the <code>VerifyXMLSignatureRequest<code> message and invoke the
- * <code>XMLSignatureVerificationModule</code>.
- *
- * @param request
- * A <code>VerifyXMLSignatureRequest<code> API object
- * containing the data for verifying an XML signature.
- * @return A <code>VerifyXMLSignatureResponse</code> containing the answert
- * to the <code>VerifyXMLSignatureRequest</code>. MOA schema
- * definition.
- * @throws MOAException
- * An error occurred during signature verification.
- */
- public VerifyXMLSignatureResponse verifyXMLSignature(VerifyXMLSignatureRequest request) throws MOAException {
-
- TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
- LoggingContext loggingCtx = LoggingContextManager.getInstance().getLoggingContext();
- XMLSignatureVerificationProfileFactory profileFactory = new XMLSignatureVerificationProfileFactory(request);
- VerifyXMLSignatureResponseBuilder responseBuilder = new VerifyXMLSignatureResponseBuilder();
- ExtendedXMLSignatureVerificationResult result = null;
- XMLSignatureVerificationResult plainResult;
- XMLSignatureVerificationProfile profile;
- ReferencesCheckResult signatureManifestCheck;
- DataObjectFactory dataObjFactory;
- XMLDataObject signatureEnvironment;
- Node signatureEnvironmentParent = null;
- Element requestElement = null;
- XMLSignature xmlSignature;
- Date signingTime;
- List supplements;
- List dataObjectList;
-
- // get the supplements
- supplements = getSupplements(request);
-
- // build XMLSignature
- dataObjFactory = DataObjectFactory.getInstance();
- signatureEnvironment = dataObjFactory
- .createSignatureEnvironment(request.getSignatureInfo().getVerifySignatureEnvironment(), supplements);
- xmlSignature = buildXMLSignature(signatureEnvironment, request);
-
- // build the list of DataObjects
- dataObjectList = buildDataObjectList(supplements);
-
- // build profile
- profile = profileFactory.createProfile();
-
- // get the signingTime
- signingTime = request.getDateTime();
-
- // make the signature environment the root of the document, if it is not
- // a
- // separate document anyway; this is done to assure that
- // canonicalization
- // of the signature environment contains the correct namespace
- // declarations
- requestElement = signatureEnvironment.getElement().getOwnerDocument().getDocumentElement();
- if (requestElement != signatureEnvironment.getElement()) {
- signatureEnvironmentParent = signatureEnvironment.getElement().getParentNode();
- requestElement.getOwnerDocument().replaceChild(signatureEnvironment.getElement(), requestElement);
- }
-
- QCSSCDResult qcsscdresult = new QCSSCDResult();
- String tpID = profile.getCertificateValidationProfile().getTrustStoreProfile().getId();
- ConfigurationProvider config = ConfigurationProvider.getInstance();
- TrustProfile tp = config.getTrustProfile(tpID);
-
- // verify the signature
- try {
- XMLSignatureVerificationModule module = XMLSignatureVerificationModuleFactory.getInstance();
-
- module.setLog(new IaikLog(loggingCtx.getNodeID()));
-
- 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;
- } catch (IAIKRuntimeException e) {
- MOAException moaException = IaikExceptionMapper.getInstance().map(e);
- throw moaException;
- }
-
- ExtendedCertificateCheckResult extCheckResult;
- if(result != null) {
- List adesResults = null;//
-
- adesResults = AdESResultUtils.getAdESResult(result.getFormVerificationResult());
-
- if (adesResults != null) {
- Iterator adesIterator = adesResults.iterator();
- while (adesIterator.hasNext()) {
- Logger.info("ADES Formresults: " + adesIterator.next().toString());
- }
- }
-
- responseBuilder.setAdESFormResults(adesResults);
-
- try {
- //Logger.info("Extended Validation Report: " + result.getName());
- Logger.info("Extended Validation Code: " + result.getResultCode().toString());
- Logger.info("Extended Validation Info: " + result.getInfo());
-
- extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode());
- responseBuilder.setExtendedCertificateCheckResult(extCheckResult);
- } catch (ConfigurationException e) {
- Logger.warn("Cannot generate Extendend Result. Check SVA Configuration!", e);
- } catch (NullPointerException e) {
- Logger.info("No extendend validation result available.");
- }
- }
- // QC/SSCD check
- List list = plainResult.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, plainResult.getSigningTime(), tp.isTSLEnabled(), config);
- }
-
- // get signer certificate issuer country code
- String issuerCountryCode = CertificateUtils.getIssuerCountry((X509Certificate) list.get(0));
-
- // swap back in the request as root document
- if (requestElement != signatureEnvironment.getElement()) {
- requestElement.getOwnerDocument().replaceChild(requestElement, signatureEnvironment.getElement());
- signatureEnvironmentParent.appendChild(signatureEnvironment.getElement());
- }
-
- // check the result
- signatureManifestCheck = validateSignatureManifest(request, 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(plainResult,
- trustProfile);
-
- // build the response
- responseBuilder.setResult(plainResult, profile, signatureManifestCheck,
- certificateCheck, qcsscdresult.isQC(), qcsscdresult.isQCSourceTSL(), qcsscdresult.isSSCD(),
- qcsscdresult.isSSCDSourceTSL(), tp.isTSLEnabled(), issuerCountryCode, qcsscdresult.getTslInfos());
- return responseBuilder.getResponse();
- }
-
- /**
- * Checks if the signer certificate matches one of the allowed signer
- * certificates specified in the provided <code>trustProfile</code>.
- *
- * @param result
- * The result produced by the
- * <code>XMLSignatureVerificationModule</code>.
- *
- * @param trustProfile
- * The trust profile the signer certificate is validated against.
- *
- * @return The overal result of the certificate validation for the signer
- * certificate.
- *
- * @throws MOAException
- * if one of the signer certificates specified in the
- * <code>trustProfile</code> cannot be read from the file
- * system.
- */
- private CheckResult validateSignerCertificate(XMLSignatureVerificationResult result,
- TrustProfile trustProfile)
- throws MOAException {
- MessageProvider msg = MessageProvider.getInstance();
-
- int resultCode = result.getCertificateValidationResult().getValidationResultCode().intValue();
-
- if (resultCode == 0 && trustProfile.getSignerCertsUri() != null) {
- X509Certificate signerCertificate = (X509Certificate) result.getCertificateValidationResult()
- .getCertificateChain().get(0);
-
- File signerCertsDir = null;
- try {
- signerCertsDir = new File(new URI(trustProfile.getSignerCertsUri()).getPath());
- } catch (URIException e) {
- throw new MOASystemException("2900", null, e); // Should not
- // happen,
- // already
- // checked at
- // loading the
- // MOA
- // configuration
- }
-
- File[] files = signerCertsDir.listFiles();
- if (files == null)
- resultCode = 1;
- int i;
- for (i = 0; i < files.length; i++) {
- if (!files[i].isDirectory()) {
- FileInputStream currentFIS = null;
- try {
- currentFIS = new FileInputStream(files[i]);
- } catch (FileNotFoundException e) {
- throw new MOASystemException("2900", null, e);
- }
-
- try {
- X509Certificate currentCert = new X509Certificate(currentFIS);
- currentFIS.close();
- if (currentCert.equals(signerCertificate))
- break;
- } catch (Exception e) {
- // Simply ignore file if it cannot be interpreted as
- // certificate
- String logMsg = msg.getMessage("invoker.03",
- new Object[] { trustProfile.getId(), files[i].getName() });
- Logger.warn(logMsg);
- try {
- currentFIS.close();
- } catch (IOException e1) {
- // If clean-up fails, do nothing
- }
- }
- }
- }
- if (i >= files.length) {
- resultCode = 1; // No signer certificate from the trustprofile
- // pool matches the actual signer certificate
- }
- }
-
- SPSSFactory factory = SPSSFactory.getInstance();
- return factory.createCheckResult(resultCode, null);
- }
-
- /**
- * Select the <code>dsig:Signature</code> DOM element within the signature
- * environment.
- *
- * @param signatureEnvironment
- * The signature environment containing the
- * <code>dsig:Signature</code>.
- * @param request
- * The <code>VerifyXMLSignatureRequest</code> containing the
- * signature environment.
- * @return The <code>dsig:Signature</code> element wrapped in a
- * <code>XMLSignature</code> object.
- * @throws MOAApplicationException
- * An error occurred locating the <code>dsig:Signature</code>.
- */
- private XMLSignature buildXMLSignature(XMLDataObject signatureEnvironment, VerifyXMLSignatureRequest request)
- throws MOAApplicationException {
-
- VerifySignatureLocation signatureLocation = request.getSignatureInfo().getVerifySignatureLocation();
- Element signatureParent;
-
- // evaluate the VerifySignatureLocation to get the signature parent
- signatureParent = InvokerUtils.evaluateSignatureLocation(signatureEnvironment.getElement(), signatureLocation);
-
- // check for signatureParent to be a dsig:Signature element
- if (!"Signature".equals(signatureParent.getLocalName())
- || !Constants.DSIG_NS_URI.equals(signatureParent.getNamespaceURI())) {
- throw new MOAApplicationException("2266", null);
- }
-
- return new XMLSignatureImpl(signatureParent);
- }
-
- /**
- * Build the supplemental data objects contained in the
- * <code>VerifyXMLSignatureRequest</code>.
- *
- * @param supplements
- * A <code>List</code> of <code>XMLDataObjectAssociation</code>s
- * containing the supplement data.
- * @return A <code>List</code> of <code>DataObject</code>s representing the
- * supplemental data objects.
- * @throws MOASystemException
- * A system error occurred building one of the data objects.
- * @throws MOAApplicationException
- * An error occurred building one of the data objects.
- */
- private List buildDataObjectList(List supplements) throws MOASystemException, MOAApplicationException {
- List dataObjectList = new ArrayList();
-
- DataObjectFactory factory = DataObjectFactory.getInstance();
- DataObject dataObject;
- Iterator iter;
-
- if (supplements != null) {
- for (iter = supplements.iterator(); iter.hasNext();) {
- XMLDataObjectAssociation supplement = (XMLDataObjectAssociation) iter.next();
- dataObject = factory.createFromXmlDataObjectAssociation(supplement, true, false);
- dataObjectList.add(dataObject);
- }
- }
-
- return dataObjectList;
-
- }
-
- /**
- * Get the supplemental data contained in the
- * <code>VerifyXMLSignatureRequest</code>.
- *
- * @param request
- * The <code>VerifyXMLSignatureRequest</code> containing the
- * supplemental data.
- * @return A <code>List</code> of <code>XMLDataObjectAssociation</code>
- * objects containing the supplemental data.
- * @throws MOAApplicationException
- * An error occurred resolving one of the supplement profiles.
- */
- private List getSupplements(VerifyXMLSignatureRequest request) throws MOAApplicationException {
- TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- List supplementProfiles = request.getSupplementProfiles();
-
- List supplements = new ArrayList();
-
- if (supplementProfiles != null) {
-
- List mappedProfiles = ProfileMapper.mapSupplementProfiles(supplementProfiles, config);
- Iterator iter;
-
- for (iter = mappedProfiles.iterator(); iter.hasNext();) {
- SupplementProfileExplicit profile = (SupplementProfileExplicit) iter.next();
- supplements.add(profile.getSupplementProfile());
- }
-
- }
- return supplements;
- }
-
- /**
- * Perform additional validations of the
- * <code>XMLSignatureVerificationResult</code>.
- *
- * <p>
- * In particular, it is verified that:
- * <ul>
- * <li>Each <code>ReferenceData</code> object contains transformation chain
- * that matches one of the <code>Transforms</code> given in the
- * corresponding <code>SignatureManifestCheckParams/ReferenceInfo</code>
- * </li>
- * <li>The hash values of the <code>TransformParameter</code>s are valid.
- * </li>
- * </ul>
- * </p>
- *
- * @param request
- * The <code>VerifyXMLSignatureRequest</code> containing the
- * signature to verify.
- * @param result
- * The result produced by
- * <code>XMLSignatureVerificationModule</code>.
- * @param profile
- * The profile used for validating the <code>request</code>.
- * @return The result of additional validations of the signature manifest.
- * @throws MOAApplicationException
- * Post-validation of the
- * <code>XMLSignatureVerificaitonResult</code> failed.
- */
- private ReferencesCheckResult validateSignatureManifest(VerifyXMLSignatureRequest request,
- XMLSignatureVerificationResult result, XMLSignatureVerificationProfile profile)
- throws MOAApplicationException {
-
- SPSSFactory factory = SPSSFactory.getInstance();
- MessageProvider msg = MessageProvider.getInstance();
-
- // validate that each ReferenceData object contains transforms specified
- // in the corresponding SignatureManifestCheckParams/ReferenceInfo
- if (request.getSignatureManifestCheckParams() != null) {
- List refInfos = request.getSignatureManifestCheckParams().getReferenceInfos();
- List refDatas = filterReferenceInfos(result.getReferenceDataList());
- List failedReferencesList = new ArrayList();
- Iterator refInfoIter;
- Iterator refDataIter;
-
- if (refInfos.size() != refDatas.size()) {
- return factory.createReferencesCheckResult(1, null);
- }
-
- refInfoIter = refInfos.iterator();
- refDataIter = filterReferenceInfos(result.getReferenceDataList()).iterator();
-
- while (refInfoIter.hasNext()) {
- ReferenceInfo refInfo = (ReferenceInfo) refInfoIter.next();
- ReferenceData refData = (ReferenceData) refDataIter.next();
- List transforms = buildTransformsList(refInfo);
- boolean found = false;
- Iterator trIter;
-
- for (trIter = transforms.iterator(); trIter.hasNext() && !found;) {
- found = trIter.next().equals(refData.getTransformationList());
- }
-
- if (!found) {
- Integer refIndex = new Integer(refData.getReferenceIndex());
- String logMsg = msg.getMessage("invoker.01", new Object[] { refIndex });
-
- failedReferencesList.add(refIndex);
- Logger.debug(new LogMsg(logMsg));
- }
- }
-
- if (!failedReferencesList.isEmpty()) {
- // at least one reference failed - return their indexes and
- // check code 1
- int[] failedReferences = CollectionUtils.toIntArray(failedReferencesList);
- ReferencesCheckResultInfo checkInfo = factory.createReferencesCheckResultInfo(null, failedReferences);
-
- return factory.createReferencesCheckResult(1, checkInfo);
- }
- }
-
- // validate the hashes contained in all the ReferenceInfo objects of the
- // security layer manifest
- if (request.getSignatureManifestCheckParams() != null && result.containsSecurityLayerManifest()) {
- Map hashValues = buildTransformParameterHashValues(request);
- Set transformParameterURIs = buildTransformParameterURIs(profile.getTransformationSupplements());
- List referenceInfoList = result.getSecurityLayerManifest().getReferenceDataList();
- Iterator refIter;
-
- for (refIter = referenceInfoList.iterator(); refIter.hasNext();) {
- iaik.server.modules.xmlverify.ReferenceInfo ref = (iaik.server.modules.xmlverify.ReferenceInfo) refIter
- .next();
- byte[] hash = (byte[]) hashValues.get(ref.getURI());
-
- if (!transformParameterURIs.contains(ref.getURI())
- || (hash != null && !Arrays.equals(hash, ref.getHashValue()))) {
-
- // the transform parameter doesn't exist or the hashs do not
- // match
- // return the index of the failed reference and check code 1
- int[] failedReferences = new int[] { ref.getReferenceIndex() };
- ReferencesCheckResultInfo checkInfo = factory.createReferencesCheckResultInfo(null,
- failedReferences);
- String logMsg = msg.getMessage("invoker.02", new Object[] { new Integer(ref.getReferenceIndex()) });
-
- Logger.debug(new LogMsg(logMsg));
-
- return factory.createReferencesCheckResult(1, checkInfo);
- }
- }
- }
-
- return factory.createReferencesCheckResult(0, null);
- }
-
- /**
- * Get all <code>Transform</code>s contained in all the
- * <code>VerifyTransformsInfoProfile</code>s of the given
- * <code>ReferenceInfo</code>.
- *
- * @param refInfo
- * The <code>ReferenceInfo</code> object containing the
- * transformations.
- * @return A <code>List</code> of <code>List</code>s. Each of the
- * <code>List</code>s contains <code>Transformation</code> objects.
- * @throws MOAApplicationException
- * An error occurred building one of the
- * <code>Transformation</code>s.
- */
- private List buildTransformsList(ReferenceInfo refInfo) throws MOAApplicationException {
-
- TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- List profiles = refInfo.getVerifyTransformsInfoProfiles();
- List mappedProfiles = ProfileMapper.mapVerifyTransformsInfoProfiles(profiles, config);
- List transformsList = new ArrayList();
- TransformationFactory factory = TransformationFactory.getInstance();
- Iterator iter;
-
- for (iter = mappedProfiles.iterator(); iter.hasNext();) {
- VerifyTransformsInfoProfileExplicit profile = (VerifyTransformsInfoProfileExplicit) iter.next();
- List transforms = profile.getTransforms();
-
- if (transforms != null) {
- transformsList.add(factory.createTransformationList(transforms));
- }
- }
-
- return transformsList;
- }
-
- /**
- * Build the <code>Set</code> of all <code>TransformParameter</code> URIs.
- *
- * @param transformParameters
- * The <code>List</code> of <code>TransformParameter</code>s, as
- * provided to the verification.
- * @return The <code>Set</code> of all <code>TransformParameter</code> URIs.
- */
- private Set buildTransformParameterURIs(List transformParameters) {
- Set uris = new HashSet();
- Iterator iter;
-
- for (iter = transformParameters.iterator(); iter.hasNext();) {
- DataObject transformParameter = (DataObject) iter.next();
- uris.add(transformParameter.getURI());
- }
-
- return uris;
- }
-
- /**
- * Build a mapping between <code>TransformParameter</code> URIs (a
- * <code>String</code> and <code>dsig:HashValue</code> (a
- * <code>byte[]</code>).
- *
- * @param request
- * The <code>VerifyXMLSignatureRequest</code>.
- * @return Map The resulting mapping.
- * @throws MOAApplicationException
- * An error occurred accessing one of the profiles.
- */
- private Map buildTransformParameterHashValues(VerifyXMLSignatureRequest request) throws MOAApplicationException {
-
- TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- Map hashValues = new HashMap();
- List refInfos = request.getSignatureManifestCheckParams().getReferenceInfos();
- Iterator refIter;
-
- for (refIter = refInfos.iterator(); refIter.hasNext();) {
- ReferenceInfo refInfo = (ReferenceInfo) refIter.next();
- List profiles = refInfo.getVerifyTransformsInfoProfiles();
- List mappedProfiles = ProfileMapper.mapVerifyTransformsInfoProfiles(profiles, config);
- Iterator prIter;
-
- for (prIter = mappedProfiles.iterator(); prIter.hasNext();) {
- VerifyTransformsInfoProfileExplicit profile = (VerifyTransformsInfoProfileExplicit) prIter.next();
- List trParameters = profile.getTransformParameters();
- Iterator trIter;
-
- for (trIter = trParameters.iterator(); trIter.hasNext();) {
- TransformParameter transformParameter = (TransformParameter) trIter.next();
- String uri = transformParameter.getURI();
-
- if (transformParameter.getTransformParameterType() == TransformParameter.HASH_TRANSFORMPARAMETER) {
- hashValues.put(uri, ((TransformParameterHash) transformParameter).getDigestValue());
- }
-
- }
- }
- }
- return hashValues;
- }
-
- /**
- * Filter the <code>ReferenceInfo</code>s returned by the
- * <code>VerifyXMLSignatureResult</code> for comparison with the
- * <code>ReferenceInfo</code> elements in the request.
- *
- * @param referenceInfos
- * The <code>ReferenceInfo</code>s from the
- * <code>VerifyXMLSignatureResult</code>.
- * @return A <code>List</code> of all <code>ReferenceInfo</code>s whose type
- * is not a XMLDsig manifest, Security Layer manifest, or ETSI
- * signed property.
- */
- private List filterReferenceInfos(List referenceInfos) {
- List filtered = new ArrayList();
- Iterator iter;
-
- for (iter = referenceInfos.iterator(); iter.hasNext();) {
- iaik.server.modules.xmlverify.ReferenceInfo refInfo = (iaik.server.modules.xmlverify.ReferenceInfo) iter
- .next();
- String refType = refInfo.getReferenceType();
-
- if (refType == null || !FILTERED_REF_TYPES.contains(refType)) {
- filtered.add(refInfo);
- }
- }
-
- return filtered;
- }
-
- private List getAdESResult(ExtendedXMLSignatureVerificationResult adesFormVerification) throws ConfigurationException {
- if (adesFormVerification == null) {
- // no form information
- return null;
- }
-
- List adesList = new ArrayList();
-
- /*
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LTA),
- SignatureVerificationProfile.LEVEL_LTA, adesList);
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LT),
- SignatureVerificationProfile.LEVEL_LT, adesList);
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_T),
- SignatureVerificationProfile.LEVEL_T, adesList);
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_B),
- SignatureVerificationProfile.LEVEL_B, adesList);
- */
-
- AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.LONG_TERM_VALIDATION),
- SignatureVerificationProfile.LEVEL_LT, adesList);
- AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.ADES_T_VALIDATION),
- SignatureVerificationProfile.LEVEL_T, adesList);
- AdESResultUtils.checkSubResult(adesFormVerification.getSubResult("basic report"),
- SignatureVerificationProfile.LEVEL_B, adesList);
-
- return adesList;
- }
+ /** The single instance of this class. */
+ private static XMLSignatureVerificationInvoker instance = null;
+
+ private static Set FILTERED_REF_TYPES;
+
+ static {
+ FILTERED_REF_TYPES = new HashSet();
+ FILTERED_REF_TYPES.add(DsigManifest.XML_DSIG_MANIFEST_TYPE);
+ FILTERED_REF_TYPES.add(SecurityLayerManifest.SECURITY_LAYER_MANIFEST_TYPE);
+ FILTERED_REF_TYPES.add(SecurityLayerManifest.SECURITY_LAYER_MANIFEST_TYPE_OLD);
+ FILTERED_REF_TYPES.add(XMLConstants.NAMESPACE_ETSI_STRING + "SignedProperties");
+ FILTERED_REF_TYPES.add("http://uri.etsi.org/01903#SignedProperties");
+ }
+
+ /**
+ * Get the single instance of this class.
+ *
+ * @return The single instance of this class.
+ */
+ public static synchronized XMLSignatureVerificationInvoker getInstance() {
+ if (instance == null) {
+ instance = new XMLSignatureVerificationInvoker();
+ }
+ return instance;
+ }
+
+ /**
+ * Create a new <code>XMLSignatureCreationInvoker</code>.
+ *
+ * Protected to disallow multiple instances.
+ */
+ protected XMLSignatureVerificationInvoker() {
+ }
+
+ /**
+ * Process the <code>VerifyXMLSignatureRequest<code> message and invoke the
+ * <code>XMLSignatureVerificationModule</code>.
+ *
+ * @param request A <code>VerifyXMLSignatureRequest<code> API object
+ * containing the data for verifying an XML signature.
+ * &#64;return A <code>VerifyXMLSignatureResponse</code> containing the answert
+ * to the <code>VerifyXMLSignatureRequest</code>. MOA schema
+ * definition.
+ * @throws MOAException An error occurred during signature verification.
+ */
+ public VerifyXMLSignatureResponse verifyXMLSignature(VerifyXMLSignatureRequest request)
+ throws MOAException {
+
+ final TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ final LoggingContext loggingCtx = LoggingContextManager.getInstance().getLoggingContext();
+ final XMLSignatureVerificationProfileFactory profileFactory = new XMLSignatureVerificationProfileFactory(
+ request);
+ final VerifyXMLSignatureResponseBuilder responseBuilder = new VerifyXMLSignatureResponseBuilder();
+ ExtendedXMLSignatureVerificationResult result = null;
+ XMLSignatureVerificationResult plainResult;
+ XMLSignatureVerificationProfile profile;
+ ReferencesCheckResult signatureManifestCheck;
+ DataObjectFactory dataObjFactory;
+ XMLDataObject signatureEnvironment;
+ Node signatureEnvironmentParent = null;
+ Element requestElement = null;
+ XMLSignature xmlSignature;
+ Date signingTime;
+ List supplements;
+ List dataObjectList;
+
+ // get the supplements
+ supplements = getSupplements(request);
+
+ // build XMLSignature
+ dataObjFactory = DataObjectFactory.getInstance();
+ signatureEnvironment = dataObjFactory
+ .createSignatureEnvironment(request.getSignatureInfo().getVerifySignatureEnvironment(), supplements);
+ xmlSignature = buildXMLSignature(signatureEnvironment, request);
+
+ // build the list of DataObjects
+ dataObjectList = buildDataObjectList(supplements);
+
+ // build profile
+ profile = profileFactory.createProfile();
+
+ // get the signingTime
+ signingTime = request.getDateTime();
+
+ // make the signature environment the root of the document, if it is not
+ // a
+ // separate document anyway; this is done to assure that
+ // canonicalization
+ // of the signature environment contains the correct namespace
+ // declarations
+ requestElement = signatureEnvironment.getElement().getOwnerDocument().getDocumentElement();
+ if (requestElement != signatureEnvironment.getElement()) {
+ signatureEnvironmentParent = signatureEnvironment.getElement().getParentNode();
+ requestElement.getOwnerDocument().replaceChild(signatureEnvironment.getElement(), requestElement);
+ }
+
+ QCSSCDResult qcsscdresult = new QCSSCDResult();
+ final String tpID = profile.getCertificateValidationProfile().getTrustStoreProfile().getId();
+ final ConfigurationProvider config = ConfigurationProvider.getInstance();
+ final TrustProfile tp = config.getTrustProfile(tpID);
+
+ // verify the signature
+ try {
+ final XMLSignatureVerificationModule module = XMLSignatureVerificationModuleFactory.getInstance();
+
+ module.setLog(new IaikLog(loggingCtx.getNodeID()));
+
+ 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 (final IAIKException e) {
+ final MOAException moaException = IaikExceptionMapper.getInstance().map(e);
+ throw moaException;
+ } catch (final IAIKRuntimeException e) {
+ final MOAException moaException = IaikExceptionMapper.getInstance().map(e);
+ throw moaException;
+ }
+
+ ExtendedCertificateCheckResult extCheckResult;
+ if (result != null) {
+ List adesResults = null;//
+
+ adesResults = AdESResultUtils.getAdESResult(result.getFormVerificationResult());
+
+ if (Logger.isDebugEnabled()) {
+ if (adesResults != null) {
+ final Iterator adesIterator = adesResults.iterator();
+ while (adesIterator.hasNext()) {
+ Logger.debug("ADES Formresults: " + adesIterator.next().toString());
+ }
+ }
+ }
+
+ responseBuilder.setAdESFormResults(adesResults);
+
+ try {
+ // Logger.info("Extended Validation Report: " + result.getName());
+ Logger.debug("Extended Validation Code: " + result.getResultCode().toString());
+ Logger.debug("Extended Validation Info: " + result.getInfo());
+
+ extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode());
+ responseBuilder.setExtendedCertificateCheckResult(extCheckResult);
+
+ } catch (final NullPointerException e) {
+ Logger.info("No extendend validation result available.");
+ }
+ }
+ // QC/SSCD check
+ final List list = plainResult.getCertificateValidationResult().getCertificateChain();
+ if (list != null) {
+ final X509Certificate[] chain = new X509Certificate[list.size()];
+
+ final Iterator it = list.iterator();
+ int i = 0;
+ while (it.hasNext()) {
+ chain[i] = (X509Certificate) it.next();
+ i++;
+ }
+
+ qcsscdresult = CertificateUtils.checkQCSSCD(chain, plainResult.getSigningTime(), tp.isTSLEnabled(),
+ config);
+ }
+
+ // get signer certificate issuer country code
+ final String issuerCountryCode = CertificateUtils.getIssuerCountry((X509Certificate) list.get(0));
+
+ // swap back in the request as root document
+ if (requestElement != signatureEnvironment.getElement()) {
+ requestElement.getOwnerDocument().replaceChild(requestElement, signatureEnvironment.getElement());
+ signatureEnvironmentParent.appendChild(signatureEnvironment.getElement());
+ }
+
+ // check the result
+ signatureManifestCheck = validateSignatureManifest(request, plainResult,
+ profile);
+
+ // Check if signer certificate is in trust profile's allowed signer
+ // certificates pool
+ final TrustProfile trustProfile = context.getConfiguration().getTrustProfile(request.getTrustProfileId());
+ final CheckResult certificateCheck = validateSignerCertificate(plainResult,
+ trustProfile);
+
+ // build the response
+ responseBuilder.setResult(plainResult, profile, signatureManifestCheck,
+ certificateCheck, qcsscdresult.isQC(), qcsscdresult.isQCSourceTSL(), qcsscdresult.isSSCD(),
+ qcsscdresult.isSSCDSourceTSL(), tp.isTSLEnabled(), issuerCountryCode, qcsscdresult.getTslInfos(),
+ request.getExtendedValidaiton());
+ return responseBuilder.getResponse();
+ }
+
+ /**
+ * Checks if the signer certificate matches one of the allowed signer
+ * certificates specified in the provided <code>trustProfile</code>.
+ *
+ * @param result The result produced by the
+ * <code>XMLSignatureVerificationModule</code>.
+ *
+ * @param trustProfile The trust profile the signer certificate is validated
+ * against.
+ *
+ * @return The overal result of the certificate validation for the signer
+ * certificate.
+ *
+ * @throws MOAException if one of the signer certificates specified in the
+ * <code>trustProfile</code> cannot be read from the file
+ * system.
+ */
+ private CheckResult validateSignerCertificate(XMLSignatureVerificationResult result,
+ TrustProfile trustProfile)
+ throws MOAException {
+ final MessageProvider msg = MessageProvider.getInstance();
+
+ int resultCode = result.getCertificateValidationResult().getValidationResultCode().intValue();
+
+ if (resultCode == 0 && trustProfile.getSignerCertsUri() != null) {
+ final X509Certificate signerCertificate = (X509Certificate) result.getCertificateValidationResult()
+ .getCertificateChain().get(0);
+
+ File signerCertsDir = null;
+ try {
+ signerCertsDir = new File(new URI(trustProfile.getSignerCertsUri()).getPath());
+ } catch (final URIException e) {
+ throw new MOASystemException("2900", null, e); // Should not
+ // happen,
+ // already
+ // checked at
+ // loading the
+ // MOA
+ // configuration
+ }
+
+ final File[] files = signerCertsDir.listFiles();
+ if (files == null) {
+ resultCode = 1;
+ }
+ int i;
+ for (i = 0; i < files.length; i++) {
+ if (!files[i].isDirectory()) {
+ FileInputStream currentFIS = null;
+ try {
+ currentFIS = new FileInputStream(files[i]);
+ } catch (final FileNotFoundException e) {
+ throw new MOASystemException("2900", null, e);
+ }
+
+ try {
+ final X509Certificate currentCert = new X509Certificate(currentFIS);
+ currentFIS.close();
+ if (currentCert.equals(signerCertificate)) {
+ break;
+ }
+ } catch (final Exception e) {
+ // Simply ignore file if it cannot be interpreted as
+ // certificate
+ final String logMsg = msg.getMessage("invoker.03",
+ new Object[] { trustProfile.getId(), files[i].getName() });
+ Logger.warn(logMsg);
+ try {
+ currentFIS.close();
+ } catch (final IOException e1) {
+ // If clean-up fails, do nothing
+ }
+ }
+ }
+ }
+ if (i >= files.length) {
+ resultCode = 1; // No signer certificate from the trustprofile
+ // pool matches the actual signer certificate
+ }
+ }
+
+ final SPSSFactory factory = SPSSFactory.getInstance();
+ return factory.createCheckResult(resultCode, null);
+ }
+
+ /**
+ * Select the <code>dsig:Signature</code> DOM element within the signature
+ * environment.
+ *
+ * @param signatureEnvironment The signature environment containing the
+ * <code>dsig:Signature</code>.
+ * @param request The <code>VerifyXMLSignatureRequest</code>
+ * containing the signature environment.
+ * @return The <code>dsig:Signature</code> element wrapped in a
+ * <code>XMLSignature</code> object.
+ * @throws MOAApplicationException An error occurred locating the
+ * <code>dsig:Signature</code>.
+ */
+ private XMLSignature buildXMLSignature(XMLDataObject signatureEnvironment,
+ VerifyXMLSignatureRequest request)
+ throws MOAApplicationException {
+
+ final VerifySignatureLocation signatureLocation = request.getSignatureInfo().getVerifySignatureLocation();
+ Element signatureParent;
+
+ // evaluate the VerifySignatureLocation to get the signature parent
+ signatureParent = InvokerUtils.evaluateSignatureLocation(signatureEnvironment.getElement(),
+ signatureLocation);
+
+ // check for signatureParent to be a dsig:Signature element
+ if (!"Signature".equals(signatureParent.getLocalName())
+ || !Constants.DSIG_NS_URI.equals(signatureParent.getNamespaceURI())) {
+ throw new MOAApplicationException("2266", null);
+ }
+
+ return new XMLSignatureImpl(signatureParent);
+ }
+
+ /**
+ * Build the supplemental data objects contained in the
+ * <code>VerifyXMLSignatureRequest</code>.
+ *
+ * @param supplements A <code>List</code> of
+ * <code>XMLDataObjectAssociation</code>s containing the
+ * supplement data.
+ * @return A <code>List</code> of <code>DataObject</code>s representing the
+ * supplemental data objects.
+ * @throws MOASystemException A system error occurred building one of the
+ * data objects.
+ * @throws MOAApplicationException An error occurred building one of the data
+ * objects.
+ */
+ private List buildDataObjectList(List supplements) throws MOASystemException, MOAApplicationException {
+ final List dataObjectList = new ArrayList();
+
+ final DataObjectFactory factory = DataObjectFactory.getInstance();
+ DataObject dataObject;
+ Iterator iter;
+
+ if (supplements != null) {
+ for (iter = supplements.iterator(); iter.hasNext();) {
+ final XMLDataObjectAssociation supplement = (XMLDataObjectAssociation) iter.next();
+ dataObject = factory.createFromXmlDataObjectAssociation(supplement, true, false);
+ dataObjectList.add(dataObject);
+ }
+ }
+
+ return dataObjectList;
+
+ }
+
+ /**
+ * Get the supplemental data contained in the
+ * <code>VerifyXMLSignatureRequest</code>.
+ *
+ * @param request The <code>VerifyXMLSignatureRequest</code> containing the
+ * supplemental data.
+ * @return A <code>List</code> of <code>XMLDataObjectAssociation</code> objects
+ * containing the supplemental data.
+ * @throws MOAApplicationException An error occurred resolving one of the
+ * supplement profiles.
+ */
+ private List getSupplements(VerifyXMLSignatureRequest request) throws MOAApplicationException {
+ final TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final List supplementProfiles = request.getSupplementProfiles();
+
+ final List supplements = new ArrayList();
+
+ if (supplementProfiles != null) {
+
+ final List mappedProfiles = ProfileMapper.mapSupplementProfiles(supplementProfiles, config);
+ Iterator iter;
+
+ for (iter = mappedProfiles.iterator(); iter.hasNext();) {
+ final SupplementProfileExplicit profile = (SupplementProfileExplicit) iter.next();
+ supplements.add(profile.getSupplementProfile());
+ }
+
+ }
+ return supplements;
+ }
+
+ /**
+ * Perform additional validations of the
+ * <code>XMLSignatureVerificationResult</code>.
+ *
+ * <p>
+ * In particular, it is verified that:
+ * <ul>
+ * <li>Each <code>ReferenceData</code> object contains transformation chain that
+ * matches one of the <code>Transforms</code> given in the corresponding
+ * <code>SignatureManifestCheckParams/ReferenceInfo</code></li>
+ * <li>The hash values of the <code>TransformParameter</code>s are valid.</li>
+ * </ul>
+ * </p>
+ *
+ * @param request The <code>VerifyXMLSignatureRequest</code> containing the
+ * signature to verify.
+ * @param result The result produced by
+ * <code>XMLSignatureVerificationModule</code>.
+ * @param profile The profile used for validating the <code>request</code>.
+ * @return The result of additional validations of the signature manifest.
+ * @throws MOAApplicationException Post-validation of the
+ * <code>XMLSignatureVerificaitonResult</code>
+ * failed.
+ */
+ private ReferencesCheckResult validateSignatureManifest(VerifyXMLSignatureRequest request,
+ XMLSignatureVerificationResult result, XMLSignatureVerificationProfile profile)
+ throws MOAApplicationException {
+
+ final SPSSFactory factory = SPSSFactory.getInstance();
+ final MessageProvider msg = MessageProvider.getInstance();
+
+ // validate that each ReferenceData object contains transforms specified
+ // in the corresponding SignatureManifestCheckParams/ReferenceInfo
+ if (request.getSignatureManifestCheckParams() != null) {
+ final List refInfos = request.getSignatureManifestCheckParams().getReferenceInfos();
+ final List refDatas = filterReferenceInfos(result.getReferenceDataList());
+ final List failedReferencesList = new ArrayList();
+ Iterator refInfoIter;
+ Iterator refDataIter;
+
+ if (refInfos.size() != refDatas.size()) {
+ return factory.createReferencesCheckResult(1, null);
+ }
+
+ refInfoIter = refInfos.iterator();
+ refDataIter = filterReferenceInfos(result.getReferenceDataList()).iterator();
+
+ while (refInfoIter.hasNext()) {
+ final ReferenceInfo refInfo = (ReferenceInfo) refInfoIter.next();
+ final ReferenceData refData = (ReferenceData) refDataIter.next();
+ final List transforms = buildTransformsList(refInfo);
+ boolean found = false;
+ Iterator trIter;
+
+ for (trIter = transforms.iterator(); trIter.hasNext() && !found;) {
+ found = trIter.next().equals(refData.getTransformationList());
+ }
+
+ if (!found) {
+ final Integer refIndex = new Integer(refData.getReferenceIndex());
+ final String logMsg = msg.getMessage("invoker.01", new Object[] { refIndex });
+
+ failedReferencesList.add(refIndex);
+ Logger.debug(new LogMsg(logMsg));
+ }
+ }
+
+ if (!failedReferencesList.isEmpty()) {
+ // at least one reference failed - return their indexes and
+ // check code 1
+ final int[] failedReferences = CollectionUtils.toIntArray(failedReferencesList);
+ final ReferencesCheckResultInfo checkInfo = factory.createReferencesCheckResultInfo(null,
+ failedReferences);
+
+ return factory.createReferencesCheckResult(1, checkInfo);
+ }
+ }
+
+ // validate the hashes contained in all the ReferenceInfo objects of the
+ // security layer manifest
+ if (request.getSignatureManifestCheckParams() != null && result.containsSecurityLayerManifest()) {
+ final Map hashValues = buildTransformParameterHashValues(request);
+ final Set transformParameterURIs = buildTransformParameterURIs(profile.getTransformationSupplements());
+ final List referenceInfoList = result.getSecurityLayerManifest().getReferenceDataList();
+ Iterator refIter;
+
+ for (refIter = referenceInfoList.iterator(); refIter.hasNext();) {
+ final iaik.server.modules.xmlverify.ReferenceInfo ref =
+ (iaik.server.modules.xmlverify.ReferenceInfo) refIter
+ .next();
+ final byte[] hash = (byte[]) hashValues.get(ref.getURI());
+
+ if (!transformParameterURIs.contains(ref.getURI())
+ || hash != null && !Arrays.equals(hash, ref.getHashValue())) {
+
+ // the transform parameter doesn't exist or the hashs do not
+ // match
+ // return the index of the failed reference and check code 1
+ final int[] failedReferences = new int[] { ref.getReferenceIndex() };
+ final ReferencesCheckResultInfo checkInfo = factory.createReferencesCheckResultInfo(null,
+ failedReferences);
+ final String logMsg = msg.getMessage("invoker.02", new Object[] { new Integer(ref
+ .getReferenceIndex()) });
+
+ Logger.debug(new LogMsg(logMsg));
+
+ return factory.createReferencesCheckResult(1, checkInfo);
+ }
+ }
+ }
+
+ return factory.createReferencesCheckResult(0, null);
+ }
+
+ /**
+ * Get all <code>Transform</code>s contained in all the
+ * <code>VerifyTransformsInfoProfile</code>s of the given
+ * <code>ReferenceInfo</code>.
+ *
+ * @param refInfo The <code>ReferenceInfo</code> object containing the
+ * transformations.
+ * @return A <code>List</code> of <code>List</code>s. Each of the
+ * <code>List</code>s contains <code>Transformation</code> objects.
+ * @throws MOAApplicationException An error occurred building one of the
+ * <code>Transformation</code>s.
+ */
+ private List buildTransformsList(ReferenceInfo refInfo) throws MOAApplicationException {
+
+ final TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final List profiles = refInfo.getVerifyTransformsInfoProfiles();
+ final List mappedProfiles = ProfileMapper.mapVerifyTransformsInfoProfiles(profiles, config);
+ final List transformsList = new ArrayList();
+ final TransformationFactory factory = TransformationFactory.getInstance();
+ Iterator iter;
+
+ for (iter = mappedProfiles.iterator(); iter.hasNext();) {
+ final VerifyTransformsInfoProfileExplicit profile = (VerifyTransformsInfoProfileExplicit) iter.next();
+ final List transforms = profile.getTransforms();
+
+ if (transforms != null) {
+ transformsList.add(factory.createTransformationList(transforms));
+ }
+ }
+
+ return transformsList;
+ }
+
+ /**
+ * Build the <code>Set</code> of all <code>TransformParameter</code> URIs.
+ *
+ * @param transformParameters The <code>List</code> of
+ * <code>TransformParameter</code>s, as provided to
+ * the verification.
+ * @return The <code>Set</code> of all <code>TransformParameter</code> URIs.
+ */
+ private Set buildTransformParameterURIs(List transformParameters) {
+ final Set uris = new HashSet();
+ Iterator iter;
+
+ for (iter = transformParameters.iterator(); iter.hasNext();) {
+ final DataObject transformParameter = (DataObject) iter.next();
+ uris.add(transformParameter.getURI());
+ }
+
+ return uris;
+ }
+
+ /**
+ * Build a mapping between <code>TransformParameter</code> URIs (a
+ * <code>String</code> and <code>dsig:HashValue</code> (a <code>byte[]</code>).
+ *
+ * @param request The <code>VerifyXMLSignatureRequest</code>.
+ * @return Map The resulting mapping.
+ * @throws MOAApplicationException An error occurred accessing one of the
+ * profiles.
+ */
+ private Map buildTransformParameterHashValues(VerifyXMLSignatureRequest request)
+ throws MOAApplicationException {
+
+ final TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final Map hashValues = new HashMap();
+ final List refInfos = request.getSignatureManifestCheckParams().getReferenceInfos();
+ Iterator refIter;
+
+ for (refIter = refInfos.iterator(); refIter.hasNext();) {
+ final ReferenceInfo refInfo = (ReferenceInfo) refIter.next();
+ final List profiles = refInfo.getVerifyTransformsInfoProfiles();
+ final List mappedProfiles = ProfileMapper.mapVerifyTransformsInfoProfiles(profiles, config);
+ Iterator prIter;
+
+ for (prIter = mappedProfiles.iterator(); prIter.hasNext();) {
+ final VerifyTransformsInfoProfileExplicit profile = (VerifyTransformsInfoProfileExplicit) prIter
+ .next();
+ final List trParameters = profile.getTransformParameters();
+ Iterator trIter;
+
+ for (trIter = trParameters.iterator(); trIter.hasNext();) {
+ final TransformParameter transformParameter = (TransformParameter) trIter.next();
+ final String uri = transformParameter.getURI();
+
+ if (transformParameter.getTransformParameterType() == TransformParameter.HASH_TRANSFORMPARAMETER) {
+ hashValues.put(uri, ((TransformParameterHash) transformParameter).getDigestValue());
+ }
+
+ }
+ }
+ }
+ return hashValues;
+ }
+
+ /**
+ * Filter the <code>ReferenceInfo</code>s returned by the
+ * <code>VerifyXMLSignatureResult</code> for comparison with the
+ * <code>ReferenceInfo</code> elements in the request.
+ *
+ * @param referenceInfos The <code>ReferenceInfo</code>s from the
+ * <code>VerifyXMLSignatureResult</code>.
+ * @return A <code>List</code> of all <code>ReferenceInfo</code>s whose type is
+ * not a XMLDsig manifest, Security Layer manifest, or ETSI signed
+ * property.
+ */
+ private List filterReferenceInfos(List referenceInfos) {
+ final List filtered = new ArrayList();
+ Iterator iter;
+
+ for (iter = referenceInfos.iterator(); iter.hasNext();) {
+ final iaik.server.modules.xmlverify.ReferenceInfo refInfo =
+ (iaik.server.modules.xmlverify.ReferenceInfo) iter
+ .next();
+ final String refType = refInfo.getReferenceType();
+
+ if (refType == null || !FILTERED_REF_TYPES.contains(refType)) {
+ filtered.add(refInfo);
+ }
+ }
+
+ return filtered;
+ }
+
+ private List getAdESResult(ExtendedXMLSignatureVerificationResult adesFormVerification)
+ throws ConfigurationException {
+ if (adesFormVerification == null) {
+ // no form information
+ return null;
+ }
+
+ final List adesList = new ArrayList();
+
+ /*
+ * checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile
+ * .LEVEL_LTA), SignatureVerificationProfile.LEVEL_LTA, adesList);
+ * checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile
+ * .LEVEL_LT), SignatureVerificationProfile.LEVEL_LT, adesList);
+ * checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile
+ * .LEVEL_T), SignatureVerificationProfile.LEVEL_T, adesList);
+ * checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile
+ * .LEVEL_B), SignatureVerificationProfile.LEVEL_B, adesList);
+ */
+
+ AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(
+ iaik.esi.sva.util.Constants.LONG_TERM_VALIDATION),
+ SignatureVerificationProfile.LEVEL_LT, adesList);
+ AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(
+ iaik.esi.sva.util.Constants.ADES_T_VALIDATION),
+ SignatureVerificationProfile.LEVEL_T, adesList);
+ AdESResultUtils.checkSubResult(adesFormVerification.getSubResult("basic report"),
+ SignatureVerificationProfile.LEVEL_B, adesList);
+
+ return adesList;
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java
index 3e4c712..7fcd0e9 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationProfileFactory.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 java.util.ArrayList;
@@ -29,8 +28,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import iaik.server.modules.xmlverify.XMLSignatureVerificationProfile;
-
import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.MOASystemException;
import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo;
@@ -43,26 +40,29 @@ import at.gv.egovernment.moa.spss.server.iaik.pki.PKIProfileImpl;
import at.gv.egovernment.moa.spss.server.iaik.xmlverify.XMLSignatureVerificationProfileImpl;
import at.gv.egovernment.moa.spss.server.transaction.TransactionContext;
import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager;
+import iaik.server.modules.xmlverify.XMLSignatureVerificationProfile;
/**
* A factory to create a <code>XMLSignatureVerificationProfile</code> from a
* <code>VerifyXMLSignatureRequest</code>, based on the current MOA
* configuration.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class XMLSignatureVerificationProfileFactory {
- /** The <code>VerifyXMLSignatureRequest</code> for which to create profile
- * information. */
- private VerifyXMLSignatureRequest request;
+ /**
+ * The <code>VerifyXMLSignatureRequest</code> for which to create profile
+ * information.
+ */
+ private final VerifyXMLSignatureRequest request;
/**
* Create a new <code>XMLSignatureVerificationProfileFactory</code>.
- *
- * @param request The <code>VerifyXMLSignatureRequest</code> to extract
- * profile data from.
+ *
+ * @param request The <code>VerifyXMLSignatureRequest</code> to extract profile
+ * data from.
*/
public XMLSignatureVerificationProfileFactory(VerifyXMLSignatureRequest request) {
this.request = request;
@@ -71,19 +71,19 @@ public class XMLSignatureVerificationProfileFactory {
/**
* Create a <code>XMLSignatureCreationProfile</code> from the
* <code>VerifyXMLSignaturesRequest</code> and the current MOA configuration.
- *
+ *
* @return The <code>XMLSignatureVerificationProfile</code> containing
- * additional information for verifying an XML signature.
- * @throws MOASystemException A system error occurred building the profile.
+ * additional information for verifying an XML signature.
+ * @throws MOASystemException A system error occurred building the profile.
* @throws MOAApplicationException An error occurred building the profile.
*/
public XMLSignatureVerificationProfile createProfile()
- throws MOASystemException, MOAApplicationException {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- XMLSignatureVerificationProfileImpl profile =
- new XMLSignatureVerificationProfileImpl();
+ throws MOASystemException, MOAApplicationException {
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final XMLSignatureVerificationProfileImpl profile =
+ new XMLSignatureVerificationProfileImpl();
SignatureManifestCheckParams checkParams;
String trustProfileID;
@@ -93,49 +93,50 @@ public class XMLSignatureVerificationProfileFactory {
// set the certificate validation profile
trustProfileID = request.getTrustProfileId();
profile.setCertificateValidationProfile(
- new PKIProfileImpl(config, trustProfileID));
+ new PKIProfileImpl(config, trustProfileID));
// set whether hash input data is to be included
profile.setIncludeHashInputData(request.getReturnHashInputData());
// set the security layer manifest check parameters
- // and transformation supplements (if present)
+ // and transformation supplements (if present)
checkParams = request.getSignatureManifestCheckParams();
profile.setCheckSecurityLayerManifest(true);
- profile.setIncludeReferenceInputData(checkParams != null ? checkParams.getReturnReferenceInputData() : false);
+ profile.setIncludeReferenceInputData(checkParams != null ? checkParams.getReturnReferenceInputData()
+ : false);
if (checkParams != null) {
- List transformationSupplements;
- transformationSupplements = buildTransformationSupplements();
- profile.setTransformationSupplements(transformationSupplements);
+ List transformationSupplements;
+ transformationSupplements = buildTransformationSupplements();
+ profile.setTransformationSupplements(transformationSupplements);
} else {
- profile.setTransformationSupplements(Collections.EMPTY_LIST);
+ profile.setTransformationSupplements(Collections.EMPTY_LIST);
}
-
+
profile.setPermitFileURIs(config.getPermitFileURIs());
-
+
return profile;
}
/**
* Build supplemental data objects used in the transformations.
- *
+ *
* @return A <code>List</code> of <code>DataObject</code>s providing
- * supplemental data to the transformations.
- * @throws MOASystemException A system error occurred building one of the
- * transformations.
+ * supplemental data to the transformations.
+ * @throws MOASystemException A system error occurred building one of the
+ * transformations.
* @throws MOAApplicationException An error occurred building one of the
- * transformations.
+ * transformations.
*/
public List buildTransformationSupplements()
- throws MOASystemException, MOAApplicationException {
- TransactionContext context =
- TransactionContextManager.getInstance().getTransactionContext();
- ConfigurationProvider config = context.getConfiguration();
- SignatureManifestCheckParams checkParams =
- request.getSignatureManifestCheckParams();
- List transformsProfiles = new ArrayList();
- List transformationSupplements = new ArrayList();
- DataObjectFactory factory = DataObjectFactory.getInstance();
+ throws MOASystemException, MOAApplicationException {
+ final TransactionContext context =
+ TransactionContextManager.getInstance().getTransactionContext();
+ final ConfigurationProvider config = context.getConfiguration();
+ final SignatureManifestCheckParams checkParams =
+ request.getSignatureManifestCheckParams();
+ final List transformsProfiles = new ArrayList();
+ final List transformationSupplements = new ArrayList();
+ final DataObjectFactory factory = DataObjectFactory.getInstance();
List refInfos = checkParams.getReferenceInfos();
Iterator refIter;
Iterator prIter;
@@ -144,26 +145,26 @@ public class XMLSignatureVerificationProfileFactory {
// build the list of all VerifyTransformsInfoProfiles in all ReferenceInfos
refInfos = checkParams.getReferenceInfos();
for (refIter = refInfos.iterator(); refIter.hasNext();) {
- ReferenceInfo refInfo = (ReferenceInfo) refIter.next();
- List profiles = refInfo.getVerifyTransformsInfoProfiles();
+ final ReferenceInfo refInfo = (ReferenceInfo) refIter.next();
+ final List profiles = refInfo.getVerifyTransformsInfoProfiles();
transformsProfiles.addAll(
- ProfileMapper.mapVerifyTransformsInfoProfiles(profiles, config));
+ ProfileMapper.mapVerifyTransformsInfoProfiles(profiles, config));
}
// build the DataObjects
for (prIter = transformsProfiles.iterator(); prIter.hasNext();) {
- VerifyTransformsInfoProfileExplicit profile =
- (VerifyTransformsInfoProfileExplicit) prIter.next();
- List transformParameters = profile.getTransformParameters();
+ final VerifyTransformsInfoProfileExplicit profile =
+ (VerifyTransformsInfoProfileExplicit) prIter.next();
+ final List transformParameters = profile.getTransformParameters();
for (trIter = transformParameters.iterator(); trIter.hasNext();) {
- TransformParameter trParam = (TransformParameter) trIter.next();
+ final TransformParameter trParam = (TransformParameter) trIter.next();
transformationSupplements.add(
- factory.createFromTransformParameter(trParam));
+ factory.createFromTransformParameter(trParam));
}
}
-
+
return transformationSupplements;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java
index dcb1397..f477588 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java
@@ -21,20 +21,17 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.logging;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import iaik.logging.TransactionId;
/**
- * An implementation of the <code>iaik.logging.Log</code>
- * interface that is based on Jakarta Commons-Logging.
- *
+ * An implementation of the <code>iaik.logging.Log</code> interface that is
+ * based on Jakarta Commons-Logging.
+ *
* @author Fatemeh Philippi
* @version $Id$
*/
@@ -45,11 +42,11 @@ public class IaikLog implements iaik.logging.Log {
private static Logger log = LoggerFactory.getLogger(IAIK_LOG_HIERARCHY);
/** The node ID to use. */
private String nodeId;
-
+
/**
* Create a new <code>IaikLog</code>.
- *
- * @param nodeId The node ID for this <code>Log</code> object.
+ *
+ * @param nodeId The node ID for this <code>Log</code> object.
*/
public IaikLog(String nodeId) {
this.nodeId = nodeId;
@@ -58,6 +55,7 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#isDebugEnabled()
*/
+ @Override
public boolean isDebugEnabled() {
return log.isDebugEnabled();
}
@@ -65,8 +63,9 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#debug(TransactionId, Object, Throwable)
*/
+ @Override
public void debug(TransactionId transactionId, Object message, Throwable t) {
- IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
+ final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
log.debug(msg.toString(), t);
}
@@ -74,6 +73,7 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#isInfoEnabled()
*/
+ @Override
public boolean isInfoEnabled() {
return log.isInfoEnabled();
}
@@ -81,8 +81,9 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#info(TransactionId, Object, Throwable)
*/
+ @Override
public void info(TransactionId transactionId, Object message, Throwable t) {
- IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
+ final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
log.info(msg.toString(), t);
}
@@ -90,6 +91,7 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#isWarnEnabled()
*/
+ @Override
public boolean isWarnEnabled() {
return log.isWarnEnabled();
}
@@ -97,8 +99,9 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#warn(TransactionId, Object, Throwable)
*/
+ @Override
public void warn(TransactionId transactionId, Object message, Throwable t) {
- IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
+ final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
log.warn(msg.toString(), t);
}
@@ -106,6 +109,7 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#isErrorEnabled()
*/
+ @Override
public boolean isErrorEnabled() {
return log.isErrorEnabled();
}
@@ -113,8 +117,9 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#error(TransactionId, Object, Throwable)
*/
+ @Override
public void error(TransactionId transactionId, Object message, Throwable t) {
- IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
+ final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
log.error(msg.toString(), t);
}
@@ -122,6 +127,7 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#isFatalEnabled()
*/
+ @Override
public boolean isFatalEnabled() {
return log.isErrorEnabled();
}
@@ -129,8 +135,9 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#fatal(TransactionId, Object, Throwable)
*/
+ @Override
public void fatal(TransactionId transactionId, Object message, Throwable t) {
- IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
+ final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message);
log.error(msg.toString(), t);
}
@@ -138,6 +145,7 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#setNodeId(String)
*/
+ @Override
public void setNodeId(String nodeId) {
this.nodeId = nodeId;
}
@@ -145,6 +153,7 @@ public class IaikLog implements iaik.logging.Log {
/**
* @see iaik.logging.Log#getNodeId()
*/
+ @Override
public String getNodeId() {
return nodeId;
}
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 cca9117..e0a4ea6 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
@@ -21,43 +21,49 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.logging;
+import at.gv.egovernment.moaspss.logging.LoggingContext;
import at.gv.egovernment.moaspss.logging.LoggingContextManager;
import iaik.logging.Log;
import iaik.logging.LogConfigurationException;
import iaik.logging.LogFactory;
/**
- * An implementation of the <code>iaik.logging.LogFactory</code> abstract
- * class to log messages to the MOA logging subsystem.
- *
+ * An implementation of the <code>iaik.logging.LogFactory</code> abstract class
+ * to log messages to the MOA logging subsystem.
+ *
* @author Patrick Peck
* @version $Id$
*/
public class IaikLogFactory extends LogFactory {
+ @Override
public Log getInstance(Class clazz) throws LogConfigurationException {
- return getInstanceImpl();
+ return getInstanceImpl(clazz.getName());
}
+ @Override
public Log getInstance(String name) throws LogConfigurationException {
- return getInstanceImpl();
+ return getInstanceImpl(name);
}
/**
* Return an instance of <code>iaik.logging.Log</code>.
- *
+ *
* @return The <code>iaik.logging.Log</code> object to log messages to.
- */
- private Log getInstanceImpl() {
- String nodeID =
- LoggingContextManager.getInstance().getLoggingContext().getNodeID();
-
- return new IaikLog(nodeID);
+ */
+ private Log getInstanceImpl(String name) {
+ final LoggingContext context = LoggingContextManager.getInstance().getLoggingContext();
+ if (context != null) {
+ return new IaikLog(context.getNodeID());
+ } else {
+ return new IaikLog("Internal");
+ }
+
}
+ @Override
public void release() {
// we do not hold any resources
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java
index 7e4ff84..d096b2e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java
@@ -21,34 +21,33 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.logging;
import iaik.logging.TransactionId;
/**
* A unified message type to log messages from the IAIK subsystem.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class IaikLogMsg {
-
+
/** The transaction ID of this message. */
- private TransactionId transactionId;
+ private final TransactionId transactionId;
/** The node ID of this message. */
- private String nodeId;
+ private final String nodeId;
/** The message to log. */
- private Object message;
-
+ private final Object message;
+
/**
* Create a <code>IaikLogMsg</code> object.
- *
- * @param transactionId The transaction id of the transaction which
- * generated this log message. May be <code>null</code>.
- * @param nodeId The node id where this message was generated. May be
- * <code>null</code>.
- * @param message The actual message to log. May be <code>null</code>.
+ *
+ * @param transactionId The transaction id of the transaction which generated
+ * this log message. May be <code>null</code>.
+ * @param nodeId The node id where this message was generated. May be
+ * <code>null</code>.
+ * @param message The actual message to log. May be <code>null</code>.
*/
public IaikLogMsg(TransactionId transactionId, String nodeId, Object message) {
this.transactionId = transactionId;
@@ -56,22 +55,22 @@ public class IaikLogMsg {
this.message = message;
}
-
/**
* Convert this log message to a <code>String</code>.
- *
- * @return The <code>String</code> representation of this log message.
+ *
+ * @return The <code>String</code> representation of this log message.
*/
+ @Override
public String toString() {
- StringBuffer msg = new StringBuffer();
-
+ final StringBuffer msg = new StringBuffer();
+
msg.append("TID=");
msg.append(transactionId != null ? transactionId.getLogID() : "<null>");
msg.append(" NID=");
msg.append(nodeId != null ? nodeId : "<null>");
msg.append(" MSG=");
msg.append(message != null ? message.toString() : "<null>");
-
+
return msg.toString();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java
index ba76c0b..75623fd 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java
@@ -21,25 +21,24 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.logging;
/**
* An implementation of the <code>iaik.logging.TransactionId</code> interface.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class TransactionId implements iaik.logging.TransactionId {
-
+
/** The String representation for logging the transaction ID. */
- private String logID;
-
+ private final String logID;
+
/**
* Create a <code>TransactionId</code> object.
- *
+ *
* @param logID The transaction id as it should be presented to the logging
- * subsystem.
+ * subsystem.
*/
public TransactionId(String logID) {
this.logID = logID;
@@ -48,13 +47,15 @@ public class TransactionId implements iaik.logging.TransactionId {
/**
* @see iaik.logging.TransactionId#getLogID()
*/
+ @Override
public String getLogID() {
return logID;
}
-
+
/**
* @see java.lang.Object#toString()
*/
+ @Override
public String toString() {
return getLogID();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/monitoring/ServiceStatusContainer.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/monitoring/ServiceStatusContainer.java
new file mode 100644
index 0000000..9c5bef3
--- /dev/null
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/monitoring/ServiceStatusContainer.java
@@ -0,0 +1,44 @@
+package at.gv.egovernment.moa.spss.server.monitoring;
+
+import java.util.List;
+
+import at.gv.egovernment.moa.sig.tsl.engine.data.TSLProcessingResultElement;
+import at.gv.egovernment.moa.spss.tsl.TSLServiceFactory;
+
+public class ServiceStatusContainer {
+
+ public static final String STATUS_NOT_SET = "no status message";
+ public static final String STATUS_OK = "ok";
+
+ private static boolean TSLStatusValid = false;
+ private static String TSLStatusMsg = STATUS_NOT_SET;
+ private static List<TSLProcessingResultElement> tslDetailStatus = null;
+
+ public static boolean getStatus() {
+ return TSLStatusValid;
+
+ }
+
+ public static String getStatusMsg() {
+ return TSLStatusMsg;
+
+ }
+
+ public static List<TSLProcessingResultElement> getTslDetailStatus() {
+ return tslDetailStatus;
+ }
+
+ public static void setStatus(boolean currentStatus) {
+ TSLStatusValid = currentStatus;
+
+ if (TSLServiceFactory.isInitialized()) {
+ tslDetailStatus = TSLServiceFactory.getTSLServiceClient().getCurrentTSLClientStatus();
+ }
+
+ }
+
+ public static void setStatusMsg(String msg) {
+ TSLStatusMsg = msg;
+ }
+
+}
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 d3a930c..1d85d66 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
@@ -21,13 +21,8 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.service;
-import iaik.pki.revocation.RevocationSourceTypes;
-import iaik.pki.store.revocation.archive.Archive;
-import iaik.pki.store.revocation.archive.ArchiveFactory;
-
import java.util.Date;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
@@ -35,64 +30,67 @@ 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;
+import iaik.pki.revocation.RevocationSourceTypes;
+import iaik.pki.store.revocation.archive.Archive;
+import iaik.pki.store.revocation.archive.ArchiveFactory;
/**
- * A <code>Runnable</code> for periodically cleaning up the revocation archive.
+ * A <code>Runnable</code> for periodically cleaning up the revocation archive.
+ *
* @author Patrick Peck
* @version $Id$
*/
public class RevocationArchiveCleaner implements Runnable {
/** The inverval between two clean-ups of the revocation archive. */
- private long archiveCleanupInterval;
+ private final long archiveCleanupInterval;
/**
* Create a new <code>RevocationArchiveCleaner</code>.
- *
+ *
* @param archiveCleanupInterval The interval between two clean-ups of the
- * revocation archive.
+ * revocation archive.
*/
public RevocationArchiveCleaner(long archiveCleanupInterval) {
this.archiveCleanupInterval = archiveCleanupInterval;
}
/**
- * Run the <code>RevocationArchiveCleaner</code> in its own
- * <code>Thread</code>.
+ * Run the <code>RevocationArchiveCleaner</code> in its own <code>Thread</code>.
*/
+ @Override
public void run() {
while (true) {
try {
- ConfigurationProvider config = ConfigurationProvider.getInstance();
- boolean enableArchiving = config.getEnableRevocationArchiving();
+ final ConfigurationProvider config = ConfigurationProvider.getInstance();
+ final boolean enableArchiving = config.getEnableRevocationArchiving();
- if (enableArchiving)
- {
- Archive archive = ArchiveFactory.getInstance().getArchive();
- long archiveDurationMillis =
- (long) config.getCRLArchiveDuration() * 86400000;
+ if (enableArchiving) {
+ final Archive archive = ArchiveFactory.getInstance().getArchive();
+ final long archiveDurationMillis =
+ (long) config.getCRLArchiveDuration() * 86400000;
// delete old archive data
if (archiveDurationMillis > 0) {
- Date olderThan =
- new Date(System.currentTimeMillis() - archiveDurationMillis);
+ final Date olderThan =
+ new Date(System.currentTimeMillis() - archiveDurationMillis);
archive.deleteOldArchiveEntries(
- RevocationSourceTypes.CRL,
- olderThan,
- new TransactionId("RevocationArchiveCleaner"));
+ RevocationSourceTypes.CRL,
+ olderThan,
+ new TransactionId("RevocationArchiveCleaner"));
}
}
- } catch (Exception e) {
- MessageProvider msg = MessageProvider.getInstance();
+ } catch (final Exception e) {
+ final MessageProvider msg = MessageProvider.getInstance();
Logger.error(new LogMsg(msg.getMessage("init.02", null)), e);
}
- // sleep
+ // sleep
try {
Thread.sleep(archiveCleanupInterval * 1000);
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
// ok to do nothing here
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/DeleteableDataSource.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/DeleteableDataSource.java
index a5ea592..335bf68 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/DeleteableDataSource.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/DeleteableDataSource.java
@@ -3,5 +3,5 @@ package at.gv.egovernment.moa.spss.server.transaction;
import javax.activation.DataSource;
public interface DeleteableDataSource extends DataSource {
- public void delete();
+ void delete();
}
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 4e0d9f6..5746657 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
@@ -21,11 +21,8 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.transaction;
-import iaik.xml.crypto.utils.URI;
-
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
@@ -33,23 +30,23 @@ import java.io.InputStream;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map.Entry;
import java.util.Vector;
import javax.activation.DataSource;
-import java.util.Map.Entry;
-
import org.w3c.dom.Element;
import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moaspss.logging.Logger;
+import iaik.xml.crypto.utils.URI;
/**
* Contains information about the current request.
- *
+ *
* @author Stefan Knirsch
- * @author Patrick Peck
+ * @author Patrick Peck
*/
public class TransactionContext {
@@ -69,18 +66,19 @@ public class TransactionContext {
private HashMap resolvedEntities = null;
/** The configuration to use throughout the request. */
private ConfigurationProvider configuration = null;
-
+
/**
* Create a <code>TransactionContext</code> object.
- *
- * @param transactionID A unique ID for this <code>TransactionContext</code>.
+ *
+ * @param transactionID A unique ID for this
+ * <code>TransactionContext</code>.
* @param clientCertificate The client certificate chain.
- * @param configuration The MOA configuration to use for this transaction.
+ * @param configuration The MOA configuration to use for this transaction.
*/
public TransactionContext(
- String transactionID,
- X509Certificate[] clientCertificate,
- ConfigurationProvider configuration) {
+ String transactionID,
+ X509Certificate[] clientCertificate,
+ ConfigurationProvider configuration) {
this.transactionID = transactionID;
this.clientCertificate = clientCertificate;
@@ -89,18 +87,19 @@ public class TransactionContext {
/**
* Create a <code>TransactionContext</code> object.
- *
- * @param transactionID A unique ID for this <code>TransactionContext</code>.
+ *
+ * @param transactionID A unique ID for this
+ * <code>TransactionContext</code>.
* @param clientCertificate The client certificate chain.
- * @param configuration The MOA configuration to use for this transaction.
- * @param attachments to use for this transaction.
+ * @param configuration The MOA configuration to use for this transaction.
+ * @param attachments to use for this transaction.
*/
public TransactionContext(
- String transactionID,
- X509Certificate[] clientCertificate,
- ConfigurationProvider configuration,
- Element request,
- HashMap attachments) {
+ String transactionID,
+ X509Certificate[] clientCertificate,
+ ConfigurationProvider configuration,
+ Element request,
+ HashMap attachments) {
this.transactionID = transactionID;
this.clientCertificate = clientCertificate;
@@ -108,14 +107,14 @@ public class TransactionContext {
this.request = request;
this.attachments = attachments;
}
-
+
/**
* Returns the client certificate.
- *
+ *
* @return The client certificate chain, if SSL client authentication has been
- * configured in the web server and has been used by the client. The 0th
- * element of the array contains the client certificate. <code>null</code>
- * otherwise.
+ * configured in the web server and has been used by the client. The 0th
+ * element of the array contains the client certificate.
+ * <code>null</code> otherwise.
*/
public X509Certificate[] getClientCertificate() {
return clientCertificate;
@@ -123,7 +122,7 @@ public class TransactionContext {
/**
* Returns the unique transaction ID.
- *
+ *
* @return The transaction ID.
*/
public String getTransactionID() {
@@ -132,7 +131,7 @@ public class TransactionContext {
/**
* Returns the name of the request.
- *
+ *
* @return The name of the request.
*/
public String getRequestName() {
@@ -141,7 +140,7 @@ public class TransactionContext {
/**
* Sets the name of the request.
- *
+ *
* @param requestName The request name to set.
*/
public void setRequestName(String requestName) {
@@ -150,7 +149,7 @@ public class TransactionContext {
/**
* Sets the the request.
- *
+ *
* @param request The request to set.
*/
public void setRequest(Element request) {
@@ -159,7 +158,7 @@ public class TransactionContext {
/**
* Returns the request.
- *
+ *
* @return The request.
*/
public Element getRequest() {
@@ -168,7 +167,7 @@ public class TransactionContext {
/**
* Sets the the response.
- *
+ *
* @param response The response to set.
*/
public void setResponse(Element response) {
@@ -177,23 +176,26 @@ public class TransactionContext {
/**
* Returns the response.
- *
+ *
* @return The response.
*/
public Element getResponse() {
return response;
}
-
+
/**
* Adds an attachment to the transactions list of SOAP attachments.
- *
+ *
* @param referenceId Identification value for the SOAP attachment.
* @param contentType MIME type of the SOAP attachment.
- * @param is Handle to the ManagedMemoryDataSource of the SOAP attachment.
+ * @param is Handle to the ManagedMemoryDataSource of the SOAP
+ * attachment.
*/
public void addAttachment(String referenceId, String contentType, DataSource is) {
- if (this.attachments == null) this.attachments = new HashMap();
- Vector entry = new Vector(2);
+ if (this.attachments == null) {
+ this.attachments = new HashMap();
+ }
+ final Vector entry = new Vector(2);
entry.add(contentType);
entry.add(is);
this.attachments.put(referenceId, entry);
@@ -201,185 +203,198 @@ public class TransactionContext {
/**
* Adds an attachment to the transactions list of SOAP attachments.
- *
+ *
* @param referenceId Identification value for the SOAP attachment.
* @param contentType MIME type of the SOAP attachment.
- * @param is Handle to the InputStream of the SOAP attachment.
- * @param filename Filename of the temporary file the InputStream belongs to
+ * @param is Handle to the InputStream of the SOAP attachment.
+ * @param filename Filename of the temporary file the InputStream belongs to
*/
public void addAttachment(String referenceId, String contentType, InputStream is, String filename) {
- if (this.attachments == null) this.attachments = new HashMap();
- Vector entry = new Vector(3);
+ if (this.attachments == null) {
+ this.attachments = new HashMap();
+ }
+ final Vector entry = new Vector(3);
entry.add(contentType);
entry.add(is);
entry.add(filename);
this.attachments.put(referenceId, entry);
}
-
+
/**
- * Returns the ManagedMemoryDataSource to a specific SOAP attachment identified by referenceId.
- *
+ * Returns the ManagedMemoryDataSource to a specific SOAP attachment identified
+ * by referenceId.
+ *
* @param referenceId Identification value for the SOAP attachment.
*/
public DataSource getAttachment(String referenceId) {
- if (attachments==null) {
+ if (attachments == null) {
return null;
}
- Vector entry = (Vector) attachments.get(referenceId);
- if (entry==null) {
+ final Vector entry = (Vector) attachments.get(referenceId);
+ if (entry == null) {
return null;
}
- Object object = entry.get(1);
+ final Object object = entry.get(1);
if (object instanceof DataSource) {
- return (DataSource) object;
+ return (DataSource) object;
} else {
- return null;
+ return null;
}
}
-
+
/**
* Returns the InputStream to a specific SOAP attachment identified by uri.
- *
+ *
* @param uri Identification value for the SOAP attachment.
*/
public InputStream getAttachmentInputStream(URI uri) throws MOAApplicationException {
- if (attachments==null) {
+ if (attachments == null) {
return null;
}
- String referenceId = uri.getPath();
- Vector entry = (Vector) attachments.get(referenceId);
- if (entry==null) {
+ final String referenceId = uri.getPath();
+ final Vector entry = (Vector) attachments.get(referenceId);
+ if (entry == null) {
return null;
}
InputStream attachmentIs = null;
- Object object = entry.get(1);
-
+ final Object object = entry.get(1);
+
if (object instanceof DataSource) {
- try {
- attachmentIs = (InputStream) ( ((DataSource)object).getInputStream());
- } catch (IOException e) {
- throw new MOAApplicationException("2208", new Object[] { uri }, e);
- }
+ try {
+ attachmentIs = ((DataSource) object).getInputStream();
+ } catch (final IOException e) {
+ throw new MOAApplicationException("2208", new Object[] { uri }, e);
+ }
} else {
- attachmentIs = (InputStream) object;
+ attachmentIs = (InputStream) object;
}
return attachmentIs;
- //If we would return the whole mmds: return (ManagedMemoryDataSource) entry.get(1);
+ // If we would return the whole mmds: return (ManagedMemoryDataSource)
+ // entry.get(1);
}
-
+
/**
- * Returns the content type to a specific SOAP attachment identified by referenceId.
- *
+ * Returns the content type to a specific SOAP attachment identified by
+ * referenceId.
+ *
* @param referenceId Identification value for the SOAP attachment.
*/
public String getAttachmentContentType(String referenceId) {
- Vector entry = (Vector) attachments.get(referenceId);
- if (entry==null) {
+ final Vector entry = (Vector) attachments.get(referenceId);
+ if (entry == null) {
return null;
}
return (String) entry.get(0);
}
-
+
/**
* Delete the temporary attachment files.
*/
-public void cleanAttachmentCache() {
- if (null==attachments) {
+ public void cleanAttachmentCache() {
+ if (null == attachments) {
return;
}
- Iterator iterator = attachments.entrySet().iterator();
+ final Iterator iterator = attachments.entrySet().iterator();
while (iterator.hasNext()) {
- Entry hmEntry = (Entry) iterator.next();
- Vector entry = (Vector)hmEntry.getValue();
- Object object = entry.get(1);
+ final Entry hmEntry = (Entry) iterator.next();
+ final Vector entry = (Vector) hmEntry.getValue();
+ final Object object = entry.get(1);
if (object instanceof DataSource) {
- DataSource mmds = (DataSource)object;
- try {
- if (mmds!=null) {
- InputStream is = mmds.getInputStream();
- if (is!=null) is.close();
-// not available in Axis 1.0 to 1.1
+ final DataSource mmds = (DataSource) object;
+ try {
+ if (mmds != null) {
+ final InputStream is = mmds.getInputStream();
+ if (is != null) {
+ is.close();
+ }
+// not available in Axis 1.0 to 1.1
// File f = mmds.getDiskCacheFile();
// if (f!=null) f.delete();
- if(mmds instanceof DeleteableDataSource) {
- ((DeleteableDataSource)mmds).delete();
- }
- //mmds..delete();
- }
- } catch (IOException e) {
- // ok to do nothing here
- }
+ if (mmds instanceof DeleteableDataSource) {
+ ((DeleteableDataSource) mmds).delete();
+ }
+ // mmds..delete();
+ }
+ } catch (final IOException e) {
+ // ok to do nothing here
+ }
} else if (object instanceof InputStream) {
- InputStream is = (InputStream)object;
- try {
- if (is!=null) is.close();
- String tempFile = (String) entry.get(2);
- if (tempFile!=null){
- File f = new File(tempFile);
- f.delete();
- }
- } catch (IOException e) {
- // ok to do nothing here
- }
+ final InputStream is = (InputStream) object;
+ try {
+ if (is != null) {
+ is.close();
+ }
+ final String tempFile = (String) entry.get(2);
+ if (tempFile != null) {
+ final File f = new File(tempFile);
+ f.delete();
+ }
+ } catch (final IOException e) {
+ // ok to do nothing here
+ }
}
}
}
-
+
/**
* Returns the <code>ConfigurationProvider</code> associated with this
* transaction.
- *
- * @return The ConfigurationProvider associated with this transaction.
+ *
+ * @return The ConfigurationProvider associated with this transaction.
*/
public ConfigurationProvider getConfiguration() {
return configuration;
}
-
+
/**
* Search an uri content in cashed map.
- *
+ *
* @param uri The value to look for.
* @return If found the cached entity, <code>null<code> otherwise.
*/
public Vector FindResolvedEntity(String uri) {
- if (resolvedEntities==null) return null;
- return (Vector) resolvedEntities.get(uri);
+ if (resolvedEntities == null) {
+ return null;
+ }
+ return (Vector) resolvedEntities.get(uri);
}
-
+
/**
* Get a new InputStream of a cached entity.
- *
+ *
* @param uri The value to look for.
* @return A new InputStream of the cached entity.
*/
public InputStream ResolveURI(String uri) {
- InputStream is = null;
- Vector entity = FindResolvedEntity(uri);
- if (entity!=null) {
- byte[] contentBytes = (byte[]) entity.get(0);
- if (contentBytes!=null) {
- is = new ByteArrayInputStream(contentBytes);
- }
- }
- return is;
+ InputStream is = null;
+ final Vector entity = FindResolvedEntity(uri);
+ if (entity != null) {
+ final byte[] contentBytes = (byte[]) entity.get(0);
+ if (contentBytes != null) {
+ is = new ByteArrayInputStream(contentBytes);
+ }
+ }
+ return is;
}
/**
- * Put a read entity (supplement, detached content, data object) on
- * transactions entity cash, to prevent repeated reading on slower channels.
- *
- * @param uri A transaction-wide unique URI used as key of the entity cash
- * table.
+ * Put a read entity (supplement, detached content, data object) on transactions
+ * entity cash, to prevent repeated reading on slower channels.
+ *
+ * @param uri A transaction-wide unique URI used as key of the entity
+ * cash table.
* @param contentBytes The cached content belonging to the uri.
- * @param contentType If known, the MIME-type of the cashed content.
+ * @param contentType If known, the MIME-type of the cashed content.
*/
public void PutResolvedEntity(String uri, byte[] contentBytes, String contentType) {
- Logger.trace(" storing uri content of uri \"" + uri + "\" for future references");
- if (resolvedEntities==null) resolvedEntities = new HashMap();
- Vector entity = new Vector();
- entity.add(contentBytes);
- entity.add(contentType);
- resolvedEntities.put(uri, entity);
+ Logger.trace(" storing uri content of uri \"" + uri + "\" for future references");
+ if (resolvedEntities == null) {
+ resolvedEntities = new HashMap();
+ }
+ final Vector entity = new Vector();
+ entity.add(contentBytes);
+ entity.add(contentType);
+ resolvedEntities.put(uri, entity);
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java
index 8a45ddf..080f801 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContextManager.java
@@ -21,30 +21,29 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.transaction;
/**
* Provides each thread with an instance of <code>TransactionContext</code>.
- *
+ *
* The single instance of the <code>TransactionContextManager</code> should be
* used to access contextual information for each web service transaction, e.g.
* the transaction ID, MOA configuration, client certificate, etc.
- *
+ *
* @author Stefan Knirsch
* @author Patrick Peck
*/
public class TransactionContextManager {
- /** The single instance of <code>TransactionContextManager</code> */
+ /** The single instance of <code>TransactionContextManager</code> */
private static TransactionContextManager instance = null;
-
+
/** Contains a single <code>TransactionContext</code> for each thread. */
private ThreadLocal context = null;
/**
* Get the single instance of <code>TransactionContextManager</code>.
- *
+ *
* @return The single instanc of <code>TransactionContextManager</code>.
*/
public static synchronized TransactionContextManager getInstance() {
@@ -56,7 +55,7 @@ public class TransactionContextManager {
/**
* Creates a new <code>TransactionContextManager</code>.
- *
+ *
* Protected to disallow direct instantiation.
*/
protected TransactionContextManager() {
@@ -65,7 +64,7 @@ public class TransactionContextManager {
/**
* Set the <code>TransactionContext</code> for the current thread.
- *
+ *
* @param txContext The <code>TransactionContext</code> for this thread.
*/
public void setTransactionContext(TransactionContext txContext) {
@@ -74,10 +73,10 @@ public class TransactionContextManager {
/**
* Get the <code>TransactionContext</code> for the current thread.
- *
+ *
* @return The <code>TransactionContext</code> for the current thread or
- * <code>null</code>, if none has been set (or if this method is being invoked
- * outside the bounds of a transaction).
+ * <code>null</code>, if none has been set (or if this method is being
+ * invoked outside the bounds of a transaction).
*/
public TransactionContext getTransactionContext() {
return (TransactionContext) context.get();
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java
index b173308..463785b 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionIDGenerator.java
@@ -21,27 +21,28 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.transaction;
-
/**
* A generator for unique transaction IDs.
- *
- * <p>The transaction IDs are of the form "<base>-<counter>", where:
- * <ul>
+ *
+ * <p>
+ * The transaction IDs are of the form "<base>-<counter>", where:
+ * <ul>
* <li><code>base</code> is initialized with the system time when this class is
* being loaded</li>
* <li><code>counter</code> is incremented sequentially on each call to
* <code>nextID()</code></li>
* </ul>
* </p>
- *
- * <p> Assuming that it is highly unlikely that MOA servers are started at
- * exactly the same time instant, the mechanism provided by this class should
- * guarantee unique transaction IDs across multiple restarts and/or instances of
- * the server.</p>
- *
+ *
+ * <p>
+ * Assuming that it is highly unlikely that MOA servers are started at exactly
+ * the same time instant, the mechanism provided by this class should guarantee
+ * unique transaction IDs across multiple restarts and/or instances of the
+ * server.
+ * </p>
+ *
* @author Patrick Peck
* @author Stefan Knirsch
*/
@@ -63,13 +64,13 @@ public class TransactionIDGenerator {
/**
* Returns the next transaction ID.
- *
+ *
* @return The next transaction ID.
*/
public static synchronized String nextID() {
counter++;
- return (base + "-" + counter);
+ return base + "-" + counter;
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java
index a8d9e1b..a6bc653 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/util/IdGenerator.java
@@ -21,65 +21,66 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.server.util;
import java.util.Set;
/**
* Generate unique ID values for various objects in the response.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class IdGenerator {
/** The base value to append the counter to. */
- private String base;
+ private final String base;
/** The <code>Set</code> of reserved ID values. */
- private Set reserved;
+ private final Set reserved;
/** The sequence number. */
private int count;
-
+
/**
* Create a new <code>IdGenerator</code>.
- *
- * @param base A base value to append the IDs to. The creator of this object
- * should provide a base value, so that appending the counter leads to unique
- * IDs.
- * @param reserved The <code>Set</code> of reserved IDs. A call to
- * <code>uniqueId()</code> will respect the reserved IDs.
+ *
+ * @param base A base value to append the IDs to. The creator of this object
+ * should provide a base value, so that appending the counter
+ * leads to unique IDs.
+ * @param reserved The <code>Set</code> of reserved IDs. A call to
+ * <code>uniqueId()</code> will respect the reserved IDs.
*/
public IdGenerator(String base, Set reserved) {
this.base = base;
this.reserved = reserved;
count = 1;
}
-
+
/**
* Create the next ID value in the sequence.
- *
+ *
* @return The next ID value in the sequence.
*/
protected String nextId() {
return base + "-" + count++;
}
-
+
/**
* Create the next unique ID value which is unique in the reserved ID set.
- *
+ *
* The created ID is added to the set of reserved IDs.
- *
+ *
* @return The next ID value.
*/
public String uniqueId() {
String nextId;
- while (reserved.contains(nextId = nextId()));
-
+ while (reserved.contains(nextId = nextId())) {
+ ;
+ }
+
reserved.add(nextId);
-
+
return nextId;
-
+
}
-
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java
index 223361d..d75240e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java
@@ -5,6 +5,7 @@ import at.gv.egovernment.moa.sig.tsl.api.ITslService;
import at.gv.egovernment.moa.sig.tsl.config.TslConfigurationImpl;
import at.gv.egovernment.moa.sig.tsl.exception.TslException;
import at.gv.egovernment.moa.sig.tsl.pki.chaining.ChainingTrustStoreHandler;
+import at.gv.egovernment.moa.spss.server.monitoring.ServiceStatusContainer;
import at.gv.egovernment.moa.spss.util.MessageProvider;
import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
@@ -12,40 +13,59 @@ import iaik.pki.store.truststore.TrustStoreFactory;
public class TSLServiceFactory {
- private static ITslService tslClient = null;
-
-
- public static void initialize(TslConfigurationImpl config) {
- if (tslClient == null) {
- try {
- tslClient = TslClientFactory.buildTslService(config );
-
- TrustStoreFactory.addTrustStoreHandler(new ChainingTrustStoreHandler());
-
- } catch (TslException e) {
- Logger.fatal(new LogMsg(MessageProvider.getInstance().getMessage("init.05", new Object[]{e.getMessage()})), e);
-
- }
-
- } else {
- Logger.error("TSL-Service client can only be initialized once.");
- throw new IllegalStateException("TSL-Service client can only be initialized once.");
-
- }
-
- }
-
- public static boolean isInitialized() {
- if (tslClient == null)
- return false;
- else
- return true;
-
- }
-
- public static ITslService getTSLServiceClient() {
- return tslClient;
-
- }
-
+ private static ITslService tslClient = null;
+ private static TslConfigurationImpl interalConfig;
+
+ public static void initialize(TslConfigurationImpl config) {
+ if (tslClient == null) {
+ try {
+ interalConfig = config;
+ tslClient = TslClientFactory.buildTslService(interalConfig);
+
+ TrustStoreFactory.addTrustStoreHandler(new ChainingTrustStoreHandler());
+
+ // set global TSL client status
+ ServiceStatusContainer.setStatus(true);
+ ServiceStatusContainer.setStatusMsg(ServiceStatusContainer.STATUS_OK);
+
+ } catch (final TslException e) {
+ Logger.fatal(new LogMsg(MessageProvider.getInstance().getMessage("init.05", new Object[] { e
+ .getMessage() })), e);
+
+ // set global TSL client status
+ ServiceStatusContainer.setStatus(false);
+ ServiceStatusContainer.setStatusMsg(
+ new LogMsg(MessageProvider.getInstance().getMessage("init.05", new Object[] { e.getMessage() }))
+ .toString());
+
+ }
+
+ } else {
+ Logger.error("TSL-Service client can only be initialized once.");
+ throw new IllegalStateException("TSL-Service client can only be initialized once.");
+
+ }
+
+ }
+
+ public static boolean isInitialized() {
+ if (tslClient == null) {
+ return false;
+ } else {
+ return true;
+ }
+
+ }
+
+ public static ITslService getTSLServiceClient() {
+ if (!isInitialized()) {
+ Logger.warn(
+ "TSL client is not initialized but config is available. Starting new initialization process ...");
+ initialize(interalConfig);
+ }
+
+ return tslClient;
+
+ }
+
}
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 300bcae..1a377b6 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
@@ -1,62 +1,49 @@
package at.gv.egovernment.moa.spss.tsl.timer;
-import iaik.asn1.ObjectID;
-import iaik.pki.store.certstore.CertStoreException;
-import iaik.pki.store.certstore.CertStoreParameters;
-import iaik.pki.store.truststore.TrustStoreException;
-import iaik.pki.store.truststore.TrustStoreProfile;
-import iaik.pki.store.utils.StoreUpdater;
-import iaik.server.ConfigurationData;
-import iaik.x509.X509Certificate;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.security.cert.CertificateException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Map;
import java.util.TimerTask;
import at.gv.egovernment.moa.sig.tsl.exception.TslException;
import at.gv.egovernment.moa.sig.tsl.exception.TslUpdateException;
-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;
-import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
-import at.gv.egovernment.moa.spss.server.config.TrustProfile;
-import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator;
-import at.gv.egovernment.moa.spss.server.iaik.pki.store.truststore.TrustStoreProfileImpl;
-import at.gv.egovernment.moa.spss.server.logging.TransactionId;
+import at.gv.egovernment.moa.spss.server.monitoring.ServiceStatusContainer;
import at.gv.egovernment.moa.spss.tsl.TSLServiceFactory;
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.util.StringUtils;
-
public class TSLUpdaterTimerTask extends TimerTask {
-
- @Override
- public void run() {
-
- try {
- Logger.info("Start TSL Update");
- TSLServiceFactory.getTSLServiceClient().updateTSLInformation();
- Logger.info("Finished TSL Update");
-
- } catch (TslUpdateException e) {
- MessageProvider msg = MessageProvider.getInstance();
- Logger.error(new LogMsg(msg.getMessage("tsl.00", null)), e);
-
- } catch (TslException e) {
- MessageProvider msg = MessageProvider.getInstance();
- Logger.error(new LogMsg(msg.getMessage("tsl.00", null)), e);
-
- }
-
- }
+
+ @Override
+ public void run() {
+
+ try {
+ Logger.info("Start TSL Update");
+ TSLServiceFactory.getTSLServiceClient().updateTSLInformation();
+ Logger.info("Finished TSL Update");
+
+ // set global TSL client status
+ ServiceStatusContainer.setStatus(true);
+ ServiceStatusContainer.setStatusMsg(ServiceStatusContainer.STATUS_OK);
+
+ } catch (final TslUpdateException e) {
+ final MessageProvider msg = MessageProvider.getInstance();
+ Logger.error(new LogMsg(msg.getMessage("tsl.00", null)), e);
+
+ // set global TSL client status
+ ServiceStatusContainer.setStatus(false);
+ ServiceStatusContainer.setStatusMsg(
+ new LogMsg(msg.getMessage("tsl.00", null)).toString());
+
+ } catch (final TslException e) {
+ final MessageProvider msg = MessageProvider.getInstance();
+ Logger.error(new LogMsg(msg.getMessage("tsl.00", null)), e);
+
+ // set global TSL client status
+ ServiceStatusContainer.setStatus(false);
+ ServiceStatusContainer.setStatusMsg(
+ new LogMsg(msg.getMessage("tsl.00", null)).toString());
+
+ }
+
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/CertificateReader.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/CertificateReader.java
index 763382a..eeff27c 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/CertificateReader.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/utils/CertificateReader.java
@@ -1,10 +1,4 @@
package at.gv.egovernment.moa.spss.tsl.utils;
-import iaik.pkcs.PKCS7CertList;
-import iaik.pkcs.PKCSParsingException;
-import iaik.security.provider.IAIK;
-import iaik.utils.Util;
-import iaik.x509.X509Certificate;
-import iaik.xml.crypto.EccProviderAdapter;
import java.io.BufferedInputStream;
import java.io.File;
@@ -18,6 +12,13 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import iaik.pkcs.PKCS7CertList;
+import iaik.pkcs.PKCSParsingException;
+import iaik.security.provider.IAIK;
+import iaik.utils.Util;
+import iaik.x509.X509Certificate;
+import iaik.xml.crypto.EccProviderAdapter;
+
// Copyright (C) 2011 IAIK
// http://jce.iaik.at
//
@@ -49,107 +50,106 @@ import java.util.List;
public class CertificateReader {
+ /**
+ * Filter for reading certificate files from a directory. The filter accepts a
+ * file if its name ends with &quot;.cer&quot;, &quot;.der&quot;,
+ * &quot;.crt&quot; or &quot;.pem&quot;.
+ *
+ * @author Harald Bratko
+ * @author Konrad Lanz
+ */
+ static class CertificateFileFilter implements FileFilter {
+
/**
- * Filter for reading certificate files from a directory.
- * The filter accepts a file if its name ends with
- * &quot;.cer&quot;, &quot;.der&quot;, &quot;.crt&quot;
- * or &quot;.pem&quot;.
+ * Accepts a file if it is not a directory and its name ends with
+ * &quot;.cer&quot;, &quot;.der&quot;, &quot;.crt&quot; or &quot;.pem&quot;.
*
- * @author Harald Bratko
- * @author Konrad Lanz
+ * @see java.io.FileFilter#accept(java.io.File)
*/
- static class CertificateFileFilter implements FileFilter {
-
- /**
- * Accepts a file if it is not a directory and its name ends with
- * &quot;.cer&quot;, &quot;.der&quot;, &quot;.crt&quot; or &quot;.pem&quot;.
- *
- * @see java.io.FileFilter#accept(java.io.File)
- */
- public boolean accept(File file) {
- String name = file.getName();
- if (name.endsWith(".der") ||
+ @Override
+ public boolean accept(File file) {
+ final String name = file.getName();
+ if (name.endsWith(".der") ||
name.endsWith(".cer") ||
name.endsWith(".crt") ||
- name.endsWith(".pem"))
- {
- return true;
- } else {
- return false;
- }
+ name.endsWith(".pem")) {
+ return true;
+ } else {
+ return false;
}
}
-
-
-
- /**
- * Reads the certificates from the given directory and
- * returns the certificates as sorted list (end user certificate first).
- * @param directory
- * @return
- * @throws IOException
- * @throws FileNotFoundException
- * @throws CertificateException
- * @throws Exception
- */
- public static X509Certificate[] readCertificatesIntoArray(String directory) throws CertificateException, FileNotFoundException, IOException{
- File file = new File(directory);
- File[] certificateFiles = file.listFiles(new CertificateFileFilter());
- int l = certificateFiles.length;
- X509Certificate[] certs = new X509Certificate[l];
- for (int i=0; i<certificateFiles.length; i++) {
- X509Certificate certificate = new X509Certificate(new FileInputStream(certificateFiles[i]));
- certs[i] = certificate;
- }
- return Util.arrangeCertificateChain(certs, false);
+ }
+
+ /**
+ * Reads the certificates from the given directory and returns the certificates
+ * as sorted list (end user certificate first).
+ *
+ * @param directory
+ * @return
+ * @throws IOException
+ * @throws FileNotFoundException
+ * @throws CertificateException
+ * @throws Exception
+ */
+ public static X509Certificate[] readCertificatesIntoArray(String directory) throws CertificateException,
+ FileNotFoundException, IOException {
+ final File file = new File(directory);
+ final File[] certificateFiles = file.listFiles(new CertificateFileFilter());
+ final int l = certificateFiles.length;
+ final X509Certificate[] certs = new X509Certificate[l];
+ for (int i = 0; i < certificateFiles.length; i++) {
+ final X509Certificate certificate = new X509Certificate(new FileInputStream(certificateFiles[i]));
+ certs[i] = certificate;
}
-
- /**
- * Reads the certificates from the given directory and
- * returns the certificates as sorted list (end user certificate first).
- * @param directory
- * @return
- * @throws IOException
- * @throws FileNotFoundException
- * @throws CertificateException
- * @throws Exception
- */
- public static List<X509Certificate> readCertificates(String directory) throws CertificateException, FileNotFoundException, IOException{
-
- return Arrays.asList(readCertificatesIntoArray(directory));
- }
-
- public static void main(String[] args) {
- try {
-
- IAIK.addAsJDK14Provider();
- //IAIK.addAsProvider();
- //Security.addProvider(new IAIK());
-
- // install ECC provider
- Security.addProvider(EccProviderAdapter.getEccProvider());
-
- String dir = "spec/examples/EU/AT/certs/on-tsl/chain/";
- List l = readCertificates(dir);
- Iterator<X509Certificate> it = l.iterator();
- while (it.hasNext()) {
- System.out.println(((X509Certificate)it.next()).getSubjectDN().getName());
- }
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(1);
+ return Util.arrangeCertificateChain(certs, false);
+ }
+
+ /**
+ * Reads the certificates from the given directory and returns the certificates
+ * as sorted list (end user certificate first).
+ *
+ * @param directory
+ * @return
+ * @throws IOException
+ * @throws FileNotFoundException
+ * @throws CertificateException
+ * @throws Exception
+ */
+ public static List<X509Certificate> readCertificates(String directory) throws CertificateException,
+ FileNotFoundException, IOException {
+
+ return Arrays.asList(readCertificatesIntoArray(directory));
+ }
+
+ public static void main(String[] args) {
+ try {
+
+ IAIK.addAsJDK14Provider();
+ // IAIK.addAsProvider();
+ // Security.addProvider(new IAIK());
+
+ // install ECC provider
+ Security.addProvider(EccProviderAdapter.getEccProvider());
+
+ final String dir = "spec/examples/EU/AT/certs/on-tsl/chain/";
+ final List l = readCertificates(dir);
+ final Iterator<X509Certificate> it = l.iterator();
+ while (it.hasNext()) {
+ System.out.println(it.next().getSubjectDN().getName());
}
-
+ } catch (final Exception e) {
+ e.printStackTrace();
+ System.exit(1);
}
- public static X509Certificate[] p7read(File path) throws PKCSParsingException, FileNotFoundException, IOException {
- PKCS7CertList p7certList = new PKCS7CertList(
- new BufferedInputStream(
- new FileInputStream(
- path
- )
- )
- );
- return p7certList.getCertificateList();
- }
- } \ No newline at end of file
+ }
+
+ public static X509Certificate[] p7read(File path) throws PKCSParsingException, FileNotFoundException,
+ IOException {
+ final PKCS7CertList p7certList = new PKCS7CertList(
+ new BufferedInputStream(
+ new FileInputStream(
+ path)));
+ return p7certList.getCertificateList();
+ }
+} \ No newline at end of file
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/AdESResultUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/AdESResultUtils.java
index 4903391..23570cc 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/AdESResultUtils.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/AdESResultUtils.java
@@ -11,185 +11,238 @@ import at.gv.egovernment.moaspss.logging.Logger;
import iaik.esi.sva.validation.ValidationReport;
import iaik.server.ConfigurationException;
import iaik.server.modules.AdESVerificationResult;
-import iaik.server.modules.ResultCode;
-import iaik.server.modules.ResultCodeInvalid;
-import iaik.server.modules.ResultCodeValid;
import iaik.server.modules.SignatureVerificationProfile;
import iaik.server.modules.SignatureVerificationResult;
+import iaik.server.modules.resultcodes.ResultCode;
+import iaik.server.modules.resultcodes.ResultCodeError;
+import iaik.server.modules.resultcodes.ResultCodeInvalid;
+import iaik.server.modules.resultcodes.ResultCodeSkipped;
+import iaik.server.modules.resultcodes.ResultCodeValid;
public class AdESResultUtils {
- public static Integer getResultCode(Integer adesCode) {
- return adesCode;
- }
-
- public static ExtendedCertificateCheckResult getExtendedResult(iaik.server.modules.ResultCode resultCode) {
- ExtendedCertificateCheckResult check = null;
-
- int majorCode = -1;
- String majorInfo = "";
- int minorCode = -1;
- String minorInfo = "";
-
- Logger.debug("Generating extendend validation result: " + resultCode.toString());
-
- if (resultCode instanceof ResultCodeValid) {
- majorCode = SignatureVerificationResult.VALID;
- majorInfo = "VALID";
- } else if (resultCode instanceof ResultCodeInvalid) {
- majorCode = SignatureVerificationResult.INVALID;
- majorInfo = "INVALID";
- } else {
- majorCode = SignatureVerificationResult.INDETERMINATE;
- majorInfo = "INDETERMINATE";
- }
-
- if (resultCode.getCode() != null) {
- minorCode = resultCode.getCode();
- if (resultCode.getCode().equals(ResultCode.CODE_CHAIN_CONSTRAINTS_FAILURE)) {
- minorInfo = "CHAIN_CONSTRAINTS_FAILURE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_CRYPTO_CONSTRAINTS_FAILURE)) {
- minorInfo = "CRYPTO_CONSTRAINTS_FAILURE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_CRYPTO_CONSTRAINTS_FAILURE_NO_POE)) {
- minorInfo = "CRYPTO_CONSTRAINTS_FAILURE_NO_POE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_EXPIRED)) {
- minorInfo = "EXPIRED";
- } else if (resultCode.getCode().equals(ResultCode.CODE_FORMAT_FAILURE)) {
- minorInfo = "FORMAT_FAILURE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_GENERIC)) {
- minorInfo = "GENERIC";
- } else if (resultCode.getCode().equals(ResultCode.CODE_HASH_FAILURE)) {
- minorInfo = "HASH_FAILURE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_NO_CERTIFICATE_CHAIN_FOUND)) {
- minorInfo = "NO_CERTIFICATE_CHAIN_FOUND";
- } else if (resultCode.getCode().equals(ResultCode.CODE_NO_POE)) {
- minorInfo = "NO_POE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_NO_POLICY)) {
- minorInfo = "NO_POLICY";
- } else if (resultCode.getCode().equals(ResultCode.CODE_NOT_YET_VALID)) {
- minorInfo = "NOT_YET_VALID";
- } else if (resultCode.getCode().equals(ResultCode.CODE_OUT_OF_BOUNDS_NO_POE)) {
- minorInfo = "OUT_OF_BOUNDS_NO_POE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_POLICY_PROCESSING_ERROR)) {
- minorInfo = "POLICY_PROCESSING_ERROR";
- } else if (resultCode.getCode().equals(ResultCode.CODE_REVOKED)) {
- minorInfo = "REVOKED";
- } else if (resultCode.getCode().equals(ResultCode.CODE_REVOKED_CA_NO_POE)) {
- minorInfo = "REVOKED_CA_NO_POE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_REVOKED_NO_POE)) {
- minorInfo = "REVOKED_NO_POE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_SIG_CONSTRAINTS_FAILURE)) {
- minorInfo = "SIG_CONSTRAINTS_FAILURE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_SIG_CRYPTO_FAILURE)) {
- minorInfo = "SIG_CRYPTO_FAILURE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_SIGNED_DATA_NOT_FOUND)) {
- minorInfo = "SIGNED_DATA_NOT_FOUND";
- } else if (resultCode.getCode().equals(ResultCode.CODE_TIMESTAMP_ORDER_FAILURE)) {
- minorInfo = "TIMESTAMP_ORDER_FAILURE";
- } else if (resultCode.getCode().equals(ResultCode.CODE_TRY_LATER)) {
- minorInfo = "TRY_LATER";
- } else if (resultCode.getCode().equals(ResultCode.CODE_UNKNOWN_COMMITMENT_TYPE)) {
- minorInfo = "UNKNOWN_COMMITMENT_TYPE";
- } else if (resultCode.getCode().equals(ResultCode.SUCCESS)) {
- minorInfo = "SUCCESS";
- }
- }
-
- check = new ExtendedCertificateCheckResultImpl(majorCode, majorInfo, minorCode,
- minorInfo);
-
- return check;
-
- }
-
- public static List getAdESResult(iaik.server.modules.AdESFormVerificationResult adesFormVerification) {
- if (adesFormVerification == null) {
- // no form information
- return null;
- }
-
- List adesList = new ArrayList();
-
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LTA),
- SignatureVerificationProfile.LEVEL_LTA, adesList);
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LT),
- SignatureVerificationProfile.LEVEL_LT, adesList);
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_T),
- SignatureVerificationProfile.LEVEL_T, adesList);
- checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_B),
- SignatureVerificationProfile.LEVEL_B, adesList);
-
- return adesList;
- }
-
- public static void buildResult(ValidationReport report, List adesList) {
-
- if (report == null) {
- return;
- }
-
- AdESFormResultsImpl adESFormResultsImpl = new AdESFormResultsImpl();
- adESFormResultsImpl.setCode(report.getStatus().ordinal());
- adESFormResultsImpl.setInfo(report.getLongText());
- adESFormResultsImpl.setName(report.getValidationName());
-
- adesList.add(adESFormResultsImpl);
-
- if (report.getSubValidationReports() != null && !report.getSubValidationReports().isEmpty()) {
- Iterator<ValidationReport> reportIt = report.getSubValidationReports().iterator();
- while (reportIt.hasNext()) {
- buildResult(reportIt.next(), adesList);
- }
- }
-
- }
-
- public static void checkSubResult(AdESVerificationResult subResult, String level, List adesList) {
- if (subResult != null) {
- Logger.info("Checking Level: " + level);
- try {
-
- AdESFormResultsImpl adESFormResultsImpl = new AdESFormResultsImpl();
- adESFormResultsImpl.setCode(subResult.getResultCode());
- Logger.info("RESULT: " + String.valueOf(subResult.getResultCode()));
- adESFormResultsImpl.setInfo(subResult.getInfo());
- adESFormResultsImpl.setName(level);
-
- adesList.add(adESFormResultsImpl);
- } catch (NullPointerException e) {
- Logger.warn("Catching NullPointer Exception, of invalid Form Results", e);
- }
- } else {
- Logger.info("Subresult Level: " + level + " not available");
- }
- }
-
- public static void checkSubResult(SignatureVerificationResult subResult, String level, List adesList)
- throws ConfigurationException {
- if (subResult != null) {
- Logger.info("Checking Level: " + level);
- try {
-
- AdESFormResultsImpl adESFormResultsImpl = new AdESFormResultsImpl();
- ResultCode resultCode = subResult.getResultCode();
- if (resultCode instanceof ResultCodeValid) {
- adESFormResultsImpl.setCode(SignatureVerificationResult.VALID);// .getResultCode().getCode()));
- } else if (resultCode instanceof ResultCodeInvalid) {
- adESFormResultsImpl.setCode(SignatureVerificationResult.INVALID);
- } else {
- adESFormResultsImpl.setCode(SignatureVerificationResult.INDETERMINATE);
- }
- Logger.info("RESULT: " + resultCode.toString());
- adESFormResultsImpl.setInfo(subResult.getInfo());
- adESFormResultsImpl.setName(level);
-
- adesList.add(adESFormResultsImpl);
- } catch (NullPointerException e) {
- Logger.warn("Catching NullPointer Exception, of invalid? Form Results", e);
- }
- } else {
- Logger.info("Subresult Level: " + level + " not available");
- }
- }
+ private static final int MAJORRESULTCODESKIPPED = new Integer(3);
+ private static final int MAJORRESULTCODEERROR = new Integer(4);
+
+ public static Integer getResultCode(Integer adesCode) {
+ return adesCode;
+ }
+
+ public static ExtendedCertificateCheckResult getExtendedResult(
+ iaik.server.modules.resultcodes.ResultCode resultCode) {
+ ExtendedCertificateCheckResult check = null;
+
+ int majorCode = -1;
+ String majorInfo = "";
+ int minorCode = -1;
+ String minorInfo = "";
+
+ Logger.debug("Generating extendend validation result: " + resultCode.toString());
+
+ if (resultCode instanceof ResultCodeValid) {
+ majorCode = SignatureVerificationResult.VALID;
+ majorInfo = "VALID";
+
+ } else if (resultCode instanceof ResultCodeInvalid) {
+ majorCode = SignatureVerificationResult.INVALID;
+ majorInfo = "INVALID";
+
+ } else if (resultCode instanceof ResultCodeSkipped) {
+ majorCode = MAJORRESULTCODESKIPPED;
+ majorInfo = "SKIPPED";
+
+ } else if (resultCode instanceof ResultCodeError) {
+ majorCode = MAJORRESULTCODEERROR;
+ majorInfo = "ERROR";
+
+ } else {
+ majorCode = SignatureVerificationResult.INDETERMINATE;
+ majorInfo = "INDETERMINATE";
+ }
+
+ if (resultCode.getCode() != null) {
+ minorCode = resultCode.getCode();
+ if (resultCode.getCode().equals(ResultCode.CODE_CHAIN_CONSTRAINTS_FAILURE)) {
+ minorInfo = "CHAIN_CONSTRAINTS_FAILURE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_CRYPTO_CONSTRAINTS_FAILURE)) {
+ minorInfo = "CRYPTO_CONSTRAINTS_FAILURE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_CRYPTO_CONSTRAINTS_FAILURE_NO_POE)) {
+ minorInfo = "CRYPTO_CONSTRAINTS_FAILURE_NO_POE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_EXPIRED)) {
+ minorInfo = "EXPIRED";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_FORMAT_FAILURE)) {
+ minorInfo = "FORMAT_FAILURE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_GENERIC)) {
+ minorInfo = "GENERIC";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_HASH_FAILURE)) {
+ minorInfo = "HASH_FAILURE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_NO_CERTIFICATE_CHAIN_FOUND)) {
+ minorInfo = "NO_CERTIFICATE_CHAIN_FOUND";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_NO_POE)) {
+ minorInfo = "NO_POE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_NO_POLICY)) {
+ minorInfo = "NO_POLICY";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_NOT_YET_VALID)) {
+ minorInfo = "NOT_YET_VALID";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_OUT_OF_BOUNDS_NO_POE)) {
+ minorInfo = "OUT_OF_BOUNDS_NO_POE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_POLICY_PROCESSING_ERROR)) {
+ minorInfo = "POLICY_PROCESSING_ERROR";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_REVOKED)) {
+ minorInfo = "REVOKED";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_REVOKED_CA_NO_POE)) {
+ minorInfo = "REVOKED_CA_NO_POE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_REVOKED_NO_POE)) {
+ minorInfo = "REVOKED_NO_POE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_SIG_CONSTRAINTS_FAILURE)) {
+ minorInfo = "SIG_CONSTRAINTS_FAILURE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_SIG_CRYPTO_FAILURE)) {
+ minorInfo = "SIG_CRYPTO_FAILURE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_SIGNED_DATA_NOT_FOUND)) {
+ minorInfo = "SIGNED_DATA_NOT_FOUND";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_TIMESTAMP_ORDER_FAILURE)) {
+ minorInfo = "TIMESTAMP_ORDER_FAILURE";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_TRY_LATER)) {
+ minorInfo = "TRY_LATER";
+ } else if (resultCode.getCode().equals(ResultCode.CODE_UNKNOWN_COMMITMENT_TYPE)) {
+ minorInfo = "UNKNOWN_COMMITMENT_TYPE";
+ } else if (resultCode.getCode().equals(ResultCode.SUCCESS)) {
+ minorInfo = "SUCCESS";
+ } else if (resultCode.getCode().equals(ResultCode.ERROR)) {
+ minorInfo = "ERROR";
+ } else if (resultCode.getCode().equals(ResultCode.UNKNOWN_SUBFILTER)) {
+ minorInfo = "UNKNOWN_SUBFILTER";
+
+ // pdf-as 3.x detection is removed from MOA-SP since 3.1.2
+ } else if (resultCode.getCode().equals(ResultCode.PDF_AS_SIGNATURE)) {
+ // minorInfo = "PDF_AS_SIGNATURE";
+ minorInfo = "UNKNOWN_SUBFILTER";
+ minorCode = ResultCode.UNKNOWN_SUBFILTER;
+ }
+
+ }
+
+ check = new ExtendedCertificateCheckResultImpl(majorCode, majorInfo, minorCode,
+ minorInfo);
+
+ return check;
+
+ }
+
+ public static List getAdESResult(iaik.server.modules.AdESFormVerificationResult adesFormVerification) {
+ if (adesFormVerification == null) {
+ // no form information
+ return null;
+ }
+
+ final List adesList = new ArrayList();
+
+ // add only the completed form result to response
+ final String completedForm = adesFormVerification.getCompleteForm();
+ Logger.info("Find complete Form: " + completedForm);
+
+ /*
+ * This code only returns the result of the completed form
+ */
+// if (MiscUtil.isNotEmpty(completedForm)) {
+// Logger.info("Form-validation found completed form: " + completedForm);
+// AdESVerificationResult subResult = adesFormVerification.getSubResult(completedForm);
+// checkSubResult(subResult, completedForm, adesList);
+// if (Logger.isDebugEnabled())
+// Logger.debug("Detailed Result: \n" + subResult.getInfo());
+//
+// } else
+// Logger.info("Form-valdition found NO completed form.");
+//
+// if (Logger.isDebugEnabled())
+// Logger.debug("Full form-validation result: \n" + adesFormVerification.getInfo());
+
+ /*
+ * This code returns the result for all forms
+ */
+ // add results for all form types to response
+ checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LTA),
+ SignatureVerificationProfile.LEVEL_LTA, adesList);
+ checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LT),
+ SignatureVerificationProfile.LEVEL_LT, adesList);
+ checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_T),
+ SignatureVerificationProfile.LEVEL_T, adesList);
+ checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_B),
+ SignatureVerificationProfile.LEVEL_B, adesList);
+
+ return adesList;
+ }
+
+ public static void buildResult(ValidationReport report, List adesList) {
+
+ if (report == null) {
+ return;
+ }
+
+ final AdESFormResultsImpl adESFormResultsImpl = new AdESFormResultsImpl();
+ adESFormResultsImpl.setCode(report.getStatus().ordinal());
+ adESFormResultsImpl.setInfo(report.getLongText());
+ adESFormResultsImpl.setName(report.getValidationName());
+
+ adesList.add(adESFormResultsImpl);
+
+ if (report.getSubValidationReports() != null && !report.getSubValidationReports().isEmpty()) {
+ final Iterator<ValidationReport> reportIt = report.getSubValidationReports().iterator();
+ while (reportIt.hasNext()) {
+ buildResult(reportIt.next(), adesList);
+ }
+ }
+
+ }
+
+ public static void checkSubResult(AdESVerificationResult subResult, String level, List adesList) {
+ if (subResult != null) {
+ Logger.debug("Checking Level: " + level);
+ try {
+
+ final AdESFormResultsImpl adESFormResultsImpl = new AdESFormResultsImpl();
+ adESFormResultsImpl.setCode(subResult.getResultCode());
+ Logger.debug("RESULT: " + String.valueOf(subResult.getResultCode()));
+ adESFormResultsImpl.setInfo(subResult.getInfo());
+ adESFormResultsImpl.setName(level);
+
+ adesList.add(adESFormResultsImpl);
+ } catch (final NullPointerException e) {
+ Logger.warn("Catching NullPointer Exception, of invalid Form Results", e);
+
+ }
+ } else {
+ Logger.info("Subresult Level: " + level + " not available");
+
+ }
+ }
+
+ public static void checkSubResult(SignatureVerificationResult subResult, String level, List adesList)
+ throws ConfigurationException {
+ if (subResult != null) {
+ Logger.debug("Checking Level: " + level);
+ try {
+
+ final AdESFormResultsImpl adESFormResultsImpl = new AdESFormResultsImpl();
+ final iaik.server.modules.resultcodes.ResultCode resultCode = subResult.getResultCode();
+ if (resultCode instanceof ResultCodeValid) {
+ adESFormResultsImpl.setCode(SignatureVerificationResult.VALID);// .getResultCode().getCode()));
+ } else if (resultCode instanceof ResultCodeInvalid) {
+ adESFormResultsImpl.setCode(SignatureVerificationResult.INVALID);
+ } else {
+ adESFormResultsImpl.setCode(SignatureVerificationResult.INDETERMINATE);
+ }
+ Logger.debug("RESULT: " + resultCode.toString());
+ adESFormResultsImpl.setInfo(subResult.getInfo());
+ adESFormResultsImpl.setName(level);
+
+ adesList.add(adESFormResultsImpl);
+ } catch (final NullPointerException e) {
+ Logger.warn("Catching NullPointer Exception, of invalid? Form Results", e);
+ }
+ } else {
+ Logger.info("Subresult Level: " + level + " not available");
+ }
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertStoreConverter.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertStoreConverter.java
index 0956617..59db5db 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertStoreConverter.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/CertStoreConverter.java
@@ -14,96 +14,96 @@ import iaik.pki.store.certstore.utils.DirectoryCertStoreConverter;
public class CertStoreConverter {
- private static final Logger logger = LoggerFactory.getLogger(CertStoreConverter.class);
-
- public static boolean convert(String certStoreRoot, TransactionId transId) {
- String certStoreSubjectDN = certStoreRoot + File.separator + "subjectdn";
-
- logger.error("checking for new cert store format {} -> {}", certStoreRoot, certStoreSubjectDN);
-
- File certStoreDirectory = new File(certStoreRoot);
- if (certStoreDirectory.isDirectory() && certStoreDirectory.exists()) {
-
- File file = new File(certStoreSubjectDN);
-
- if (file.isDirectory() && file.exists()) {
- // Is new Format!
- logger.error("Cert store is allready new format!");
- return false;
- } else {
- try {
- logger.error(
- "###########################################################################################");
- logger.error(
- "###########################################################################################");
- logger.error("The certificate store @ {} will now be converted into the new format!",
- certStoreDirectory.getAbsolutePath());
-
- String backup = certStoreRoot;
-
- if (certStoreRoot.endsWith(File.separator)) {
- backup = certStoreRoot.substring(0, certStoreRoot.length() - File.separator.length());
- }
-
- String timestamp = String.valueOf(System.currentTimeMillis());
- backup = backup + "_" + timestamp;
-
- logger.error("Creating a backup of the certstore @ {}", backup);
-
- File backupDirectory = new File(backup);
- try {
- FileUtils.copyDirectory(certStoreDirectory, backupDirectory);
- } catch (IOException e) {
- logger.error("Failed to create certstore backup!", e);
- throw new RuntimeException("Failed to create certstore backup!", e);
- }
-
- logger.error("deleting original certstore @ {}", certStoreRoot);
-
- try {
- FileUtils.deleteDirectory(certStoreDirectory);
- } catch (IOException e1) {
- logger.error("Failed to delete old certstore!", e1);
- throw new RuntimeException("Failed to delete old certstore!", e1);
- }
- certStoreDirectory.mkdir();
-
- DirectoryCertStoreConverter directoryCertStoreConverter = new DirectoryCertStoreConverter();
-
- try {
- logger.error("running conversion of certstore @ {}", certStoreRoot);
- directoryCertStoreConverter.convert(backupDirectory.getAbsolutePath(),
- certStoreDirectory.getAbsolutePath(), true, false,
- new IaikLog("DirectoryCertStoreConverter"), transId);
- } catch (DirectoryStoreException e) {
- logger.error("Failed to run conversion of old certstore!", e);
-
- try {
- FileUtils.copyDirectory(backupDirectory, certStoreDirectory);
- } catch (IOException e1) {
- logger.error("!!!!Failed to restore original certstore!!!! CHECK LOGS", e1);
- throw new RuntimeException("!!!!Failed to restore original certstore!!!! CHECK LOGS", e);
-
- }
- throw new RuntimeException("Failed to run conversion of old certstore!", e);
- }
-
- logger.error("Conversion of certstore succseeded");
- logger.error("Certstore in new format is located @ {}", certStoreDirectory.getAbsolutePath());
- logger.error("Backup of Certstore in old format is located @ {}",
- certStoreDirectory.getAbsolutePath());
- } finally {
- logger.error(
- "###########################################################################################");
- logger.error(
- "###########################################################################################");
- }
- return true;
- }
- } else {
- logger.error("Certstore does not exist yet");
- }
- return false;
- }
-
+ private static final Logger logger = LoggerFactory.getLogger(CertStoreConverter.class);
+
+ public static boolean convert(String certStoreRoot, TransactionId transId) {
+ final String certStoreSubjectDN = certStoreRoot + File.separator + "subjectdn";
+
+ logger.info("checking for new cert store format {} -> {}", certStoreRoot, certStoreSubjectDN);
+
+ final File certStoreDirectory = new File(certStoreRoot);
+ if (certStoreDirectory.isDirectory() && certStoreDirectory.exists()) {
+
+ final File file = new File(certStoreSubjectDN);
+
+ if (file.isDirectory() && file.exists()) {
+ // Is new Format!
+ logger.debug("Cert store is allready new format!");
+ return false;
+ } else {
+ try {
+ logger.info(
+ "###########################################################################################");
+ logger.info(
+ "###########################################################################################");
+ logger.info("The certificate store @ {} will now be converted into the new format!",
+ certStoreDirectory.getAbsolutePath());
+
+ String backup = certStoreRoot;
+
+ if (certStoreRoot.endsWith(File.separator)) {
+ backup = certStoreRoot.substring(0, certStoreRoot.length() - File.separator.length());
+ }
+
+ final String timestamp = String.valueOf(System.currentTimeMillis());
+ backup = backup + "_" + timestamp;
+
+ logger.info("Creating a backup of the certstore @ {}", backup);
+
+ final File backupDirectory = new File(backup);
+ try {
+ FileUtils.copyDirectory(certStoreDirectory, backupDirectory);
+ } catch (final IOException e) {
+ logger.error("Failed to create certstore backup!", e);
+ throw new RuntimeException("Failed to create certstore backup!", e);
+ }
+
+ logger.info("deleting original certstore @ {}", certStoreRoot);
+
+ try {
+ FileUtils.deleteDirectory(certStoreDirectory);
+ } catch (final IOException e1) {
+ logger.error("Failed to delete old certstore!", e1);
+ throw new RuntimeException("Failed to delete old certstore!", e1);
+ }
+ certStoreDirectory.mkdir();
+
+ final DirectoryCertStoreConverter directoryCertStoreConverter = new DirectoryCertStoreConverter();
+
+ try {
+ logger.info("running conversion of certstore @ {}", certStoreRoot);
+ directoryCertStoreConverter.convert(backupDirectory.getAbsolutePath(),
+ certStoreDirectory.getAbsolutePath(), true, false,
+ new IaikLog("DirectoryCertStoreConverter"), transId);
+ } catch (final DirectoryStoreException e) {
+ logger.error("Failed to run conversion of old certstore!", e);
+
+ try {
+ FileUtils.copyDirectory(backupDirectory, certStoreDirectory);
+ } catch (final IOException e1) {
+ logger.error("!!!!Failed to restore original certstore!!!! CHECK LOGS", e1);
+ throw new RuntimeException("!!!!Failed to restore original certstore!!!! CHECK LOGS", e);
+
+ }
+ throw new RuntimeException("Failed to run conversion of old certstore!", e);
+ }
+
+ logger.info("Conversion of certstore succseeded");
+ logger.info("Certstore in new format is located @ {}", certStoreDirectory.getAbsolutePath());
+ logger.info("Backup of Certstore in old format is located @ {}",
+ certStoreDirectory.getAbsolutePath());
+ } finally {
+ logger.info(
+ "###########################################################################################");
+ logger.info(
+ "###########################################################################################");
+ }
+ return true;
+ }
+ } else {
+ logger.error("Certstore does not exist yet");
+ }
+ return false;
+ }
+
}
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 ce78580..b7580ac 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
@@ -1,18 +1,5 @@
package at.gv.egovernment.moa.spss.util;
-import iaik.asn1.ObjectID;
-import iaik.asn1.structures.Name;
-import iaik.asn1.structures.PolicyInformation;
-import iaik.utils.RFC2253NameParser;
-import iaik.utils.RFC2253NameParserException;
-import iaik.x509.X509Certificate;
-import iaik.x509.X509ExtensionInitException;
-import iaik.x509.extensions.CertificatePolicies;
-import iaik.x509.extensions.qualified.QCStatements;
-import iaik.x509.extensions.qualified.structures.QCStatement;
-import iaik.x509.extensions.qualified.structures.etsi.QcEuCompliance;
-import iaik.x509.extensions.qualified.structures.etsi.QcEuSSCD;
-
import java.net.URI;
import java.security.Principal;
import java.util.Arrays;
@@ -22,370 +9,387 @@ import java.util.List;
import at.gv.egovernment.moa.sig.tsl.TslConstants;
import at.gv.egovernment.moa.sig.tsl.engine.data.ITslEndEntityResult;
import at.gv.egovernment.moa.sig.tsl.exception.TslException;
-import at.gv.egovernment.moa.sig.tsl.utils.MiscUtil;
import at.gv.egovernment.moa.spss.api.common.TslInfos;
import at.gv.egovernment.moa.spss.api.impl.TslInfosImpl;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moa.spss.tsl.TSLServiceFactory;
import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
+import iaik.asn1.ObjectID;
+import iaik.asn1.structures.Name;
+import iaik.asn1.structures.PolicyInformation;
+import iaik.utils.RFC2253NameParser;
+import iaik.utils.RFC2253NameParserException;
+import iaik.x509.X509Certificate;
+import iaik.x509.X509ExtensionInitException;
+import iaik.x509.extensions.CertificatePolicies;
+import iaik.x509.extensions.qualified.QCStatements;
+import iaik.x509.extensions.qualified.structures.QCStatement;
+import iaik.x509.extensions.qualified.structures.etsi.QcEuCompliance;
+import iaik.x509.extensions.qualified.structures.etsi.QcEuSSCD;
public class CertificateUtils {
-
-
- /**
- * Verifies if the given certificate contains QCP+ statement
- * @param cert X509Certificate
- * @return true if the given certificate contains QCP+ statement, else false
- */
- private static boolean checkQCPPlus(X509Certificate cert) {
- Logger.debug("Checking QCP+ extension");
- String OID_QCPPlus = "0.4.0.1456.1.1";
- try {
- CertificatePolicies certPol = (CertificatePolicies) cert.getExtension(CertificatePolicies.oid);
- if (certPol == null) {
- Logger.debug("No CertificatePolicies extension found");
- return false;
- }
-
- PolicyInformation[] polInfo = certPol.getPolicyInformation();
- if (polInfo == null) {
- Logger.debug("No policy information found");
- return false;
- }
-
- for (int i = 0; i < polInfo.length; i++) {
- ObjectID oid = polInfo[i].getPolicyIdentifier();
- String oidStr = oid.getID();
- if (oidStr.compareToIgnoreCase(OID_QCPPlus) == 0) {
- Logger.debug("QCP+ extension found");
- return true;
- }
- }
-
- Logger.debug("No QCP+ extension found");
-
- return false;
- } catch (X509ExtensionInitException e) {
- Logger.debug("No QCP+ extension found");
-
- return false;
- }
-
- }
-
- /**
- * Verifies if the given certificate contains QCP statement
- * @param cert X509Certificate
- * @return true if the given certificate contains QCP statement, else false
- */
- private static boolean checkQCP(X509Certificate cert) {
- Logger.debug("Checking QCP extension");
- String OID_QCP = "0.4.0.1456.1.2";
- try {
- CertificatePolicies certPol = (CertificatePolicies) cert.getExtension(CertificatePolicies.oid);
- if (certPol == null) {
- Logger.debug("No CertificatePolicies extension found");
- return false;
- }
-
- PolicyInformation[] polInfo = certPol.getPolicyInformation();
- if (polInfo == null) {
- Logger.debug("No policy information found");
- return false;
- }
-
- for (int i = 0; i < polInfo.length; i++) {
- ObjectID oid = polInfo[i].getPolicyIdentifier();
- String oidStr = oid.getID();
- if (oidStr.compareToIgnoreCase(OID_QCP) == 0) {
- Logger.debug("QCP extension found");
- return true;
- }
-
- }
-
- Logger.debug("No QCP extension found");
- return false;
-
- } catch (X509ExtensionInitException e) {
- Logger.debug("No QCP extension found");
- return false;
- }
-
- }
-
- /**
- * Verifies if the given certificate contains QcEuCompliance statement
- * @param cert X509Certificate
- * @return true if the given certificate contains QcEuCompliance statement, else false
- */
- private static boolean checkQcEuCompliance(X509Certificate cert) {
- Logger.debug("Checking QcEUCompliance extension");
- try {
- QCStatements qcStatements = (QCStatements) cert.getExtension(QCStatements.oid);
-
- if (qcStatements == null) {
- Logger.debug("No QcStatements extension found");
- return false;
- }
-
- QCStatement qcEuCompliance = qcStatements.getQCStatements(QcEuCompliance.statementID);
-
- if (qcEuCompliance != null) {
- Logger.debug("QcEuCompliance extension found");
- return true;
- }
-
- Logger.debug("No QcEuCompliance extension found");
- return false;
-
- } catch (X509ExtensionInitException e) {
- Logger.debug("No QcEuCompliance extension found");
- return false;
- }
-
- }
-
- /**
- * Verifies if the given certificate contains QcEuSSCD statement
- * @param cert X509Certificate
- * @return true if the given certificate contains QcEuSSCD statement, else false
- */
- private static boolean checkQcEuSSCD(X509Certificate cert) {
- Logger.debug("Checking QcEuSSCD extension");
- try {
- QCStatements qcStatements = (QCStatements) cert.getExtension(QCStatements.oid);
- if (qcStatements == null) {
- Logger.debug("No QcStatements extension found");
- return false;
- }
-
- QCStatement qcEuSSCD = qcStatements.getQCStatements(QcEuSSCD.statementID);
-
- if (qcEuSSCD != null) {
- Logger.debug("QcEuSSCD extension found");
- return true;
- }
-
- Logger.debug("No QcEuSSCD extension found");
- return false;
-
- } catch (X509ExtensionInitException e) {
- Logger.debug("No QcEuSSCD extension found");
- return false;
- }
-
- }
-
- public static QCSSCDResult checkQCSSCD(X509Certificate[] chain, Date signingTime, boolean isTSLenabledTrustprofile, ConfigurationProvider config) {
-
- try {
- if (isTSLenabledTrustprofile) {
- if (signingTime == null) {
- signingTime = new Date();
- Logger.debug("TSL check without signingTime --> use current time for evaluation");
-
- }
-
- ITslEndEntityResult tslCheckResult =
- TSLServiceFactory.getTSLServiceClient().evaluate(
- Arrays.asList(chain),
- signingTime,
- TslConstants.CHAIN_MODEL);
-
- if (tslCheckResult != null) {
- URI tslServiceTypeIdentifier = tslCheckResult.getEvaluatedServiceTypeIdentifier();
- List<URI> tslCertificateQualifier = tslCheckResult.getEvaluatedQualifier();
-
- // QC evaluation flags
- boolean qc = false;
- boolean qcSourceTSL = false;
- boolean qcDisallowedFromTSL = false;
-
- // SSCD/QSCD evaluation flags
- boolean sscd = false;
- boolean sscdSourceTSL = false;
-
-
- //check QC
- List<URI> allowedQCQualifier = config.getTSLConfiguration().getQualifierForQC();
- for (URI el : allowedQCQualifier) {
- if (el.equals(tslServiceTypeIdentifier)) {
- qcSourceTSL = true;
- qc = true;
-
- }
-
- }
-
- //check SSCD/QSCD qualifiers and mark result acording this check
- List<URI> allowedSSCDQualifier = config.getTSLConfiguration().getQualifierForSSCD();
- if (tslCertificateQualifier != null && allowedSSCDQualifier != null) {
- for (URI allowedSSCD : allowedSSCDQualifier) {
- for (URI certSSCD : tslCertificateQualifier) {
- if (allowedSSCD.equals(certSSCD)) {
- sscdSourceTSL = true;
- sscd = true;
-
- }
- }
- }
- }
-
- //check additional flags in TSP qualifiers for this certificate
- if (tslCertificateQualifier != null) {
- for (URI qEl : tslCertificateQualifier) {
- //check if SSCD/QSCD status must be used from cert
- if (qEl.equals(
- TslConstants.SSCD_QUALIFIER_SORT_TO_URI.get(
- TslConstants.SSCD_QUALIFIER_SHORT.QCQSCDStatusAsInCert))
- || qEl.equals(TslConstants.SSCD_QUALIFIER_SORT_TO_URI.get(
- TslConstants.SSCD_QUALIFIER_SHORT.QCSSCDStatusAsInCert))) {
-
- sscdSourceTSL = false;
- sscd = false;
-
- //check if extentsion includes a NotQualified flag
- } else if (qEl.equals(
- TslConstants.SSCD_QUALIFIER_SORT_TO_URI.get(
- TslConstants.SSCD_QUALIFIER_SHORT.NotQualified))) {
- qc = false;
- qcSourceTSL = false;
- qcDisallowedFromTSL = true;
- Logger.info("TSL mark this certificate explicitly as 'NotQualified'!");
-
- }
- }
- }
-
- /*
- * This block is removes with MOA-SP 3.1 because if TSL support is enabled for the requested TrustProfile
- * QC evaluation is ONLY allowed from TSL information!!! Because with eIDAS regulation and July 01. 2016
- * the Trust-Status List is constitutive.
- */
-// //evaluate QC statement according previous selected information
-// if (qcSourceTSL)
+
+ /**
+ * Verifies if the given certificate contains QCP+ statement
+ *
+ * @param cert X509Certificate
+ * @return true if the given certificate contains QCP+ statement, else false
+ */
+ private static boolean checkQCPPlus(X509Certificate cert) {
+ Logger.debug("Checking QCP+ extension");
+ final String OID_QCPPlus = "0.4.0.1456.1.1";
+ try {
+ final CertificatePolicies certPol = (CertificatePolicies) cert.getExtension(CertificatePolicies.oid);
+ if (certPol == null) {
+ Logger.debug("No CertificatePolicies extension found");
+ return false;
+ }
+
+ final PolicyInformation[] polInfo = certPol.getPolicyInformation();
+ if (polInfo == null) {
+ Logger.debug("No policy information found");
+ return false;
+ }
+
+ for (final PolicyInformation element : polInfo) {
+ final ObjectID oid = element.getPolicyIdentifier();
+ final String oidStr = oid.getID();
+ if (oidStr.compareToIgnoreCase(OID_QCPPlus) == 0) {
+ Logger.debug("QCP+ extension found");
+ return true;
+ }
+ }
+
+ Logger.debug("No QCP+ extension found");
+
+ return false;
+ } catch (final X509ExtensionInitException e) {
+ Logger.debug("No QCP+ extension found");
+
+ return false;
+ }
+
+ }
+
+ /**
+ * Verifies if the given certificate contains QCP statement
+ *
+ * @param cert X509Certificate
+ * @return true if the given certificate contains QCP statement, else false
+ */
+ private static boolean checkQCP(X509Certificate cert) {
+ Logger.debug("Checking QCP extension");
+ final String OID_QCP = "0.4.0.1456.1.2";
+ try {
+ final CertificatePolicies certPol = (CertificatePolicies) cert.getExtension(CertificatePolicies.oid);
+ if (certPol == null) {
+ Logger.debug("No CertificatePolicies extension found");
+ return false;
+ }
+
+ final PolicyInformation[] polInfo = certPol.getPolicyInformation();
+ if (polInfo == null) {
+ Logger.debug("No policy information found");
+ return false;
+ }
+
+ for (final PolicyInformation element : polInfo) {
+ final ObjectID oid = element.getPolicyIdentifier();
+ final String oidStr = oid.getID();
+ if (oidStr.compareToIgnoreCase(OID_QCP) == 0) {
+ Logger.debug("QCP extension found");
+ return true;
+ }
+
+ }
+
+ Logger.debug("No QCP extension found");
+ return false;
+
+ } catch (final X509ExtensionInitException e) {
+ Logger.debug("No QCP extension found");
+ return false;
+ }
+
+ }
+
+ /**
+ * Verifies if the given certificate contains QcEuCompliance statement
+ *
+ * @param cert X509Certificate
+ * @return true if the given certificate contains QcEuCompliance statement, else
+ * false
+ */
+ private static boolean checkQcEuCompliance(X509Certificate cert) {
+ Logger.debug("Checking QcEUCompliance extension");
+ try {
+ final QCStatements qcStatements = (QCStatements) cert.getExtension(QCStatements.oid);
+
+ if (qcStatements == null) {
+ Logger.debug("No QcStatements extension found");
+ return false;
+ }
+
+ final QCStatement qcEuCompliance = qcStatements.getQCStatements(QcEuCompliance.statementID);
+
+ if (qcEuCompliance != null) {
+ Logger.debug("QcEuCompliance extension found");
+ return true;
+ }
+
+ Logger.debug("No QcEuCompliance extension found");
+ return false;
+
+ } catch (final X509ExtensionInitException e) {
+ Logger.debug("No QcEuCompliance extension found");
+ return false;
+ }
+
+ }
+
+ /**
+ * Verifies if the given certificate contains QcEuSSCD statement
+ *
+ * @param cert X509Certificate
+ * @return true if the given certificate contains QcEuSSCD statement, else false
+ */
+ private static boolean checkQcEuSSCD(X509Certificate cert) {
+ Logger.debug("Checking QcEuSSCD extension");
+ try {
+ final QCStatements qcStatements = (QCStatements) cert.getExtension(QCStatements.oid);
+ if (qcStatements == null) {
+ Logger.debug("No QcStatements extension found");
+ return false;
+ }
+
+ final QCStatement qcEuSSCD = qcStatements.getQCStatements(QcEuSSCD.statementID);
+
+ if (qcEuSSCD != null) {
+ Logger.debug("QcEuSSCD extension found");
+ return true;
+ }
+
+ Logger.debug("No QcEuSSCD extension found");
+ return false;
+
+ } catch (final X509ExtensionInitException e) {
+ Logger.debug("No QcEuSSCD extension found");
+ return false;
+ }
+
+ }
+
+ public static QCSSCDResult checkQCSSCD(X509Certificate[] chain, Date signingTime,
+ boolean isTSLenabledTrustprofile, ConfigurationProvider config) {
+
+ try {
+ if (isTSLenabledTrustprofile) {
+ if (signingTime == null) {
+ signingTime = new Date();
+ Logger.debug("TSL check without signingTime --> use current time for evaluation");
+
+ }
+
+ final ITslEndEntityResult tslCheckResult =
+ TSLServiceFactory.getTSLServiceClient().evaluate(
+ Arrays.asList(chain),
+ signingTime,
+ TslConstants.PKIX_MODEL);
+
+ if (tslCheckResult != null) {
+ final URI tslServiceTypeIdentifier = tslCheckResult.getEvaluatedServiceTypeIdentifier();
+ final List<URI> tslCertificateQualifier = tslCheckResult.getEvaluatedQualifier();
+
+ // QC evaluation flags
+ boolean qc = false;
+ boolean qcSourceTSL = false;
+ boolean qcDisallowedFromTSL = false;
+
+ // SSCD/QSCD evaluation flags
+ boolean sscd = false;
+ boolean sscdSourceTSL = false;
+
+ // check QC
+ final List<URI> allowedQCQualifier = config.getTSLConfiguration().getQualifierForQC();
+ for (final URI el : allowedQCQualifier) {
+ if (el.equals(tslServiceTypeIdentifier)) {
+ qcSourceTSL = true;
+ qc = true;
+
+ }
+
+ }
+
+ // check SSCD/QSCD qualifiers and mark result acording this check
+ final List<URI> allowedSSCDQualifier = config.getTSLConfiguration().getQualifierForSSCD();
+ if (tslCertificateQualifier != null && allowedSSCDQualifier != null) {
+ for (final URI allowedSSCD : allowedSSCDQualifier) {
+ for (final URI certSSCD : tslCertificateQualifier) {
+ if (allowedSSCD.equals(certSSCD)) {
+ sscdSourceTSL = true;
+ sscd = true;
+
+ }
+ }
+ }
+ }
+
+ // check additional flags in TSP qualifiers for this certificate
+ if (tslCertificateQualifier != null) {
+ for (final URI qEl : tslCertificateQualifier) {
+ // check if SSCD/QSCD status must be used from cert
+ if (qEl.equals(
+ TslConstants.SSCD_QUALIFIER_SORT_TO_URI.get(
+ TslConstants.SSCD_QUALIFIER_SHORT.QCQSCDStatusAsInCert))
+ || qEl.equals(TslConstants.SSCD_QUALIFIER_SORT_TO_URI.get(
+ TslConstants.SSCD_QUALIFIER_SHORT.QCSSCDStatusAsInCert))) {
+
+ sscdSourceTSL = false;
+ sscd = false;
+
+ // check if extentsion includes a NotQualified flag
+ } else if (qEl.equals(
+ TslConstants.SSCD_QUALIFIER_SORT_TO_URI.get(
+ TslConstants.SSCD_QUALIFIER_SHORT.NotQualified))) {
+ qc = false;
+ qcSourceTSL = false;
+ qcDisallowedFromTSL = true;
+ Logger.info("TSL mark this certificate explicitly as 'NotQualified'!");
+
+ }
+ }
+ }
+
+ /*
+ * This block is removes with MOA-SP 3.1 because if TSL support is enabled for
+ * the requested TrustProfile QC evaluation is ONLY allowed from TSL
+ * information!!! Because with eIDAS regulation and July 01. 2016 the
+ * Trust-Status List is constitutive.
+ */
+// //evaluate QC statement according previous selected information
+// if (qcSourceTSL)
// Logger.debug("Certificate is QC (Source: TSL)");
-//
+//
// else {
-//
-//
+//
+//
// // if TSL return no service-type identifier us information from certificate
-// if (tslServiceTypeIdentifier == null ||
+// if (tslServiceTypeIdentifier == null ||
// MiscUtil.isEmpty(tslServiceTypeIdentifier.toString())) {
// // try certificate extensions QCP and QcEuCompliance
// Logger.debug("QC check via TSL returned false - checking certificate extensions");
// boolean checkQCP = CertificateUtils.checkQCP(chain[0]);
// boolean checkQcEuCompliance = CertificateUtils.checkQcEuCompliance(chain[0]);
-//
+//
// if ((checkQCP || checkQcEuCompliance) && !qcDisallowedFromTSL) {
// Logger.debug("Certificate is QC (Source: Certificate)");
// qc = true;
-//
+//
// }
-// }
+// }
// }
-
-
- //evaluate SSCD/QSCD results according previous selected information
- if (sscdSourceTSL)
- Logger.debug("Certificate is SSCD (Source: TSL)");
-
- else {
- // if SSCD check via TSL returns false
- // try certificate extensions QCP+ and QcEuSSCD
- Logger.debug("SSCD check via TSL returned false - checking certificate extensions");
- boolean checkQCPPlus = CertificateUtils.checkQCPPlus(chain[0]);
- boolean checkQcEuSSCD = CertificateUtils.checkQcEuSSCD(chain[0]);
-
- if (checkQCPPlus || checkQcEuSSCD) {
- Logger.debug("Certificate is SSCD (Source: Certificate)");
- sscd = true;
- }
- }
-
- //build basic result
- QCSSCDResult result = new QCSSCDResult(qc, qcSourceTSL, sscd, sscdSourceTSL);
-
- //add additinal information
- TslInfos extTslInfos = new TslInfosImpl(
- tslCheckResult.getTerritory(),
- tslCheckResult.getTspStatus(),
- tslServiceTypeIdentifier.toString(),
- tslCertificateQualifier,
- tslCheckResult.getAdditionalServiceInformation());
- result.setTslInfos(extTslInfos);
-
- return result;
-
- } else {
- Logger.debug("Qualifier check via TSL return null - checking certificate extensions without QC evaluation");
- return parseInfosFromCertificate(chain, false);
-
- }
-
- } else
- Logger.info("TSL support is not enabled - checking certificate extensions with QC evaluation ");
- return parseInfosFromCertificate(chain, true);
- }
- catch (TslException e) {
- MessageProvider msg = MessageProvider.getInstance();
- Logger.error(new LogMsg(msg.getMessage("tsl.01", null)), e);
-
- return new QCSSCDResult();
- }
-
- }
-
- private static QCSSCDResult parseInfosFromCertificate(X509Certificate[] chain, boolean performQCEvaluation) {
- boolean qc = false;
- boolean sscd = false;
-
- // Trustprofile is not TSL enabled - use certificate extensions only
-
- if (performQCEvaluation) {
- // perform QC check
- // try certificate extensions QCP and QcEuCompliance
- boolean checkQCP = CertificateUtils.checkQCP(chain[0]);
- boolean checkQcEuCompliance = CertificateUtils.checkQcEuCompliance(chain[0]);
-
- if (checkQCP || checkQcEuCompliance)
- qc = true;
-
- }
-
- // perform SSCD check
- // try certificate extensions QCP+ and QcEuSSCD
- boolean checkQCPPlus = CertificateUtils.checkQCPPlus(chain[0]);
- boolean checkQcEuSSCD = CertificateUtils.checkQcEuSSCD(chain[0]);
-
- if (checkQCPPlus || checkQcEuSSCD)
- sscd = true;
-
- return new QCSSCDResult(qc, false, sscd, false);
-
- }
-
-
- /**
- * Gets the country from the certificate issuer
- * @param cert X509 certificate
- * @return Country code from the certificate issuer
- */
- public static String getIssuerCountry(X509Certificate cert) {
- String country = null;
- Principal issuerdn = cert.getIssuerX500Principal();
- RFC2253NameParser nameParser = new RFC2253NameParser(issuerdn.getName());
-
- try {
- Name name = nameParser.parse();
- country = name.getRDN(ObjectID.country);
- } catch (RFC2253NameParserException e) {
- Logger.warn("Could not get country code from issuer.");
- }
-
-
- return country;
- }
+
+ // evaluate SSCD/QSCD results according previous selected information
+ if (sscdSourceTSL) {
+ Logger.debug("Certificate is SSCD (Source: TSL)");
+ } else {
+ // if SSCD check via TSL returns false
+ // try certificate extensions QCP+ and QcEuSSCD
+ Logger.debug("SSCD check via TSL returned false - checking certificate extensions");
+ final boolean checkQCPPlus = CertificateUtils.checkQCPPlus(chain[0]);
+ final boolean checkQcEuSSCD = CertificateUtils.checkQcEuSSCD(chain[0]);
+
+ if (checkQCPPlus || checkQcEuSSCD) {
+ Logger.debug("Certificate is SSCD (Source: Certificate)");
+ sscd = true;
+ }
+ }
+
+ // build basic result
+ final QCSSCDResult result = new QCSSCDResult(qc, qcSourceTSL, sscd, sscdSourceTSL);
+
+ // add additinal information
+ final TslInfos extTslInfos = new TslInfosImpl(
+ tslCheckResult.getTerritory(),
+ tslCheckResult.getTspStatus(),
+ tslServiceTypeIdentifier.toString(),
+ tslCertificateQualifier,
+ tslCheckResult.getAdditionalServiceInformation());
+ result.setTslInfos(extTslInfos);
+
+ return result;
+
+ } else {
+ Logger.debug(
+ "Qualifier check via TSL return null - checking certificate extensions without QC evaluation");
+ return parseInfosFromCertificate(chain, false);
+
+ }
+
+ } else {
+ Logger.info("TSL support is not enabled - checking certificate extensions with QC evaluation ");
+ }
+ return parseInfosFromCertificate(chain, true);
+ } catch (final TslException e) {
+ final MessageProvider msg = MessageProvider.getInstance();
+ Logger.error(new LogMsg(msg.getMessage("tsl.01", null)), e);
+
+ return new QCSSCDResult();
+ }
+
+ }
+
+ private static QCSSCDResult parseInfosFromCertificate(X509Certificate[] chain,
+ boolean performQCEvaluation) {
+ boolean qc = false;
+ boolean sscd = false;
+
+ // Trustprofile is not TSL enabled - use certificate extensions only
+
+ if (performQCEvaluation) {
+ // perform QC check
+ // try certificate extensions QCP and QcEuCompliance
+ final boolean checkQCP = CertificateUtils.checkQCP(chain[0]);
+ final boolean checkQcEuCompliance = CertificateUtils.checkQcEuCompliance(chain[0]);
+
+ if (checkQCP || checkQcEuCompliance) {
+ qc = true;
+ }
+
+ }
+
+ // perform SSCD check
+ // try certificate extensions QCP+ and QcEuSSCD
+ final boolean checkQCPPlus = CertificateUtils.checkQCPPlus(chain[0]);
+ final boolean checkQcEuSSCD = CertificateUtils.checkQcEuSSCD(chain[0]);
+
+ if (checkQCPPlus || checkQcEuSSCD) {
+ sscd = true;
+ }
+
+ return new QCSSCDResult(qc, false, sscd, false);
+
+ }
+
+ /**
+ * Gets the country from the certificate issuer
+ *
+ * @param cert X509 certificate
+ * @return Country code from the certificate issuer
+ */
+ public static String getIssuerCountry(X509Certificate cert) {
+ String country = null;
+ final Principal issuerdn = cert.getIssuerX500Principal();
+ final RFC2253NameParser nameParser = new RFC2253NameParser(issuerdn.getName());
+
+ try {
+ final Name name = nameParser.parse();
+ country = name.getRDN(ObjectID.country);
+ } catch (final RFC2253NameParserException e) {
+ Logger.warn("Could not get country code from issuer.");
+ }
+
+ return country;
+ }
}
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 859e7e9..be40a9e 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
@@ -12,103 +12,103 @@ import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
public class ExternalURIVerifier {
-
- public static void verify(String host, int port) throws MOAApplicationException {
-
-
- if (host == null)
- return;
- if (host.equalsIgnoreCase(""))
- return;
-
- try {
- ConfigurationProvider config = ConfigurationProvider.getInstance();
-
- boolean allowExternalUris = config.getAllowExternalUris();
- List blacklist = config.getBlackListedUris();
- List whitelist = config.getWhiteListedUris();
-
- InetAddress hostInetAddress = InetAddress.getByName(host);
- String ip = hostInetAddress.getHostAddress();
-
-
- if (allowExternalUris) {
- // external URIs are allowed - check blacklist
- Iterator it = blacklist.iterator();
- while (it.hasNext()) {
- String[] array = (String[])it.next();
- String bhost = array[0];
- String bport = array[1];
- if (bport == null || port == -1) {
- // check only host
- if (ip.startsWith(bhost)) {
- Logger.debug(new LogMsg("Blacklist check: " + host + " (" + ip + ") blacklisted"));
- throw new MOAApplicationException("4002", new Object[]{host + "(" + ip + ")"});
- }
- }
- else {
- // check host and port
- int iport = new Integer(bport).intValue();
- if (ip.startsWith(bhost) && (iport == port)) {
- Logger.debug(new LogMsg("Blacklist check: " + host + ":" + port + " (" + ip + ":" + port + " blacklisted"));
- throw new MOAApplicationException("4002", new Object[]{host + ":" + port + " (" + ip + ":" + port + ")"});
- }
-
- }
- }
- }
- else {
- // external uris are forbidden - check whitelist
- Iterator it = whitelist.iterator();
- boolean allowed = false;
- while (it.hasNext()) {
- String[] array = (String[])it.next();
- String bhost = array[0];
- String bport = array[1];
- if (bport == null || port == -1) {
- // check only host
- if (ip.startsWith(bhost)) {
- Logger.debug(new LogMsg("Whitelist check: " + host + " (" + ip + ") whitelisted"));
- allowed = true;
- //throw new MOAApplicationException("4002", new Object[]{host + "(" + ip + ")"});
- }
- }
- else {
- // check host and port
- int iport = new Integer(bport).intValue();
- if (ip.startsWith(bhost) && (iport == port)) {
- Logger.debug(new LogMsg("Whitelist check: " + host + ":" + port + " (" + ip + ":" + port + " whitelisted"));
- //throw new MOAApplicationException("4002", new Object[]{host + ":" + port + " (" + ip + ":" + port + ")"});
- allowed = true;
- }
-
- }
- }
-
- if (!allowed) {
- if (port != -1) {
- Logger.debug(new LogMsg("No external URIs allowed (" + host + ")"));
- throw new MOAApplicationException("4001", new Object[]{host + "(" + ip + ")"});
- }
- else {
- Logger.debug(new LogMsg("No external URIs allowed (" + host + ":" + port + ")"));
- throw new MOAApplicationException("4001", new Object[]{host + ":" + port + " (" + ip + ":" + port + ")"});
- }
-
- }
-
- }
-
- Logger.debug(new LogMsg("URI allowed: " + ip + ":" + port));
-
- } catch (ConfigurationException e) {
- throw new MOAApplicationException("config.10", null);
- } catch (UnknownHostException e) {
- throw new MOAApplicationException("4003", new Object[]{host});
- }
-
-
-
- }
+
+ public static void verify(String host, int port) throws MOAApplicationException {
+
+ if (host == null) {
+ return;
+ }
+ if (host.equalsIgnoreCase("")) {
+ return;
+ }
+
+ try {
+ final ConfigurationProvider config = ConfigurationProvider.getInstance();
+
+ final boolean allowExternalUris = config.getAllowExternalUris();
+ final List blacklist = config.getBlackListedUris();
+ final List whitelist = config.getWhiteListedUris();
+
+ final InetAddress hostInetAddress = InetAddress.getByName(host);
+ final String ip = hostInetAddress.getHostAddress();
+
+ if (allowExternalUris) {
+ // external URIs are allowed - check blacklist
+ final Iterator it = blacklist.iterator();
+ while (it.hasNext()) {
+ final String[] array = (String[]) it.next();
+ final String bhost = array[0];
+ final String bport = array[1];
+ if (bport == null || port == -1) {
+ // check only host
+ if (ip.startsWith(bhost)) {
+ Logger.debug(new LogMsg("Blacklist check: " + host + " (" + ip + ") blacklisted"));
+ throw new MOAApplicationException("4002", new Object[] { host + "(" + ip + ")" });
+ }
+ } else {
+ // check host and port
+ final int iport = new Integer(bport).intValue();
+ if (ip.startsWith(bhost) && iport == port) {
+ Logger.debug(new LogMsg("Blacklist check: " + host + ":" + port + " (" + ip + ":" + port
+ + " blacklisted"));
+ throw new MOAApplicationException("4002", new Object[] { host + ":" + port + " (" + ip + ":"
+ + port + ")" });
+ }
+
+ }
+ }
+ } else {
+ // external uris are forbidden - check whitelist
+ final Iterator it = whitelist.iterator();
+ boolean allowed = false;
+ while (it.hasNext()) {
+ final String[] array = (String[]) it.next();
+ final String bhost = array[0];
+ final String bport = array[1];
+ if (bport == null || port == -1) {
+ // check only host
+ if (ip.startsWith(bhost)) {
+ Logger.debug(new LogMsg("Whitelist check: " + host + " (" + ip + ") whitelisted"));
+ allowed = true;
+ // throw new MOAApplicationException("4002", new Object[]{host + "(" + ip +
+ // ")"});
+ }
+ } else {
+ // check host and port
+ final int iport = new Integer(bport).intValue();
+ if (ip.startsWith(bhost) && iport == port) {
+ Logger.debug(new LogMsg("Whitelist check: " + host + ":" + port + " (" + ip + ":" + port
+ + " whitelisted"));
+ // throw new MOAApplicationException("4002", new Object[]{host + ":" + port + "
+ // (" + ip + ":" + port + ")"});
+ allowed = true;
+ }
+
+ }
+ }
+
+ if (!allowed) {
+ if (port != -1) {
+ Logger.debug(new LogMsg("No external URIs allowed (" + host + ")"));
+ throw new MOAApplicationException("4001", new Object[] { host + "(" + ip + ")" });
+ } else {
+ Logger.debug(new LogMsg("No external URIs allowed (" + host + ":" + port + ")"));
+ throw new MOAApplicationException("4001", new Object[] { host + ":" + port + " (" + ip + ":"
+ + port + ")" });
+ }
+
+ }
+
+ }
+
+ Logger.debug(new LogMsg("URI allowed: " + ip + ":" + port));
+
+ } catch (final ConfigurationException e) {
+ throw new MOAApplicationException("config.10", null);
+ } catch (final UnknownHostException e) {
+ throw new MOAApplicationException("4003", new Object[] { host });
+ }
+
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/FilteredOutputStream.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/FilteredOutputStream.java
index 3a9fe51..4f33617 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/FilteredOutputStream.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/FilteredOutputStream.java
@@ -6,71 +6,73 @@ import java.io.OutputStream;
import java.math.BigDecimal;
public class FilteredOutputStream extends BufferedOutputStream {
- private BigDecimal from = null;
- private BigDecimal to = null;
- private BigDecimal counter = new BigDecimal("0");
- BigDecimal one = new BigDecimal("1");
-
- public FilteredOutputStream(OutputStream innerStream,
- int bufferSize, BigDecimal from,
- BigDecimal to) {
- super(innerStream, bufferSize);
- this.from = from;
- this.to = to;
- }
+ private BigDecimal from = null;
+ private BigDecimal to = null;
+ private BigDecimal counter = new BigDecimal("0");
+ BigDecimal one = new BigDecimal("1");
- @Override
- public synchronized void write(int b) throws IOException {
- if(!inRange(counter)) {
- super.write(b);
- }
- counter = counter.add(one);
- }
+ public FilteredOutputStream(OutputStream innerStream,
+ int bufferSize, BigDecimal from,
+ BigDecimal to) {
+ super(innerStream, bufferSize);
+ this.from = from;
+ this.to = to;
+ }
- @Override
- public synchronized void write(byte[] b, int off, int len) throws IOException {
- this.filteredWrite(b, off, len);
- }
+ @Override
+ public synchronized void write(int b) throws IOException {
+ if (!inRange(counter)) {
+ super.write(b);
+ }
+ counter = counter.add(one);
+ }
- @Override
- public synchronized void flush() throws IOException {
- super.flush();
- }
+ @Override
+ public synchronized void write(byte[] b, int off, int len) throws IOException {
+ this.filteredWrite(b, off, len);
+ }
- @Override
- public void write(byte[] b) throws IOException {
- if(b != null) {
- this.filteredWrite(b, 0, b.length);
- }
- }
+ @Override
+ public synchronized void flush() throws IOException {
+ super.flush();
+ }
- @Override
- public void close() throws IOException {
- super.close();
- }
-
- private synchronized void filteredWrite(byte[] b, int off, int len) throws IOException {
- for(int i = 0; i < len; i++) {
- if(!inRange(counter)) {
- super.write(b[off+i]);
- }
- counter = counter.add(one);
- }
- }
-
- private boolean inRange(BigDecimal counter) {
- 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;
- }
- }
+ @Override
+ public void write(byte[] b) throws IOException {
+ if (b != null) {
+ this.filteredWrite(b, 0, b.length);
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ super.close();
+ }
+
+ private synchronized void filteredWrite(byte[] b, int off, int len) throws IOException {
+ for (int i = 0; i < len; i++) {
+ if (!inRange(counter)) {
+ super.write(b[off + i]);
+ }
+ counter = counter.add(one);
+ }
+ }
+
+ private boolean inRange(BigDecimal counter) {
+ 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;
+ }
+ }
+ }
}
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 ee6fe0a..047c2bf 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
@@ -36,20 +36,21 @@ import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
import at.gv.egovernment.moaspss.util.Constants;
-
/**
- * An <code>EntityResolver</code> that looks up entities stored as
- * local resources.
- *
- * <p>The following DTDs are mapped to local resources:
+ * An <code>EntityResolver</code> that looks up entities stored as local
+ * resources.
+ *
+ * <p>
+ * The following DTDs are mapped to local resources:
* <ul>
* <li>The XMLSchema.dtd</li>
* <li>The datatypes.dtd</li>
* </ul>
* </p>
- * <p>For all other resources, an attempt is made to resolve them as resources,
+ * <p>
+ * For all other resources, an attempt is made to resolve them as resources,
* either absolute or relative to <code>Constants.SCHEMA_ROOT</code>.
- *
+ *
* @author Patrick Peck
* @author Sven Aigner
*/
@@ -57,65 +58,66 @@ public class MOASPSSEntityResolver implements EntityResolver {
/**
* Resolve an entity.
- *
+ *
* The <code>systemId</code> parameter is used to perform the lookup of the
- * entity as a resource, either by interpreting the <code>systemId</code> as
- * an absolute resource path, or by appending the last path component of
+ * entity as a resource, either by interpreting the <code>systemId</code> as an
+ * absolute resource path, or by appending the last path component of
* <code>systemId</code> to <code>Constants.SCHEMA_ROOT</code>.
- *
+ *
* @param publicId The public ID of the resource.
* @param systemId The system ID of the resource.
* @return An <code>InputSource</code> from which the entity can be read, or
- * <code>null</code>, if the entity could not be found.
- * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
+ * <code>null</code>, if the entity could not be found.
+ * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String,
+ * java.lang.String)
*/
+ @Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
InputStream stream;
int slashPos;
-
+
if (Logger.isDebugEnabled()) {
Logger.debug(
- new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId));
+ 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"));
+ getClass().getResourceAsStream(
+ Constants.SCHEMA_ROOT + "XMLSchema.dtd"));
} else if (publicId.equalsIgnoreCase("datatypes")) {
return new InputSource(
- getClass().getResourceAsStream(
- Constants.SCHEMA_ROOT + "datatypes.dtd"));
+ getClass().getResourceAsStream(
+ Constants.SCHEMA_ROOT + "datatypes.dtd"));
}
} else if (systemId != null) {
// get the URI path
try {
- URI uri = new URI(systemId);
+ final URI uri = new URI(systemId);
systemId = uri.getPath();
-
+
if ("".equals(systemId.trim())) {
return null;
}
-
+
// if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) {
// return null;
// }
ExternalURIVerifier.verify(uri.getHost(), uri.getPort());
-
- } catch (MalformedURIException e) {
+
+ } catch (final MalformedURIException e) {
return null;
- }
- catch (MOAApplicationException e) {
- throw new SAXException(e);
+ } catch (final MOAApplicationException e) {
+ throw new SAXException(e);
}
-
+
// try to get the resource from the full path
stream = getClass().getResourceAsStream(systemId);
if (stream != null) {
- InputSource source = new InputSource(stream);
+ final InputSource source = new InputSource(stream);
source.setSystemId(systemId);
return source;
@@ -126,9 +128,9 @@ public class MOASPSSEntityResolver implements EntityResolver {
if (slashPos >= 0 && systemId.length() > slashPos) {
systemId = systemId.substring(slashPos + 1, systemId.length());
stream =
- getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId);
+ getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId);
if (stream != null) {
- InputSource source = new InputSource(stream);
+ final InputSource source = new InputSource(stream);
source.setSystemId(systemId);
return source;
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 47b8d36..cb83b3a 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
@@ -21,7 +21,6 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.util;
import java.util.Locale;
@@ -30,45 +29,45 @@ import at.gv.egovernment.moaspss.util.Messages;
/**
* Singleton wrapper around a <code>Messages</code> object.
- *
+ *
* @author Patrick Peck
* @version $Id$
*/
public class MessageProvider {
-
- /** The resource names of the messages to load. */
+
+ /** The resource names of the messages to load. */
private static final String[] DEFAULT_MESSAGE_RESOURCES =
- { "resources/properties/spss_messages" };
+ { "resources/properties/spss_messages" };
/** The corresponding message locales. */
private static final Locale[] DEFAULT_MESSAGE_LOCALES =
- new Locale[] { new Locale("de", "AT") };
+ new Locale[] { new Locale("de", "AT") };
/** The single instance of this class. */
private static MessageProvider instance;
-
+
/** The messages provided by the <code>MessageProvider</code>. */
- private Messages messages;
-
+ private final Messages messages;
+
/**
* Return the single instance of the <code>MessageProvider</code>.
- *
+ *
* Intialilizes the <code>MessageProvider</code> with the default message
* locations: <code>/resources/properties/spss_messages</code>.
- *
+ *
* @return The single <code>MessageProvider</code>.
*/
public static synchronized MessageProvider getInstance() {
if (instance == null) {
instance =
- new MessageProvider(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES);
+ new MessageProvider(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES);
}
return instance;
}
/**
* Create a <code>MessageProvider</code>.
- *
+ *
* @param resourceNames The names of the resources containing the messages.
- * @param locales The corresponding locales.
+ * @param locales The corresponding locales.
*/
protected MessageProvider(String[] resourceNames, Locale[] locales) {
this.messages = new Messages(resourceNames, locales);
@@ -77,13 +76,12 @@ public class MessageProvider {
/**
* Get the message corresponding to a given message ID.
*
- * @param messageId The ID of the message.
+ * @param messageId The ID of the message.
* @param parameters The parameters to fill in into the message arguments.
- * @return The formatted message.
+ * @return The formatted message.
*/
public String getMessage(String messageId, Object[] parameters) {
return messages.getMessage(messageId, parameters);
}
-
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/NodeListToNodeSetDataAdapter.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/NodeListToNodeSetDataAdapter.java
index e9b1f7d..9c684b1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/NodeListToNodeSetDataAdapter.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/NodeListToNodeSetDataAdapter.java
@@ -10,17 +10,17 @@ import org.w3c.dom.NodeList;
public class NodeListToNodeSetDataAdapter implements NodeSetData {
- private List list = new ArrayList();
-
- public NodeListToNodeSetDataAdapter(NodeList list) {
- for(int i = 0; i < list.getLength(); i++) {
- this.list.add(list.item(i));
- }
- }
-
- @Override
- public Iterator iterator() {
- return this.list.iterator();
- }
+ private final List list = new ArrayList();
+
+ public NodeListToNodeSetDataAdapter(NodeList list) {
+ for (int i = 0; i < list.getLength(); i++) {
+ this.list.add(list.item(i));
+ }
+ }
+
+ @Override
+ public Iterator iterator() {
+ return this.list.iterator();
+ }
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/QCSSCDResult.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/QCSSCDResult.java
index c00225d..3e8a7fd 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/QCSSCDResult.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/QCSSCDResult.java
@@ -4,50 +4,50 @@ import at.gv.egovernment.moa.spss.api.common.TslInfos;
public class QCSSCDResult {
- private boolean qc;
- private boolean qcSourceTSL;
-
- private boolean sscd;
- private boolean sscdSourceTSL;
-
- private TslInfos tslInfos;
-
-
-
- public QCSSCDResult() {
- this.qc = false;
- this.qcSourceTSL = false;
- this.sscd = false;
- this.sscdSourceTSL = false;
- }
-
- public QCSSCDResult(boolean qc, boolean qcSourceTSL, boolean sscd, boolean sscdSourceTSL) {
- this.qc = qc;
- this.qcSourceTSL = qcSourceTSL;
- this.sscd = sscd;
- this.sscdSourceTSL = sscdSourceTSL;
- }
-
- public boolean isQC() {
- return this.qc;
- }
- public boolean isQCSourceTSL() {
- return this.qcSourceTSL;
- }
- public boolean isSSCD() {
- return this.sscd;
- }
- public boolean isSSCDSourceTSL() {
- return this.sscdSourceTSL;
- }
-
- public TslInfos getTslInfos() {
- return tslInfos;
- }
-
- public void setTslInfos(TslInfos tslInfos) {
- this.tslInfos = tslInfos;
- }
-
-
+ private final boolean qc;
+ private final boolean qcSourceTSL;
+
+ private final boolean sscd;
+ private final boolean sscdSourceTSL;
+
+ private TslInfos tslInfos;
+
+ public QCSSCDResult() {
+ this.qc = false;
+ this.qcSourceTSL = false;
+ this.sscd = false;
+ this.sscdSourceTSL = false;
+ }
+
+ public QCSSCDResult(boolean qc, boolean qcSourceTSL, boolean sscd, boolean sscdSourceTSL) {
+ this.qc = qc;
+ this.qcSourceTSL = qcSourceTSL;
+ this.sscd = sscd;
+ this.sscdSourceTSL = sscdSourceTSL;
+ }
+
+ public boolean isQC() {
+ return this.qc;
+ }
+
+ public boolean isQCSourceTSL() {
+ return this.qcSourceTSL;
+ }
+
+ public boolean isSSCD() {
+ return this.sscd;
+ }
+
+ public boolean isSSCDSourceTSL() {
+ return this.sscdSourceTSL;
+ }
+
+ public TslInfos getTslInfos() {
+ return tslInfos;
+ }
+
+ public void setTslInfos(TslInfos tslInfos) {
+ this.tslInfos = tslInfos;
+ }
+
}
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
index 243cd5d..f0e5326 100644
--- 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
@@ -6,54 +6,54 @@ 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();
- }
+ private final 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/main/java/at/gv/egovernment/moa/spss/util/SecProviderUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/SecProviderUtils.java
index edcac97..12e3837 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/SecProviderUtils.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/SecProviderUtils.java
@@ -7,16 +7,16 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SecProviderUtils {
-
- private static final Logger logger = LoggerFactory.getLogger(SecProviderUtils.class);
-
-
- public static void dumpSecProviders(String message) {
-
- logger.info("Security Providers: {}", message);
-
- for(Provider provider : Security.getProviders()) {
- logger.info(" - {} - {}", provider.getName(), provider.getVersion());
- }
- }
+
+ private static final Logger logger = LoggerFactory.getLogger(SecProviderUtils.class);
+
+ public static void dumpSecProviders(String message) {
+ if (logger.isDebugEnabled()) {
+ logger.info("Security Providers: {}", message);
+ for (final Provider provider : Security.getProviders()) {
+ logger.info(" - {} - {}", provider.getName(), provider.getVersion());
+
+ }
+ }
+ }
}