eu.emi.security.authn.x509
Class ValidationResult

java.lang.Object
  extended by eu.emi.security.authn.x509.ValidationResult

public class ValidationResult
extends Object

Wraps a validation result, error messages and unresolved certificate extension oids (if any).

Author:
K. Benedyczak
See Also:
X509CertChainValidator

Constructor Summary
ValidationResult(boolean valid)
          Constructor used when no errors are provided and no information about unresolved extensions.
ValidationResult(boolean valid, List<ValidationError> errors)
          Constructor used when no information about unresolved extensions is provided.
ValidationResult(boolean valid, List<ValidationError> errors, Set<String> unresolvedCriticalExtensions, List<X509Certificate> validChain)
          Constructor used to provide a full information set about validation problem.
 
Method Summary
 void addErrors(List<ValidationError> errors)
          Adds specified errors to this result (may change valid flag).
 List<ValidationError> getErrors()
          Returns list of problems found.
 Set<String> getUnresolvedCriticalExtensions()
          Returns a set of unresolved critical certificate extensions.
 List<X509Certificate> getValidChain()
          Returns the resolved, valid certificate chain which was validated.
 boolean isValid()
          Returns whether validation was successful or not.
 String toShortString()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidationResult

public ValidationResult(boolean valid)
Constructor used when no errors are provided and no information about unresolved extensions.

Parameters:
valid - whether validation was valid (true) or not (false).

ValidationResult

public ValidationResult(boolean valid,
                        List<ValidationError> errors)
Constructor used when no information about unresolved extensions is provided.

Parameters:
valid - whether validation was valid (true) or not (false).
errors - list of errors found

ValidationResult

public ValidationResult(boolean valid,
                        List<ValidationError> errors,
                        Set<String> unresolvedCriticalExtensions,
                        List<X509Certificate> validChain)
Constructor used to provide a full information set about validation problem.

Parameters:
valid - whether validation was valid (true) or not (false).
errors - list of errors found
unresolvedCriticalExtensions - set of unresolved critical extensions
validChain - null if input is invalid or full, valid chain including trust anchor and all discovered intermediary CAs.
Method Detail

addErrors

public void addErrors(List<ValidationError> errors)
Adds specified errors to this result (may change valid flag).

Parameters:
errors - to be added

isValid

public boolean isValid()
Returns whether validation was successful or not.

Returns:
true if the validated chain turned out to be valid, false otherwise.

getErrors

public List<ValidationError> getErrors()
Returns list of problems found. Empty list is returned if certificate chain is valid.

Returns:
list of ValidationErrors

getUnresolvedCriticalExtensions

public Set<String> getUnresolvedCriticalExtensions()
Returns a set of unresolved critical certificate extensions.

Returns:
set of unresolved critical extensions OIDs in String form

getValidChain

public List<X509Certificate> getValidChain()
Returns the resolved, valid certificate chain which was validated. The returned chain typically is the validation input chain with the proper trust anchor (i.e. the matching CA certificate from the trust store). In rare cases it can contain also intermediary CA certificates which were downloaded.

Returns:
the resolved valid chain or null if validation was not successful.
Since:
1.1.0

toShortString

public String toShortString()
Returns:
a short representation of validation result, which will contain only one (hopefully the most significant) validation error description.

toString

public String toString()
Overrides:
toString in class Object
Returns:
a full (multiline) representation of validation result, including detailed information about all validation errors found.


Copyright © 2012-2013 European Middleware Initiative. All Rights Reserved.