summaryrefslogtreecommitdiffstats
path: root/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/util/src/netscape/security/x509/CRLNumberExtension.java')
-rwxr-xr-xpki/base/util/src/netscape/security/x509/CRLNumberExtension.java121
1 files changed, 61 insertions, 60 deletions
diff --git a/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java b/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java
index 67baf106..710ca3bd 100755
--- a/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java
+++ b/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java
@@ -31,20 +31,19 @@ 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 {
/**
*
@@ -68,9 +67,9 @@ 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 {
@@ -81,9 +80,9 @@ 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 {
@@ -95,11 +94,12 @@ 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 @@ 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,55 +132,56 @@ 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.
*/
@@ -190,36 +191,36 @@ 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);
}
}