This project implements a secure file transfer system using C++ and OpenSSL. It features a specific custom protocol over TLS 1.3 with AES encryption.
- Linux Environment
g++(supporting C++17) orcmakeopensslinstalled (libssl-dev)
-
Navigate to the project directory:
cd /path/to/file/SFTP-CPP -
Generate SSL Certificates: You must generate the keys and certificates for the secure connection to work.
cd certs bash gen_certs.sh cd ..
-
Compile the Project: Running the following command will build both the Server and the Client.
g++ -std=c++17 -I include src/server/main.cpp src/server/server.cpp src/common/ssl_wrapper.cpp src/common/utils.cpp -o sftp_server -lssl -lcrypto -lpthread g++ -std=c++17 -I include src/client/main.cpp src/client/client.cpp src/common/ssl_wrapper.cpp src/common/utils.cpp -o sftp_client -lssl -lcrypto -lpthread
The server handles file storage and connections.
./sftp_serverThe server will create a server_storage directory automatically.
Open a new terminal.
./sftp_client [ServerIP]If running locally, you can just run:
./sftp_clientThe client features an interactive menu:
- List Remote Files: Shows files currently stored on the server.
- Upload File: Enter the path to a local file (e.g.,
./docs/myfile.txt) to upload it securely. You will see a progress bar. - Download File: Enter the name of a file on the server to download it to your current directory.
- Exit: Close the connection.
- TLS 1.3: All communication is encrypted using modern TLS standards.
- AES Encryption: Data privacy is ensured via the cipher suites negotiated by OpenSSL.
- Certificate Pinning: The client uses the generated CA certificate to verify the server's identity.
- Connection Failed: Ensure the server is running and the certificates were generated correctly in
certs/keys/. - Permission Denied: Ensure you have read/write permissions in the directory.
