Here you can find the source of toGlobusID(X500Principal principal)
public static String toGlobusID(X500Principal principal)
//package com.java2s; /*//from ww w . ja v a2s . c o m * Copyright 1999-2010 University of Chicago * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is * distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. * * See the License for the specific language governing permissions and limitations under the License. */ import java.util.StringTokenizer; import javax.security.auth.x500.X500Principal; public class Main { /** * Converts DN of the form "CN=A, OU=B, O=C" into Globus format * "/O=C/OU=B/CN=A" <BR> This function might return incorrect * Globus-formatted ID when one of the RDNs in the DN contains commas. * * @return the converted DN in Globus format. */ public static String toGlobusID(X500Principal principal) { if (principal == null) { return null; } String dn = principal.getName(); StringTokenizer tokens = new StringTokenizer(dn, ","); StringBuffer buf = new StringBuffer(); String token; while (tokens.hasMoreTokens()) { token = tokens.nextToken().trim(); buf.insert(0, token); buf.insert(0, "/"); } return buf.toString(); } }