summaryrefslogtreecommitdiffstats
path: root/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java')
-rw-r--r--pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java124
1 files changed, 55 insertions, 69 deletions
diff --git a/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java b/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java
index ee93e4bec..e6fb81b88 100644
--- a/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java
+++ b/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java
@@ -30,22 +30,18 @@ import netscape.security.util.DerOutputStream;
import netscape.security.util.DerValue;
import netscape.security.util.ObjectIdentifier;
-
/**
* Represent the CRL Hold Instruction Code Extension.
- *
- * <p>The hold instruction code is a non-critical CRL entry
- * extension that provides a registered instruction identifier
- * which indicates the action to be taken after encountering
- * a certificate that has been placed on hold.
- *
+ *
+ * <p>
+ * The hold instruction code is a non-critical CRL entry extension that provides a registered instruction identifier which indicates the action to be taken after encountering a certificate that has been placed on hold.
+ *
* @see Extension
* @see CertAttrSet
*/
-
public class HoldInstructionExtension extends Extension
-implements CertAttrSet {
+ implements CertAttrSet {
/**
*
@@ -63,35 +59,35 @@ implements CertAttrSet {
public static final String OID = "2.5.29.23";
public static final String NONE_HOLD_INSTR_OID_STR =
- "1.2.840.10040.2.1";
+ "1.2.840.10040.2.1";
public static final ObjectIdentifier NONE_HOLD_INSTR_OID =
- new ObjectIdentifier(NONE_HOLD_INSTR_OID_STR);
+ new ObjectIdentifier(NONE_HOLD_INSTR_OID_STR);
public static final String CALL_ISSUER_HOLD_INSTR_OID_STR =
- "1.2.840.10040.2.2";
+ "1.2.840.10040.2.2";
public static final ObjectIdentifier CALL_ISSUER_HOLD_INSTR_OID =
- new ObjectIdentifier(CALL_ISSUER_HOLD_INSTR_OID_STR);
+ new ObjectIdentifier(CALL_ISSUER_HOLD_INSTR_OID_STR);
public static final String REJECT_HOLD_INSTR_OID_STR =
- "1.2.840.10040.2.3";
+ "1.2.840.10040.2.3";
public static final ObjectIdentifier REJECT_HOLD_INSTR_OID =
- new ObjectIdentifier(REJECT_HOLD_INSTR_OID_STR);
+ new ObjectIdentifier(REJECT_HOLD_INSTR_OID_STR);
- private ObjectIdentifier holdInstructionCodeOIDs[] = {NONE_HOLD_INSTR_OID,
+ private ObjectIdentifier holdInstructionCodeOIDs[] = { NONE_HOLD_INSTR_OID,
CALL_ISSUER_HOLD_INSTR_OID,
- REJECT_HOLD_INSTR_OID};
+ REJECT_HOLD_INSTR_OID };
private ObjectIdentifier holdInstructionCodeOID = null;
- private String holdInstructionDescription[] = {"None",
+ private String holdInstructionDescription[] = { "None",
"Call Issuer",
- "Reject"};
-
+ "Reject" };
static {
try {
OIDMap.addAttribute(HoldInstructionExtension.class.getName(),
OID, NAME);
- } catch (CertificateException e) {}
+ } catch (CertificateException e) {
+ }
}
private int getHoldInstructionCodeFromOID(ObjectIdentifier oid) {
@@ -107,7 +103,7 @@ implements CertAttrSet {
if (oid != null) {
int i = getHoldInstructionCodeFromOID(oid);
if (i > 0 && i < 4)
- description = holdInstructionDescription[i-1];
+ description = holdInstructionDescription[i - 1];
}
return (description);
}
@@ -124,15 +120,14 @@ implements CertAttrSet {
/**
* Create a HoldInstructionExtension with the date.
* The criticality is set to false.
- *
+ *
* @param code the value to be set for the extension.
*/
public HoldInstructionExtension(int code)
- throws IOException
- {
+ throws IOException {
if (code < 1 || code > 3)
throw new IOException("Invalid hold instruction code");
- holdInstructionCodeOID = holdInstructionCodeOIDs[code-1];
+ holdInstructionCodeOID = holdInstructionCodeOIDs[code - 1];
this.extensionId = PKIXExtensions.HoldInstructionCode_Id;
this.critical = false;
encodeThis();
@@ -141,12 +136,11 @@ implements CertAttrSet {
/**
* Create a HoldInstructionExtension with the date.
* The criticality is set to false.
- *
+ *
* @param oidStr the value to be set for the extension.
*/
public HoldInstructionExtension(String oidStr)
- throws IOException
- {
+ throws IOException {
ObjectIdentifier oid = new ObjectIdentifier(oidStr);
if (oid == null || getHoldInstructionCodeFromOID(oid) == 0)
throw new IOException("Invalid hold instruction code");
@@ -159,12 +153,11 @@ implements CertAttrSet {
/**
* Create a HoldInstructionExtension with the date.
* The criticality is set to false.
- *
+ *
* @param oid the value to be set for the extension.
*/
public HoldInstructionExtension(ObjectIdentifier oid)
- throws IOException
- {
+ throws IOException {
if (getHoldInstructionCodeFromOID(oid) == 0)
throw new IOException("Invalid hold instruction code");
holdInstructionCodeOID = oid;
@@ -176,16 +169,15 @@ implements CertAttrSet {
/**
* Create a HoldInstructionExtension with the date.
* The criticality is set to false.
- *
+ *
* @param critical true if the extension is to be treated as critical.
* @param code the value to be set for the extension.
*/
public HoldInstructionExtension(Boolean critical, int code)
- throws IOException
- {
+ throws IOException {
if (code < 1 || code > 3)
throw new IOException("Invalid hold instruction code");
- holdInstructionCodeOID = holdInstructionCodeOIDs[code-1];
+ holdInstructionCodeOID = holdInstructionCodeOIDs[code - 1];
this.extensionId = PKIXExtensions.HoldInstructionCode_Id;
this.critical = critical.booleanValue();
encodeThis();
@@ -194,13 +186,12 @@ implements CertAttrSet {
/**
* Create a HoldInstructionExtension with the date.
* The criticality is set to false.
- *
+ *
* @param critical true if the extension is to be treated as critical.
* @param oidStr the value to be set for the extension.
*/
public HoldInstructionExtension(Boolean critical, String oidStr)
- throws IOException
- {
+ throws IOException {
ObjectIdentifier oid = new ObjectIdentifier(oidStr);
if (oid == null || getHoldInstructionCodeFromOID(oid) == 0)
throw new IOException("Invalid hold instruction code");
@@ -213,13 +204,12 @@ implements CertAttrSet {
/**
* Create a HoldInstructionExtension with the date.
* The criticality is set to false.
- *
+ *
* @param critical true if the extension is to be treated as critical.
* @param oid the value to be set for the extension.
*/
public HoldInstructionExtension(Boolean critical, ObjectIdentifier oid)
- throws IOException
- {
+ throws IOException {
if (getHoldInstructionCodeFromOID(oid) == 0)
throw new IOException("Invalid hold instruction code");
holdInstructionCodeOID = oid;
@@ -230,14 +220,13 @@ 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 HoldInstructionExtension(Boolean critical, Object value)
- throws IOException
- {
+ throws IOException {
this.extensionId = PKIXExtensions.HoldInstructionCode_Id;
this.critical = critical.booleanValue();
@@ -261,13 +250,11 @@ implements CertAttrSet {
/**
* Get the hold instruction code.
*/
- public ObjectIdentifier getHoldInstructionCode()
- {
+ public ObjectIdentifier getHoldInstructionCode() {
return holdInstructionCodeOID;
}
- public String getHoldInstructionCodeDescription()
- {
+ public String getHoldInstructionCodeDescription() {
return getHoldInstructionDescription(holdInstructionCodeOID);
}
@@ -279,9 +266,9 @@ implements CertAttrSet {
if (!(obj instanceof ObjectIdentifier)) {
throw new IOException("Attribute must be of type String.");
}
- holdInstructionCodeOID = (ObjectIdentifier)obj;
+ holdInstructionCodeOID = (ObjectIdentifier) obj;
} else {
- throw new IOException("Attribute name not recognized by"+
+ throw new IOException("Attribute name not recognized by" +
" CertAttrSet:HoldInstructionCode.");
}
}
@@ -293,7 +280,7 @@ implements CertAttrSet {
if (name.equalsIgnoreCase(HOLD_INSTRUCTION)) {
return holdInstructionCodeOID;
} else {
- throw new IOException("Attribute name not recognized by"+
+ throw new IOException("Attribute name not recognized by" +
" CertAttrSet:HoldInstructionCode.");
}
}
@@ -305,7 +292,7 @@ implements CertAttrSet {
if (name.equalsIgnoreCase(HOLD_INSTRUCTION)) {
holdInstructionCodeOID = null;
} else {
- throw new IOException("Attribute name not recognized by"+
+ throw new IOException("Attribute name not recognized by" +
" CertAttrSet:HoldInstructionCode.");
}
}
@@ -314,14 +301,14 @@ implements CertAttrSet {
* Returns a printable representation of the HoldInstructionExtension.
*/
public String toString() {
- String s = super.toString() + "Hold Instruction Code: "+
- getHoldInstructionDescription(holdInstructionCodeOID)+"\n";
+ String s = super.toString() + "Hold Instruction Code: " +
+ getHoldInstructionDescription(holdInstructionCodeOID) + "\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.
*/
@@ -331,27 +318,27 @@ 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.HoldInstructionCode_Id;
- this.critical = true;
- encodeThis();
- }
- super.encode(tmp);
- out.write(tmp.toByteArray());
+ DerOutputStream tmp = new DerOutputStream();
+
+ if (this.extensionValue == null) {
+ this.extensionId = PKIXExtensions.HoldInstructionCode_Id;
+ this.critical = true;
+ 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(HOLD_INSTRUCTION);
return (elements.elements());
@@ -360,8 +347,7 @@ implements CertAttrSet {
/**
* Return the name of this attribute.
*/
- public String getName () {
+ public String getName() {
return (NAME);
}
}
-