-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Marcus,
On 4/7/2009 9:49 AM, Marcus Carlson wrote:
> I've developed an application that sets up an encrypted socket in a
> separate thread when running init() on my servlet. However, I have no
> idea how to set up the truststore and keystore just for this
> application. Is this possible at all?
I think this is possible, though I've never actually wrote code to open
my own TrustStore file. Maybe this can get you on the right path: you
have to flip everything around that you are probably already doing, like
just doing "new SSLServerSocket(...)". Instead, you have to create a new
SSLContext and SSLSocketFactory, etc.:
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.TrustManager;
SSLContext sc = SSLContext.getInstance("SSL"); // or TLS?
KeyManager keyMgr = ???;
TrustManager trustMgr = ???;
sc.init(keyMgr, trustMgr, new java.security.SecureRandom());
SSLSocketFactory factory = sc.getSocketFactory();
SSLServerSocket socket = (SSLServerSocket)factory.createSocket(...);
I hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAknbsUAACgkQ9CaO5/Lv0PDKCQCeMlv/fAI3zhDTW91Np3s5Bceq
xZYAoJhdErGUFnytVMLyxK4RXEU00a6w
=4y47
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]