Win a copy of Spring Boot in Practice this week in the Spring forum!

Pankaj Kr

+ Follow
since Sep 09, 2003
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pankaj Kr

Hi Folks,

I have written a Beanshell script to invoke any Ant task from any Beanshell script. Found it really useful in may day job and ended up writing an article about it. What do you think about the idea of executing Ant tasks from Beanshell scripts? About the script that I wrote? About the article?

Do you think this could be useful to you in any way?

Pankaj Kumar
17 years ago
Check out ssltool utility of JSTK for a Java equivalent of OpenSSL's s_client.
18 years ago
Here is a definition of Web Service taken fromW3C Web Services Glossary:

A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP-messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.

As per this definition, a WSDL based description of the interface is mandatory.
18 years ago
Another question for RMH:
Some people see Web Services as a better way to develop distributed Object Oriented architectures.
Some people see Web Services only for Service Oriented Architectures.
Certain aspects of Web Services, such as use of HTTP as transport and XML for payload, make it attractive for distributed OOA systems. At the same time, lack of capabilities such as Session, attributes/properties and reliable messaging, makes it hard to build rich distributed OOA systems.
How do you see the future in this regard?
18 years ago
This is question fot RMH.
I often hear people say that Security is a key obstacle in wide spread adoption of Web Services.
It was not until Netscape introduced SSL and HTTPS that commerce on the Web flourished. And despite the criticism of PKI and HTTPS, these technologies solve the problem of Web security in most people's mind.
SSL and other Transport oriented security mechanisms, such as HTTP-Basic and HTTP-Digest authentication, though applicable to Web Services (atleast those involving SOAP over HTTP and not using content-aware routers), are not seen as ultimate solution to the Web Services Security problem. In the beginning, there was some talk of using message level security such as S/MIME, but I don't hear much about that now.
A lot of people expect WS-Security, a specification originally authored by IBM, Microsoft and VeriSign, and now being standardized at OASIS, to solve the issue of Web Services Security once and for all.
That brings me to my questions:
1. Do you think that WS-Security is the right answer to Web Services Security problem? If yes, why? If no, why? What are different forces at work here?
2. What would be a good way to incorporate WS-Security in J2EE Web Services? Are the JAX-RPC handlers the right answer? or should this be pushed down to the J2EE container?
Best Regards,
Pankaj Kumar.
18 years ago
Not having worked with .Net, I am assuming that .Net takes the private key and the public key (as part of the certificate) from Windows certificate store (the same one that you access from IE, Outlook Express and other Windows applications).
If this is so, then you can easily export the certificate (and hence the public key), in a DER or PEM (BASE64 encoded) format (In IE, do Tools --> Internet Options --> Content --> Certificates; then select the certificate and click on Export ). Once you have this, you can import the certificate in a Java keystore using keytool and use it within a Java program to verify the signature.
18 years ago

Originally posted by John Todd:
Do you mean people inside (lets say: inside Nkorea) unable to download products from java site?

No. But if they do download and use in their applications, they might be (depending on the country) breaking laws of their own country.
18 years ago
I quote from my book:

The policy file deafult_US_export.policy, archived within [signed]US_export_policy.jar, specifies the permissions allowed by US export laws. Policy file default_local.policy, archived within [signed]local_policy.jar, specifies permissions that can be freely imported worldwide.
If you are within the US and want to use a larger keysize (than the ones allowed by default_local.policy), you can download JCE Unlimited Strength Jurisdiction policy files from Sun's J2SE dowload page ...

18 years ago
What you want to do is to bypass (or customize) the validation of server certificate at your end!
This is certainly doable, but non-trivial. Try the following steps:
1. Write your own X509TrustManager (by subcalssing and supply passthru code for validation.
2. Use this trust manager for initializing a SSLContext object.
3. Retrieve a SocketFactory from this SSLContext object by calling getSocketFactory() method.
4. Supply this socket factory to the HttpsURLConnection.setDefaultSSLSocketFactory().
Now, your validation code will (should be!) called and you should be able to bypass the checks!
Let me know if this works. I haven't tried it myself so I would like to know if there is any caveat!
18 years ago
The industry practice, at this stage, is to hire a knowledgeable consultant!
18 years ago
Your numbers are quite close to my numbers ...
Well, encryption is compute-intensive and these numbers do not appear to be unreasonably large. Even if you support multiple users, it is unlikely that they will all be doing encryption at the same time.
To improve performance, you can try these:
1. Use BouncyCastle provider.
2. Use OpenSSL libraries through JNI. (in place of BouncyCastle). You can also try MS libraries if your application runs on Windows.
3. Buy faster CPU. Or even better, buy multi-CPU machines.
4. Buy special cryptographic accelerators.
None of these are really worth the effort unless you are sure that encryption delay is turning away paying customers.
18 years ago
I also ran the CipherTest program with BouncyCastle provider and the time to encrypt a 3MB file is around 1700 milli seconds. With the default provider, it is more than 2600 milli seconds. So, the BouncyCastle provider is certainly more efficient.
And yes, BouncyCastle s/w is free (but read the license for details).
18 years ago
Not sure what you mean by "lot of time"? What CPU does your machine have? What is the input buffer size? what is the observed time?
By the way, I wrote this simple program to take the timing measurements:
And got the following output with a 47KB file:

With an input file of 3MB, the output is:

I have a 900 MHz Athlon machine and am running JDK1.4.1.
How do these numbers compare with your observations?
18 years ago
You can take some timings within your code to get an idea of which operation is having maximum performance overhead -- is it the cipher initialization or the actual encryption? Do you need to do the initialization for every call? (this would be the case if secret key changes but looking at the code I get a feeling that this may be shared).
You can also try out some alternative libraries -- such as the one from BouncyCastle or one from OpenSSL (in this case, you will have to use JNI to invoke the encryption methods).
18 years ago