/**
* valid test_00
*/
intPolicies = new ASN1EncodableVector();
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.5.29.32.0")));
map = new Hashtable();
map.put("2.16.840.1.101.3.2.1.48.1","2.16.840.1.101.3.2.1.48.2");
intCert = createIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
policies = new ASN1EncodableVector();
policies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.2")));
endCert = createEndEntityCert(pubKey, intPrivKey, intPubKey, policies);
requirePolicies = null;
String msg = testPolicies(0, trustCert, intCert, endCert, requirePolicies, true);
checkMessage(0, msg, "");
/**
* test_01
*/
intPolicies = new ASN1EncodableVector();
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.5.29.32.0")));
map = new Hashtable();
map.put("2.16.840.1.101.3.2.1.48.1","2.16.840.1.101.3.2.1.48.2");
intCert = createIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
policies = new ASN1EncodableVector();
policies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.2")));
endCert = createEndEntityCert(pubKey, intPrivKey, intPubKey, policies);
requirePolicies = new HashSet();
requirePolicies.add("2.16.840.1.101.3.2.1.48.1");
msg = testPolicies(1, trustCert, intCert, endCert, requirePolicies, true);
checkMessage(1, msg, "");
/**
* test_02
*/
intPolicies = new ASN1EncodableVector();
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.5.29.32.0")));
map = new Hashtable();
map.put("2.16.840.1.101.3.2.1.48.1","2.16.840.1.101.3.2.1.48.2");
intCert = createIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
policies = new ASN1EncodableVector();
policies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.2")));
endCert = createEndEntityCert(pubKey, intPrivKey, intPubKey, policies);
requirePolicies = new HashSet();
requirePolicies.add("2.5.29.32.0");
msg = testPolicies(2, trustCert, intCert, endCert, requirePolicies, true);
checkMessage(2, msg, "");
/**
* test_03
*/
intPolicies = new ASN1EncodableVector();
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.3")));
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.5.29.32.0")));
map = new Hashtable();
map.put("2.16.840.1.101.3.2.1.48.1","2.16.840.1.101.3.2.1.48.2");
intCert = createIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
policies = new ASN1EncodableVector();
policies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.2")));
endCert = createEndEntityCert(pubKey, intPrivKey, intPubKey, policies);
requirePolicies = new HashSet();
requirePolicies.add("2.16.840.1.101.3.2.1.48.1");
msg = testPolicies(3, trustCert, intCert, endCert, requirePolicies, true);
checkMessage(3, msg, "");
/**
* test_04
*/
intPolicies = new ASN1EncodableVector();
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.3")));
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.5.29.32.0")));
map = new Hashtable();
map.put("2.16.840.1.101.3.2.1.48.1","2.16.840.1.101.3.2.1.48.2");
intCert = createIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
policies = new ASN1EncodableVector();
policies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.3")));
endCert = createEndEntityCert(pubKey, intPrivKey, intPubKey, policies);
requirePolicies = new HashSet();
requirePolicies.add("2.16.840.1.101.3.2.1.48.3");
msg = testPolicies(4, trustCert, intCert, endCert, requirePolicies, true);
checkMessage(4, msg, "");
/**
* test_05
*/
intPolicies = new ASN1EncodableVector();
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.5.29.32.0")));
map = new Hashtable();
map.put("2.16.840.1.101.3.2.1.48.1","2.16.840.1.101.3.2.1.48.2");
intCert = createIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
policies = new ASN1EncodableVector();
policies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.2")));
endCert = createEndEntityCert(pubKey, intPrivKey, intPubKey, policies);
requirePolicies = new HashSet();
requirePolicies.add("2.16.840.1.101.3.2.1.48.2");
msg = testPolicies(5, trustCert, intCert, endCert, requirePolicies, false);
checkMessage(5, msg, "Path processing failed on policy.");
/**
* test_06
*/
intPolicies = new ASN1EncodableVector();
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.5.29.32.0")));
map = new Hashtable();
map.put("2.16.840.1.101.3.2.1.48.1","2.16.840.1.101.3.2.1.48.2");
intCert = createIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
policies = new ASN1EncodableVector();
policies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.1")));
endCert = createEndEntityCert(pubKey, intPrivKey, intPubKey, policies);
requirePolicies = new HashSet();
requirePolicies.add("2.16.840.1.101.3.2.1.48.1");
msg = testPolicies(6, trustCert, intCert, endCert, requirePolicies, true);
checkMessage(6, msg, "");
/**
* test_07
*/
intPolicies = new ASN1EncodableVector();
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.5.29.32.0")));
map = new Hashtable();
map.put("2.16.840.1.101.3.2.1.48.1","2.16.840.1.101.3.2.1.48.2");
intCert = createIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
policies = new ASN1EncodableVector();
policies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.2")));
endCert = createEndEntityCert(pubKey, intPrivKey, intPubKey, policies);
requirePolicies = new HashSet();
requirePolicies.add("2.16.840.1.101.3.2.1.48.3");
msg = testPolicies(7, trustCert, intCert, endCert, requirePolicies, false);
checkMessage(7, msg, "Path processing failed on policy.");
/**
* test_08
*/
intPolicies = new ASN1EncodableVector();
intPolicies.add(new PolicyInformation(new DERObjectIdentifier("2.5.29.32.0")));
map = new Hashtable();
map.put("2.16.840.1.101.3.2.1.48.1","2.16.840.1.101.3.2.1.48.2");
intCert = createIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
policies = new ASN1EncodableVector();
policies.add(new PolicyInformation(new DERObjectIdentifier("2.16.840.1.101.3.2.1.48.3")));
endCert = createEndEntityCert(pubKey, intPrivKey, intPubKey, policies);
requirePolicies = new HashSet();
requirePolicies.add("2.16.840.1.101.3.2.1.48.1");
msg = testPolicies(8, trustCert, intCert, endCert, requirePolicies, false);