* GeneralNames of types: 1, 2, 6, 7 and set it as a criterion.
*/
public void testSetNameConstraints1() throws IOException {
GeneralName [] name_constraints = new GeneralName[] {
new GeneralName(1, "822.Name"),
new GeneralName(1, "rfc@822.Name"),
new GeneralName(2, "Name.org"),
new GeneralName(2, "dNS.Name.org"),
new GeneralName(6, "http://.Resource.Id"),
new GeneralName(6, "http://uniform.Resource.Id"),
new GeneralName(7, "1.1.1.1"),
new GeneralName(7, "1.1.1.1/3.3.3.3"),
new GeneralName(7, "0101:0101:0101:0101:0101:0101:0101:0101"),
new GeneralName(7, "0101:0101:0101:0101:0101:0101:0101:0101"
+ "/0303:0303:0303:0303:0303:0303:0303:0303"),
};
// Names which should match divided from names which should not
// match by null.
// Restrictions apply only when the specified name form is present.
// If no name of the type is in the certificate, the certificate
// is acceptable (rfc 3280). This assertion is checked during processing
// of null GeneralName object (it also serves as separator).
GeneralName[][] alternative_names = new GeneralName[][] {
{
new GeneralName(1, "rfc@822.Name"),
null,
new GeneralName(1, "rfc@Other.Name")
}, {
new GeneralName(1, "rfc@822.Name"),
null,
new GeneralName(1, "rfc@Other.Name")
}, {
new GeneralName(2, "Name.org"),
new GeneralName(2, "dNS.Name.org"),
null,
new GeneralName(2, "dNS.OtherName.org")
}, {
new GeneralName(2, "dNS.Name.org"),
null,
new GeneralName(2, "Name.org"),
new GeneralName(2, "dNS.OtherName.org")
}, {
new GeneralName(6, "http://uniform.Resource.Id/location"),
null,
new GeneralName(6, "http://Resource.Id")
}, {
new GeneralName(6, "http://uniform.Resource.Id"),
null,
new GeneralName(6, "http://Resource.Id")
}, {
new GeneralName(new byte[] {1, 1, 1, 1}),
null,
new GeneralName(new byte[] {2, 2, 2, 2})
}, {
new GeneralName(new byte[] {1, 1, 1, 1}),
new GeneralName(new byte[] {2, 2, 2, 2}),
new GeneralName(new byte[] {3, 3, 3, 3}),
null,
new GeneralName(new byte[] {4, 4, 4, 4})
}, {
new GeneralName(new byte[] {1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1}),
null,
new GeneralName(new byte[] {2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2}),
}, {
new GeneralName(new byte[] {1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1}),
new GeneralName(new byte[] {2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2}),
new GeneralName(new byte[] {3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3}),
null,
new GeneralName(new byte[] {4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4}),
}
};
X509CertSelector selector = new X509CertSelector();