diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-01 08:30:42 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-01 08:30:42 +0000 |
commit | e48b7b84c057762ce8e8fa43d26814711752d399 (patch) | |
tree | 5c8ffa8be515ebdbd050088a3622ff2dd27a6cab /trunk/pdf-over-signer/pdf-over-sigpdfas/src/main | |
parent | 5ef8c7dd57907a9905760dbe2084e71b5750f610 (diff) | |
download | pdf-over-e48b7b84c057762ce8e8fa43d26814711752d399.tar.gz pdf-over-e48b7b84c057762ce8e8fa43d26814711752d399.tar.bz2 pdf-over-e48b7b84c057762ce8e8fa43d26814711752d399.zip |
Fixed some TODOs...
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12538 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk/pdf-over-signer/pdf-over-sigpdfas/src/main')
5 files changed, 51 insertions, 11 deletions
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java index 5998055a..b2f95f50 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java @@ -61,8 +61,7 @@ public class ByteArrayPDFASDataSource implements DataSource { @Override public String getCharacterEncoding() { - //TODO - return null; + return "UTF8"; } }
\ No newline at end of file diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java index 493b3e9c..85f06294 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java @@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.signator.ByteArrayDocumentSource; import at.asit.pdfover.signator.SLRequest; +import at.asit.pdfover.signer.pdfas.exceptions.PDFASSLRequestException; /** * PDF - AS Security Layer Request implementation @@ -36,12 +37,13 @@ public class PDFASSLRequest extends SLRequest { * Default constructor * @param slRequest * @param signData + * @throws PDFASSLRequestException */ - public PDFASSLRequest(String slRequest, byte[] signData) { + public PDFASSLRequest(String slRequest, byte[] signData) throws PDFASSLRequestException { if(!slRequest.contains(PDFASSigner.LOC_REF)) { - // TODO: throw Exception (Failed to prepare SL Request) log.error("PDF-AS SL request doesn't contain " + PDFASSigner.LOC_REF); log.debug("Request: " + slRequest); + throw new PDFASSLRequestException("PDF-AS SL request doesn't contain " + PDFASSigner.LOC_REF); } // Modifing SL Request ... diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java index 43179367..1b058553 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java @@ -10,6 +10,7 @@ import at.asit.pdfover.signator.SignResultImpl; import at.asit.pdfover.signator.SignatureParameter; import at.asit.pdfover.signator.SignaturePosition; import at.asit.pdfover.signator.SigningState; +import at.asit.pdfover.signer.pdfas.exceptions.PDFASSLRequestException; import at.gv.egiz.pdfas.api.PdfAs; import at.gv.egiz.pdfas.api.sign.SignParameters; import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; @@ -63,7 +64,6 @@ public class PDFASSigner implements Signer { if(parameter.getSignatureDevice() == BKUs.LOCAL) { params.setSignatureDevice(Constants.SIGNATURE_DEVICE_BKU); } else if(parameter.getSignatureDevice() == BKUs.MOBILE) { - // TODO: change to MOBILE!! params.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOBILE); //params.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOBILETEST); } @@ -102,7 +102,10 @@ public class PDFASSigner implements Signer { state.setSignatureRequest(request); return state; - } catch (PdfAsException e) { + } catch(PDFASSLRequestException e) { + throw new SignatureException(e); + } + catch (PdfAsException e) { throw new SignatureException(e); } } diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java index 9aec98f7..5b15543e 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java @@ -16,6 +16,9 @@ package at.asit.pdfover.signer.pdfas; //Imports +import java.util.HashMap; +import java.util.Properties; + import at.asit.pdfover.signator.SignatureDimension; import at.asit.pdfover.signator.SignatureParameter; import at.gv.egiz.pdfas.api.io.DataSource; @@ -26,6 +29,8 @@ import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning; */ public class PdfAsSignatureParameter extends SignatureParameter { + private HashMap<String, String> genericProperties = new HashMap<String, String>(); + @Override public SignatureDimension getPlaceholderDimension() { // TODO Auto-generated method stub @@ -46,19 +51,16 @@ public class PdfAsSignatureParameter extends SignatureParameter { * @return ByteArrayPDFASDataSource */ public DataSource getPDFASDataSource() { - // TODO: implement Signature creation return new ByteArrayPDFASDataSource(this.getInputDocument().getByteArray()); } @Override public void setProperty(String key, String value) { - // TODO Auto-generated method stub - + this.genericProperties.put(key, value); } @Override public String getProperty(String key) { - // TODO Auto-generated method stub - return null; + return this.genericProperties.get(key); } } diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PDFASSLRequestException.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PDFASSLRequestException.java new file mode 100644 index 00000000..ceb25779 --- /dev/null +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PDFASSLRequestException.java @@ -0,0 +1,34 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer.pdfas.exceptions; + +/** + * + */ +public class PDFASSLRequestException extends Exception { + /** + * + */ + private static final long serialVersionUID = -7515747014505057787L; + + /** + * Constructor + * @param msg + */ + public PDFASSLRequestException(String msg) { + super(msg); + } +} |