fun findRevokedCertificate()

in lib/src/main/kotlin/org/jetbrains/zip/signer/signer/CertificateUtils.kt [156:174]


    fun findRevokedCertificate(
        certs: List<X509Certificate>,
        revocationLists: List<X509CRL>
    ): X509Certificate? {
        if (revocationLists.size != certs.size - 1) {
            throw IllegalArgumentException(
                "Number of revocation lists should be one less than the number of certificates"
            )
        }
        return certs
            .zipWithNext()
            .zip(revocationLists) { certificates, revocationList ->
                Triple(certificates.first, certificates.second, revocationList)
            }
            .reversed()
            .find { (certificate, certificateAuthority, revocationList) ->
                isCertificateRevoked(certificate, certificateAuthority, revocationList)
            }?.first
    }