[openssl-users] usage of SSL_read() and SSL_write() for file transfer

Viktor Dukhovni openssl-users at dukhovni.org
Fri Feb 2 04:56:37 UTC 2018



> On Feb 1, 2018, at 11:42 PM, Roushan Ara <roushan.ara at skanray.com> wrote:
> 
> currently i am using openssl for client and server communication for file transfer. i am facing some issue regarding the writing the content of file.my requirement is i have to send the whole content of some specified file to server for that i am using SSL_write(). i can achieve this using SSL_write() in a while loop but my requirement is i have to use single SSL_write() for sending whole content of file and single SSL_read  at the server to receive the whole content of the file.because in that message itself we  have to specify some id so that it can be identified at the server to indicate that it is file reading. so i need to send single message with full content of file in a buffer. because of the maximum limitation of SSL_write() we are not able to send more than 16384 bytes.
> Could somebody suggest s how can i use SSL_write() for the writing the whole content of text file in a single message without using any while loop.

Your simplest solution is to use HTTP POST over SSL to create the
illusion of a single message layered over a underlying reliable
bytestream.  Don't write your own code, consider using libcurl
or an HTTPS library that best meets your needs.

-- 
	Viktor.



More information about the openssl-users mailing list