sun.security.mule.jgss
Class GSSToken

java.lang.Object
  extended by sun.security.mule.jgss.GSSToken
Direct Known Subclasses:
NegTokenInit, NegTokenTarg

public abstract class GSSToken
extends Object

Utilities for processing GSS Tokens.


Constructor Summary
GSSToken()
           
 
Method Summary
static void debug(String str)
           
static String getHexBytes(byte[] bytes)
           
static String getHexBytes(byte[] bytes, int len)
           
static String getHexBytes(byte[] bytes, int pos, int len)
           
static int readBigEndian(byte[] data, int pos, int size)
           
static void readFully(InputStream is, byte[] buffer)
          Blocks till the required number of bytes have been read from the input stream.
static void readFully(InputStream is, byte[] buffer, int offset, int len)
          Blocks till the required number of bytes have been read from the input stream.
static int readInt(byte[] src, int pos)
          Reads a two byte integer value from a byte array.
static int readInt(InputStream is)
          Reads a two byte integer value from an InputStream.
static int readLittleEndian(byte[] data, int pos, int size)
          Reads an integer value from a byte array in little endian form.
static void writeBigEndian(int value, byte[] array)
           
static void writeBigEndian(int value, byte[] array, int pos)
           
static int writeInt(int val, byte[] dest, int pos)
          Writes a two byte integer value to a byte array.
static void writeInt(int val, OutputStream os)
          Writes a two byte integer value to a OutputStream.
static void writeLittleEndian(int value, byte[] array)
          Copies an integer value to a byte array in little endian form.
static void writeLittleEndian(int value, byte[] array, int pos)
          Copies an integer value to a byte array in little endian form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GSSToken

public GSSToken()
Method Detail

writeLittleEndian

public static final void writeLittleEndian(int value,
                                           byte[] array)
Copies an integer value to a byte array in little endian form.

Parameters:
value - the integer value to write
array - the byte array into which the integer must be copied. It is assumed that the array will be large enough to hold the 4 bytes of the integer.

writeLittleEndian

public static final void writeLittleEndian(int value,
                                           byte[] array,
                                           int pos)
Copies an integer value to a byte array in little endian form.

Parameters:
value - the integer value to write
array - the byte array into which the integer must be copied. It is assumed that the array will be large enough to hold the 4 bytes of the integer.
pos - the position at which to start writing

writeBigEndian

public static final void writeBigEndian(int value,
                                        byte[] array)

writeBigEndian

public static final void writeBigEndian(int value,
                                        byte[] array,
                                        int pos)

readLittleEndian

public static final int readLittleEndian(byte[] data,
                                         int pos,
                                         int size)
Reads an integer value from a byte array in little endian form. This method allows the reading of two byte values as well as four bytes values both of which are needed in the Kerberos v5 GSS-API mechanism.

Parameters:
data - the array containing the bytes of the integer value
pos - the offset in the array
Returns:
the integer value

readBigEndian

public static final int readBigEndian(byte[] data,
                                      int pos,
                                      int size)

writeInt

public static final void writeInt(int val,
                                  OutputStream os)
                           throws IOException
Writes a two byte integer value to a OutputStream.

Parameters:
val - the integer value. It will lose the high-order two bytes.
os - the OutputStream to write to
Throws:
IOException - if an error occurs while writing to the OutputStream

writeInt

public static final int writeInt(int val,
                                 byte[] dest,
                                 int pos)
Writes a two byte integer value to a byte array.

Parameters:
val - the integer value. It will lose the high-order two bytes.
dest - the byte array to write to
pos - the offset to start writing to

readInt

public static final int readInt(InputStream is)
                         throws IOException
Reads a two byte integer value from an InputStream.

Parameters:
is - the InputStream to read from
Throws:
IOException - if some errors occurs while reading the integer bytes.

readInt

public static final int readInt(byte[] src,
                                int pos)
Reads a two byte integer value from a byte array.

Parameters:
src - the byte arra to read from
pos - the offset to start reading from

readFully

public static final void readFully(InputStream is,
                                   byte[] buffer)
                            throws IOException
Blocks till the required number of bytes have been read from the input stream.

Parameters:
is - the InputStream to read from
buffer - the buffer to store the bytes into
throws - EOFException if EOF is reached before all bytes are read.
Throws:
IOException - is an error occurs while reading

readFully

public static final void readFully(InputStream is,
                                   byte[] buffer,
                                   int offset,
                                   int len)
                            throws IOException
Blocks till the required number of bytes have been read from the input stream.

Parameters:
is - the InputStream to read from
buffer - the buffer to store the bytes into
offset - the offset to start storing at
len - the number of bytes to read
throws - EOFException if EOF is reached before all bytes are read.
Throws:
IOException - is an error occurs while reading

debug

public static final void debug(String str)

getHexBytes

public static final String getHexBytes(byte[] bytes)

getHexBytes

public static final String getHexBytes(byte[] bytes,
                                       int len)

getHexBytes

public static final String getHexBytes(byte[] bytes,
                                       int pos,
                                       int len)


Copyright © 2013. All Rights Reserved.