APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.jgss.krb5

pack-priv Class WrapToken_v2

extends MessageToken_v2
Class Inheritance
Imports
org.ietf.jgss.*, sun.security.jgss.*, java.io.InputStream, .OutputStream, .IOException, .ByteArrayOutputStream, java.util.Arrays, sun.security.krb5.Confounder

This class represents the new format of GSS tokens, as specified in RFC 4121, emitted by the GSSContext.wrap() call. It is a MessageToken except that it also contains plaintext or encrypted data at the end. A WrapToken has certain other rules that are peculiar to it and different from a MICToken, which is another type of MessageToken. All data in a WrapToken is prepended by a random confounder of 16 bytes. Thus, all application data is replaced by (confounder || data || tokenHeader || checksum).
Author
Seema Malkani

Field Summary

Modifier and TypeField and Description
pack-priv byte[]
private final boolean
Inherited from sun.security.jgss.krb5.MessageToken_v2:
checksumcipherHelperCONFOUNDER_SIZEKG_USAGE_ACCEPTOR_SEALKG_USAGE_ACCEPTOR_SIGNKG_USAGE_INITIATOR_SEALKG_USAGE_INITIATOR_SIGNTOKEN_HEADER_SIZEtokenDatatokenDataLen

Constructor Summary

AccessConstructor and Description
public
WrapToken_v2(Krb5Context
the mechanism context associated with this token
context
,
byte[]
the bytes of the token
tokenBytes
,
int
the offset of the token
tokenOffset
,
int
the length of the token
tokenLen
,
MessageProp
the MessageProp into which characteristics of the parsed token will be stored.
prop
)

Constructs a WrapToken from token bytes obtained from the peer.

public
WrapToken_v2(Krb5Context
the mechanism context associated with this token
context
,
InputStream
the InputStream containing the token bytes
is
,
MessageProp
the MessageProp into which characteristics of the parsed token will be stored.
prop
)

Constructs a WrapToken from token bytes read on the fly from an InputStream.

public
WrapToken_v2(Krb5Context context, MessageProp prop, byte[] dataBytes, int dataOffset, int dataLen)

Writes a WrapToken_v2 object

Method Summary

Modifier and TypeMethod and Description
public void
encode(OutputStream os)

Implements abstract sun.security.jgss.krb5.MessageToken_v2.encode.

Encodes a MessageToken_v2 onto an OutputStream.

public byte[]
public int
encode(byte[] outToken, int offset)

public byte[]

Returns:

a byte array containing the application data
getData
()

Obtains the application data that was transmitted in this WrapToken.

public int

Returns:

the size of the data written
getData
(byte[]
the output buffer into which the data must be written
dataBuf
,
int
the offset at which to write the data
dataBufOffset
)

Obtains the application data that was transmitted in this WrapToken, writing it into an application provided output array.

pack-priv static int
getSizeLimit(int qop, boolean confReq, int maxTokenSize, CipherHelper ch)

Inherited from sun.security.jgss.krb5.MessageToken_v2:
encodeHeadergenSignAndSeqNumbergetChecksumgetConfStategetKeyUsagegetSequenceNumbergetTokenHeadergetTokenIdverifySign

Field Detail

confounderback to summary
pack-priv byte[] confounder
privacyback to summary
private final boolean privacy

Constructor Detail

WrapToken_v2back to summary
public WrapToken_v2(Krb5Context context, byte[] tokenBytes, int tokenOffset, int tokenLen, MessageProp prop) throws GSSException

Constructs a WrapToken from token bytes obtained from the peer.

Parameters
context:Krb5Context

the mechanism context associated with this token

tokenBytes:byte[]

the bytes of the token

tokenOffset:int

the offset of the token

tokenLen:int

the length of the token

prop:MessageProp

the MessageProp into which characteristics of the parsed token will be stored.

Exceptions
GSSException:
if the token is defective
WrapToken_v2back to summary
public WrapToken_v2(Krb5Context context, InputStream is, MessageProp prop) throws GSSException

Constructs a WrapToken from token bytes read on the fly from an InputStream.

Parameters
context:Krb5Context

the mechanism context associated with this token

is:InputStream

the InputStream containing the token bytes

prop:MessageProp

the MessageProp into which characteristics of the parsed token will be stored.

Exceptions
GSSException:
if the token is defective or if there is a problem reading from the InputStream
WrapToken_v2back to summary
public WrapToken_v2(Krb5Context context, MessageProp prop, byte[] dataBytes, int dataOffset, int dataLen) throws GSSException

Writes a WrapToken_v2 object

Method Detail

encodeback to summary
public void encode(OutputStream os) throws IOException

Implements abstract sun.security.jgss.krb5.MessageToken_v2.encode.

Doc from sun.security.jgss.krb5.MessageToken_v2.encode.

Encodes a MessageToken_v2 onto an OutputStream.

Exceptions
IOException:
is an error occurs while encoding the token
encodeback to summary
public byte[] encode() throws IOException
encodeback to summary
public int encode(byte[] outToken, int offset) throws IOException
getDataback to summary
public byte[] getData() throws GSSException

Obtains the application data that was transmitted in this WrapToken.

Returns:byte[]

a byte array containing the application data

Exceptions
GSSException:
if an error occurs while decrypting any cipher text and checking for validity
getDataback to summary
public int getData(byte[] dataBuf, int dataBufOffset) throws GSSException

Obtains the application data that was transmitted in this WrapToken, writing it into an application provided output array.

Parameters
dataBuf:byte[]

the output buffer into which the data must be written

dataBufOffset:int

the offset at which to write the data

Returns:int

the size of the data written

Exceptions
GSSException:
if an error occurs while decrypting any cipher text and checking for validity
getSizeLimitback to summary
pack-priv static int getSizeLimit(int qop, boolean confReq, int maxTokenSize, CipherHelper ch) throws GSSException