While expecting a StackOverFlow error from uploading an EK certificate,

this is not occurring.  A unit test had to be updated because the
previous BouncyCastle X500Compare.equals() method returned false for 2
empty string compares.  Now it returns true.
This commit is contained in:
Cyrus 2024-01-24 09:48:44 -05:00
parent ab4c608d8d
commit 1d0a71a1a2
2 changed files with 2 additions and 9 deletions

View File

@ -13,7 +13,6 @@ import lombok.NoArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.bouncycastle.asn1.ASN1ApplicationSpecific;
import org.bouncycastle.asn1.ASN1BitString;
import org.bouncycastle.asn1.ASN1Boolean;
import org.bouncycastle.asn1.ASN1Encodable;
@ -55,7 +54,7 @@ import java.util.Set;
/**
*
* This class persists Certificate Authority credentials by extending the base Certificate
* This class persists an Endorsement Credential by extending the base Certificate
* class with fields unique to Endorsement credentials, as defined in the Trusted
* Computing Group Credential Profiles, specification v.1.2.
*
@ -529,10 +528,6 @@ public class EndorsementCredential extends DeviceAssociatedCertificate {
e.printStackTrace();
}
}
} else if (component instanceof ASN1ApplicationSpecific) {
parseSingle(((ASN1ApplicationSpecific) component).getObject(), addToMapping, key);
} else if (component instanceof DERBMPString) {
if (addToMapping) {
String bmpStr = ((DERBMPString) component).getString();

View File

@ -1,6 +1,5 @@
package hirs.utils;
import lombok.extern.log4j.Log4j2;
import org.apache.logging.log4j.util.Strings;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -9,7 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* Tests methods in the (@link BouncyCastleUtils) utility class.
*/
@Log4j2
public class BouncyCastleUtilsTest {
private static final String VALID_RDN_STRING = "OU=PCTest,O=example.com,C=US";
@ -28,6 +26,7 @@ public class BouncyCastleUtilsTest {
VALID_RDN_STRING, VALID_RDN_STRING_SWITCHED));
assertTrue(BouncyCastleUtils.x500NameCompare(
VALID_RDN_STRING, VALID_RDN_STRING_UPPERCASE));
assertTrue(BouncyCastleUtils.x500NameCompare(Strings.EMPTY, Strings.EMPTY));
}
/**
@ -40,7 +39,6 @@ public class BouncyCastleUtilsTest {
// Error that aren't thrown but logged
assertFalse(BouncyCastleUtils.x500NameCompare(VALID_RDN_STRING, Strings.EMPTY));
assertFalse(BouncyCastleUtils.x500NameCompare(Strings.EMPTY, VALID_RDN_STRING));
assertFalse(BouncyCastleUtils.x500NameCompare(Strings.EMPTY, Strings.EMPTY));
assertFalse(BouncyCastleUtils.x500NameCompare(
VALID_RDN_STRING, MALFORMED_RDN_STRING));
assertFalse(BouncyCastleUtils.x500NameCompare(