package eu.europa.esig.dss.validation.process.bbb.xcv.checks;

import eu.europa.esig.dss.jaxb.detailedreport.XmlXCV;
import eu.europa.esig.dss.validation.MessageTag;
import eu.europa.esig.dss.validation.policy.rules.Indication;
import eu.europa.esig.dss.validation.policy.rules.SubIndication;
import eu.europa.esig.dss.validation.process.ChainItem;
import eu.europa.esig.dss.validation.wrappers.CertificateWrapper;
import eu.europa.esig.dss.validation.wrappers.RevocationWrapper;
import eu.europa.esig.jaxb.policy.LevelConstraint;

public class IntermediateCertificateRevokedCheck extends ChainItem<XmlXCV> {

	private final CertificateWrapper certificate;

	public IntermediateCertificateRevokedCheck(XmlXCV result, CertificateWrapper certificate, LevelConstraint constraint) {
		super(result, constraint);
		this.certificate = certificate;
	}

	@Override
	protected boolean process() {
		RevocationWrapper revocationData = certificate.getRevocationData();
		return (revocationData != null) && !revocationData.isStatus();
	}

	@Override
	protected MessageTag getMessageTag() {
		return MessageTag.BBB_XCV_IICR;
	}

	@Override
	protected MessageTag getErrorMessageTag() {
		return MessageTag.BBB_XCV_IICR_ANS;
	}

	@Override
	protected Indication getFailedIndicationForConclusion() {
		return Indication.INDETERMINATE;
	}

	@Override
	protected SubIndication getFailedSubIndicationForConclusion() {
		return SubIndication.REVOKED_CA_NO_POE;
	}

}

@@ -465,32 +465,82 @@
 ocationWrapper;%0A
+import eu.europa.esig.dss.x509.crl.CRLReasonEnum;%0A
 import eu.europa
@@ -1003,22 +1003,35 @@
 ta();%0A%09%09
-return
+boolean isRevoked =
  (revoca
@@ -1077,16 +1077,148 @@
 Status()
+ && !CRLReasonEnum.certificateHold.name().equals(revocationData.getReason());%0A%09%09if (!isRevoked) %7B%0A%09%09%09return true;%0A%09%09%7D%0A%09%09return false
 ;%0A%09%7D%0A%0A%09@

Fix IntermediateCertificateRevokedCheck