diff options
author | Ade Lee <alee@redhat.com> | 2011-12-08 21:15:59 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2011-12-08 21:15:59 -0500 |
commit | 171aaece4f23709d33d180cf36eb3af5e454b0c9 (patch) | |
tree | 1485f9f0a7bd10de4ff25030db575dbb8dafae74 /pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java | |
parent | adad2fcee8a29fdb82376fbce07dedb11fccc182 (diff) | |
download | pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.gz pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.xz pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.zip |
Revert "Formatting"
This reverts commit 32150d3ee32f8ac27118af7c792794b538c78a2f.
Diffstat (limited to 'pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java')
-rw-r--r-- | pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java | 184 |
1 files changed, 101 insertions, 83 deletions
diff --git a/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java b/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java index 1734e4e8..ee93e4be 100644 --- a/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java +++ b/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java @@ -30,19 +30,22 @@ 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 { + +public class HoldInstructionExtension extends Extension +implements CertAttrSet { /** * @@ -59,31 +62,36 @@ public class HoldInstructionExtension extends Extension 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"; - public static final ObjectIdentifier NONE_HOLD_INSTR_OID = new ObjectIdentifier( - NONE_HOLD_INSTR_OID_STR); + public static final String NONE_HOLD_INSTR_OID_STR = + "1.2.840.10040.2.1"; + public static final ObjectIdentifier NONE_HOLD_INSTR_OID = + new ObjectIdentifier(NONE_HOLD_INSTR_OID_STR); - public static final String CALL_ISSUER_HOLD_INSTR_OID_STR = "1.2.840.10040.2.2"; - public static final ObjectIdentifier CALL_ISSUER_HOLD_INSTR_OID = new ObjectIdentifier( - CALL_ISSUER_HOLD_INSTR_OID_STR); + public static final String CALL_ISSUER_HOLD_INSTR_OID_STR = + "1.2.840.10040.2.2"; + public static final ObjectIdentifier CALL_ISSUER_HOLD_INSTR_OID = + new ObjectIdentifier(CALL_ISSUER_HOLD_INSTR_OID_STR); - public static final String REJECT_HOLD_INSTR_OID_STR = "1.2.840.10040.2.3"; - public static final ObjectIdentifier REJECT_HOLD_INSTR_OID = new ObjectIdentifier( - REJECT_HOLD_INSTR_OID_STR); + public static final String REJECT_HOLD_INSTR_OID_STR = + "1.2.840.10040.2.3"; + public static final ObjectIdentifier REJECT_HOLD_INSTR_OID = + new ObjectIdentifier(REJECT_HOLD_INSTR_OID_STR); - private ObjectIdentifier holdInstructionCodeOIDs[] = { NONE_HOLD_INSTR_OID, - CALL_ISSUER_HOLD_INSTR_OID, REJECT_HOLD_INSTR_OID }; + private ObjectIdentifier holdInstructionCodeOIDs[] = {NONE_HOLD_INSTR_OID, + CALL_ISSUER_HOLD_INSTR_OID, + REJECT_HOLD_INSTR_OID}; private ObjectIdentifier holdInstructionCodeOID = null; - private String holdInstructionDescription[] = { "None", "Call Issuer", - "Reject" }; + private String holdInstructionDescription[] = {"None", + "Call Issuer", + "Reject"}; + static { try { - OIDMap.addAttribute(HoldInstructionExtension.class.getName(), OID, - NAME); - } catch (CertificateException e) { - } + OIDMap.addAttribute(HoldInstructionExtension.class.getName(), + OID, NAME); + } catch (CertificateException e) {} } private int getHoldInstructionCodeFromOID(ObjectIdentifier oid) { @@ -99,7 +107,7 @@ public class HoldInstructionExtension extends Extension implements CertAttrSet { if (oid != null) { int i = getHoldInstructionCodeFromOID(oid); if (i > 0 && i < 4) - description = holdInstructionDescription[i - 1]; + description = holdInstructionDescription[i-1]; } return (description); } @@ -114,27 +122,31 @@ public class HoldInstructionExtension extends Extension implements CertAttrSet { } /** - * Create a HoldInstructionExtension with the date. The criticality is set - * to false. - * + * 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 { + public HoldInstructionExtension(int code) + 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(); } /** - * Create a HoldInstructionExtension with the date. The criticality is set - * to false. - * + * 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 { + public HoldInstructionExtension(String oidStr) + throws IOException + { ObjectIdentifier oid = new ObjectIdentifier(oidStr); if (oid == null || getHoldInstructionCodeFromOID(oid) == 0) throw new IOException("Invalid hold instruction code"); @@ -145,12 +157,14 @@ public class HoldInstructionExtension extends Extension implements CertAttrSet { } /** - * Create a HoldInstructionExtension with the date. The criticality is set - * to false. - * + * 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 { + public HoldInstructionExtension(ObjectIdentifier oid) + throws IOException + { if (getHoldInstructionCodeFromOID(oid) == 0) throw new IOException("Invalid hold instruction code"); holdInstructionCodeOID = oid; @@ -160,31 +174,33 @@ public class HoldInstructionExtension extends Extension implements CertAttrSet { } /** - * Create a HoldInstructionExtension with the date. The criticality is set - * to false. - * + * 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(); } /** - * Create a HoldInstructionExtension with the date. The criticality is set - * to false. - * + * 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"); @@ -195,14 +211,15 @@ public class HoldInstructionExtension extends Extension implements CertAttrSet { } /** - * Create a HoldInstructionExtension with the date. The criticality is set - * to false. - * + * 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; @@ -213,13 +230,14 @@ public class HoldInstructionExtension 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 HoldInstructionExtension(Boolean critical, Object value) - throws IOException { + throws IOException + { this.extensionId = PKIXExtensions.HoldInstructionCode_Id; this.critical = critical.booleanValue(); @@ -231,26 +249,25 @@ public class HoldInstructionExtension extends Extension implements CertAttrSet { this.extensionValue = extValue; DerValue val = new DerValue(extValue); if (val.tag == DerValue.tag_ObjectId) { - DerInputStream derInputStream = new DerInputStream( - val.toByteArray()); + DerInputStream derInputStream = new DerInputStream(val.toByteArray()); holdInstructionCodeOID = derInputStream.getOID(); if (getHoldInstructionCodeFromOID(holdInstructionCodeOID) == 0) - throw new IOException( - "Invalid encoding for HoldInstructionExtension"); + throw new IOException("Invalid encoding for HoldInstructionExtension"); } else { - throw new IOException( - "Invalid encoding for HoldInstructionExtension"); + throw new IOException("Invalid encoding for HoldInstructionExtension"); } } /** * Get the hold instruction code. */ - public ObjectIdentifier getHoldInstructionCode() { + public ObjectIdentifier getHoldInstructionCode() + { return holdInstructionCodeOID; } - public String getHoldInstructionCodeDescription() { + public String getHoldInstructionCodeDescription() + { return getHoldInstructionDescription(holdInstructionCodeOID); } @@ -262,10 +279,10 @@ public class HoldInstructionExtension extends Extension 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" - + " CertAttrSet:HoldInstructionCode."); + throw new IOException("Attribute name not recognized by"+ + " CertAttrSet:HoldInstructionCode."); } } @@ -276,8 +293,8 @@ public class HoldInstructionExtension extends Extension implements CertAttrSet { if (name.equalsIgnoreCase(HOLD_INSTRUCTION)) { return holdInstructionCodeOID; } else { - throw new IOException("Attribute name not recognized by" - + " CertAttrSet:HoldInstructionCode."); + throw new IOException("Attribute name not recognized by"+ + " CertAttrSet:HoldInstructionCode."); } } @@ -288,8 +305,8 @@ public class HoldInstructionExtension extends Extension implements CertAttrSet { if (name.equalsIgnoreCase(HOLD_INSTRUCTION)) { holdInstructionCodeOID = null; } else { - throw new IOException("Attribute name not recognized by" - + " CertAttrSet:HoldInstructionCode."); + throw new IOException("Attribute name not recognized by"+ + " CertAttrSet:HoldInstructionCode."); } } @@ -297,14 +314,14 @@ public class HoldInstructionExtension extends Extension 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. */ @@ -314,27 +331,27 @@ public class HoldInstructionExtension 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.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()); @@ -343,7 +360,8 @@ public class HoldInstructionExtension extends Extension implements CertAttrSet { /** * Return the name of this attribute. */ - public String getName() { + public String getName () { return (NAME); } } + |