MinimalFTP icon indicating copy to clipboard operation
MinimalFTP copied to clipboard

Q: Can you provide an example for an SSL enabled server?

Open bseib opened this issue 7 years ago • 1 comments

Specifically, how do we create a simple SSLContext to pass in?


// Creates a native file system
File ftpRootDir = getFtpRootDir();
NativeFileSystem fs = new NativeFileSystem(ftpRootDir);

// Creates a noop authenticator, which allows anonymous authentication
NoOpAuthenticator auth1 = new NoOpAuthenticator(fs);

// Creates a secure SSL server with the noop authenticator
server3 = new FTPServer(auth1);
server3.setExplicitSSL(false); // support SSL connections

SSLContext sslContext = howDoWeBuildSimpleSSLContext(); // ???
server3.setSSLContext(sslContext);

// Start listening asynchronously
server3.listen(InetAddress.getLoopbackAddress(), 3333);

bseib avatar Oct 31 '18 15:10 bseib

Second this. I'd like to use a self-signed certificate, but I cannot build a SSLContext that works.

I tried:

https://stackoverflow.com/questions/12411363/java-code-to-connect-to-ftp-server-using-ssl https://gist.github.com/erickok/7692592

Using sample certificates from:

https://github.com/freelan-developers/freelan/wiki/Sample-certificate-files

But can't get it work.

proofrock avatar Nov 14 '18 14:11 proofrock