org.bouncycastle.cert.path.CertPathValidationResultBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpkix-fips Show documentation
Show all versions of bcpkix-fips Show documentation
The Bouncy Castle Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation. The APIs are designed primarily to be used in conjunction with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified.
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 - 2024 Weber Informatics LLC | Privacy Policy