All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.cert.path.CertPathValidationResultBuilder Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation. This jar contains APIs for JDK 1.8 and up. The APIs are designed primarily to be used in conjunction with the BC LTS provider but may also be used with other providers providing cryptographic services.

There is a newer version: 2.73.7
Show newest version
package org.bouncycastle.cert.path;

import java.util.ArrayList;
import java.util.List;

import org.bouncycastle.util.Integers;

class CertPathValidationResultBuilder
{
    private final CertPathValidationContext context;
    private final List certIndexes = new ArrayList();
    private final List ruleIndexes = new ArrayList();
    private final List exceptions = new ArrayList();

    CertPathValidationResultBuilder(CertPathValidationContext context)
    {
        this.context = context;
    }

    public CertPathValidationResult build()
    {
        if (exceptions.isEmpty())
        {
            return new CertPathValidationResult(context);
        }
        else
        {
            return new CertPathValidationResult(context,
                toInts(certIndexes), toInts(ruleIndexes), (CertPathValidationException[])exceptions.toArray(new CertPathValidationException[exceptions.size()]));
        }
    }

    public void addException(int certIndex, int ruleIndex, CertPathValidationException exception)
    {
        this.certIndexes.add(Integers.valueOf(certIndex));
        this.ruleIndexes.add(Integers.valueOf(ruleIndex));
        this.exceptions.add(exception);
    }

    private int[] toInts(List values)
    {
        int[] rv = new int[values.size()];

        for (int i = 0; i != rv.length; i++)
        {
            rv[i] = ((Integer)values.get(i)).intValue();
        }

        return rv;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy