diff options
Diffstat (limited to 'pki/base/util/src/netscape/security/x509/CRLExtensions.java')
-rwxr-xr-x | pki/base/util/src/netscape/security/x509/CRLExtensions.java | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/pki/base/util/src/netscape/security/x509/CRLExtensions.java b/pki/base/util/src/netscape/security/x509/CRLExtensions.java index bba44eab..8164bd53 100755 --- a/pki/base/util/src/netscape/security/x509/CRLExtensions.java +++ b/pki/base/util/src/netscape/security/x509/CRLExtensions.java @@ -35,7 +35,7 @@ import netscape.security.util.DerValue; /** * This class defines the CRL Extensions. - * + * * @author Hemma Prafullchandra * @version 1.4 */ @@ -45,16 +45,16 @@ public class CRLExtensions extends Vector<Extension> { * */ private static final long serialVersionUID = 365767738692986418L; - private Hashtable<String,Extension> map; + private Hashtable<String, Extension> map; // Parse the encoded extension private void parseExtension(Extension ext) throws X509ExtensionException { try { Class<?> extClass = OIDMap.getClass(ext.getExtensionId()); - if (extClass == null) { // Unsupported extension + if (extClass == null) { // Unsupported extension if (ext.isCritical()) { throw new IOException("Unsupported CRITICAL extension: " - + ext.getExtensionId()); + + ext.getExtensionId()); } else { map.put(ext.getExtensionId().toString(), ext); addElement(ext); @@ -65,23 +65,23 @@ public class CRLExtensions extends Vector<Extension> { Constructor<?> cons = extClass.getConstructor(params); byte[] extData = ext.getExtensionValue(); int extLen = extData.length; - Object value = Array.newInstance(byte.class, extLen); - - for (int i = 0; i < extLen; i++) { - Array.setByte(value, i, extData[i]); - } - Object[] passed = new Object[] {new Boolean(ext.isCritical()), - value}; - CertAttrSet crlExt = (CertAttrSet)cons.newInstance(passed); - map.put(crlExt.getName(), (Extension) crlExt); + Object value = Array.newInstance(byte.class, extLen); + + for (int i = 0; i < extLen; i++) { + Array.setByte(value, i, extData[i]); + } + Object[] passed = new Object[] { new Boolean(ext.isCritical()), + value }; + CertAttrSet crlExt = (CertAttrSet) cons.newInstance(passed); + map.put(crlExt.getName(), (Extension) crlExt); addElement((Extension) crlExt); } catch (InvocationTargetException invk) { - throw new X509ExtensionException( - invk.getTargetException().getMessage()); + throw new X509ExtensionException(invk.getTargetException() + .getMessage()); - } catch (Exception e) { - throw new X509ExtensionException(e.toString()); + } catch (Exception e) { + throw new X509ExtensionException(e.toString()); } } @@ -94,13 +94,13 @@ public class CRLExtensions extends Vector<Extension> { /** * Create the object, decoding the values from the passed DER stream. - * + * * @param in the DerInputStream to read the Extension from. * @exception CRLException on decoding errors. * @exception X509ExtensionException on extension handling errors. */ - public CRLExtensions(DerInputStream in) - throws CRLException, X509ExtensionException { + public CRLExtensions(DerInputStream in) throws CRLException, + X509ExtensionException { map = new Hashtable<String, Extension>(); try { @@ -117,13 +117,13 @@ public class CRLExtensions extends Vector<Extension> { /** * Decode the extensions from the InputStream. - * + * * @param in the InputStream to unmarshal the contents from. * @exception CRLException on decoding or validity errors. * @exception X509ExtensionException on extension handling errors. */ - public void decode(InputStream in) - throws CRLException, X509ExtensionException { + public void decode(InputStream in) throws CRLException, + X509ExtensionException { try { DerValue val = new DerValue(in); DerInputStream str = val.toDerInputStream(); @@ -142,25 +142,25 @@ public class CRLExtensions extends Vector<Extension> { /** * Encode the extensions in DER form to the stream. - * + * * @param out the DerOutputStream to marshal the contents to. - * @param isExplicit the tag indicating whether this is an entry - * extension or a CRL extension. + * @param isExplicit the tag indicating whether this is an entry extension + * or a CRL extension. * @exception CRLException on encoding errors. */ public void encode(OutputStream out, boolean isExplicit) - throws CRLException { + throws CRLException { try { - // #381559 + // #381559 if (size() == 0) - return; + return; DerOutputStream extOut = new DerOutputStream(); for (int i = 0; i < size(); i++) { Object thisOne = elementAt(i); if (thisOne instanceof CertAttrSet) - ((CertAttrSet)thisOne).encode(extOut); + ((CertAttrSet) thisOne).encode(extOut); else if (thisOne instanceof Extension) - ((Extension)thisOne).encode(extOut); + ((Extension) thisOne).encode(extOut); else throw new CRLException("Illegal extension object"); } @@ -170,8 +170,8 @@ public class CRLExtensions extends Vector<Extension> { DerOutputStream tmp = new DerOutputStream(); if (isExplicit) - tmp.write(DerValue.createTag(DerValue.TAG_CONTEXT, - true, (byte)0), seq); + tmp.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, + (byte) 0), seq); else tmp = seq; @@ -185,7 +185,7 @@ public class CRLExtensions extends Vector<Extension> { /** * Get the extension with this alias. - * + * * @param alias the identifier string for the extension to retrieve. * @exception X509ExtensionException on extension handling errors. */ @@ -195,24 +195,23 @@ public class CRLExtensions extends Vector<Extension> { String id = attr.getPrefix(); if (id.equalsIgnoreCase(X509CertImpl.NAME)) { // fully qualified int index = alias.lastIndexOf("."); - name = alias.substring(index + 1); + name = alias.substring(index + 1); } else name = alias; - Extension ext = (Extension)map.get(name); + Extension ext = (Extension) map.get(name); if (ext == null) throw new X509ExtensionException("No extension found with name: " - + alias); + + alias); return ext; } /** * Set the extension value with this alias. - * + * * @param alias the identifier string for the extension to set. - * @param obj the Object to set the extension identified by the - * alias. + * @param obj the Object to set the extension identified by the alias. * @exception IOException on errors. - */ + */ public void set(String alias, Extension obj) throws IOException { map.put(alias, obj); addElement(obj); @@ -220,9 +219,10 @@ public class CRLExtensions extends Vector<Extension> { /** * Return an enumeration of names of the extensions. - * @return an enumeration of the names of the extensions in this CRL. - */ - public Enumeration<Extension> getElements () { + * + * @return an enumeration of the names of the extensions in this CRL. + */ + public Enumeration<Extension> getElements() { return (map.elements()); } } |