[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] Problem with PKCS12 writeTo(...)



Hi,

I'm having a problem with the PKCS12 writeTo method, using it to write
between a server and a client.  Although I'm using an SSLServerSocket
and an SSLSocket, I don't think the problem arises from this, since it
persists using ordinary Sockets.  The difficulty is that, on the server
side, the following line (in which s is a reference to an SSLSocket and
client is the PKCS12 object) appears to execute OK:

client.writeTo(s.getOutputStream()); 

Usually it works fine.  But it occasionally happens that nothing seems
to arrive at the client end, so the client just blocks on the line:

PKCS12 pkcs=new PKCS12(cs.getInputStream());

The enclosing code on the server side is:

...
debug("Writing the PKCS12 object down the connection");
client.writeTo(s.getOutputStream());
debug("Closing the socket");
s.close();
debug("Closed the socket");
...

And on the client side:

debug("Receiving the PKCS12 object");
PKCS12 pkcs=new PKCS12(cs.getInputStream());
debug("Received the PKCS12 object OK");
pkcs.decrypt(password.toCharArray());
keyPairCollected=true;

Could it be that the OutputStream needs a flush() before the socket is
closed on the server side?  If so, how can one do this?

Any comments much appreciated!

Thanks,

Tom Runnacles
--
Mailinglist-archive at http://jcewww.iaik.tu-graz.ac.at/mailarchive/iaik-jce/maillist.html

To unsubscribe send an email to listserv@iaik.tu-graz.ac.at with the folowing content: UNSUBSCRIBE iaik-jce