summaryrefslogtreecommitdiffstats
path: root/pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
committerAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
commit171aaece4f23709d33d180cf36eb3af5e454b0c9 (patch)
tree1485f9f0a7bd10de4ff25030db575dbb8dafae74 /pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java
parentadad2fcee8a29fdb82376fbce07dedb11fccc182 (diff)
downloadpki-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/extensions/NSCertTypeExtension.java')
-rw-r--r--pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java134
1 files changed, 72 insertions, 62 deletions
diff --git a/pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java b/pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java
index 0d337f50..e470d4dc 100644
--- a/pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java
+++ b/pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package netscape.security.extensions;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -31,13 +32,14 @@ import netscape.security.x509.CertAttrSet;
import netscape.security.x509.Extension;
/**
- * NSCertTypeExtension Represents Netscape Certificate Type Extension
- *
- * <p>
- * This deprecated extension, if present, defines both the purpose (e.g.,
- * encipherment, signature, certificate signing) and the application (e.g., SSL,
- * S/Mime or Object Signing of the key contained in the certificate.
- *
+ * NSCertTypeExtension
+ * Represents Netscape Certificate Type Extension
+ *
+ * <p>This deprecated extension, if present, defines both the purpose
+ * (e.g., encipherment, signature, certificate signing) and the application
+ * (e.g., SSL, S/Mime or Object Signing of the key contained in the
+ * certificate.
+ *
* @author galperin
* @version $Revision$, $Date$
*/
@@ -54,38 +56,38 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet {
/**
* Identifies the particular public key used to sign the certificate.
*/
- public static final ObjectIdentifier CertType_Id = new ObjectIdentifier(
- CertType_data);
-
- /**
- * Attribute names.
- */
- public static final String NAME = "NSCertType";
- public static final String SSL_CLIENT = "ssl_client";
- public static final String SSL_SERVER = "ssl_server";
- public static final String EMAIL = "email";
- public static final String OBJECT_SIGNING = "object_signing";
- public static final String SSL_CA = "ssl_ca";
- public static final String EMAIL_CA = "email_ca";
- public static final String OBJECT_SIGNING_CA = "object_signing_ca";
-
- /**
- * Attribute names.
- */
- public static final int SSL_CLIENT_BIT = 0;
- public static final int SSL_SERVER_BIT = 1;
- public static final int EMAIL_BIT = 2;
- public static final int OBJECT_SIGNING_BIT = 3;
- // 4 is reserved.
- public static final int SSL_CA_BIT = 5;
- public static final int EMAIL_CA_BIT = 6;
- public static final int OBJECT_SIGNING_CA_BIT = 7;
-
- public static final int NBITS = 8;
+ public static final ObjectIdentifier CertType_Id = new
+ ObjectIdentifier(CertType_data);
+
+ /**
+ * Attribute names.
+ */
+ public static final String NAME = "NSCertType";
+ public static final String SSL_CLIENT = "ssl_client";
+ public static final String SSL_SERVER = "ssl_server";
+ public static final String EMAIL = "email";
+ public static final String OBJECT_SIGNING = "object_signing";
+ public static final String SSL_CA = "ssl_ca";
+ public static final String EMAIL_CA = "email_ca";
+ public static final String OBJECT_SIGNING_CA = "object_signing_ca";
+
+ /**
+ * Attribute names.
+ */
+ public static final int SSL_CLIENT_BIT = 0;
+ public static final int SSL_SERVER_BIT = 1;
+ public static final int EMAIL_BIT = 2;
+ public static final int OBJECT_SIGNING_BIT = 3;
+ // 4 is reserved.
+ public static final int SSL_CA_BIT = 5;
+ public static final int EMAIL_CA_BIT = 6;
+ public static final int OBJECT_SIGNING_CA_BIT = 7;
+
+ public static final int NBITS = 8;
/**
- * Identifier for this attribute, to be used with the get, set, delete
- * methods of Certificate, x509 type.
+ * Identifier for this attribute, to be used with the
+ * get, set, delete methods of Certificate, x509 type.
*/
public static final String IDENT = "x509.info.extensions.NSCertType";
@@ -102,12 +104,17 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet {
}
}
- private static MapEntry[] mMapData = { new MapEntry(SSL_CLIENT, 0),
- new MapEntry(SSL_SERVER, 1), new MapEntry(EMAIL, 2),
+ private static MapEntry[] mMapData =
+ {
+ new MapEntry(SSL_CLIENT, 0),
+ new MapEntry(SSL_SERVER, 1),
+ new MapEntry(EMAIL, 2),
new MapEntry(OBJECT_SIGNING, 3),
// note that bit 4 is reserved
- new MapEntry(SSL_CA, 5), new MapEntry(EMAIL_CA, 6),
- new MapEntry(OBJECT_SIGNING_CA, 7), };
+ new MapEntry(SSL_CA, 5),
+ new MapEntry(EMAIL_CA, 6),
+ new MapEntry(OBJECT_SIGNING_CA, 7),
+ };
private static Vector mAttributeNames = new Vector();
@@ -123,7 +130,8 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet {
return mMapData[i].mPosition;
}
throw new CertificateException("Attribute name [" + name
- + "] not recognized by" + " CertAttrSet:NSCertType.");
+ + "] not recognized by"
+ + " CertAttrSet:NSCertType.");
}
// Encode this extension value
@@ -136,7 +144,7 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet {
/**
* Check if bit is set.
- *
+ *
* @param position the position in the bit string to check.
*/
public boolean isSet(int position) {
@@ -169,8 +177,8 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet {
}
/**
- * Create NSCertTypeExtension from boolean array. The criticality is set to
- * false.
+ * Create NSCertTypeExtension from boolean array.
+ * The criticality is set to false.
*/
public NSCertTypeExtension(boolean critical, boolean[] bits) {
this.extensionId = CertType_Id;
@@ -193,13 +201,12 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet {
}
/**
- * Create a NSCertTypeExtension with the passed bit settings. The
- * criticality is set to false.
- *
+ * Create a NSCertTypeExtension with the passed bit settings.
+ * The criticality is set to false.
+ *
* @param bitString the bits to be set for the extension.
*/
- public NSCertTypeExtension(boolean critical, byte[] bitString)
- throws IOException {
+ public NSCertTypeExtension(boolean critical, byte[] bitString) throws IOException {
this.mBitString = bitString;
this.extensionId = CertType_Id;
this.critical = critical;
@@ -215,17 +222,19 @@ public class NSCertTypeExtension 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 NSCertTypeExtension(Boolean critical, Object value)
- throws IOException {
+ throws IOException {
/**
- * Debug.trace("NSCertTypeExtension"); this.mBitString = new byte[1];
- * this.mBitString[0] = (byte)0x00; return;
+ Debug.trace("NSCertTypeExtension");
+ this.mBitString = new byte[1];
+ this.mBitString[0] = (byte)0x00;
+ return;
**/
this.extensionId = CertType_Id;
@@ -245,10 +254,10 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet {
this.extensionId = CertType_Id;
this.critical = false;
this.mBitString = new byte[0];
- try {
- encodeThis();
- } catch (Exception e) {
- }
+ try {
+ encodeThis();
+ } catch (Exception e) {
+ }
}
/**
@@ -256,7 +265,8 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet {
*/
public void set(String name, Object obj) throws CertificateException {
if (!(obj instanceof Boolean)) {
- throw new CertificateException("Attribute must be of type Boolean.");
+ throw new CertificateException
+ ("Attribute must be of type Boolean.");
}
boolean val = ((Boolean) obj).booleanValue();
@@ -324,7 +334,7 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet {
/**
* Decode the extension from the InputStream.
- *
+ *
* @param in the InputStream to unmarshal the contents from.
* @exception IOException on decoding or validity errors.
*/
@@ -334,12 +344,12 @@ public class NSCertTypeExtension 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();
+ DerOutputStream tmp = new DerOutputStream();
encodeThis();
if (this.extensionValue == null) {