xades4j.providers.ValidationData Maven / Gradle / Ivy
Show all versions of xades4j Show documentation
/*
* XAdES4j - A Java library for generation and verification of XAdES signatures.
* Copyright (C) 2010 Luis Goncalves.
*
* XAdES4j is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or any later version.
*
* XAdES4j is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with XAdES4j. If not, see .
*/
package xades4j.providers;
import java.security.cert.X509CRL;
import java.security.cert.X509Certificate;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Container of validation data (certificates and corresponding CRLs).
*
* Contains the full certification chain, starting with the signing certificate
* and endind with the trust-anchor.
* @author Luís
*/
public class ValidationData
{
private final List certs;
private final Collection crls;
/**
* @param crls the CRLs used to validate the certificates in {@code certs}. Might be {@code null}.
* @throws NullPointerException if {@code certs} is {@code null}
* @throws IllegalArgumentException if {@code certs} is empty
*/
public ValidationData(
List certs,
Collection crls)
{
if (null == certs)
throw new NullPointerException("Null cert path");
if (certs.isEmpty())
throw new IllegalArgumentException("Empty cert path");
this.certs = Collections.unmodifiableList(certs);
if (null == crls)
this.crls = Collections.emptyList();
else
this.crls = Collections.unmodifiableCollection(crls);
}
public ValidationData(List certs)
{
this(certs, null);
}
public List getCerts()
{
return certs;
}
public Collection getCrls()
{
return crls;
}
}