Overview
Features
Download
Documentation
Community
Add-Ons & Services

'STARTTLS' like connection

Please post support and help requests here.

'STARTTLS' like connection

Postby dreamy » 10 Apr 2012, 23:09

Hello,

this is my first post on this forum and i am totally new in POCO C++ libraries, so judge me gently. :)

I was able to build a simple TCP-based server application and I'd like to implement optional TLS connection by issuing a command during insecure connection (I'd also like to "escape" from this secured connection back to insecure if possible).
I believe I'd like same behavior as STARTTLS command in SMTP... Is (and if yes, then how) this possible in POCO?
dreamy
 
Posts: 6
Joined: 10 Apr 2012, 23:05

Re: 'STARTTLS' like connection

Postby dreamy » 20 Apr 2012, 21:19

I see a few replies in newer threads, but none in this. Does it mean that no solution exists?
dreamy
 
Posts: 6
Joined: 10 Apr 2012, 23:05

Re: 'STARTTLS' like connection

Postby dreamy » 16 Aug 2012, 23:25

I'm feeling really ignored. :(
dreamy
 
Posts: 6
Joined: 10 Apr 2012, 23:05

Re: 'STARTTLS' like connection

Postby guenter » 18 Aug 2012, 17:16

See the implmenentation of Poco::Net::SecureSMTPClientSession in the NetSSL_OpenSSL library, specifically the startTLS() method:

Code: Select all
bool SecureSMTPClientSession::startTLS(Context::Ptr pContext)
{
   int status = 0;
   std::string response;
   
   status = sendCommand("STARTTLS", response);
   if (!isPositiveCompletion(status)) return false;

   SecureStreamSocket sss(SecureStreamSocket::attach(socket(), pContext));
   socket() = sss;
   
   return true;
}
guenter
 
Posts: 1157
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: 'STARTTLS' like connection

Postby dreamy » 20 Aug 2012, 22:01

So I can attach an opened socket to a new SecureStreamSocket anytime? That looks really simple, thank you really really much.
dreamy
 
Posts: 6
Joined: 10 Apr 2012, 23:05


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests