Methods Summary |
---|
public byte[] | getEncoded()Gets encoded form of DN
if (encoded == null) {
encoded = ASN1.encode(this);
}
return encoded;
|
public java.lang.String | getName(java.lang.String format)Returns Relative Distinguished Name as String according
the format requested
//
// check X500Principal constants first
//
if (format == X500Principal.RFC1779) {
if (rfc1779String == null) {
rfc1779String = getName0(format);
}
return rfc1779String;
} else if (format == X500Principal.RFC2253) {
if (rfc2253String == null) {
rfc2253String = getName0(format);
}
return rfc2253String;
} else if (format == X500Principal.CANONICAL) {
if (canonicalString == null) {
canonicalString = getName0(format);
}
return canonicalString;
}
//
// compare ignore case
//
else if (X500Principal.RFC1779.equalsIgnoreCase(format)) {
if (rfc1779String == null) {
rfc1779String = getName0(X500Principal.RFC1779);
}
return rfc1779String;
} else if (X500Principal.RFC2253.equalsIgnoreCase(format)) {
if (rfc2253String == null) {
rfc2253String = getName0(X500Principal.RFC2253);
}
return rfc2253String;
} else if (X500Principal.CANONICAL.equalsIgnoreCase(format)) {
if (canonicalString == null) {
canonicalString = getName0(X500Principal.CANONICAL);
}
return canonicalString;
} else {
throw new IllegalArgumentException(Messages.getString("security.177", format)); //$NON-NLS-1$
}
|
private java.lang.String | getName0(java.lang.String format)Returns Relative Distinguished Name as String according
the format requested, format is int value
StringBuffer name = new StringBuffer();
// starting with the last element and moving to the first.
for (int i = rdn.size() - 1; i >= 0; i--) {
List atavList = (List) rdn.get(i);
if (X500Principal.CANONICAL == format) {
List sortedList = new LinkedList(atavList);
Collections.sort(sortedList,
new AttributeTypeAndValueComparator());
atavList = sortedList;
}
// Relative Distinguished Name to string
Iterator it = atavList.iterator();
while (it.hasNext()) {
AttributeTypeAndValue _ava = (AttributeTypeAndValue) it.next();
_ava.appendName(format, name);
if (it.hasNext()) {
// multi-valued RDN
if (X500Principal.RFC1779 == format) {
name.append(" + "); //$NON-NLS-1$
} else {
name.append('+");
}
}
}
if (i != 0) {
name.append(',");
if (format == X500Principal.RFC1779) {
name.append(' ");
}
}
}
String sName = name.toString();
if (format == X500Principal.CANONICAL) {
sName = sName.toLowerCase(Locale.US);
}
return sName;
|
public javax.security.auth.x500.X500Principal | getX500Principal()Returns X500Principal instance corresponding to this
Name instance
return new X500Principal(getName0(X500Principal.RFC2253));
|