Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 110331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:12:37+00:00 2026-05-11T02:12:37+00:00

At the moment I am getting a KrbException: Integrity check on decrypted field failed

  • 0

At the moment I am getting a KrbException: Integrity check on decrypted field failed (31) with my GSS demo application (on the server side). Now I am looking for the reason for this. I have the suspicion, that it comes from the fact that

  1. the client and the server application run on the same machine (localhost) and/or
  2. the SPN was generated for another machine (computer)

The second means that the service principal was generated for a machine xxx0815.domain.net, so the SPN is HTTP/xxx0815.domain.net@DOMAIN.NET. And my machine is not that one, but I have got the keytab file so that the server’s login method succeeds.

Do I suspect correctly or am I making another mistake?

Server configuration and source code:
server.conf

Server {      com.sun.security.auth.module.Krb5LoginModule          required          isInitiator=false          doNotPrompt=true          useKeyTab=true          keyTab='gssdemo.keytab'          storeKey=true          principal='HTTP/xxx0815.domain.net@DOMAIN.NET'          debug=true;  }; 

GSSServer.java (omitted the boilerplate stuff)

    GSSManager manager = GSSManager.getInstance();     GSSName serverName = manager.createName(getServerName(), null);     GSSCredential serverCred = manager.createCredential(serverName,                                                         GSSCredential.INDEFINITE_LIFETIME,                                                         createKerberosOid(),                                                         GSSCredential.ACCEPT_ONLY);     GSSContext context = manager.createContext(serverCred);     System.out.println('Context created successfully. Now incoming tokens could be accepted.');      ServerSocket serverSocket = new ServerSocket(55555);     SocketAdapter ca = new SocketAdapter(serverSocket.accept());      while (!context.isEstablished()) {         byte[] inToken = ca.readToken();         byte[] outToken = context.acceptSecContext(inToken, 0, inToken.length);          if (outToken != null) {             ca.sendToken(outToken);         }     }      System.out.println('Context established');     System.out.println('Connected user is: ' + context.getSrcName());     context.dispose(); 

Client configuration and source code:
client.conf

Client {     com.sun.security.auth.module.Krb5LoginModule         required         useTicketCache=true         debug=true; }; 

GssClient.java (boilerplate omitted)

    GSSManager manager = GSSManager.getInstance();     GSSName clientName = manager.createName(getClientName(), null);     GSSCredential clientCred = manager.createCredential(clientName,                                                         8 * 3600,                                                         createKerberosOid(),                                                         GSSCredential.INITIATE_ONLY);     GSSName serviceName = manager.createName('HTTP/xxx0815.domain.net@DOMAIN.NET', null);      GSSContext context = manager.createContext(serviceName,                                                createKerberosOid(),                                                clientCred,                                                GSSContext.DEFAULT_LIFETIME);     context.requestMutualAuth(true);     context.requestConf(false);     context.requestInteg(true);      System.out.println('Establishing context');     SocketAdapter ca = new SocketAdapter(new Socket('localhost', 55555));      byte[] inToken = new byte[0];     while (true) {         byte[] outToken = context.initSecContext(inToken, 0, inToken.length);          if (outToken != null) {             ca.sendToken(outToken);         }          if (context.isEstablished()) {             break;         }          inToken = ca.readToken();     }      System.out.println('Context established: ' + context.isEstablished());      context.dispose(); 

I have checked the outgoing and incoming network data – it’s the same on both sides so I can rule out a problem there (I have BASE64-encoded the output and then just send it through the streams. I think there is not much that can go wrong there…).

The exception I get:

Caused by: 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)     at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:323)     at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:267)     at de.westlb.mrm.sandbox.gss.GssServer.acceptAndEstablish(GssServer.java:88)     at de.westlb.mrm.sandbox.gss.GssServer.run(GssServer.java:66)     ... 4 more 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.DesCbcMd5EType.decrypt(DesCbcMd5EType.java:33)     at sun.security.krb5.internal.crypto.DesCbcEType.decrypt(DesCbcEType.java:125)     at sun.security.krb5.internal.crypto.DesCbcMd5EType.decrypt(DesCbcMd5EType.java:33)     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)     ... 8 more 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:12:37+00:00Added an answer on May 11, 2026 at 2:12 am

    If the integrity check fails that suggests that the data is not being sent / received correctly (that or this is an incorrect error message). In other words some modification has occurred.

    I know you say you have checked that the sent data matches the received data at the network level, however are you sure it is not corrupted prior to send, or after receipt? I would suggest you review your code for this first.

    edit: In answer to your question, a service principal (really, any ticket) can be bound to a specific machine, but this is normally done in terms of IP address. In any case something like that should result in a different higher level error.

    The error you’re getting sounds like it is having trouble decrypting the ticket in the first place. A possible cause of that is that it is using the wrong key, which may be related to your copying the keytab. A wrong key can also be caused by using the wrong ticket (as kerberos basically provides a key management protocol). Is it possible you have cached an old/incorrect ticket?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 251k
  • Answers 251k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It seems to me you're loading an ELF image and… May 13, 2026 at 9:28 am
  • Editorial Team
    Editorial Team added an answer I don't see a problem with looping, just make sure… May 13, 2026 at 9:28 am
  • Editorial Team
    Editorial Team added an answer The initialization of the c_cflags looks wrong, by using bitwise… May 13, 2026 at 9:28 am

Related Questions

I am getting a date field from the database in one of my variables,
My Web Service uses another API to obtain data. I cache the data, clean
When using fluent configuration to specify fluent mappings like this: .Mappings(m => m.FluentMappings.AddFromAssembly(typeof(UserMapping).Assembly)) At
I'm behind a firewall at work at the moment and I was testing something

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.