HELP!! "Checksum failed" & "Integrity check on decrypted field failed "

I hope this is a newbie question for you guys out there since I've been googling for a solution for days but no luck so far.

I am trying to learn JAAS programming and got started from a very simple example where a client authenticate to kerberos and send messages to a echo server. I am using kerberos from MIT and it's running on a linux box. "krb5.conf" is as following:

[libdefaults]

ticket_lifetime = 600

default_realm = AMAIL.COM

#default_tkt_enctypes = des-cbc-crc

#default_tgs_enctypes = des-cbc-crc

#permitted_enctypes = des-cbc-crc des-cbc-md5

[realms]

AMAIL.COM ={

kdc = amail1.amail.com:88

admin_server = amail1.amail.com:749

default_domain = amail.com

}

[domain_realm]

.amail.com = AMAIL.COM

amail.com = AMAIL.COM

[logging]

kdc = FILE:/var/log/krb5kdc.log

admin_server = FILE:/var/log/kadmin.log

default = FILE:/var/log/krb5lib.log

the configuration file for the echo server and client is as following:

GSSClient{

com.sun.security.auth.module.Krb5LoginModule required debug=true;

};

GSSServer{

com.sun.security.auth.module.Krb5LoginModule required

storeKey=true debug=true;

};

The problems is when I run the client programme, the server outputs :

"GSSException: Failure unspecified at GSS-API level (Mechanism level: Checksum failed)"

However, when I uncomment "#permitted_enctypes = des-cbc-crc des-cbc-md5 " in krb5.conf, the server outputs:

"GSSException: Failure unspecified at GSS-API level (Mechanism level: Integrity check on decrypted field failed (31))"

I can see that I authenticated to kerberos successfully but the server fails when exchanging tokens with the client. Do I need to do any configurations on the echo server side or even the client side( there's a krb5.ini file in the windows folder and I modified it to have the same content as krb5.conf and I found varies sites mentioned keytab files but I am using username and password to authenticate client and server to kerberos)? I've tried to run the server and client on both Java 1.5 and Java 1.6 but got the same errors. Following is the full output of the server:

Debug istrue storeKeytrue useTicketCachefalse useKeyTabfalse doNotPromptfalse ticketCache isnull isInitiatortrue KeyTab isnull refreshKrb5Config isfalse principal isnull tryFirstPass isfalse useFirstPass isfalse storePass isfalse clearPass isfalse

[Krb5LoginModule] user entered username: root

Using builtindefault etypesfor default_tkt_enctypes

default etypesfor default_tkt_enctypes: 3 1 23 16 17.

Acquire TGT using AS Exchange

Using builtindefault etypesfor default_tkt_enctypes

default etypesfor default_tkt_enctypes: 3 1 23 16 17.

>>> KrbAsReq calling createMessage

>>> KrbAsReq in createMessage

>>> KrbKdcReq send: kdc=10.10.10.1 UDP:88, timeout=30000, number of retries =3, #bytes=139

>>> KDCCommunication: kdc=10.10.10.1 UDP:88, timeout=30000,Attempt =1, #bytes=139

>>> KrbKdcReq send: #bytes read=492

>>> KrbKdcReq send: #bytes read=492

>>> EType: sun.security.krb5.internal.crypto.DesCbcMd5EType

>>> KrbAsRep cons in KrbAsReq.getReply root

Using builtindefault etypesfor default_tkt_enctypes

default etypesfor default_tkt_enctypes: 3 1 23 16 17.

principal is root@AMAIL.COM

EncryptionKey: keyType=3 keyBytes (hex dump)=0000: FD 13 B5 83 FB 01 34 FB

EncryptionKey: keyType=1 keyBytes (hex dump)=0000: FD 13 B5 83 FB 01 34 FB

EncryptionKey: keyType=23 keyBytes (hex dump)=0000: 32 91 53 F5 60 EB 32 9C0E 1D EE A5 5E 88 A1 E9 2.S.`.2.....^...

EncryptionKey: keyType=16 keyBytes (hex dump)=0000: F8 3D E5 C2 C1 9D 2A 6752 68 70 54 D5 E9 D0 58 .=....*gRhpT...X

0010: 85 8F 5B BF F4 91 23 B9

EncryptionKey: keyType=17 keyBytes (hex dump)=0000: E6 96 AD 05 B0 43 07 2386 99 D6 DC 0E 7B 60 39 .....C.#......`9

Added server's keyKerberos Principal root@AMAIL.COMKey Version 0key EncryptionKey: keyType=3 keyBytes (hex dump)=

0000: FD 13 B5 83 FB 01 34 FB

[Krb5LoginModule] added Krb5Principal root@AMAIL.COM to Subject

Added server's keyKerberos Principal root@AMAIL.COMKey Version 0key EncryptionKey: keyType=1 keyBytes (hex dump)=

0000: FD 13 B5 83 FB 01 34 FB

[Krb5LoginModule] added Krb5Principal root@AMAIL.COM to Subject

Added server's keyKerberos Principal root@AMAIL.COMKey Version 0key EncryptionKey: keyType=23 keyBytes (hex dump)=

0000: 32 91 53 F5 60 EB 32 9C0E 1D EE A5 5E 88 A1 E9 2.S.`.2.....^...

[Krb5LoginModule] added Krb5Principal root@AMAIL.COM to Subject

Added server's keyKerberos Principal root@AMAIL.COMKey Version 0key EncryptionKey: keyType=16 keyBytes (hex dump)=

0000: F8 3D E5 C2 C1 9D 2A 6752 68 70 54 D5 E9 D0 58 .=....*gRhpT...X

0010: 85 8F 5B BF F4 91 23 B9

[Krb5LoginModule] added Krb5Principal root@AMAIL.COM to Subject

Added server's keyKerberos Principal root@AMAIL.COMKey Version 0key EncryptionKey: keyType=17 keyBytes (hex dump)=

0000: E6 96 AD 05 B0 43 07 2386 99 D6 DC 0E 7B 60 39 .....C.#......`9

[Krb5LoginModule] added Krb5Principal root@AMAIL.COM to Subject

Commit Succeeded

Found keyfor root@AMAIL.COM(16)

Found keyfor root@AMAIL.COM(23)

Found keyfor root@AMAIL.COM(17)

Found keyfor root@AMAIL.COM(1)

Found keyfor root@AMAIL.COM(3)

>>> GSSServer starts... Waitingfor incoming connection

GSSException: Failure unspecified at GSS-API level (Mechanism level: Integrity check on decrypted field failed (31))

at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:741)

Entered Krb5Context.acceptSecContext with state=STATE_NEW

>>> EType: sun.security.krb5.internal.crypto.DesCbcCrcEType

>>>crc32: 8bc7ac62

>>>crc32: 10001011110001111010110001100010

at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:323)

at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:267)

at GSSServer.run(GSSServer.java:130)

at java.security.AccessController.doPrivileged(Native Method)

at javax.security.auth.Subject.doAs(Subject.java:337)

at GSSServer.startServer(GSSServer.java:91)

at GSSServer.main(GSSServer.java:66)

Caused by: KrbException: Integrity check on decrypted field failed (31)

at sun.security.krb5.internal.crypto.DesCbcEType.decrypt(DesCbcEType.java:154)

at sun.security.krb5.internal.crypto.DesCbcCrcEType.decrypt(DesCbcCrcEType.java:30)

at sun.security.krb5.internal.crypto.DesCbcCrcEType.decrypt(DesCbcCrcEType.java:77)

at sun.security.krb5.EncryptedData.decrypt(EncryptedData.java:168)

at sun.security.krb5.KrbApReq.authenticate(KrbApReq.java:267)

at sun.security.krb5.KrbApReq.<init>(KrbApReq.java:134)

at sun.security.jgss.krb5.InitSecContextToken.<init>(InitSecContextToken.java:79)

at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:724)

... 7 more

Someone please help as I've already spent a week on searching a solution for this problem. Thanks in advance!!

[8972 byte] By [yulu81a] at [2008-2-7]
# 1

Hi,

Please a question

Did you manage to find a way to work it out ?

I'm struggling with the same problem on a new sytem config

It's funny because one one I got a rc4 encryption type trouble,

http://forum.java.sun.com/thread.jspa?threadID=5130483&messageID=9468078#9468078

I can't find a way to turn around so while waiting for a help

I decided to go back from zero and I moved to a second network (thanks i got some few computers available for my tests ) and this time i run in the same problem as your..

Seems this always just leads us to problems...

Strange Sun Java security team just won't do anything to help us deploy quite easily on one of the most widely-spread platform ( despite we don't like them that much it's MS servers (2000 and 2003) )

Anyway if one could help...

henoc.aa at 2007-7-15 > top of java,Security,Kerberos & Java GSS (JGSS)...
# 2
I had this error when I had mixed up SPN and accounts... the client was requesting an service ticket for one SPN, but my service was accepting credentials & using the keytab from another account (that didn't have that SPN registered).
Rockwindera at 2007-7-15 > top of java,Security,Kerberos & Java GSS (JGSS)...
# 3

thanks for your help, but i got one question...

I checked but i can't see how this could happen.. ?

both my computers (server and client) are on windows, the AD is a windows 2003 server

I've put the server's keytab on the server and link it in the jaas configuration file

and i specify the login for the client by meyself,

Was your service running on windows ?

I must have missed something but what ?

I wonder if all this doesn"t failed because SUN somehow had designed

this for unix/Windows interoperability and it is waiting for merged keytabs

(unix style) but on windows there seems to be NO MERGING tool

and so the jvm just can't do it's work when we are dealing in a all windows environnement ?

Is this the point ?

Can somebody who succeeded in this stuff on windows could be kind enough

to give us step by step what he dis with wich tools on wich computer ?

(the AD, the Server or the client ?)

This will be fine...

henoc.aa at 2007-7-15 > top of java,Security,Kerberos & Java GSS (JGSS)...
# 4
Hi, yulu81!How did you solve this problem? I got the same trouble!
Andremona at 2007-7-15 > top of java,Security,Kerberos & Java GSS (JGSS)...
# 5

What encryption type have you configured to use at the client-end ? Please check and ensure you have configured the encryption type correctly.

Refer to the Java GSS programming guide that includes sample code :

http://java.sun.com/javase/6/docs/technotes/guides/security/jgss/lab/index.html

Seema

Seema-1a at 2007-7-15 > top of java,Security,Kerberos & Java GSS (JGSS)...
# 6
I'm sorry, but could anybody tell me accurate desicion of this problem. I've absolutally such errors, as described in first message of this topic.I'm using DES-CBC-MD5 encryption, so all tickets from server (win 2000 serv) are encrypted in DES-CBC-MD5.
Andremona at 2007-7-15 > top of java,Security,Kerberos & Java GSS (JGSS)...