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.java95
1 files changed, 47 insertions, 48 deletions
diff --git a/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java b/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java
index 67baf106b..9475117be 100755
--- a/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java
+++ b/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java
@@ -31,20 +31,17 @@ 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 {
+ implements CertAttrSet {
/**
*
@@ -70,7 +67,7 @@ implements CertAttrSet {
/**
* 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 {
@@ -83,7 +80,7 @@ implements CertAttrSet {
/**
* 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,7 +92,7 @@ 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.
*/
@@ -108,21 +105,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,40 +129,42 @@ 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"
+ 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"
+ 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"
+ } else {
+ throw new IOException("Attribute name not recognized by"
+ " CertAttrSet:CRLNumber.");
- }
+ }
}
/**
@@ -180,7 +179,7 @@ implements CertAttrSet {
/**
* Decode the extension from the InputStream.
- *
+ *
* @param in the InputStream to unmarshal the contents from.
* @exception IOException on decoding or validity errors.
*/
@@ -190,36 +189,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);
}
}