Package org.apache.cxf.xkms.model.xkms

Examples of org.apache.cxf.xkms.model.xkms.UseKeyWithType


    protected LocateRequestType prepareLocateXKMSRequest(List<X509AppId> ids) {
        QueryKeyBindingType queryKeyBindingType = XKMS_OF
            .createQueryKeyBindingType();

        for (X509AppId id : ids) {
            UseKeyWithType useKeyWithType = XKMS_OF.createUseKeyWithType();
            useKeyWithType.setIdentifier(id.getId());
            useKeyWithType.setApplication(id.getApplication().getUri());

            queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        }

        LocateRequestType locateRequestType = XKMS_OF.createLocateRequestType();
View Full Code Here


        Assert.assertTrue(certFile.exists());
        FileInputStream fis = new FileInputStream(certFile);
        CertificateFactory factory = CertificateFactory.getInstance("X.509");
        X509Certificate cert = (X509Certificate) factory.generateCertificate(fis);

        UseKeyWithType key = new UseKeyWithType();
        key.setApplication(Applications.PKIX.getUri());
        key.setIdentifier(EXPECTED_SUBJECT_DN);
        persistenceManager.saveCertificate(cert, key);
        testFindBySubjectDnInternal(persistenceManager);
    }
View Full Code Here

        EasyMock.expectLastCall().once();
        LdapCertificateRepo ldapCertRepo = new LdapCertificateRepo(ldapSearch, LDAP_CERT_CONFIG, ROOT_DN);
        X509Certificate cert = getTestCert();

        c.replay();
        UseKeyWithType key = new UseKeyWithType();
        key.setApplication(Applications.PKIX.getUri());
        key.setIdentifier(EXPECTED_SUBJECT_DN2);
        ldapCertRepo.saveCertificate(cert, key);
        c.verify();
    }
View Full Code Here

        EasyMock.expectLastCall().once();
        LdapCertificateRepo ldapCertRepo = new LdapCertificateRepo(ldapSearch, LDAP_CERT_CONFIG, ROOT_DN);
        X509Certificate cert = getTestCert();

        c.replay();
        UseKeyWithType key = new UseKeyWithType();
        key.setApplication(Applications.SERVICE_NAME.getUri());
        key.setIdentifier(EXPECTED_SERVICE_URI);
        ldapCertRepo.saveCertificate(cert, key);
        c.verify();
    }
View Full Code Here

    public void testLocatePKIX() throws URISyntaxException, Exception {
        LocateRequestType request = XKMS_OF.createLocateRequestType();
        setGenericRequestParams(request);
        QueryKeyBindingType queryKeyBindingType = XKMS_OF.createQueryKeyBindingType();

        UseKeyWithType useKeyWithType = XKMS_OF.createUseKeyWithType();
        useKeyWithType.setIdentifier("CN=Dave, OU=Apache, O=CXF, L=CGN, ST=NRW, C=DE");
        useKeyWithType.setApplication(Applications.PKIX.getUri());

        locateCertificate(request, queryKeyBindingType, useKeyWithType);
    }
View Full Code Here

    public void testLocateByEndpoint() throws URISyntaxException, Exception {
        LocateRequestType request = XKMS_OF.createLocateRequestType();
        setGenericRequestParams(request);
        QueryKeyBindingType queryKeyBindingType = XKMS_OF.createQueryKeyBindingType();

        UseKeyWithType useKeyWithType = XKMS_OF.createUseKeyWithType();
        useKeyWithType.setIdentifier("http://localhost:8080/services/TestService");
        useKeyWithType.setApplication(Applications.SERVICE_ENDPOINT.getUri());

        locateCertificate(request, queryKeyBindingType, useKeyWithType);
    }
View Full Code Here

        InputStream is = this.getClass().getResourceAsStream("/store1/" + EXPECTED_CERT_FILE_NAME);
        if (is == null) {
            throw new RuntimeException("Can not find path " + is + " in classpath");
        }
        X509Certificate cert = loadTestCert(is);
        UseKeyWithType key = new UseKeyWithType();
        key.setApplication(Applications.PKIX.getUri());
        key.setIdentifier(EXAMPLE_SUBJECT_DN);
        fileRegisterHandler.saveCertificate(cert, key);

        File certFile = new File(storageDir, EXPECTED_CERT_FILE_NAME);
        Assert.assertTrue("Cert file " + certFile + " should exist", certFile.exists());
        FileInputStream fis = new FileInputStream(certFile);
View Full Code Here

        List<Object> content = keyInfo.getContent();
        for (Object obj1 : content) {
            if (obj1 instanceof JAXBElement) {
                JAXBElement<?> keyInfoChild = (JAXBElement<?>) obj1;
                if (X509Utils.X509_KEY_NAME.equals(keyInfoChild.getName())) {
                    UseKeyWithType keyDN = new UseKeyWithType();
                    keyDN.setApplication(Applications.PKIX.getUri());
                    keyDN.setIdentifier((String) keyInfoChild.getValue());
                    keyIDs.add(keyDN);

                } else if (X509Utils.X509_DATA.equals(keyInfoChild.getName())) {
                    X509DataType x509Data = (X509DataType) keyInfoChild.getValue();
                    List<Object> x509DataContent = x509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName();

                    for (Object obj2 : x509DataContent) {
                        if (obj2 instanceof JAXBElement) {
                            JAXBElement<?> x509DataChild = (JAXBElement<?>) obj2;

                            if (X509Utils.X509_ISSUER_SERIAL.equals(x509DataChild.getName())) {
                                X509IssuerSerialType x509IssuerSerial = (X509IssuerSerialType) x509DataChild.getValue();

                                UseKeyWithType issuer = new UseKeyWithType();
                                issuer.setApplication(Applications.ISSUER.getUri());
                                issuer.setIdentifier(x509IssuerSerial.getX509IssuerName());
                                keyIDs.add(issuer);

                                UseKeyWithType serial = new UseKeyWithType();
                                serial.setApplication(Applications.SERIAL.getUri());
                                serial.setIdentifier(x509IssuerSerial.getX509SerialNumber().toString());
                                keyIDs.add(serial);

                            } else if (X509Utils.X509_SUBJECT_NAME.equals(x509DataChild.getName())) {
                                UseKeyWithType keyDN = new UseKeyWithType();
                                keyDN.setApplication(Applications.PKIX.getUri());
                                keyDN.setIdentifier((String) x509DataChild.getValue());
                                keyIDs.add(keyDN);
                            }
                        }
                    }
                }
View Full Code Here

            List<UseKeyWithType> useKeyWithList = binding.getUseKeyWith();
            if (useKeyWithList == null || useKeyWithList.size() != 1) {
                throw new IllegalArgumentException("Exactly one useKeyWith element is supported");
                //TODO standard requires support for multiple useKeyWith attributes
            }
            UseKeyWithType useKeyWith = useKeyWithList.get(0);
            List<X509Certificate> certList = getCertsFromKeyInfo(keyInfo);
            if (certList.size() != 1) {
                throw new IllegalArgumentException("Must provide one X509Certificate");
            }
            X509Certificate cert = certList.get(0);
View Full Code Here

    protected LocateRequestType prepareLocateXKMSRequest(List<X509AppId> ids) {
        QueryKeyBindingType queryKeyBindingType = XKMS_OF
            .createQueryKeyBindingType();

        for (X509AppId id : ids) {
            UseKeyWithType useKeyWithType = XKMS_OF.createUseKeyWithType();
            useKeyWithType.setIdentifier(id.getId());
            useKeyWithType.setApplication(id.getApplication().getUri());

            queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        }

        LocateRequestType locateRequestType = XKMS_OF.createLocateRequestType();
View Full Code Here

TOP

Related Classes of org.apache.cxf.xkms.model.xkms.UseKeyWithType

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.