summaryrefslogtreecommitdiff
path: root/STALService/src/main/java/at/gv/egiz/stal/util
diff options
context:
space:
mode:
authorwbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-08 08:39:17 +0000
committerwbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-08 08:39:17 +0000
commit27d91275555207f9e152c2867d52fbbf83f92ba7 (patch)
tree27798cbea71918278dc04c9a3e4e309f05956888 /STALService/src/main/java/at/gv/egiz/stal/util
parent35364f7492308692bd690c17f5527f4157eb583a (diff)
downloadmocca-27d91275555207f9e152c2867d52fbbf83f92ba7.tar.gz
mocca-27d91275555207f9e152c2867d52fbbf83f92ba7.tar.bz2
mocca-27d91275555207f9e152c2867d52fbbf83f92ba7.zip
changed ssl certificate validation, now using iaik_pki
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@83 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'STALService/src/main/java/at/gv/egiz/stal/util')
-rw-r--r--STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java b/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
new file mode 100644
index 00000000..dda20968
--- /dev/null
+++ b/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
@@ -0,0 +1,67 @@
+package at.gv.egiz.stal.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.utils.StreamUtil;
+import at.gv.egiz.stal.HashDataInput;
+
+/**
+ * Enables multiple read requests.
+ *
+ */
+public class HashDataInputProxy implements HashDataInput {
+
+ private static Log log = LogFactory.getLog(HashDataInputProxy.class);
+
+ private HashDataInput delegate;
+ private byte[] hashInput;
+
+ /**
+ *
+ * @param delegate
+ * != null
+ */
+ public HashDataInputProxy(HashDataInput delegate) {
+ if (delegate == null) {
+ throw new NullPointerException("Constructor argument must not be null");
+ }
+ this.delegate = delegate;
+ }
+
+ @Override
+ public String getEncoding() {
+ return delegate.getEncoding();
+ }
+
+ @Override
+ public InputStream getHashDataInput() {
+ if (hashInput == null) {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ try {
+ StreamUtil.copyStream(delegate.getHashDataInput(), os);
+ hashInput = os.toByteArray();
+ } catch (IOException e) {
+ log.error("Cannot access hashdatainput stream", e);
+ hashInput = new byte[0];
+ }
+ }
+ return new ByteArrayInputStream(hashInput);
+ }
+
+ @Override
+ public String getMimeType() {
+ return delegate.getMimeType();
+ }
+
+ @Override
+ public String getReferenceId() {
+ return delegate.getReferenceId();
+ }
+
+}