Examples of GlobusCredential


Examples of org.globus.gsi.GlobusCredential

        return "irods://" + irodsAccount.getHost() + ":" + irodsAccount.getPort();
    }

    public static void main(String[] args) throws FileSystemException, GlobusCredentialException, GSSException
    {
        GlobusCredential gCert = GlobusCredential.getDefaultCredential();

        System.out.println("id: " + gCert.getIdentity());
        System.out.println("getting default credentials");

        GSSCredential cert = new GlobusGSSCredentialImpl(gCert, GSSCredential.INITIATE_AND_ACCEPT);
        //SRBAccount srbAccount = new SRBAccount("srbdev.sf.utas.edu.au",
        //                    5544,
View Full Code Here

Examples of org.globus.gsi.GlobusCredential

            final String msg = "Configured CA key path ('" +
                               caPrivPemPath + "') can not be read.";
            throw new Exception(msg);
        }

        final GlobusCredential caGlobusCred =
                new GlobusCredential(caPubPemPath, caPrivPemPath);

        final X509Certificate caCert = caGlobusCred.getIdentityCertificate();
        final PrivateKey caPrivateKey = caGlobusCred.getPrivateKey();

        final EzPzCA ca = new EzPzCA(caCert, caPrivateKey,
                                     caGlobusCred.getIdentity());

        final KeyPair keyPair = ca.createNewKeyPair();

        final Calendar expires = Calendar.getInstance();
        expires.add(Calendar.MONTH, VALIDITY_MONTHS);
View Full Code Here

Examples of org.globus.gsi.GlobusCredential

            final String msg = "Configured CA key path ('" +
                               caPrivPemPath + "') can not be read.";
            throw new Exception(msg);
        }

        final GlobusCredential caGlobusCred =
                new GlobusCredential(caPubPemPath, caPrivPemPath);

        final X509Certificate caCert = caGlobusCred.getIdentityCertificate();
        final PrivateKey caPrivateKey = caGlobusCred.getPrivateKey();

        final EzPzCA ca = new EzPzCA(caCert, caPrivateKey,
                                     caGlobusCred.getIdentity());

        final X509CRL crl = ca.generateCRL();
       
        final String crlPEM = CertWriter.crlToPEMString(Base64.encode(crl.getEncoded()));
        final OutputStreamWriter crlFile = new FileWriter(targetPath);
View Full Code Here

Examples of org.globus.gsi.GlobusCredential

     * @throws org.ietf.jgss.GSSException problem loading the desired certificate
     */
    public static GSSCredential getGSSCredential()
            throws GlobusCredentialException, GSSException {

        final GlobusCredential credential = getGlobusCredential();
        if (credential == null) {
            return null;
        }
        return new GlobusGSSCredentialImpl(credential, GSSCredential.INITIATE_ONLY);
    }
View Full Code Here

Examples of org.globus.gsi.GlobusCredential

        }
        final String userkeyPath = getNimbusUnencryptedKeyPath();
        if (userkeyPath == null) {
            return null;
        }
        return new GlobusCredential(usercertPath, userkeyPath);
    }
View Full Code Here

Examples of org.globus.gsi.GlobusCredential

                               this.caKeyPath + "') can not be read.";
            logger.error(msg); // hard to see amidst JNDI problem
            throw new ContextBrokerException(msg);
        }

        final GlobusCredential caGlobusCred =
                new GlobusCredential(this.caCertPath, this.caKeyPath);

        logger.debug("read in CA credential: '" +
                                caGlobusCred.getIdentity() + "'");

        final X509Certificate caCert = caGlobusCred.getIdentityCertificate();
        final PrivateKey caPrivateKey = caGlobusCred.getPrivateKey();
       
        this.ca = new CertificateAuthority(caCert,
                                           caPrivateKey,
                                           caGlobusCred.getIdentity());

        // make a test certificate, to see if all is well rather than waiting
        // for a deployment to fail
        if (this.testBootstrapGeneration) {
            this.testBootstrapGeneration();
View Full Code Here

Examples of org.globus.gsi.GlobusCredential

            }
            String files = "  - " + Props.KEY_NIMBUS_CERT + ": " + certPath + '\n';
            files += "  - " + Props.KEY_NIMBUS_KEY + ": " + keyPath + '\n';
            print.debugln(files);

            final GlobusCredential credential = NimbusCredential.getGlobusCredential();
            if (credential != null) {
                print.debugln("Using Nimbus credential from properties:");
                print.debugln("    - " + NimbusCredential.getNimbusCertificatePath());
                print.debugln("    - " + NimbusCredential.getNimbusUnencryptedKeyPath());
                print.debugln();
                return credential;
            }
            String err = "Could not load credential from properties, properties are " +
                    "probably not set.\n";
            print.debugln(err);
            err += files;
            if(!error_ok) {
                throw new Exception(err);
            }
            accumulatedErrors.append(err);
        } catch (Exception e) {
            final String err = "Problem loading credential from properties:\n    " +
                    CommonUtil.recurseForSomeString(e);
            accumulatedErrors.append(err).append('\n');
            print.debugln(err);

            if(!error_ok) {
                throw e;
            }
        }

        try {
            print.debugln("Attempting to load the default X509 proxy file");
            final GlobusCredential credential = GlobusCredential.getDefaultCredential();
            print.debugln("Using default X509 proxy:");
            proxyInformation(credential, print);
            return credential;
        } catch (Exception e) {
            final String err = "Problem loading default proxy credential:" +
                    "\n    " + CommonUtil.recurseForSomeString(e);
            accumulatedErrors.append(err).append('\n');
            print.debugln(err);
        }

        final String dotNimbus = expandTilde("~/.nimbus/");
        try {
            print.debugln("\nLooking for unencrypted credential in ~/.nimbus");
            final File usercert = guessCertFromDirectory(dotNimbus);
            final File userkey = guessKeyFromDirectory(dotNimbus);
            final GlobusCredential credential =
                    getUnencryptedUsercert(usercert, userkey, print);
            NimbusCredential.setUnencryptedCredential(usercert.getAbsolutePath(),
                                                       userkey.getAbsolutePath());
            print.debugln("Using unencrypted ~/.nimbus credential\n");
            return credential;
        } catch (Exception e) {
            final String err = "Problem loading from ~/.nimbus:\n    " +
                    CommonUtil.recurseForSomeString(e);
            accumulatedErrors.append(err).append('\n');
            print.debugln(err);
        }

        final String dotGlobus = expandTilde("~/.globus/");
        try {
            print.debugln("\nLooking for unencrypted credential in ~/.globus");
            final File usercert = guessCertFromDirectory(dotGlobus);
            final File userkey = guessKeyFromDirectory(dotGlobus);
            final GlobusCredential credential =
                    getUnencryptedUsercert(usercert, userkey, print);
            NimbusCredential.setUnencryptedCredential(usercert.getAbsolutePath(),
                                                       userkey.getAbsolutePath());
            print.debugln("Using unencrypted ~/.globus credential\n");
            return credential;
View Full Code Here

Examples of org.globus.gsi.GlobusCredential

            final String err = "Does not exist: " + usercertPath;
            print.debugln(err);
            throw new Exception(err);
        }

        final GlobusCredential credential;
        try {
            credential = new GlobusCredential(usercertPath, userkeyPath);
        } catch (Exception e) {
            final String err = "Problem loading " + usercertPath + ":\n    " +
                                    CommonUtil.recurseForSomeString(e);
            print.debugln(err);
            throw new Exception(err);
View Full Code Here

Examples of org.globus.gsi.GlobusCredential

        }
    }

    private void delegate() throws Exception {

        final GlobusCredential credential =
                GlobusCredential.getDefaultCredential();

        final ClientSecurityDescriptor csd =
                WSUtils.getClientSecDesc(this.d.delegationSecMechanism,
                                         this.d.delegationProtection,
                                         this.d.delegationAuthorization);

        final EndpointReferenceType delegEpr = AddressingUtils.
                  createEndpointReference(this.d.delegationFactoryUrl, null);

        final X509Certificate[] certsToDelegateOn =
                DelegationUtil.getCertificateChainRP(delegEpr, csd);

        final X509Certificate certToSign = certsToDelegateOn[0];

        if (this.pr.enabled()) {
            final String msg = "Delegating for staging credential(s).";
            if (this.pr.useThis()) {
                this.pr.infoln(PrCodes.DELEGATE__ALLMESSAGES,
                               msg);
            } else if (this.pr.useLogging()) {
                logger.info(msg);
            }
        }

        if (this.pr.enabled()) {
            final StringBuffer buf = new StringBuffer(512);

            buf.append("\nAbout to call delegation.\n  - Client credential: ")
               .append(credential.getIdentity())
               .append("\n  - Factory URL: ")
               .append(this.d.delegationFactoryUrl)
               .append("\n  - Security mechanism: ")
               .append(this.d.delegationSecMechanism)
               .append("\n  - Protection mechanism: ")
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.