From f8e05e4376e1d5f00c93307605eb768281ad240b Mon Sep 17 00:00:00 2001 From: Yuuta Liang Date: Tue, 28 Nov 2023 21:08:03 -0800 Subject: Add association tags and generate UML Signed-off-by: Yuuta Liang --- src/main/model/pki/AlgorithmIdentifier.java | 3 +++ src/main/model/pki/SubjectPublicKeyInfo.java | 3 +++ src/main/model/pki/cert/Certificate.java | 4 ++++ src/main/model/pki/cert/Extension.java | 4 ++++ src/main/model/pki/cert/Extensions.java | 5 +++++ src/main/model/pki/cert/TbsCertificate.java | 12 ++++++++++++ src/main/model/pki/cert/Validity.java | 3 +++ src/main/model/pki/crl/CertificateList.java | 4 ++++ src/main/model/pki/crl/CertificateListContent.java | 6 ++++++ src/main/model/pki/crl/RevokedCertificate.java | 4 ++++ 10 files changed, 48 insertions(+) (limited to 'src/main/model/pki') diff --git a/src/main/model/pki/AlgorithmIdentifier.java b/src/main/model/pki/AlgorithmIdentifier.java index f7df59f..4e4fab3 100644 --- a/src/main/model/pki/AlgorithmIdentifier.java +++ b/src/main/model/pki/AlgorithmIdentifier.java @@ -1,5 +1,6 @@ package model.pki; +import annotations.Assoc; import model.asn1.ASN1Object; import model.asn1.ObjectIdentifier; import model.asn1.Tag; @@ -24,6 +25,7 @@ public class AlgorithmIdentifier extends ASN1Object { /** * The type of that attribute. For example,
1.2.840.113549.1.1.11
is sha256WithRSAEncryption. */ + @Assoc(partOf = true) private final ObjectIdentifier type; /** @@ -48,6 +50,7 @@ public class AlgorithmIdentifier extends ASN1Object { * } * */ + @Assoc(partOf = true, lowerBond = 0) private final ASN1Object parameters; /** diff --git a/src/main/model/pki/SubjectPublicKeyInfo.java b/src/main/model/pki/SubjectPublicKeyInfo.java index ca3b997..2f2a514 100644 --- a/src/main/model/pki/SubjectPublicKeyInfo.java +++ b/src/main/model/pki/SubjectPublicKeyInfo.java @@ -1,5 +1,6 @@ package model.pki; +import annotations.Assoc; import model.asn1.ASN1Object; import model.asn1.BitString; import model.asn1.Tag; @@ -24,11 +25,13 @@ public class SubjectPublicKeyInfo extends ASN1Object { /** * The algorithm used. */ + @Assoc(partOf = true) private final AlgorithmIdentifier algorithm; /** * The public key. */ + @Assoc(partOf = true) private final BitString subjectPublicKey; /** diff --git a/src/main/model/pki/cert/Certificate.java b/src/main/model/pki/cert/Certificate.java index 25499e3..f9d61bb 100644 --- a/src/main/model/pki/cert/Certificate.java +++ b/src/main/model/pki/cert/Certificate.java @@ -1,5 +1,6 @@ package model.pki.cert; +import annotations.Assoc; import model.asn1.ASN1Object; import model.asn1.BitString; import model.asn1.Tag; @@ -53,16 +54,19 @@ public class Certificate extends ASN1Object { * All info of that cert, excluding the signature. * It will be signed, and the signature is in
signature
. */ + @Assoc(partOf = true) private final TbsCertificate certificate; /** * The algorithm used for
signature
. */ + @Assoc(partOf = true) private final AlgorithmIdentifier signatureAlgorithm; /** * The signature. */ + @Assoc(partOf = true) private final BitString signature; /** diff --git a/src/main/model/pki/cert/Extension.java b/src/main/model/pki/cert/Extension.java index 9db83b2..a856086 100644 --- a/src/main/model/pki/cert/Extension.java +++ b/src/main/model/pki/cert/Extension.java @@ -1,5 +1,6 @@ package model.pki.cert; +import annotations.Assoc; import model.asn1.*; import model.asn1.exceptions.ParseException; import model.asn1.parsing.BytesReader; @@ -28,6 +29,7 @@ public class Extension extends ASN1Object { /** * The ID of the type of that extension. */ + @Assoc(partOf = true) private final ObjectIdentifier extnId; /** @@ -37,11 +39,13 @@ public class Extension extends ASN1Object { * behaviour is undefined. * Marking an extension critical reduces compatibility. */ + @Assoc(partOf = true) private final Bool critical; /** * The DER-encoded ASN.1 content of that extension. */ + @Assoc(partOf = true) private final OctetString extnValue; /** diff --git a/src/main/model/pki/cert/Extensions.java b/src/main/model/pki/cert/Extensions.java index 72d641f..8c636b0 100644 --- a/src/main/model/pki/cert/Extensions.java +++ b/src/main/model/pki/cert/Extensions.java @@ -1,5 +1,6 @@ package model.pki.cert; +import annotations.Assoc; import model.asn1.ASN1Object; import model.asn1.Encodable; import model.asn1.Tag; @@ -18,6 +19,10 @@ import java.util.stream.Stream; * */ public class Extensions extends ASN1Object { + /** + * The extension array. + */ + @Assoc(partOf = true) private final Extension[] extensions; /** diff --git a/src/main/model/pki/cert/TbsCertificate.java b/src/main/model/pki/cert/TbsCertificate.java index 26b30f4..6ad15e7 100644 --- a/src/main/model/pki/cert/TbsCertificate.java +++ b/src/main/model/pki/cert/TbsCertificate.java @@ -1,5 +1,6 @@ package model.pki.cert; +import annotations.Assoc; import model.asn1.ASN1Object; import model.asn1.Int; import model.asn1.Tag; @@ -63,6 +64,7 @@ public class TbsCertificate extends ASN1Object { * [0] Version DEFAULT v1 * */ + @Assoc(partOf = true) private final Int version; /** @@ -72,8 +74,10 @@ public class TbsCertificate extends ASN1Object { * CertificateSerialNumber ::= INTEGER * */ + @Assoc(partOf = true) private final Int serialNumber; + @Assoc(partOf = true) private final AlgorithmIdentifier signature; /** @@ -83,24 +87,32 @@ public class TbsCertificate extends ASN1Object { * subject Name * */ + @Assoc(partOf = true) private final Name issuer; /** * The validity period of that certificate. * Validity ::= SEQUENCE { notBefore Time, notAfter Time, ... } */ + @Assoc(partOf = true) private final Validity validity; /** * See the comments on issuer. */ + @Assoc(partOf = true) private final Name subject; + /** + * The public key of the certificate's holder. + */ + @Assoc(partOf = true) private final SubjectPublicKeyInfo subjectPublicKeyInfo; /** * [3] Optional. */ + @Assoc(partOf = true, lowerBond = 0) private final Extensions extensions; /** diff --git a/src/main/model/pki/cert/Validity.java b/src/main/model/pki/cert/Validity.java index e83d326..190b469 100644 --- a/src/main/model/pki/cert/Validity.java +++ b/src/main/model/pki/cert/Validity.java @@ -1,5 +1,6 @@ package model.pki.cert; +import annotations.Assoc; import model.asn1.*; import model.asn1.exceptions.ParseException; import model.asn1.parsing.BytesReader; @@ -28,11 +29,13 @@ public class Validity extends ASN1Object { /** * The certificate is not valid before that time. */ + @Assoc(partOf = true) private final ASN1Time notBefore; /** * The certificate is not valid after that time. */ + @Assoc(partOf = true) private final ASN1Time notAfter; /** diff --git a/src/main/model/pki/crl/CertificateList.java b/src/main/model/pki/crl/CertificateList.java index 8729561..8f4b98b 100644 --- a/src/main/model/pki/crl/CertificateList.java +++ b/src/main/model/pki/crl/CertificateList.java @@ -1,5 +1,6 @@ package model.pki.crl; +import annotations.Assoc; import model.asn1.ASN1Object; import model.asn1.BitString; import model.asn1.Tag; @@ -20,16 +21,19 @@ public class CertificateList extends ASN1Object { * All info of that CRL, excluding the signature. * It will be signed, and the signature is in
signature
. */ + @Assoc(partOf = true) private final CertificateListContent crl; /** * The algorithm used for
signature
. */ + @Assoc(partOf = true) private final AlgorithmIdentifier signatureAlgorithm; /** * The signature. */ + @Assoc(partOf = true) private final BitString signature; /** diff --git a/src/main/model/pki/crl/CertificateListContent.java b/src/main/model/pki/crl/CertificateListContent.java index 4cc96fb..80d8fc1 100644 --- a/src/main/model/pki/crl/CertificateListContent.java +++ b/src/main/model/pki/crl/CertificateListContent.java @@ -1,5 +1,6 @@ package model.pki.crl; +import annotations.Assoc; import model.asn1.*; import model.pki.AlgorithmIdentifier; import model.x501.Name; @@ -39,10 +40,15 @@ import java.util.stream.Stream; */ public class CertificateListContent extends ASN1Object { private final Int version = new Int(Int.TAG, null, 1); + @Assoc(partOf = true) private final Name issuer; + @Assoc(partOf = true) private final AlgorithmIdentifier signature; + @Assoc(partOf = true) private final ASN1Time thisUpdate; + @Assoc(partOf = true) private final ASN1Time nextUpdate; + @Assoc(partOf = true, lowerBond = 0) private final RevokedCertificate[] revokedCertificates; /** diff --git a/src/main/model/pki/crl/RevokedCertificate.java b/src/main/model/pki/crl/RevokedCertificate.java index 1f0afc1..5acb2ed 100644 --- a/src/main/model/pki/crl/RevokedCertificate.java +++ b/src/main/model/pki/crl/RevokedCertificate.java @@ -1,5 +1,6 @@ package model.pki.crl; +import annotations.Assoc; import model.asn1.*; import java.util.Arrays; @@ -17,8 +18,11 @@ import java.util.stream.Stream; * */ public class RevokedCertificate extends ASN1Object { + @Assoc(partOf = true) private final Int serialNumber; + @Assoc(partOf = true) private final ASN1Time revocationDate; + @Assoc(partOf = true) private final Reason reason; /** -- cgit v1.2.3