diff options
author | netconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-08-27 08:07:48 +0000 |
---|---|---|
committer | netconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-08-27 08:07:48 +0000 |
commit | 567b6e8f386b9b85e77beec16302c7afe37d041b (patch) | |
tree | ea6ccedc3d11548c1c6838f53fe079a1ec8276e6 /src/main/java/at/knowcenter | |
parent | 8dffa927aa50a1ff1924f554fe3534ebcd6d9278 (diff) | |
download | pdf-as-3-567b6e8f386b9b85e77beec16302c7afe37d041b.tar.gz pdf-as-3-567b6e8f386b9b85e77beec16302c7afe37d041b.tar.bz2 pdf-as-3-567b6e8f386b9b85e77beec16302c7afe37d041b.zip |
bigfix "add cert when signing"
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@203 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter')
3 files changed, 32 insertions, 3 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java index fc446f9..f818f59 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java @@ -167,5 +167,10 @@ public class IncrementalUpdateInformation implements Serializable * The table position.
*/
public TablePos pos;
+
+ /**
+ * For signing: the profile.
+ */
+ public String signProfile;
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java index 52c986a..fc58bd1 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java @@ -26,6 +26,8 @@ import java.io.FileOutputStream; import java.io.IOException;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
@@ -689,6 +691,20 @@ public class SignatureObject implements Serializable setSigValue(SIG_CER, x509Certificate);
storeCertificate(getSignationSerialNumber(), getSignationIssuer(), x509Certificate, getX509CertificateDigest());
}
+
+ public void setX509Certificate(X509Certificate cert)
+ {
+ try
+ {
+ byte [] der = cert.getEncoded();
+ String certStr = CodingHelper.encodeBase64(der);
+ setX509Certificate(certStr);
+ }
+ catch (CertificateEncodingException e)
+ {
+ logger_.error(e);
+ }
+ }
/**
* return the 509v3 certificate of the given serialNumber and the given issuer
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/signatureobject/SignatureObjectHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/signatureobject/SignatureObjectHelper.java index 1eb432e..bb5dc86 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/signatureobject/SignatureObjectHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/signatureobject/SignatureObjectHelper.java @@ -3,11 +3,12 @@ */
package at.knowcenter.wag.egov.egiz.sig.signatureobject;
+import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.knowcenter.wag.egov.egiz.PdfASID;
-import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException;
import at.knowcenter.wag.egov.egiz.exceptions.SignatureException;
import at.knowcenter.wag.egov.egiz.exceptions.SignatureTypesException;
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
+import at.knowcenter.wag.egov.egiz.sig.X509Cert;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.SignSignatureObject;
/**
@@ -31,17 +32,24 @@ public final class SignatureObjectHelper so.setSignationIDs(sso.getSigID());
so.setKZ(new PdfASID(sso.getSigKZ()));
so.setSignationName(sso.getName());
+
+ so.setX509Certificate(sso.getX509Certificate());
return so;
}
- public static SignSignatureObject convertSignatureObjectToSignSignatureObject (SignatureObject so) throws InvalidIDException
+ public static SignSignatureObject convertSignatureObjectToSignSignatureObject (SignatureObject so) throws SignatureException
{
SignSignatureObject sso = new SignSignatureObject();
sso.date = so.getSignationDate();
sso.signatureValue = so.getSignationValue();
sso.issuer = so.getSignationIssuer();
- sso.x509Certificate = so.getX509Cert().getX509Certificate();
+ X509Cert cert = so.getX509Cert();
+ if (cert == null)
+ {
+ throw new SignatureException(ErrorCode.CERTIFICATE_NOT_FOUND, "so.getX509Cert returned null. No cert found.");
+ }
+ sso.x509Certificate = cert.getX509Certificate();
sso.id = so.getSignationIds();
sso.kz = so.getKZ() == null ? null : so.getKZ().toString();
|