Skip to content

Commit 9c0ff03

Browse files
authored
Merge pull request #894 from nsacyber/v3_issue_872-apply-lombok-to-classes-with-boilerplate-code
[#872] Apply Lombok to Remaining Classes with Boilerplate Code
2 parents 03c6bbc + da59897 commit 9c0ff03

File tree

20 files changed

+329
-640
lines changed

20 files changed

+329
-640
lines changed

HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/info/TPMInfo.java

+4-9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public class TPMInfo implements Serializable {
4949
@Column(nullable = true)
5050
private short tpmVersionRevMinor;
5151

52+
/**
53+
* identity certificate for the device.
54+
*/
55+
@Getter
5256
@XmlElement
5357
@XmlJavaTypeAdapter(X509CertificateAdapter.class)
5458
@Lob
@@ -178,15 +182,6 @@ public TPMInfo() {
178182
identityCertificate = null;
179183
}
180184

181-
/**
182-
* Used to retrieve the identity certificate for the device.
183-
*
184-
* @return a byte array holding the certificate information
185-
*/
186-
public X509Certificate getIdentityCertificate() {
187-
return identityCertificate;
188-
}
189-
190185
private void setIdentityCertificate(
191186
final X509Certificate identityCertificate) {
192187
if (identityCertificate == null) {

HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityRequestEnvelope.java

+17-28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import hirs.structs.elements.Struct;
44
import hirs.structs.elements.StructElementLength;
55
import hirs.structs.elements.StructElements;
6+
import lombok.Getter;
67

78
import java.util.Arrays;
89

@@ -16,75 +17,63 @@
1617
"deviceInfoReportLength", "deviceInfoReport"})
1718
public class IdentityRequestEnvelope implements Struct {
1819

20+
/**
21+
* the length of the identity request blob.
22+
*/
23+
@Getter
1924
@StructElementLength(fieldName = "request")
2025
private int requestLength;
2126

2227
private byte[] request;
2328

29+
/**
30+
* the length of the endorsementCredentialModulus blob.
31+
*/
32+
@Getter
2433
@StructElementLength(fieldName = "endorsementCredentialModulus")
2534
private int endorsementCredentialModulusLength;
2635

2736
private byte[] endorsementCredentialModulus;
2837

38+
/**
39+
* the length of the endorsementCredential blob.
40+
*/
41+
@Getter
2942
@StructElementLength(fieldName = "endorsementCredential")
3043
private int endorsementCredentialLength;
3144

3245
private byte[] endorsementCredential;
3346

47+
/**
48+
* the length of the device info report.
49+
*/
50+
@Getter
3451
@StructElementLength(fieldName = "deviceInfoReport")
3552
private int deviceInfoReportLength;
3653

3754
private byte[] deviceInfoReport;
3855

39-
/**
40-
* @return the length of the identity request blob.
41-
*/
42-
public int getRequestLength() {
43-
return requestLength;
44-
}
45-
4656
/**
4757
* @return the identity request.
4858
*/
4959
public byte[] getRequest() {
5060
return Arrays.copyOf(request, request.length);
5161
}
5262

53-
/**
54-
* @return the length of the endorsementCredentialModulus blob
55-
*/
56-
public int getEndorsementCredentialModulusLength() {
57-
return endorsementCredentialModulusLength;
58-
}
59-
6063
/**
6164
* @return the endorsementCredentialModulus blob.
6265
*/
6366
public byte[] getEndorsementCredentialModulus() {
6467
return Arrays.copyOf(endorsementCredentialModulus, endorsementCredentialModulus.length);
6568
}
6669

67-
/**
68-
* @return the length of the endorsementCredential blob
69-
*/
70-
public int getEndorsementCredentialLength() {
71-
return endorsementCredentialLength;
72-
}
73-
7470
/**
7571
* @return the endorsementCredential
7672
*/
7773
public byte[] getEndorsementCredential() {
7874
return Arrays.copyOf(endorsementCredential, endorsementCredential.length);
7975
}
8076

81-
/**
82-
* @return the length of the device info report
83-
*/
84-
public int getDeviceInfoReportLength() {
85-
return deviceInfoReportLength;
86-
}
87-
8877
/**
8978
* @return the device info report
9079
*/

HIRS_Structs/src/main/java/hirs/structs/elements/aca/IdentityResponseEnvelope.java

+9-17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import hirs.structs.elements.Struct;
44
import hirs.structs.elements.StructElementLength;
55
import hirs.structs.elements.StructElements;
6+
import lombok.Getter;
67

78
import java.util.Arrays;
89

@@ -13,11 +14,19 @@
1314
"symmetricAttestation"})
1415
public class IdentityResponseEnvelope implements Struct {
1516

17+
/**
18+
* the asymmetric contents block size.
19+
*/
20+
@Getter
1621
@StructElementLength(fieldName = "asymmetricContents")
1722
private int asymmetricContentsSize;
1823

1924
private byte[] asymmetricContents;
2025

26+
/**
27+
* the symmetric attestation.
28+
*/
29+
@Getter
2130
private SymmetricAttestation symmetricAttestation;
2231

2332
/**
@@ -29,21 +38,4 @@ public byte[] getAsymmetricContents() {
2938
return Arrays.copyOf(asymmetricContents, asymmetricContents.length);
3039
}
3140

32-
/**
33-
* Gets the asymmetric contents block size.
34-
*
35-
* @return the asymmetric contents block size
36-
*/
37-
public int getAsymmetricContentsSize() {
38-
return asymmetricContentsSize;
39-
}
40-
41-
/**
42-
* Gets the symmetric attestation.
43-
*
44-
* @return the symmetric attestation.
45-
*/
46-
public SymmetricAttestation getSymmetricAttestation() {
47-
return symmetricAttestation;
48-
}
4941
}

HIRS_Structs/src/main/java/hirs/structs/elements/aca/SymmetricAttestation.java

+9-18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import hirs.structs.elements.StructElementLength;
55
import hirs.structs.elements.StructElements;
66
import hirs.structs.elements.tpm.SymmetricKeyParams;
7+
import lombok.Getter;
78

89
import java.util.Arrays;
910

@@ -15,30 +16,20 @@
1516
@StructElements(elements = {"credentialSize", "algorithm", "credential"})
1617
public class SymmetricAttestation implements Struct {
1718

19+
/**
20+
* the size of the credential block.
21+
*/
22+
@Getter
1823
@StructElementLength(fieldName = "credential")
1924
private int credentialSize;
2025

21-
private SymmetricKeyParams algorithm;
22-
23-
private byte[] credential;
24-
2526
/**
26-
* Gets the credential block size.
27-
*
28-
* @return the size of the credential block
27+
* the algorithm and other meta data regarding the key.
2928
*/
30-
public int getCredentialSize() {
31-
return credentialSize;
32-
}
29+
@Getter
30+
private SymmetricKeyParams algorithm;
3331

34-
/**
35-
* Gets the key parameters for the credential.
36-
*
37-
* @return the algorithm and other meta data regarding the key
38-
*/
39-
public SymmetricKeyParams getAlgorithm() {
40-
return algorithm;
41-
}
32+
private byte[] credential;
4233

4334
/**
4435
* Gets the credential block.

HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricKeyParams.java

+14-31
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,41 @@
33
import hirs.structs.elements.Struct;
44
import hirs.structs.elements.StructElementLength;
55
import hirs.structs.elements.StructElements;
6+
import lombok.Getter;
67

78
/**
89
* As defined in TCPA 4.20, the key parameters data structure describes the parameters used to
910
* generate a key pair and to store the parts of a key.
1011
*/
12+
@Getter
1113
@StructElements(elements = {"algorithmId", "encryptionScheme", "signatureScheme", "paramsSize",
1214
"params"})
1315
public class AsymmetricKeyParams implements Struct {
1416

15-
private int algorithmId;
16-
17-
private short encryptionScheme;
18-
19-
private short signatureScheme;
20-
21-
@StructElementLength(fieldName = "params")
22-
private int paramsSize;
23-
24-
private RsaSubParams params;
25-
2617
/**
27-
* @return the key algorithm
18+
* the key algorithm.
2819
*/
29-
public int getAlgorithmId() {
30-
return algorithmId;
31-
}
20+
private int algorithmId;
3221

3322
/**
34-
* @return the size of the params field
23+
* the encryption scheme that the key uses.
3524
*/
36-
public int getParamsSize() {
37-
return paramsSize;
38-
}
25+
private short encryptionScheme;
3926

4027
/**
41-
* @return the encryption scheme that the key uses
28+
* the signature scheme that the key uses to perform digital signatures.
4229
*/
43-
public short getEncryptionScheme() {
44-
return encryptionScheme;
45-
}
30+
private short signatureScheme;
4631

4732
/**
48-
* @return the signature scheme that the key uses to perform digital signatures
33+
* the size of the params field.
4934
*/
50-
public short getSignatureScheme() {
51-
return signatureScheme;
52-
}
35+
@StructElementLength(fieldName = "params")
36+
private int paramsSize;
5337

5438
/**
55-
* @return parameter information dependant upon the key algorithm.
39+
* parameter information dependant upon the key algorithm.
5640
*/
57-
public RsaSubParams getParams() {
58-
return params;
59-
}
41+
private RsaSubParams params;
42+
6043
}

HIRS_Structs/src/main/java/hirs/structs/elements/tpm/AsymmetricPublicKey.java

+8-18
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
import hirs.structs.elements.Struct;
44
import hirs.structs.elements.StructElements;
5+
import lombok.Getter;
6+
import lombok.NoArgsConstructor;
57

68
/**
79
* As specified in TCPA Main Specification section 4.27.3. This structure contains the public
810
* portion of an asymmetric key pair. It contains all the information necessary for it's unambiguous
911
* usage.
1012
*/
13+
@Getter
14+
@NoArgsConstructor
1115
@StructElements(elements = {"asymmetricKeyParams", "storePubKey"})
1216
public class AsymmetricPublicKey implements Struct {
1317

@@ -36,28 +40,14 @@ public class AsymmetricPublicKey implements Struct {
3640
*/
3741
public static final short DEFAULT_RSA_SIGNATURE_SCHEME = 0x1;
3842

39-
private AsymmetricKeyParams asymmetricKeyParams;
40-
41-
private StorePubKey storePubKey;
42-
4343
/**
44-
* Default constructor. This is required for the {@link
45-
* hirs.structs.converters.StructConverter}.
44+
* information regarding this key.
4645
*/
47-
public AsymmetricPublicKey() {
48-
}
46+
private AsymmetricKeyParams asymmetricKeyParams;
4947

5048
/**
51-
* @return information regarding this key
49+
* the public as described by the key parameters.
5250
*/
53-
public AsymmetricKeyParams getAsymmetricKeyParams() {
54-
return asymmetricKeyParams;
55-
}
51+
private StorePubKey storePubKey;
5652

57-
/**
58-
* @return the public as described by the key parameters.
59-
*/
60-
public StorePubKey getStorePubKey() {
61-
return storePubKey;
62-
}
6353
}

0 commit comments

Comments
 (0)