diff options
10 files changed, 25 insertions, 39 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 c19b7b10..57a89df0 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.info("Initializing PDF-AS with config: " + cfgFile.getPath()); + logger.trace("Initializing PDF-AS with config: " + cfgFile.getPath()); this.settings = new Settings(cfgFile); } @@ -370,7 +370,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, sb.append(" " + byteRange[i]); } - logger.info("ByteRange: " + sb.toString()); + logger.trace("ByteRange: " + sb.toString()); request.setSignatureData(signatureDataExtractor diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl20/utils/SL20JSONExtractorUtils.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl20/utils/SL20JSONExtractorUtils.java index 8ed27e3c..8eb7211f 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/sl20/utils/SL20JSONExtractorUtils.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl20/utils/SL20JSONExtractorUtils.java @@ -1,6 +1,5 @@ package at.gv.egiz.sl20.utils; -import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -200,7 +199,7 @@ public class SL20JSONExtractorUtils { while (entry.hasNext()) { Entry<String, JsonElement> el = entry.next(); if (result.containsKey(el.getKey())) - log.info("Attr. Map already contains Element with Key: " + el.getKey() + ". Overwrite element ... "); + log.debug("Attr. Map already contains Element with Key: " + el.getKey() + ". Overwrite element ... "); result.put(el.getKey(), el.getValue().getAsString()); diff --git a/pdf-as-lib/src/main/resources/config/config.zip b/pdf-as-lib/src/main/resources/config/config.zip Binary files differindex 495b3028..ebfeee02 100644 --- a/pdf-as-lib/src/main/resources/config/config.zip +++ b/pdf-as-lib/src/main/resources/config/config.zip 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 a6cbcd72..c8a60575 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.info("Loading certificate from url: " + certificateValue); + logger.trace("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.info("Loading certificate from file: " + logger.trace("Loading certificate from file: " + certificateValue); this.certificate = new X509Certificate(new FileInputStream( diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java index f69b1788..f1aa78b6 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java @@ -103,7 +103,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine implements Pl private static Logger logger = LoggerFactory .getLogger(SignaturePlaceholderExtractor.class); - private static List<SignaturePlaceholderData> placeholders = new Vector<>(); + private static List<SignaturePlaceholderData> placeholders = new ArrayList<>(); private int currentPage = 0; private PDDocument doc; @@ -128,6 +128,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine implements Pl this.doc = doc; } + //todo lists returns duplicates public static List<SignaturePlaceholderData> listPlaceholders() { return placeholders; } 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 a44986f5..ae64878f 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.debug("Signer: " + dict.getNameAsString("Name")); - logger.debug("SubFilter: " + dict.getNameAsString("SubFilter")); - logger.debug("Filter: " + dict.getNameAsString("Filter")); - logger.debug("Modified: " + dict.getNameAsString("M")); + logger.trace("Signer: " + dict.getNameAsString("Name")); + logger.trace("SubFilter: " + dict.getNameAsString("SubFilter")); + logger.trace("Filter: " + dict.getNameAsString("Filter")); + logger.trace("Modified: " + dict.getNameAsString("M")); COSArray byteRange = (COSArray) dict.getDictionaryObject("ByteRange"); StringBuilder sb = new StringBuilder(); @@ -106,7 +106,7 @@ public class PDFBOXVerifier implements VerifyBackend { sb.append(" " + bytes[j]); } - logger.debug("ByteRange" + sb.toString()); + logger.trace("ByteRange" + sb.toString()); COSString content = (COSString) dict.getDictionaryObject("Contents"); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java index bca9bc5b..ba1481f9 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java @@ -345,7 +345,13 @@ public class ExternSignServlet extends HttpServlet { String placeholder_id = PdfAsParameterExtractor.getPlaceholderId(request); if(!placeholder_id.equalsIgnoreCase("")) { PlaceholderWebConfiguration.setValue(IConfigurationConstants.PLACEHOLDER_WEB_ID, placeholder_id); + } else + { + PlaceholderWebConfiguration.clear(); + } + + } catch(Exception e) { logger.error(e.getLocalizedMessage()); } diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SLDataURLServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SLDataURLServlet.java index 31f5a2ef..55946afb 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SLDataURLServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SLDataURLServlet.java @@ -118,7 +118,7 @@ public class SLDataURLServlet extends HttpServlet { String sl20ReqId = (String) request.getSession(false).getAttribute(PdfAsHelper.PDF_SESSION_PREFIX + SL20Constants.SL20_REQID); String inRespTo = SL20JSONExtractorUtils.getStringValue(sl20ReqObj, SL20Constants.SL20_INRESPTO, true); if (sl20ReqId == null || !sl20ReqId.equals(inRespTo)) { - logger.info("SL20 'reqId': " + sl20ReqId + " does NOT match to 'inResponseTo':" + inRespTo); + logger.debug("SL20 'reqId': " + sl20ReqId + " does NOT match to 'inResponseTo':" + inRespTo); throw new SL20SecurityException("SL20 'reqId': " + sl20ReqId + " does NOT match to 'inResponseTo':" + inRespTo); } 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 4f496a75..4a0ecf47 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 @@ -1,20 +1,16 @@ package at.gv.egiz.pdfas.web.sl20; -import java.io.IOException; import java.security.Key; import java.security.KeyStore; import java.security.PrivateKey; import java.security.cert.Certificate; -import java.security.cert.CertificateEncodingException; import java.security.cert.X509Certificate; import java.util.ArrayList; -import java.util.Base64; import java.util.Collections; import java.util.Enumeration; import java.util.List; import org.apache.commons.lang3.StringUtils; -import org.bouncycastle.util.encoders.Base64Encoder; import org.jose4j.jwa.AlgorithmConstraints; import org.jose4j.jwa.AlgorithmConstraints.ConstraintType; import org.jose4j.jwe.JsonWebEncryption; @@ -85,7 +81,7 @@ public class JsonSecurityUtils implements IJOSETools{ if (certChainSigning[i] instanceof X509Certificate) { signCertChain[i] = (X509Certificate)certChainSigning[i]; } else - logger.warn("NO X509 certificate for signing: " + certChainSigning[i].getType()); + logger.warn("NO X509 certificate for signing: "); } @@ -99,7 +95,7 @@ public class JsonSecurityUtils implements IJOSETools{ if (certChainEncryption[i] instanceof X509Certificate) { encCertChain[i] = (X509Certificate)certChainEncryption[i]; } else - logger.warn("NO X509 certificate for encryption: " + certChainEncryption[i].getType()); + logger.warn("NO X509 certificate for encryption: "); } } else logger.info("No encryption key for SL2.0 found. End-to-End encryption is not used."); @@ -119,20 +115,20 @@ public class JsonSecurityUtils implements IJOSETools{ if (cert != null && cert instanceof X509Certificate) trustedCerts.add((X509Certificate) cert); else - logger.info("Can not process entry: " + el + ". Reason: " + cert.toString()); + logger.info("Can not process entry: " + el + ". Reason: "); } } //some short validation if (signPrivKey == null || !(signPrivKey instanceof PrivateKey)) { - logger.info("Can NOT open privateKey for SL2.0 signing. KeyStore=" + getKeyStoreFilePath()); + 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=" + getKeyStoreFilePath()); + logger.info("NO certificate for SL2.0 signing. KeyStore="); throw new SL20Exception("sl20.03"); } @@ -205,15 +201,6 @@ public class JsonSecurityUtils implements IJOSETools{ } else { logger.info("Can NOT find JOSE certificate in truststore."); - logger.debug("JOSE certificate: " + sortedX5cCerts.get(0).toString()); - try { - logger.debug("Cert: " + Base64.getEncoder().encodeToString(sortedX5cCerts.get(0).getEncoded())); - - } catch (CertificateEncodingException e) { - e.printStackTrace(); - - } - } } else if (StringUtils.isNotEmpty(x5t256)) { @@ -289,12 +276,6 @@ public class JsonSecurityUtils implements IJOSETools{ if (!sortedX5cCerts.get(0).equals(encCertChain[0])) { logger.info("Certificate from JOSE header does NOT match encryption certificate"); logger.debug("JOSE certificate: " + sortedX5cCerts.get(0).toString()); - - try { - logger.debug("Cert: " + Base64.getEncoder().encodeToString(sortedX5cCerts.get(0).getEncoded())); - } catch (CertificateEncodingException e) { - e.printStackTrace(); - } throw new SL20Exception("sl20.05"); } @@ -303,7 +284,6 @@ public class JsonSecurityUtils implements IJOSETools{ String certFingerPrint = X509Util.x5tS256(encCertChain[0]); if (!certFingerPrint.equals(x5t256)) { logger.info("X5t256 from JOSE header does NOT match encryption certificate"); - logger.debug("X5t256 from JOSE header: " + x5t256 + " Encrytption cert: " + certFingerPrint); throw new SL20Exception("sl20.05"); } diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java index 0dcbfd9f..6845adf2 100644 --- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java @@ -126,7 +126,7 @@ public class PAdESSignerKeystore implements IPlainSigner, PAdESConstants { private KeyStore buildKeyStoreFromFile(String file, String kspassword, String type, String provider) throws Throwable { String viusalProvider = (provider == null ? "IAIK" : provider); - logger.info("Opening Keystore: " + file + " with [" + viusalProvider + logger.trace("Opening Keystore: " + file + " with [" + viusalProvider + "]"); KeyStore ks = null; |