Examples of PureTLSContext


Examples of org.globus.gsi.ptls.PureTLSContext

        try {
            X509Certificate[] trustedCerts = getTrustedCertificates();

            // Use the class from globus to set trustedCertificates as an
            // argument.
            PureTLSContext sslContext = new PureTLSContext();
            sslContext.setTrustedCertificates(trustedCerts);

            // Load anonymous certificate to access resource catalog.
            // This is a temporary solution
            InputStream anonymousCertificateStream = XBayaSecurity.class
                    .getResourceAsStream(ANONYMOUS_CERTIFICATE);
            if (anonymousCertificateStream == null) {
                throw new XBayaRuntimeException("Failed to get InputStream to "
                        + ANONYMOUS_CERTIFICATE);
            }

            sslContext.loadEAYKeyFile(anonymousCertificateStream, "");

            // Copied from PuretlsInvoker
            SSLPolicyInt policy = new SSLPolicyInt();
            policy.negotiateTLS(true);
            policy.waitOnClose(true);
            sslContext.setPolicy(policy);

            PuretlsInvoker invoker = new PuretlsInvoker(sslContext);
            WSIFProviderManager.getInstance().addProvider(
                    new xsul.wsif_xsul_soap_gsi.Provider(invoker));
            WsdlResolver.getInstance().setSecureInvoker(invoker);
View Full Code Here

Examples of org.globus.gsi.ptls.PureTLSContext

        String certFile = globalConfiguration.getTrustedCertsFile();
        String keyfile = globalConfiguration.getHostcertsKeyFile();

        SoapHttpDynamicInfosetInvoker invoker;
        if(useHostKey && globalConfiguration.getTrustedCertificates() != null && keyfile != null){
            PureTLSContext ctx = new PureTLSContext();
            ctx.setTrustedCertificates(globalConfiguration.getTrustedCertificates());
            ctx.loadEAYKeyFile(keyfile, "");
            SSLPolicyInt policy = new SSLPolicyInt();
            policy.requireClientAuth(true);
            policy.setAcceptNoClientCert(true);
            ctx.setPolicy(policy);
            invoker = new PuretlsInvoker(ctx);
        }else if(useHostKey && certFile != null && keyfile != null && new File(certFile).isFile()){
            invoker = new PuretlsInvoker(keyfile, "", certFile);
        }else {
            X509Certificate[] certs = globalConfiguration.getTrustedCertificates();
View Full Code Here

Examples of org.globus.gsi.ptls.PureTLSContext

    private XService cmsvc;

    public XregistryServer(GlobalContext globalContext) throws XregistryException {
        try {
            int port = globalContext.getPort();
            PureTLSContext ctx = null;
            String trustedCertsFile = globalContext.getTrustedCertsFile();
            String certKeyFile = globalContext.getHostcertsKeyFile();
           
            //try to load host certificate
            if(globalContext.isSecurityEnabled()){
                if(certKeyFile != null){
                    ctx = new PureTLSContext();
                    if(globalContext.getTrustedCertificates() != null){
                        ctx.setTrustedCertificates(globalContext.getTrustedCertificates());
                    }else if(trustedCertsFile != null && new File(trustedCertsFile).isFile()){
                        ctx.loadRootCertificates(trustedCertsFile);   
                    }else if(trustedCertsFile != null && new File(trustedCertsFile).isDirectory()){
                      TrustedCertificates certificates = TrustedCertificates.load(trustedCertsFile);
                    TrustedCertificates.setDefaultTrustedCertificates(certificates);
                      ctx.setTrustedCertificates(certificates.getCertificates());   
                    }
                    else{
                        TrustedCertificates tc = TrustedCertificates.getDefaultTrustedCertificates();
                        ctx.setTrustedCertificates(tc.getCertificates());
                    }
                    ctx.loadEAYKeyFile(certKeyFile, "");
                    SSLPolicyInt policy = new SSLPolicyInt();
                    policy.requireClientAuth(true);
                    policy.setAcceptNoClientCert(true);
                    ctx.setPolicy(policy);
                }else{
                    //Use Globous crednatials if it is there
                    try {
                        ctx = new PureTLSContext();
                        GSSCredential gssCredntial = globalContext.getCredential();
                        if(gssCredntial instanceof GlobusGSSCredentialImpl){
                            GlobusCredential globusCred = ((GlobusGSSCredentialImpl)gssCredntial).getGlobusCredential();
                            TrustedCertificates tc = TrustedCertificates.getDefaultTrustedCertificates();
                            if (tc == null)
                            {
                                throw new XregistryException("Trusted certificates is null");
                            }
                            X509Certificate[] certs = tc.getCertificates();
                            ctx.setTrustedCertificates(certs);
                            ctx.setCredential(globusCred);
                        }else{
                            throw new XregistryException("Can not find the credantial to start a secure server");
                        }
                    } catch (RuntimeException e) {
                        throw new XregistryException("Secuirty is enabled, but no credentials found");
View Full Code Here

Examples of org.globus.gsi.ptls.PureTLSContext

      FileNotFoundException, IOException{
    try {
      if (hostkeyPath == null || hostkeyPath == "") {
        throw new XRegistryClientException("The host key file path is null or empty");
      }
      PureTLSContext ctx = new PureTLSContext();
      ctx.setTrustedCertificates(trustedCerts);
      ctx.loadEAYKeyFile(hostkeyPath, "");
      SSLPolicyInt policy = new SSLPolicyInt();
      policy.requireClientAuth(true);
      policy.setAcceptNoClientCert(true);
      ctx.setPolicy(policy);
      SoapHttpDynamicInfosetInvoker invoker = new PuretlsInvoker(ctx);
      String wsdlAsStr = invoker.invokeHttpGet(xregistryServiceWsdlUrl);
      XmlElement el = XmlConstants.BUILDER.parseFragmentFromReader(new StringReader(wsdlAsStr));
      WsdlDefinitions def = new WsdlDefinitions(el);
View Full Code Here

Examples of org.globus.gsi.ptls.PureTLSContext

        try {
            X509Certificate[] trustedCerts = getTrustedCertificates();

            // Use the class from globus to set trustedCertificates as an
            // argument.
            PureTLSContext sslContext = new PureTLSContext();
            sslContext.setTrustedCertificates(trustedCerts);

            // Load anonymous certificate to access resource catalog.
            // This is a temporary solution
            InputStream anonymousCertificateStream = XBayaSecurity.class.getResourceAsStream(ANONYMOUS_CERTIFICATE);
            if (anonymousCertificateStream == null) {
                throw new WorkflowRuntimeException("Failed to get InputStream to " + ANONYMOUS_CERTIFICATE);
            }

            sslContext.loadEAYKeyFile(anonymousCertificateStream, "");

            // Copied from PuretlsInvoker
            SSLPolicyInt policy = new SSLPolicyInt();
            policy.negotiateTLS(true);
            policy.waitOnClose(true);
            sslContext.setPolicy(policy);

            PuretlsInvoker invoker = new PuretlsInvoker(sslContext);
            WSIFProviderManager.getInstance().addProvider(new xsul.wsif_xsul_soap_gsi.Provider(invoker));
            WsdlResolver.getInstance().setSecureInvoker(invoker);
View Full Code Here

Examples of org.globus.gsi.ptls.PureTLSContext

        try {
            X509Certificate[] trustedCerts = getTrustedCertificates();

            // Use the class from globus to set trustedCertificates as an
            // argument.
            PureTLSContext sslContext = new PureTLSContext();
            sslContext.setTrustedCertificates(trustedCerts);

            // Load anonymous certificate to access resource catalog.
            // This is a temporary solution
            InputStream anonymousCertificateStream = XBayaSecurity.class.getResourceAsStream(ANONYMOUS_CERTIFICATE);
            if (anonymousCertificateStream == null) {
                throw new XBayaRuntimeException("Failed to get InputStream to " + ANONYMOUS_CERTIFICATE);
            }

            sslContext.loadEAYKeyFile(anonymousCertificateStream, "");

            // Copied from PuretlsInvoker
            SSLPolicyInt policy = new SSLPolicyInt();
            policy.negotiateTLS(true);
            policy.waitOnClose(true);
            sslContext.setPolicy(policy);

            PuretlsInvoker invoker = new PuretlsInvoker(sslContext);
            WSIFProviderManager.getInstance().addProvider(new xsul.wsif_xsul_soap_gsi.Provider(invoker));
            WsdlResolver.getInstance().setSecureInvoker(invoker);
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.