public class

PrincipalName

extends Object
implements Cloneable
java.lang.Object
   ↳ sun.security.mule.krb5.PrincipalName
Known Direct Subclasses

Class Overview

This class encapsulates a Kerberos principal.

Summary

Constants
int KRB_NT_PRINCIPAL Just the name of the principal as in DCE, or for users
int KRB_NT_SRV_HST Service with host name as instance (telnet, rcommands)
int KRB_NT_SRV_INST Service and other unique instance (krbtgt)
int KRB_NT_SRV_XHST Service with host as remaining components
int KRB_NT_UID Unique ID
int KRB_NT_UNKNOWN Name type not known
char NAME_COMPONENT_SEPARATOR
String NAME_COMPONENT_SEPARATOR_STR
char NAME_REALM_SEPARATOR
String NAME_REALM_SEPARATOR_STR
char REALM_COMPONENT_SEPARATOR
String REALM_COMPONENT_SEPARATOR_STR
int TGS_DEFAULT_NT
String TGS_DEFAULT_SRV_NAME TGS Name
Fields
private Realm nameRealm
private String[] nameStrings
private int nameType
private String salt
Public Constructors
PrincipalName(String[] nameParts, int type)
PrincipalName(String[] nameParts)
PrincipalName(DerValue encoding)
Returns the ASN.1 encoding of the PrincipalName ::= SEQUENCE { name-type [0] Int32, name-string [1] SEQUENCE OF KerberosString } KerberosString ::= GeneralString (IA5String)

This definition reflects the Network Working Group RFC 4120 specification available at http://www.ietf.org/rfc/rfc4120.txt.

PrincipalName(String name, int type, Config kerberosConfig)
PrincipalName(String name, Config kerberosConfig)
PrincipalName(String name, String realm, Config kerberosConfig)
Protected Constructors
PrincipalName()
PrincipalName(String primary, String instance, String realm, int type)
Creates a KRB_NT_SRV_INST name from the supplied name components and realm.
Public Methods
byte[] asn1Encode()
Encodes a PrincipalName object.
Object clone()
boolean equals(Object o)
boolean equals(PrincipalName other)
String getInstanceComponent()
Returns the instance component of a name.
String getName()
String getNameString()
String[] getNameStrings()
int getNameType()
String getPrincipalNameAsString()
Realm getRealm()
String getRealmAsString()
String getRealmString()
String getSalt()
int hashCode()
boolean match(PrincipalName pname)
Checks if two PrincipalName objects have identical values in their corresponding data fields.
static PrincipalName parse(DerInputStream data, byte explicitTag, boolean optional)
Parse (unmarshal) a PrincipalName from a DER input stream.
void setRealm(String realmsString)
void setRealm(Realm new_nameRealm)
void setSalt(String salt)
byte[][] toByteArray()
String toString()
void writePrincipal(CCacheOutputStream cos)
Writes data field values of PrincipalName in FCC format to an output stream.
Protected Methods
static String[] parseName(String name)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int KRB_NT_PRINCIPAL

Just the name of the principal as in DCE, or for users

Constant Value: 1 (0x00000001)

public static final int KRB_NT_SRV_HST

Service with host name as instance (telnet, rcommands)

Constant Value: 3 (0x00000003)

public static final int KRB_NT_SRV_INST

Service and other unique instance (krbtgt)

Constant Value: 2 (0x00000002)

public static final int KRB_NT_SRV_XHST

Service with host as remaining components

Constant Value: 4 (0x00000004)

public static final int KRB_NT_UID

Unique ID

Constant Value: 5 (0x00000005)

public static final int KRB_NT_UNKNOWN

Name type not known

Constant Value: 0 (0x00000000)

public static final char NAME_COMPONENT_SEPARATOR

Constant Value: 47 (0x0000002f)

public static final String NAME_COMPONENT_SEPARATOR_STR

Constant Value: "/"

public static final char NAME_REALM_SEPARATOR

Constant Value: 64 (0x00000040)

public static final String NAME_REALM_SEPARATOR_STR

Constant Value: "@"

public static final char REALM_COMPONENT_SEPARATOR

Constant Value: 46 (0x0000002e)

public static final String REALM_COMPONENT_SEPARATOR_STR

Constant Value: "."

public static final int TGS_DEFAULT_NT

Constant Value: 2 (0x00000002)

public static final String TGS_DEFAULT_SRV_NAME

TGS Name

Constant Value: "krbtgt"

Fields

private Realm nameRealm

private String[] nameStrings

private int nameType

private String salt

Public Constructors

public PrincipalName (String[] nameParts, int type)

Parameters
nameParts
type
Throws
IOException
IllegalArgumentException

public PrincipalName (String[] nameParts)

Parameters
nameParts
Throws
IOException

public PrincipalName (DerValue encoding)

Returns the ASN.1 encoding of the

PrincipalName ::= SEQUENCE { name-type [0] Int32, name-string [1] SEQUENCE OF KerberosString } KerberosString ::= GeneralString (IA5String)

This definition reflects the Network Working Group RFC 4120 specification available at http://www.ietf.org/rfc/rfc4120.txt.

Parameters
encoding A Der-encoded data.
Throws
Asn1Exception if an error occurs while decoding an ASN1 encoded data.
Asn1Exception if there is an ASN1 encoding error
IOException if an I/O error occurs
IllegalArgumentException if encoding is null reading encoded data.

public PrincipalName (String name, int type, Config kerberosConfig)

Parameters
name
type
kerberosConfig

public PrincipalName (String name, Config kerberosConfig)

Parameters
name
kerberosConfig

public PrincipalName (String name, String realm, Config kerberosConfig)

Parameters
name
realm
kerberosConfig

Protected Constructors

protected PrincipalName ()

protected PrincipalName (String primary, String instance, String realm, int type)

Creates a KRB_NT_SRV_INST name from the supplied name components and realm.

Parameters
primary The primary component of the name
instance The instance component of the name
realm The realm
type
Throws
KrbException

Public Methods

public byte[] asn1Encode ()

Encodes a PrincipalName object.

Returns
  • the byte array of the encoded PrncipalName object.
Throws
Asn1Exception if an error occurs while decoding an ASN1 encoded data.
IOException if an I/O error occurs while reading encoded data.

public Object clone ()

public boolean equals (Object o)

Parameters
o

public boolean equals (PrincipalName other)

Parameters
other

public String getInstanceComponent ()

Returns the instance component of a name. In a multi-component name such as a KRB_NT_SRV_INST name, the second component is returned. Null is returned if there are not two or more components in the name.

public String getName ()

public String getNameString ()

public String[] getNameStrings ()

public int getNameType ()

public String getPrincipalNameAsString ()

public Realm getRealm ()

public String getRealmAsString ()

public String getRealmString ()

public String getSalt ()

public int hashCode ()

public boolean match (PrincipalName pname)

Checks if two PrincipalName objects have identical values in their corresponding data fields.

Parameters
pname The other PrincipalName object.
Returns
  • true if two have identical values, otherwise, return false.

public static PrincipalName parse (DerInputStream data, byte explicitTag, boolean optional)

Parse (unmarshal) a PrincipalName from a DER input stream. This form parsing might be used when expanding a value which is part of a constructed sequence and uses explicitly tagged type.

Parameters
data The Der input stream value, which contains one or more marshaled value.
explicitTag Tag number.
optional Indicate if this data field is optional
Returns
  • an instance of PrincipalName.
Throws
Asn1Exception on error.
IOException

public void setRealm (String realmsString)

Parameters
realmsString

public void setRealm (Realm new_nameRealm)

Parameters
new_nameRealm

public void setSalt (String salt)

Parameters
salt

public byte[][] toByteArray ()

public String toString ()

public void writePrincipal (CCacheOutputStream cos)

Writes data field values of PrincipalName in FCC format to an output stream.

Parameters
cos A CCacheOutputStream for writing data.
Throws
IOException if an I/O exception occurs.

Protected Methods

protected static String[] parseName (String name)

Parameters
name