Issue with Client Certificate Revocation Check in Azure API Management

Problem:
We are implementing client certificate validation in Azure API Management (APIM) and encountering issues with certificate revocation checks. Specifically, APIM returns the following error for both valid and revoked certificates:

Message: The revocation function was unable to check revocation for the certificate.
ExceptionType: ClientCertificateRevocationCheckFailed

If we disable revocation validation (validate-revocation="false"), the API requests work as expected.

Setup:

  1. Added our root certificate to Azure API Management as a CA certificate (Root). This root certificate serves as the anchor of trust for the entire certificate chain.

  2. Added our intermediate certificate to Azure API Management as a CA certificate (Intermediate Certificate). The intermediate certificate includes a Certificate Revocation List (CRL) URL. Both our intermediate certificate and client certificates have a Certificate Distribution Point (CDP) that points to the CRL. We have verified the CRL URLs and the revocation status of certificates using OpenSSL, ensuring that the CRL is accessible and correctly indicates revoked certificates.

  3. Enabled the “Negotiate client certificate” option on the Self-Hosted Gateway under Custom Domains. This configuration ensures that the gateway will request and negotiate client certificates during the TLS handshake, allowing us to enforce client certificate validation policies.

  4. Applied the following policy in APIM:

<policies>
    <inbound>
        <validate-client-certificate validate-revocation="true" validate-trust="true" validate-not-before="false" validate-not-after="false" ignore-error="false" />
        <base />
    </inbound>
    <backend>
        <base />
    </backend>
    <outbound>
        <base />
    </outbound>
    <on-error>
        <base />
    </on-error>
</policies>
  1. Tested API requests using both valid and revoked client certificates.

Troubleshooting:
We validated the certificates and CRL URLs using the following C# code, which correctly identifies revoked and non-revoked certificates:

using System;
using System.Net;
using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
 
public class CertificateValidator
{
    private static readonly HttpClient httpClient = new HttpClient();
 
    public static bool ValidateCertificate(X509Certificate2 clientCertificate)
    {
        if (clientCertificate == null)
        {
            throw new ArgumentNullException(nameof(clientCertificate));
        }
 
        // Check if the certificate is valid
        if (DateTime.Now > clientCertificate.NotAfter || DateTime.Now < clientCertificate.NotBefore)
        {
            return false;
        }
 
        // Check if the certificate has been revoked
        bool isRevoked = CheckCertificateRevocation(clientCertificate).Result;
        return !isRevoked;
    }
 
    private static async Task<bool> CheckCertificateRevocation(X509Certificate2 certificate)
    {
        // Get the CRL distribution points from the certificate
        foreach (X509Extension extension in certificate.Extensions)
        {
            if (extension is X509CrlDistributionPointsExtension crlDistributionPointsExtension)
            {
                foreach (var distributionPoint in crlDistributionPointsExtension.DistributionPoints)
                {
                    if (await CheckRevocationList(distributionPoint.FullName, certificate))
                    {
                        return true; // Certificate is revoked
                    }
                }
            }
        }
        return false; // Certificate is not revoked
    }
 
    private static async Task<bool> CheckRevocationList(string crlUrl, X509Certificate2 certificate)
    {
        try
        {
            // Download the CRL from the distribution point
            byte[] crlData = await httpClient.GetByteArrayAsync(crlUrl);
            X509Crl2 crl = new X509Crl2(crlData);
 
            // Check if the certificate serial number is in the CRL
            foreach (var entry in crl.RevokedCertificates)
            {
                if (entry.SerialNumber == certificate.SerialNumber)
                {
                    return true; // Certificate is revoked
                }
            }
        }
        catch
        {
            // Handle exceptions appropriately (e.g., log them)
        }
        return false; // Certificate is not revoked
    }
}
 
// Example usage
public class Program
{
    public static void Main()
    {
        // Load a client certificate from file
        X509Certificate2 clientCertificate = new X509Certificate2("path/to/certificate.cer");
 
        // Validate the certificate
        bool isValid = CertificateValidator.ValidateCertificate(clientCertificate);
 
        Console.WriteLine($"Certificate is valid: {isValid}");
    }
}

Question:
How can we determine the root cause of the certificate revocation check failure in Azure API Management? Are there specific logs or diagnostic tools available that can help us troubleshoot this issue?

Recognized by Microsoft Azure Collective

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật