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

public final Class KrbAsReqBuilder

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.Arrays, javax.security.auth.kerberos.KeyTab, sun.security.jgss.krb5.Krb5Util, sun.security.krb5.internal.HostAddresses, .KDCOptions, .KRBError, .KerberosTime, .Krb5, .PAData, sun.security.krb5.internal.crypto.EType

A manager class for AS-REQ communications. This class does: 1. Gather information to create AS-REQ 2. Create and send AS-REQ 3. Receive AS-REP and KRB-ERROR (-KRB_ERR_RESPONSE_TOO_BIG) and parse them 4. Emit credentials and secret keys (for JAAS storeKey=true with password) This class does not: 1. Deal with real communications (KdcComm does it, and TGS-REQ) a. Name of KDCs for a realm b. Server availability, timeout, UDP or TCP d. KRB_ERR_RESPONSE_TOO_BIG 2. Stores its own copy of password, this means: a. Do not change/wipe it before Builder finish b. Builder will not wipe it for you With this class: 1. KrbAsReq has only one constructor 2. Krb5LoginModule and Kinit call a single builder 3. Better handling of sensitive info
Since
1.7

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static enum

Field Summary

Modifier and TypeField and Description
private HostAddresses
private PrincipalName
private KerberosTime
private final KeyTab
private KDCOptions
private PAData[]
private final char[]
private PrincipalName
private KrbAsRep
private KrbAsReq
private KerberosTime
private PrincipalName
private KrbAsReqBuilder.State
private KerberosTime

Constructor Summary

AccessConstructor and Description
public
KrbAsReqBuilder(PrincipalName
the client of the AS-REQ. Must not be null. Might have no realm, where default realm will be used. This realm will be the target realm for AS-REQ. I believe a client should only get initial TGT from its own realm.
cname
,
KeyTab
must not be null. If empty, might be quite useless. This argument will neither be modified nor stored by the method.
ktab
)

Creates a builder to be used by cname with existing keys.

public
KrbAsReqBuilder(PrincipalName
the client of the AS-REQ. Must not be null. Might have no realm, where default realm will be used. This realm will be the target realm for AS-REQ. I believe a client should only get initial TGT from its own realm.
cname
,
char[]
must not be null. This argument will neither be modified nor stored by the method.
pass
)

Creates a builder to be used by cname with a known password.

Method Summary

Modifier and TypeMethod and Description
public KrbAsReqBuilder
action()

Performs AS-REQ send and AS-REP receive.

private KrbAsReq

Returns:

the KrbAsReq object
build
(EncryptionKey
null (initial AS-REQ) or pakey (with preauth)
key
,
KrbAsReqBuilder.ReferralsState referralsState)

Build a KrbAsReq object from all info fed above.

private void
checkState(KrbAsReqBuilder.State
the expected state
st
,
String
error message if state is not correct
msg
)

Checks if the current state is the specified one.

public void
destroy()

Destroys the object and clears keys and password info.

public Credentials
getCCreds()

Gets another type of Credentials after action

public Credentials
getCreds()

Gets Credentials object after action

public EncryptionKey[]

Returns:

generated keys from password. PA-DATA from server might be used. All "default_tkt_enctypes" keys will be generated, Never null.
getKeys
(boolean
if the caller is an initiator
isInitiator
)

Retrieves an array of secret keys for the client.

private void
private KrbAsReqBuilder
resolve()

Parses AS-REP, decrypts enc-part, retrieves ticket and session key

private KrbAsReqBuilder
send()

Communication until AS-REP or non preauth-related KRB-ERROR received

public void
setAddresses(HostAddresses addresses)

Adds or clears addresses.

public void
setOptions(KDCOptions options)

Sets or clears options.

public void
public void
setTarget(PrincipalName sname)

Sets or clears target.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addressesback to summary
private HostAddresses addresses
cnameback to summary
private PrincipalName cname
fromback to summary
private KerberosTime from
ktabback to summary
private final KeyTab ktab
optionsback to summary
private KDCOptions options
paListback to summary
private PAData[] paList
passwordback to summary
private final char[] password
refCnameback to summary
private PrincipalName refCname
repback to summary
private KrbAsRep rep
reqback to summary
private KrbAsReq req
rtimeback to summary
private KerberosTime rtime
snameback to summary
private PrincipalName sname
stateback to summary
private KrbAsReqBuilder.State state
tillback to summary
private KerberosTime till

Constructor Detail

KrbAsReqBuilderback to summary
public KrbAsReqBuilder(PrincipalName cname, KeyTab ktab) throws KrbException

Creates a builder to be used by cname with existing keys.

Parameters
cname:PrincipalName

the client of the AS-REQ. Must not be null. Might have no realm, where default realm will be used. This realm will be the target realm for AS-REQ. I believe a client should only get initial TGT from its own realm.

ktab:KeyTab

must not be null. If empty, might be quite useless. This argument will neither be modified nor stored by the method.

KrbAsReqBuilderback to summary
public KrbAsReqBuilder(PrincipalName cname, char[] pass) throws KrbException

Creates a builder to be used by cname with a known password.

Parameters
cname:PrincipalName

the client of the AS-REQ. Must not be null. Might have no realm, where default realm will be used. This realm will be the target realm for AS-REQ. I believe a client should only get initial TGT from its own realm.

pass:char[]

must not be null. This argument will neither be modified nor stored by the method.

Method Detail

actionback to summary
public KrbAsReqBuilder action() throws KrbException, Asn1Exception, IOException

Performs AS-REQ send and AS-REP receive. Maybe a state is needed here, to divide prepare process and getCreds.

buildback to summary
private KrbAsReq build(EncryptionKey key, KrbAsReqBuilder.ReferralsState referralsState) throws KrbException, IOException

Build a KrbAsReq object from all info fed above. Normally this method will be called twice: initial AS-REQ and second with pakey

Parameters
key:EncryptionKey

null (initial AS-REQ) or pakey (with preauth)

Returns:KrbAsReq

the KrbAsReq object

checkStateback to summary
private void checkState(KrbAsReqBuilder.State st, String msg)

Checks if the current state is the specified one.

Parameters
st:KrbAsReqBuilder.State

the expected state

msg:String

error message if state is not correct

Exceptions
IllegalStateException:
if state is not correct
destroyback to summary
public void destroy()

Destroys the object and clears keys and password info.

getCCredsback to summary
public Credentials getCCreds()

Gets another type of Credentials after action

getCredsback to summary
public Credentials getCreds()

Gets Credentials object after action

getKeysback to summary
public EncryptionKey[] getKeys(boolean isInitiator) throws KrbException

Retrieves an array of secret keys for the client. This is used when the client supplies password but need keys to act as an acceptor. For an initiator, it must be called after AS-REQ is performed (state is OK). For an acceptor, it can be called when this KrbAsReqBuilder object is constructed (state is INIT).

Parameters
isInitiator:boolean

if the caller is an initiator

Returns:EncryptionKey[]

generated keys from password. PA-DATA from server might be used. All "default_tkt_enctypes" keys will be generated, Never null.

Exceptions
IllegalStateException:
if not constructed from a password
initback to summary
private void init(PrincipalName cname) throws KrbException
resolveback to summary
private KrbAsReqBuilder resolve() throws KrbException, Asn1Exception, IOException

Parses AS-REP, decrypts enc-part, retrieves ticket and session key

sendback to summary
private KrbAsReqBuilder send() throws KrbException, IOException

Communication until AS-REP or non preauth-related KRB-ERROR received

setAddressesback to summary
public void setAddresses(HostAddresses addresses)

Adds or clears addresses. KrbAsReq might add some if empty field not allowed

setOptionsback to summary
public void setOptions(KDCOptions options)

Sets or clears options. If cleared, default options will be used at creation time.

setRTimeback to summary
public void setRTime(KerberosTime rtime)
setTargetback to summary
public void setTarget(PrincipalName sname)

Sets or clears target. If cleared, KrbAsReq might choose krbtgt for cname realm

setTillback to summary
public void setTill(KerberosTime till)
sun.security.krb5 back to summary

pack-priv final Class KrbAsReqBuilder.ReferralsState

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static boolean
private int
private boolean
private boolean
private boolean
private KrbAsReqBuilder
private boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
pack-priv static void
pack-priv boolean
pack-priv boolean
pack-priv boolean
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

canonicalizeConfigback to summary
private static boolean canonicalizeConfig
countback to summary
private int count
enabledback to summary
private boolean enabled
isEnterpriseCnameback to summary
private boolean isEnterpriseCname
refreshCommback to summary
private boolean refreshComm
reqBuilderback to summary
private KrbAsReqBuilder reqBuilder
sendCanonicalizeback to summary
private boolean sendCanonicalize

Constructor Detail

ReferralsStateback to summary
pack-priv ReferralsState(KrbAsReqBuilder reqBuilder) throws KrbException

Method Detail

handleErrorback to summary
pack-priv boolean handleError(KrbException ke) throws RealmException
initStaticback to summary
pack-priv static void initStatic()
isEnabledback to summary
pack-priv boolean isEnabled()
refreshCommback to summary
pack-priv boolean refreshComm()
sendCanonicalizeback to summary
pack-priv boolean sendCanonicalize()
updateStatusback to summary
private void updateStatus()
sun.security.krb5 back to summary

private final Enum KrbAsReqBuilder.State

extends Enum<KrbAsReqBuilder.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final KrbAsReqBuilder.State
public static final KrbAsReqBuilder.State
public static final KrbAsReqBuilder.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static KrbAsReqBuilder.State
public static KrbAsReqBuilder.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DESTROYEDback to summary
public static final KrbAsReqBuilder.State DESTROYED
INITback to summary
public static final KrbAsReqBuilder.State INIT
REQ_OKback to summary
public static final KrbAsReqBuilder.State REQ_OK

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static KrbAsReqBuilder.State valueOf(String name)
valuesback to summary
public static KrbAsReqBuilder.State[] values()