Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2005

Tip: Looking for answers? Try searching our database.

Set a KeyStore as the system property javax.net.ssl.trustStore value

Thread view: 
oziris - 29 Sep 2005 15:46 GMT
[CC from comp.lang.java.security]

Hi,

Here the deal.
- I know how to create a KeyStore with KeyStore.getInstance(), etc.
- I know how to set a keystore file (.keystore) as the value of the
system property javax.net.ssl.trustStore with System.setProperty().

Is there a mean to set a KeyStore object as the this property value?

My application has only access to the certificate files and I would
like dynamically create a KeyStore, set the above property with in
order to create a SSL session only with the instruction

m_sslSession = new URL("https://localhost:443/soap/servlet/rpcrouter");

so without using SSLContext and SSLSocketFactory.

Thanks in advance even for any minor births of ideas you could have.

-o--
Roedy Green - 29 Sep 2005 16:04 GMT
>Is there a mean to set a KeyStore object as the this property value?

when you dynamically change a system property you are giving the
property a string value, so obviously you can't set a property to an
object.  It might be set to a file name, an URL etc.  But of course
the meaning of the property is defined and if you put something other
than the original sort of value in there, it won't work.

Sun has a habit of giving a two or three techniques to register a
plug-in replacement: a system property, a magic jar entry, and a
static  register method.  Perhaps you should look for one of the other
two.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

oziris - 29 Sep 2005 16:47 GMT
thanks for your help roedy. Could you precise what mean "static
register method"? That seams to be a suitable solution.

-o--
Roedy Green - 30 Sep 2005 00:05 GMT
>thanks for your help roedy. Could you precise what mean "static
>register method"? That seams to be a suitable solution.

For example in JCE if you have wrote a new provider class you can
register it by called a method with a name something
registerNewJCEProvider ( JCEProviderInterface j );

I thought there might be an equivalent for your problem.

You can register new encodings with a scheme like this:
A charset provider identifies itself with a provider-configuration
file named java.nio.charset.spi.CharsetProvider in the resource
directory META-INF/services. The file should contain a list of
fully-qualified concrete charset-provider class names, one per line. A
line is terminated by any one of a line feed ('\n'), a carriage return
('\r'), or a carriage return followed immediately by a line feed.
Space and tab characters surrounding each name, as well as blank
lines, are ignored. The comment character is '#' ('\u0023'); on each
line all characters following the first comment character are ignored.
The file must be encoded in UTF-8.

Preferences has  a plug-in registration scheme that works like this:
If a PreferencesFactory implementation class file has been installed
in a jar file that is visible to the system class loader, and that jar
file contains a provider-configuration file named
java.util.prefs.PreferencesFactory in the resource directory
META-INF/services, then the first class name specified in that file is
taken.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.