diff options
author | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-02-23 15:29:35 +0100 |
---|---|---|
committer | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-02-23 15:29:35 +0100 |
commit | 7b6860087f50b7576c31f7aa50714d3fa7a9b228 (patch) | |
tree | c2347315c5a0e4e6565f9020d3e1d7d38d94abfe /pdf-over-signator/src/main | |
parent | 72cb98966c0d631ed4741bf071c621fd36f33fd6 (diff) | |
download | pdf-over-7b6860087f50b7576c31f7aa50714d3fa7a9b228.tar.gz pdf-over-7b6860087f50b7576c31f7aa50714d3fa7a9b228.tar.bz2 pdf-over-7b6860087f50b7576c31f7aa50714d3fa7a9b228.zip |
BASE64 request handling
Diffstat (limited to 'pdf-over-signator/src/main')
-rw-r--r-- | pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java | 59 | ||||
-rw-r--r-- | pdf-over-signator/src/main/java/at/asit/pdfover/signator/SigningState.java | 8 |
2 files changed, 7 insertions, 60 deletions
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java index 9edd0a02..5fd9c756 100644 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java +++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java @@ -15,19 +15,12 @@ */ package at.asit.pdfover.signator; -import org.apache.commons.codec.binary.Base64; - /** * Security Layer Request */ public class SLRequest { /** - * The String constant to replace the SL DATAOBJECT - */ - public static final String DATAOBJECT_STRING = "##DATAOBJECT##"; - - /** * The security layer request */ private String request; @@ -39,7 +32,6 @@ public class SLRequest { /** * Set the SL request - * The data object should contain the placeholder DATAOBJECT_STRING * @param request the request to set */ protected void setRequest(String request) { @@ -47,57 +39,6 @@ public class SLRequest { } /** - * The SL request String with the document encoded in base64 - * - * This SL Request is always a detached signature request which contains a - * reference to the data object in base64 encoding. - * - * @return SL request String - */ - public String getBase64Request() { - String b64content = new String(Base64.encodeBase64(getSignatureData().getByteArray())); - - String b64request = this.request.replace( - DATAOBJECT_STRING, - "<sl:Base64Content>" + b64content //$NON-NLS-1$ - + "</sl:Base64Content>"); //$NON-NLS-1$ - - return b64request; - } - - /** - * The SL request String with the document defined as file upload - * @return SL request String - */ - public String getFileUploadRequest() { - String fileUploadRequest = this.request.replace( - DATAOBJECT_STRING, - "<sl:LocRefContent>formdata:fileupload</sl:LocRefContent>"); //$NON-NLS-1$ - - return fileUploadRequest; - } - - /** - * The SL request String with the document referenced as an URI - * - * This SL Request is always a detached signature request which contains a - * reference to the data object as an URI - * The URI has to be provided and should be a valid reference to - * the document provided by getSignatureData(). - * - * @param uri The URI pointing to the signature data - * @return SL request String - */ - public String getURIRequest(String uri) { - String urirequest = this.request.replace( - DATAOBJECT_STRING, - "<sl:LocRefContent>" + uri //$NON-NLS-1$ - + "</sl:LocRefContent>"); //$NON-NLS-1$ - - return urirequest; - } - - /** * Set the signature data (document to be signed) * @param signatureData the signatureData to set */ diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SigningState.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SigningState.java index b86e356c..f624e5b4 100644 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SigningState.java +++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SigningState.java @@ -27,11 +27,17 @@ public interface SigningState { public SLRequest getSignatureRequest(); /** + * Sets whether to use base64 (or FileUpload) for request data + * @param useBase64Request whether to use base64 for request data + */ + public void setUseBase64Request(boolean useBase64Request); + + /** * Sets the Security Layer Response to the Signature Request * @param value The Signature Response */ public void setSignatureResponse(SLResponse value); - + /** * Has the state a SignatureResponse set ? * @return true if a SLResponse is set |