Reply To: ftp encryption

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf ftp encryption Reply To: ftp encryption

#59535
Bakha Nurzhanov
Participant

    I have done such thing. I am encrypting content of a message before passing it to the outbound protocol driver. I had difficult time doing dual pipe as in:

    (UNIX eq: cat “message” | pgp | cat ) so I had to create a temporary file by writing the message. I then exec pgp < tempfile_in > tempfile_out. Lastly I would read tempfile_out back into message and pass it on. You would also need to change DRIVERCTL metadata to append .pgp to the original file name (which is not mandatory but is a nice thing to do to your trading partner). You would need to create temp directory in your $HCIROOT if you use this code verbatim. You also would need to use command line version of pgp and it will have to be in your $PATH. I also get original file name from USERDATA structure of message metadata which I populate using custom code.

    Here is the snippet of the code:

    Code:


                   global HciConnName HciRootDir
                   set msgCtr [CtrNextValue “${HciConnName}”]
                   set msgOutFileName [file join ${HciRootDir} {temp} ${HciConnName}_${msgCtr}]
                   set msgOutFile [open ${msgOutFileName} w]
                   msgwrite raw $mh $msgOutFile
                   flush $msgOutFile
                   close $msgOutFile
                   set msgInFileName “$msgOutFileName.pgp”
                   catch { exec pgp +verbose=0 +force -ef < $msgOutFileName > $msgInFileName ${pgp_user_id} }
                   set msgInFileSize [file size ${msgInFileName}]
                   set msgInFile [open ${msgInFileName} r]
                   msgread raw $mh $msgInFile $msgInFileSize
                   close $msgInFile
                   file delete $msgOutFileName $msgInFileName

                   set fileName “$fileName.pgp”
                   set drvr_ctl_str “{FILESET {{OBFILE $fileName} {OBSTYLE single}}}”
                   msgmetaset $mh DRIVERCTL $drvr_ctl_str

                   lappend dispList “CONTINUE $mh”