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

  • SEARCH
  • Home
  • 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 8163011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:55:19+00:00 2026-06-06T18:55:19+00:00

I have to establish a TLS connection to a remote server with a preshared

  • 0

I have to establish a TLS connection to a remote server with a preshared key. I’m currently using PSKTlsClient from Bouncycastle. My initialization code looks like that:

 socket_ = new Socket(address,port);            
 tlsHandler_ = new TlsProtocolHandler(socket_.getInputStream(),socket_.getOutputStream());           
 pskTlsClient_ = new PSKTlsClient(tlsPskInfo_);            
 tlsHandler_.connect(pskTlsClient_);

However Im getting this stacktrace:

java.io.IOException: Internal TLS error, this could be an attack
at org.bouncycastle.crypto.tls.TlsProtocolHandler.failWithError(Unknown Source)
at org.bouncycastle.crypto.tls.TlsProtocolHandler.safeReadData(Unknown Source)
at org.bouncycastle.crypto.tls.TlsProtocolHandler.connect(Unknown Source)
at common.network.Transport.PskTlsClientSocket.connect(PskTlsClientSocket.java:61)

I also got a TLS Certificate in the message, where the PSK is transmitted, but I’m somehow stuck how to establish this connection. Do you have any suggestion how to proceed?

  • 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. Editorial Team
    Editorial Team
    2026-06-06T18:55:20+00:00Added an answer on June 6, 2026 at 6:55 pm

    Solved. The problem was, that in the java bouncycastle library, the process server certificate method wasn’t implemented and always throws an internal error. So i had to implement this and all worked fine after that.

    Edit:
    In TlsPSKKeyExchange.java change the following method to:

    public void processServerCertificate(Certificate serverCertificate) throws IOException
    {
        SubjectPublicKeyInfo subPubKeyInfo = serverCertificate.certs[0].getTBSCertificate().getSubjectPublicKeyInfo();
        RSAPublicKey pubKey = RSAPublicKey.getInstance(subPubKeyInfo.getPublicKey());
        rsaServerPublicKey = new RSAKeyParameters(false,pubKey.getModulus(),pubKey.getPublicExponent());
    }
    

    The first public key in the first certificate is used for the RSA encryption.

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

Sidebar

Related Questions

I have the following code that's trying to establish a connection to a remote
I am trying to establish a long lived connection using jQuery. I have a
When I establish a socket connection to a server, both client and server have
I have some java-app, and i want to establish a connection to some https
I know to start using areas, you have to establish parent/child relationships. I have
I have a short jsp page that tries to establish the connection to the
I have Installed SQL server 2008 I want to connect to it using c#
I have an application which will establish DB connection with MySQL and execute queries.
I have the following code in my configuration file to establish the root path
I found that when I use HttpWebRequest to establish SSL\TLS connection, it takes near

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.