diff options
author | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2013-12-13 01:26:39 +0000 |
---|---|---|
committer | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2013-12-13 01:26:39 +0000 |
commit | d311d0f7b7ef9ed5bc383d6744b7d61239aafbc1 (patch) | |
tree | b48a211d1a907ad7af72027b2b2709ecd540b27c /bkucommon | |
parent | 8d597612c69c77982c981f711f549bc826b06fd8 (diff) | |
download | mocca-d311d0f7b7ef9ed5bc383d6744b7d61239aafbc1.tar.gz mocca-d311d0f7b7ef9ed5bc383d6744b7d61239aafbc1.tar.bz2 mocca-d311d0f7b7ef9ed5bc383d6744b7d61239aafbc1.zip |
Extend STAL to support CMS SignedAttributes
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1262 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'bkucommon')
3 files changed, 12 insertions, 6 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/STALSecurityProvider.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/STALSecurityProvider.java index cdd8f111..0a2140c3 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/STALSecurityProvider.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/STALSecurityProvider.java @@ -27,6 +27,7 @@ import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.SignRequest.SignedInfo; import at.gv.egiz.stal.SignResponse; public class STALSecurityProvider extends IaikProvider { @@ -89,8 +90,10 @@ public class STALSecurityProvider extends IaikProvider { SignRequest signRequest = new SignRequest(); signRequest.setKeyIdentifier(keyboxIdentifier); log.debug("SignedAttributes: " + Util.toBase64String(signedAttributes)); - signRequest.setSignedInfo(signedAttributes); - signRequest.setSignedInfoIsCMSSignedAttributes(true); + SignedInfo signedInfo = new SignedInfo(); + signedInfo.setValue(signedAttributes); + signedInfo.setIsCMSSignedAttributes(true); + signRequest.setSignedInfo(signedInfo); signRequest.setSignatureMethod(signatureMethod); signRequest.setHashDataInput(hashDataInput); return signRequest; diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureMethod.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureMethod.java index 51c6c805..1a6f6df9 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureMethod.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureMethod.java @@ -25,6 +25,8 @@ package at.gv.egiz.bku.slcommands.impl.xsect; +import iaik.xml.crypto.dsig.AbstractSignatureMethodImpl; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -48,10 +50,9 @@ import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.SignRequest.SignedInfo; import at.gv.egiz.stal.SignResponse; -import iaik.xml.crypto.dsig.AbstractSignatureMethodImpl; - public class STALSignatureMethod extends AbstractSignatureMethodImpl { /** @@ -99,7 +100,9 @@ public class STALSignatureMethod extends AbstractSignatureMethodImpl { SignRequest signRequest = new SignRequest(); signRequest.setKeyIdentifier(keyboxIdentifier); - signRequest.setSignedInfo(m.toByteArray()); + SignedInfo signedInfo = new SignedInfo(); + signedInfo.setValue(m.toByteArray()); + signRequest.setSignedInfo(signedInfo); signRequest.setHashDataInput(hashDataInputs); List<STALResponse> responses = diff --git a/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java index 853505ce..61d0d480 100644 --- a/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java +++ b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java @@ -137,7 +137,7 @@ public class DummySTAL implements STAL { SignRequest signReq = (SignRequest) request; Signature s = Signature.getInstance("SHA1withRSA"); s.initSign(privateKey); - s.update(signReq.getSignedInfo()); + s.update(signReq.getSignedInfo().getValue()); byte[] sigVal = s.sign(); SignResponse resp = new SignResponse(); resp.setSignatureValue(sigVal); |