public final class CollectionCS extends CertificateStore
| Constructor and Description |
|---|
CollectionCS(ValidationInfo validationInfo)
Creates a new
CollectionCS and initializes it for the logged
in user. |
| Modifier and Type | Method and Description |
|---|---|
void |
addTrustedCertificate(X509Certificate trustedCert)
Adds a trusted certificate.
|
void |
addTrustedCertificate(X509Certificate trustedCert,
boolean checkPABPolicy)
Adds a trusted certificate.
|
void |
addTrustedCertificates(X509Certificate[] trustedCerts)
Adds trusted certificates, setting them as roots of trust.
|
void |
attach(CertificateStore certStore)
Adds a new certificate store to the set of certificate stores managed
by this
CollectionCS. |
CertificateSet |
findAllCerts(java.security.Principal dn)
Finds all certificates in this collection of certificate stores that are
stored under the indicated distinguished name.
|
CertificateSet |
findCerts(GeneralName location)
Generalized version of findCerts.
|
CertificateSet |
findCerts(java.security.Principal dn)
Returns all certificates for the entity specified in
dn. |
CertificateSet |
findExtensionCerts(X509Certificate certificate,
ObjectID accessMethod,
ObjectID infoAccess)
Search through all certificate stores for certificates located at the
AIA ca-Issuers accessLocation.
|
java.util.List<CertificateStore> |
getCertificateStores()
Returns a List of CertificateStore object that will be used by
this CollectionCS to find certificates.
|
X509Certificate[] |
getRootsOfTrust()
Method getRootsOfTrust
|
X509Certificate[] |
getTrustedCertificates()
Method getTrustedCertificates.
|
ValidationConfig |
getValidationConfig()
This methods collection the configuration settings used by this
object and constructs a
ValidationConfig object that
represent this validation settings in use by this object. |
boolean |
isTrustedCertificate(X509Certificate certificate)
Indicates whether or not the certificate is a trusted certificate.
|
void |
setValidationConfig(ValidationConfig validationConfig)
This method is used for setting the Validation Configuration,
which allows custom validation parameters to be set.
|
X509Certificate[] |
validate(X509Certificate certificate)
Validates an X.509 certificate.
|
X509Certificate[] |
validate(X509Certificate certificate,
java.util.Date validationTime)
Validates an X.509 certificate at a given point in time.
|
findpublic CollectionCS(ValidationInfo validationInfo) throws java.lang.NullPointerException
CollectionCS and initializes it for the logged
in user.
validationInfo - the validation info that contains the environment for the
certificate validation processjava.lang.NullPointerException - if validationInfo is nullpublic void addTrustedCertificate(X509Certificate trustedCert) throws CertificationRootException
This method calls method addTrustedCertificate(X509Certificate, boolean)
with a boolean value of true, indicating the CA PAB and PAB policy
settings will be checked for this setting.
trustedCert - the new trusted certificate to be addedCertificationRootException - if the policy doesn't allow PABs or CA PABs.public void addTrustedCertificate(X509Certificate trustedCert, boolean checkPABPolicy) throws CertificationRootException
If the certificate has a BasicConstraints extension, this extension decides if the certificate is a CA certificate or not.
If the certificate does not have a BasicConstraints extension, then
the certificate is considered an end user certificate. The only exception
is if it is a V1 X509Certificate and ValidationInfo.getForceV1CertAsCA()
is set to true.
If checkPABPolicy is true this method will perform the following policy checks:
addTrustedCertificate
throws a CertificationRootException.addTrustedCertificate
throws a CertificationRootException.Trusted certificates are stored in a static memory based repository. Because the repository is memory based it is non-persistent, meaning it exists only while the application is running and is not shared between separate applications.
trustedCert - the new trusted certificate to be addedcheckPABPolicy - Set to true if checking the Personal Address Book (PAB) policy
and (CAPAB) policy should be checked, false if they should not be checkedCertificationRootException - if the policy is checked and it doesn't allow PABs or CA PABs.public void addTrustedCertificates(X509Certificate[] trustedCerts)
This method calls method addTrustedCertificate(X509Certificate, boolean)
with a boolean value of false, indicating the CA PAB and PAB policy
settings will not be checked for this setting.
trustedCerts - the new trusted certificates to be addedpublic X509Certificate[] validate(X509Certificate certificate) throws CertificationException
Validation consists of three steps:
certificate to the root
of trustThis may cause the Directory to be contacted, which could cause this call to run for a long time if the Directory is slow to respond. If possible, set Directory connection and search timeout values.
The validation of a trusted certificate does not check its extension and revocation.
certificate - the certificate to validateCertificationRootException - thrown if no certificate chain from certificate to the
root of trust can be foundLifespanException - if certificate is not yet valid or has
already expiredExtensionException - thrown if a certificate chain is found, but chain validation failsRevocationException - thrown if a certificate chain is found, but a certificate in the
chain is revokedCertificationExceptionpublic X509Certificate[] validate(X509Certificate certificate, java.util.Date validationTime) throws CertificationException
Validation consists of three steps:
certificate to the root
of trustThis may cause the Directory to be contacted, which could cause this call to run for a long time if the Directory is slow to respond. If possible, set Directory connection and search timeout values.
The validation of a trusted certificate does not check its extension or revocation.
certificate - the certificate being validatedvalidationTime - the time at which the validation is being done fornull if the certificate is revoked after
validation timeCertificationRootException - thrown if no certificate chain from certificate to the
root of trust can be foundLifespanException - thrown if the certificate is not yet valid at the
time of validation or has already expired at the time of validationExtensionException - thrown if a certificate chain is found, but chain validation failsRevocationException - thrown if a certificate chain is found, but a certificate in the chain
is revoked; the revocation status of the certificate is
checked a the time of validation, for all other certificates in the
chain the revocation status is checked at the current timeRevocationWarningException - thrown if the certificate is revoked, but was revoked
after the time of validationCertificationExceptionpublic CertificateSet findCerts(java.security.Principal dn)
dn. If
no certificate is found, this method returns null.findCerts in class CertificateStoredn - the distinguished name of the key ownerdn or null if no
certificates for dn are found in this
CertificateStorepublic CertificateSet findAllCerts(java.security.Principal dn)
Note: Each individual certificate store in the collection is searched;
this differs from the findCerts(Principal) API which stops after
certificates are found in any of the certificate stores in the
collection.
dn - the distinguished name that will be used in the certificate
lookuppublic CertificateSet findCerts(GeneralName location) throws CertificationException
findCerts in class CertificateStorelocation - The GeneralName. It must represent a type of
java.security.Principal or this check cannot be done.location, or
null if no certificates for location are
found in this CertificateStoreCertificationException - if there is a problem finding the certificates.public void attach(CertificateStore certStore)
CollectionCS.
If a certificate cannot be found in any of the default certificate stores,
it is searched for in certStore.
certStore - an additional certificate store to use when looking for a
certificatepublic java.util.List<CertificateStore> getCertificateStores()
List of CertificateStore objectspublic boolean isTrustedCertificate(X509Certificate certificate)
certificate - the certificate to checktrue if the certificate is a trusted certificate,
otherwise returns false.public X509Certificate[] getTrustedCertificates()
public X509Certificate[] getRootsOfTrust()
public CertificateSet findExtensionCerts(X509Certificate certificate, ObjectID accessMethod, ObjectID infoAccess) throws CertificationException
certificate - CertificationExceptionpublic void setValidationConfig(ValidationConfig validationConfig)
validationConfig - The validationConfigValidationConfigpublic ValidationConfig getValidationConfig()
ValidationConfig object that
represent this validation settings in use by this object.ValidationConfig