相关文章推荐
卖萌的单车  ·  Mismatch between ...·  9 月前    · 
腼腆的卡布奇诺  ·  sparse ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm modifying an application embedded FTP server I have previously written for a customer to support FTPS and while I have implicit mode working by passing a SecureServerSocket to the TCPSocketServer, I want to support Explicit mode where the connection start as a regular socket connection, and when receiving a AUTH TLS, switch the StreamSocket to a SecureStreamSocket and send a server hanshake.

I have attempted to use the attach method, but it seem to send a client hand shake rather than server one. So then I tried to create a server context when creating the SecureStreamSocket, but get "GnuTLS error -19: An unexpected TLS handshake packet was received" when trying to connect from filezilla.

const Poco::Net::Context::Ptr ctx = new Poco::Net::Context(Poco::Net::Context::SERVER_USE, "", "", "", Poco::Net::Context::VERIFY_NONE, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); 
SecureStreamSocket *test = new SecureStreamSocket(ctx);
test->attach(socket());

Have anyone successfully transition a already established POCO TCPServer connection to Secure connection and if so, how did you do it - any hints would be helpfull.

SecureStreamSocket has some static functions to attach a StreamSocket to a SecureStreamSocket. Like static SecureStreamSocket attach(const StreamSocket& streamSocket,.... But I think you want to use it like SecureStreamSocket test = SecureStreamSocket::attach(yourSocket... – Okkenator Apr 3, 2020 at 16:33 thank for pointing this out, but the result is the same: GnuTLS error -19: An unexpected TLS handshake packet was received. – Mikaelo Apr 6, 2020 at 16:51 After assigning a error handler to Poco, it logs the following error at the time of the attach: error:141A10F4:SSL routines:ossl_statem_client_read_transition:unexpected message – Mikaelo Apr 6, 2020 at 16:58

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.