/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
private final byte[] CHECKSUM_FIRST_BYTES =
{(byte)0x10, (byte)0x00, (byte)0x00, (byte)0x00};
protected class OverloadedChecksum {
/**
* Called on the initiator side when creating the
* InitSecContextToken.
*/
byte[] krbCredMessage = null;
int pos = 0;
if (!tgt.isForwardable()) {
context.setCredDelegState(false);
context.setDelegPolicyState(false);
} else if (context.getCredDelegState()) {
if (context.getDelegPolicyState()) {
if (!serviceTicket.checkDelegate()) {
// delegation not permitted by server policy, mark it
context.setDelegPolicyState(false);
}
}
} else if (context.getDelegPolicyState()) {
if (serviceTicket.checkDelegate()) {
context.setCredDelegState(true);
} else {
context.setDelegPolicyState(false);
}
}
if (context.getCredDelegState()) {
if (useNullKey(cipherHelper)) {
} else {
}
}
checksumBytes = new byte[size];
if (localBindings != null) {
byte[] localBindingsBytes =
// System.out.println("ChannelBinding hash: "
// + getHexBytes(localBindingsBytes));
}
if (context.getCredDelegState())
if (context.getMutualAuthState())
if (context.getReplayDetState())
if (context.getSequenceDetState())
if (context.getIntegState())
if (context.getConfState())
byte[] temp = new byte[4];
if (context.getCredDelegState()) {
// Cannot use '\"' instead of "\"" in constructor because
// it is interpreted as suggested length!
}
/*
* Write 1 in little endian but in two bytes
* for DlgOpt
*/
/*
* Write the length of the delegated credential in little
* endian but in two bytes for Dlgth
*/
"Incorrect messsage length");
}
}
/**
* Called on the acceptor side when reading an InitSecContextToken.
*/
// XXX Passing in Checksum is not required. byte[] can
// be passed in if this checksum type denotes a
// raw_checksum. In that case, make Checksum class krb5
// internal.
int pos = 0;
"No cksum in AP_REQ's authenticator");
throw ge;
}
"Incorrect checksum");
}
// Ignore remote channel binding info when not requested at
// local side (RFC 4121 4.1.1.2: the acceptor MAY ignore...).
//
// All major krb5 implementors implement this "MAY",
// and some applications depend on it as a workaround
// for not having a way to negotiate the use of channel
// binding -- the initiator application always uses CB
// and hopes the acceptor will ignore the CB if the
// acceptor doesn't support CB.
if (localBindings != null) {
byte[] remoteBindingBytes = new byte[CHECKSUM_BINDINGS_SIZE];
byte[] noBindings = new byte[CHECKSUM_BINDINGS_SIZE];
byte[] localBindingsBytes =
"Bytes mismatch!");
}
} else {
"Token missing ChannelBinding!");
}
}
/*
* XXX
* if ((checksumBytes[24] != (byte)0x01) &&
* (checksumBytes[25] != (byte)0x00))
*/
if (useNullKey(cipherHelper)) {
getDelegatedCreds()[0];
} else {
try {
} catch (KrbException e) {
} else {
throw e;
}
}
}
}
}
// check if KRB-CRED message should use NULL_KEY for encryption
boolean flag = true;
// for "newer" etypes and RC4-HMAC do not use NULL KEY
flag = false;
}
return flag;
}
}
return delegCreds;
}
// Only called by acceptor
// default for cred delegation is false
context.setCredDelegState(true);
// default for the following are true
context.setMutualAuthState(false);
}
context.setReplayDetState(false);
}
context.setSequenceDetState(false);
}
context.setConfState(false);
}
context.setIntegState(false);
}
}
}
if (addr instanceof Inet4Address)
else if (addr instanceof Inet6Address)
return (addressType);
}
if (addressBytes != null) {
switch (addressType) {
case CHANNEL_BINDING_AF_INET:
"Incorrect AF-INET address length in ChannelBinding.");
}
return (addressBytes);
case CHANNEL_BINDING_AF_INET6:
"Incorrect AF-INET6 address length in ChannelBinding.");
}
return (addressBytes);
default:
"Cannot handle non AF-INET addresses in ChannelBinding.");
}
}
return null;
}
throws GSSException {
byte[] initiatorAddressBytes = null;
if (initiatorAddress != null) {
}
byte[] acceptorAddressBytes = null;
if (acceptorAddress != null) {
}
if (appDataBytes != null) {
}
int pos = 0;
pos += 4;
if (initiatorAddressBytes != null) {
pos += 4;
} else {
// Write length 0
pos += 4;
}
pos += 4;
if (acceptorAddressBytes != null) {
pos += 4;
} else {
// Write length 0
pos += 4;
}
if (appDataBytes != null) {
pos += 4;
} else {
// Write 0
pos += 4;
}
try {
} catch (NoSuchAlgorithmException e) {
"Could not get MD5 Message Digest - "
+ e.getMessage());
}
}
}