diff options
| author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2026-04-15 13:49:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-15 13:49:22 +0200 |
| commit | 77dd3fcc4d85088b15ab859c4438521d9cd6ed10 (patch) | |
| tree | aefedc8d2ef77e6819b46a948459d6016dfe5b62 /pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java | |
| parent | 88930540361a88ff56e07fed31004b583f2e729f (diff) | |
| download | pdf-as-4-77dd3fcc4d85088b15ab859c4438521d9cd6ed10.tar.gz pdf-as-4-77dd3fcc4d85088b15ab859c4438521d9cd6ed10.tar.bz2 pdf-as-4-77dd3fcc4d85088b15ab859c4438521d9cd6ed10.zip | |
pdf-as-5 (#82)
- JDK 17
- PDFBox 3
- PDF-AS Web moved to Spring Boot
- MOA Integration tests w/ new error code
---------
Co-authored-by: Gerald Palfinger <gerald.palfinger@a-sit.at>
Co-authored-by: kathrin.resek <kathrin.resek@a-sit.at>
Diffstat (limited to 'pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java')
| -rw-r--r-- | pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java deleted file mode 100644 index 7349dbec..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - ******************************************************************************/ -package at.gv.egiz.pdfas.wrapper; - -import java.io.OutputStream; -import java.util.Enumeration; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.pdfas.api.exceptions.ErrorCode; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -import at.gv.egiz.pdfas.api.sign.SignParameters; -import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.gv.egiz.pdfas.lib.api.sign.SignResult; -import at.gv.egiz.pdfas.moa.MOAConnector; -import at.gv.egiz.pdfas.sigs.pades.PAdESSigner; -import at.gv.egiz.sl.util.BKUSLConnector; - -public class SignParameterWrapper { - - private static final Logger logger = LoggerFactory - .getLogger(SignParameterWrapper.class); - - private SignParameter signParameter4; - private SignParameters signParameters; - - public SignParameterWrapper(SignParameters signParameters, - SignParameter signParameter4) { - this.signParameter4 = signParameter4; - this.signParameters = signParameters; - } - - public void syncOldToNew() throws PdfAsException { - - if (this.signParameters.getSignaturePositioning() != null) { - // Create positioning string - String posString = this.signParameters.getSignaturePositioning() - .getPositionString(); - logger.info("Pos String: " + posString); - if (posString.equals("x:auto;y:auto;w:auto;p:auto;f:0.0")) { - this.signParameter4.setSignaturePosition(null); - } else { - this.signParameter4.setSignaturePosition(posString); - } - } else { - this.signParameter4.setSignaturePosition(null); - } - - // Select signing device - if (this.signParameters.getSignatureDevice().equals("moa")) { - try { - this.signParameter4 - .setPlainSigner(new PAdESSigner(new MOAConnector( - this.signParameter4.getConfiguration()))); - } catch (Exception e) { - throw new PdfAsException(ErrorCode.CERTIFICATE_NOT_FOUND, - "You need to specify MOA certificate file to use moa (moa.sign.Certificate)"); - } - } else if (this.signParameters.getSignatureDevice().equals("bku")) { - this.signParameter4 - .setPlainSigner(new PAdESSigner(new BKUSLConnector( - this.signParameter4.getConfiguration()))); - } else { - throw new PdfAsException(ErrorCode.UNSUPPORTED_SIGNATURE, - "Unsupported device! Use bku or moa!"); - } - - // Overwrite Configurations - Enumeration<Object> keys = this.signParameters - .getProfileOverrideProperties().keys(); - - while (keys.hasMoreElements()) { - Object obj = keys.nextElement(); - if (obj != null) { - String key = obj.toString(); - this.signParameter4.getConfiguration().setValue( - key, - this.signParameters.getProfileOverrideProperties() - .getProperty(key)); - } - } - } - - public void syncNewToOld(SignResult result) throws PdfAsException { - try { - //OutputStream os = this.signParameters.getOutput() - // .createOutputStream("application/pdf"); - //IOUtils.copy(result.getOutputDocument(), os); - //os.close(); - } catch (Exception e) { - throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, - e.getMessage()); - } - } - - public SignParameter getSignParameter4() { - return this.signParameter4; - } - - public SignParameters getSignParameters() { - return this.signParameters; - } -} |
