summaryrefslogtreecommitdiffstats
path: root/pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2012-01-11 13:58:57 -0500
committerAde Lee <alee@redhat.com>2012-01-11 13:58:57 -0500
commitfbbf6c77236902e726faafe380a5ddf1891e8dc9 (patch)
tree1e671265cbd3d4072838eeec51b6a2ec77bed7d1 /pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java
parentf7a1d6a79d1b0367e556d5c53fe5e0c07c7b5c66 (diff)
downloadpki-fbbf6c77236902e726faafe380a5ddf1891e8dc9.tar.gz
pki-fbbf6c77236902e726faafe380a5ddf1891e8dc9.tar.xz
pki-fbbf6c77236902e726faafe380a5ddf1891e8dc9.zip
Formatting - no wrap in comments and code
Diffstat (limited to 'pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java')
-rw-r--r--pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java104
1 files changed, 52 insertions, 52 deletions
diff --git a/pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java b/pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java
index cbaf2ce5..a7a101cd 100644
--- a/pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java
+++ b/pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java
@@ -29,20 +29,17 @@ import netscape.security.util.DerValue;
/**
* Represent the Subject Key Identifier Extension.
- *
+ *
* This extension, if present, provides a means of identifying the particular
- * public key used in an application. This extension by default is marked
+ * public key used in an application. This extension by default is marked
* non-critical.
- *
- * <p>Extensions are addiitonal attributes which can be inserted in a X509
- * v3 certificate. For example a "Driving License Certificate" could have
- * the driving license number as a extension.
- *
- * <p>Extensions are represented as a sequence of the extension identifier
- * (Object Identifier), a boolean flag stating whether the extension is to
- * be treated as being critical and the extension value itself (this is again
- * a DER encoding of the extension value).
- *
+ *
+ * <p>
+ * Extensions are addiitonal attributes which can be inserted in a X509 v3 certificate. For example a "Driving License Certificate" could have the driving license number as a extension.
+ *
+ * <p>
+ * Extensions are represented as a sequence of the extension identifier (Object Identifier), a boolean flag stating whether the extension is to be treated as being critical and the extension value itself (this is again a DER encoding of the extension value).
+ *
* @author Amit Kapoor
* @author Hemma Prafullchandra
* @version 1.7
@@ -50,7 +47,7 @@ import netscape.security.util.DerValue;
* @see CertAttrSet
*/
public class SubjectKeyIdentifierExtension extends Extension
-implements CertAttrSet {
+ implements CertAttrSet {
/**
*
*/
@@ -58,7 +55,7 @@ implements CertAttrSet {
/**
* 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.SubjectKeyIdentifier";
/**
@@ -79,18 +76,20 @@ implements CertAttrSet {
/**
* Create a SubjectKeyIdentifierExtension with the passed octet string.
* The criticality is set to False.
+ *
* @param octetString the octet string identifying the key identifier.
*/
- public SubjectKeyIdentifierExtension (boolean critical, byte[] octetString)
- throws IOException {
+ public SubjectKeyIdentifierExtension(boolean critical, byte[] octetString)
+ throws IOException {
id = new KeyIdentifier(octetString);
this.extensionId = PKIXExtensions.SubjectKey_Id;
this.critical = critical;
encodeThis();
}
- public SubjectKeyIdentifierExtension (byte[] octetString)
- throws IOException {
+
+ public SubjectKeyIdentifierExtension(byte[] octetString)
+ throws IOException {
id = new KeyIdentifier(octetString);
this.extensionId = PKIXExtensions.SubjectKey_Id;
@@ -100,21 +99,21 @@ implements CertAttrSet {
/**
* Create the extension from the passed DER encoded value.
- *
+ *
* @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 SubjectKeyIdentifierExtension(Boolean critical, Object value)
- throws IOException {
+ throws IOException {
this.extensionId = PKIXExtensions.SubjectKey_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.id = new KeyIdentifier(val);
@@ -124,7 +123,8 @@ implements CertAttrSet {
* Returns a printable representation.
*/
public String toString() {
- if (id == null) return "";
+ if (id == null)
+ return "";
String s = super.toString() + "SubjectKeyIdentifier [\n"
+ id.toString() + "]\n";
return (s);
@@ -132,7 +132,7 @@ implements CertAttrSet {
/**
* Write the extension to the OutputStream.
- *
+ *
* @param out the OutputStream to write the extension to.
* @exception IOException on encoding errors.
*/
@@ -144,12 +144,12 @@ implements CertAttrSet {
encodeThis();
}
super.encode(tmp);
- out.write(tmp.toByteArray());
+ out.write(tmp.toByteArray());
}
/**
* Decode the extension from the InputStream.
- *
+ *
* @param in the InputStream to unmarshal the contents from.
* @exception IOException on decoding or validity errors.
*/
@@ -161,52 +161,52 @@ implements CertAttrSet {
* Set the attribute value.
*/
public void set(String name, Object obj) throws IOException {
- clearValue();
- if (name.equalsIgnoreCase(KEY_ID)) {
- if (!(obj instanceof KeyIdentifier)) {
- throw new IOException("Attribute value should be of" +
+ clearValue();
+ if (name.equalsIgnoreCase(KEY_ID)) {
+ if (!(obj instanceof KeyIdentifier)) {
+ throw new IOException("Attribute value should be of" +
" type KeyIdentifier.");
- }
- id = (KeyIdentifier)obj;
- } else {
- throw new IOException("Attribute name not recognized by " +
- "CertAttrSet:SubjectKeyIdentifierExtension.");
- }
+ }
+ id = (KeyIdentifier) obj;
+ } else {
+ throw new IOException("Attribute name not recognized by " +
+ "CertAttrSet:SubjectKeyIdentifierExtension.");
+ }
}
/**
* Get the attribute value.
*/
public Object get(String name) throws IOException {
- if (name.equalsIgnoreCase(KEY_ID)) {
- return (id);
- } else {
- throw new IOException("Attribute name not recognized by " +
- "CertAttrSet:SubjectKeyIdentifierExtension.");
- }
+ if (name.equalsIgnoreCase(KEY_ID)) {
+ return (id);
+ } else {
+ throw new IOException("Attribute name not recognized by " +
+ "CertAttrSet:SubjectKeyIdentifierExtension.");
+ }
}
/**
* Delete the attribute value.
*/
public void delete(String name) throws IOException {
- if (name.equalsIgnoreCase(KEY_ID)) {
- id = null;
- } else {
- throw new IOException("Attribute name not recognized by " +
- "CertAttrSet:SubjectKeyIdentifierExtension.");
- }
+ if (name.equalsIgnoreCase(KEY_ID)) {
+ id = null;
+ } else {
+ throw new IOException("Attribute name not recognized by " +
+ "CertAttrSet:SubjectKeyIdentifierExtension.");
+ }
}
/**
* Return an enumeration of names of attributes existing within this
* attribute.
*/
- public Enumeration<String> getAttributeNames () {
+ public Enumeration<String> getAttributeNames() {
Vector<String> elements = new Vector<String>();
elements.addElement(KEY_ID);
- return (elements.elements());
+ return (elements.elements());
}
}