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 the
PKIX 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
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 Details
-
PKIXParameters
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, InvalidAlgorithmParameterExceptionCreates 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 Details
-
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 InvalidAlgorithmParameterExceptionSets 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
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
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
Adds the specifiedPKIXCertPathCheckerto the list of certification path checkers.- Parameters:
checker- thePKIXCertPathCheckerto add, ifnull, it will be ignored.
-
getCertStores
Returns the list of certificate stores that are used to find certificates and CRLs.- Returns:
- an immutable list of certificate stores.
-
setCertStores
Set the list of certificate stores that are used to find certificates and CRLs.- Parameters:
certStores- the list of certificate stores.
-
addCertStore
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
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
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
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
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
Returns the name of the signature provider.- Returns:
- the name of the signature provider, or
nullif none is set.
-
setSigProvider
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
Returns the constraints that are required for the target certificate.- Returns:
- the constraints for the target certificate, or
nullif none are set.
-
setTargetCertConstraints
Sets the constraints that are required for the target certificate.- Parameters:
targetCertConstraints- the constraints for the target certificate, ornullif none should be used.
-
clone
Clones thisPKIXParametersinstance.- Specified by:
clonein interfaceCertPathParameters- Overrides:
clonein classObject- Returns:
- the cloned instance.
-
toString
Returns a string representation of thisPKIXParametersinstance.
-