Top Description Inners Fields Constructors Methods
java.security.cert

public Class CertPathValidatorException

extends GeneralSecurityException
Class Inheritance
Imports
java.io.InvalidObjectException, .IOException, .ObjectInputStream, java.security.GeneralSecurityException

An exception indicating one of a variety of problems encountered when validating a certification path.

A CertPathValidatorException provides support for wrapping exceptions. The getCause method returns the throwable, if any, that caused this exception to be thrown.

A CertPathValidatorException may also include the certification path that was being validated when the exception was thrown, the index of the certificate in the certification path that caused the exception to be thrown, and the reason that caused the failure. Use the getCertPath, getIndex, and getReason methods to retrieve this information.

Concurrent Access

Unless otherwise specified, the methods defined in this class are not thread-safe. Multiple threads that need to access a single object concurrently should synchronize amongst themselves and provide the necessary locking. Multiple threads each manipulating separate objects need not synchronize.

Author
Yassir Elley
Since
1.4
See Also
CertPathValidator

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
CertPathValidatorException.BasicReason

The BasicReason enumerates the potential reasons that a certification path of any type may be invalid.

public static interface
CertPathValidatorException.Reason

The reason the validation algorithm failed.

Field Summary

Modifier and TypeField and Description
private final CertPath
private int
private CertPathValidatorException.Reason
private static final long

Constructor Summary

AccessConstructor and Description
public
CertPathValidatorException()

Creates a CertPathValidatorException with no detail message.

public
CertPathValidatorException(String
the detail message
msg
)

Creates a CertPathValidatorException with the given detail message.

public
CertPathValidatorException(Throwable
the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
cause
)

Creates a CertPathValidatorException that wraps the specified throwable.

public
CertPathValidatorException(String
the detail message
msg
,
Throwable
the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
cause
)

Creates a CertPathValidatorException with the specified detail message and cause.

public
CertPathValidatorException(String
the detail message (or null if none)
msg
,
Throwable
the cause (or null if none)
cause
,
CertPath
the certification path that was in the process of being validated when the error was encountered
certPath
,
int
the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a CertPath is zero based.
index
)

Creates a CertPathValidatorException with the specified detail message, cause, certification path, and index.

public
CertPathValidatorException(String
the detail message (or null if none)
msg
,
Throwable
the cause (or null if none)
cause
,
CertPath
the certification path that was in the process of being validated when the error was encountered
certPath
,
int
the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a CertPath is zero based.
index
,
CertPathValidatorException.Reason
the reason the validation failed
reason
)

Creates a CertPathValidatorException with the specified detail message, cause, certification path, index, and reason.

Method Summary

Modifier and TypeMethod and Description
public CertPath

Returns:

the CertPath that was being validated when the exception was thrown (or null if not specified)
getCertPath
()

Returns the certification path that was being validated when the exception was thrown.

public int

Returns:

the index that has been set, or -1 if none has been set
getIndex
()

Returns the index of the certificate in the certification path that caused the exception to be thrown.

public CertPathValidatorException.Reason

Returns:

the reason that the validation failed, or BasicReason.UNSPECIFIED if a reason has not been specified
getReason
()

Returns the reason that the validation failed.

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
stream
)

Hides java.lang.Throwable.readObject.

Restores the state of this object from the stream.

Field Detail

certPathback to summary
private final CertPath certPath
indexback to summary
private int index
reasonback to summary
private CertPathValidatorException.Reason reason
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.GeneralSecurityException.serialVersionUID.

Annotations
@Serial

Constructor Detail

CertPathValidatorExceptionback to summary
public CertPathValidatorException()

Creates a CertPathValidatorException with no detail message.

CertPathValidatorExceptionback to summary
public CertPathValidatorException(String msg)

Creates a CertPathValidatorException with the given detail message. A detail message is a String that describes this particular exception.

Parameters
msg:String

the detail message

CertPathValidatorExceptionback to summary
public CertPathValidatorException(Throwable cause)

Creates a CertPathValidatorException that wraps the specified throwable. This allows any exception to be converted into a CertPathValidatorException, while retaining information about the wrapped exception, which may be useful for debugging. The detail message is set to (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).

Parameters
cause:Throwable

the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

CertPathValidatorExceptionback to summary
public CertPathValidatorException(String msg, Throwable cause)

Creates a CertPathValidatorException with the specified detail message and cause.

Parameters
msg:String

the detail message

cause:Throwable

the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

CertPathValidatorExceptionback to summary
public CertPathValidatorException(String msg, Throwable cause, CertPath certPath, int index)

Creates a CertPathValidatorException with the specified detail message, cause, certification path, and index.

Parameters
msg:String

the detail message (or null if none)

cause:Throwable

the cause (or null if none)

certPath:CertPath

the certification path that was in the process of being validated when the error was encountered

index:int

the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a CertPath is zero based.

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < -1 || (certPath != null && index >= certPath.getCertificates().size())
IllegalArgumentException:
if certPath is null and index is not -1
CertPathValidatorExceptionback to summary
public CertPathValidatorException(String msg, Throwable cause, CertPath certPath, int index, CertPathValidatorException.Reason reason)

Creates a CertPathValidatorException with the specified detail message, cause, certification path, index, and reason.

Parameters
msg:String

the detail message (or null if none)

cause:Throwable

the cause (or null if none)

certPath:CertPath

the certification path that was in the process of being validated when the error was encountered

index:int

the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a CertPath is zero based.

reason:CertPathValidatorException.Reason

the reason the validation failed

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < -1 || (certPath != null && index >= certPath.getCertificates().size())
IllegalArgumentException:
if certPath is null and index is not -1
NullPointerException:
if reason is null
Since
1.7

Method Detail

getCertPathback to summary
public CertPath getCertPath()

Returns the certification path that was being validated when the exception was thrown.

Returns:CertPath

the CertPath that was being validated when the exception was thrown (or null if not specified)

getIndexback to summary
public int getIndex()

Returns the index of the certificate in the certification path that caused the exception to be thrown. Note that the list of certificates in a CertPath is zero based. If no index has been set, -1 is returned.

Returns:int

the index that has been set, or -1 if none has been set

getReasonback to summary
public CertPathValidatorException.Reason getReason()

Returns the reason that the validation failed. The reason is associated with the index of the certificate returned by getIndex.

Returns:CertPathValidatorException.Reason

the reason that the validation failed, or BasicReason.UNSPECIFIED if a reason has not been specified

Since
1.7
readObjectback to summary
private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException

Hides java.lang.Throwable.readObject.

Restores the state of this object from the stream.

Parameters
stream:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
ClassNotFoundException:
if a serialized class cannot be loaded
IOException:
if an I/O error occurs
java.security.cert back to summary

public final Enum CertPathValidatorException.BasicReason

extends Enum<CertPathValidatorException.BasicReason>
implements Reason
Class Inheritance
All Implemented Interfaces
java.security.cert.CertPathValidatorException.Reason, java.io.Serializable

The BasicReason enumerates the potential reasons that a certification path of any type may be invalid.
Since
1.7

Field Summary

Modifier and TypeField and Description
public static final CertPathValidatorException.BasicReason
ALGORITHM_CONSTRAINED

The public key or the signature algorithm has been constrained.

public static final CertPathValidatorException.BasicReason
EXPIRED

The certificate is expired.

public static final CertPathValidatorException.BasicReason
INVALID_SIGNATURE

The signature is invalid.

public static final CertPathValidatorException.BasicReason
NOT_YET_VALID

The certificate is not yet valid.

public static final CertPathValidatorException.BasicReason
REVOKED

The certificate is revoked.

public static final CertPathValidatorException.BasicReason
UNDETERMINED_REVOCATION_STATUS

The revocation status of the certificate could not be determined.

public static final CertPathValidatorException.BasicReason
UNSPECIFIED

Unspecified reason.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static CertPathValidatorException.BasicReason
public static CertPathValidatorException.BasicReason[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ALGORITHM_CONSTRAINEDback to summary
public static final CertPathValidatorException.BasicReason ALGORITHM_CONSTRAINED

The public key or the signature algorithm has been constrained.

EXPIREDback to summary
public static final CertPathValidatorException.BasicReason EXPIRED

The certificate is expired.

INVALID_SIGNATUREback to summary
public static final CertPathValidatorException.BasicReason INVALID_SIGNATURE

The signature is invalid.

NOT_YET_VALIDback to summary
public static final CertPathValidatorException.BasicReason NOT_YET_VALID

The certificate is not yet valid.

REVOKEDback to summary
public static final CertPathValidatorException.BasicReason REVOKED

The certificate is revoked.

UNDETERMINED_REVOCATION_STATUSback to summary
public static final CertPathValidatorException.BasicReason UNDETERMINED_REVOCATION_STATUS

The revocation status of the certificate could not be determined.

UNSPECIFIEDback to summary
public static final CertPathValidatorException.BasicReason UNSPECIFIED

Unspecified reason.

Constructor Detail

BasicReasonback to summary
private BasicReason()

Method Detail

valueOfback to summary
public static CertPathValidatorException.BasicReason valueOf(String name)
valuesback to summary
public static CertPathValidatorException.BasicReason[] values()
java.security.cert back to summary

public Interface CertPathValidatorException.Reason

extends Serializable
Known Direct Implementers
java.security.cert.CertPathValidatorException.BasicReason, java.security.cert.PKIXReason

The reason the validation algorithm failed.
Since
1.7