summaryrefslogtreecommitdiffstats
path: root/pki/base/util/src/netscape/security/x509/InvalidityDateExtension.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/x509/InvalidityDateExtension.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/x509/InvalidityDateExtension.java')
-rwxr-xr-xpki/base/util/src/netscape/security/x509/InvalidityDateExtension.java114
1 files changed, 59 insertions, 55 deletions
diff --git a/pki/base/util/src/netscape/security/x509/InvalidityDateExtension.java b/pki/base/util/src/netscape/security/x509/InvalidityDateExtension.java
index 35a33c94..cb568c7f 100755
--- a/pki/base/util/src/netscape/security/x509/InvalidityDateExtension.java
+++ b/pki/base/util/src/netscape/security/x509/InvalidityDateExtension.java
@@ -30,20 +30,22 @@ import netscape.security.util.DerInputStream;
import netscape.security.util.DerOutputStream;
import netscape.security.util.DerValue;
+
/**
* Represent the CRL Invalidity Date Extension.
- *
- * <p>
- * This CRL entry extension, if present, provides the date on which it is known
- * or suspected that the private key was compromised or that the certificate
- * otherwise became invalid. Invalidity date may be earlier than the revocation
- * date.
- *
+ *
+ * <p>This CRL entry extension, if present, provides the date
+ * on which it is known or suspected that the private key was
+ * compromised or that the certificate otherwise became invalid.
+ * Invalidity date may be earlier than the revocation date.
+ *
* @see Extension
* @see CertAttrSet
*/
-public class InvalidityDateExtension extends Extension implements CertAttrSet {
+
+public class InvalidityDateExtension extends Extension
+implements CertAttrSet {
/**
*
@@ -60,14 +62,14 @@ public class InvalidityDateExtension extends Extension implements CertAttrSet {
*/
public static final String OID = "2.5.29.24";
+
private Date invalidityDate = null;
static {
try {
- OIDMap.addAttribute(InvalidityDateExtension.class.getName(), OID,
- NAME);
- } catch (CertificateException e) {
- }
+ OIDMap.addAttribute(InvalidityDateExtension.class.getName(),
+ OID, NAME);
+ } catch (CertificateException e) {}
}
// Encode this extension value
@@ -80,12 +82,14 @@ public class InvalidityDateExtension extends Extension implements CertAttrSet {
}
/**
- * Create a InvalidityDateExtension with the date. The criticality is set to
- * false.
- *
+ * Create a InvalidityDateExtension with the date.
+ * The criticality is set to false.
+ *
* @param dateOfInvalidity the value to be set for the extension.
*/
- public InvalidityDateExtension(Date dateOfInvalidity) throws IOException {
+ public InvalidityDateExtension(Date dateOfInvalidity)
+ throws IOException
+ {
this.invalidityDate = dateOfInvalidity;
this.extensionId = PKIXExtensions.InvalidityDate_Id;
this.critical = false;
@@ -93,14 +97,15 @@ public class InvalidityDateExtension extends Extension implements CertAttrSet {
}
/**
- * Create a InvalidityDateExtension with the date. The criticality is set to
- * false.
- *
+ * Create a InvalidityDateExtension with the date.
+ * The criticality is set to false.
+ *
* @param critical true if the extension is to be treated as critical.
* @param dateOfInvalidity the value to be set for the extension.
*/
public InvalidityDateExtension(Boolean critical, Date dateOfInvalidity)
- throws IOException {
+ throws IOException
+ {
this.invalidityDate = dateOfInvalidity;
this.extensionId = PKIXExtensions.InvalidityDate_Id;
this.critical = critical.booleanValue();
@@ -109,13 +114,14 @@ public class InvalidityDateExtension 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 InvalidityDateExtension(Boolean critical, Object value)
- throws IOException {
+ throws IOException
+ {
this.extensionId = PKIXExtensions.InvalidityDate_Id;
this.critical = critical.booleanValue();
@@ -127,19 +133,18 @@ public class InvalidityDateExtension extends Extension implements CertAttrSet {
this.extensionValue = extValue;
DerValue val = new DerValue(extValue);
if (val.tag == DerValue.tag_GeneralizedTime) {
- DerInputStream derInputStream = new DerInputStream(
- val.toByteArray());
+ DerInputStream derInputStream = new DerInputStream(val.toByteArray());
this.invalidityDate = derInputStream.getGeneralizedTime();
} else {
- throw new IOException(
- "Invalid encoding for InvalidityDateExtension");
+ throw new IOException("Invalid encoding for InvalidityDateExtension");
}
}
/**
* Get the invalidity date.
*/
- public Date getInvalidityDate() {
+ public Date getInvalidityDate()
+ {
return invalidityDate;
}
@@ -151,10 +156,10 @@ public class InvalidityDateExtension extends Extension implements CertAttrSet {
if (!(obj instanceof Date)) {
throw new IOException("Attribute must be of type Date.");
}
- invalidityDate = (Date) obj;
- } else {
- throw new IOException("Attribute name not recognized by"
- + " CertAttrSet:InvalidityDate.");
+ invalidityDate = (Date)obj;
+ } else {
+ throw new IOException("Attribute name not recognized by"+
+ " CertAttrSet:InvalidityDate.");
}
}
@@ -163,13 +168,11 @@ public class InvalidityDateExtension extends Extension implements CertAttrSet {
*/
public Object get(String name) throws IOException {
if (name.equalsIgnoreCase(INVALIDITY_DATE)) {
- if (invalidityDate == null)
- return null;
- else
- return invalidityDate;
+ if (invalidityDate == null) return null;
+ else return invalidityDate;
} else {
- throw new IOException("Attribute name not recognized by"
- + " CertAttrSet:InvalidityDate.");
+ throw new IOException("Attribute name not recognized by"+
+ " CertAttrSet:InvalidityDate.");
}
}
@@ -180,8 +183,8 @@ public class InvalidityDateExtension extends Extension implements CertAttrSet {
if (name.equalsIgnoreCase(INVALIDITY_DATE)) {
invalidityDate = null;
} else {
- throw new IOException("Attribute name not recognized by"
- + " CertAttrSet:InvalidityDate.");
+ throw new IOException("Attribute name not recognized by"+
+ " CertAttrSet:InvalidityDate.");
}
}
@@ -189,15 +192,15 @@ public class InvalidityDateExtension extends Extension implements CertAttrSet {
* Returns a printable representation of the InvalidityDateExtension.
*/
public String toString() {
- String s = super.toString() + "Invalidity Date: "
- + ((invalidityDate == null) ? "" : invalidityDate.toString())
- + "\n";
+ String s = super.toString() + "Invalidity Date: " +
+ ((invalidityDate == null) ? "" : invalidityDate.toString())
+ + "\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.
*/
@@ -207,27 +210,27 @@ public class InvalidityDateExtension 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.InvalidityDate_Id;
- this.critical = true;
- encodeThis();
- }
- super.encode(tmp);
- out.write(tmp.toByteArray());
+ DerOutputStream tmp = new DerOutputStream();
+
+ if (this.extensionValue == null) {
+ this.extensionId = PKIXExtensions.InvalidityDate_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(INVALIDITY_DATE);
return (elements.elements());
@@ -236,7 +239,8 @@ public class InvalidityDateExtension extends Extension implements CertAttrSet {
/**
* Return the name of this attribute.
*/
- public String getName() {
+ public String getName () {
return (NAME);
}
}
+