diff options
author | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2013-11-28 13:23:28 +0000 |
---|---|---|
committer | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2013-11-28 13:23:28 +0000 |
commit | cabc42be1db17af1f7931544f50e0019959da49b (patch) | |
tree | 6b2ffb0e3dfc2a5559a4ce5eaf48240b64f9451e /smccSTAL/src/main/java | |
parent | 624dc3a0b6ef39948b9e78841ef7f75f27fee8da (diff) | |
download | mocca-cabc42be1db17af1f7931544f50e0019959da49b.tar.gz mocca-cabc42be1db17af1f7931544f50e0019959da49b.tar.bz2 mocca-cabc42be1db17af1f7931544f50e0019959da49b.zip |
Extend SignRequest to allow non-XML-Signatures
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1235 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smccSTAL/src/main/java')
-rw-r--r-- | smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java | 24 |
1 files changed, 21 insertions, 3 deletions
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 41ef90a5..10b2e191 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 @@ -50,7 +50,9 @@ import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; import at.gv.egiz.stal.SignResponse; +import at.gv.egiz.stal.signedinfo.CanonicalizationMethodType; import at.gv.egiz.stal.signedinfo.ObjectFactory; +import at.gv.egiz.stal.signedinfo.SignatureMethodType; import at.gv.egiz.stal.signedinfo.SignedInfoType; public class SignRequestHandler extends AbstractRequestHandler { @@ -89,13 +91,29 @@ public class SignRequestHandler extends AbstractRequestHandler { try { Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); InputStream is = new ByteArrayInputStream(signReq.getSignedInfo()); - JAXBElement<SignedInfoType> si = (JAXBElement<SignedInfoType>) unmarshaller.unmarshal(is); - String signatureMethod = si.getValue().getSignatureMethod().getAlgorithm(); + + SignedInfoType signedInfo; + if (signReq.getSignedInfoIsRawData()) { + signedInfo = new SignedInfoType(); + CanonicalizationMethodType canonicalizationMethod = + new CanonicalizationMethodType(); + canonicalizationMethod.setAlgorithm(""); + SignatureMethodType signatureMethod = new SignatureMethodType(); + signatureMethod.setAlgorithm(signReq.getSignatureMethod()); + signedInfo.setCanonicalizationMethod(canonicalizationMethod); + signedInfo.setSignatureMethod(signatureMethod); + signedInfo.setId(""); + } else { + JAXBElement<SignedInfoType> si = + (JAXBElement<SignedInfoType>) unmarshaller.unmarshal(is); + signedInfo = si.getValue(); + } + String signatureMethod = signedInfo.getSignatureMethod().getAlgorithm(); log.debug("Found signature method: {}.", signatureMethod); KeyboxName kb = SignatureCard.KeyboxName.getKeyboxName(signReq.getKeyIdentifier()); byte[] resp = card.createSignature(new ByteArrayInputStream(signReq.getSignedInfo()), kb, - new SignPINGUI(gui, secureViewer, si.getValue()), signatureMethod); + new SignPINGUI(gui, secureViewer, signedInfo), signatureMethod); if (resp == null) { return errorResponse(6001, "Response is null", null); } |