Package org.apache.juddi.v3.client.cryptor

Examples of org.apache.juddi.v3.client.cryptor.DigSigUtil


        bt.setBindingKey(null);
        bt.setServiceKey(null);
        bt.setAccessPoint(new AccessPoint("http://localhost", "wsdl"));

        bs.getName().add(new Name("Joe's bs", null));
        DigSigUtil ds = GetDigSig();
        bt = ds.signUddiEntity(bt);
        bs.getBindingTemplates().getBindingTemplate().add(bt);
        be.setBusinessServices(new BusinessServices());
        be.getBusinessServices().getBusinessService().add(bs);

View Full Code Here


        bt.setBindingKey(null);
        bt.setServiceKey(TckBusinessService.JOE_SERVICE_KEY);
        bt.setAccessPoint(new AccessPoint("http://localhost", "wsdl"));

        bs.getName().add(new Name("Joe's bs", null));
        DigSigUtil ds = GetDigSig();
        bt = ds.signUddiEntity(bt);
        bs.getBindingTemplates().getBindingTemplate().add(bt);
        be.setBusinessServices(new BusinessServices());
        be.getBusinessServices().getBusinessService().add(bs);

View Full Code Here

        bt.setBindingKey(null);
        bt.setServiceKey(TckBusinessService.JOE_SERVICE_KEY);
        bt.setAccessPoint(new AccessPoint("http://localhost", "wsdl"));

        bs.getName().add(new Name("Joe's bs", null));
        DigSigUtil ds = GetDigSig();
        bt = ds.signUddiEntity(bt);
        bs.getBindingTemplates().getBindingTemplate().add(bt);

        try {
            SaveBinding sb1 = new SaveBinding();
            sb1.setAuthInfo(authInfoJoe);
View Full Code Here

        be.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY);
               
        Name n = new Name();
        n.setValue("JUDDI_716_SaveBusinessWithSignatureX509IssuerSerial");
        be.getName().add(n);
        DigSigUtil ds = GetDigSig();
        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
        be = ds.signUddiEntity(be);
        sb.getBusinessEntity().add(be);
        try {
            BusinessDetail saveBusiness = publication.saveBusiness(sb);
            GetBusinessDetail gsb=new GetBusinessDetail();
            gsb.setAuthInfo(authInfoJoe);
            gsb.getBusinessKey().add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
            BusinessDetail businessDetail = inquiry.getBusinessDetail(gsb);
            PrintUDDI<BusinessEntity> printer = new PrintUDDI<BusinessEntity>();
            System.out.println(printer.print(businessDetail.getBusinessEntity().get(0)));
            AtomicReference<String> msg = new AtomicReference<String>();
            boolean b=ds.verifySignedUddiEntity(businessDetail.getBusinessEntity().get(0), msg);
            Assert.assertTrue(msg.get(),b );
            Assert.assertTrue(msg.get()==null || msg.get().length()==0);

        } catch (Exception ex) {
            logger.error("unExpected failure: ", ex);
View Full Code Here

       }

       if (j != null) {
          try {
             //sign it
             org.apache.juddi.v3.client.cryptor.DigSigUtil ds = new DigSigUtil();
             if (isIncludePublicKey.isSelected()) {
                ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");
             }
             if (isIncludeSubjectName.isSelected()) {
                ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
             }
             if (isIncludeIssuer.isSelected()) {
                ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
             }
             ds.put(DigSigUtil.SIGNATURE_METHOD, jTextFieldSigMethod.getText());
             ds.put(DigSigUtil.SIGNATURE_OPTION_DIGEST_METHOD, jTextFieldDigestMethod.getText());
             ds.put(DigSigUtil.CANONICALIZATIONMETHOD, jTextFieldc14n.getText());

             char[] cp = jPasswordField1.getPassword();
             if (cp != null && cp.length <= 0) {
                cp = null;
             }
             if (cp != null) {
                String s = new String(cp);
                s = s.trim();
                if ("".equalsIgnoreCase(s)) {
                   cp = null;
                }
             }
             PrivateKey key = (PrivateKey) keyStore.getKey((String) jList1.getSelectedValue(), cp);
             Certificate publickey = keyStore.getCertificate((String) jList1.getSelectedValue());

             j = ds.signUddiEntity(j, publickey, key);
             ds.clear();
             StringWriter sw = new StringWriter();
             JAXB.marshal(j, sw);
             signedXml = sw.toString();
          } catch (Exception ex) {
             error = true;
View Full Code Here


        if (j != null) {
            try {
                //sign it
                org.apache.juddi.v3.client.cryptor.DigSigUtil ds = new DigSigUtil();
                ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");
                ds.put(DigSigUtil.SIGNATURE_METHOD, "RSA_SHA1");
                PrivateKey key = (PrivateKey) keyStore.getKey((String) jList1.getSelectedValue(), null);

                Certificate publickey = keyStore.getCertificate((String) jList1.getSelectedValue());


                j = ds.signUddiEntity(j, publickey, key);
                ds.clear();
                StringWriter sw = new StringWriter();
                JAXB.marshal(j, sw);
                signedXml = sw.toString();
            } catch (Exception ex) {
                Logger.getLogger(XmlSignatureApplet.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

                sp.Fire(null, null);
        }

        public void Fire(String token, String key) {
                try {
                        DigSigUtil ds = null;

                        //option 1), set everything manually
                        ds = new DigSigUtil();
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, "keystore.jks");
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "JKS");
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "Test");
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "Test");
                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");

                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
                        ds.put(DigSigUtil.TRUSTSTORE_FILE, "truststore.jks");
                        ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS");
                        ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test");

                        //option 2), load it from the juddi config file
                        //ds = new DigSigUtil(clerkManager.getClientConfig().getDigitalSignatureConfiguration());
                        //login
                        if (token == null) //option, load from juddi config
                        {
                                token = GetAuthKey(clerkManager.getClerk("default").getPublisher(),
                                        clerkManager.getClerk("default").getPassword());
                        }
                        if (key==null){
                                SaveTModel stm = new SaveTModel();
                                stm.setAuthInfo(token);
                                TModel tm = new TModel();
                                tm.setName(new Name("my cool signed tmodel", null));
                                stm.getTModel().add(tm);
                                TModelDetail saveTModel = publish.saveTModel(stm);
                                key = saveTModel.getTModel().get(0).getTModelKey();
                        }

                        TModel be = GetTmodelDetails(key);
                        if (!be.getSignature().isEmpty())
                        {
                                System.out.println("WARN, the entity with the key " + key + " is already signed! aborting");
                                return;
                        }
                       
                        //DigSigUtil.JAXB_ToStdOut(be);
                        System.out.println("signing");
                        TModel signUDDI_JAXBObject = ds.signUddiEntity(be);
                        DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
                        System.out.println("signed, saving");

                        SaveTModel sb = new SaveTModel();
                        sb.setAuthInfo(token);
                        sb.getTModel().add(signUDDI_JAXBObject);
                        publish.saveTModel(sb);
                        System.out.println("saved, fetching");

                        be = GetTmodelDetails(key);
                        DigSigUtil.JAXB_ToStdOut(be);
                        System.out.println("verifing");
                        AtomicReference<String> msg = new AtomicReference<String>();
                        boolean verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(be, msg);
                        if (verifySigned_UDDI_JAXB_Object) {
                                System.out.println("signature validation passed (expected)");
                        } else {
                                System.out.println("signature validation failed (not expected)");
                        }
View Full Code Here

        }

        public void Fire(String token, String key) {
                try {

                        DigSigUtil ds = null;

                        //option 1), set everything manually
                        ds = new DigSigUtil();
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, "keystore.jks");
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "JKS");
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "Test");
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "Test");
                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");

                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
                        ds.put(DigSigUtil.TRUSTSTORE_FILE, "truststore.jks");
                        ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS");
                        ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test");

                        //option 2), load it from the juddi config file
                        //ds = new DigSigUtil(clerkManager.getClientConfig().getDigitalSignatureConfiguration());
                        //login
                        if (token == null) //option, load from juddi config
                        {
                                token = GetAuthKey(clerkManager.getClerk("default").getPublisher(),
                                        clerkManager.getClerk("default").getPassword());
                        }

                        if (key == null) {
                                //make a new business
                                SaveBusiness sb = new SaveBusiness();
                                sb.setAuthInfo(token);
                                BusinessEntity ob = new BusinessEntity();
                                Name name = new Name();
                                name.setValue("My Signed Business");
                                ob.getName().add(name);
                                sb.getBusinessEntity().add(ob);
                                //save it
                                BusinessDetail saveBusiness = publish.saveBusiness(sb);

                                System.out.println("business created with key " + saveBusiness.getBusinessEntity().get(0).getBusinessKey());

                                BusinessEntity be = saveBusiness.getBusinessEntity().get(0);
                                key = be.getBusinessKey();
                        }
                        BusinessEntity be = clerkManager.getClerk("default").getBusinessDetail(key);
                        //sign the copy returned from the UDDI node (it may have made changes)
                        DigSigUtil.JAXB_ToStdOut(be);
                        if (!be.getSignature().isEmpty())
                        {
                                System.out.println("WARN, the entity with the key " + key + " is already signed! aborting");
                                return;
                        }

                        //if it's already signed, remove all existing signatures
                       
                        System.out.println("signing");
                        BusinessEntity signUDDI_JAXBObject = ds.signUddiEntity(be);
                        DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
                        System.out.println("signed, saving");

                        SaveBusiness sb = new SaveBusiness();
                        sb.setAuthInfo(token);
                        sb.getBusinessEntity().add(signUDDI_JAXBObject);
                        publish.saveBusiness(sb);
                        System.out.println("saved, fetching");

                        //validate it again from the server, confirming that it was transformed correctly
                        GetBusinessDetail gb = new GetBusinessDetail();
                        gb.setAuthInfo(token);
                        gb.getBusinessKey().add(be.getBusinessKey());
                        be = inquiry.getBusinessDetail(gb).getBusinessEntity().get(0);
                        DigSigUtil.JAXB_ToStdOut(be);
                        System.out.println("verifing");
                        AtomicReference<String> msg = new AtomicReference<String>();
                        boolean verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(be, msg);
                        if (verifySigned_UDDI_JAXB_Object) {
                                System.out.println("signature validation passed (expected)");
                        } else {
                                System.out.println("signature validation failed (not expected)");
                        }
View Full Code Here

        }

        public void Fire(String token, String key) {
                try {

                        DigSigUtil ds = null;

                        ds = new DigSigUtil();
                        //option 1), set everything manually
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, "keystore.jks");
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "JKS");
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "Test");
                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "Test");
                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");

                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
                        ds.put(DigSigUtil.TRUSTSTORE_FILE, "truststore.jks");
                        ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS");
                        ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test");


            //option 2), load it from the juddi config file
                        //ds = new DigSigUtil(clerkManager.getClientConfig().getDigitalSignatureConfiguration());
                        //login
                        if (token == null) //option, load from juddi config
                        {
                                token = GetAuthKey(clerkManager.getClerk("default").getPublisher(),
                                        clerkManager.getClerk("default").getPassword());
                        }

                        if (key == null) {
                                SaveBusiness sb = new SaveBusiness();
                                sb.setAuthInfo(token);
                                BusinessEntity ob = new BusinessEntity();
                                Name name = new Name();
                                name.setValue("My Signed Business");
                                ob.getName().add(name);
                                ob.setBusinessServices(new BusinessServices());
                                BusinessService bs = new BusinessService();
                                bs.getName().add(new Name("My signed service", null));
                                ob.getBusinessServices().getBusinessService().add(bs);
                                sb.getBusinessEntity().add(ob);
                                //save it
                                BusinessDetail saveBusiness = publish.saveBusiness(sb);

                                System.out.println("business created with key " + saveBusiness.getBusinessEntity().get(0).getBusinessKey());

                                key = saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getServiceKey();
                        }

                        BusinessService be = null;
                        be = GetServiceDetails(key);
                        if (!be.getSignature().isEmpty())
                        {
                                System.out.println("WARN, the entity with the key " + key + " is already signed! aborting");
                                return;
                        }
                       
                        //DigSigUtil.JAXB_ToStdOut(be);
                        System.out.println("signing");
                        BusinessService signUDDI_JAXBObject = ds.signUddiEntity(be);
                        DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
                        System.out.println("signed, saving");

                        SaveService sb = new SaveService();
                        sb.setAuthInfo(token);
                        sb.getBusinessService().add(signUDDI_JAXBObject);
                        publish.saveService(sb);
                        System.out.println("saved, fetching");

                        be = GetServiceDetails(key);
                        DigSigUtil.JAXB_ToStdOut(be);
                        System.out.println("verifing");
                        AtomicReference<String> msg = new AtomicReference<String>();
                        boolean verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(be, msg);
                        if (verifySigned_UDDI_JAXB_Object) {
                                System.out.println("signature validation passed (expected)");
                        } else {
                                System.out.println("signature validation failed (not expected)");
                        }
View Full Code Here

        registrationInfo.setPortName(portName);
        registrationInfo.setServiceUrl(serviceUrl);
        registrationInfo.setWsdlUrl(wsdlURL);
        registrationInfo.setWsdlDefinition(wsdlDefinition);
        registrationInfo.setRegistrationType(RegistrationType.BPEL);
        registration = new AsyncRegistration(bpelClerk, urlLocalizer, properties, registrationInfo);
        Thread thread = new Thread(registration);
        thread.start();
      } catch (Exception e) {
        log.error("Unable to register service " + serviceQName
            + " ." + e.getMessage(),e);
View Full Code Here

TOP

Related Classes of org.apache.juddi.v3.client.cryptor.DigSigUtil

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.