当前位置: 首页>>代码示例>>Java>>正文


Java CertUtil.init方法代码示例

本文整理汇总了Java中org.globus.gsi.CertUtil.init方法的典型用法代码示例。如果您正苦于以下问题:Java CertUtil.init方法的具体用法?Java CertUtil.init怎么用?Java CertUtil.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.globus.gsi.CertUtil的用法示例。


在下文中一共展示了CertUtil.init方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doInfo

import org.globus.gsi.CertUtil; //导入方法依赖的package包/类
private void doInfo() {
      int credLifetime = credLifetimeNumDays * 24 * 3600;
CertUtil.init();
boolean bInfOk = false;
MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT);
if( credential == null && keyPassword.length() > 0){
	credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH);
}
	CredentialInfo inf = null;
	try {
		inf = myProxy.info(credential, username, myproxyPassword);
		bInfOk = true;
	}
	catch(MyProxyException e){
		appendExceptionDetailsToStatus(e);
	}
	if( bInfOk ){
		appendToStatus(getLocString("msg006") + hostname + " " + inf.getOwner() );
	}
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:21,代码来源:MyProxyApplet.java

示例2: doDestroy

import org.globus.gsi.CertUtil; //导入方法依赖的package包/类
private void doDestroy() {
       int credLifetime = credLifetimeNumDays * 24 * 3600;
	CertUtil.init();
	boolean bDestroyOk = false;
	MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT);
	if( credential == null ){
		credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH);
	}
	if( credential != null ){
		try {
			myProxy.destroy(credential, username, myproxyPassword);
			bDestroyOk= true;
		}
		catch(MyProxyException e){
			appendExceptionDetailsToStatus(e);
		}
		if( bDestroyOk){
			appendToStatus(getLocString("msg007") + username );
		}
	}
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:22,代码来源:MyProxyApplet.java

示例3: doPut

import org.globus.gsi.CertUtil; //导入方法依赖的package包/类
private void doPut() {
      int lifetime     = PORTAL_LIFETIME_HOURS * 3600;
      int credLifetime = credLifetimeNumDays * 24 * 3600;

      CertUtil.init();
      boolean bPutOk = false;
      MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT);
if( credential == null ) {
	credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH);
}
if( credential != null ){
	try {
		myProxy.put(credential, username, myproxyPassword, lifetime);
		bPutOk = true;
	}
	catch(MyProxyException e){
		appendExceptionDetailsToStatus(e);
	}
	if( bPutOk ){
		appendToStatus(getLocString("msg008") + credLifetime / 3600 + getLocString("msg009") + (credLifetime / (3600 * 24)) + getLocString("msg010") + username + getLocString("msg011") + hostname + ".");
	}
}
  }
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:24,代码来源:MyProxyApplet.java

示例4: main

import org.globus.gsi.CertUtil; //导入方法依赖的package包/类
public static void main(String args[]) {

CertUtil.init();

       GridProxyInit gpiFrame = new GridProxyInit(null, true);
gpiFrame.setRunAsApplication(true);
gpiFrame.saveProxy(true);

       WindowListener l = new WindowAdapter() {
	public void windowClosing(WindowEvent e) {
	    System.exit(0);
	}
    };

gpiFrame.addWindowListener(l);
gpiFrame.pack();
UITools.center(null, gpiFrame);
       gpiFrame.setVisible(true);
   }
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:20,代码来源:GridProxyInit.java

示例5: getKeyPair

import org.globus.gsi.CertUtil; //导入方法依赖的package包/类
private KeyPair getKeyPair() throws Exception {
       CertUtil.init();
       
int bits = 512;
       
KeyPairGenerator keyGen = null;
keyGen = KeyPairGenerator.getInstance("RSA", "BC");
keyGen.initialize(bits);
       
       return keyGen.genKeyPair();
   }
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:12,代码来源:BouncyCastleOpenSSLKeyTest.java

示例6: parseCmdLine

import org.globus.gsi.CertUtil; //导入方法依赖的package包/类
protected void parseCmdLine(String [] args) {
for (int i = 0; i < args.length; i++) {
    
    if (args[i].charAt(0) != '-') {

	CertUtil.init();

	if (args[i].equalsIgnoreCase("get")) {
	    doGet(args, i+1, false);
	} else if (args[i].equalsIgnoreCase("anonget")) {
	    doGet(args, i+1, true);
	} else if (args[i].equalsIgnoreCase("put")) {
	    doPut(args, i+1);
	} else if (args[i].equalsIgnoreCase("store")) {
	    doStore(args, i+1);
	} else if (args[i].equalsIgnoreCase("destroy")) {
	    doDestroy(args, i+1);
	} else if (args[i].equalsIgnoreCase("info")) {
	    doInfo(args, i+1);
	} else if (args[i].equalsIgnoreCase("pwd")) {
	    doChangePassword(args, i+1);
	} else {
	    error("Error: unknown command (" + args[i] +")");
	}
    } else if (args[i].equals("-h") || 
	       args[i].equalsIgnoreCase("-host")) {
	++i;
	if (i == args.length) {
	    error("Error: -h requires hostname");
	} else {
	    this.hostname = args[i]; 
	}
    } else if (args[i].equals("-p") ||
	       args[i].equalsIgnoreCase("-port")) {
	++i;
	if (i == args.length) {
	    error("Error: -p requires port number");
	} else {
	    this.port = Integer.parseInt(args[i]);
	}
    } else if (args[i].equals("-l") ||
	       args[i].equalsIgnoreCase("-username")) {
	++i;
	if (i == args.length) {
	    error("Error: -l requires username");
	} else {
	    this.username = args[i]; 
	}
    } else if (args[i].equals("-d") ||
    	       args[i].equalsIgnoreCase("-dn_as_username")) {
	this.dnAsUsername = true;
    } else if (args[i].equalsIgnoreCase("-debug")) {
	this.debug = true;
           } else if (args[i].equals("-S") ||
                      args[i].equalsIgnoreCase("-stdin_pass")) {
	this.stdin = true;
    } else if (args[i].equals("-s") ||
	       args[i].equalsIgnoreCase("-subject")) {
	++i;
	if (i == args.length) {
	    error("Error: -subject requires an argument");
	} else {
	    this.subjectDN = args[i];
	}
    } else if (args[i].equals("-v") ||
	       args[i].equalsIgnoreCase("-version")) {
	
	// display version info
	System.out.println(Version.getVersion());
	System.exit(1);
    } else if (args[i].equalsIgnoreCase("-help") ||
	       args[i].equalsIgnoreCase("-usage")) {
	
	System.err.println(message);
	System.exit(1);
    } else {
	error("Error: argument #" + i + " (" + args[i] +") : unknown");
    }
}
error("Error: No command specified");
   }
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:82,代码来源:MyProxy.java

示例7: connect

import org.globus.gsi.CertUtil; //导入方法依赖的package包/类
public void connect(String host,int port) throws Exception
{
    if (port<=0) 
        port=5010; 
        
    this.socket = new Socket(host,port); 
    
    CertUtil.init();

    GlobusCredential cred;
    cred = GlobusCredential.getDefaultCredential();

    this.input = new DataInputStream(new BufferedInputStream(
            this.socket.getInputStream()));
    this.output = new DataOutputStream(new BufferedOutputStream(
                this.socket.getOutputStream()));

    GSSCredential gssCred = new GlobusGSSCredentialImpl(cred,
                GSSCredential.INITIATE_AND_ACCEPT);
    new GSSTokenSend(nullToken).send(this.output);

    GSSTokenRecv returnToken = new GSSTokenRecv();
    returnToken.readFrom(this.input);
    
    GSSManager manager = new GlobusGSSManagerImpl();
    ExtendedGSSContext context = (ExtendedGSSContext) manager.createContext(
            null,
            GSSConstants.MECH_OID, 
            gssCred, 
            86400);

    context.requestMutualAuth(true); // true
    context.requestCredDeleg(false);
    context.requestConf(false); // true
    context.requestAnonymity(false);
    
    context.setOption(
    		GSSConstants.GSS_MODE,
    		GSIConstants.MODE_GSI);
	context.setOption(
                    GSSConstants.REJECT_LIMITED_PROXY,
                    Boolean.FALSE);

	byte[] inToken = new byte[0];

	// Loop while there still is a token to be processed
	while (!context.isEstablished())
	{
                byte[] outToken = context.initSecContext(inToken, 0,
                        inToken.length);
                // send the output token if generated
                if (outToken != null)
                {
                    new GSSTokenSend(CSEC_TOKEN_MAGIC_1, 3,
                            outToken).send(this.output);

                    // gssTokenSend(this.output, );
                    this.output.flush();
                }
                if (!context.isEstablished())
                {
                    GSSTokenRecv gsstoken = new GSSTokenRecv();
                    gsstoken.readFrom(this.input);

                    inToken = gsstoken.getToken();
                }
    }
}
 
开发者ID:NLeSC,项目名称:vbrowser,代码行数:69,代码来源:TestBOL0.java

示例8: createCredential

import org.globus.gsi.CertUtil; //导入方法依赖的package包/类
public GlobusCredentialWrapper createCredential(final Secret passwd) throws Exception
{
    GlobusCredential credential;
    
    String proxyFile=this.getDefaultProxyFilename(); 
    String certFile=this.getDefaultUserCertLocation(); 
    String keyFile=this.getDefaultUserKeyLocation(); 
 
    int lifeTime=this.getDefaultLifetimeSeconds(); 
     
    ProxyInit init = new ProxyInit();

    int bits = 512;
    int proxyType = GSIConstants.GSI_2_PROXY; 

    CertUtil.init();

    init.setBits(bits);
    init.setLifetime(lifeTime);
    init.setProxyType(proxyType);
    init.setProxyCertInfo(null);
    init.setDebug(true);

    credential=init.createProxy(certFile,
        keyFile,
        passwd,
        false,
        proxyFile);

    // vomsify 
    if (this.getEnableVoms())
    {
        // create new proxy and overwrite previous proxy. 
        VomsProxyCredential vomsCred = VomsUtil.vomsify(credential,
                this.getDefaultVOName(),
                this.getDefaultVOName(),
                this.getDefaultVORole(),
                this.getDefaultLifetime()*3600);  
            credential=vomsCred.getVomsProxy();
            
    }

    GlobusCredentialWrapper cred = new GlobusCredentialWrapper(this,credential);
        
    // update settings. This is the only place they are known:  
    cred.setUserKeyFile(keyFile); 
    cred.setUserCertFile(certFile); 
    cred.setProxyFile(proxyFile); 
    
    return cred; 
}
 
开发者ID:NLeSC,项目名称:vbrowser,代码行数:52,代码来源:GlobusCredentialProvider.java

示例9: init

import org.globus.gsi.CertUtil; //导入方法依赖的package包/类
public void init() {
    
    CertUtil.init();
    
    resetCertFileLoc();

    loadParams();
    
    loadProperties();
    
    handleCAInstallation();

}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:14,代码来源:GIPApplet.java


注:本文中的org.globus.gsi.CertUtil.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。