From 17ca0eee124f6aed0837a938b3bfd4ca60fe5d0e Mon Sep 17 00:00:00 2001 From: Emina Ahmetovic Date: Mon, 2 Nov 2020 16:18:55 +0100 Subject: Code cleanup --- pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java | 6 ++---- pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java | 4 ---- pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java | 2 +- pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java | 4 ++-- .../at/gv/egiz/pdfas/lib/impl/verify/pdfbox/PDFBOXVerifier.java | 8 ++++---- .../main/java/at/gv/egiz/pdfas/web/sl20/JsonSecurityUtils.java | 4 ---- 6 files changed, 9 insertions(+), 19 deletions(-) diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java index 57a89df0..324712cb 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java @@ -72,7 +72,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, private ISettings settings; public PdfAsImpl(File cfgFile) { - logger.trace("Initializing PDF-AS with config: " + cfgFile.getPath()); + logger.debug("Initializing PDF-AS with config: " + cfgFile.getPath()); this.settings = new Settings(cfgFile); } @@ -369,9 +369,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, for (int i = 0; i < byteRange.length; i++) { sb.append(" " + byteRange[i]); } - - logger.trace("ByteRange: " + sb.toString()); - + logger.debug("ByteRange: " + sb.toString()); request.setSignatureData(signatureDataExtractor .getSignatureData()); diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java index 4a32390b..2e5c972f 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java @@ -170,17 +170,13 @@ public class BKUSLConnector extends BaseSLConnector { } holder.getProcessInfo().add(hdr); - } - } BKUHeader hdr = new BKUHeader( ErrorConstants.STATUS_INFO_SIGDEVICE, SIGNATURE_DEVICE); logger.debug("Response Header : {}", hdr.toString()); - holder.getProcessInfo().add(hdr); - } BufferedReader rd = new BufferedReader(new InputStreamReader( diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java index 46857249..2744276e 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java @@ -97,7 +97,7 @@ public abstract class BaseSLConnector implements ISLConnector, byte[] data = PDFUtils.blackOutSignature(signatureData, byteRange); RequestPackage pack = new RequestPackage(); int[] exclude_range = PDFUtils.buildExcludeRange(byteRange); - logger.info("Exclude Byte Range: " + exclude_range[0] + " " + logger.debug("Exclude Byte Range: " + exclude_range[0] + " " + exclude_range[1]); MetaInfoType metaInfoType = new MetaInfoType(); diff --git a/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java b/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java index c8a60575..cc739b9e 100644 --- a/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java +++ b/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java @@ -123,7 +123,7 @@ public class MOAConnector implements ISignatureConnector, String certificateValue = config.getValue(MOA_SIGN_CERTIFICATE); if (certificateValue.startsWith("http")) { - logger.trace("Loading certificate from url: " + certificateValue); + logger.debug("Loading certificate from url: " + certificateValue); try { URL certificateURL = new URL(certificateValue); @@ -144,7 +144,7 @@ public class MOAConnector implements ISignatureConnector, certFile = new File(certificateValue); } - logger.trace("Loading certificate from file: " + logger.debug("Loading certificate from file: " + certificateValue); this.certificate = new X509Certificate(new FileInputStream( diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/pdfbox/PDFBOXVerifier.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/pdfbox/PDFBOXVerifier.java index ae64878f..baec6398 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/pdfbox/PDFBOXVerifier.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/pdfbox/PDFBOXVerifier.java @@ -93,10 +93,10 @@ public class PDFBOXVerifier implements VerifyBackend { COSBase base = field.getDictionaryObject("V"); COSDictionary dict = (COSDictionary) base; - logger.trace("Signer: " + dict.getNameAsString("Name")); - logger.trace("SubFilter: " + dict.getNameAsString("SubFilter")); - logger.trace("Filter: " + dict.getNameAsString("Filter")); - logger.trace("Modified: " + dict.getNameAsString("M")); + logger.debug("Signer: " + dict.getNameAsString("Name")); + logger.debug("SubFilter: " + dict.getNameAsString("SubFilter")); + logger.debug("Filter: " + dict.getNameAsString("Filter")); + logger.debug("Modified: " + dict.getNameAsString("M")); COSArray byteRange = (COSArray) dict.getDictionaryObject("ByteRange"); StringBuilder sb = new StringBuilder(); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/sl20/JsonSecurityUtils.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/sl20/JsonSecurityUtils.java index 4a0ecf47..bf37b290 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/sl20/JsonSecurityUtils.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/sl20/JsonSecurityUtils.java @@ -116,7 +116,6 @@ public class JsonSecurityUtils implements IJOSETools{ trustedCerts.add((X509Certificate) cert); else logger.info("Can not process entry: " + el + ". Reason: "); - } } @@ -124,13 +123,11 @@ public class JsonSecurityUtils implements IJOSETools{ if (signPrivKey == null || !(signPrivKey instanceof PrivateKey)) { logger.info("Can NOT open privateKey for SL2.0 signing. KeyStore="); throw new SL20Exception("sl20.03"); - } if (signCertChain == null || signCertChain.length == 0) { logger.info("NO certificate for SL2.0 signing. KeyStore="); throw new SL20Exception("sl20.03"); - } isInitialized = true; @@ -291,7 +288,6 @@ public class JsonSecurityUtils implements IJOSETools{ } else { logger.info("Signed SL2.0 response contains NO signature certificate or NO certificate fingerprint"); throw new SLCommandoParserException(); - } //set key -- cgit v1.2.3