Package java.security.cert
Class PKIXParameters
- java.lang.Object
-
- java.security.cert.PKIXParameters
-
- All Implemented Interfaces:
Cloneable,CertPathParameters
- Direct Known Subclasses:
ExtendedPKIXParameters,PKIXBuilderParameters
public class PKIXParameters extends Object implements CertPathParameters
This class implements the parameters for thePKIX CertPathValidator.The parameters must be created with trusted certificate authorities (trust anchors).
- See Also:
CertPathValidator,CertPathParameters
-
-
Constructor Summary
Constructors Constructor Description PKIXParameters(KeyStore keyStore)Creates a newPKIXParametersinstance with the trustedX509Certificateentries from the specifiedKeyStore.PKIXParameters(Set<TrustAnchor> trustAnchors)Creates a newPKIXParametersinstance with the specified set of trusted certificate authorities.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCertPathChecker(PKIXCertPathChecker checker)Adds the specifiedPKIXCertPathCheckerto the list of certification path checkers.voidaddCertStore(CertStore store)Adds a certificate store to the list of certificate stores that are used to find certificates and CRLs.Objectclone()Clones thisPKIXParametersinstance.List<PKIXCertPathChecker>getCertPathCheckers()Returns the list of checkers for the certification path.List<CertStore>getCertStores()Returns the list of certificate stores that are used to find certificates and CRLs.DategetDate()Returns the time for which the validation of the certification path should be evaluated.Set<String>getInitialPolicies()Returns the list of policies (as OID strings) that would be acceptable for the purpose of certification path processing.booleangetPolicyQualifiersRejected()Returns whether certificates are rejected that include policy qualifiers in a certificate policy extension that is marked as critical.StringgetSigProvider()Returns the name of the signature provider.CertSelectorgetTargetCertConstraints()Returns the constraints that are required for the target certificate.Set<TrustAnchor>getTrustAnchors()Returns a unmodifiable set of the trusted certificate authorities.booleanisAnyPolicyInhibited()Returns whether the any policy OID will be inhibited if it's included in a certificate.booleanisExplicitPolicyRequired()Returns whether an acceptable policy needs to be explicit identified in every certificate.booleanisPolicyMappingInhibited()Returns whether policy mapping is inhibited.booleanisRevocationEnabled()Returns whether the default revocation checking mechanism of the underlying service provider is used.voidsetAnyPolicyInhibited(boolean anyPolicyInhibited)Sets whether the any policy OID should be inhibited if it's included in a certificate.voidsetCertPathCheckers(List<PKIXCertPathChecker> certPathCheckers)Sets the list of checkers for the certification path.voidsetCertStores(List<CertStore> certStores)Set the list of certificate stores that are used to find certificates and CRLs.voidsetDate(Date date)Sets the time for which the validation of the certification path should be evaluated.voidsetExplicitPolicyRequired(boolean explicitPolicyRequired)Sets whether an an acceptable policy needs to be explicit identified in every certificate.voidsetInitialPolicies(Set<String> initialPolicies)Sets the list of policies (as OID strings) that would be acceptable for the purpose of certification path processing.voidsetPolicyMappingInhibited(boolean policyMappingInhibited)Sets whether policy mapping is to be inhibited.voidsetPolicyQualifiersRejected(boolean policyQualifiersRejected)Sets whether certificates should be rejected that include policy qualifiers in a certificate policy extension that is marked as critical.voidsetRevocationEnabled(boolean revocationEnabled)Sets whether the default revocation checking mechanism of the underlying service provider should be used.voidsetSigProvider(String sigProvider)Sets the name of the preferred signature provider.voidsetTargetCertConstraints(CertSelector targetCertConstraints)Sets the constraints that are required for the target certificate.voidsetTrustAnchors(Set<TrustAnchor> trustAnchors)Sets the set of trusted certificate authorities.StringtoString()Returns a string representation of thisPKIXParametersinstance.
-
-
-
Constructor Detail
-
PKIXParameters
public PKIXParameters(Set<TrustAnchor> trustAnchors) throws InvalidAlgorithmParameterException
Creates a newPKIXParametersinstance with the specified set of trusted certificate authorities.- Parameters:
trustAnchors- the trusted CAs.- Throws:
InvalidAlgorithmParameterException- iftrustAnchorsis empty.
-
PKIXParameters
public PKIXParameters(KeyStore keyStore) throws KeyStoreException, InvalidAlgorithmParameterException
Creates a newPKIXParametersinstance with the trustedX509Certificateentries from the specifiedKeyStore.- Parameters:
keyStore- the key store containing trusted certificates.- Throws:
KeyStoreException- if thekeyStoreis not initialized.InvalidAlgorithmParameterException- ifkeyStoredoes not contained any trusted certificate entry.
-
-
Method Detail
-
getTrustAnchors
public Set<TrustAnchor> getTrustAnchors()
Returns a unmodifiable set of the trusted certificate authorities.- Returns:
- a unmodifiable set of the trusted certificate authorities.
-
setTrustAnchors
public void setTrustAnchors(Set<TrustAnchor> trustAnchors) throws InvalidAlgorithmParameterException
Sets the set of trusted certificate authorities.- Parameters:
trustAnchors- the set of trusted certificate authorities.- Throws:
InvalidAlgorithmParameterException- iftrustAnchorsis empty.
-
isAnyPolicyInhibited
public boolean isAnyPolicyInhibited()
Returns whether the any policy OID will be inhibited if it's included in a certificate.- Returns:
trueif the any policy OID will be inhibited, otherwisefalse.
-
setAnyPolicyInhibited
public void setAnyPolicyInhibited(boolean anyPolicyInhibited)
Sets whether the any policy OID should be inhibited if it's included in a certificate.- Parameters:
anyPolicyInhibited-trueif the any policy OID should be inhibited, otherwisefalse.
-
getCertPathCheckers
public List<PKIXCertPathChecker> getCertPathCheckers()
Returns the list of checkers for the certification path.The list is unmodifiable and the entries in the list are cloned.
- Returns:
- the list of checkers for the certification path.
-
setCertPathCheckers
public void setCertPathCheckers(List<PKIXCertPathChecker> certPathCheckers)
Sets the list of checkers for the certification path.The list is copied and the entries are cloned.
- Parameters:
certPathCheckers- the list of checkers for the certification path, ornullto clear the checkers.
-
addCertPathChecker
public void addCertPathChecker(PKIXCertPathChecker checker)
Adds the specifiedPKIXCertPathCheckerto the list of certification path checkers.- Parameters:
checker- thePKIXCertPathCheckerto add, ifnull, it will be ignored.
-
getCertStores
public List<CertStore> getCertStores()
Returns the list of certificate stores that are used to find certificates and CRLs.- Returns:
- an immutable list of certificate stores.
-
setCertStores
public void setCertStores(List<CertStore> certStores)
Set the list of certificate stores that are used to find certificates and CRLs.- Parameters:
certStores- the list of certificate stores.
-
addCertStore
public void addCertStore(CertStore store)
Adds a certificate store to the list of certificate stores that are used to find certificates and CRLs.- Parameters:
store- the store to add, ifnull, it will be ignored.
-
getDate
public Date getDate()
Returns the time for which the validation of the certification path should be evaluated.- Returns:
- the time for the validation, or
nullfor the current time.
-
setDate
public void setDate(Date date)
Sets the time for which the validation of the certification path should be evaluated.- Parameters:
date- the time for the validation, ornullfor the current time.
-
isExplicitPolicyRequired
public boolean isExplicitPolicyRequired()
Returns whether an acceptable policy needs to be explicit identified in every certificate.- Returns:
trueif an explicit policy is required, otherwisefalse.
-
setExplicitPolicyRequired
public void setExplicitPolicyRequired(boolean explicitPolicyRequired)
Sets whether an an acceptable policy needs to be explicit identified in every certificate.- Parameters:
explicitPolicyRequired-trueif an explicit policy is required, otherwisefalse.
-
getInitialPolicies
public Set<String> getInitialPolicies()
Returns the list of policies (as OID strings) that would be acceptable for the purpose of certification path processing.- Returns:
- the unmodifiable list of policies, or an empty set if any policy is acceptable.
-
setInitialPolicies
public void setInitialPolicies(Set<String> initialPolicies)
Sets the list of policies (as OID strings) that would be acceptable for the purpose of certification path processing.- Parameters:
initialPolicies- the list of policies, or an empty set ornullif any policy is acceptable.
-
isPolicyMappingInhibited
public boolean isPolicyMappingInhibited()
Returns whether policy mapping is inhibited.- Returns:
trueif policy mapping is inhibited, otherwisefalse.
-
setPolicyMappingInhibited
public void setPolicyMappingInhibited(boolean policyMappingInhibited)
Sets whether policy mapping is to be inhibited.- Parameters:
policyMappingInhibited-trueif policy mapping is to be inhibited, otherwisefalse.
-
getPolicyQualifiersRejected
public boolean getPolicyQualifiersRejected()
Returns whether certificates are rejected that include policy qualifiers in a certificate policy extension that is marked as critical.- Returns:
trueif the certificates should be rejected, otherwisefalse.
-
setPolicyQualifiersRejected
public void setPolicyQualifiersRejected(boolean policyQualifiersRejected)
Sets whether certificates should be rejected that include policy qualifiers in a certificate policy extension that is marked as critical.- Parameters:
policyQualifiersRejected-trueif the certificates should be rejected, otherwisefalse.
-
isRevocationEnabled
public boolean isRevocationEnabled()
Returns whether the default revocation checking mechanism of the underlying service provider is used.- Returns:
trueif the default revocation checking mechanism is used, otherwisefalse.
-
setRevocationEnabled
public void setRevocationEnabled(boolean revocationEnabled)
Sets whether the default revocation checking mechanism of the underlying service provider should be used.- Parameters:
revocationEnabled-trueid the default revocation checking mechanism should be used, otherwisefalse.
-
getSigProvider
public String getSigProvider()
Returns the name of the signature provider.- Returns:
- the name of the signature provider, or
nullif none is set.
-
setSigProvider
public void setSigProvider(String sigProvider)
Sets the name of the preferred signature provider.If set, the specified provider will be preferred for creating signatures. If not set, the first provider found supporting creation of signatures will be used.
- Parameters:
sigProvider- the name of the preferred signature provider, ornullif none is preferred.
-
getTargetCertConstraints
public CertSelector getTargetCertConstraints()
Returns the constraints that are required for the target certificate.- Returns:
- the constraints for the target certificate, or
nullif none are set.
-
setTargetCertConstraints
public void setTargetCertConstraints(CertSelector targetCertConstraints)
Sets the constraints that are required for the target certificate.- Parameters:
targetCertConstraints- the constraints for the target certificate, ornullif none should be used.
-
clone
public Object clone()
Clones thisPKIXParametersinstance.- Specified by:
clonein interfaceCertPathParameters- Overrides:
clonein classObject- Returns:
- the cloned instance.
-
-