Managing certificate revocation
The toolkit can use CRL revocation checking, online certificate status protocol (OCSP) revocation, or both methods based on a pre-configured revocation configuration.
Initializing the revocation settings
Create an object for revocation configuration.
UserRevocationInfo revinfo = new UserRevocationInfo();Enabling the trust cache
Optionally, set the number of seconds a certificate is considered valid.
revinfo.setTrustCacheInterval(900);Initializing the OCSP settings
Add an object for OCSP-specific parameters.
OCSPConfiguration ocspconfig1 = new OCSPConfiguration();revinfo.addOCSPConfiguration(ocspconfig1);Add a group of OCSP responders.
OCSPConfiguration ocspconfig2 = new OCSPConfiguration();ocspconfig2.setURLLocation(new URL("http://responder2.location.com:80"));ocspconfig2.addCADN(new Name("o=responder2,c=ca"));OCSPConfiguration ocspconfig3 = new OCSPConfiguration();ocspconfig3.setURLLocation(new URL("http://responder3.location.com:80"));ocspconfig3.addCADN(new Name("o=responder3,c=ca"));ocspconfig3.setAIAChecking(false);revinfo.addOCSPGroup(new OCSPConfiguration[]{ocspconfig2,ocspconfig3});Enabling CRL revocation
Optionally, enable CRL revocation checking.
revinfo.addCRLRevocationChecking(true);Writing the settings
Write out the revocation settings for later usage
revinfo.writePropertiesFile(newFileOutputStream("U:\\Development\\JavaTK\\OCSP\\programmers.properties"),null);See below the contents of a sample configuration file.
#Revocation Configuration file written by Entrust#Written on: Mon Jun 05 16:23:29 EDT 2006# OCSP Configuration number: 0ocspconfig.name.0 = config0config0.AIAChecking = trueconfig0.ConnectTimeout = 0config0.ReadTimeout = 0config0.IncludeRequestorName = trueconfig0.IncludeAcceptableResponse = falseconfig0.Nonce = falseconfig0.CertIDHashAlgorithm = sha256# OCSP Configuration number: 1ocspconfig.name.1 = config1config1.AccessLocation = http://responder2.location.com:80config1.AIAChecking = trueconfig1.ConnectTimeout = 0config1.ReadTimeout = 0config1.IncludeRequestorName = trueconfig1.IncludeAcceptableResponse = falseconfig1.Nonce = falseconfig1.CertIDHashAlgorithm = sha256config1.CADN.0 = o=responder2,c=ca# OCSP Configuration number: 2ocspconfig.name.2 = config2config2.AccessLocation = http://responder3.location.com:80config2.AIAChecking = falseconfig2.ConnectTimeout = 0config2.ReadTimeout = 0config2.IncludeRequestorName = trueconfig2.IncludeAcceptableResponse = falseconfig2.Nonce = falseconfig2.CertIDHashAlgorithm = sha256config2.CADN.0 = o=responder3,c=ca# CRL Configuration: crl.requireCRL = true# Revocation configuration order defined belowlocalconfig.0 = config0localgroup.1 = config1:config2crlconfig.2 = trueAdding the settings to the user
Create a user settings object.
UserConfigSettings usersettings = new UserConfigSettings();Add the revocation settings.
UserConfigSettings object.usersettings.setRevocationInfo(revinfo);Add the revocation settings to the user
User user = new User(usersettings);