CrushFTP Documentation

This page in: CrushFTP 11

You are reading the CrushFTP 10 documentation. CrushFTP 11 is the current version. Read this page for CrushFTP 11

CrushClientPGP#

CrushClient can do all the transfer scenarios for the various protocols and also includes the abilities of doing the PGP on the fly encryption and decryption.

Here are a few examples using it to do the PGP operations on a copy.

Encrypting using a public key on a local file copy:

java -jar CrushTunnel.jar inline_script "config pgpEncryptUpload true;config pgpPublicKeyUploadPath mykey.pub;connect file://;put plain.txt encrypted.txt;quit;"

Decrypt:

java -jar CrushTunnel.jar inline_script "config pgpDecryptUpload true;config pgpPrivateKeyUploadPath mykey.key;config pgpPrivateKeyUploadPassword password;connect file://;put encrypted.txt plain.txt;quit;"

Doing this in code is more complicated, but also possible if necessary. Classes come from CrushTunnel.jar located in your WebInterface folder.

//encrypt
GenericClient c = Common.getClient("file://","",null);
c.setConfig("pgpEncryptUpload","true");
c.setConfig("pgpPublicKeyPath","/path/to/mykey.pub");
OutputStream out = c.upload("/path/to/destfile.txt",0,true,true);
//write bytes, close out.
c.logout();

//decrypt
GenericClient c = Common.getClient("file://","",null);
c.setConfig("pgpDecryptUpload","true");
c.setConfig("pgpPrivateKeyUploadPath","/path/to/mykey.key");
c.setConfig("pgpPrivateKeyUploadPassword","password");
OutputStream out = c.upload("/path/to/destfile.txt",0,true,true);
//write bytes from encrypted file, close out.
c.logout();