posted 16 years ago
Hi All,
I need a clarrification on InitialContext properties:
weblogic.jndi.Environment env = new weblogic.jndi.Environment();
env.setProviderUrl(jndi_url);
System.setProperty("weblogic.StdoutDebugEnabled", rb.getString("Debug.StdoutDebugEnabled"));
InputStream key = new FileInputStream(rb.getString("SSL.KeyStore.Key"));
InputStream cert = new FileInputStream(rb.getString("SSL.KeyStore.Cert"));
env.setSSLClientCertificate(new InputStream[] {key, cert});
env.setSSLClientKeyPassword(rb.getString("SSL.KeyStore.KeyPassword"));
Context ctx = env.getInitialContext();
I am converting above code into vendor neutral(removing weblogic related stuff)
Hashtable props = new Hashtable();
props.put(Context.PROVIDER_URL,jndi_url);
props.put(Context.SECURITY_PRINCIPAL,rb.getString("SSL.KeyStore.Cert")); // ERROR, it's failing here
props.put(Context.SECURITY_CREDENTIALS,rb.getString("SSL.KeyStore.KeyPassword"));
Context ctx = new InitialContext(props);
Here I dont understand one thing, in the first part of the code, they are passing key and cert values in setSSLClientCertificate method, in the second part of code do i need to pass those values to any method ? I did some reading on this, we need to pass user releated information into SECURITY_PRINCIPAL constant. how is it looks like ?
Now my question is, can we reuse Key/Cert or do i need to have entirely new set of code ? Requesting to clarify.
Thanks,
Kumar
Ravi Kumar
SCWCD 5 - 89%, SCJP 1.4 - 90%