diff options
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java | 97 |
1 files changed, 37 insertions, 60 deletions
diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java index 0e9121394..601e15d2f 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cms.crl; + import java.io.IOException; import java.util.Locale; @@ -39,35 +40,35 @@ import com.netscape.certsrv.logging.ILogger; /** * This represents a certificate issuer extension. - * + * * @version $Revision$, $Date$ */ -public class CMSCertificateIssuerExtension implements ICMSCRLExtension, - IExtendedPluginInfo { +public class CMSCertificateIssuerExtension + implements ICMSCRLExtension, IExtendedPluginInfo { private ILogger mLogger = CMS.getLogger(); public CMSCertificateIssuerExtension() { } - public Extension setCRLExtensionCriticality(Extension ext, boolean critical) { + public Extension setCRLExtensionCriticality(Extension ext, + boolean critical) { CertificateIssuerExtension certIssuerExt = null; GeneralNames names = null; try { - names = (GeneralNames) ((CertificateIssuerExtension) ext) - .get(CertificateIssuerExtension.CERTIFICATE_ISSUER); - certIssuerExt = new CertificateIssuerExtension( - Boolean.valueOf(critical), names); + names = (GeneralNames) ((CertificateIssuerExtension) ext).get( + CertificateIssuerExtension.CERTIFICATE_ISSUER); + certIssuerExt = new CertificateIssuerExtension(Boolean.valueOf(critical), + names); } catch (IOException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_CERT_ISSUER_EXT", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_CERT_ISSUER_EXT", e.toString())); } return certIssuerExt; } - public Extension getCRLExtension(IConfigStore config, Object ip, - boolean critical) { + public Extension getCRLExtension(IConfigStore config, + Object ip, + boolean critical) { CertificateIssuerExtension certIssuerExt = null; int numNames = 0; @@ -76,9 +77,7 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, try { numNames = config.getInteger("numNames", 0); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_INVALID_NUM_NAMES", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_NUM_NAMES", e.toString())); } if (numNames > 0) { GeneralNames names = new GeneralNames(); @@ -89,13 +88,9 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, try { nameType = config.getString("nameType" + i); } catch (EPropertyNotFound e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage( - "CRL_CREATE_UNDEFINED_TYPE", Integer.toString(i), - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_UNDEFINED_TYPE", Integer.toString(i), e.toString())); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage( - "CRL_CREATE_INVALID_TYPE", Integer.toString(i), - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_TYPE", Integer.toString(i), e.toString())); } if (nameType != null) { @@ -104,13 +99,9 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, try { name = config.getString("name" + i); } catch (EPropertyNotFound e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage( - "CRL_CREATE_UNDEFINED_TYPE", - Integer.toString(i), e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_UNDEFINED_TYPE", Integer.toString(i), e.toString())); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage( - "CRL_CREATE_INVALID_TYPE", Integer.toString(i), - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_TYPE", Integer.toString(i), e.toString())); } if (name != null && name.length() > 0) { @@ -120,17 +111,14 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, names.addElement(dirName); } catch (IOException e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage( - "CRL_CREATE_INVALID_500NAME", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_500NAME", e.toString())); } } else if (nameType.equalsIgnoreCase("URI")) { URIName uriName = new URIName(name); names.addElement(uriName); } else { - log(ILogger.LL_FAILURE, CMS.getLogMessage( - "CRL_CREATE_INVALID_NAME_TYPE", nameType)); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_NAME_TYPE", nameType)); } } } @@ -139,11 +127,9 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, if (names.size() > 0) { try { certIssuerExt = new CertificateIssuerExtension( - Boolean.valueOf(critical), names); + Boolean.valueOf(critical), names); } catch (IOException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_CERT_ISSUER_EXT", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_CERT_ISSUER_EXT", e.toString())); } } } @@ -161,9 +147,7 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, try { numNames = config.getInteger("numNames", 0); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_INVALID_NUM_NAMES", - e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_NUM_NAMES", e.toString())); } nvp.add("numNames", String.valueOf(numNames)); @@ -173,13 +157,9 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, try { nameType = config.getString("nameType" + i); } catch (EPropertyNotFound e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_UNDEFINED_TYPE", - Integer.toString(i), e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_UNDEFINED_TYPE", Integer.toString(i), e.toString())); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_INVALID_TYPE", - Integer.toString(i), e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_TYPE", Integer.toString(i), e.toString())); } if (nameType != null && nameType.length() > 0) { @@ -193,13 +173,9 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, try { name = config.getString("name" + i); } catch (EPropertyNotFound e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_UNDEFINED_TYPE", - Integer.toString(i), e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_UNDEFINED_TYPE", Integer.toString(i), e.toString())); } catch (EBaseException e) { - log(ILogger.LL_FAILURE, - CMS.getLogMessage("CRL_CREATE_INVALID_TYPE", - Integer.toString(i), e.toString())); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_TYPE", Integer.toString(i), e.toString())); } if (name != null && name.length() > 0) { @@ -219,8 +195,8 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, public String[] getExtendedPluginInfo(Locale locale) { String[] params = { - // "type;choice(CRLExtension,CRLEntryExtension);CRL Entry Extension type."+ - // " This field is not editable.", + //"type;choice(CRLExtension,CRLEntryExtension);CRL Entry Extension type."+ + //" This field is not editable.", "enable;boolean;Check to enable Certificate Issuer CRL entry extension.", "critical;boolean;Set criticality for Certificate Issuer CRL entry extension.", "numNames;number;Set number of certificate issuer names for the CRL entry.", @@ -230,11 +206,12 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, "name1;string;Enter Certificate Issuer name corresponding to the selected name type.", "nameType2;choice(DirectoryName,URI);Select Certificate Issuer name type.", "name2;string;Enter Certificate Issuer name corresponding to the selected name type.", - IExtendedPluginInfo.HELP_TOKEN - + ";configuration-ca-edit-crlextension-certificateissuer", - IExtendedPluginInfo.HELP_TEXT - + ";This CRL entry extension identifies the certificate issuer" - + " associated with an entry in an indirect CRL." }; + IExtendedPluginInfo.HELP_TOKEN + + ";configuration-ca-edit-crlextension-certificateissuer", + IExtendedPluginInfo.HELP_TEXT + + ";This CRL entry extension identifies the certificate issuer" + + " associated with an entry in an indirect CRL." + }; return params; } @@ -242,4 +219,4 @@ public class CMSCertificateIssuerExtension implements ICMSCRLExtension, private void log(int level, String msg) { mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_CA, level, msg); } -} +} |