public class PkiDirectoryCertificateStore extends Object implements CertificateStore
CertificateStore that keeps certificates on disk.| Constructor and Description |
|---|
PkiDirectoryCertificateStore()
Create a new validator using the default baseDir ("PKI\CA"), trustedDir ("certs"), rejectedDir
("rejected") and revokedDir ("crl").
|
PkiDirectoryCertificateStore(String baseDir)
Create a new validator using a baseDir and default subdirs: trustedDir ("certs"), rejectedDir
("rejected") and revokedDir ("crl").
|
PkiDirectoryCertificateStore(String baseDir,
String trustedDir,
String rejectedDir,
String revocationDir)
Create a new validator using a baseDir and subdirectory names, trustedDir, rejectedDir
and revocationDir.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCertificate(ValidationResult type,
Cert certificate)
Add a certificate to the store.
|
void |
addListener(DefaultCertificateStoreListener listener) |
void |
addRejectedCertificate(Cert certificate)
Add a certificate to the rejected certificates.
|
void |
addRevocationList(X509CRL crl)
Add a certificate revocation list to the store.
|
void |
addTrustedCertificate(Cert certificate)
Add a certificate to the trusted certificates.
|
void |
clear(boolean removeFiles)
Clears the certificate lists.
|
File |
getBaseDir() |
static int |
getDefaultMaxStoredRejectedCertificates()
The default number of rejected certificates to keep.
|
File |
getFileForCert(Cert cert)
Returns File for the given Certificate.
|
int |
getMaxStoredRejectedCertificates() |
Set<Cert> |
getRejectedCerts()
Get all certificates that are stored as Rejected.
|
File |
getRejectedDir() |
File |
getRevocationDir() |
Set<X509CRL> |
getRevocationLists()
Get all revocation lists the store has.
|
Set<Cert> |
getTrustedCerts()
Get all certificates that are stored as Trusted.
|
File |
getTrustedDir() |
boolean |
isStoreAcceptOnceCertificates() |
void |
refresh()
Refresh certificates.
|
void |
removeCertificate(Cert certificate)
Removes a certificate from the store.
|
void |
removeListener(DefaultCertificateStoreListener listener) |
static void |
setDefaultMaxStoredRejectedCertificates(int defaultMaxStoredRejectedCertificates)
Set the default number of rejected certificates to keep.
|
void |
setMaxStoredRejectedCertificates(int maxStoredRejectedCertificates)
Defines the maximum amount of rejected certificates that should be stored.
|
void |
setStoreAcceptOnceCertificates(boolean storeAcceptOnceCertificates)
Defines whether certificates that are accepted with AcceptOnce status are stored in the
certificate store or not.
|
public PkiDirectoryCertificateStore()
public PkiDirectoryCertificateStore(String baseDir)
baseDir - the path to the base directory where the certificate directories are kept.public PkiDirectoryCertificateStore(String baseDir, String trustedDir, String rejectedDir, String revocationDir)
baseDir - the path to the base directory where the certificate directories are kept. Use
null, if you wish to define the other directories with absolute paths.trustedDir - the name of the directory in which the trusted certificates are kept. If
baseDir is defined, this is a relative path to that, e.g. a subdirectory name.rejectedDir - the name of the directory in which the rejected certificates are kept. If
baseDir is defined, this is a relative path to that, e.g. a subdirectory name.revocationDir - the name of the directory in which revoked certificates are kept. If
baseDir is defined, this is a relative path to that, e.g. a subdirectory name.public static int getDefaultMaxStoredRejectedCertificates()
public static void setDefaultMaxStoredRejectedCertificates(int defaultMaxStoredRejectedCertificates)
public void addCertificate(ValidationResult type, Cert certificate)
CertificateStoreaddCertificate in interface CertificateStoretype - trusted, rejected or accept once.certificate - the certificate to add.public void addListener(DefaultCertificateStoreListener listener)
public void addRejectedCertificate(Cert certificate)
certificate - the certificate to addpublic void addRevocationList(X509CRL crl)
crl - revocation list to addpublic void addTrustedCertificate(Cert certificate)
certificate - the certificate to addpublic void clear(boolean removeFiles)
removeFiles - if true, removes all certificate files as well. Be careful with this!public File getBaseDir()
public File getFileForCert(Cert cert)
cert - the certificatepublic int getMaxStoredRejectedCertificates()
public Set<Cert> getRejectedCerts()
CertificateStoregetRejectedCerts in interface CertificateStorepublic File getRejectedDir()
public File getRevocationDir()
public Set<X509CRL> getRevocationLists()
CertificateStoregetRevocationLists in interface CertificateStorepublic Set<Cert> getTrustedCerts()
CertificateStoreCertificateStore.getRevocationLists() revocation lists.getTrustedCerts in interface CertificateStorepublic File getTrustedDir()
public boolean isStoreAcceptOnceCertificates()
public void refresh()
public void removeCertificate(Cert certificate)
certificate - the certificate to removepublic void removeListener(DefaultCertificateStoreListener listener)
public void setMaxStoredRejectedCertificates(int maxStoredRejectedCertificates)
public void setStoreAcceptOnceCertificates(boolean storeAcceptOnceCertificates)
Default: true
storeAcceptOnceCertificates - true if accept once certs should be storedCopyright © 2026. All rights reserved.