From 5f5c03c5d8475add6e9ba7474de7a20970ccd7a7 Mon Sep 17 00:00:00 2001 From: knowcenter Date: Fri, 1 Jun 2007 08:33:42 +0000 Subject: solved the "SIG_NAME" fix git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@115 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../sig/signatureobject/SignatureObjectHelper.java | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/main/java/at/knowcenter/wag/egov/egiz/sig/signatureobject/SignatureObjectHelper.java (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/sig/signatureobject') 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 new file mode 100644 index 0000000..1eb432e --- /dev/null +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/signatureobject/SignatureObjectHelper.java @@ -0,0 +1,50 @@ +/** + * + */ +package at.knowcenter.wag.egov.egiz.sig.signatureobject; + +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.connectors.bku.SignSignatureObject; + +/** + * Contains helper methods for dealing with signature objects. + * + * @author wprinz + * + */ +public final class SignatureObjectHelper +{ + + public static SignatureObject convertSignSignatureObjectToSignatureObject (SignSignatureObject sso, String signature_type) throws SignatureTypesException, SignatureException + { + SignatureObject so = new SignatureObject(); + so.setSigType(signature_type); + so.initByType(); + so.setSignationDate(sso.getDate()); + so.setSignationIssuer(sso.getIssuer()); + so.setSignationSerialNumber(sso.getSerialNumber()); + so.setSignationValue(sso.getSignatureValue()); + so.setSignationIDs(sso.getSigID()); + so.setKZ(new PdfASID(sso.getSigKZ())); + so.setSignationName(sso.getName()); + + return so; + } + + public static SignSignatureObject convertSignatureObjectToSignSignatureObject (SignatureObject so) throws InvalidIDException + { + SignSignatureObject sso = new SignSignatureObject(); + sso.date = so.getSignationDate(); + sso.signatureValue = so.getSignationValue(); + sso.issuer = so.getSignationIssuer(); + sso.x509Certificate = so.getX509Cert().getX509Certificate(); + sso.id = so.getSignationIds(); + sso.kz = so.getKZ() == null ? null : so.getKZ().toString(); + + return sso; + } +} -- cgit v1.2.3