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 8301333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:54:04+00:00 2026-06-08T16:54:04+00:00

We are using standard Java/SAAJ features to create SOAP messages and perform web service

  • 0

We are using standard Java/SAAJ features to create SOAP messages and perform web service (WS) calls. So far, communication has been unecrypted across HTTP transport and calling a WS on the endpoint has worked fine using this approach:

SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
SOAPConnection con = scf.createConnection();
URL endpoint = new URL(endpointUrl); // configured HTTP URL

// "message" is passed as parameter (a SOAPMessage object)
SOAPMessage response = con.call(message, endpoint);
con.close();

Now our clients wants us to encrypt all traffic using Blowfish. I know I can encrypt arbitrary data using the following simple approach (this example just uses a random secret key):

KeyGenerator kgen = KeyGenerator.getInstance("Blowfish");
SecretKey skey = kgen.generateKey();
byte[] raw = skey.getEncoded();
SecretKeySpec skeySpec = new SecretKeySpec(raw, "Blowfish");

Cipher cipher = Cipher.getInstance("Blowfish");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
String inputString = "This is just an example";
byte[] encrypted = cipher.doFinal(inputString.getBytes());

Cipher decCipher = Cipher.getInstance("Blowfish");
decCipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] decrypted = decCipher.doFinal(encrypted);

assertEquals(inputString, new String(decrypted));

However, the missing link is: How do I put these two pieces together so that I can encrypt the payload using Blowfish and decrypt it upon receiving the response?

The standard facilities Java provides (SOAPMessage, SOAPConnection and the likes) do not seem to support any encryption at all. I have seen that Spring’s WebServiceTemplate supports ClientInterceptor instances which may help with that. However, I would have to rewrite our WS code to use spring-ws, then. And I have not yet found an example in their reference docs which explains how to do this kind of encryption with spring-ws.

Am I missing some easy way to encrypt the communication? If yes, what is it? If not, which good options exist to achieve what the client is asking for?

Update: using HTTPS as secure transport is not an option.

Thanks a lot for your help.

  • 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-08T16:54:07+00:00Added an answer on June 8, 2026 at 4:54 pm

    The article is quite long, so it is difficult to summarize here, but you may want to use Web Services Security, and IBM has a great article on that.

    http://www.ibm.com/developerworks/java/library/j-jws5/index.html

    But, you will have a couple of issues, one is key exchange, for Blowfish, as it needs the same key on the client and server-side, so you risk someone intercepting the key unless you can walk it over on a jump drive for example.

    You may want to look at the data and see what parts needs to be encrypted, then you can use RSA to encrypt the symmetric key, pass that as a parameter in your SOAP service, and that key is used to encrypt whichever fields needs to be protected.

    By using a public key encryption to do this you can change the Blowfish key on every call, and the key exchange is still secure, as the private key (on the server) is needed to recover the key.

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

Sidebar

Related Questions

I have a fairly standard Java EE6 web application using JPA 2 with dependency
I'm trying to create a loggers hierarchy in my application. (I'm using standard java
I have a Java web-app using standard web.xml and servlets. At the moment, I'm
I would create Java standard application using spring framework but all the examples I
Im using the standard java ws implementation shipped with e.g. java6 (javax.jws.*). I have
We had been using java standard keystore ( $JAVA_HOME/jre/lib/security/cacerts ) as the trusted store
I am making a simple FTP client in Java using standard Java sockets. I
The following XML snippet is parsable using standard XML lib (tried with Java and
So the original problem is that we run an industry standard java based web
Using the standard java logging API (import java.util.logging.Logger), after the construction: Logger l =

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.