Re: Problem to start an SSL session

2006-08-12 Thread Krishna M Singh
Hi This is not an issue. U are using a non-blocking socket and thus u need to have a select call and put this socket on readable list and call SSL_read whenever this sockets becomes readable.. Other way round, make ur socket fd non-blocking (ioctl call) and than it will return after the connectio

Re: Problem to start an SSL session

2006-08-12 Thread Frank Büttner
Krishna M Singh schrieb: > Hi > > This is not an issue. U are using a non-blocking socket and thus u > need to have a select call and put this socket on readable list and > call SSL_read whenever this sockets becomes readable.. > Other way round, make ur socket fd non-blocking (ioctl call) and tha

RE: Problem to start an SSL session

2006-08-12 Thread David Schwartz
> Krishna M Singh schrieb: > > Hi > > > > This is not an issue. U are using a non-blocking socket and thus u > > need to have a select call and put this socket on readable list and > > call SSL_read whenever this sockets becomes readable.. > > Other way round, make ur socket fd non-blocking (ioct

Re: Problem to start an SSL session

2006-08-13 Thread Frank Büttner
David Schwartz schrieb: > So call it after. This is not an "error" but an indication, similar to > EWOULDBLOCK. It is telling you that the operation cannot complete without > blocking and you asked it not to block, so it can't complete now. When I then call SSL_read I will get the same error

Re: Problem to start an SSL session

2006-08-13 Thread Krishna M Singh
Hi You need to call SSL_Connect (if client) or SSL_accept( if server) and not the SSL_read.. SSL_Connection or ssl_accept internally performs that.. If u do SSL_read before SSL handshake completion, the SSL connection can't be established.. HTH -Krishna On 8/13/06, Frank Büttner <[EMAIL PROTEC

Re: Problem to start an SSL session

2006-08-13 Thread Frank Büttner
Krishna M Singh schrieb: > Hi > > You need to call SSL_Connect (if client) or SSL_accept( if server) and > not the SSL_read.. SSL_Connection or ssl_accept internally performs > that.. > > If u do SSL_read before SSL handshake completion, the SSL connection > can't be established.. > > HTH > -Kri

Re: Problem to start an SSL session

2006-08-14 Thread Krishna M Singh
Hi In non-blocking mode, for client we call SSL_connect In case SSL_connect returns -1 with SSL_ERROR_WANT_READ u need to wait in Select and once the sock fd is readable, u again need to all SSL_connect till the SSL_connect returns success or some other error code (except read or write wait)..

Re: Problem to start an SSL session

2006-08-15 Thread Frank Büttner
Krishna M Singh schrieb: > Hi > > In non-blocking mode, for client we call > SSL_connect > > In case SSL_connect returns -1 with SSL_ERROR_WANT_READ u need to wait > in Select and once the sock fd is readable, u again need to all > SSL_connect till the SSL_connect returns success or some other er

Re: Problem to start an SSL session

2006-08-16 Thread Krishna M Singh
Here are the steps in brief a) make a socket fd non-blocking and link with a ssl object. b) Call SSL_connect and this returns wait for read. c) Place this socket fd in the select call redable list. d) Whenever select call indicates this socket is readable again call SSL_connect until this call re

RE: Problem to start an SSL session

2006-08-16 Thread David Schwartz
> Here are the steps in brief > > a) make a socket fd non-blocking and link with a ssl object. > b) Call SSL_connect and this returns wait for read. > c) Place this socket fd in the select call redable list. > d) Whenever select call indicates this socket is readable again call > SSL_connect until

RE: Problem to start an SSL session

2006-08-16 Thread Mark
Hi, It's easy enough to write "wrapper" functions for SSL_read/write/ accept/connect etc. that work with blocking or non-blocking sockets. That's what I did. Regards, Mark. __ OpenSSL Project htt

Re: Problem to start an SSL session

2006-08-17 Thread Frank Büttner
Non blocking is not possible because Qt returns only an non blocking fd. What do you mean with the select() function. In the openSSL doc I can't found something like that. smime.p7s Description: S/MIME Cryptographic Signature

Re: Problem to start an SSL session

2006-08-17 Thread Bruno Oliveira Silvestre
Hi, On 8/16/06, David Schwartz <[EMAIL PROTECTED]> wrote: [...] The SSL engine may have already read the data and your 'select' may block forever. You should only wait for 'select' to give you read hit before calling SSL_read if your last SSL operation returned a WANT_READ indication. Accord

Re: Problem to start an SSL session

2006-08-17 Thread Richard Koenning
Frank Büttner wrote: Non blocking is not possible because Qt returns only an non blocking fd. What is the problem? What do you mean with the select() function. In the openSSL doc I can't found something like that. select

Re: Problem to start an SSL session

2006-08-18 Thread Frank Büttner
Richard Koenning schrieb: > Frank Büttner wrote: > >> Non blocking is not possible because Qt returns only an non blocking fd. > > What is the problem? > >> What do you mean with the select() function. In the openSSL doc I can

RE: Problem to start an SSL session

2006-08-18 Thread David Schwartz
> The only signals that I have is readyRead() (emit when I can read data > form socked) and bytesWritten() (emit when data was written to the > socked). I seen that OpenSSL will only have data for read when an Record > was complete transmitted. How can I find out the size of an Record? > Then I ca

RE: Problem to start an SSL session

2006-08-18 Thread David Schwartz
> Hi, > On 8/16/06, David Schwartz <[EMAIL PROTECTED]> wrote: > > [...] The SSL engine may have already read the data and your > > 'select' may block forever. You should only wait for 'select' > to give you > > read hit before calling SSL_read if your last SSL operation returned a > > WANT_READ

Re: Problem to start an SSL session

2006-08-18 Thread Frank Büttner
David Schwartz schrieb: >> The only signals that I have is readyRead() (emit when I can read data >> form socked) and bytesWritten() (emit when data was written to the >> socked). I seen that OpenSSL will only have data for read when an Record >> was complete transmitted. How can I find out the siz

RE: Problem to start an SSL session

2006-08-18 Thread David Schwartz
> David Schwartz schrieb: > >> The only signals that I have is readyRead() (emit when I can read data > >> form socked) and bytesWritten() (emit when data was written to the > >> socked). I seen that OpenSSL will only have data for read when > >> an Record > >> was complete transmitted. How can I

Re: Problem to start an SSL session

2006-08-18 Thread Krishna M Singh
Hi I haven't ever used BIO.. One more thing, after calling SSL_read we need to call SSL_pending also to make nothing is buffered.. In case SSL_pending returns non-zero than we can iteractively call the SSL_read again until it returns SSL_WANT_read or Write.. Whatvever it returns, based on that w

Re: Problem to start an SSL session

2006-08-18 Thread Frank Büttner
Krishna M Singh schrieb: > Hi > > I haven't ever used BIO.. One more thing, after calling SSL_read we > need to call SSL_pending also to make nothing is buffered.. In case > SSL_pending returns non-zero than we can iteractively call the > SSL_read again until it returns SSL_WANT_read or Write.. >

Re: Problem to start an SSL session

2006-08-18 Thread Krishna M Singh
Not sure whether it failed with bio.. But for non-blocking sockets u must use the select call else it would be too complex to handle the sockets.. Have u tried that..? On 8/18/06, Frank Büttner <[EMAIL PROTECTED]> wrote: Krishna M Singh schrieb: > Hi > > I haven't ever used BIO.. One more thing

Re: Problem to start an SSL session

2006-08-18 Thread Frank Büttner
Krishna M Singh schrieb: > Not sure whether it failed with bio.. But for non-blocking sockets u > must use the select call else it would be too complex to handle the > sockets.. Have u tried that..? > > I can't use the select() call, because I only have an fd for the socket. But no direct connect

Re: Problem to start an SSL session

2006-08-18 Thread Krishna M Singh
Hi Frank Don't know anything about Qt socket system but I feel there must be some other API in place of select in that. Non-blocking sockets cant' be handled without select easily and efficiently.. Its very crude way but u can sort of implement select functionality like this.. a) timeout = 100 m

Re: Problem to start an SSL session

2006-08-18 Thread Frank Büttner
Krishna M Singh schrieb: > Hi Frank > > Don't know anything about Qt socket system but I feel there must be > some other API in place of select in that. Non-blocking sockets cant' > be handled without select easily and efficiently.. > Its very crude way but u can sort of implement select functiona

Re: Problem to start an SSL session

2006-08-18 Thread Richard Koenning
Frank Büttner wrote: So I found out that SSL don't take teh data from the socket:( The Qt buffer will grow and grow, but SSL don't read the data:( It seems to me that you have an architecture problem. As i understand your descriptions you have OpenSSL and Qt accessing a socket in *parallel*,

RE: Problem to start an SSL session

2006-08-18 Thread David Schwartz
> So I found out that SSL don't take teh data from the socket:( > The Qt buffer will grow and grow, but SSL don't read the data:( If you use bio pairs, SSL doesn't have to touch the network at all ever. You can read and write data to and from the network and to and from OpenSSL. This is probably

Re: Problem to start an SSL session

2006-08-18 Thread Frank Büttner
David Schwartz schrieb: >> So I found out that SSL don't take teh data from the socket:( >> The Qt buffer will grow and grow, but SSL don't read the data:( > > If you use bio pairs, SSL doesn't have to touch the network at all ever. You > can read and write data to and from the network and to and

Re: Problem to start an SSL session

2006-08-18 Thread Frank Büttner
Richard Koenning schrieb: > Frank Büttner wrote: > >> So I found out that SSL don't take teh data from the socket:( >> The Qt buffer will grow and grow, but SSL don't read the data:( > > It seems to me that you have an architecture problem. As i understand > your descriptions you have OpenSSL and

Re: Problem to start an SSL session

2006-08-18 Thread Marek Marcola
Hello, > >> So I found out that SSL don't take teh data from the socket:( > >> The Qt buffer will grow and grow, but SSL don't read the data:( > > > > It seems to me that you have an architecture problem. As i understand > > your descriptions you have OpenSSL and Qt accessing a socket in > > *para

Re: Problem to start an SSL session

2006-08-18 Thread Marek Marcola
Hello, > > >> So I found out that SSL don't take teh data from the socket:( > > >> The Qt buffer will grow and grow, but SSL don't read the data:( > > > > > > It seems to me that you have an architecture problem. As i understand > > > your descriptions you have OpenSSL and Qt accessing a socket in

RE: Problem to start an SSL session

2006-08-18 Thread David Schwartz
> I have try this, but it fails, because the is no way to find out when > the write buffer BIO has data that must send. I have try it with the > callback function. But this will not work, because the function must be > static. And than I can not acces the network object form Qt.:( I can't

Re: Problem to start an SSL session

2006-08-19 Thread Frank Büttner
David Schwartz schrieb: >> I have try this, but it fails, because the is no way to find out when >> the write buffer BIO has data that must send. I have try it with the >> callback function. But this will not work, because the function must be >> static. And than I can not acces the network object

Re: Problem to start an SSL session

2006-08-19 Thread Frank Büttner
Now it will work better. The problem was to that all must be event trigger. Thanks a lot. Next I must add some error handling:) Frank smime.p7s Description: S/MIME Cryptographic Signature