Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: java.security.ProviderException: Could not derive key

  1. #1
    Junior Member
    Join Date
    Apr 2018
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java.security.ProviderException: Could not derive key

    Hi,

    I am calling Soap Based Web Services from an application which is deployed in J Boss server. Part of my code snippet is given below.

    Socket socket = new Socket();
    SocketAddress sockaddr = new InetSocketAddress("xxxx", 8080);
    socket.connect(sockaddr, 10000);
    Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(socket.getInetAddress(), 8080));
    SOAPMessage soapMessage = createSOAPRequest(username, password, soapAction);
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    soapMessage.writeTo(stream);
    String message = new String(stream.toByteArray(), "UTF-8");
    URL url = new URL(soapEndpointUrl);
    URLConnection connection = url.openConnection();
    HttpURLConnection httpConn = (HttpURLConnection)connection;
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    byte[] buffer = new byte[message.length()];
    buffer = message.getBytes();
    bout.write(buffer);
    byte[] b = bout.toByteArray();
    httpConn.setRequestProperty("Content-Length", String.valueOf(b.length));
    httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
    httpConn.setRequestProperty("SOAPAction", soapAction);
    httpConn.setRequestMethod("GET");
    httpConn.setDoOutput(true);
    httpConn.setDoInput(true);
    OutputStream outputStream = httpConn.getOutputStream();
    outputStream.write(b);
    outputStream.close();

    If I run this code as a standalone Java Program out of J Boss, it's working fine. But the same code is integrated in the main application and deployed in J Boss server is throwing with the below Exception. I am using jdk 1.8 and imported the respective certificate in jre/lib/security.

    Caused by: javax.net.ssl.SSLException: java.security.ProviderException: Could not derive key

    Caused by: java.security.ProviderException: Could not derive key
    at sun.security.ec.ECDHKeyAgreement.engineGenerateSec ret(ECDHKeyAgreement.java:133)
    at sun.security.ec.ECDHKeyAgreement.engineGenerateSec ret(ECDHKeyAgreement.java:163)
    at javax.crypto.KeyAgreement.generateSecret(KeyAgreem ent.java:648)
    at sun.security.ssl.ECDHCrypt.getAgreedSecret(ECDHCry pt.java:102)
    at sun.security.ssl.ClientHandshaker.serverHelloDone( ClientHandshaker.java:1061)
    at sun.security.ssl.ClientHandshaker.processMessage(C lientHandshaker.java:348)
    at sun.security.ssl.Handshaker.processLoop(Handshaker .java:1026)
    at sun.security.ssl.Handshaker.process_record(Handsha ker.java:961)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocke tImpl.java:1072)
    at sun.security.ssl.SSLSocketImpl.performInitialHands hake(SSLSocketImpl.java:1385)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLS ocketImpl.java:1413)
    ... 85 common frames omitted
    Caused by: java.security.InvalidAlgorithmParameterException: null

    Please help me in find out the root cause and solution.

    Thanks,
    Srinivas

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: java.security.ProviderException: Could not derive key

    Caused by: java.security.InvalidAlgorithmParameterException: null
    Is there a null value being used there?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2018
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java.security.ProviderException: Could not derive key

    Thanks for your reply.

    I am using the same build in both our local environment and UAT deployed J Boss. Local instance is working fine, but not UAT( which is firewalls enabled, but opened our urls and working my standalone java program here in UAT).

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: java.security.ProviderException: Could not derive key

    What about the null referenced in the error messages? Where is that?

    Also posted at: https://coderanch.com/t/692413/java/...ion-derive-key
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 1
    Last Post: April 3rd, 2014, 02:11 PM
  2. Homeland Security and Java
    By randylewiskemp in forum The Cafe
    Replies: 9
    Last Post: January 17th, 2013, 09:11 AM
  3. java.security.AccessControlException
    By aussiemcgr in forum Java Networking
    Replies: 7
    Last Post: December 30th, 2012, 01:41 AM
  4. want to implement security key feature in the software
    By javasabin in forum Member Introductions
    Replies: 2
    Last Post: January 8th, 2011, 01:52 AM

Tags for this Thread