Package org.apache.harmony.security.x509.tsp

Examples of org.apache.harmony.security.x509.tsp.PKIStatusInfo


    public void testGetSubjectAlternativeNames() {
        try {
            GeneralName san1 = new GeneralName(1, "rfc@822.Name");
            GeneralName san2 = new GeneralName(2, "dNSName");

            GeneralNames sans = new GeneralNames();
            sans.addName(san1);
            sans.addName(san2);

            TestCert cert_1 = new TestCert(sans);
            X509CertSelector selector = new X509CertSelector();

            assertNull("Selector should return null",
                                        selector.getSubjectAlternativeNames());

            selector.setSubjectAlternativeNames(sans.getPairsList());
            assertTrue("The certificate should match the selection criteria.",
                                                        selector.match(cert_1));
            selector.getSubjectAlternativeNames().clear();
            assertTrue("The modification of initialization object "
                        + "should not affect the modification "
View Full Code Here


    public void testSetMatchAllSubjectAltNames() {
        try {
            GeneralName san1 = new GeneralName(1, "rfc@822.Name");
            GeneralName san2 = new GeneralName(2, "dNSName");

            GeneralNames sans_1 = new GeneralNames();
            sans_1.addName(san1);
            GeneralNames sans_2 = new GeneralNames();
            sans_2.addName(san1);
            sans_2.addName(san2);

            TestCert cert = new TestCert(sans_1);
            X509CertSelector selector = new X509CertSelector();
            selector.setMatchAllSubjectAltNames(true);

            selector.setSubjectAlternativeNames(sans_2.getPairsList());
            assertFalse("Only certificate which contain all of the specified "
                       + "subject alternative names should match.",
                                                        selector.match(cert));
            selector.setMatchAllSubjectAltNames(false);
            /*
 
View Full Code Here

                subtrees.addSubtree(subtree);
                // start the checking for each alt. name corresponding
                // to current name_constraints[i]
                boolean check_matching = true;
                for (int j=0; j<alternative_names[i].length; j++) {
                    GeneralNames alt_names_extension = new GeneralNames();
                    if (alternative_names[i][j] == null) {
                        // double trick: turn the switch and check that the
                        // restrictions apply only when the specified name
                        // form is presented.  If no name of the type is in the
                        // certificate, the certificate is acceptable.
                        check_matching = false;
                    } else {
                        alt_names_extension.addName(alternative_names[i][j]);
                    }
                    TestCert certificate = new TestCert(alt_names_extension);
                    certificate.setSubject(x500Subject);
                    certificate.setEncoding(getCertEncoding(nameSubject,
                                                     alt_names_extension));
View Full Code Here

                subtrees.addSubtree(subtree);
                // start the checking for each alt. name corresponding
                // to current name_constraints[i]
                boolean check_matching = true;
                for (int j=0; j<alternative_names[i].length; j++) {
                    GeneralNames alt_names_extension = new GeneralNames();
                    if (alternative_names[i][j] == null) {
                        // double trick: turn the switch and check that the
                        // restrictions apply only when the specified name
                        // form is presented.  If no name of the type is in the
                        // certificate, the certificate is acceptable.
                        check_matching = false;
                    } else {
                        alt_names_extension.addName(alternative_names[i][j]);
                    }
                    TestCert certificate = new TestCert(alt_names_extension);
                    certificate.setSubject(x500Subject);
                    certificate.setEncoding(getCertEncoding(nameSubject,
                                                     alt_names_extension));
View Full Code Here

                new GeneralName(new EDIPartyName("assigner", "party"));
            GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
            GeneralName san7 = new GeneralName(7, "1.1.1.1");
            GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");

            GeneralNames sans_1 = new GeneralNames();
            sans_1.addName(san0);
            sans_1.addName(san1);
            sans_1.addName(san2);
            sans_1.addName(san3);
            sans_1.addName(san4);
            sans_1.addName(san5);
            sans_1.addName(san6);
            sans_1.addName(san7);
            sans_1.addName(san8);

            byte[] encoding =  GeneralNames.ASN1.encode(sans_1);
            GeneralNames.ASN1.decode(encoding);
        } catch (Exception e) {
            // should not be thrown:
View Full Code Here

                printAsHex(16, "", " ", _encoded);
                System.out.println("");
                pass = false;
            }

            GeneralNames gNames = new GeneralNames();
            gNames.addName(gName);
            encoded = gNames.getEncoded();
            // manually derived data:
            _encoded = new byte[] {
                (byte) 0x30, (byte) 0x1f, (byte) 0xa5, (byte) 0x1d,
                (byte) 0x80, (byte) 0x0e, (byte) 0x13, (byte) 0x0c,
                (byte) 0x6e, (byte) 0x61, (byte) 0x6d, (byte) 0x65,
View Full Code Here

            GeneralName gName = new GeneralName(ora);
            System.out.println("GeneralName:");
            printAsHex(8, "", " ", gName.getEncoded());
            System.out.println("");

            GeneralNames gNames = new GeneralNames();
            gNames.addName(gName);
            System.out.println("GeneralNames:");
            printAsHex(8, "", " ", gNames.getEncoded());
            System.out.println("");

        } catch (Exception e) {
            e.printStackTrace();
            fail("Exception was thrown.");
View Full Code Here

        try {
            Name nameSubject = new Name(subject);
            for (int i=0; i<name_constraints.length; i++) {
                // make the subtrees (part of name constraints)
                // this subtrees will be used as permited and as excluded
                GeneralSubtree subtree =
                    new GeneralSubtree(name_constraints[i]);
                GeneralSubtrees subtrees = new GeneralSubtrees();
                NameConstraints constraints;
                subtrees.addSubtree(subtree);
                // start the checking for each alt. name corresponding
                // to current name_constraints[i]
View Full Code Here

        try {
            Name nameSubject = new Name(subject);
            for (int i=0; i<name_constraints.length; i++) {
                // make the subtrees (part of name constraints)
                // this subtrees will be used as permited and as excluded
                GeneralSubtree subtree =
                    new GeneralSubtree(name_constraints[i]);
                GeneralSubtrees subtrees = new GeneralSubtrees();
                NameConstraints constraints;
                subtrees.addSubtree(subtree);
                // start the checking for each alt. name corresponding
                // to current name_constraints[i]
View Full Code Here

                // make the subtrees (part of name constraints)
                // this subtrees will be used as permited and as excluded
                // name which is presented in certificate:
                GeneralSubtrees pos_subtrees = new GeneralSubtrees();
                pos_subtrees.addSubtree(
                        new GeneralSubtree(
                            new GeneralName(4, variants[i][2])));
                // name which is absent in certificate:
                GeneralSubtrees neg_subtrees = new GeneralSubtrees();
                neg_subtrees.addSubtree(
                        new GeneralSubtree(
                            new GeneralName(4, variants[i][3])));

                NameConstraints constraints;
                // Work with name which is presented in certificate
                // first check if certificate with permited name matches:
View Full Code Here

TOP

Related Classes of org.apache.harmony.security.x509.tsp.PKIStatusInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.