From e6e4bdc24bbb6f59e80d1ad0765cf8111695e3d3 Mon Sep 17 00:00:00 2001 From: tkellner Date: Fri, 13 Jul 2012 10:00:21 +0000 Subject: Check signing certificate for validity git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1103 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../bku/slcommands/impl/CreateXMLSignatureCommandImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bkucommon/src/main') diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandImpl.java index 4827ab16..5f8bebec 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandImpl.java @@ -25,6 +25,8 @@ package at.gv.egiz.bku.slcommands.impl; import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateExpiredException; +import java.security.cert.CertificateNotYetValidException; import java.security.cert.X509Certificate; import java.util.Collections; import java.util.Date; @@ -229,6 +231,16 @@ public class CreateXMLSignatureCommandImpl extends log.info("Got signing certificate."); } + // check certificate for validity + try { + signingCertificate.checkValidity(); + log.info("signing certificate is valid"); + } catch (CertificateExpiredException e) { + log.warn("Your signing certificate has expired!"); + } catch (CertificateNotYetValidException e) { + log.warn("Your signing certificate is not yet valid!"); + } + // prepare the XMLSignature for signing log.info("Preparing XML signature."); prepareXMLSignature(commandContext); -- cgit v1.2.3