From 438727ab21b5e80d1771279b988d6aed57ba3ab1 Mon Sep 17 00:00:00 2001 From: tkellner Date: Fri, 13 Dec 2013 04:06:05 +0000 Subject: Add ExcludedByteRange to STAL SignatureRequest, honour it for digest calculation git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1264 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'smccSTAL/src/main/java/at/gv/egiz/bku/smccstal') diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index dba822ea..3026d27a 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -67,7 +67,6 @@ public class SignRequestHandler extends AbstractRequestHandler { private final static Logger log = LoggerFactory.getLogger(SignRequestHandler.class); private final static String CMS_DEF_SIGNEDINFO_ID = "SignedInfo-1"; - private final static String CMS_DEF_OBJECT_ID = "SignatureData-1"; private final static String OID_MESSAGEDIGEST = "1.2.840.113549.1.9.4"; private static JAXBContext jaxbContext; @@ -178,7 +177,6 @@ public class SignRequestHandler extends AbstractRequestHandler { List references = signedInfo.getReference(); ReferenceType reference = new ReferenceType(); reference.setId(HashDataInput.CMS_DEF_REFERENCE_ID); - reference.setURI(CMS_DEF_OBJECT_ID); DigestMethodType digestMethod = new DigestMethodType(); digestMethod.setAlgorithm(signReq.getDigestMethod()); reference.setDigestMethod(digestMethod); @@ -204,6 +202,13 @@ public class SignRequestHandler extends AbstractRequestHandler { throw new SignatureException(e); } reference.setDigestValue(messageDigest); + if (signReq.getExcludedByteRange() != null) { + // Abuse URI to store ExcludedByteRange + String range = "CMSExcludedByteRange:" + + signReq.getExcludedByteRange().getFrom() + "-" + + signReq.getExcludedByteRange().getTo(); + reference.setURI(range); + } references.add(reference); return signedInfo; } -- cgit v1.2.3