Examples of LocateRequestType


Examples of org.w3._2002._03.xkms_.LocateRequestType

    }

    public void test06LocateAndKeyUsage() throws Exception {
        // request with Signature and expect signature
        LocateRequestType locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("139");
        QueryKeyBindingType queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");

        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_SIGNATURE);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        LocateResultType locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertEquals("Wrong number of UnverifiedKeyBinding.", 1, locateResultType.getUnverifiedKeyBinding().size());
        List<UnverifiedKeyBindingType> numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        Iterator<UnverifiedKeyBindingType> iter = numberOfUnverifiedKeyBindings.iterator();
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            assertTrue(nextKeyBinding.getKeyUsage().size() == 1);
            assertTrue(nextKeyBinding.getKeyUsage().contains(XKMSConstants.KEYUSAGE_SIGNATURE));
        }

        // request with Signature and receive noMatch
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("140");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_PKIX);
        useKeyWithType.setIdentifier(dn1);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_SIGNATURE);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        /*
         * <?xml version="1.0" ?> <S:Envelope xmlns:S =
         * "http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <LocateResult
         * xmlns = "http://www.w3.org/2002/03/xkms#" xmlns:ds =
         * "http://www.w3.org/2000/09/xmldsig#" xmlns:xenc =
         * "http://www.w3.org/2001/04/xmlenc#" Id = "_1669649196518103469"
         * RequestId = "140" ResultMajor =
         * "http://www.w3.org/2002/03/xkms#Success" Service =
         * "http://localhost:8080/ejbca/xkms/xkms"> <UnverifiedKeyBinding Id =
         * "_77cca72c8e066b19"> <ds:KeyInfo> <ds:X509Data>
         * <ds:X509Certificate>MIIDFzCCAf+
         * gAwIBAgIId8ynLI4GaxkwDQYJKoZIhvcNAQELBQAwNzERMA8GA1UEAwwIQWRtaW5DQTExFTATBgNVBAoMDEVKQkNBIFNhbXBsZTELMAkGA1UEBhMCU0UwHhcNMDkwMjA5MDYyNjMyWhcNMTEwMjA5MDYyNjMyWjA7MRswGQYDVQQDDBJ4a21zdGVzdHVzZXItOTAyLTExDzANBgNVBAoMBkFuYVRvbTELMAkGA1UEBhMCU0UwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJJBZdwEN7RCY
         * +46ZnxzrjXOm+h6k/
         * WF6jbt8O5V7YbVr2wL657ivKWBQr8WEEtOheQ9DFFbXq80Adryf8YSRDz4DL5008Fn/
         * LRC5jqCspT6aEhhvSvcvmBEO8YJhR2YhVUHB84p3RD9RvPPRzDsTLXGWScbbjCu1NzdnXX7AGNTAgMBAAGjgaYwgaMwHQYDVR0OBBYEFPYgaKLUO
         * /X7ZC+6Mn3uFzRmTcVwMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUwaEcbxN+
         * sSfiQreKUuLPjNpzi24wDgYDVR0PAQH/
         * BAQDAgXgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAbgRl4a21zdGVzdHVzZXItOTAyLTFAZm9vLnNlMA0GCSqGSIb3DQEBCwUAA4IBAQAcFUxvDxDcNpkvzp2bdntR9HnaljqlUwPWVQROSr5r0h7iS0
         * /ZJ/
         * kFKLuSdBSoVU1nbuOrtlhNC1zdfE6e86IHbFDK8dk6zJRpYRdsoZcmz9k0F9dX9AmILj9aXS3kiSzyF8L0m02siZZF9dMbpXCgFZCQRGFWLxcNAf6BZTS6c92W7
         * +
         * bPS67vVcGujideTiO8Ud0fU1tyu9BtsqpFItnS9N34sm19MC8pLAzaJjoCNmSXcUl0bswe4d3TkzWKlEjfQeNrRwNP1dI8HJEE7Ddr1j8eE8sW9E
         * /
         * IXQP4QINzF7P6psdtqMlevqx7JFUR6Px73Yn2ASJueScyB9l03Ikj</ds:X509Certificate
         * > </ds:X509Data> </ds:KeyInfo>
         * <KeyUsage>http://www.w3.org/2002/03/xkms#Exchange</KeyUsage>
         * <KeyUsage>http://www.w3.org/2002/03/xkms#Signature</KeyUsage>
         * <UseKeyWith Application = "urn:ietf:rfc:2459" Identifier =
         * "C=SE, O=AnaTom, CN=xkmstestuser-902-1"></UseKeyWith>
         * <ValidityInterval NotBefore = "2009-02-09T15:26:32.000+09:00"
         * NotOnOrAfter = "2011-02-09T15:26:32.000+09:00"></ValidityInterval>
         * </UnverifiedKeyBinding> </LocateResult> </S:Body> </S:Envelope>
         */
        // modified by dai 20090209
        // according to the result xml above, there is no resultminor if the
        // resut is success.
        // so assert for resultminor should not be done if succeed case.
        assertTrue(locateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        // assertTrue(locateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOMATCH));

        // request Exchange or Signature and receive Signature expect Nomatch
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("141");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");

        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_SIGNATURE);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_EXCHANGE);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        assertTrue(locateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOMATCH));

        // request Exchange and that response can be used for both exchange and
        // encryption.
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("142");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_PKIX);
        useKeyWithType.setIdentifier(dn3);

        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_ENCRYPTION);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_EXCHANGE);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        assertEquals("locateResultType.getUnverifiedKeyBinding: ", 1, locateResultType.getUnverifiedKeyBinding().size());
        numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
View Full Code Here

Examples of org.w3._2002._03.xkms_.LocateRequestType

    }

    public void test07LocateAndResponseLimit() throws Exception {
        // request with 3 and expect 3
        LocateRequestType locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("300");
        QueryKeyBindingType queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSHTTP);
        useKeyWithType.setIdentifier(baseUsername);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        locateRequestType.setResponseLimit(new BigInteger("3"));

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        LocateResultType locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertEquals("Wrong number of UnverifiedKeyBinding.", 3, locateResultType.getUnverifiedKeyBinding().size());

        // request with 2 and expect 2
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("301");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSHTTP);
        useKeyWithType.setIdentifier(baseUsername);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        locateRequestType.setResponseLimit(new BigInteger("2"));

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        assertTrue(locateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_TOOMANYRESPONSES));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.