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();

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-2) was last changed on 19-May-2022 05:39 by Ben Spink
G’day (anonymous guest)
CrushFTP10 | What's New

Referenced by
CrushClient

JSPWiki