aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib/src/main/java/at')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/moa/ByteArrayDataSource.java1
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java7
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java17
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java107
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/StatusRequestImpl.java2
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderExtractor.java10
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java38
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/sig_interface/SignatureDataInjector.java4
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java17
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/StamperFactory.java2
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java12
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/RequestedSignature.java2
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/package-info.java2
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java20
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java5
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java6
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java2
17 files changed, 57 insertions, 197 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/moa/ByteArrayDataSource.java b/pdf-as-lib/src/main/java/at/gv/egiz/moa/ByteArrayDataSource.java
index aec5f070..4c3a2c6e 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/moa/ByteArrayDataSource.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/moa/ByteArrayDataSource.java
@@ -1,7 +1,6 @@
package at.gv.egiz.moa;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java
index 76e760bd..2711afe2 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java
@@ -8,12 +8,7 @@ import at.gv.egiz.pdfas.lib.api.sign.SignResult;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyResult;
-public interface PdfAs {
-
- // Sign
- // Verify
- // Get Configuration
-
+public interface PdfAs {
/**
* Signs a PDF document using PDF-AS.
*
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java
index 8011e1eb..bd7c9d3e 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java
@@ -33,12 +33,7 @@ public class PdfAsFactory {
static {
PropertyConfigurator.configure(ClassLoader
.getSystemResourceAsStream("resources/log4j.properties"));
- // BasicConfigurator.configure();
-
- // iaik.security.ecc.provider.ECCProvider.addAsProvider();
IAIK.addAsProvider();
- // ECCProvider.addAsProvider();
- // install security provider
ECCelerate.addAsProvider();
}
@@ -89,6 +84,14 @@ public class PdfAsFactory {
return param;
}
+ /**
+ * Deploy default configuration to targetDirectory
+ *
+ * The targetDirectory will be deleted and
+ *
+ * @param targetDirectory
+ * @throws Exception
+ */
public static void deployDefaultConfiguration(File targetDirectory)
throws Exception {
if (targetDirectory.exists()) {
@@ -100,10 +103,6 @@ public class PdfAsFactory {
}
InputStream is = ClassLoader
.getSystemResourceAsStream(DEFAULT_CONFIG_RES);
- // URL zipUrl = ClassLoader.getSystemResource(DEFAULT_CONFIG_RES);
- // logger.debug("CONFIG URI: " + zipUrl.toURI().toString());
- // File zipFile = new File(zipUrl.toURI());
- // ZipFile zip = null;
ZipInputStream zip = null;
try {
zip = new ZipInputStream(is);
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
index 89408bc8..5f9d2b03 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
@@ -19,6 +19,7 @@ import org.apache.pdfbox.pdmodel.PDDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.gv.egiz.pdfas.common.exceptions.PDFIOException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsException;
import at.gv.egiz.pdfas.common.settings.ISettings;
@@ -110,69 +111,12 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
this.stampPdf(status);
- /*
- * if (requestedSignature.isVisual()) {
- * logger.info("Creating visual siganture block"); //
- * ================================================================
- * // SignBlockCreationStage (visual) -> create visual signature //
- * block (logicaly) SignatureProfileSettings
- * signatureProfileSettings = TableFactory
- * .createProfile(signatureProfileID, settings);
- *
- * Table main = TableFactory.createSigTable(
- * signatureProfileSettings, MAIN, settings, requestedSignature);
- *
- * IPDFStamper stamper = StamperFactory
- * .createDefaultStamper(settings); IPDFVisualObject visualObject =
- * stamper.createVisualPDFObject( status.getPdfObject(), main);
- *
- * //
- * ================================================================
- * // PositioningStage (visual) -> find position or use fixed //
- * position
- *
- * String posString = status.getSignParamter()
- * .getSignaturePosition();
- *
- * if (posString == null) { posString =
- * signatureProfileConfiguration .getDefaultPositioning(); }
- *
- * TablePos tablePos = null;
- *
- * if (posString == null) { tablePos = new TablePos(); } else {
- * tablePos = new TablePos(posString); }
- *
- * PDDocument originalDocument = PDDocument .load(new
- * ByteArrayInputStream(status.getPdfObject()
- * .getOriginalDocument()));
- *
- * PositioningInstruction positioningInstruction = Positioning
- * .determineTablePositioning(tablePos, "", originalDocument,
- * visualObject);
- *
- * //
- * ================================================================
- * // StampingStage (visual) -> stamp logical signature block to //
- * location (itext)
- *
- * byte[] incrementalUpdate = stamper.writeVisualObject(
- * visualObject, positioningInstruction, status
- * .getPdfObject().getOriginalDocument());
- * status.getPdfObject().setStampedDocument(incrementalUpdate); }
- * else { logger.info("No visual siganture block"); // Stamped
- * Object is equal to original
- * status.getPdfObject().setStampedDocument(
- * status.getPdfObject().getOriginalDocument()); }
- */
-
- // TODO: Create signature
+ // Create signature
IPdfSigner signer = PdfSignerFactory.createPdfSigner();
signer.signPDF(status.getPdfObject(), requestedSignature,
new PdfboxSignerWrapper(status.getSignParamter()
.getPlainSigner()));
- // status.getPdfObject().setSignedDocument(status.getPdfObject().getStampedDocument());
-
// ================================================================
// Create SignResult
SignResultImpl result = new SignResultImpl(status.getSignParamter()
@@ -186,8 +130,8 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
return result;
} catch (Throwable e) {
- logger.error("sign failed " + e.getMessage(), e);
- throw new PdfAsException("sign Failed", e);
+ logger.error("Failed to create signature [" + e.getMessage() + "]", e);
+ throw new PdfAsException("error.pdf.sig.01", e);
} finally {
logger.trace("sign done");
}
@@ -236,10 +180,6 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
COSString content = (COSString) dict
.getDictionaryObject("Contents");
- /*
- * logger.trace("Content: " +
- * StringUtils.bytesToHexString(content.getBytes()));
- */
ByteArrayOutputStream contentData = new ByteArrayOutputStream();
for (int j = 0; j < bytes.length; j = j + 2) {
@@ -265,12 +205,12 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
}
return result;
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("Failed to verify document", e);
+ throw new PDFIOException("error.pdf.verify.02", e);
} catch (PdfAsException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ logger.error("Failed to verify document", e);
+ throw new PdfAsException("error.pdf.verify.02", e);
}
- throw new PdfAsException();
}
public Configuration getConfiguration() {
@@ -279,6 +219,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
public StatusRequest startSign(SignParameter parameter)
throws PdfAsException {
+
// TODO: VERIFY PARAMETERS
StatusRequestImpl request = new StatusRequestImpl();
@@ -303,14 +244,14 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
return request;
} catch (Throwable e) {
logger.error("startSign", e);
- throw new PdfAsException("startSign", e);
+ throw new PdfAsException("error.pdf.sig.03", e);
}
}
public StatusRequest process(StatusRequest statusRequest)
throws PdfAsException {
if (!(statusRequest instanceof StatusRequestImpl)) {
- throw new PdfAsException("Invalid Status");
+ throw new PdfAsException("error.pdf.sig.04");
}
StatusRequestImpl request = (StatusRequestImpl) statusRequest;
@@ -363,7 +304,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
} catch (Throwable e) {
logger.error("process", e);
- throw new PdfAsException("process", e);
+ throw new PdfAsException("error.pdf.sig.05", e);
}
} else if (request.needSignature()) {
request.setNeedSignature(false);
@@ -377,23 +318,9 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
for (int i = 0; i < pdfSignature.length; i++) {
status.getPdfObject().getSignedDocument()[offset + i] = pdfSignature[i];
}
- /*
- *
- * String pdfFilter = status.getSignParamter().getPlainSigner()
- * .getPDFFilter(); String pdfSubFilter =
- * status.getSignParamter().getPlainSigner() .getPDFSubFilter();
- * SignatureDataInjector injector = new SignatureDataInjector(
- * request.getCertificate(), pdfFilter, pdfSubFilter,
- * status.getSigningDate(), request.getSignature(),
- * request.getSignatureData());
- *
- * IPdfSigner signer = PdfSignerFactory.createPdfSigner();
- * signer.signPDF(status.getPdfObject(),
- * status.getRequestedSignature(), injector);
- */
request.setIsReady(true);
} else {
- throw new PdfAsException("Invalid Status");
+ throw new PdfAsException("error.pdf.sig.04");
}
return request;
@@ -402,20 +329,20 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
public SignResult finishSign(StatusRequest statusRequest)
throws PdfAsException {
if (!(statusRequest instanceof StatusRequestImpl)) {
- throw new PdfAsException("Invalid Status");
+ throw new PdfAsException("error.pdf.sig.04");
}
StatusRequestImpl request = (StatusRequestImpl) statusRequest;
OperationStatus status = request.getStatus();
if (!request.isReady()) {
- throw new PdfAsException("Invalid Status");
+ throw new PdfAsException("error.pdf.sig.04");
}
try {
return createSignResult(status);
} catch (IOException e) {
- throw new PdfAsException("Invalid Status", e);
+ throw new PdfAsException("error.pdf.sig.06", e);
}
}
@@ -583,8 +510,6 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
outputStream.close();
- // result.setSignaturePosition(status.getRequestedSignature().);
-
result.setSignerCertificate(status.getRequestedSignature()
.getCertificate());
result.setSignaturePosition(status.getRequestedSignature()
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/StatusRequestImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/StatusRequestImpl.java
index 3b2f62f7..71e5cb4e 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/StatusRequestImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/StatusRequestImpl.java
@@ -68,12 +68,10 @@ public class StatusRequestImpl implements StatusRequest {
}
public byte[] getSignatureData() {
- // TODO Auto-generated method stub
return signatureData;
}
public int[] getSignatureDataByteRange() {
- // TODO Auto-generated method stub
return byteRange;
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderExtractor.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderExtractor.java
index eabc27e2..0f6a31cd 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderExtractor.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderExtractor.java
@@ -111,14 +111,14 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
try {
doc = PDDocument.load(inputStream);
} catch (IOException e) {
- throw new PDFIOException("failed to read document", e);
+ throw new PDFIOException("error.pdf.io.04", e);
}
SignaturePlaceholderExtractor extractor;
try
{
extractor = new SignaturePlaceholderExtractor(placeholderId, matchMode);
} catch (IOException e2) {
- throw new PDFIOException("failed to read document", e2);
+ throw new PDFIOException("error.pdf.io.04", e2);
}
List pages = doc.getDocumentCatalog().getAllPages();
Iterator iter = pages.iterator();
@@ -135,7 +135,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
return ret;
}
} catch (IOException e1) {
- throw new PDFIOException("failed to read document", e1);
+ throw new PDFIOException("error.pdf.io.04", e1);
}
}
@@ -146,7 +146,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
}
// no placeholders found, apply strict mode if set
if (matchMode == PLACEHOLDER_MATCH_MODE_STRICT) {
- throw new PlaceholderExtractionException("no suitable placeholder found and STRICT matching mode requested.");
+ throw new PlaceholderExtractionException("error.pdf.stamp.09");
}
return null;
@@ -165,7 +165,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
List placeholders, String placeholderId, int matchMode) throws PlaceholderExtractionException {
if (matchMode == PLACEHOLDER_MATCH_MODE_STRICT)
- throw new PlaceholderExtractionException("no suitable placeholder found and STRICT matching mode requested.");
+ throw new PlaceholderExtractionException("error.pdf.stamp.09");
if (placeholders.size() == 0)
return null;
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java
index cc75ff69..40b274a8 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java
@@ -13,7 +13,6 @@ import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.exceptions.SignatureException;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
-import org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -112,41 +111,4 @@ public class PADESPDFBOXSigner implements IPdfSigner {
throw new PdfAsException("error.pdf.sig.01", e);
}
}
-
-/*
- public void signPDF(String src, String dst, SignatureInterface signer) throws Exception {
- //ByteArrayOutputStream os = new ByteArrayOutputStream();
- FileInputStream fis = new FileInputStream(new File(src));
- FileOutputStream fos = new FileOutputStream(new File(dst));
- byte[] buffer = new byte[8 * 1024];
- byte[] outbuffer;
- int c;
- while ((c = fis.read(buffer)) != -1)
- {
- fos.write(buffer, 0, c);
- }
- fis.close();
- PDDocument doc = PDDocument.load(src);
- fis = new FileInputStream(new File(dst));
-
- PDSignature signature = new PDSignature();
- signature.setFilter(PDSignature.FILTER_ADOBE_PPKLITE); // default filter
-
- signature.setSubFilter(PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED);
- signature.setName("Andraes Fitzek");
- signature.setLocation("signer location");
- signature.setReason("Test Signature");
-
- // the signing date, needed for valid signature
- signature.setSignDate(Calendar.getInstance());
-
- doc.addSignature(signature, signer);
-
- // pdfbox patched (FIS -> IS)
- doc.saveIncremental(fis, fos);
-
- fos.close();
- // FileUtils.writeByteArrayToFile(new File(dst), os.toByteArray());
- }
-*/
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/sig_interface/SignatureDataInjector.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/sig_interface/SignatureDataInjector.java
index 65083a36..cc120717 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/sig_interface/SignatureDataInjector.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/sig_interface/SignatureDataInjector.java
@@ -28,10 +28,6 @@ public class SignatureDataInjector extends SignatureDataExtractor {
IOException {
byte[] signatureData = StreamUtils.inputStreamToByteArray(content);
- FileOutputStream fos2 = new FileOutputStream("/home/afitzek/devel/pdfas_neu/sign2.pdf");
- fos2.write(signatureData);
- fos2.close();
-
if(signatureData.length != this.oldSignatureData.length) {
throw new SignatureException("Signature Data missmatch!");
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java
index 7f8b0a0b..f5a89741 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java
@@ -1,19 +1,20 @@
package at.gv.egiz.pdfas.lib.impl.stamping;
-import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings;
-import at.gv.egiz.pdfas.common.utils.DNUtils;
-import at.gv.egiz.pdfas.common.utils.OgnlUtils;
-import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature;
import iaik.x509.X509Certificate;
+
+import java.util.Map;
+
+import javax.naming.InvalidNameException;
+
import ognl.OgnlContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.naming.InvalidNameException;
-import javax.naming.ldap.LdapName;
-
-import java.util.Map;
+import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings;
+import at.gv.egiz.pdfas.common.utils.DNUtils;
+import at.gv.egiz.pdfas.common.utils.OgnlUtils;
+import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature;
public class CertificateResolver implements IResolver {
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/StamperFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/StamperFactory.java
index f04a955a..e215e07d 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/StamperFactory.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/StamperFactory.java
@@ -15,7 +15,7 @@ public class StamperFactory {
stamper.setSettings(settings);
return stamper;
} catch (Throwable e) {
- throw new PdfAsException("NO STAMPER!", e);
+ throw new PdfAsException("error.pdf.stamp.10", e);
}
}
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java
index 19b38f27..38fead85 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java
@@ -30,11 +30,6 @@ public class ValueResolver implements IProfileConstants, IResolver {
public static final String EXP_START = "${";
public static final String EXP_END = "}";
- // TODO: Currently just for proof of concept ...
- // Should support Reading Fields from Certificate and DATETIME
-
- // TODO: Use status in real implementation to get currently needed
- // informations...
public String resolve(String key, String value,
SignatureProfileSettings settings, RequestedSignature signature) {
@@ -61,13 +56,6 @@ public class ValueResolver implements IProfileConstants, IResolver {
} else {
result = value;
}
- /*
- * if (value.startsWith(EXP_START) && value.endsWith(EXP_END)) { //
- * TODO: handle OGNL expression for key and value // TODO: Here we
- * need the certificate
- *
- * String exp = value.replace('$', ' '); return }
- */
return result;
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/RequestedSignature.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/RequestedSignature.java
index 8ae8e377..0d551c8b 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/RequestedSignature.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/RequestedSignature.java
@@ -25,7 +25,7 @@ public class RequestedSignature {
profileID = status.getGlobalConfiguration().getDefaultSignatureProfile();
if(profileID == null) {
- throw new PdfAsSettingsException("Failed to determine Signature Profile!");
+ throw new PdfAsSettingsException("error.pdf.sig.07");
}
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/package-info.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/package-info.java
index 62eb0d25..e6ebd1d8 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/package-info.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/package-info.java
@@ -1,4 +1,4 @@
/**
- *
+ * PDF-AS 4.0 Main package name
*/
package at.gv.egiz.pdfas.lib; \ No newline at end of file
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java
index 414f2854..3820df8f 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java
@@ -99,15 +99,15 @@ public class BKUSLConnector extends BaseSLConnector {
.unmarshalFromString(slResponse);
} catch (JAXBException e) {
- throw new PDFIOException("SL_COM", e);
+ throw new PDFIOException("error.pdf.io.03", e);
} catch (ClientProtocolException e) {
- throw new PDFIOException("SL_COM", e);
+ throw new PDFIOException("error.pdf.io.03", e);
} catch (IOException e) {
- throw new PDFIOException("SL_COM", e);
+ throw new PDFIOException("error.pdf.io.03", e);
}
if (element == null) {
- throw new PDFIOException("SL ELEMENT NOT AVAILABLE");
+ throw new PDFIOException("error.pdf.io.04");
}
if (element.getValue() instanceof InfoboxReadResponseType) {
@@ -120,7 +120,7 @@ public class BKUSLConnector extends BaseSLConnector {
throw new SLPdfAsException(errorResponseType.getErrorCode(),
errorResponseType.getInfo());
}
- throw new PdfAsException("Invalid SL Repsonse");
+ throw new PdfAsException("error.pdf.io.03");
}
public CreateCMSSignatureResponseType sendCMSRequest(
@@ -137,15 +137,15 @@ public class BKUSLConnector extends BaseSLConnector {
element = (JAXBElement) SLMarschaller
.unmarshalFromString(slResponse);
} catch (JAXBException e) {
- throw new PDFIOException("SL_COM", e);
+ throw new PDFIOException("error.pdf.io.03", e);
} catch (ClientProtocolException e) {
- throw new PDFIOException("SL_COM", e);
+ throw new PDFIOException("error.pdf.io.03", e);
} catch (IOException e) {
- throw new PDFIOException("SL_COM", e);
+ throw new PDFIOException("error.pdf.io.03", e);
}
if (element == null) {
- throw new PDFIOException("SL ELEMENT NOT AVAILABLE");
+ throw new PDFIOException("error.pdf.io.05");
}
if (element.getValue() instanceof CreateCMSSignatureResponseType) {
@@ -159,7 +159,7 @@ public class BKUSLConnector extends BaseSLConnector {
throw new SLPdfAsException(errorResponseType.getErrorCode(),
errorResponseType.getInfo());
}
- throw new PdfAsException("Invalid SL Repsonse");
+ throw new PdfAsException("error.pdf.io.03");
}
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java
index c32a4c32..b02e4f1a 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java
@@ -1,13 +1,11 @@
package at.gv.egiz.sl.util;
import java.math.BigInteger;
-import java.security.MessageDigest;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.gv.egiz.pdfas.common.utils.StringUtils;
import at.gv.egiz.sl.Base64OptRefContentType;
import at.gv.egiz.sl.CMSDataObjectRequiredMetaType;
import at.gv.egiz.sl.CreateCMSSignatureRequestType;
@@ -25,7 +23,7 @@ public abstract class BaseSLConnector implements ISLConnector {
public static final String SecureSignatureKeypair = "SecureSignatureKeypair";
public static final String PDF_MIME_TYPE = "application/pdf";
- public static final String PDF_MIME_TYPE_DESC = "Adobe PDF-Dateien";
+ public static final String PDF_MIME_TYPE_DESC = "Adobe PDF-File";
public static final String DETACHED = "detached";
@@ -80,7 +78,6 @@ public abstract class BaseSLConnector implements ISLConnector {
// == MetaInfoType
MetaInfoType metaInfoType = new MetaInfoType();
metaInfoType.setMimeType(PDF_MIME_TYPE);
- metaInfoType.setDescription(PDF_MIME_TYPE_DESC);
// == Base64OptRefContentType
Base64OptRefContentType base64OptRefContentType = new Base64OptRefContentType();
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java
index 409b984f..273f08ab 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java
@@ -104,13 +104,13 @@ public class ISignatureConnectorSLWrapper implements ISignatureConnector {
verifyResult.setSignerCertificate(signedData
.getCertificate(signerInfos[i]
.getSignerIdentifier()));
- throw new PdfAsSignatureException("Invalid Signature", ex);
+ throw new PdfAsSignatureException("error.pdf.sig.08", ex);
}
}
} catch (CMSException e) {
- throw new PdfAsSignatureException("Invalid Signature", e);
+ throw new PdfAsSignatureException("error.pdf.sig.08", e);
} catch (IOException e) {
- throw new PdfAsSignatureException("Invalid Signature", e);
+ throw new PdfAsSignatureException("error.pdf.sig.08", e);
}
return response.getCMSSignature();
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java
index 7f223b40..15a42deb 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java
@@ -65,7 +65,7 @@ public abstract class PDFUtilities
}
catch (IOException e)
{
- throw new PDFIOException("calculatePageLength", e);
+ throw new PDFIOException("error.pdf.stamp.11", e);
}
}