class buildks {

	public int createCredential(String args[]){
		int returnCode=-1;
		String command=null;
    	String alias=null;
    	String valueOption=null;
    	String credential=null;
    	String providerOption=null;
    	String providerPath=null;
    	String tempCredential=null;
		try{	    		    	
	    	if(args!=null && args.length==6)
	    	{
	    		command=args[0];
	    		alias=args[1];
	    		valueOption=args[2];
	    		credential=args[3];
	    		providerOption=args[4];
	    		providerPath=args[5];
				if(!isValidCreateCommand(command,alias,valueOption,credential,providerOption,providerPath)){
	    			return returnCode;
	    		}	    		
	    		tempCredential=CredentialReader.getDecryptedString(providerPath, alias);
	    	}else{  
	    		return returnCode;
	    	}
	    	
	    	if(tempCredential==null){
	    		returnCode=createKeyStore(args);
	    	}else{
	    		try{
	    			System.out.println("Alias already exist!! will try to delete first.");
	    			boolean isSilentMode = true;
	    			String argsDelete[]=new String[4];
	    			argsDelete[0]="delete";
	    			argsDelete[1]=alias;
	    			argsDelete[2]=providerOption;
	    			argsDelete[3]=providerPath;
	    			returnCode=deleteCredential(argsDelete, isSilentMode);
	    			if(returnCode==0){
	    	    		returnCode=createKeyStore(args);
	    	    	}
	    		}catch(Exception ex){
	    			returnCode=-1;
	    		}
	    	}
	    }catch(Exception ex){
    		ex.printStackTrace();
    	}
		return returnCode;
	}

}