diff options
Diffstat (limited to 'pki/base/util/src/netscape/security/x509/CRLNumberExtension.java')
-rwxr-xr-x | pki/base/util/src/netscape/security/x509/CRLNumberExtension.java | 121 |
1 files changed, 60 insertions, 61 deletions
diff --git a/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java b/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java index 710ca3bd9..67baf106b 100755 --- a/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java +++ b/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java @@ -31,19 +31,20 @@ import netscape.security.util.DerValue; /** * Represent the CRL Number Extension. - * - * <p> - * This extension, if present, conveys a monotonically increasing sequence - * number for each CRL issued by a given CA through a specific CA X.500 - * Directory entry or CRL distribution point. This extension allows users to - * easily determine when a particular CRL supersedes another CRL. - * + * + * <p>This extension, if present, conveys a monotonically increasing + * sequence number for each CRL issued by a given CA through a specific + * CA X.500 Directory entry or CRL distribution point. This extension + * allows users to easily determine when a particular CRL supersedes + * another CRL. + * * @author Hemma Prafullchandra * @version 1.2 * @see Extension * @see CertAttrSet */ -public class CRLNumberExtension extends Extension implements CertAttrSet { +public class CRLNumberExtension extends Extension +implements CertAttrSet { /** * @@ -67,9 +68,9 @@ public class CRLNumberExtension extends Extension implements CertAttrSet { } /** - * Create a CRLNumberExtension with the integer value . The criticality is - * set to false. - * + * Create a CRLNumberExtension with the integer value . + * The criticality is set to false. + * * @param crlNum the value to be set for the extension. */ public CRLNumberExtension(int crlNum) throws IOException { @@ -80,9 +81,9 @@ public class CRLNumberExtension extends Extension implements CertAttrSet { } /** - * Create a CRLNumberExtension with the BigInteger value . The criticality - * is set to false. - * + * Create a CRLNumberExtension with the BigInteger value . + * The criticality is set to false. + * * @param crlNum the value to be set for the extension. */ public CRLNumberExtension(BigInteger crlNum) throws IOException { @@ -94,12 +95,11 @@ public class CRLNumberExtension extends Extension implements CertAttrSet { /** * Create a CRLNumberExtension with the BigInteger value . - * + * * @param critical true if the extension is to be treated as critical. * @param crlNum the value to be set for the extension. */ - public CRLNumberExtension(Boolean critical, BigInteger crlNum) - throws IOException { + public CRLNumberExtension(Boolean critical, BigInteger crlNum) throws IOException { this.crlNumber = new BigInt(crlNum); this.extensionId = PKIXExtensions.CRLNumber_Id; this.critical = critical.booleanValue(); @@ -108,21 +108,21 @@ public class CRLNumberExtension extends Extension implements CertAttrSet { /** * Create the extension from the passed DER encoded value of the same. - * + * * @param critical true if the extension is to be treated as critical. * @param value Array of DER encoded bytes of the actual value. * @exception IOException on error. */ public CRLNumberExtension(Boolean critical, Object value) - throws IOException { + throws IOException { this.extensionId = PKIXExtensions.CRLNumber_Id; this.critical = critical.booleanValue(); int len = Array.getLength(value); - byte[] extValue = new byte[len]; - for (int i = 0; i < len; i++) { - extValue[i] = Array.getByte(value, i); - } + byte[] extValue = new byte[len]; + for (int i = 0; i < len; i++) { + extValue[i] = Array.getByte(value, i); + } this.extensionValue = extValue; DerValue val = new DerValue(extValue); this.crlNumber = val.getInteger(); @@ -132,56 +132,55 @@ public class CRLNumberExtension extends Extension implements CertAttrSet { * Set the attribute value. */ public void set(String name, Object obj) throws IOException { - if (name.equalsIgnoreCase(NUMBER)) { + if (name.equalsIgnoreCase(NUMBER)) { if (!(obj instanceof BigInteger)) { - throw new IOException("Attribute must be of type BigInteger."); - } - crlNumber = new BigInt((BigInteger) obj); - } else { - throw new IOException("Attribute name not recognized by" - + " CertAttrSet:CRLNumber."); - } + throw new IOException("Attribute must be of type BigInteger."); + } + crlNumber = new BigInt((BigInteger)obj); + } else { + throw new IOException("Attribute name not recognized by" + + " CertAttrSet:CRLNumber."); + } } /** * Get the attribute value. */ public Object get(String name) throws IOException { - if (name.equalsIgnoreCase(NUMBER)) { - if (crlNumber == null) - return null; - else - return crlNumber.toBigInteger(); - } else { - throw new IOException("Attribute name not recognized by" - + " CertAttrSet:CRLNumber."); - } + if (name.equalsIgnoreCase(NUMBER)) { + if (crlNumber == null) return null; + else return crlNumber.toBigInteger(); + } else { + throw new IOException("Attribute name not recognized by" + + " CertAttrSet:CRLNumber."); + } } /** * Delete the attribute value. */ public void delete(String name) throws IOException { - if (name.equalsIgnoreCase(NUMBER)) { + if (name.equalsIgnoreCase(NUMBER)) { crlNumber = null; - } else { - throw new IOException("Attribute name not recognized by" - + " CertAttrSet:CRLNumber."); - } + } else { + throw new IOException("Attribute name not recognized by" + + " CertAttrSet:CRLNumber."); + } } /** * Returns a printable representation of the CRLNumberExtension. */ public String toString() { - String s = super.toString() + "CRL Number: " - + ((crlNumber == null) ? "" : crlNumber.toString()) + "\n"; + String s = super.toString() + "CRL Number: " + + ((crlNumber == null) ? "" : crlNumber.toString()) + + "\n"; return (s); } /** * Decode the extension from the InputStream. - * + * * @param in the InputStream to unmarshal the contents from. * @exception IOException on decoding or validity errors. */ @@ -191,36 +190,36 @@ public class CRLNumberExtension extends Extension implements CertAttrSet { /** * Write the extension to the DerOutputStream. - * + * * @param out the DerOutputStream to write the extension to. * @exception IOException on encoding errors. */ public void encode(OutputStream out) throws IOException { - DerOutputStream tmp = new DerOutputStream(); - - if (this.extensionValue == null) { - this.extensionId = PKIXExtensions.CRLNumber_Id; - this.critical = false; - encodeThis(); - } - super.encode(tmp); - out.write(tmp.toByteArray()); + DerOutputStream tmp = new DerOutputStream(); + + if (this.extensionValue == null) { + this.extensionId = PKIXExtensions.CRLNumber_Id; + this.critical = false; + encodeThis(); + } + super.encode(tmp); + out.write(tmp.toByteArray()); } /** * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getElements () { Vector<String> elements = new Vector<String>(); elements.addElement(NUMBER); - return (elements.elements()); + return (elements.elements()); } /** * Return the name of this attribute. */ - public String getName() { + public String getName () { return (NAME); } } |