From 1bc9affcf1a5641a638dcb3944f778005e5267f4 Mon Sep 17 00:00:00 2001 From: TheSilentCoder <184309164+ThatSilentCoder@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:28:55 -0500 Subject: [PATCH 1/3] issue_872: I believe I was able to lombok all the files that had the default setters and getters. --- .../entity/userdefined/info/TPMInfo.java | 13 +- .../elements/aca/IdentityRequestEnvelope.java | 45 ++--- .../aca/IdentityResponseEnvelope.java | 26 +-- .../elements/aca/SymmetricAttestation.java | 27 +-- .../elements/tpm/AsymmetricKeyParams.java | 45 ++--- .../elements/tpm/AsymmetricPublicKey.java | 26 +-- .../structs/elements/tpm/IdentityProof.java | 78 +++----- .../structs/elements/tpm/IdentityRequest.java | 54 +++--- .../hirs/structs/elements/tpm/PublicKey.java | 19 +- .../structs/elements/tpm/RsaSubParams.java | 35 ++-- .../structs/elements/tpm/StorePubKey.java | 11 +- .../structs/elements/tpm/SymmetricKey.java | 34 ++-- .../elements/tpm/SymmetricKeyParams.java | 45 ++--- .../elements/tpm/SymmetricSubParams.java | 34 ++-- .../hirs/structs/elements/tpm/Version.java | 35 ++-- .../java/hirs/utils/xjc/SoftwareIdentity.java | 170 ++++++------------ .../main/java/hirs/swid/CredentialParser.java | 68 ++++--- .../main/java/hirs/swid/SwidTagGateway.java | 130 +++++--------- 18 files changed, 326 insertions(+), 569 deletions(-) diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/info/TPMInfo.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/info/TPMInfo.java index 099eecff7..5ca240ff4 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/info/TPMInfo.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/info/TPMInfo.java @@ -49,6 +49,10 @@ public class TPMInfo implements Serializable { @Column(nullable = true) private short tpmVersionRevMinor; + /** + * identity certificate for the device. + */ + @Getter @XmlElement @XmlJavaTypeAdapter(X509CertificateAdapter.class) @Lob @@ -178,15 +182,6 @@ public TPMInfo() { identityCertificate = null; } - /** - * Used to retrieve the identity certificate for the device. - * - * @return a byte array holding the certificate information - */ - public X509Certificate getIdentityCertificate() { - return identityCertificate; - } - private void setIdentityCertificate( final X509Certificate identityCertificate) { if (identityCertificate == null) { diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityRequestEnvelope.java b/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityRequestEnvelope.java index 9a5dae36e..4361386f3 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityRequestEnvelope.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityRequestEnvelope.java @@ -3,6 +3,7 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; import java.util.Arrays; @@ -16,33 +17,42 @@ "deviceInfoReportLength", "deviceInfoReport"}) public class IdentityRequestEnvelope implements Struct { + /** + * the length of the identity request blob. + */ + @Getter @StructElementLength(fieldName = "request") private int requestLength; private byte[] request; + /** + * the length of the endorsementCredentialModulus blob. + */ + @Getter @StructElementLength(fieldName = "endorsementCredentialModulus") private int endorsementCredentialModulusLength; private byte[] endorsementCredentialModulus; + /** + * the length of the endorsementCredential blob. + */ + @Getter @StructElementLength(fieldName = "endorsementCredential") private int endorsementCredentialLength; private byte[] endorsementCredential; + /** + * the length of the device info report. + */ + @Getter @StructElementLength(fieldName = "deviceInfoReport") private int deviceInfoReportLength; private byte[] deviceInfoReport; - /** - * @return the length of the identity request blob. - */ - public int getRequestLength() { - return requestLength; - } - /** * @return the identity request. */ @@ -50,13 +60,6 @@ public byte[] getRequest() { return Arrays.copyOf(request, request.length); } - /** - * @return the length of the endorsementCredentialModulus blob - */ - public int getEndorsementCredentialModulusLength() { - return endorsementCredentialModulusLength; - } - /** * @return the endorsementCredentialModulus blob. */ @@ -64,13 +67,6 @@ public byte[] getEndorsementCredentialModulus() { return Arrays.copyOf(endorsementCredentialModulus, endorsementCredentialModulus.length); } - /** - * @return the length of the endorsementCredential blob - */ - public int getEndorsementCredentialLength() { - return endorsementCredentialLength; - } - /** * @return the endorsementCredential */ @@ -78,13 +74,6 @@ public byte[] getEndorsementCredential() { return Arrays.copyOf(endorsementCredential, endorsementCredential.length); } - /** - * @return the length of the device info report - */ - public int getDeviceInfoReportLength() { - return deviceInfoReportLength; - } - /** * @return the device info report */ diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityResponseEnvelope.java b/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityResponseEnvelope.java index a7b3ccb17..6a38a2073 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityResponseEnvelope.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityResponseEnvelope.java @@ -3,6 +3,7 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; import java.util.Arrays; @@ -13,11 +14,19 @@ "symmetricAttestation"}) public class IdentityResponseEnvelope implements Struct { + /** + * the asymmetric contents block size + */ + @Getter @StructElementLength(fieldName = "asymmetricContents") private int asymmetricContentsSize; private byte[] asymmetricContents; + /** + * the symmetric attestation. + */ + @Getter private SymmetricAttestation symmetricAttestation; /** @@ -29,21 +38,4 @@ public byte[] getAsymmetricContents() { return Arrays.copyOf(asymmetricContents, asymmetricContents.length); } - /** - * Gets the asymmetric contents block size. - * - * @return the asymmetric contents block size - */ - public int getAsymmetricContentsSize() { - return asymmetricContentsSize; - } - - /** - * Gets the symmetric attestation. - * - * @return the symmetric attestation. - */ - public SymmetricAttestation getSymmetricAttestation() { - return symmetricAttestation; - } } diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/aca/SymmetricAttestation.java b/HIRS_Structs/src/main/java/hirs/structs/elements/aca/SymmetricAttestation.java index 94b808544..dbbc9c4ef 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/aca/SymmetricAttestation.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/aca/SymmetricAttestation.java @@ -4,6 +4,7 @@ import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; import hirs.structs.elements.tpm.SymmetricKeyParams; +import lombok.Getter; import java.util.Arrays; @@ -15,30 +16,20 @@ @StructElements(elements = {"credentialSize", "algorithm", "credential"}) public class SymmetricAttestation implements Struct { + /** + * the size of the credential block. + */ + @Getter @StructElementLength(fieldName = "credential") private int credentialSize; - private SymmetricKeyParams algorithm; - - private byte[] credential; - /** - * Gets the credential block size. - * - * @return the size of the credential block + * the algorithm and other meta data regarding the key. */ - public int getCredentialSize() { - return credentialSize; - } + @Getter + private SymmetricKeyParams algorithm; - /** - * Gets the key parameters for the credential. - * - * @return the algorithm and other meta data regarding the key - */ - public SymmetricKeyParams getAlgorithm() { - return algorithm; - } + private byte[] credential; /** * Gets the credential block. diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricKeyParams.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricKeyParams.java index b61d89c64..331c6e72e 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricKeyParams.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricKeyParams.java @@ -3,58 +3,41 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; /** * As defined in TCPA 4.20, the key parameters data structure describes the parameters used to * generate a key pair and to store the parts of a key. */ +@Getter @StructElements(elements = {"algorithmId", "encryptionScheme", "signatureScheme", "paramsSize", "params"}) public class AsymmetricKeyParams implements Struct { - private int algorithmId; - - private short encryptionScheme; - - private short signatureScheme; - - @StructElementLength(fieldName = "params") - private int paramsSize; - - private RsaSubParams params; - /** - * @return the key algorithm + * the key algorithm. */ - public int getAlgorithmId() { - return algorithmId; - } + private int algorithmId; /** - * @return the size of the params field + * the encryption scheme that the key uses. */ - public int getParamsSize() { - return paramsSize; - } + private short encryptionScheme; /** - * @return the encryption scheme that the key uses + * the signature scheme that the key uses to perform digital signatures. */ - public short getEncryptionScheme() { - return encryptionScheme; - } + private short signatureScheme; /** - * @return the signature scheme that the key uses to perform digital signatures + * the size of the params field. */ - public short getSignatureScheme() { - return signatureScheme; - } + @StructElementLength(fieldName = "params") + private int paramsSize; /** - * @return parameter information dependant upon the key algorithm. + * parameter information dependant upon the key algorithm. */ - public RsaSubParams getParams() { - return params; - } + private RsaSubParams params; + } diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricPublicKey.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricPublicKey.java index c2cbfb48b..369e921c1 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricPublicKey.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricPublicKey.java @@ -2,12 +2,16 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElements; +import lombok.Getter; +import lombok.NoArgsConstructor; /** * As specified in TCPA Main Specification section 4.27.3. This structure contains the public * portion of an asymmetric key pair. It contains all the information necessary for it's unambiguous * usage. */ +@Getter +@NoArgsConstructor @StructElements(elements = {"asymmetricKeyParams", "storePubKey"}) public class AsymmetricPublicKey implements Struct { @@ -36,28 +40,14 @@ public class AsymmetricPublicKey implements Struct { */ public static final short DEFAULT_RSA_SIGNATURE_SCHEME = 0x1; - private AsymmetricKeyParams asymmetricKeyParams; - - private StorePubKey storePubKey; - /** - * Default constructor. This is required for the {@link - * hirs.structs.converters.StructConverter}. + * information regarding this key */ - public AsymmetricPublicKey() { - } + private AsymmetricKeyParams asymmetricKeyParams; /** - * @return information regarding this key + * the public as described by the key parameters. */ - public AsymmetricKeyParams getAsymmetricKeyParams() { - return asymmetricKeyParams; - } + private StorePubKey storePubKey; - /** - * @return the public as described by the key parameters. - */ - public StorePubKey getStorePubKey() { - return storePubKey; - } } diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/IdentityProof.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/IdentityProof.java index 8e03e91f2..6c89e3355 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/IdentityProof.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/IdentityProof.java @@ -3,6 +3,7 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; import java.util.Arrays; @@ -16,23 +17,51 @@ "endorsementCredential", "platformCredential", "conformanceCredential"}) public class IdentityProof implements Struct { + /** + * version of the TPM that created this data structure. + */ + @Getter private Version version; + /** + * the size of the label area. + */ + @Getter @StructElementLength(fieldName = "label") private int labelSize; + /** + * the size of the identity binding area. + */ + @Getter @StructElementLength(fieldName = "identityBinding") private int identityBindingSize; + /** + * the size of the endorsement credential. + */ + @Getter @StructElementLength(fieldName = "endorsementCredential") private int endorsementSize; + /** + * the size of the endorsement credential. + */ + @Getter @StructElementLength(fieldName = "platformCredential") private int platformSize; + /** + * the size of the conformance credential. + */ + @Getter @StructElementLength(fieldName = "conformanceCredential") private int conformanceSize; + /** + * public key of the new identity. + */ + @Getter private AsymmetricPublicKey identityKey; private byte[] label; @@ -45,55 +74,6 @@ public class IdentityProof implements Struct { private byte[] conformanceCredential; - /** - * @return version of the TPM that created this data structure - */ - public Version getVersion() { - return version; - } - - /** - * @return the size of the label area - */ - public int getLabelSize() { - return labelSize; - } - - /** - * @return the size of the identity binding area - */ - public int getIdentityBindingSize() { - return identityBindingSize; - } - - /** - * @return the size of the endorsement credential - */ - public int getEndorsementSize() { - return endorsementSize; - } - - /** - * @return the size of the endorsement credential - */ - public int getPlatformSize() { - return platformSize; - } - - /** - * @return the size of the conformance credential - */ - public int getConformanceSize() { - return conformanceSize; - } - - /** - * @return public key of the new identity - */ - public AsymmetricPublicKey getIdentityKey() { - return identityKey; - } - /** * @return label of the identity */ diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/IdentityRequest.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/IdentityRequest.java index 94260475a..4c26ccf3b 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/IdentityRequest.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/IdentityRequest.java @@ -3,6 +3,8 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; +import lombok.Setter; import java.util.Arrays; @@ -14,47 +16,39 @@ "symmetricAlgorithm", "asymmetricBlob", "symmetricBlob"}) public class IdentityRequest implements Struct { + /** + * the size of the asymmetric encrypted area. + */ + @Getter @StructElementLength(fieldName = "asymmetricBlob") private int asymmetricBlobSize; + /** + * the size of the symmetric encrypted area. + */ + @Getter @StructElementLength(fieldName = "symmetricBlob") private int symmetricBlobSize; - private AsymmetricKeyParams asymmetricAlgorithm; - - private SymmetricKeyParams symmetricAlgorithm; - - private byte[] asymmetricBlob; - - private byte[] symmetricBlob; - /** - * @return the size of the asymmetric encrypted area + * the parameters for the asymmetric algorithm used to create the asymmetricBlob. */ - public int getAsymmetricBlobSize() { - return asymmetricBlobSize; - } + @Getter + private AsymmetricKeyParams asymmetricAlgorithm; /** - * @return the size of the symmetric encrypted area + * the parameters for the symmetric algorithm used to create the asymmetricBlob. */ - public int getSymmetricBlobSize() { - return symmetricBlobSize; - } + @Getter + private SymmetricKeyParams symmetricAlgorithm; - /** - * @return the parameters for the asymmetric algorithm used to create the asymmetricBlob - */ - public AsymmetricKeyParams getAsymmetricAlgorithm() { - return asymmetricAlgorithm; - } + private byte[] asymmetricBlob; /** - * @return the parameters for the symmetric algorithm used to create the asymmetricBlob + * the value of the encrypted symmetric blob. */ - public SymmetricKeyParams getSymmetricAlgorithm() { - return symmetricAlgorithm; - } + @Setter + private byte[] symmetricBlob; /** * @return encrypted asymmetric area @@ -70,12 +64,4 @@ public byte[] getSymmetricBlob() { return Arrays.copyOf(symmetricBlob, symmetricBlob.length); } - /** - * Sets the value of the encrypted symmetric blob. - * - * @param symmetricBlob new value - */ - public void setSymmetricBlob(final byte[] symmetricBlob) { - this.symmetricBlob = symmetricBlob; - } } diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/PublicKey.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/PublicKey.java index 245188a44..b38e2757e 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/PublicKey.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/PublicKey.java @@ -2,30 +2,25 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElements; +import lombok.Getter; /** * As specified in TCPA Main Specification section 4.27.3. This structure contains the public * portion of an asymmetric key pair. It contains all the information necessary for it's unambiguous * usage. */ +@Getter @StructElements(elements = {"asymmetricKeyParams", "storePubKey"}) public class PublicKey implements Struct { - private AsymmetricKeyParams asymmetricKeyParams; - - private StorePubKey storePubKey; - /** - * @return information regarding this key + * information regarding this key */ - public AsymmetricKeyParams getAsymmetricKeyParams() { - return asymmetricKeyParams; - } + private AsymmetricKeyParams asymmetricKeyParams; /** - * @return the public as described by the key parameters. + * the public as described by the key parameters. */ - public StorePubKey getStorePubKey() { - return storePubKey; - } + private StorePubKey storePubKey; + } diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/RsaSubParams.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/RsaSubParams.java index 9abef6878..1a139bc50 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/RsaSubParams.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/RsaSubParams.java @@ -3,6 +3,7 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; import java.util.Arrays; @@ -13,30 +14,28 @@ @StructElements(elements = {"keyLength", "totalPrimes", "exponentSize", "exponent"}) public class RsaSubParams implements Struct { + /** + * the length of the key. + */ + @Getter private int keyLength; + /** + * the total number of prime numbers in the key. Typically this is associated with the + * block size. + */ + @Getter private int totalPrimes; + /** + * the size of the exponent block. + */ + @Getter @StructElementLength(fieldName = "exponent") private int exponentSize; private byte[] exponent; - /** - * @return the length of the key - */ - public int getKeyLength() { - return keyLength; - } - - /** - * @return the total number of prime numbers in the key. Typically this is associated with the - * block size. - */ - public int getTotalPrimes() { - return totalPrimes; - } - /** * @return the public exponent of the key */ @@ -44,10 +43,4 @@ public byte[] getExponent() { return Arrays.copyOf(exponent, exponent.length); } - /** - * @return the size of the exponent block. - */ - public int getExponentSize() { - return exponentSize; - } } diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/StorePubKey.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/StorePubKey.java index cc70106d1..908e080b7 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/StorePubKey.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/StorePubKey.java @@ -3,6 +3,7 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; import java.util.Arrays; @@ -12,19 +13,13 @@ */ @StructElements(elements = {"keyLength", "key"}) public class StorePubKey implements Struct { - + + @Getter @StructElementLength(fieldName = "key") private int keyLength; private byte[] key; - /** - * @return length of the key field - */ - public int getKeyLength() { - return keyLength; - } - /** * @return contains the public key information which varies depending on the key algorithm. In * example, if an RSA key, this field will represent the RSA public modulus. diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKey.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKey.java index 3c2fb30b1..a5b69af4c 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKey.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKey.java @@ -3,6 +3,7 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; import java.util.Arrays; @@ -23,35 +24,26 @@ public class SymmetricKey implements Struct { */ public static final short SCHEME_CBC = 255; - private int algorithmId; - - private short encryptionScheme; - - @StructElementLength(fieldName = "key") - private short keySize; - - private byte[] key; - /** - * @return of the symmetric key + * of the symmetric key */ - public int getAlgorithmId() { - return algorithmId; - } + @Getter + private int algorithmId; /** - * @return the encryption scheme of the symmetric key + * the encryption scheme of the symmetric key. */ - public short getEncryptionScheme() { - return encryptionScheme; - } + @Getter + private short encryptionScheme; /** - * @return the size the underlying symmetric key block. + * the size the underlying symmetric key block. */ - public short getKeySize() { - return keySize; - } + @Getter + @StructElementLength(fieldName = "key") + private short keySize; + + private byte[] key; /** * @return the underlying key block. diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKeyParams.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKeyParams.java index 7b03b9fb2..a7689e6b9 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKeyParams.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKeyParams.java @@ -3,10 +3,12 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; /** * Represents a symmetric key as specified in section 4.20 of the TCPA. */ +@Getter @StructElements(elements = {"algorithmId", "encryptionScheme", "signatureScheme", "paramsSize", "params"}) public class SymmetricKeyParams implements Struct { @@ -21,49 +23,30 @@ public class SymmetricKeyParams implements Struct { */ public static final short SCHEME_CBC_PKCS5PADDING = 0x1; - private int algorithmId; - - private short encryptionScheme; - - private short signatureScheme; - - @StructElementLength(fieldName = "params") - private int paramsSize; - - private SymmetricSubParams params; - /** - * @return the algorithm used. + * the algorithm used. */ - public int getAlgorithmId() { - return algorithmId; - } + private int algorithmId; /** - * @return the encryption scheme used. + * the encryption scheme used. */ - public short getEncryptionScheme() { - return encryptionScheme; - } + private short encryptionScheme; /** - * @return the algorithm used. + * the algorithm used. */ - public short getSignatureScheme() { - return signatureScheme; - } + private short signatureScheme; /** - * @return the size of the sub parameters block. + * the size of the sub parameters block. */ - public int getParamsSize() { - return paramsSize; - } + @StructElementLength(fieldName = "params") + private int paramsSize; /** - * @return the sub parameters block. + * the sub parameters block. */ - public SymmetricSubParams getParams() { - return params; - } + private SymmetricSubParams params; + } diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricSubParams.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricSubParams.java index fde376328..7dec88518 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricSubParams.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricSubParams.java @@ -3,6 +3,7 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; import java.util.Arrays; @@ -13,35 +14,26 @@ @StructElements(elements = {"keyLength", "blockSize", "ivSize", "iv"}) public class SymmetricSubParams implements Struct { - private int keyLength; - - private int blockSize; - - @StructElementLength(fieldName = "iv") - private int ivSize; - - private byte[] iv; - /** - * @return the key length. + * the key length. */ - public int getKeyLength() { - return keyLength; - } + @Getter + private int keyLength; /** - * @return the block size. + * the block size. */ - public int getBlockSize() { - return blockSize; - } + @Getter + private int blockSize; /** - * @return the IV size. + * the IV size. */ - public int getIvSize() { - return ivSize; - } + @Getter + @StructElementLength(fieldName = "iv") + private int ivSize; + + private byte[] iv; /** * @return the IV. diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/Version.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/Version.java index 3204b8d6e..274a41b06 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/Version.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/Version.java @@ -2,47 +2,34 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElements; +import lombok.Getter; /** * As specified in the TCPA Main Specification section 4.5. This structure represents the version of * the TPM. */ +@Getter @StructElements(elements = {"major", "minor", "revisionMajor", "revisionMinor"}) public class Version implements Struct { - private byte major; - - private byte minor; - - private byte revisionMajor; - - private byte revisionMinor; - /** - * @return the major version indicator. For version 1 this MUST be 0x01 + * the major version indicator. For version 1 this MUST be 0x01. */ - public byte getMajor() { - return major; - } + private byte major; /** - * @return the minor version indicator. For version 1 this MUST be 0x01 + * the minor version indicator. For version 1 this MUST be 0x01. */ - public byte getMinor() { - return minor; - } + private byte minor; /** - * @return the value of the TCPA_PERSISTENT_DATA -> revMajor + * the value of the TCPA_PERSISTENT_DATA -> revMajor. */ - public byte getRevisionMajor() { - return revisionMajor; - } + private byte revisionMajor; /** - * @return the value of the TCPA_PERSISTENT_DATA -> revMinor + * the value of the TCPA_PERSISTENT_DATA -> revMinor. */ - public byte getRevisionMinor() { - return revisionMinor; - } + private byte revisionMinor; + } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareIdentity.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareIdentity.java index 3f28ec2d8..c7614dee1 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareIdentity.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareIdentity.java @@ -19,6 +19,8 @@ import jakarta.xml.bind.annotation.XmlType; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import lombok.Getter; +import lombok.Setter; import org.w3c.dom.Element; import java.math.BigInteger; @@ -74,22 +76,70 @@ public class SoftwareIdentity }) @XmlAnyElement(lax = true) protected List entityOrEvidenceOrLink; + + /** + * corpus property. + */ + @Setter @XmlAttribute(name = "corpus") protected Boolean corpus; + + /** + * patch property. + */ + @Setter @XmlAttribute(name = "patch") protected Boolean patch; + + /** + * media property. + */ + @Setter + @Getter @XmlAttribute(name = "media") protected String media; + + /** + * name property. + */ + @Setter + @Getter @XmlAttribute(name = "name", required = true) protected String name; + + /** + * supplemental property. + */ + @Setter @XmlAttribute(name = "supplemental") protected Boolean supplemental; + + /** + * tagId property. + */ + @Setter + @Getter @XmlAttribute(name = "tagId", required = true) protected String tagId; + + /** + * tagVersion property. + */ + @Setter @XmlAttribute(name = "tagVersion") protected BigInteger tagVersion; + + /** + * version property. + */ + @Setter @XmlAttribute(name = "version") protected String version; + + /** + * versionScheme property. + */ + @Setter @XmlAttribute(name = "versionScheme") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlSchemaType(name = "NMTOKEN") @@ -142,16 +192,6 @@ public boolean isCorpus() { } } - /** - * Sets the value of the corpus property. - * - * @param value allowed object is - * {@link Boolean } - */ - public void setCorpus(Boolean value) { - this.corpus = value; - } - /** * Gets the value of the patch property. * @@ -166,56 +206,6 @@ public boolean isPatch() { } } - /** - * Sets the value of the patch property. - * - * @param value allowed object is - * {@link Boolean } - */ - public void setPatch(Boolean value) { - this.patch = value; - } - - /** - * Gets the value of the media property. - * - * @return possible object is - * {@link String } - */ - public String getMedia() { - return media; - } - - /** - * Sets the value of the media property. - * - * @param value allowed object is - * {@link String } - */ - public void setMedia(String value) { - this.media = value; - } - - /** - * Gets the value of the name property. - * - * @return possible object is - * {@link String } - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value allowed object is - * {@link String } - */ - public void setName(String value) { - this.name = value; - } - /** * Gets the value of the supplemental property. * @@ -230,36 +220,6 @@ public boolean isSupplemental() { } } - /** - * Sets the value of the supplemental property. - * - * @param value allowed object is - * {@link Boolean } - */ - public void setSupplemental(Boolean value) { - this.supplemental = value; - } - - /** - * Gets the value of the tagId property. - * - * @return possible object is - * {@link String } - */ - public String getTagId() { - return tagId; - } - - /** - * Sets the value of the tagId property. - * - * @param value allowed object is - * {@link String } - */ - public void setTagId(String value) { - this.tagId = value; - } - /** * Gets the value of the tagVersion property. * @@ -274,16 +234,6 @@ public BigInteger getTagVersion() { } } - /** - * Sets the value of the tagVersion property. - * - * @param value allowed object is - * {@link BigInteger } - */ - public void setTagVersion(BigInteger value) { - this.tagVersion = value; - } - /** * Gets the value of the version property. * @@ -298,16 +248,6 @@ public String getVersion() { } } - /** - * Sets the value of the version property. - * - * @param value allowed object is - * {@link String } - */ - public void setVersion(String value) { - this.version = value; - } - /** * Gets the value of the versionScheme property. * @@ -322,14 +262,4 @@ public String getVersionScheme() { } } - /** - * Sets the value of the versionScheme property. - * - * @param value allowed object is - * {@link String } - */ - public void setVersionScheme(String value) { - this.versionScheme = value; - } - } diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/CredentialParser.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/CredentialParser.java index 013095d83..31875e5ca 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/CredentialParser.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/CredentialParser.java @@ -1,5 +1,7 @@ package hirs.swid; +import lombok.Getter; +import lombok.Setter; import org.bouncycastle.asn1.x509.AccessDescription; import org.bouncycastle.asn1.x509.AuthorityInformationAccess; import org.bouncycastle.asn1.x509.Extension; @@ -12,8 +14,24 @@ import org.bouncycastle.util.encoders.Base64; import org.bouncycastle.util.encoders.DecoderException; -import java.io.*; -import java.security.*; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.Security; +import java.security.UnrecoverableEntryException; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; @@ -24,6 +42,7 @@ /** * This class parses private key, public key, and certificate for use in their respective java.security objects. */ +@Getter public class CredentialParser { private static final String X509 = "X.509"; private static final String JKS = "JKS"; @@ -34,25 +53,13 @@ public class CredentialParser { private static final String PKCS8_FOOTER = "-----END PRIVATE KEY-----"; private static final String CERTIFICATE_HEADER = "-----BEGIN CERTIFICATE-----"; private static final String CERTIFICATE_FOOTER = "-----END CERTIFICATE-----"; - private X509Certificate certificate; - private PrivateKey privateKey; - private PublicKey publicKey; - public X509Certificate getCertificate() { - return certificate; - } - - public void setCertificate(X509Certificate certificate) { - this.certificate = certificate; - } + @Setter + private X509Certificate certificate; - public PrivateKey getPrivateKey() { - return privateKey; - } + private PrivateKey privateKey; - public PublicKey getPublicKey() { - return publicKey; - } + private PublicKey publicKey; public void parseJKSCredentials(String jksKeystore) { KeyStore.PrivateKeyEntry privateKeyEntry = @@ -78,6 +85,7 @@ public void parsePEMCredentials(String certificateFile, String privateKeyFile) * This method extracts certificate bytes from a string. The bytes are assumed to be * PEM format, and a header and footer are concatenated with the input string to * facilitate proper parsing. + * * @param pemString the input string * @return an X509Certificate created from the string * @throws CertificateException if instantiating the CertificateFactory errors @@ -86,10 +94,10 @@ public X509Certificate parseCertFromPEMString(String pemString) throws Certifica try { CertificateFactory factory = CertificateFactory.getInstance(X509); InputStream inputStream = new ByteArrayInputStream((CERTIFICATE_HEADER - + System.lineSeparator() - + pemString - + System.lineSeparator() - + CERTIFICATE_FOOTER).getBytes()); + + System.lineSeparator() + + pemString + + System.lineSeparator() + + CERTIFICATE_FOOTER).getBytes()); return (X509Certificate) factory.generateCertificate(inputStream); } catch (CertificateException e) { throw e; @@ -98,6 +106,7 @@ public X509Certificate parseCertFromPEMString(String pemString) throws Certifica /** * This method returns the X509Certificate object from a PEM certificate file. + * * @param certificateFile * @return * @throws FileNotFoundException @@ -111,6 +120,7 @@ public List parseCertsFromPEM(String certificateFile) * This method returns the X509Certificate found in a PEM file. * Unchecked typcase warnings are suppressed because the CertificateFactory * implements X509Certificate objects explicitly. + * * @param filename pem file * @return a list containing all X509Certificates extracted */ @@ -158,6 +168,7 @@ private List parsePEMCertificates(String filename) { * Both PKCS1 and PKCS8 formats are handled. * Algorithm argument is present to allow handling of multiple encryption algorithms, * but for now it is always RSA. + * * @param filename * @return */ @@ -218,6 +229,7 @@ private PrivateKey parsePEMPrivateKey(String filename, String algorithm) throws /** * This method reads a PKCS1 keypair from a PEM file. + * * @param filename * @return */ @@ -232,12 +244,14 @@ private KeyPair getPKCS1KeyPair(String filename) throws IOException { /** * This method returns the private key from a JKS keystore. + * * @param keystoreFile * @param alias * @param password * @return KeyStore.PrivateKeyEntry */ - private KeyStore.PrivateKeyEntry parseKeystorePrivateKey(String keystoreFile, String alias, String password) { + private KeyStore.PrivateKeyEntry parseKeystorePrivateKey(String keystoreFile, String alias, + String password) { KeyStore keystore = null; KeyStore.PrivateKeyEntry privateKey = null; try { @@ -247,7 +261,8 @@ private KeyStore.PrivateKeyEntry parseKeystorePrivateKey(String keystoreFile, St new KeyStore.PasswordProtection(password.toCharArray())); } catch (FileNotFoundException e) { System.out.println("Cannot locate keystore " + keystoreFile); - } catch (KeyStoreException | NoSuchAlgorithmException | UnrecoverableEntryException | CertificateException | IOException e) { + } catch (KeyStoreException | NoSuchAlgorithmException | UnrecoverableEntryException | + CertificateException | IOException e) { e.printStackTrace(); } @@ -256,6 +271,7 @@ private KeyStore.PrivateKeyEntry parseKeystorePrivateKey(String keystoreFile, St /** * This method returns the authorityInfoAccess from an X509Certificate. + * * @return * @throws IOException */ @@ -264,7 +280,7 @@ public String getCertificateAuthorityInfoAccess() throws IOException { byte[] extension = certificate.getExtensionValue(Extension.authorityInfoAccess.getId()); if (extension != null && extension.length > 0) { AuthorityInformationAccess aia = AuthorityInformationAccess.getInstance( - JcaX509ExtensionUtils.parseExtensionValue(extension)); + JcaX509ExtensionUtils.parseExtensionValue(extension)); for (AccessDescription ad : aia.getAccessDescriptions()) { if (ad.getAccessMethod().toString().equals(SwidTagConstants.CA_ISSUERS)) { sb.append("CA issuers - "); @@ -279,6 +295,7 @@ public String getCertificateAuthorityInfoAccess() throws IOException { /** * This method returns the subjectKeyIdentifier from the local X509Certificate. + * * @return the String representation of the subjectKeyIdentifier * @throws IOException */ @@ -293,6 +310,7 @@ public String getCertificateSubjectKeyIdentifier() throws IOException { /** * This method returns the subjectKeyIdentifier from a given X509Certificate. + * * @param certificate the cert to pull the subjectKeyIdentifier from * @return the String representation of the subjectKeyIdentifier * @throws IOException diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java index 2e3e3e257..9ed060753 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java @@ -17,6 +17,7 @@ import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Marshaller; +import lombok.Setter; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -84,17 +85,64 @@ public class SwidTagGateway { private final ObjectFactory objectFactory = new ObjectFactory(); private Marshaller marshaller; + /** + * String holding attributes file path + */ + @Setter private String attributesFile; + + /** + * boolean governing signing credentials + */ + @Setter private boolean defaultCredentials; + + /** + * JKS keystore file + */ + @Setter private String jksTruststoreFile; + + /** + * private key file in PEM format + */ + @Setter private String pemPrivateKeyFile; + + /** + * certificate file in PEM format + */ + @Setter private String pemCertificateFile; + + /** + * embed certificate file in signature block + */ + @Setter private boolean embeddedCert; + + /** + * event log support RIM + */ + @Setter private String rimEventLog; + + /** + * timestamp format in XML signature + */ + @Setter private String timestampFormat; + + /** + * timestamp input - RFC3852 + file or RFC3339 + value + */ + @Setter private String timestampArgument; + private String errorRequiredFields; + private DocumentBuilderFactory dbf; + private DocumentBuilder builder; /** @@ -124,88 +172,6 @@ public SwidTagGateway() { } } - /** - * Setter for String holding attributes file path - * - * @param attributesFile - */ - public void setAttributesFile(final String attributesFile) { - this.attributesFile = attributesFile; - } - - /** - * Setter for boolean governing signing credentials - * - * @param defaultCredentials - * @return - */ - public void setDefaultCredentials(final boolean defaultCredentials) { - this.defaultCredentials = defaultCredentials; - } - - /** - * Setter for JKS keystore file - * - * @param jksTruststoreFile - */ - public void setJksTruststoreFile(final String jksTruststoreFile) { - this.jksTruststoreFile = jksTruststoreFile; - } - - /** - * Setter for private key file in PEM format - * - * @param pemPrivateKeyFile - */ - public void setPemPrivateKeyFile(final String pemPrivateKeyFile) { - this.pemPrivateKeyFile = pemPrivateKeyFile; - } - - /** - * Setter for certificate file in PEM format - * - * @param pemCertificateFile - */ - public void setPemCertificateFile(final String pemCertificateFile) { - this.pemCertificateFile = pemCertificateFile; - } - - /** - * Setter to embed certificate file in signature block - * - * @param embeddedCert - */ - public void setEmbeddedCert(final boolean embeddedCert) { - this.embeddedCert = embeddedCert; - } - - /** - * Setter for event log support RIM - * - * @param rimEventLog - */ - public void setRimEventLog(final String rimEventLog) { - this.rimEventLog = rimEventLog; - } - - /** - * Setter for timestamp format in XML signature - * - * @param timestampFormat - */ - public void setTimestampFormat(String timestampFormat) { - this.timestampFormat = timestampFormat; - } - - /** - * Setter for timestamp input - RFC3852 + file or RFC3339 + value - * - * @param timestampArgument - */ - public void setTimestampArgument(String timestampArgument) { - this.timestampArgument = timestampArgument; - } - /** * This method generates a base RIM from the values in a JSON file. * From 1123af6f295996a9edb1071843c2c92f2b798c6b Mon Sep 17 00:00:00 2001 From: TheSilentCoder <184309164+ThatSilentCoder@users.noreply.github.com> Date: Tue, 14 Jan 2025 12:06:29 -0500 Subject: [PATCH 2/3] issue_872: Finished cleaning up checkstyle errors in code, ready for PR. --- .../hirs/structs/elements/aca/IdentityResponseEnvelope.java | 2 +- .../java/hirs/structs/elements/tpm/AsymmetricPublicKey.java | 2 +- .../src/main/java/hirs/structs/elements/tpm/PublicKey.java | 2 +- .../src/main/java/hirs/structs/elements/tpm/StorePubKey.java | 1 - .../src/main/java/hirs/structs/elements/tpm/SymmetricKey.java | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityResponseEnvelope.java b/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityResponseEnvelope.java index 6a38a2073..50234894b 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityResponseEnvelope.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityResponseEnvelope.java @@ -15,7 +15,7 @@ public class IdentityResponseEnvelope implements Struct { /** - * the asymmetric contents block size + * the asymmetric contents block size. */ @Getter @StructElementLength(fieldName = "asymmetricContents") diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricPublicKey.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricPublicKey.java index 369e921c1..5f2784d44 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricPublicKey.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricPublicKey.java @@ -41,7 +41,7 @@ public class AsymmetricPublicKey implements Struct { public static final short DEFAULT_RSA_SIGNATURE_SCHEME = 0x1; /** - * information regarding this key + * information regarding this key. */ private AsymmetricKeyParams asymmetricKeyParams; diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/PublicKey.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/PublicKey.java index b38e2757e..358312ad6 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/PublicKey.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/PublicKey.java @@ -14,7 +14,7 @@ public class PublicKey implements Struct { /** - * information regarding this key + * information regarding this key. */ private AsymmetricKeyParams asymmetricKeyParams; diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/StorePubKey.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/StorePubKey.java index 908e080b7..7efabe0ba 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/StorePubKey.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/StorePubKey.java @@ -13,7 +13,6 @@ */ @StructElements(elements = {"keyLength", "key"}) public class StorePubKey implements Struct { - @Getter @StructElementLength(fieldName = "key") private int keyLength; diff --git a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKey.java b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKey.java index a5b69af4c..f1d30f662 100644 --- a/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKey.java +++ b/HIRS_Structs/src/main/java/hirs/structs/elements/tpm/SymmetricKey.java @@ -25,7 +25,7 @@ public class SymmetricKey implements Struct { public static final short SCHEME_CBC = 255; /** - * of the symmetric key + * algorithm id of the symmetric key. */ @Getter private int algorithmId; From 40377dd2414ca1a605115d0f6609f3e2c41a46c4 Mon Sep 17 00:00:00 2001 From: TheSilentCoder <184309164+ThatSilentCoder@users.noreply.github.com> Date: Tue, 14 Jan 2025 12:26:03 -0500 Subject: [PATCH 3/3] issue_872: Applied lombok to these test classes. --- .../converters/TestEmbeddedStruct.java | 29 +----------- .../hirs/structs/converters/TestStruct.java | 46 +------------------ 2 files changed, 4 insertions(+), 71 deletions(-) diff --git a/HIRS_Structs/src/test/java/hirs/structs/converters/TestEmbeddedStruct.java b/HIRS_Structs/src/test/java/hirs/structs/converters/TestEmbeddedStruct.java index 44686f2dd..a0f0b000b 100644 --- a/HIRS_Structs/src/test/java/hirs/structs/converters/TestEmbeddedStruct.java +++ b/HIRS_Structs/src/test/java/hirs/structs/converters/TestEmbeddedStruct.java @@ -3,12 +3,14 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; import java.util.Arrays; /** * A struct to be embedded within TestStruct. */ +@Getter @StructElements(elements = {"embeddedSize", "embeddedShort", "embedded"}) public class TestEmbeddedStruct implements Struct { @@ -20,7 +22,6 @@ public class TestEmbeddedStruct implements Struct { private static final byte[] DEFAULT_ARRAY = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; - @StructElementLength(fieldName = "embedded") private int embeddedSize = EMBEDDED_SIZE; @@ -57,30 +58,4 @@ public final int hashCode() { return result; } - /** - * Getter. - * - * @return value - */ - public byte[] getEmbedded() { - return embedded; - } - - /** - * Getter. - * - * @return value - */ - public short getEmbeddedShort() { - return embeddedShort; - } - - /** - * Getter. - * - * @return value - */ - public int getEmbeddedSize() { - return embeddedSize; - } } diff --git a/HIRS_Structs/src/test/java/hirs/structs/converters/TestStruct.java b/HIRS_Structs/src/test/java/hirs/structs/converters/TestStruct.java index 0e6428d5e..009a13de9 100644 --- a/HIRS_Structs/src/test/java/hirs/structs/converters/TestStruct.java +++ b/HIRS_Structs/src/test/java/hirs/structs/converters/TestStruct.java @@ -3,10 +3,12 @@ import hirs.structs.elements.Struct; import hirs.structs.elements.StructElementLength; import hirs.structs.elements.StructElements; +import lombok.Getter; /** * A Struct class designed to fully test the design of the converter being tested. */ +@Getter @StructElements( elements = {"testShort", "testEmbeddedStruct", "testByte", "testVariableStructLength", "testVariableStruct"}) @@ -52,48 +54,4 @@ public final int hashCode() { return result; } - /** - * Getter. - * - * @return value - */ - public byte getTestByte() { - return testByte; - } - - /** - * Getter. - * - * @return value - */ - public short getTestShort() { - return testShort; - } - - /** - * Getter. - * - * @return value - */ - public TestEmbeddedStruct getTestEmbeddedStruct() { - return testEmbeddedStruct; - } - - /** - * Getter. - * - * @return value - */ - public TestVariableStruct getTestVariableStruct() { - return testVariableStruct; - } - - /** - * Getter. - * - * @return value - */ - public int getTestVariableStructLength() { - return testVariableStructLength; - } }