org.apache.directory.shared.kerberos.components
Class KdcRep

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.kerberos.messages.KerberosMessage
          extended by org.apache.directory.shared.kerberos.components.KdcRep
All Implemented Interfaces:
org.apache.directory.shared.asn1.Asn1Object
Direct Known Subclasses:
AsRep, TgsRep

public class KdcRep
extends KerberosMessage

The KDC-REP data structure. It will store the object described by the ASN.1 grammar :

 KDC-REP         ::= SEQUENCE {
         pvno            [0] INTEGER (5),
         msg-type        [1] INTEGER (11 -- AS -- | 13 -- TGS --),
         padata          [2] SEQUENCE OF PA-DATA OPTIONAL
                                 -- NOTE: not empty --,
         crealm          [3] Realm,
         cname           [4] ,
         ticket          [5] ,
         enc-part        [6] 
                                 -- EncASRepPart or EncTGSRepPart,
                                 -- as appropriate
 }
 

Author:
Apache Directory Project

Field Summary
protected  EncKdcRepPart encKdcRepPart
          The decoded KDC-REP part
 
Constructor Summary
KdcRep(KerberosMessageType msgType)
          Creates a new instance of KDC-REP.
 
Method Summary
 void addPaData(PaData paData)
           
 int computeLength()
          Compute the KDC-REP length
 ByteBuffer encode(ByteBuffer buffer)
          Encode the KDC-REP component
 PrincipalName getCName()
          Returns the client PrincipalName.
 String getCRealm()
          Returns the client realm.
 EncKdcRepPart getEncKdcRepPart()
           
 EncryptedData getEncPart()
          Returns the encrypted part as EncryptedData.
 List<PaData> getPaData()
           
 int getPvno()
           
 Ticket getTicket()
          Returns the Ticket
 void setCName(PrincipalName cname)
          Set the client principalName
 void setCRealm(String crealm)
          Set the client realm
 void setEncKdcRepPart(EncKdcRepPart encKdcRepPart)
           
 void setEncPart(EncryptedData encPart)
           
 void setPvno(int pvno)
           
 void setTicket(Ticket ticket)
          Set the Ticket
 String toString()
           
 
Methods inherited from class org.apache.directory.shared.kerberos.messages.KerberosMessage
getMessageType, getProtocolVersionNumber, setMessageType, setProtocolVersionNumber
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

encKdcRepPart

protected EncKdcRepPart encKdcRepPart
The decoded KDC-REP part

Constructor Detail

KdcRep

public KdcRep(KerberosMessageType msgType)
Creates a new instance of KDC-REP.

Method Detail

getPvno

public int getPvno()
Returns:
the pvno

setPvno

public void setPvno(int pvno)
Parameters:
pvno - the pvno to set

getPaData

public List<PaData> getPaData()
Returns:
the paData

addPaData

public void addPaData(PaData paData)
Parameters:
paData - the paData to set

getCRealm

public String getCRealm()
Returns the client realm.

Returns:
The client realm.

setCRealm

public void setCRealm(String crealm)
Set the client realm

Parameters:
crealm - the client realm

getCName

public PrincipalName getCName()
Returns the client PrincipalName.

Returns:
The client PrincipalName.

setCName

public void setCName(PrincipalName cname)
Set the client principalName

Parameters:
cname - the client principalName

getTicket

public Ticket getTicket()
Returns the Ticket

Returns:
The Ticket

setTicket

public void setTicket(Ticket ticket)
Set the Ticket

Parameters:
ticket - the ticket to set

getEncPart

public EncryptedData getEncPart()
Returns the encrypted part as EncryptedData.

Returns:
The encrypted part as EncryptedData.

setEncPart

public void setEncPart(EncryptedData encPart)
Parameters:
encPart - the encPart to set

getEncKdcRepPart

public EncKdcRepPart getEncKdcRepPart()
Returns:
the encKdcRepPart

setEncKdcRepPart

public void setEncKdcRepPart(EncKdcRepPart encKdcRepPart)
Parameters:
encKdcRepPart - the encKdcRepPart to set

computeLength

public int computeLength()
Compute the KDC-REP length
 KDC-REP :
 
 0x30 L1 KDC-REP sequence
  |
  +--> 0xA0 0x03 pvno tag
  |     |
  |     +--> 0x02 0x01 0x05 pvno (5)
  |
  +--> 0xA1 0x03 msg-type tag
  |     |
  |     +--> 0x02 0x01 0x0B/0x0D msg-type : either AS-REP (0x0B) or TGS-REP (0x0D)
  |     
  +--> 0xA2 L2 pa-data tag
  |     |
  |     +--> 0x30 L2-1 pa-data SEQ
  |           |
  |           +--> 0x30 L2-1-1 pa-data
  |           |
  |           +--> 0x30 L2-1-2 pa-data
  |           :
  |     
  +--> 0xA3 L3 crealm tag
  |     |
  |     +--> 0x1B L3-1 crealm
  |
  +--> 0xA4 L4 cname tag
  |     |
  |     +--> 0x30 L4-1 cname
  |
  +--> 0xA5 L5 ticket tag
  |     |
  |     +--> 0x61 L5-1 ticket
  |
  +--> 0xA6 L6 enc-part tag
        |
        +--> 0x30 L6-1 enc-part
  
 


encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws org.apache.directory.shared.asn1.EncoderException
Encode the KDC-REP component

Specified by:
encode in interface org.apache.directory.shared.asn1.Asn1Object
Overrides:
encode in class org.apache.directory.shared.asn1.AbstractAsn1Object
Parameters:
buffer - The buffer containing the encoded result
Returns:
The encoded component
Throws:
org.apache.directory.shared.asn1.EncoderException - If the encoding failed

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.