aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-legacy/src/main/java/at
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-01-21 09:57:16 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-01-21 09:57:16 +0100
commit2436aa273f00dafb465c2342ea8e7297898915d2 (patch)
tree27cf115b4ec6d36f84b01b50acc403cf31b3ab6b /pdf-as-legacy/src/main/java/at
parent8d801ab37834b0f11c6a16c240d77da71a6ab816 (diff)
downloadpdf-as-4-2436aa273f00dafb465c2342ea8e7297898915d2.tar.gz
pdf-as-4-2436aa273f00dafb465c2342ea8e7297898915d2.tar.bz2
pdf-as-4-2436aa273f00dafb465c2342ea8e7297898915d2.zip
Implementations for pdf-as-web and pdf-as-legacy
Diffstat (limited to 'pdf-as-legacy/src/main/java/at')
-rw-r--r--pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java1
-rw-r--r--pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java7
-rw-r--r--pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignResultImpl.java6
-rw-r--r--pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignaturePositionImpl.java34
-rw-r--r--pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyParameterWrapper.java6
-rw-r--r--pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultWrapper.java13
6 files changed, 53 insertions, 14 deletions
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java
index eee62cd8..f16d2ffb 100644
--- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java
+++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java
@@ -32,6 +32,7 @@ package at.gv.egiz.pdfas.api.sign.pos;
*
* @author wprinz
*/
+@Deprecated
public interface SignaturePosition
{
/**
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java
index 0f1a60c1..ecd3c031 100644
--- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java
+++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java
@@ -20,6 +20,7 @@ import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
import at.gv.egiz.pdfas.api.sign.SignParameters;
import at.gv.egiz.pdfas.api.sign.SignResult;
import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation;
+import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition;
import at.gv.egiz.pdfas.api.verify.VerifyAfterAnalysisParameters;
import at.gv.egiz.pdfas.api.verify.VerifyAfterReconstructXMLDsigParameters;
import at.gv.egiz.pdfas.api.verify.VerifyParameters;
@@ -34,6 +35,7 @@ import at.gv.egiz.pdfas.lib.api.StatusRequest;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyResult;
+import at.gv.egiz.pdfas.lib.impl.SignaturePositionImpl;
public class PdfAsObject implements PdfAs {
@@ -69,15 +71,18 @@ public class PdfAsObject implements PdfAs {
at.gv.egiz.pdfas.lib.api.sign.SignResult result = this.pdfas4.finishSign(request);
sdi.wrapper.syncNewToOld();
SignResultImpl oldresult = new SignResultImpl(sdi.wrapper.getSignParameters().getOutput(),
- sdi.getX509Certificate());
+ sdi.getX509Certificate(), new at.gv.egiz.pdfas.wrapper.SignaturePositionImpl(
+ result.getSignaturePosition()));
return oldresult;
} else {
throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED,
"Invalid state");
}
} catch (at.gv.egiz.pdfas.common.exceptions.PdfAsException e) {
+ e.printStackTrace();
throw new PdfAsException(
ErrorCode.SIGNATURE_COULDNT_BE_CREATED, e.getMessage());
+
}
} else {
throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED,
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignResultImpl.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignResultImpl.java
index b8a9ab33..f8d36869 100644
--- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignResultImpl.java
+++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignResultImpl.java
@@ -11,10 +11,12 @@ public class SignResultImpl implements SignResult {
private DataSink sink;
private X509Certificate certificate;
+ private SignaturePosition position;
- public SignResultImpl(DataSink data, X509Certificate cert) {
+ public SignResultImpl(DataSink data, X509Certificate cert, SignaturePosition position) {
this.certificate = cert;
this.sink = data;
+ this.position = position;
}
public DataSink getOutputDocument() {
@@ -26,7 +28,7 @@ public class SignResultImpl implements SignResult {
}
public SignaturePosition getSignaturePosition() {
- return null;
+ return position;
}
public List getNonTextualObjects() {
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignaturePositionImpl.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignaturePositionImpl.java
new file mode 100644
index 00000000..2d950643
--- /dev/null
+++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignaturePositionImpl.java
@@ -0,0 +1,34 @@
+package at.gv.egiz.pdfas.wrapper;
+
+import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition;
+
+public class SignaturePositionImpl implements SignaturePosition {
+
+ private at.gv.egiz.pdfas.lib.api.SignaturePosition position;
+
+ public SignaturePositionImpl(at.gv.egiz.pdfas.lib.api.SignaturePosition position) {
+ this.position = position;
+ }
+
+
+ public int getPage() {
+ return this.position.getPage();
+ }
+
+ public float getX() {
+ return this.position.getX();
+ }
+
+ public float getY() {
+ return this.position.getY();
+ }
+
+ public float getWidth() {
+ return this.position.getWidth();
+ }
+
+ public float getHeight() {
+ return this.position.getHeight();
+ }
+
+}
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyParameterWrapper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyParameterWrapper.java
index 51a8c843..44f9aa6c 100644
--- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyParameterWrapper.java
+++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyParameterWrapper.java
@@ -9,8 +9,12 @@ import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
public class VerifyParameterWrapper {
public static VerifyParameter toNewParameters(VerifyParameters oldParameters, Configuration config) {
- return PdfAsFactory.createVerifyParameter(config,
+ VerifyParameter parameter = PdfAsFactory.createVerifyParameter(config,
new ByteArrayDataSource(oldParameters.getDocument().getAsByteArray()));
+
+ parameter.setWhichSignature(oldParameters.getSignatureToVerify());
+ parameter.setVerificationTime(oldParameters.getVerificationTime());
+ return parameter;
}
}
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultWrapper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultWrapper.java
index 0364be9b..7b35ef6c 100644
--- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultWrapper.java
+++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultWrapper.java
@@ -1,9 +1,11 @@
package at.gv.egiz.pdfas.wrapper;
+import java.io.InputStream;
import java.security.cert.X509Certificate;
import java.util.Date;
import java.util.List;
+import at.gv.egiz.pdfas.api.commons.Constants;
import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
import at.gv.egiz.pdfas.api.exceptions.PdfAsWrappedException;
import at.gv.egiz.pdfas.api.io.DataSource;
@@ -20,13 +22,11 @@ public class VerifyResultWrapper implements VerifyResult {
}
public String getSignatureType() {
- // TODO Auto-generated method stub
return null;
}
public DataSource getSignedData() {
- // TODO Auto-generated method stub
- return null;
+ return new ByteArrayDataSource_OLD(this.newResult.getSignatureData());
}
public X509Certificate getSignerCertificate() {
@@ -34,17 +34,14 @@ public class VerifyResultWrapper implements VerifyResult {
}
public Date getSigningTime() {
- // TODO Auto-generated method stub
return null;
}
public Object getInternalSignatureInformation() {
- // TODO Auto-generated method stub
return null;
}
public String getTimeStampValue() {
- // TODO Auto-generated method stub
return null;
}
@@ -76,22 +73,18 @@ public class VerifyResultWrapper implements VerifyResult {
}
public boolean isPublicAuthority() {
- // TODO Auto-generated method stub
return false;
}
public String getPublicAuthorityCode() {
- // TODO Auto-generated method stub
return null;
}
public List getPublicProperties() {
- // TODO Auto-generated method stub
return null;
}
public Date getVerificationTime() {
- // TODO Auto-generated method stub
return null;
}