aboutsummaryrefslogtreecommitdiff
path: root/src/main/model/asn1
diff options
context:
space:
mode:
authorYuuta Liang <yuutaw@student.cs.ubc.ca>2023-11-28 21:08:03 -0800
committerYuuta Liang <yuutaw@student.cs.ubc.ca>2023-11-28 21:08:03 -0800
commitf8e05e4376e1d5f00c93307605eb768281ad240b (patch)
tree5683cfe5c5c612452723f44d3eee114f27498fcf /src/main/model/asn1
parent2a9c2e3abf57a5d92e311c07679ff62be7275f02 (diff)
downloadjca-f8e05e4376e1d5f00c93307605eb768281ad240b.tar
jca-f8e05e4376e1d5f00c93307605eb768281ad240b.tar.gz
jca-f8e05e4376e1d5f00c93307605eb768281ad240b.tar.bz2
jca-f8e05e4376e1d5f00c93307605eb768281ad240b.zip
Add association tags and generate UML
Signed-off-by: Yuuta Liang <yuutaw@student.cs.ubc.ca>
Diffstat (limited to 'src/main/model/asn1')
-rw-r--r--src/main/model/asn1/ASN1Object.java3
-rw-r--r--src/main/model/asn1/Encodable.java3
-rw-r--r--src/main/model/asn1/Tag.java2
3 files changed, 8 insertions, 0 deletions
diff --git a/src/main/model/asn1/ASN1Object.java b/src/main/model/asn1/ASN1Object.java
index ca10fa6..1e4d600 100644
--- a/src/main/model/asn1/ASN1Object.java
+++ b/src/main/model/asn1/ASN1Object.java
@@ -1,5 +1,6 @@
package model.asn1;
+import annotations.Assoc;
import model.asn1.exceptions.ParseException;
import model.asn1.parsing.BytesReader;
@@ -28,6 +29,7 @@ public class ASN1Object implements Encodable {
public static final Tag TAG_SET = new Tag(TagClass.UNIVERSAL, true, 0x11);
// The ASN.1 type tag.
+ @Assoc(partOf = true)
private final Tag tag;
// The value length for implementation parsing purposes (only available if the object is parsed)
@@ -37,6 +39,7 @@ public class ASN1Object implements Encodable {
private final Byte[] value;
// The parent ASN.1 type tag, if required for EXPLICIT tagging with a CONTEXT SPECIFIC tag number.
+ @Assoc(lowerBond = 0, partOf = true)
private final Tag parentTag;
/**
diff --git a/src/main/model/asn1/Encodable.java b/src/main/model/asn1/Encodable.java
index 547029c..64d5f60 100644
--- a/src/main/model/asn1/Encodable.java
+++ b/src/main/model/asn1/Encodable.java
@@ -5,5 +5,8 @@ package model.asn1;
*/
@FunctionalInterface
public interface Encodable {
+ /**
+ * EFFECTS: Encode the object into DER bytes.
+ */
Byte[] encodeDER();
}
diff --git a/src/main/model/asn1/Tag.java b/src/main/model/asn1/Tag.java
index 7fb8ae4..9b6a480 100644
--- a/src/main/model/asn1/Tag.java
+++ b/src/main/model/asn1/Tag.java
@@ -1,5 +1,6 @@
package model.asn1;
+import annotations.Assoc;
import model.asn1.exceptions.ParseException;
import model.asn1.parsing.BytesReader;
@@ -7,6 +8,7 @@ import model.asn1.parsing.BytesReader;
* Represents the metadata (tag) of an ASN.1 type.
*/
public class Tag implements Encodable {
+ @Assoc(partOf = true)
private final TagClass cls;
private final boolean constructive;
private final int number;