diff options
Diffstat (limited to 'spss/server/serverlib')
16 files changed, 199 insertions, 99 deletions
diff --git a/spss/server/serverlib/.settings/org.eclipse.jdt.core.prefs b/spss/server/serverlib/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index dc0892a32..000000000 --- a/spss/server/serverlib/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/spss/server/serverlib/.settings/org.eclipse.wst.common.component b/spss/server/serverlib/.settings/org.eclipse.wst.common.component deleted file mode 100644 index fe4fd3290..000000000 --- a/spss/server/serverlib/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
- <wb-module deploy-name="moa-spss-lib">
- <wb-resource deploy-path="/" source-path="src/main/java"/>
- <wb-resource deploy-path="/" source-path="src/main/resources"/>
- <wb-resource deploy-path="/" source-path="/src/main/java"/>
- <wb-resource deploy-path="/" source-path="/src/main/resources"/>
- </wb-module>
-</project-modules>
diff --git a/spss/server/serverlib/.settings/org.eclipse.wst.common.project.facet.core.xml b/spss/server/serverlib/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 656f15b87..000000000 --- a/spss/server/serverlib/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
- <fixed facet="jst.java"/>
- <fixed facet="jst.utility"/>
- <installed facet="jst.utility" version="1.0"/>
- <installed facet="jst.java" version="5.0"/>
-</faceted-project>
\ No newline at end of file diff --git a/spss/server/serverlib/.settings/org.maven.ide.eclipse.prefs b/spss/server/serverlib/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index 7f28ca3cd..000000000 --- a/spss/server/serverlib/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,8 +0,0 @@ -activeProfiles=
-eclipse.preferences.version=1
-fullBuildGoals=process-test-resources
-includeModules=false
-resolveWorkspaceProjects=true
-resourceFilterGoals=process-resources resources\:testResources
-skipCompilerPlugin=true
-version=1
diff --git a/spss/server/serverlib/moa-spss-lib.iml b/spss/server/serverlib/moa-spss-lib.iml index 1601f060b..0652af183 100644 --- a/spss/server/serverlib/moa-spss-lib.iml +++ b/spss/server/serverlib/moa-spss-lib.iml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> +<module type="JAVA_MODULE" version="4"> <component name="FacetManager"> <facet type="web" name="Web"> <configuration> @@ -44,7 +44,7 @@ </configuration> </facet> </component> - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false"> + <component name="NewModuleRootManager" inherit-compiler-output="false"> <output url="file://$MODULE_DIR$/../../target/classes" /> <output-test url="file://$MODULE_DIR$/../../target/test-classes" /> <content url="file://$MODULE_DIR$"> @@ -56,44 +56,6 @@ <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="library" scope="TEST" name="Maven: MOA:moa-common:test-jar:tests:2.0" level="project" /> - <orderEntry type="library" name="Maven: axis:axis:1.0_IAIK" level="project" /> - <orderEntry type="library" name="Maven: org.apache.axis:axis-jaxrpc:1.4" level="project" /> - <orderEntry type="library" name="Maven: org.apache.axis:axis-saaj:1.4" level="project" /> - <orderEntry type="library" name="Maven: axis:axis-wsdl4j:1.5.1" level="project" /> - <orderEntry type="library" name="Maven: commons-discovery:commons-discovery:0.2" level="project" /> - <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.0.4" level="project" /> - <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" /> - <orderEntry type="library" name="Maven: javax.mail:mail:1.4" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" /> - <orderEntry type="library" name="Maven: log4j:log4j:1.2.14" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: postgresql:postgresql:7.2" level="project" /> - <orderEntry type="library" name="Maven: javax.servlet:servlet-api:2.4" level="project" /> - <orderEntry type="library" name="Maven: xalan-bin-dist:xalan:2.7.1" level="project" /> - <orderEntry type="library" name="Maven: xalan:serializer:2.7.1" level="project" /> - <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.3.04" level="project" /> - <orderEntry type="library" name="Maven: xerces:xercesImpl:2.9.0" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: xalan-bin-dist:xml-apis:2.7.1" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: xalan-bin-dist:serializer:2.7.1" level="project" /> - <orderEntry type="library" name="Maven: iaik.prod:iaik_moa:1.5" level="project" /> - <orderEntry type="library" name="Maven: iaik.prod:iaik_ixsil:1.2.2.5" level="project" /> - <orderEntry type="library" name="Maven: iaik.prod:iaik_jce_full:5.101" level="project" /> - <orderEntry type="library" name="Maven: iaik.prod:iaik_ecc:2.19" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: iaik.prod:iaik_cms:4.1_MOA" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: iaik.prod:iaik_Pkcs11Provider:1.2.4" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: iaik.prod:iaik_Pkcs11Wrapper:1.2.17" level="project" /> - <orderEntry type="module" module-name="moa-common" /> - <orderEntry type="library" name="Maven: jaxen:jaxen:1.0-FCS" level="project" /> - <orderEntry type="library" name="Maven: saxpath:saxpath:1.0-FCS" level="project" /> - <orderEntry type="library" name="Maven: joda-time:joda-time:1.6.2" level="project" /> - <orderEntry type="module" module-name="moa-common" scope="TEST" production-on-test="" /> - <orderEntry type="module" module-name="moa-spss-tools" scope="TEST" /> - <orderEntry type="library" name="Maven: iaik.prod:iaik_tsl:0.0.2-SNAPSHOT" level="project" /> - <orderEntry type="library" name="Maven: iaik.prod:iaik_util:0.23" level="project" /> - <orderEntry type="library" name="Maven: iaik.prod:iaik_xsect:1.1709142" level="project" /> - <orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.2.6" level="project" /> - <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.2.5" level="project" /> - <orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.7.8-SNAPSHOT" level="project" /> - <orderEntry type="library" name="Maven: iaik.prod:iaik_jsse:4.4" level="project" /> </component> </module> diff --git a/spss/server/serverlib/pom.xml b/spss/server/serverlib/pom.xml index 21fe5fb40..1c756d4d4 100644 --- a/spss/server/serverlib/pom.xml +++ b/spss/server/serverlib/pom.xml @@ -2,13 +2,14 @@ <parent>
<groupId>MOA.spss</groupId>
<artifactId>moa-spss</artifactId>
- <version>1.5.2</version>
+ <version>2.0.x</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>MOA.spss.server</groupId>
<artifactId>moa-spss-lib</artifactId>
<packaging>jar</packaging>
+ <version>2.0.0</version>
<name>MOA SP/SS API</name>
<properties>
@@ -134,11 +135,10 @@ <artifactId>moa-common</artifactId>
<type>test-jar</type>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>MOA.spss.server</groupId>
<artifactId>moa-spss-tools</artifactId>
- <version>1.5.2</version>
<scope>test</scope>
</dependency>
diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java index b5cc96a04..d41891167 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java @@ -25,6 +25,7 @@ package at.gv.egovernment.moa.spss.api; import java.io.InputStream; +import java.math.BigDecimal; import java.math.BigInteger; import java.security.cert.X509Certificate; import java.util.Date; @@ -481,7 +482,9 @@ public abstract class SPSSFactory { */ public abstract CMSDataObject createCMSDataObject( MetaInfo metaInfo, - CMSContent content); + CMSContent content, + BigDecimal excludeByteRangeFrom, + BigDecimal excludeByteRangeTo); /** * Create a new <code>CMSContent</code> object from the data contained at the diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java index 0c4b2ce6d..f9a684676 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/cmsverify/CMSDataObject.java @@ -24,6 +24,8 @@ package at.gv.egovernment.moa.spss.api.cmsverify; +import java.math.BigDecimal; + import at.gv.egovernment.moa.spss.api.common.MetaInfo; /** @@ -46,4 +48,10 @@ public interface CMSDataObject { * @return The actual content. */ public CMSContent getContent(); -} + + + public BigDecimal getExcludeByteRangeFrom(); + + public BigDecimal getExcludeByteRangeTo(); + + } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java index 0e89885c8..20a9b5654 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/CMSDataObjectImpl.java @@ -24,6 +24,8 @@ package at.gv.egovernment.moa.spss.api.impl; +import java.math.BigDecimal; + import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; import at.gv.egovernment.moa.spss.api.common.MetaInfo; @@ -40,6 +42,9 @@ public class CMSDataObjectImpl implements CMSDataObject { 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. @@ -67,4 +72,20 @@ public class CMSDataObjectImpl implements CMSDataObject { return cmsContent; } + public void setExcludeByteRangeFrom(BigDecimal excludeByteRangeFrom) { + this.excludeByteRangeFrom = excludeByteRangeFrom; + } + + public BigDecimal getExcludeByteRangeFrom() { + return excludeByteRangeFrom; + } + + public void setExcludeByteRangeTo(BigDecimal excludeByteRangeTo) { + this.excludeByteRangeTo = excludeByteRangeTo; + } + + public BigDecimal getExcludeByteRangeTo() { + return excludeByteRangeTo; + } + } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java index 8e3bb7636..ac3d4c940 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java @@ -25,7 +25,7 @@ package at.gv.egovernment.moa.spss.api.impl; import java.io.InputStream; - +import java.math.BigDecimal; import java.math.BigInteger; import java.security.cert.X509Certificate; import java.util.Date; @@ -273,11 +273,15 @@ public class SPSSFactoryImpl extends SPSSFactory { public CMSDataObject createCMSDataObject( MetaInfo metaInfo, - CMSContent content) { + CMSContent content, + BigDecimal excludeByteRangeFrom, + BigDecimal excludeByteRangeTo) { CMSDataObjectImpl cmsDataObject = new CMSDataObjectImpl(); cmsDataObject.setMetaInfo(metaInfo); cmsDataObject.setContent(content); + cmsDataObject.setExcludeByteRangeFrom(excludeByteRangeFrom); + cmsDataObject.setExcludeByteRangeTo(excludeByteRangeTo); return cmsDataObject; } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureRequestParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureRequestParser.java index 737915ecd..a8cae9c4e 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureRequestParser.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/CreateCMSSignatureRequestParser.java @@ -25,6 +25,7 @@ package at.gv.egovernment.moa.spss.api.xmlbind; import java.io.InputStream; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -38,7 +39,6 @@ import at.gv.egovernment.moa.spss.api.cmssign.DataObjectInfo; import at.gv.egovernment.moa.spss.api.cmssign.SingleSignatureInfo; import at.gv.egovernment.moa.spss.api.cmsverify.CMSContent; import at.gv.egovernment.moa.spss.api.cmsverify.CMSDataObject; -import at.gv.egovernment.moa.spss.api.common.Content; import at.gv.egovernment.moa.spss.api.common.MetaInfo; import at.gv.egovernment.moa.util.Base64Utils; import at.gv.egovernment.moa.util.BoolUtils; @@ -71,6 +71,9 @@ public class CreateCMSSignatureRequestParser { 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. */ @@ -212,7 +215,18 @@ public class CreateCMSSignatureRequestParser { metaInfo = RequestParserUtils.parseMetaInfo(metaInfoElem); } - return factory.createCMSDataObject(metaInfo, content); + String excludeByteRangeFromStr = XPathUtils.getElementValue(dataObjectElem, EXCLUDEBYTERANGE_FROM_XPATH, null); + 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); + + return factory.createCMSDataObject(metaInfo, content, excludeByteRangeFrom, excludeByteRangeTo); } else { return null; diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java index d50a17ffc..6209d8ef9 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParser.java @@ -25,6 +25,7 @@ package at.gv.egovernment.moa.spss.api.xmlbind; import java.io.InputStream; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -65,6 +66,9 @@ public class VerifyCMSSignatureRequestParser { 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 <code>SPSSFactory</code> for creating new API objects. */ private SPSSFactory factory = SPSSFactory.getInstance(); @@ -161,7 +165,20 @@ public class VerifyCMSSignatureRequestParser { metaInfo = RequestParserUtils.parseMetaInfo(metaInfoElem); } - return factory.createCMSDataObject(metaInfo, content); + String excludeByteRangeFromStr = XPathUtils.getElementValue(dataObjectElem, EXCLUDEBYTERANGE_FROM_XPATH, null); + 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); + + return factory.createCMSDataObject(metaInfo, content, excludeByteRangeFrom, excludeByteRangeTo); + + } else { return null; } diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureCreationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureCreationInvoker.java index e058c8a4b..718673a93 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureCreationInvoker.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureCreationInvoker.java @@ -38,6 +38,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.math.BigDecimal; import java.math.BigInteger; import java.security.Principal; import java.security.cert.X509Certificate; @@ -51,8 +52,6 @@ import java.util.Set; import at.gv.egovernment.moa.logging.LogMsg; import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.logging.LoggingContext; -import at.gv.egovernment.moa.logging.LoggingContextManager; import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.MOAException; import at.gv.egovernment.moa.spss.MOASystemException; @@ -238,12 +237,32 @@ public class CMSSignatureCreationInvoker { OutputStream signedDataStream = signature.getSignature(out, base64); // now write the data to be signed to the signedDataStream - byte[] buf = new byte[4096]; - int bytesRead; - while ((bytesRead = contentIs.read(buf)) >= 0) { - signedDataStream.write(buf, 0, bytesRead); - } - + + int byteRead; + BigDecimal counter = new BigDecimal("0"); + BigDecimal one = new BigDecimal("1"); + + while ((byteRead=contentIs.read()) >= 0) { + //System.out.println("counterXX: " + counter); + + if (inRange(counter, dataobject)) { + //System.out.println("Lösche..."); + // set byte to 0x00 + signedDataStream.write(0); + } + else + signedDataStream.write(byteRead); + + counter = counter.add(one); + } + + +// 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(); @@ -269,6 +288,28 @@ public class CMSSignatureCreationInvoker { 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; + } + + + + } private String getDigestAlgorithm(ConfigurationProvider config, String keyGroupID) throws MOASystemException { diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java index 7a4103957..0e5faf790 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java @@ -31,17 +31,16 @@ import iaik.server.modules.cmsverify.CMSSignatureVerificationModuleFactory; import iaik.server.modules.cmsverify.CMSSignatureVerificationProfile; import iaik.server.modules.cmsverify.CMSSignatureVerificationResult; import iaik.x509.X509Certificate; -import iaik.xml.crypto.tsl.ex.TSLEngineDiedException; -import iaik.xml.crypto.tsl.ex.TSLSearchException; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.math.BigDecimal; import java.util.Date; import java.util.Iterator; import java.util.List; -import at.gv.egovernment.moa.logging.LogMsg; -import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.logging.LoggingContext; import at.gv.egovernment.moa.logging.LoggingContextManager; import at.gv.egovernment.moa.spss.MOAApplicationException; @@ -57,9 +56,7 @@ import at.gv.egovernment.moa.spss.server.logging.IaikLog; import at.gv.egovernment.moa.spss.server.logging.TransactionId; import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; -import at.gv.egovernment.moa.spss.tsl.timer.TSLUpdaterTimerTask; import at.gv.egovernment.moa.spss.util.CertificateUtils; -import at.gv.egovernment.moa.spss.util.MessageProvider; import at.gv.egovernment.moa.spss.util.QCSSCDResult; /** @@ -273,6 +270,7 @@ public class CMSSignatureVerificationInvoker { private InputStream getSignedContent(VerifyCMSSignatureRequest request) throws MOAApplicationException { + InputStream is = null; CMSDataObject dataObj; CMSContent content; @@ -282,23 +280,86 @@ public class CMSSignatureVerificationInvoker { return null; } content = dataObj.getContent(); - + // build the content data switch (content.getContentType()) { case CMSContent.EXPLICIT_CONTENT : - return ((CMSContentExcplicit) content).getBinaryContent(); + 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(); - return resolver.resolve(reference); + 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(); + + + BigDecimal counter = new BigDecimal("0"); + BigDecimal one = new BigDecimal("1"); + + try { + while ((byteRead=contentIs.read()) >= 0) { + + if (inRange(counter, request.getDataObject())) { + // 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; + } + + + } } diff --git a/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.5.2.wsdl b/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-2.0.0.wsdl index be40c110d..f9b942a51 100644 --- a/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.5.2.wsdl +++ b/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-2.0.0.wsdl @@ -3,7 +3,7 @@ Web Service Description for MOA SP/SS 1.4
-->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://reference.e-government.gv.at/namespace/moa/20020822#" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:moa="http://reference.e-government.gv.at/namespace/moa/20020822#" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MOA" targetNamespace="http://reference.e-government.gv.at/namespace/moa/20020822#">
- <import namespace="http://reference.e-government.gv.at/namespace/moa/20020822#" location="../resources/schemas/MOA-SPSS-1.5.2.xsd"/>
+ <import namespace="http://reference.e-government.gv.at/namespace/moa/20020822#" location="../resources/schemas/MOA-SPSS-2.0.0.xsd"/>
<message name="CreateCMSSignatureInput">
<part name="body" element="moa:CreateCMSSignatureRequest"/>
</message>
diff --git a/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.5.2.xsd b/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-2.0.0.xsd index 4ae327ab3..4ae327ab3 100644 --- a/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-1.5.2.xsd +++ b/spss/server/serverlib/src/main/resources/resources/wsdl/MOA-SPSS-2.0.0.xsd |