I'm connecting to an FTPS server via TLS/SSL using the SslStream class. Everything is going fine. However I need to support a command called "CCC" which basically disables encryption. If I simply do:
SendCommand("CCC");
sslStream.Close();
netStream.Write("...<futher FTP commands>...")
Then the FTP server responds with seemingly garbage data (about 30 bytes), and then does not respond to any command after that (timeout).
The FTP logs are as follows:
# Connect()
Status: Connecting to ***:21
Response: 220-IPv6 connections are also welcome on this server.
Command: AUTH TLS
Response: 234 AUTH TLS OK.
Status: FTPS Authentication Successful
Command: USER ***
Response: 331 User *** OK. Password required
Command: PASS ***
Response: 230 OK. Current restricted directory is /
Command: PBSZ 0
Response: 200 PBSZ=0
Command: PROT P
Response: 200 Data protection level set to "private"
Status: Text encoding: System.Text.UTF8Encoding
Command: OPTS UTF8 ON
Response: 200 OK, UTF-8 enabled
Command: SYST
Response: 215 UNIX Type: L8
Command: CCC
Response: 200 Control connection unencrypted
Status: The stale data was: ************
As you can see the FTP server sends back "200 Control connection unencrypted" which means the command was successful. Its also important to note that the response was sent in encrypted format.
So I need to probably continue to use the SslStream while disabling encryption. Probably the "block mode" communication is still required while the encryption algorithm is disabled. Does anyone have any idea how I can do this?