aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-common/src/main/java
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-10-02 10:28:30 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-10-02 10:28:30 +0200
commit0876981fd70fdab07f7c3e1666cf77071b5fe03d (patch)
tree0661571d1d757383fee936d1c4648d2c31b43ddb /pdf-as-common/src/main/java
parentadd4460d9619f3586a02ae0d8c028f01903494bc (diff)
downloadpdf-as-4-0876981fd70fdab07f7c3e1666cf77071b5fe03d.tar.gz
pdf-as-4-0876981fd70fdab07f7c3e1666cf77071b5fe03d.tar.bz2
pdf-as-4-0876981fd70fdab07f7c3e1666cf77071b5fe03d.zip
+ added PKCS7 detached siganture standard via keystore
+ added simple verification implementation
Diffstat (limited to 'pdf-as-common/src/main/java')
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java
index 611d7a0b..03cd28f3 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java
@@ -27,6 +27,8 @@ public class TempFileHelper implements IProfileConstants {
private List<String> tmpFiles = new ArrayList<String>();
+ private boolean needsDeletion = false;
+
public TempFileHelper(ISettings settings) {
initializeMD();
@@ -37,9 +39,12 @@ public class TempFileHelper implements IProfileConstants {
// relatives tmp dir
myTmpDirFile = new File(settings.getWorkingDirectory() + File.separator + myTmpDir);
}
- tmpDir = myTmpDirFile.getAbsolutePath();
+ tmpDir = myTmpDirFile.getAbsolutePath() + File.separator;
} else {
- tmpDir = settings.getWorkingDirectory() + File.separator + TMP_DIR_DEFAULT_VALUE;
+ String uuidString = UUID.randomUUID().toString();
+ logger.debug("Generated UUID " + uuidString);
+ tmpDir = settings.getWorkingDirectory() + File.separator + TMP_DIR_DEFAULT_VALUE + File.separator + getHashedHexString(uuidString) + File.separator;
+ needsDeletion = true;
}
logger.info("TempDirHelper for TempDirectory: " + tmpDir);
@@ -66,6 +71,9 @@ public class TempFileHelper implements IProfileConstants {
try {
File tmpdir = new File(tmpDir);
tmpdir.mkdirs();
+ if(needsDeletion) {
+ tmpdir.deleteOnExit();
+ }
} catch (Throwable e) {
logger.error("Failed to create temporary directory: " + tmpDir, e);
}
@@ -101,7 +109,7 @@ public class TempFileHelper implements IProfileConstants {
public String getStaticFilename() {
String uuidString = UUID.randomUUID().toString();
logger.debug("Generated UUID " + uuidString);
- String tmpFilename = tmpFilePrefix + getHashedHexString(uuidString) + tmpFileSuffix;
+ String tmpFilename = tmpDir + getHashedHexString(uuidString) + tmpFileSuffix;
logger.info("Temporary filename " + tmpFilename);
tmpFiles.add(tmpFilename);
return tmpFilename;