Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Encryption tool
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Data Encryption tool
Miscellaneous
Thread ID:
01324122
Message ID:
01324122
Views:
59
I have a need to create a data file (fixed format/length) and then encrypt the file for subsequent sending to an FTP site. I have been using PGP command line 6.5.8 (free program) to do this and this has worked successfully for me in the past by creating a class that will launch the command line needed.

I have since upgraded my server to Windows Server 2003 (64 bit edition) and the launching of the command line to encrypt fails. This same code does not fail on my Windows XP SP2 development machine and I have confirmed that the command line execution works successfully on the Windows Server machine when I manually execute the command line from the command prompt.

Here is the code to launch a command line:
internal class LaunchEXE
    {
        internal static string Run(string exeName, string argsLine, int timeoutSeconds)
        {
            StreamReader outputStream = StreamReader.Null;
            string output = "";
            bool success = false;
            try
            {
                Process newProcess = new Process();
                newProcess.StartInfo.FileName = exeName;
                newProcess.StartInfo.Arguments = argsLine;
                newProcess.StartInfo.UseShellExecute = false;
                newProcess.StartInfo.CreateNoWindow = true;
                newProcess.StartInfo.RedirectStandardOutput = true;
                newProcess.Start();

                if (0 == timeoutSeconds)
                {
                    outputStream = newProcess.StandardOutput;
                    output = outputStream.ReadToEnd();
                    newProcess.WaitForExit();
                }
                else
                {
                    success = newProcess.WaitForExit(timeoutSeconds * 1000);
                    if (success)
                    {
                        outputStream = newProcess.StandardOutput;
                        output = outputStream.ReadToEnd();
                    }
                    else
                    {
                        output = "Timed out at " + timeoutSeconds + " seconds waiting for " + exeName + " to exit.";
                    }
                }
            }
            catch (Exception e)
            {
                throw (new Exception("An error occurred running " + exeName + ".", e));
            }
            finally
            {
                outputStream.Close();
            }
            return "\t" + output;
        }
    }
Now, I just pass the exe command with its arguments and it runs the command line as follows in code:
string fileName = "file.txt";
string encryptKey = "encryptKey";
encryptMsg = LaunchEXE.Run(@"c:\program files\network associates\pgpnt\pgp", 
                    @" -e " + fileName + " " + encryptKey + " +force", 10);
First question, does anybody know if this is a problem due to the Server and the PGP software? I am having trouble getting support as this is a free program.

Second question, does anybody know of a third party class that can be used to handle file encryption? If there is something else I can use I would certainly consider it and purchase if necessary.

Thanks in advance.
Reply
Map
View

Click here to load this message in the networking platform