From d311d0f7b7ef9ed5bc383d6744b7d61239aafbc1 Mon Sep 17 00:00:00 2001 From: tkellner Date: Fri, 13 Dec 2013 01:26:39 +0000 Subject: Extend STAL to support CMS SignedAttributes git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1262 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../stal/service/translator/STALTranslator.java | 13 +- .../gv/egiz/stal/service/types/ObjectFactory.java | 8 ++ .../egiz/stal/service/types/SignRequestType.java | 137 +++++++++++++++++++-- 3 files changed, 148 insertions(+), 10 deletions(-) (limited to 'STALService/src/main') diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java index 26eeaf55..28d60ed6 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java @@ -41,6 +41,7 @@ import at.gv.egiz.stal.QuitRequest; 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 at.gv.egiz.stal.StatusRequest; import at.gv.egiz.stal.StatusResponse; @@ -218,7 +219,11 @@ public class STALTranslator { if (request instanceof SignRequest) { SignRequestType req = of.createSignRequestType(); req.setKeyIdentifier(((SignRequest) request).getKeyIdentifier()); - req.setSignedInfo(((SignRequest) request).getSignedInfo()); + SignRequestType.SignedInfo signedInfo = of.createSignRequestTypeSignedInfo(); + signedInfo.setValue(((SignRequest) request).getSignedInfo().getValue()); + signedInfo.setIsCMSSignedAttributes(((SignRequest) request).getSignedInfo().isIsCMSSignedAttributes()); + req.setSignedInfo(signedInfo); + req.setSignatureMethod(((SignRequest) request).getSignatureMethod()); //TODO add hashdatainput (refactor signRequestType) return of.createGetNextRequestResponseTypeSignRequest(req); } else if (request instanceof InfoboxReadRequest) { @@ -245,7 +250,11 @@ public class STALTranslator { } else if (request instanceof SignRequestType) { SignRequest stalReq = new SignRequest(); stalReq.setKeyIdentifier(((SignRequestType) request).getKeyIdentifier()); - stalReq.setSignedInfo(((SignRequestType) request).getSignedInfo()); + SignedInfo signedInfo = new SignedInfo(); + signedInfo.setValue(((SignRequestType) request).getSignedInfo().getValue()); + signedInfo.setIsCMSSignedAttributes(((SignRequestType) request).getSignedInfo().isIsCMSSignedAttributes()); + stalReq.setSignedInfo(signedInfo); + stalReq.setSignatureMethod(((SignRequestType) request).getSignatureMethod()); return stalReq; } else if (request instanceof QuitRequestType) { return new QuitRequest(); diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/ObjectFactory.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/ObjectFactory.java index 90479808..f3b00402 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/types/ObjectFactory.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/ObjectFactory.java @@ -120,6 +120,14 @@ public class ObjectFactory { return new SignRequestType(); } + /** + * Create an instance of {@link SignRequestType.SignedInfo } + * + */ + public SignRequestType.SignedInfo createSignRequestTypeSignedInfo() { + return new SignRequestType.SignedInfo(); + } + /** * Create an instance of {@link GetHashDataInputType.Reference } * diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/SignRequestType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/SignRequestType.java index 8249491c..50a00406 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/types/SignRequestType.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/SignRequestType.java @@ -27,8 +27,10 @@ package at.gv.egiz.stal.service.types; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; /** @@ -49,7 +51,16 @@ import javax.xml.bind.annotation.XmlType; * </restriction> * </simpleType> * </element> - * <element name="SignedInfo" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> + * <element name="SignedInfo"> + * <complexType> + * <simpleContent> + * <extension base="<http://www.w3.org/2001/XMLSchema>base64Binary"> + * <attribute name="IsCMSSignedAttributes" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" /> + * </extension> + * </simpleContent> + * </complexType> + * </element> + * <element name="SignatureMethod" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * </sequence> * </extension> * </complexContent> @@ -61,7 +72,8 @@ import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SignRequestType", propOrder = { "keyIdentifier", - "signedInfo" + "signedInfo", + "signatureMethod" }) public class SignRequestType extends RequestType @@ -70,7 +82,9 @@ public class SignRequestType @XmlElement(name = "KeyIdentifier", required = true) protected String keyIdentifier; @XmlElement(name = "SignedInfo", required = true) - protected byte[] signedInfo; + protected SignRequestType.SignedInfo signedInfo; + @XmlElement(name = "SignatureMethod") + protected String signatureMethod; /** * Gets the value of the keyIdentifier property. @@ -101,9 +115,10 @@ public class SignRequestType * * @return * possible object is - * byte[] + * {@link SignRequestType.SignedInfo } + * */ - public byte[] getSignedInfo() { + public SignRequestType.SignedInfo getSignedInfo() { return signedInfo; } @@ -112,10 +127,116 @@ public class SignRequestType * * @param value * allowed object is - * byte[] + * {@link SignRequestType.SignedInfo } + * + */ + public void setSignedInfo(SignRequestType.SignedInfo value) { + this.signedInfo = value; + } + + /** + * Gets the value of the signatureMethod property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSignatureMethod() { + return signatureMethod; + } + + /** + * Sets the value of the signatureMethod property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSignatureMethod(String value) { + this.signatureMethod = value; + } + + + /** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+     * <complexType>
+     *   <simpleContent>
+     *     <extension base="<http://www.w3.org/2001/XMLSchema>base64Binary">
+     *       <attribute name="IsCMSSignedAttributes" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
+     *     </extension>
+     *   </simpleContent>
+     * </complexType>
+     * 
+ * + * */ - public void setSignedInfo(byte[] value) { - this.signedInfo = ((byte[]) value); + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "value" + }) + public static class SignedInfo { + + @XmlValue + protected byte[] value; + @XmlAttribute(name = "IsCMSSignedAttributes") + protected Boolean isCMSSignedAttributes; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * byte[] + */ + public byte[] getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * byte[] + */ + public void setValue(byte[] value) { + this.value = ((byte[]) value); + } + + /** + * Gets the value of the isCMSSignedAttributes property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public boolean isIsCMSSignedAttributes() { + if (isCMSSignedAttributes == null) { + return false; + } else { + return isCMSSignedAttributes; + } + } + + /** + * Sets the value of the isCMSSignedAttributes property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setIsCMSSignedAttributes(Boolean value) { + this.isCMSSignedAttributes = value; + } + } } -- cgit v1.2.3