AlwaysTrustTrustLinker.java

  1. /*
  2.  * Java Trust Project.
  3.  * Copyright (C) 2018-2019 e-Contract.be BVBA.
  4.  *
  5.  * This is free software; you can redistribute it and/or modify it
  6.  * under the terms of the GNU Lesser General Public License version
  7.  * 3.0 as published by the Free Software Foundation.
  8.  *
  9.  * This software is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12.  * Lesser General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Lesser General Public
  15.  * License along with this software; if not, see
  16.  * http://www.gnu.org/licenses/.
  17.  */

  18. package be.fedict.trust.linker;

  19. import java.security.cert.X509Certificate;
  20. import java.util.Date;

  21. import org.slf4j.Logger;
  22. import org.slf4j.LoggerFactory;

  23. import be.fedict.trust.policy.AlgorithmPolicy;
  24. import be.fedict.trust.revocation.RevocationData;

  25. /**
  26.  * This trust linker implementation can be used to validate expired
  27.  * certificates.
  28.  *
  29.  * @author Frank Cornelis
  30.  *
  31.  */
  32. public class AlwaysTrustTrustLinker implements TrustLinker {

  33.     private static final Logger LOGGER = LoggerFactory.getLogger(AlwaysTrustTrustLinker.class);

  34.     @Override
  35.     public TrustLinkerResult hasTrustLink(X509Certificate childCertificate, X509Certificate certificate,
  36.             Date validationDate, RevocationData revocationData, AlgorithmPolicy algorithmPolicy)
  37.             throws TrustLinkerResultException, Exception {
  38.         LOGGER.warn("trusting certificate as is: {}", certificate.getSubjectX500Principal());
  39.         return TrustLinkerResult.TRUSTED;
  40.     }
  41. }