summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--STAL/src/main/java/at/gv/egiz/stal/SignRequest.java20
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java24
2 files changed, 41 insertions, 3 deletions
diff --git a/STAL/src/main/java/at/gv/egiz/stal/SignRequest.java b/STAL/src/main/java/at/gv/egiz/stal/SignRequest.java
index 88b45b19..a649d3ba 100644
--- a/STAL/src/main/java/at/gv/egiz/stal/SignRequest.java
+++ b/STAL/src/main/java/at/gv/egiz/stal/SignRequest.java
@@ -65,6 +65,10 @@ public class SignRequest
protected byte[] signedInfo;
@XmlTransient
protected List<HashDataInput> hashData;
+ @XmlTransient
+ protected boolean signedInfoIsRawData = false;
+ @XmlTransient
+ protected String signatureMethod;
/**
* Gets the value of the keyIdentifier property.
@@ -119,4 +123,20 @@ public class SignRequest
public void setHashDataInput(List<HashDataInput> hashData) {
this.hashData = hashData;
}
+
+ public boolean getSignedInfoIsRawData() {
+ return signedInfoIsRawData;
+ }
+
+ public void setSignedInfoIsRawData(boolean signedInfoIsRawData) {
+ this.signedInfoIsRawData = signedInfoIsRawData;
+ }
+
+ public String getSignatureMethod() {
+ return signatureMethod;
+ }
+
+ public void setSignatureMethod(String signatureMethod) {
+ this.signatureMethod = signatureMethod;
+ }
}
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);
}