summaryrefslogtreecommitdiff
path: root/BKULocal/src/main/java
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-09-17 17:17:10 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-09-17 17:17:10 +0000
commitcf82096145bbdd548e388c1bc25f0e703b9b4624 (patch)
treeae08e610926dd5d5fa1b15df2856427df3e10060 /BKULocal/src/main/java
parent6cafec9a3f05bb5e24c364e51a336326a63b8296 (diff)
downloadmocca-cf82096145bbdd548e388c1bc25f0e703b9b4624.tar.gz
mocca-cf82096145bbdd548e388c1bc25f0e703b9b4624.tar.bz2
mocca-cf82096145bbdd548e388c1bc25f0e703b9b4624.zip
hashdatainput digest verification
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@44 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKULocal/src/main/java')
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java
index f8546e49..a288a716 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java
@@ -29,7 +29,10 @@ import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
import at.gv.egiz.stal.SignRequest;
+import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
import at.gv.egiz.stal.signedinfo.ReferenceType;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
/**
*
@@ -55,7 +58,7 @@ public class LocalSignRequestHandler extends SignRequestHandler {
}
@Override
- protected List<HashDataInput> getHashDataInputs(
+ public List<HashDataInput> getCashedHashDataInputs(
List<ReferenceType> dsigReferences) throws Exception {
ArrayList<HashDataInput> result = new ArrayList<HashDataInput>();
for (ReferenceType dsigRef : dsigReferences) {
@@ -65,7 +68,14 @@ public class LocalSignRequestHandler extends SignRequestHandler {
if (dsigRefId != null) {
for (HashDataInput hdi : hashDataInput) {
if (hdi.getReferenceId().equals(dsigRefId)) {
- result.add(hdi);
+ InputStream hdIs = hdi.getHashDataInput();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(hdIs.available());
+ int b;
+ while ((b = hdIs.read()) != -1) {
+ baos.write(b);
+ }
+ ByteArrayHashDataInput baHdi = new ByteArrayHashDataInput(baos.toByteArray(), hdi.getReferenceId(), hdi.getMimeType(), hdi.getEncoding());
+ result.add(baHdi);
}
}
} else {