code: @Override
      public boolean verify(final X509Certificate cert) {
          try {
              digest.reset();
              byte[] actual = digest.digest(cert.getEncoded());
              if(Arrays.equals(actual, expected))
              {
                  return true;
              }
  
              // the following code is for backwards compatibility
              actual = digest.digest(cert.getTBSCertificate());
              if(Arrays.equals(actual, expected))
              {
                  LOGGER.warn("MessageDigest over the Certificate.tbsCertificate is configured, "
                          + "but it should be over the DER encoded Certificate");
                  return true;
              } else
              {
                  return false;
              }
          } catch (CertificateEncodingException e) {
              return false;
          }
      }
docs: {@inheritDoc}