Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

does SSLEngine unwrap produce destination buffer data when handshaking?

843811Jan 1 2008 — edited Jan 3 2008
Hi,

first, happy new year everyone!

The javadoc for
SSLEngine.unwrap(ByteBuffer src,
                 ByteBuffer[] dsts,
                 int offset,
                 int length)
writes "Depending on the state of the SSLEngine, this method may consume network data +*without producing any application data*+ (for example, _it may consume handshake data_.)".

Does this mean that no dsts buffer data is written when in handshaking phase? I have a 0 byte dsts ByteBuffer and I get an SSLEngineResult.Status BUFFER_OVERFLOW after the first call to unwrap(myreceiveddata). The received data seems to be proper handshake data. So is this javadoc entry wrong? It is here:
http://java.sun.com/javase/6/docs/api/javax/net/ssl/SSLEngine.html#unwrap(java.nio.ByteBuffer, java.nio.ByteBuffer[], int, int).

Also, the intro to class SSLEngine has a code snippet for the SSLEngineResult of SSLEngine.unwrap(). For the buffer underflow case there is a check "if (netSize > dst.capacity())". Is this correct? If yes, what's the logic? Link:
http://java.sun.com/javase/6/docs/api/javax/net/ssl/SSLEngine.html

Thanks,

Lars
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 31 2008
Added on Jan 1 2008
9 comments
516 views