- java.lang.Object
- 
- java.security.cert.PKIXParameters
 
- 
- All Implemented Interfaces:
- Cloneable,- CertPathParameters
 - Direct Known Subclasses:
- PKIXBuilderParameters
 
 public class PKIXParameters extends Object implements CertPathParameters Parameters used as input for the PKIXCertPathValidatoralgorithm.A PKIX CertPathValidatoruses these parameters to validate aCertPathaccording to the PKIX certification path validation algorithm.To instantiate a PKIXParametersobject, an application must specify one or more most-trusted CAs as defined by the PKIX certification path validation algorithm. The most-trusted CAs can be specified using one of two constructors. An application can callPKIXParameters(Set), specifying aSetofTrustAnchorobjects, each of which identify a most-trusted CA. Alternatively, an application can callPKIXParameters(KeyStore), specifying aKeyStoreinstance containing trusted certificate entries, each of which will be considered as a most-trusted CA.Once a PKIXParametersobject has been created, other parameters can be specified (by callingsetInitialPoliciesorsetDate, for instance) and then thePKIXParametersis passed along with theCertPathto be validated toCertPathValidator.validate.Any parameter that is not set (or is set to null) will be set to the default value for that parameter. The default value for thedateparameter isnull, which indicates the current time when the path is validated. The default for the remaining parameters is the least constrained.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. - Since:
- 1.4
- See Also:
- CertPathValidator
 
- 
- 
Constructor SummaryConstructors Constructor Description PKIXParameters(KeyStore keystore)Creates an instance ofPKIXParametersthat populates the set of most-trusted CAs from the trusted certificate entries contained in the specifiedKeyStore.PKIXParameters(Set<TrustAnchor> trustAnchors)Creates an instance ofPKIXParameterswith the specifiedSetof most-trusted CAs.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCertPathChecker(PKIXCertPathChecker checker)Adds aPKIXCertPathCheckerto the list of certification path checkers.voidaddCertStore(CertStore store)Adds aCertStoreto the end of the list ofCertStores used in finding certificates and CRLs.Objectclone()Makes a copy of thisPKIXParametersobject.List<PKIXCertPathChecker>getCertPathCheckers()Returns theListof certification path checkers.List<CertStore>getCertStores()Returns an immutableListofCertStores that are used to find certificates and CRLs.DategetDate()Returns the time for which the validity of the certification path should be determined.Set<String>getInitialPolicies()Returns an immutableSetof initial policy identifiers (OID strings), indicating that any one of these policies would be acceptable to the certificate user for the purposes of certification path processing.booleangetPolicyQualifiersRejected()Gets the PolicyQualifiersRejected flag.StringgetSigProvider()Returns the signature provider's name, ornullif not set.CertSelectorgetTargetCertConstraints()Returns the required constraints on the target certificate.Set<TrustAnchor>getTrustAnchors()Returns an immutableSetof the most-trusted CAs.booleanisAnyPolicyInhibited()Checks whether the any policy OID should be processed if it is included in a certificate.booleanisExplicitPolicyRequired()Checks if explicit policy is required.booleanisPolicyMappingInhibited()Checks if policy mapping is inhibited.booleanisRevocationEnabled()Checks the RevocationEnabled flag.voidsetAnyPolicyInhibited(boolean val)Sets state to determine if the any policy OID should be processed if it is included in a certificate.voidsetCertPathCheckers(List<PKIXCertPathChecker> checkers)Sets aListof additional certification path checkers.voidsetCertStores(List<CertStore> stores)Sets the list ofCertStores to be used in finding certificates and CRLs.voidsetDate(Date date)Sets the time for which the validity of the certification path should be determined.voidsetExplicitPolicyRequired(boolean val)Sets the ExplicitPolicyRequired flag.voidsetInitialPolicies(Set<String> initialPolicies)Sets theSetof initial policy identifiers (OID strings), indicating that any one of these policies would be acceptable to the certificate user for the purposes of certification path processing.voidsetPolicyMappingInhibited(boolean val)Sets the PolicyMappingInhibited flag.voidsetPolicyQualifiersRejected(boolean qualifiersRejected)Sets the PolicyQualifiersRejected flag.voidsetRevocationEnabled(boolean val)Sets the RevocationEnabled flag.voidsetSigProvider(String sigProvider)Sets the signature provider's name.voidsetTargetCertConstraints(CertSelector selector)Sets the required constraints on the target certificate.voidsetTrustAnchors(Set<TrustAnchor> trustAnchors)Sets theSetof most-trusted CAs.StringtoString()Returns a formatted string describing the parameters.
 
- 
- 
- 
Constructor Detail- 
PKIXParameterspublic PKIXParameters(Set<TrustAnchor> trustAnchors) throws InvalidAlgorithmParameterException Creates an instance ofPKIXParameterswith the specifiedSetof most-trusted CAs. Each element of the set is aTrustAnchor.Note that the Setis copied to protect against subsequent modifications.- Parameters:
- trustAnchors- a- Setof- TrustAnchors
- Throws:
- InvalidAlgorithmParameterException- if the specified- Setis empty- (trustAnchors.isEmpty() == true)
- NullPointerException- if the specified- Setis- null
- ClassCastException- if any of the elements in the- Setare not of type- java.security.cert.TrustAnchor
 
 - 
PKIXParameterspublic PKIXParameters(KeyStore keystore) throws KeyStoreException, InvalidAlgorithmParameterException Creates an instance ofPKIXParametersthat populates the set of most-trusted CAs from the trusted certificate entries contained in the specifiedKeyStore. Only keystore entries that contain trustedX509Certificatesare considered; all other certificate types are ignored.- Parameters:
- keystore- a- KeyStorefrom which the set of most-trusted CAs will be populated
- Throws:
- KeyStoreException- if the keystore has not been initialized
- InvalidAlgorithmParameterException- if the keystore does not contain at least one trusted certificate entry
- NullPointerException- if the keystore is- null
 
 
- 
 - 
Method Detail- 
getTrustAnchorspublic Set<TrustAnchor> getTrustAnchors() Returns an immutableSetof the most-trusted CAs.- Returns:
- an immutable SetofTrustAnchors (nevernull)
- See Also:
- setTrustAnchors(java.util.Set<java.security.cert.TrustAnchor>)
 
 - 
setTrustAnchorspublic void setTrustAnchors(Set<TrustAnchor> trustAnchors) throws InvalidAlgorithmParameterException Sets theSetof most-trusted CAs.Note that the Setis copied to protect against subsequent modifications.- Parameters:
- trustAnchors- a- Setof- TrustAnchors
- Throws:
- InvalidAlgorithmParameterException- if the specified- Setis empty- (trustAnchors.isEmpty() == true)
- NullPointerException- if the specified- Setis- null
- ClassCastException- if any of the elements in the set are not of type- java.security.cert.TrustAnchor
- See Also:
- getTrustAnchors()
 
 - 
getInitialPoliciespublic Set<String> getInitialPolicies() Returns an immutableSetof initial policy identifiers (OID strings), indicating that any one of these policies would be acceptable to the certificate user for the purposes of certification path processing. The default return value is an emptySet, which is interpreted as meaning that any policy would be acceptable.- Returns:
- an immutable Setof initial policy OIDs inStringformat, or an emptySet(implying any policy is acceptable). Never returnsnull.
- See Also:
- setInitialPolicies(java.util.Set<java.lang.String>)
 
 - 
setInitialPoliciespublic void setInitialPolicies(Set<String> initialPolicies) Sets theSetof initial policy identifiers (OID strings), indicating that any one of these policies would be acceptable to the certificate user for the purposes of certification path processing. By default, any policy is acceptable (i.e. all policies), so a user that wants to allow any policy as acceptable does not need to call this method, or can call it with an emptySet(ornull).Note that the Setis copied to protect against subsequent modifications.- Parameters:
- initialPolicies- a- Setof initial policy OIDs in- Stringformat (or- null)
- Throws:
- ClassCastException- if any of the elements in the set are not of type- String
- See Also:
- getInitialPolicies()
 
 - 
setCertStorespublic void setCertStores(List<CertStore> stores) Sets the list ofCertStores to be used in finding certificates and CRLs. May benull, in which case noCertStores will be used. The firstCertStores in the list may be preferred to those that appear later.Note that the Listis copied to protect against subsequent modifications.- Parameters:
- stores- a- Listof- CertStores (or- null)
- Throws:
- ClassCastException- if any of the elements in the list are not of type- java.security.cert.CertStore
- See Also:
- getCertStores()
 
 - 
addCertStorepublic void addCertStore(CertStore store) Adds aCertStoreto the end of the list ofCertStores used in finding certificates and CRLs.- Parameters:
- store- the- CertStoreto add. If- null, the store is ignored (not added to list).
 
 - 
getCertStorespublic List<CertStore> getCertStores() Returns an immutableListofCertStores that are used to find certificates and CRLs.- Returns:
- an immutable ListofCertStores (may be empty, but nevernull)
- See Also:
- setCertStores(java.util.List<java.security.cert.CertStore>)
 
 - 
setRevocationEnabledpublic void setRevocationEnabled(boolean val) Sets the RevocationEnabled flag. If this flag is true, the default revocation checking mechanism of the underlying PKIX service provider will be used. If this flag is false, the default revocation checking mechanism will be disabled (not used).When a PKIXParametersobject is created, this flag is set to true. This setting reflects the most common strategy for checking revocation, since each service provider must support revocation checking to be PKIX compliant. Sophisticated applications should set this flag to false when it is not practical to use a PKIX service provider's default revocation checking mechanism or when an alternative revocation checking mechanism is to be substituted (by also calling theaddCertPathCheckerorsetCertPathCheckersmethods).- Parameters:
- val- the new value of the RevocationEnabled flag
 
 - 
isRevocationEnabledpublic boolean isRevocationEnabled() Checks the RevocationEnabled flag. If this flag is true, the default revocation checking mechanism of the underlying PKIX service provider will be used. If this flag is false, the default revocation checking mechanism will be disabled (not used). See thesetRevocationEnabledmethod for more details on setting the value of this flag.- Returns:
- the current value of the RevocationEnabled flag
 
 - 
setExplicitPolicyRequiredpublic void setExplicitPolicyRequired(boolean val) Sets the ExplicitPolicyRequired flag. If this flag is true, an acceptable policy needs to be explicitly identified in every certificate. By default, the ExplicitPolicyRequired flag is false.- Parameters:
- val-- trueif explicit policy is to be required,- falseotherwise
 
 - 
isExplicitPolicyRequiredpublic boolean isExplicitPolicyRequired() Checks if explicit policy is required. If this flag is true, an acceptable policy needs to be explicitly identified in every certificate. By default, the ExplicitPolicyRequired flag is false.- Returns:
- trueif explicit policy is required,- falseotherwise
 
 - 
setPolicyMappingInhibitedpublic void setPolicyMappingInhibited(boolean val) Sets the PolicyMappingInhibited flag. If this flag is true, policy mapping is inhibited. By default, policy mapping is not inhibited (the flag is false).- Parameters:
- val-- trueif policy mapping is to be inhibited,- falseotherwise
 
 - 
isPolicyMappingInhibitedpublic boolean isPolicyMappingInhibited() Checks if policy mapping is inhibited. If this flag is true, policy mapping is inhibited. By default, policy mapping is not inhibited (the flag is false).- Returns:
- true if policy mapping is inhibited, false otherwise
 
 - 
setAnyPolicyInhibitedpublic void setAnyPolicyInhibited(boolean val) Sets state to determine if the any policy OID should be processed if it is included in a certificate. By default, the any policy OID is not inhibited (isAnyPolicyInhibited()returnsfalse).- Parameters:
- val-- trueif the any policy OID is to be inhibited,- falseotherwise
 
 - 
isAnyPolicyInhibitedpublic boolean isAnyPolicyInhibited() Checks whether the any policy OID should be processed if it is included in a certificate.- Returns:
- trueif the any policy OID is inhibited,- falseotherwise
 
 - 
setPolicyQualifiersRejectedpublic void setPolicyQualifiersRejected(boolean qualifiersRejected) Sets the PolicyQualifiersRejected flag. If this flag is true, certificates that include policy qualifiers in a certificate policies extension that is marked critical are rejected. If the flag is false, certificates are not rejected on this basis.When a PKIXParametersobject is created, this flag is set to true. This setting reflects the most common (and simplest) strategy for processing policy qualifiers. Applications that want to use a more sophisticated policy must set this flag to false.Note that the PKIX certification path validation algorithm specifies that any policy qualifier in a certificate policies extension that is marked critical must be processed and validated. Otherwise the certification path must be rejected. If the policyQualifiersRejected flag is set to false, it is up to the application to validate all policy qualifiers in this manner in order to be PKIX compliant. - Parameters:
- qualifiersRejected- the new value of the PolicyQualifiersRejected flag
- See Also:
- getPolicyQualifiersRejected(),- PolicyQualifierInfo
 
 - 
getPolicyQualifiersRejectedpublic boolean getPolicyQualifiersRejected() Gets the PolicyQualifiersRejected flag. If this flag is true, certificates that include policy qualifiers in a certificate policies extension that is marked critical are rejected. If the flag is false, certificates are not rejected on this basis.When a PKIXParametersobject is created, this flag is set to true. This setting reflects the most common (and simplest) strategy for processing policy qualifiers. Applications that want to use a more sophisticated policy must set this flag to false.- Returns:
- the current value of the PolicyQualifiersRejected flag
- See Also:
- setPolicyQualifiersRejected(boolean)
 
 - 
getDatepublic Date getDate() Returns the time for which the validity of the certification path should be determined. Ifnull, the current time is used.Note that the Datereturned is copied to protect against subsequent modifications.- Returns:
- the Date, ornullif not set
- See Also:
- setDate(java.util.Date)
 
 - 
setDatepublic void setDate(Date date) Sets the time for which the validity of the certification path should be determined. Ifnull, the current time is used.Note that the Datesupplied here is copied to protect against subsequent modifications.- Parameters:
- date- the- Date, or- nullfor the current time
- See Also:
- getDate()
 
 - 
setCertPathCheckerspublic void setCertPathCheckers(List<PKIXCertPathChecker> checkers) Sets aListof additional certification path checkers. If the specifiedListcontains an object that is not aPKIXCertPathChecker, it is ignored.Each PKIXCertPathCheckerspecified implements additional checks on a certificate. Typically, these are checks to process and verify private extensions contained in certificates. EachPKIXCertPathCheckershould be instantiated with any initialization parameters needed to execute the check.This method allows sophisticated applications to extend a PKIX CertPathValidatororCertPathBuilder. Each of the specifiedPKIXCertPathCheckers will be called, in turn, by a PKIXCertPathValidatororCertPathBuilderfor each certificate processed or validated.Regardless of whether these additional PKIXCertPathCheckers are set, a PKIXCertPathValidatororCertPathBuildermust perform all of the required PKIX checks on each certificate. The one exception to this rule is if the RevocationEnabled flag is set to false (see thesetRevocationEnabledmethod).Note that the Listsupplied here is copied and eachPKIXCertPathCheckerin the list is cloned to protect against subsequent modifications.- Parameters:
- checkers- a- Listof- PKIXCertPathCheckers. May be- null, in which case no additional checkers will be used.
- Throws:
- ClassCastException- if any of the elements in the list are not of type- java.security.cert.PKIXCertPathChecker
- See Also:
- getCertPathCheckers()
 
 - 
getCertPathCheckerspublic List<PKIXCertPathChecker> getCertPathCheckers() Returns theListof certification path checkers. The returnedListis immutable, and eachPKIXCertPathCheckerin theListis cloned to protect against subsequent modifications.- Returns:
- an immutable ListofPKIXCertPathCheckers (may be empty, but notnull)
- See Also:
- setCertPathCheckers(java.util.List<java.security.cert.PKIXCertPathChecker>)
 
 - 
addCertPathCheckerpublic void addCertPathChecker(PKIXCertPathChecker checker) Adds aPKIXCertPathCheckerto the list of certification path checkers. See thesetCertPathCheckersmethod for more details.Note that the PKIXCertPathCheckeris cloned to protect against subsequent modifications.- Parameters:
- checker- a- PKIXCertPathCheckerto add to the list of checks. If- null, the checker is ignored (not added to list).
 
 - 
getSigProviderpublic String getSigProvider() Returns the signature provider's name, ornullif not set.- Returns:
- the signature provider's name (or null)
- See Also:
- setSigProvider(java.lang.String)
 
 - 
setSigProviderpublic void setSigProvider(String sigProvider) Sets the signature provider's name. The specified provider will be preferred when creatingSignatureobjects. Ifnullor not set, the first provider found supporting the algorithm will be used.- Parameters:
- sigProvider- the signature provider's name (or- null)
- See Also:
- getSigProvider()
 
 - 
getTargetCertConstraintspublic CertSelector getTargetCertConstraints() Returns the required constraints on the target certificate. The constraints are returned as an instance ofCertSelector. Ifnull, no constraints are defined.Note that the CertSelectorreturned is cloned to protect against subsequent modifications.- Returns:
- a CertSelectorspecifying the constraints on the target certificate (ornull)
- See Also:
- setTargetCertConstraints(java.security.cert.CertSelector)
 
 - 
setTargetCertConstraintspublic void setTargetCertConstraints(CertSelector selector) Sets the required constraints on the target certificate. The constraints are specified as an instance ofCertSelector. Ifnull, no constraints are defined.Note that the CertSelectorspecified is cloned to protect against subsequent modifications.- Parameters:
- selector- a- CertSelectorspecifying the constraints on the target certificate (or- null)
- See Also:
- getTargetCertConstraints()
 
 - 
clonepublic Object clone() Makes a copy of thisPKIXParametersobject. Changes to the copy will not affect the original and vice versa.- Specified by:
- clonein interface- CertPathParameters
- Overrides:
- clonein class- Object
- Returns:
- a copy of this PKIXParametersobject
- See Also:
- Cloneable
 
 
- 
 
-