diff options
Diffstat (limited to 'trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover')
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); + } +} |