Skip to content

Commit

Permalink
issue_847: Reduced styling errors in CA module to less than 100
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatSilentCoder committed Oct 23, 2024
1 parent 64c74ea commit 571d107
Show file tree
Hide file tree
Showing 35 changed files with 369 additions and 434 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ public static Date recoverDate(final ASN1GeneralizedTime time) {
* on the portal.
*
* @return A list of URLs that inform the location of the certificate revocation lists
* @throws java.io.IOException
* @throws IOException if there is an issue while retrieving the CRL Distribution point
*/
private String getCRLDistributionPoint() throws IOException {
List<String> crlUrls = new ArrayList<>();
Expand Down Expand Up @@ -972,6 +972,11 @@ public byte[] getRawBytes() {
return null;
}

/**
* Creates a string representation of the Certificate object.
*
* @return a string representation of the Certificate object.
*/
@Override
public String toString() {
return String.format("Certificate{%s, AuthID=%s, serialNumber=%s, "
Expand All @@ -982,6 +987,13 @@ public String toString() {
signatureAlgorithm, certificateHash);
}

/**
* Compares this certificate to the provided object to verify that both this and the provided certificate
* objects are equal.
*
* @param o object to compare
* @return true if both the provided certificate and this certificate are equal, false otherwise
*/
@Override
public boolean equals(final Object o) {
if (this == o) {
Expand All @@ -997,6 +1009,11 @@ public boolean equals(final Object o) {
return Arrays.equals(certificateBytes, that.certificateBytes);
}

/**
* Creates an integer hash code for this Certificate object.
*
* @return integer hash code
*/
@Override
public int hashCode() {
return Arrays.hashCode(certificateBytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
/**
* Represents an issued attestation certificate to a HIRS Client.
*/
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class IssuedAttestationCertificate extends DeviceAssociatedCertificate {

Expand All @@ -29,7 +29,7 @@ public class IssuedAttestationCertificate extends DeviceAssociatedCertificate {
public static final String AIC_TYPE_LABEL = "TCPA Trusted Platform Identity";

@Column
public boolean isLDevID;
private boolean isLDevID;

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "ek_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public CommonCriteriaMeasures(final ASN1Sequence sequence) throws IllegalArgumen
}
}

/**
* Creates a custom string representation of the Common Criteria Measures object.
*
* @return a string representation of Common Criteria Measures
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ public class ComponentAddress {
public static final int IDENTIFIER_NUMBER = 2;

private static final String ETHERNET_MAC = "2.23.133.17.1";

private static final String WLAN_MAC = "2.23.133.17.2";

private static final String BLUETOOTH_MAC = "2.23.133.17.3";

private ASN1ObjectIdentifier addressType;

private ASN1UTF8String addressValue;

private String addressTypeString;

private String addressValueString;

/**
Expand Down Expand Up @@ -74,6 +79,12 @@ public String getAddressTypeValue() {
};
}


/**
* Creates a string representation of the Component Address object.
*
* @return a string representation of the Component Address object.
*/
@Override
public String toString() {
return "ComponentAddress{"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ public boolean isVersion2() {
return false;
}

/**
* Creates a string representation of the Component Identifier object.
*
* @return a string representation of the Component Identifier object.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.bouncycastle.asn1.ASN1Boolean;
import org.bouncycastle.asn1.ASN1Enumerated;
import org.bouncycastle.asn1.ASN1IA5String;
Expand All @@ -17,18 +18,18 @@
* plus BOOLEAN DEFAULT FALSE }
* </pre>
*/
@Getter
@Setter
@AllArgsConstructor
@ToString
public class FIPSLevel {

private static final int MAX_SEQUENCE_SIZE = 3;
@Getter
@Setter

private ASN1IA5String version;
@Getter
@Setter

private SecurityLevel level;
@Getter
@Setter

private ASN1Boolean plus;

/**
Expand Down Expand Up @@ -65,15 +66,6 @@ public FIPSLevel(final ASN1Sequence sequence) throws IllegalArgumentException {
}
}

@Override
public String toString() {
return "FIPSLevel{"
+ "version=" + version.getString()
+ ", level=" + level.getValue()
+ ", plus=" + plus.toString()
+ '}';
}

/**
* A type to handle the security Level used in the FIPS Level.
* Ordering of enum types is intentional and their ordinal values correspond to enum
Expand All @@ -87,6 +79,8 @@ public String toString() {
* level4 (4) }
* </pre>
*/
@Getter
@AllArgsConstructor
public enum SecurityLevel {
/**
* Security Level 1.
Expand All @@ -106,23 +100,5 @@ public enum SecurityLevel {
LEVEL4("level 4");

private final String value;

/**
* Basic constructor.
*
* @param value string containing the value.
*/
SecurityLevel(final String value) {
this.value = value;
}

/**
* Get the string value from the StrengthOfFunction.
*
* @return the string containing the value.
*/
public String getValue() {
return this.value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public PlatformConfigurationV1(final ASN1Sequence sequence) throws IllegalArgume
}
}

/**
* Creates a string representation of the Platform Configuration V1 object.
*
* @return a string representation of the Platform Configuration V1 object.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1UTF8String;
import org.bouncycastle.asn1.DERUTF8String;
Expand All @@ -19,14 +20,18 @@
@Getter
@Setter
@AllArgsConstructor
@ToString
public class PlatformProperty {

/**
* Number of identifiers for version 1.
*/
protected static final int IDENTIFIER_NUMBER = 2;

private static final String NOT_SPECIFIED = "Not Specified";

private ASN1UTF8String propertyName;

private ASN1UTF8String propertyValue;

/**
Expand Down Expand Up @@ -54,12 +59,4 @@ public PlatformProperty(final ASN1Sequence sequence) throws IllegalArgumentExcep
this.propertyName = ASN1UTF8String.getInstance(sequence.getObjectAt(0));
this.propertyValue = ASN1UTF8String.getInstance(sequence.getObjectAt(1));
}

@Override
public String toString() {
return "PlatformProperty{"
+ "propertyName=" + propertyName.getString()
+ ", propertyValue=" + propertyValue.getString()
+ "}";
}
}
Loading

0 comments on commit 571d107

Please sign in to comment.