sun.security.mule.jgss
Class GSSHeader

java.lang.Object
  extended by sun.security.mule.jgss.GSSHeader

public class GSSHeader
extends Object

This class represents the mechanism independent part of a GSS-API context establishment token. Some mechanisms may choose to encode all subsequent tokens as well such that they start with an encoding of an instance of this class. e.g., The Kerberos v5 GSS-API Mechanism uses this header for all GSS-API tokens.

The format is specified in RFC 2743 section 3.1.

Author:
Mayank Upadhyay

Field Summary
static int TOKEN_ID
          The tag defined in the GSS-API mechanism independent token format.
 
Constructor Summary
GSSHeader(InputStream is)
          Reads in a GSSHeader from an InputStream.
GSSHeader(sun.security.util.ObjectIdentifier mechOid, int mechTokenLength)
          Creates a GSSHeader instance whose encoding can be used as the prefix for a particular mechanism token.
 
Method Summary
 int encode(OutputStream os)
          Encodes this GSSHeader instance onto the provided OutputStream.
 int getLength()
          Used to obtain the length of the encoding of this GSSHeader.
static int getMaxMechTokenSize(sun.security.util.ObjectIdentifier mechOid, int maxTotalSize)
          Used to determine what the maximum possible mechanism token size is if the complete GSSToken returned to the application (including a GSSHeader) is not to exceed some pre-determined value in size.
 int getMechTokenLength()
          Used to obtain the length of the mechanism specific token that will follow the encoding of this GSSHeader instance.
 sun.security.util.ObjectIdentifier getOid()
          Used to obtain the Oid stored in this GSSHeader instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOKEN_ID

public static final int TOKEN_ID
The tag defined in the GSS-API mechanism independent token format.

See Also:
Constant Field Values
Constructor Detail

GSSHeader

public GSSHeader(sun.security.util.ObjectIdentifier mechOid,
                 int mechTokenLength)
          throws IOException
Creates a GSSHeader instance whose encoding can be used as the prefix for a particular mechanism token.

Parameters:
mechOid - the Oid of the mechanism which generated the token
mechTokenLength - the length of the subsequent portion that the mechanism will be adding.
Throws:
IOException

GSSHeader

public GSSHeader(InputStream is)
          throws IOException,
                 GSSException
Reads in a GSSHeader from an InputStream. Typically this would be used as part of reading the complete token from an InputStream that is obtained from a socket.

Throws:
IOException
GSSException
Method Detail

getOid

public sun.security.util.ObjectIdentifier getOid()
Used to obtain the Oid stored in this GSSHeader instance.

Returns:
the Oid of the mechanism.

getMechTokenLength

public int getMechTokenLength()
Used to obtain the length of the mechanism specific token that will follow the encoding of this GSSHeader instance.

Returns:
the length of the mechanism specific token portion that will follow this GSSHeader.

getLength

public int getLength()
Used to obtain the length of the encoding of this GSSHeader.

Returns:
the lenght of the encoding of this GSSHeader instance.

getMaxMechTokenSize

public static int getMaxMechTokenSize(sun.security.util.ObjectIdentifier mechOid,
                                      int maxTotalSize)
Used to determine what the maximum possible mechanism token size is if the complete GSSToken returned to the application (including a GSSHeader) is not to exceed some pre-determined value in size.

Parameters:
mechOid - the Oid of the mechanism that will generate this GSS-API token
maxTotalSize - the pre-determined value that serves as a maximum size for the complete GSS-API token (including a GSSHeader)
Returns:
the maximum size of mechanism token that can be used so as to not exceed maxTotalSize with the GSS-API token

encode

public int encode(OutputStream os)
           throws IOException
Encodes this GSSHeader instance onto the provided OutputStream.

Parameters:
os - the OutputStream to which the token should be written.
Returns:
the number of bytes that are output as a result of this encoding
Throws:
IOException


Copyright © 2013. All Rights Reserved.