summaryrefslogtreecommitdiff
path: root/smccSTAL/src/main/java/at
diff options
context:
space:
mode:
authormcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-11-11 15:51:08 +0000
committermcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-11-11 15:51:08 +0000
commit68941b57df2caeead67a5bede2ef5a635d07db32 (patch)
tree78c93c71a20b4775af3991f4395c2267cc39fab8 /smccSTAL/src/main/java/at
parentcaca721368d8c24559b1cd5ea2018884b4874f6b (diff)
downloadmocca-68941b57df2caeead67a5bede2ef5a635d07db32.tar.gz
mocca-68941b57df2caeead67a5bede2ef5a635d07db32.tar.bz2
mocca-68941b57df2caeead67a5bede2ef5a635d07db32.zip
Added support for SHA-256 and partial support for e-card G3, BELPIC and Italian cards.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@540 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smccSTAL/src/main/java/at')
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java21
1 files changed, 6 insertions, 15 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 560f1373..58d7b305 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
@@ -18,9 +18,8 @@ package at.gv.egiz.bku.smccstal;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.io.InputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
@@ -44,7 +43,6 @@ import at.gv.egiz.stal.SignRequest;
import at.gv.egiz.stal.SignResponse;
import at.gv.egiz.stal.signedinfo.ObjectFactory;
import at.gv.egiz.stal.signedinfo.SignedInfoType;
-import at.gv.egiz.stal.util.JCEAlgorithmNames;
public class SignRequestHandler extends AbstractRequestHandler {
@@ -77,18 +75,11 @@ public class SignRequestHandler extends AbstractRequestHandler {
JAXBElement<SignedInfoType> si = (JAXBElement<SignedInfoType>) unmarshaller.unmarshal(is);
String signatureMethod = si.getValue().getSignatureMethod().getAlgorithm();
log.debug("Found signature method: " + signatureMethod);
- String jceName = JCEAlgorithmNames.getJCEHashName(signatureMethod);
- if (jceName == null) {
- log.error("Hash algorithm not supported:");
- return new ErrorResponse(4006);
- }
- MessageDigest md = MessageDigest.getInstance(jceName);
- md.update(signReq.getSignedInfo());
KeyboxName kb = SignatureCard.KeyboxName.getKeyboxName(signReq.getKeyIdentifier());
- byte[] resp = card.createSignature(md.digest(), kb,
+ byte[] resp = card.createSignature(new ByteArrayInputStream(signReq.getSignedInfo()), kb,
new PINProviderFactory(card.getReader(), gui)
- .getSignaturePINProvider(secureViewer, si.getValue()));
+ .getSignaturePINProvider(secureViewer, si.getValue()), signatureMethod);
if (resp == null) {
return new ErrorResponse(6001);
}
@@ -127,9 +118,9 @@ public class SignRequestHandler extends AbstractRequestHandler {
} catch (JAXBException e) {
log.error("Cannot unmarshall signed info", e);
return new ErrorResponse(1000);
- } catch (NoSuchAlgorithmException e) {
- log.error(e);
- return new ErrorResponse(1000);
+ } catch (IOException e) {
+ log.error("Error while creating signature: " + e);
+ return new ErrorResponse(4000);
}
} else {
log.fatal("Got unexpected STAL request: " + request);