Managing certificate cache archives

See below for how to handle cache archive files.

Adding security providers

If your application does not instantiate user login, add Entrust and IAIK as security providers.

com.entrust.toolkit.security.provider.Initializer.getInstance().setProviders(Initializer.MODE_NORMAL);

Use the Initializer.getMode() method to check the toolkit mode.

Initializing the certificate cache

Instantiate an archive cache object.

ArchiveCertCache acc = new ArchiveCertCache();

Add the contents of an existing cache archive file to the cache archive object.

acc.parse(new FileInputStream(<cert_cache_archive_file>));
acc.parse(new FileInputStream(<cert_cache_archive_file>));

Retrieving certificate cache information

Obtain information from the certificate cache archive. For example, obtain the certificate associated with a specific DN.

CertificateSet cs = acc.find(java.security.Principal dn);
cs = acc.find(java.security.Principal dn);

Writing the certificate cache

Write the cache archives to a specified output stream.

acc.write(new FileOutputStream(<cert_cache_archive_file>),
ArchiveCertCache.USER_CERT_ONLY);
acc.write(new FileOutputStream(<cross_cert_cache_archive_file>), ArchiveCertCache.CROSS_CERT_ONLY);