sun.security.x509.PolicyInformation Java Examples
The following examples show how to use
sun.security.x509.PolicyInformation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: X509CertSelectorTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private void testPolicy() throws IOException { System.out.println("X.509 Certificate Match on certificatePolicies"); // test encoding of CertificatePoliciesExtension because we wrote the // code // bad match X509CertSelector selector = new X509CertSelector(); Set<String> s = new HashSet<>(); s.add(new String("1.2.5.7.68")); selector.setPolicy(s); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.32")); CertificatePoliciesExtension ext = new CertificatePoliciesExtension(false, in.getOctetString()); List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES); // match on the first policy id PolicyInformation policyInfo = (PolicyInformation) policies.get(0); s.clear(); s.add(policyInfo.getPolicyIdentifier().getIdentifier().toString()); selector.setPolicy(s); checkMatch(selector, cert, true); }
Example #2
Source File: X509CertSelectorTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private void testPolicy() throws IOException { System.out.println("X.509 Certificate Match on certificatePolicies"); // test encoding of CertificatePoliciesExtension because we wrote the // code // bad match X509CertSelector selector = new X509CertSelector(); Set<String> s = new HashSet<>(); s.add(new String("1.2.5.7.68")); selector.setPolicy(s); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.32")); CertificatePoliciesExtension ext = new CertificatePoliciesExtension(false, in.getOctetString()); List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES); // match on the first policy id PolicyInformation policyInfo = (PolicyInformation) policies.get(0); s.clear(); s.add(policyInfo.getPolicyIdentifier().getIdentifier().toString()); selector.setPolicy(s); checkMatch(selector, cert, true); }
Example #3
Source File: X509CertSelectorTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private void testPolicy() throws IOException { System.out.println("X.509 Certificate Match on certificatePolicies"); // test encoding of CertificatePoliciesExtension because we wrote the // code // bad match X509CertSelector selector = new X509CertSelector(); Set<String> s = new HashSet<>(); s.add(new String("1.2.5.7.68")); selector.setPolicy(s); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.32")); CertificatePoliciesExtension ext = new CertificatePoliciesExtension(false, in.getOctetString()); List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES); // match on the first policy id PolicyInformation policyInfo = (PolicyInformation) policies.get(0); s.clear(); s.add(policyInfo.getPolicyIdentifier().getIdentifier().toString()); selector.setPolicy(s); checkMatch(selector, cert, true); }
Example #4
Source File: X509CertSelectorTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void testPolicy() throws IOException { System.out.println("X.509 Certificate Match on certificatePolicies"); // test encoding of CertificatePoliciesExtension because we wrote the // code // bad match X509CertSelector selector = new X509CertSelector(); Set<String> s = new HashSet<>(); s.add(new String("1.2.5.7.68")); selector.setPolicy(s); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.32")); CertificatePoliciesExtension ext = new CertificatePoliciesExtension(false, in.getOctetString()); List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES); // match on the first policy id PolicyInformation policyInfo = (PolicyInformation) policies.get(0); s.clear(); s.add(policyInfo.getPolicyIdentifier().getIdentifier().toString()); selector.setPolicy(s); checkMatch(selector, cert, true); }
Example #5
Source File: X509CertSelectorTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void testPolicy() throws IOException { System.out.println("X.509 Certificate Match on certificatePolicies"); // test encoding of CertificatePoliciesExtension because we wrote the // code // bad match X509CertSelector selector = new X509CertSelector(); Set<String> s = new HashSet<>(); s.add(new String("1.2.5.7.68")); selector.setPolicy(s); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.32")); CertificatePoliciesExtension ext = new CertificatePoliciesExtension(false, in.getOctetString()); List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES); // match on the first policy id PolicyInformation policyInfo = (PolicyInformation) policies.get(0); s.clear(); s.add(policyInfo.getPolicyIdentifier().getIdentifier().toString()); selector.setPolicy(s); checkMatch(selector, cert, true); }
Example #6
Source File: X509CertSelectorTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void testPolicy() throws IOException { System.out.println("X.509 Certificate Match on certificatePolicies"); // test encoding of CertificatePoliciesExtension because we wrote the // code // bad match X509CertSelector selector = new X509CertSelector(); Set<String> s = new HashSet<>(); s.add(new String("1.2.5.7.68")); selector.setPolicy(s); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.32")); CertificatePoliciesExtension ext = new CertificatePoliciesExtension(false, in.getOctetString()); List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES); // match on the first policy id PolicyInformation policyInfo = (PolicyInformation) policies.get(0); s.clear(); s.add(policyInfo.getPolicyIdentifier().getIdentifier().toString()); selector.setPolicy(s); checkMatch(selector, cert, true); }
Example #7
Source File: X509CertSelectorTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void testPolicy() throws IOException { System.out.println("X.509 Certificate Match on certificatePolicies"); // test encoding of CertificatePoliciesExtension because we wrote the // code // bad match X509CertSelector selector = new X509CertSelector(); Set<String> s = new HashSet<>(); s.add(new String("1.2.5.7.68")); selector.setPolicy(s); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.32")); CertificatePoliciesExtension ext = new CertificatePoliciesExtension(false, in.getOctetString()); List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES); // match on the first policy id PolicyInformation policyInfo = (PolicyInformation) policies.get(0); s.clear(); s.add(policyInfo.getPolicyIdentifier().getIdentifier().toString()); selector.setPolicy(s); checkMatch(selector, cert, true); }
Example #8
Source File: PolicyChecker.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #9
Source File: PolicyChecker.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #10
Source File: PolicyChecker.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #11
Source File: PolicyChecker.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @return the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #12
Source File: PolicyChecker.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @return the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #13
Source File: PolicyChecker.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #14
Source File: PolicyChecker.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #15
Source File: PolicyChecker.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #16
Source File: PolicyChecker.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #17
Source File: PolicyChecker.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #18
Source File: PolicyChecker.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #19
Source File: PolicyChecker.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #20
Source File: PolicyChecker.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #21
Source File: PolicyChecker.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
Example #22
Source File: PolicyChecker.java From j2objc with Apache License 2.0 | 4 votes |
/** * Removes those nodes which do not intersect with the initial policies * specified by the user. * * @param rootNode the root node of the valid policy tree * @param certIndex the index of the certificate being processed * @param initPolicies the Set of policies required by the user * @param currCertPolicies the CertificatePoliciesExtension of the * certificate being processed * @returns the root node of the valid policy tree after modification * @exception CertPathValidatorException Exception thrown if error occurs. */ private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }