From 782e41eee1f04f86bc895a95cd2d51353284987a Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 18:51:24 +0000 Subject: Refactoring git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@11 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- pdf-over-signer/.project | 17 +++ .../.settings/org.eclipse.core.resources.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 98 +++++++++++++ .../.settings/org.eclipse.m2e.core.prefs | 5 + .../.settings/org.eclipse.mylyn.tasks.ui.prefs | 4 + pdf-over-signer/pdf-over-sigpdfas/.classpath | 10 ++ pdf-over-signer/pdf-over-sigpdfas/.project | 23 ++++ .../.settings/org.eclipse.core.resources.prefs | 7 + .../.settings/org.eclipse.jdt.core.prefs | 98 +++++++++++++ .../.settings/org.eclipse.m2e.core.prefs | 5 + .../.settings/org.eclipse.mylyn.tasks.ui.prefs | 4 + pdf-over-signer/pdf-over-sigpdfas/pom.xml | 24 ++++ .../signer/pdfas/ByteArrayPDFASDataSource.java | 42 ++++++ .../at/asit/pdfover/signer/pdfas/PDFASHelper.java | 73 ++++++++++ .../asit/pdfover/signer/pdfas/PDFASSLRequest.java | 18 +++ .../at/asit/pdfover/signer/pdfas/PDFASSigner.java | 151 +++++++++++++++++++++ .../pdfover/signer/pdfas/PDFASSignerFactory.java | 12 ++ .../pdfover/signer/pdfas/PDFASSigningState.java | 87 ++++++++++++ .../signer/pdfas/PdfAsSignatureParameter.java | 37 +++++ pdf-over-signer/pom.xml | 16 +++ 20 files changed, 734 insertions(+) create mode 100644 pdf-over-signer/.project create mode 100644 pdf-over-signer/.settings/org.eclipse.core.resources.prefs create mode 100644 pdf-over-signer/.settings/org.eclipse.jdt.core.prefs create mode 100644 pdf-over-signer/.settings/org.eclipse.m2e.core.prefs create mode 100644 pdf-over-signer/.settings/org.eclipse.mylyn.tasks.ui.prefs create mode 100644 pdf-over-signer/pdf-over-sigpdfas/.classpath create mode 100644 pdf-over-signer/pdf-over-sigpdfas/.project create mode 100644 pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.core.resources.prefs create mode 100644 pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.jdt.core.prefs create mode 100644 pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.m2e.core.prefs create mode 100644 pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.mylyn.tasks.ui.prefs create mode 100644 pdf-over-signer/pdf-over-sigpdfas/pom.xml create mode 100644 pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java create mode 100644 pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java create mode 100644 pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java create mode 100644 pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java create mode 100644 pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSignerFactory.java create mode 100644 pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigningState.java create mode 100644 pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java create mode 100644 pdf-over-signer/pom.xml (limited to 'pdf-over-signer') diff --git a/pdf-over-signer/.project b/pdf-over-signer/.project new file mode 100644 index 00000000..e0b219a0 --- /dev/null +++ b/pdf-over-signer/.project @@ -0,0 +1,17 @@ + + + pdf-over-signer + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/pdf-over-signer/.settings/org.eclipse.core.resources.prefs b/pdf-over-signer/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..3e3d9a5e --- /dev/null +++ b/pdf-over-signer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Thu Aug 02 13:13:02 CEST 2012 +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/pdf-over-signer/.settings/org.eclipse.jdt.core.prefs b/pdf-over-signer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..3e73d18e --- /dev/null +++ b/pdf-over-signer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,98 @@ +#Fri Aug 03 18:09:51 CEST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled +org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,LOW +org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,NOTE diff --git a/pdf-over-signer/.settings/org.eclipse.m2e.core.prefs b/pdf-over-signer/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..64d42840 --- /dev/null +++ b/pdf-over-signer/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,5 @@ +#Thu Aug 02 12:33:28 CEST 2012 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/pdf-over-signer/.settings/org.eclipse.mylyn.tasks.ui.prefs b/pdf-over-signer/.settings/org.eclipse.mylyn.tasks.ui.prefs new file mode 100644 index 00000000..e915ba17 --- /dev/null +++ b/pdf-over-signer/.settings/org.eclipse.mylyn.tasks.ui.prefs @@ -0,0 +1,4 @@ +#Fri Aug 03 18:56:26 CEST 2012 +eclipse.preferences.version=1 +project.repository.kind=jira +project.repository.url=http\://jira.egovlabs.gv.at diff --git a/pdf-over-signer/pdf-over-sigpdfas/.classpath b/pdf-over-signer/pdf-over-sigpdfas/.classpath new file mode 100644 index 00000000..0f53f3e2 --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pdf-over-signer/pdf-over-sigpdfas/.project b/pdf-over-signer/pdf-over-sigpdfas/.project new file mode 100644 index 00000000..a8f28341 --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/.project @@ -0,0 +1,23 @@ + + + pdf-over-sigpdfas + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.core.resources.prefs b/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..7f5422a4 --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,7 @@ +#Thu Aug 02 13:12:39 CEST 2012 +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.jdt.core.prefs b/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..3e73d18e --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,98 @@ +#Fri Aug 03 18:09:51 CEST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled +org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,LOW +org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,NOTE diff --git a/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.m2e.core.prefs b/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..62e91186 --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,5 @@ +#Thu Aug 02 12:33:52 CEST 2012 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.mylyn.tasks.ui.prefs b/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.mylyn.tasks.ui.prefs new file mode 100644 index 00000000..c6aa7359 --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.mylyn.tasks.ui.prefs @@ -0,0 +1,4 @@ +#Fri Aug 03 18:56:31 CEST 2012 +eclipse.preferences.version=1 +project.repository.kind=jira +project.repository.url=http\://jira.egovlabs.gv.at diff --git a/pdf-over-signer/pdf-over-sigpdfas/pom.xml b/pdf-over-signer/pdf-over-sigpdfas/pom.xml new file mode 100644 index 00000000..7a1122ea --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/pom.xml @@ -0,0 +1,24 @@ + + 4.0.0 + + pdf-over-signer + a-sit.at + 4.0.0-SNAPSHOT + .. + + pdf-over-sigpdfas + PDF-Over PDF-AS Signer + + + a-sit.at + pdf-over-signator + ${project.parent.version} + + + knowcenter + pdf-as + 3.2 + + + \ No newline at end of file diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java new file mode 100644 index 00000000..0fa23192 --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java @@ -0,0 +1,42 @@ +package at.asit.pdfover.signer.pdfas; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import at.gv.egiz.pdfas.api.io.DataSource; + +public class ByteArrayPDFASDataSource implements DataSource { + + private byte[] data; + + public ByteArrayPDFASDataSource(byte[] data) { + this.data = data; + } + + @Override + public InputStream createInputStream() { + return new ByteArrayInputStream(this.data); + } + + @Override + public int getLength() { + return this.data.length; + } + + @Override + public byte[] getAsByteArray() { + return this.data; + } + + @Override + public String getMimeType() { + return "application/pdf"; + } + + @Override + public String getCharacterEncoding() { + //TODO + return null; + } + +} \ No newline at end of file diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java new file mode 100644 index 00000000..756478d3 --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java @@ -0,0 +1,73 @@ +package at.asit.pdfover.signer.pdfas; + +import at.asit.pdfover.signator.SignatureException; +import at.gv.egiz.pdfas.api.PdfAs; +import at.gv.egiz.pdfas.api.exceptions.PdfAsException; +import at.gv.egiz.pdfas.api.internal.PdfAsInternal; + +/** + * Encapsulates PDF AS API Object to need just one initialization + * @author afitzek + */ +public class PDFASHelper { + + /** + * PDF AS Object + */ + private static PdfAs pdfAs = null; + + /** + * Internal Pdf AS Object + */ + private static PdfAsInternal pdfAsInternal = null; + + /** + * Creates PDF AS Object + * @return + * @throws PdfAsException + */ + private static PdfAs createPdfAs() throws PdfAsException { + return new at.gv.egiz.pdfas.impl.api.PdfAsObject(); + } + + /** + * Creates a PDF-AS Internal object + * @return the PDF-AS Internal object + * @throws PdfAsException + */ + private static PdfAsInternal createPdfAsInternal() throws PdfAsException { + return new at.gv.egiz.pdfas.impl.api.internal.PdfAsInternalObject(); + } + + /** + * Gets PDF-AS Object + * @return the PDF-AS Object + * @throws SignatureException + */ + public static synchronized PdfAs getPdfAs() throws SignatureException { + if (pdfAs == null) { + try { + pdfAs = createPdfAs(); + } catch(PdfAsException e) { + throw new SignatureException(e); + } + } + return pdfAs; + } + + /** + * Gets PDF-AS Internal object + * @return the PDF-AS Internal object + * @throws SignatureException + */ + public static synchronized PdfAsInternal getPdfAsInternal() throws SignatureException { + if(pdfAsInternal == null) { + try { + pdfAsInternal = createPdfAsInternal(); + } catch(PdfAsException e) { + throw new SignatureException(e); + } + } + return pdfAsInternal; + } +} diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java new file mode 100644 index 00000000..7130f53a --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java @@ -0,0 +1,18 @@ +package at.asit.pdfover.signer.pdfas; + +import at.asit.pdfover.signator.DocumentSource; +import at.asit.pdfover.signator.SLRequest; + +public class PDFASSLRequest implements SLRequest { + + public PDFASSLRequest(String slRequest) { + /// Analyze Request ... + } + + @Override + public DocumentSource getSignatureData() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java new file mode 100644 index 00000000..949bbce1 --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java @@ -0,0 +1,151 @@ +package at.asit.pdfover.signer.pdfas; + +import at.asit.pdfover.signator.ByteArrayDocumentSource; +import at.asit.pdfover.signator.SignatureException; +import at.asit.pdfover.signator.Signer; +import at.asit.pdfover.signator.SignResult; +import at.asit.pdfover.signator.SignResultImpl; +import at.asit.pdfover.signator.SignatureParameter; +import at.asit.pdfover.signator.SignaturePosition; +import at.asit.pdfover.signator.SigningState; +import at.gv.egiz.pdfas.api.PdfAs; +import at.gv.egiz.pdfas.api.sign.SignParameters; +import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; +import at.gv.egiz.pdfas.io.ByteArrayDataSink; +import at.gv.egiz.pdfas.api.commons.Constants; +import at.gv.egiz.pdfas.api.exceptions.PdfAsException; +import at.gv.egiz.pdfas.api.internal.LocalBKUParams; +import at.gv.egiz.pdfas.api.internal.PdfAsInternal; + +/** + * PDF AS Signer Implementation + */ +public class PDFASSigner implements Signer { + + /** + * The profile ID + */ + protected static final String PROFILE_ID = "SIGNATURBLOCK_DE"; + + /** + * The template URL + */ + protected static final String URL_TEMPLATE = "http://pdfover.4.gv.at/template"; + + @Override + public SigningState prepare(SignatureParameter parameter) + throws SignatureException { + try { + PdfAsSignatureParameter sign_para = null; + + if (PdfAsSignatureParameter.class.isInstance(parameter)) { + sign_para = PdfAsSignatureParameter.class.cast(parameter); + } + + if (sign_para == null) { + throw new SignatureException("Incorrect SignatureParameter!"); + } + + PdfAs pdfas = PDFASHelper.getPdfAs(); + + PDFASSigningState state = new PDFASSigningState(); + + SignParameters params = new SignParameters(); + params.setSignaturePositioning(sign_para.getPDFASPositioning()); + params.setSignatureDevice(Constants.SIGNATURE_DEVICE_BKU); + params.setSignatureType(Constants.SIGNATURE_TYPE_BINARY); + params.setSignatureProfileId(PROFILE_ID); + + if (parameter.getEmblem() != null) { + params.setProfileOverrideValue("SIG_LABEL", parameter + .getEmblem().getFileName()); + } + + params.setDocument(sign_para.getPDFASDataSource()); + + state.setSignParameters(params); + + PdfAsInternal pdfasInternal = PDFASHelper.getPdfAsInternal(); + + // Prepares the document + SignatureDetailInformation sdi = pdfas.prepareSign(params); + + state.setSignatureDetailInformation(sdi); + + // Retrieve the SL Request + String slRequest = pdfasInternal.prepareLocalSignRequest(params, + false, URL_TEMPLATE, sdi); + + PDFASSLRequest request = new PDFASSLRequest(slRequest); + + state.setSignatureRequest(request); + + return state; + } catch (PdfAsException e) { + throw new SignatureException(e); + } + } + + @Override + public SignResult sign(SigningState state) throws SignatureException { + try { + PDFASSigningState sstate = null; + + if (PDFASSigningState.class.isInstance(state)) { + sstate = PDFASSigningState.class.cast(state); + } + + if (sstate == null) { + throw new SignatureException("Incorrect SigningState!"); + } + + // Retrieve objects + PdfAs pdfas = PDFASHelper.getPdfAs(); + + PdfAsInternal pdfasInternal = PDFASHelper.getPdfAsInternal(); + + SignParameters params = sstate.getSignParameters(); + + // Prepare Output sink + ByteArrayDataSink data = new ByteArrayDataSink(); + params.setOutput(data); + + SignatureDetailInformation sdi = sstate + .getSignatureDetailInformation(); + + LocalBKUParams bkuParams = new LocalBKUParams(null, null, null); + + // Perform signature + at.gv.egiz.pdfas.api.sign.SignResult signResult = pdfasInternal + .finishLocalSign(pdfas, params, sdi, bkuParams, false, + sstate.getSignatureResponse().getSLRespone()); + + // Preparing Result Response + SignResultImpl result = new SignResultImpl(); + + // Set Signer Certificate + result.setSignerCertificate(signResult.getSignerCertificate()); + at.gv.egiz.pdfas.api.sign.pos.SignaturePosition pdfasPos = signResult + .getSignaturePosition(); + + // Set Signature position + SignaturePosition pos = new SignaturePosition(pdfasPos.getX(), + pdfasPos.getY(), pdfasPos.getPage()); +/* pos.SetAuto(sstate.getPDFAsSignatureParameter() + .getSignaturePosition().useAutoPositioning());*/ + result.setSignaturePosition(pos); + + // Set signed Document + result.setSignedDocument(new ByteArrayDocumentSource(data.getData())); + + return result; + } catch (PdfAsException e) { + throw new SignatureException(e); + } + } + + @Override + public SignatureParameter newParameter() { + return new PdfAsSignatureParameter(); + } +} diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSignerFactory.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSignerFactory.java new file mode 100644 index 00000000..eaf9637f --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSignerFactory.java @@ -0,0 +1,12 @@ +package at.asit.pdfover.signer.pdfas; + +import at.asit.pdfover.signator.Signer; +import at.asit.pdfover.signator.SignerFactory; + +public class PDFASSignerFactory extends SignerFactory { + + @Override + public Signer createSigner() { + return new PDFASSigner(); + } +} diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigningState.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigningState.java new file mode 100644 index 00000000..8b8216c6 --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigningState.java @@ -0,0 +1,87 @@ +package at.asit.pdfover.signer.pdfas; + +import at.asit.pdfover.signator.SLRequest; +import at.asit.pdfover.signator.SLResponse; +import at.asit.pdfover.signator.SigningState; +import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; + +/** + * Signing State for PDFAS Wrapper + * @author afitzek + */ +public class PDFASSigningState implements SigningState { + + /** + * The Signature Layer request + */ + protected SLRequest slrequest; + + /** + * The Signature Layer response + */ + protected SLResponse slresponse; + + @Override + public SLRequest getSignatureRequest() { + return this.slrequest; + } + + @Override + public void setSignatureResponse(SLResponse response) { + this.slresponse = response; + } + + /** + * Sets the SL Request + * @param request The SL Request + */ + public void setSignatureRequest(SLRequest request) { + this.slrequest = request; + } + + /** + * Gets the SL Response + * @return The SL Repsonse object + */ + public SLResponse getSignatureResponse() { + return this.slresponse; + } + + + // ---------------------------------------- + // PDF AS Specific stuff + // ---------------------------------------- + + protected SignatureDetailInformation signatureDetailInformation; + + protected at.gv.egiz.pdfas.api.sign.SignParameters signParameters; + + protected PdfAsSignatureParameter pdfAsSignatureParameter; + + public PdfAsSignatureParameter getPdfAsSignatureParameter() { + return pdfAsSignatureParameter; + } + + public void setPdfAsSignatureParameter( + PdfAsSignatureParameter pdfAsSignatureParameter) { + this.pdfAsSignatureParameter = pdfAsSignatureParameter; + } + + public at.gv.egiz.pdfas.api.sign.SignParameters getSignParameters() { + return signParameters; + } + + public void setSignParameters( + at.gv.egiz.pdfas.api.sign.SignParameters signParameters) { + this.signParameters = signParameters; + } + + public SignatureDetailInformation getSignatureDetailInformation() { + return signatureDetailInformation; + } + + public void setSignatureDetailInformation( + SignatureDetailInformation signatureDetailInformation) { + this.signatureDetailInformation = signatureDetailInformation; + } +} diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java new file mode 100644 index 00000000..7332a13e --- /dev/null +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java @@ -0,0 +1,37 @@ +package at.asit.pdfover.signer.pdfas; + +import at.asit.pdfover.signator.SignatureDimension; +import at.asit.pdfover.signator.SignatureParameter; +import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning; +import at.gv.egiz.pdfas.api.io.DataSource; + +public class PdfAsSignatureParameter extends SignatureParameter { + + @Override + public SignatureDimension getPlaceholderDimension() { + // TODO Auto-generated method stub + return null; + } + + public SignaturePositioning getPDFASPositioning() { + // TODO: implement Signature creation + return new SignaturePositioning(); + } + + public DataSource getPDFASDataSource() { + // TODO: implement Signature creation + return new ByteArrayPDFASDataSource(null); + } + + @Override + public void setProperty(String key, String value) { + // TODO Auto-generated method stub + + } + + @Override + public String getProperty(String key) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/pdf-over-signer/pom.xml b/pdf-over-signer/pom.xml new file mode 100644 index 00000000..f09aaa5d --- /dev/null +++ b/pdf-over-signer/pom.xml @@ -0,0 +1,16 @@ + + 4.0.0 + + pdf-over + a-sit.at + 4.0.0-SNAPSHOT + .. + + pdf-over-signer + PDF-Over PDF-Signer libraries + pom + + pdf-over-sigpdfas + + \ No newline at end of file -- cgit v1.2.3