org.bouncycastle.jce.provider.test
Class PKIXNameConstraintsTest

java.lang.Object
  extended by org.bouncycastle.util.test.SimpleTest
      extended by org.bouncycastle.jce.provider.test.PKIXNameConstraintsTest
All Implemented Interfaces:
Test

public class PKIXNameConstraintsTest
extends SimpleTest

Test class for PKIXNameConstraints.

The field testXYZ is the name to test.

The field testXYZIsConstraint must be tested if it is permitted and excluded.

The field testXYZIsNotConstraint must be tested if it is not permitted and not excluded.

Furthermore there are tests for the intersection and union of test names.


Field Summary
private static java.lang.String[] dn1
           
private static java.lang.String[] dn2
           
private static java.lang.String[] dnIntersection
           
private static java.lang.String[] dns1
           
private static java.lang.String[] dns2
           
private static java.lang.String[] dnsintersect
           
private static java.lang.String[][] dnsunion
           
private static java.lang.String[][] dnUnion
           
private static java.lang.String[] email1
           
private static java.lang.String[] email2
           
private static java.lang.String[] emailintersect
           
private static java.lang.String[][] emailunion
           
private static byte[][] ip1
           
private static byte[][] ip2
           
private static byte[][] ipintersect
           
private static byte[][][] ipunion
           
private static java.lang.String testDN
           
private static java.lang.String[] testDNIsConstraint
           
private static java.lang.String[] testDNIsNotConstraint
           
private static java.lang.String testDNS
           
private static java.lang.String[] testDNSIsConstraint
           
private static java.lang.String[] testDNSIsNotConstraint
           
private static java.lang.String testEmail
           
private static java.lang.String[] testEmailIsConstraint
           
private static java.lang.String[] testEmailIsNotConstraint
           
private static byte[] testIP
           
private static byte[][] testIPIsConstraint
           
private static byte[][] testIPIsNotConstraint
           
private static java.lang.String testURI
           
private static java.lang.String[] testURIIsConstraint
           
private static java.lang.String[] testURIIsNotConstraint
           
private static java.lang.String[] uri1
           
private static java.lang.String[] uri2
           
private static java.lang.String[] uriintersect
           
private static java.lang.String[][] uriunion
           
 
Constructor Summary
PKIXNameConstraintsTest()
           
 
Method Summary
 java.lang.String getName()
           
static void main(java.lang.String[] args)
           
 void performTest()
           
private  void testConstraints(int nameType, byte[] testName, byte[][] testNameIsConstraint, byte[][] testNameIsNotConstraint, byte[][] testNames1, byte[][] testNames2, byte[][][] testUnion, byte[][] testInterSection)
          Tests byte array based GeneralNames for inclusion or exclusion.
private  void testConstraints(int nameType, java.lang.String testName, java.lang.String[] testNameIsConstraint, java.lang.String[] testNameIsNotConstraint, java.lang.String[] testNames1, java.lang.String[] testNames2, java.lang.String[][] testUnion, java.lang.String[] testInterSection)
          Tests string based GeneralNames for inclusion or exclusion.
 
Methods inherited from class org.bouncycastle.util.test.SimpleTest
areEqual, fail, fail, fail, perform, runTest, runTest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

testEmail

private static final java.lang.String testEmail
See Also:
Constant Field Values

testEmailIsConstraint

private static final java.lang.String[] testEmailIsConstraint

testEmailIsNotConstraint

private static final java.lang.String[] testEmailIsNotConstraint

email1

private static final java.lang.String[] email1

email2

private static final java.lang.String[] email2

emailintersect

private static final java.lang.String[] emailintersect

emailunion

private static final java.lang.String[][] emailunion

dn1

private static final java.lang.String[] dn1

dn2

private static final java.lang.String[] dn2

dnUnion

private static final java.lang.String[][] dnUnion

dnIntersection

private static final java.lang.String[] dnIntersection

testDN

private static final java.lang.String testDN
See Also:
Constant Field Values

testDNIsConstraint

private static final java.lang.String[] testDNIsConstraint

testDNIsNotConstraint

private static final java.lang.String[] testDNIsNotConstraint

testDNS

private static final java.lang.String testDNS
See Also:
Constant Field Values

testDNSIsConstraint

private static final java.lang.String[] testDNSIsConstraint

testDNSIsNotConstraint

private static final java.lang.String[] testDNSIsNotConstraint

dns1

private static final java.lang.String[] dns1

dns2

private static final java.lang.String[] dns2

dnsintersect

private static final java.lang.String[] dnsintersect

dnsunion

private static final java.lang.String[][] dnsunion

testURI

private static final java.lang.String testURI
See Also:
Constant Field Values

testURIIsConstraint

private static final java.lang.String[] testURIIsConstraint

testURIIsNotConstraint

private static final java.lang.String[] testURIIsNotConstraint

uri1

private static final java.lang.String[] uri1

uri2

private static final java.lang.String[] uri2

uriintersect

private static final java.lang.String[] uriintersect

uriunion

private static final java.lang.String[][] uriunion

testIP

private static final byte[] testIP

testIPIsConstraint

private static final byte[][] testIPIsConstraint

testIPIsNotConstraint

private static final byte[][] testIPIsNotConstraint

ip1

private static final byte[][] ip1

ip2

private static final byte[][] ip2

ipintersect

private static final byte[][] ipintersect

ipunion

private static final byte[][][] ipunion
Constructor Detail

PKIXNameConstraintsTest

public PKIXNameConstraintsTest()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Test
Specified by:
getName in class SimpleTest

performTest

public void performTest()
                 throws java.lang.Exception
Specified by:
performTest in class SimpleTest
Throws:
java.lang.Exception

testConstraints

private void testConstraints(int nameType,
                             java.lang.String testName,
                             java.lang.String[] testNameIsConstraint,
                             java.lang.String[] testNameIsNotConstraint,
                             java.lang.String[] testNames1,
                             java.lang.String[] testNames2,
                             java.lang.String[][] testUnion,
                             java.lang.String[] testInterSection)
                      throws java.lang.Exception
Tests string based GeneralNames for inclusion or exclusion.

Parameters:
nameType - The GeneralName type to test.
testName - The name to test.
testNameIsConstraint - The names where testName must be included and excluded.
testNameIsNotConstraint - The names where testName must not be excluded and included.
testNames1 - Operand 1 of test names to use for union and intersection testing.
testNames2 - Operand 2 of test names to use for union and intersection testing.
testUnion - The union results.
testInterSection - The intersection results.
Throws:
java.lang.Exception - If an unexpected exception occurs.

testConstraints

private void testConstraints(int nameType,
                             byte[] testName,
                             byte[][] testNameIsConstraint,
                             byte[][] testNameIsNotConstraint,
                             byte[][] testNames1,
                             byte[][] testNames2,
                             byte[][][] testUnion,
                             byte[][] testInterSection)
                      throws java.lang.Exception
Tests byte array based GeneralNames for inclusion or exclusion.

Parameters:
nameType - The GeneralName type to test.
testName - The name to test.
testNameIsConstraint - The names where testName must be included and excluded.
testNameIsNotConstraint - The names where testName must not be excluded and included.
testNames1 - Operand 1 of test names to use for union and intersection testing.
testNames2 - Operand 2 of test names to use for union and intersection testing.
testUnion - The union results.
testInterSection - The intersection results.
Throws:
java.lang.Exception - If an unexpected exception occurs.

main

public static void main(java.lang.String[] args)