Skip to content

Commit

Permalink
added invalid '=' test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Aug 26, 2023
1 parent 8b9cb67 commit b0ca436
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion core/src/test/java/org/bouncycastle/asn1/test/X500NameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public void performTest()
throws Exception
{
ietfUtilsTest();

bogusEqualsTest();

testEncodingPrintableString(BCStyle.C, "AU");
testEncodingPrintableString(BCStyle.SERIALNUMBER, "123456");
testEncodingPrintableString(BCStyle.DN_QUALIFIER, "123456");
Expand Down Expand Up @@ -676,6 +677,20 @@ private void ietfUtilsTest()
IETFUtils.valueToString(new DERUTF8String(" "));
}

private void bogusEqualsTest()
throws Exception
{
try
{
new X500Name("CN=foo=bar");
fail("no exception");
}
catch (IllegalArgumentException e)
{
isEquals("badly formatted directory string", e.getMessage());
}
}

public static class DNQStyle
extends BCStyle
{
Expand Down

0 comments on commit b0ca436

Please sign in to comment.