aboutsummaryrefslogtreecommitdiff
path: root/src/main/model/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/model/asn1')
-rw-r--r--src/main/model/asn1/ASN1Time.java2
-rw-r--r--src/main/model/asn1/GeneralizedTime.java10
-rw-r--r--src/main/model/asn1/UtcTime.java10
-rw-r--r--src/main/model/asn1/exceptions/InvalidCAException.java10
4 files changed, 21 insertions, 11 deletions
diff --git a/src/main/model/asn1/ASN1Time.java b/src/main/model/asn1/ASN1Time.java
index 8f386f5..94e58b3 100644
--- a/src/main/model/asn1/ASN1Time.java
+++ b/src/main/model/asn1/ASN1Time.java
@@ -15,7 +15,7 @@ public abstract class ASN1Time extends ASN1Object {
/**
* The time.
*/
- private ZonedDateTime timestamp;
+ private final ZonedDateTime timestamp;
/**
* EFFECTS: Initialize the time with the specific tag, parentTag, and timestamp. For tag and parentTag, consult
diff --git a/src/main/model/asn1/GeneralizedTime.java b/src/main/model/asn1/GeneralizedTime.java
index 5482906..c97a51b 100644
--- a/src/main/model/asn1/GeneralizedTime.java
+++ b/src/main/model/asn1/GeneralizedTime.java
@@ -22,7 +22,7 @@ public class GeneralizedTime extends ASN1Time {
/**
* Rather stupid impl ...
*/
- private static final DateTimeFormatter formatterNoSecs = new DateTimeFormatterBuilder()
+ private static final DateTimeFormatter FORMATTER_NO_SECS = new DateTimeFormatterBuilder()
.appendValue(ChronoField.YEAR, 4)
.appendValue(ChronoField.MONTH_OF_YEAR, 2)
.appendValue(ChronoField.DAY_OF_MONTH, 2)
@@ -32,7 +32,7 @@ public class GeneralizedTime extends ASN1Time {
.toFormatter()
.withZone(ZoneId.of("UTC"));
- private static final DateTimeFormatter formatter = new DateTimeFormatterBuilder()
+ private static final DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder()
.appendValue(ChronoField.YEAR, 4)
.appendValue(ChronoField.MONTH_OF_YEAR, 2)
.appendValue(ChronoField.DAY_OF_MONTH, 2)
@@ -71,7 +71,7 @@ public class GeneralizedTime extends ASN1Time {
@Override
public ZonedDateTime toDate(String str) throws ParseException {
try {
- return ZonedDateTime.parse(str, formatter);
+ return ZonedDateTime.parse(str, FORMATTER);
} catch (DateTimeParseException e) {
throw new ParseException(e.getMessage());
}
@@ -83,8 +83,8 @@ public class GeneralizedTime extends ASN1Time {
@Override
public String toString() {
if (getTimestamp().getSecond() == 0) {
- return getTimestamp().format(formatterNoSecs);
+ return getTimestamp().format(FORMATTER_NO_SECS);
}
- return getTimestamp().format(formatter);
+ return getTimestamp().format(FORMATTER);
}
}
diff --git a/src/main/model/asn1/UtcTime.java b/src/main/model/asn1/UtcTime.java
index 7fa93d1..54b7a5a 100644
--- a/src/main/model/asn1/UtcTime.java
+++ b/src/main/model/asn1/UtcTime.java
@@ -23,7 +23,7 @@ public class UtcTime extends ASN1Time {
/**
* Rather stupid impl ...
*/
- private static final DateTimeFormatter formatterNoSecs = new DateTimeFormatterBuilder()
+ private static final DateTimeFormatter FORMATTER_NO_SECS = new DateTimeFormatterBuilder()
.appendPattern("yy")
.appendValue(ChronoField.MONTH_OF_YEAR, 2)
.appendValue(ChronoField.DAY_OF_MONTH, 2)
@@ -33,7 +33,7 @@ public class UtcTime extends ASN1Time {
.toFormatter()
.withZone(ZoneId.of("UTC"));
- private static final DateTimeFormatter formatter = new DateTimeFormatterBuilder()
+ private static final DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder()
.appendPattern("yy")
.appendValue(ChronoField.MONTH_OF_YEAR, 2)
.appendValue(ChronoField.DAY_OF_MONTH, 2)
@@ -72,7 +72,7 @@ public class UtcTime extends ASN1Time {
@Override
public ZonedDateTime toDate(String str) throws ParseException {
try {
- return ZonedDateTime.parse(str, formatter);
+ return ZonedDateTime.parse(str, FORMATTER);
} catch (DateTimeParseException e) {
throw new ParseException(e.getMessage());
}
@@ -84,8 +84,8 @@ public class UtcTime extends ASN1Time {
@Override
public String toString() {
if (getTimestamp().getSecond() == 0) {
- return getTimestamp().format(formatterNoSecs);
+ return getTimestamp().format(FORMATTER_NO_SECS);
}
- return getTimestamp().format(formatter);
+ return getTimestamp().format(FORMATTER);
}
}
diff --git a/src/main/model/asn1/exceptions/InvalidCAException.java b/src/main/model/asn1/exceptions/InvalidCAException.java
new file mode 100644
index 0000000..e487509
--- /dev/null
+++ b/src/main/model/asn1/exceptions/InvalidCAException.java
@@ -0,0 +1,10 @@
+package model.asn1.exceptions;
+
+/**
+ * Indicate the error that the CA being installed is invalid.
+ */
+public class InvalidCAException extends Exception {
+ public InvalidCAException(String message) {
+ super(message);
+ }
+}