[Pki-devel] use of CertificateFactory in CAService - dead code?

Fraser Tweedale ftweedal at redhat.com
Fri Dec 12 03:53:46 UTC 2014


Hi all,

CAService retrieves a CertificateFactory instance in its init method
(see below), logs some things about it, and never uses it again.  Is
it safe to remove this code, or is it doing something subtle and
important?

(`mConfig = config` will stay, but it would be nice to move that to
the constructor at a later time.)

```
public void init(IConfigStore config) throws EBaseException {
    mConfig = config;

    try {
        // MOVED TO com.netscape.certsrv.apps.CMS
        //			java.security.Security.addProvider(new netscape.security.provider.CMS());
        //			java.security.Provider pr = java.security.Security.getProvider("CMS");
        //			if (pr != null) {
        //				;
        //			}
        //			else
        //				Debug.trace("Something is wrong in CMS install !");
        java.security.cert.CertificateFactory cf = java.security.cert.CertificateFactory.getInstance("X.509");

        Debug.trace("CertificateFactory Type : " + cf.getType());
        Debug.trace("CertificateFactory Provider : " + cf.getProvider().getInfo());
    } catch (java.security.cert.CertificateException e) {
        Debug.trace("Something is happen in install CMS provider !" + e.toString());
    }
}
```

Regards,
Fraser




More information about the Pki-devel mailing list