com.ibm.security.krb5

Class PrincipalName

  1. java.lang.Object
  2. extended bycom.ibm.security.krb5.PrincipalName
All implemented interfaces:
java.lang.Cloneable
Direct known subclasses:
ServiceName

  1. public class PrincipalName
  2. extends java.lang.Object
  3. implements java.lang.Cloneable
This class encapsulates a Kerberos principal.

Field Summary

Modifier and Type Field and Description
  1. static
  2. int
KRB_NT_PRINCIPAL
Just the name of the principal as in DCE, or for users
  1. static
  2. int
KRB_NT_SRV_HST
Service with host name as instance (telnet, rcommands)
  1. static
  2. int
KRB_NT_SRV_INST
Service and other unique instance (krbtgt)
  1. static
  2. int
KRB_NT_SRV_XHST
Service with host as remaining components
  1. static
  2. int
KRB_NT_UID
Unique ID
  1. static
  2. int
KRB_NT_UNKNOWN
Name type not known
  1. static
  2. char
NAME_COMPONENT_SEPARATOR
  1. static
  2. java.lang.String
NAME_COMPONENT_SEPARATOR_STR
  1. static
  2. char
NAME_REALM_SEPARATOR
  1. static
  2. java.lang.String
NAME_REALM_SEPARATOR_STR
  1. static
  2. char
REALM_COMPONENT_SEPARATOR
  1. static
  2. java.lang.String
REALM_COMPONENT_SEPARATOR_STR
  1. static
  2. int
TGS_DEFAULT_NT
  1. static
  2. java.lang.String
TGS_DEFAULT_SRV_NAME
TGS Name

Constructor Summary

Modifier Constructor and Description
  1. protected
PrincipalName()
  1. (package private)
PrincipalName(com.ibm.security.util.DerValue encoding)
Returns the ASN.1 encodigng of the PrincipalName ::= SEQUENCE { name-type[0] INTEGER, name-string[1] SEQUENCE OF GeneralString }
  1. (package private)
PrincipalName(java.lang.String name)
  1. (package private)
PrincipalName(java.lang.String[] nameParts)
  1. (package private)
PrincipalName(java.lang.String[] nameParts,int type)
  1. (package private)
PrincipalName(java.lang.String name,int type)
  1. (package private)
PrincipalName(java.lang.String name,java.lang.String realm)
  1. protected
PrincipalName(java.lang.String primary,java.lang.String instance,java.lang.String realm,int type)
Creates a KRB_NT_SRV_INST name from the supplied name components and realm.

Method Summary

Modifier and Type Method and Description
  1. byte[]
asn1Encode()
Encodes a PrincipalName object.
  1. java.lang.Object
clone()
  1. boolean
equals(java.lang.Object o)
  1. boolean
equals(PrincipalName other)
  1. java.lang.String
getInstanceComponent()
Returns the instance component of a name.
  1. java.lang.String
getName()
  1. java.lang.String
getNameString()
  1. java.lang.String[]
getNameStrings()
  1. int
getNameType()
  1. java.lang.String
getPrincipalNameAsString()
  1. Realm
getRealm()
  1. java.lang.String
getRealmAsString()
  1. java.lang.String
getRealmString()
  1. java.lang.String
getSalt()
  1. int
hashCode()
  1. boolean
isTGS()
Determines whether this is a ticket-granting service based on the name.
  1. boolean
match(PrincipalName pname)
Checks if two PrincipalName objects have identical values in their corresponding data fields.
  1. static
  2. PrincipalName
parse(com.ibm.security.util.DerInputStream data,byte explicitTag,boolean optional)
Parse (unmarshal) a PrincipalName from a DER input stream.
  1. protected static
  2. java.lang.String[]
parseName(java.lang.String name)
  1. void
setRealm(Realm new_nameRealm)
  1. void
setRealm(java.lang.String realmsString)
  1. void
setSalt(java.lang.String salt)
  1. byte[][]
toByteArray()
  1. java.lang.String
toString()
  1. protected static
  2. java.lang.String
unparseName(java.lang.String[] nameStrings)
  1. void
writePrincipal(CCacheOutputStream cos)
Writes data field values of PrincipalName in FCC format to an output stream.
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait

Field Detail

KRB_NT_UNKNOWN

  1. public static final int KRB_NT_UNKNOWN
Name type not known
See Also:

KRB_NT_PRINCIPAL

  1. public static final int KRB_NT_PRINCIPAL
Just the name of the principal as in DCE, or for users
See Also:

KRB_NT_SRV_INST

  1. public static final int KRB_NT_SRV_INST
Service and other unique instance (krbtgt)
See Also:

KRB_NT_SRV_HST

  1. public static final int KRB_NT_SRV_HST
Service with host name as instance (telnet, rcommands)
See Also:

KRB_NT_SRV_XHST

  1. public static final int KRB_NT_SRV_XHST
Service with host as remaining components
See Also:

KRB_NT_UID

  1. public static final int KRB_NT_UID
Unique ID
See Also:

TGS_DEFAULT_SRV_NAME

  1. public static final java.lang.String TGS_DEFAULT_SRV_NAME
TGS Name
See Also:

TGS_DEFAULT_NT

  1. public static final int TGS_DEFAULT_NT
See Also:

NAME_COMPONENT_SEPARATOR

  1. public static final char NAME_COMPONENT_SEPARATOR
See Also:

NAME_REALM_SEPARATOR

  1. public static final char NAME_REALM_SEPARATOR
See Also:

REALM_COMPONENT_SEPARATOR

  1. public static final char REALM_COMPONENT_SEPARATOR
See Also:

NAME_COMPONENT_SEPARATOR_STR

  1. public static final java.lang.String NAME_COMPONENT_SEPARATOR_STR
See Also:

NAME_REALM_SEPARATOR_STR

  1. public static final java.lang.String NAME_REALM_SEPARATOR_STR
See Also:

REALM_COMPONENT_SEPARATOR_STR

  1. public static final java.lang.String REALM_COMPONENT_SEPARATOR_STR
See Also:

Constructor Detail

PrincipalName

  1. protected PrincipalName()

PrincipalName

  1. public PrincipalName(java.lang.String[] nameParts,
  2. int type)

PrincipalName

  1. public PrincipalName(java.lang.String[] nameParts)

PrincipalName

  1. public PrincipalName(com.ibm.security.util.DerValue encoding)
  2. throws Asn1Exception
  3. java.io.IOException
Returns the ASN.1 encodigng of the PrincipalName ::= SEQUENCE { name-type[0] INTEGER, name-string[1] SEQUENCE OF GeneralString }

This definition reflects the Network Working Group RFC 1510 specifications dated September 1993 and available at http://www.ietf.org/rfc/rfc1510.txt.

Parameters:
encoding - a Der-encoded data.
Throws:
Asn1Exception - if an error occurs while decoding an ASN1 encoded data.
java.io.IOException - if an I/O error occurs while reading encoded data.

PrincipalName

  1. public PrincipalName(java.lang.String name,
  2. int type)
  3. throws RealmException
Throws:

PrincipalName

  1. public PrincipalName(java.lang.String name)
  2. throws RealmException
Throws:

PrincipalName

  1. public PrincipalName(java.lang.String name,
  2. java.lang.String realm)
  3. throws RealmException
Throws:

PrincipalName

  1. protected PrincipalName(java.lang.String primary,
  2. java.lang.String instance,
  3. java.lang.String realm,
  4. int type)
  5. throws KrbException
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
Throws:

Method Detail

clone

  1. public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

equals

  1. public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

equals

  1. public boolean equals(PrincipalName other)

parse

  1. public static PrincipalName parse( com.ibm.security.util.DerInputStream data,
  2. byte explicitTag,
  3. boolean optional)
  4. throws Asn1Exception
  5. java.io.IOException
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.
java.io.IOException

parseName

  1. protected static java.lang.String[] parseName( java.lang.String name)

unparseName

  1. protected static java.lang.String unparseName( java.lang.String[] nameStrings)

getRealmAsString

  1. public java.lang.String getRealmAsString( )

getPrincipalNameAsString

  1. public java.lang.String getPrincipalNameAsString( )

hashCode

  1. public int hashCode()
Overrides:
hashCode in class java.lang.Object

getName

  1. public java.lang.String getName( )

getNameType

  1. public int getNameType()

getNameStrings

  1. public java.lang.String[] getNameStrings( )

toByteArray

  1. public byte[][] toByteArray()

getRealmString

  1. public java.lang.String getRealmString( )

getRealm

  1. public Realm getRealm()

setRealm

  1. public void setRealm(Realm new_nameRealm)
  2. throws RealmException
Throws:

setRealm

  1. public void setRealm(java.lang.String realmsString)
  2. throws RealmException
Throws:

getSalt

  1. public java.lang.String getSalt( )

setSalt

  1. public void setSalt(java.lang.String salt)

toString

  1. public java.lang.String toString( )
Overrides:
toString in class java.lang.Object

getNameString

  1. public java.lang.String getNameString( )

asn1Encode

  1. public byte[] asn1Encode()
  2. throws Asn1Exception
  3. java.io.IOException
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.
java.io.IOException - if an I/O error occurs while reading encoded data.

match

  1. 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.

writePrincipal

  1. public void writePrincipal(CCacheOutputStream cos)
  2. throws java.io.IOException
Writes data field values of PrincipalName in FCC format to an output stream.
Parameters:
cos - a CCacheOutputStream for writing data.
Throws:
java.io.IOException - if an I/O exception occurs.
See Also:

getInstanceComponent

  1. public java.lang.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.

isTGS

  1. public boolean isTGS()
Determines whether this is a ticket-granting service based on the name. A ticket-granting service name consists of two parts with the first part being "krbtgt".