Skip to content

Commit

Permalink
While expecting a StackOverFlow error from uploading an EK certificate,
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cyrus-dev committed Jan 24, 2024
1 parent ab4c608 commit 1d0a71a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
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;
Expand Down Expand Up @@ -55,7 +54,7 @@

/**
*
* 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.
*
Expand Down Expand Up @@ -529,10 +528,6 @@ private void parseSingle(final ASN1Primitive component, final boolean addToMappi
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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -9,7 +8,6 @@
/**
* 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";
Expand All @@ -28,6 +26,7 @@ public void testX500NameCompareTrue() {
VALID_RDN_STRING, VALID_RDN_STRING_SWITCHED));
assertTrue(BouncyCastleUtils.x500NameCompare(
VALID_RDN_STRING, VALID_RDN_STRING_UPPERCASE));
assertTrue(BouncyCastleUtils.x500NameCompare(Strings.EMPTY, Strings.EMPTY));
}

/**
Expand All @@ -40,7 +39,6 @@ public void testX500NameCompareFalse() {
// 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(
Expand Down

0 comments on commit 1d0a71a

Please sign in to comment.