aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-12-14 13:47:48 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-12-14 13:47:48 +0000
commit9b615852df5f56eeb67c4dd021a56e72d31a2498 (patch)
tree5cdf42cdb8dd552d73f7d4ef4299aa4743975d5e /src/main/java/at/gv/egiz
parent8ba10b6fa16c78ec3a8661d7b050320971495405 (diff)
downloadpdf-as-3-9b615852df5f56eeb67c4dd021a56e72d31a2498.tar.gz
pdf-as-3-9b615852df5f56eeb67c4dd021a56e72d31a2498.tar.bz2
pdf-as-3-9b615852df5f56eeb67c4dd021a56e72d31a2498.zip
Error code created for protected pdf documents.
SettingsReader: Debug message for getInternalResource added (TRACE) multipart/formdata: align multipart charset with data charset added FIXME notes for FileHelper.readFromFile Signature/Verification-Demo updated git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@507 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java10
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java2
-rw-r--r--src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java1
-rw-r--r--src/main/java/at/gv/egiz/pdfas/exceptions/pdf/TextExtractionException.java23
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java8
5 files changed, 12 insertions, 32 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java b/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java
index c2532e8..c9c7ae7 100644
--- a/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java
+++ b/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java
@@ -3,6 +3,7 @@ package at.gv.egiz.pdfas.api.timestamp;
import java.util.Date;
import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -18,12 +19,11 @@ public class DummyTimeStamper implements TimeStamper {
private String lastTimeStamp;
public String applyTimeStamp(String b64SignatureValue) {
- log.debug("execute dummy timestamp on value: " + b64SignatureValue);
- String ts = ("my dummy timestamp " + new Date());
- log.debug("timestamp: " + ts);
-
+ log.debug("Applying dummy timestamp on signature value: " + b64SignatureValue);
+ String ts = DateFormatUtils.format(new Date(), "yyyy-MM-dd'T'hh:mm:ss.SSSZ");
+ log.debug("Timestamp: " + ts);
ts = new String(Base64.encodeBase64(ts.getBytes()));
- log.debug("timestamp b64: " + ts);
+ log.debug("Timestamp value (base64): " + ts);
this.lastTimeStamp = ts;
return ts;
}
diff --git a/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java b/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java
index 7100310..c39d78e 100644
--- a/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java
+++ b/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java
@@ -11,7 +11,7 @@ public interface TimeStamper {
/**
* Implement timestamp in this method.
* @param b64SignatureValue signature value, base64 encoded
- * @return timestamp to be embedded in egiz dict. base64 encoded
+ * @return timestamp to be embedded in egiz dictionary base64 encoded (following RFC3161).
*/
public String applyTimeStamp(String b64SignatureValue);
diff --git a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java
index 857fc09..04cf779 100644
--- a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java
+++ b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java
@@ -28,6 +28,7 @@ public final class ErrorCode
public static final int DOCUMENT_NOT_SIGNED = 206;
public static final int SIGNATURE_TYPES_EXCEPTION = 223;
public static final int FONT_NOT_FOUND = 230;
+ public static final int DOCUMENT_IS_PROTECTED = 231;
public static final int SIGNATURE_COULDNT_BE_CREATED = 300;
public static final int SIGNED_TEXT_EMPTY = 301;
diff --git a/src/main/java/at/gv/egiz/pdfas/exceptions/pdf/TextExtractionException.java b/src/main/java/at/gv/egiz/pdfas/exceptions/pdf/TextExtractionException.java
deleted file mode 100644
index 6586dd0..0000000
--- a/src/main/java/at/gv/egiz/pdfas/exceptions/pdf/TextExtractionException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package at.gv.egiz.pdfas.exceptions.pdf;
-
-import at.gv.egiz.pdfas.exceptions.ErrorCode;
-import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
-
-public class TextExtractionException extends PresentableException
-{
- /**
- * SVUID.
- */
- private static final long serialVersionUID = 2798763345488999563L;
-
- public TextExtractionException(Throwable cause)
- {
- super(ErrorCode.TEXT_EXTRACTION_EXCEPTION, cause);
- }
-
- public TextExtractionException(String message)
- {
- super(ErrorCode.TEXT_EXTRACTION_EXCEPTION, message);
- }
-
-}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java
index c983a8a..077ed97 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java
@@ -26,6 +26,8 @@ public class TextDataSourceImpl implements TextDataSource
* The text.
*/
protected String text = null;
+
+ private final static String CHARSET = "UTF-8";
/**
* Constructor that sets the text.
@@ -53,7 +55,7 @@ public class TextDataSourceImpl implements TextDataSource
{
try
{
- byte[] data = getText().getBytes("UTF-8");
+ byte[] data = getText().getBytes(CHARSET);
// PERF: if memory is an issue (e.g. in web), use a FileBased TextDataSource instead.
return new ByteArrayInputStream(data);
}
@@ -70,7 +72,7 @@ public class TextDataSourceImpl implements TextDataSource
{
try
{
- byte[] data = getText().getBytes("UTF-8");
+ byte[] data = getText().getBytes(CHARSET);
return data.length;
}
catch (UnsupportedEncodingException e)
@@ -86,7 +88,7 @@ public class TextDataSourceImpl implements TextDataSource
{
try
{
- byte[] data = getText().getBytes("UTF-8");
+ byte[] data = getText().getBytes(CHARSET);
return data;
}
catch (UnsupportedEncodingException e)