F
foobar
I'm trying to encypt a file using PgpCmdLn 6.5.8 from an asp.net page. My
code looks like this:
private String ExecuteProcess(String Arguments)
{
String msg = String.Empty;
try
{
if(this._pgpPath == null || this._pgpPath == String.Empty)
throw new Exception("The path to the Pgp cmdline application must be given!
");
Arguments +=GetSettings();
compiler = new Process();
compiler.StartInfo.FileName = this._pgpPath + "\\pgp.exe";
compiler.StartInfo.Arguments = Arguments;
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.CreateNoWindow = true ;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();
DateTime StartTime = DateTime.Now;
compiler.WaitForExit(_wait);
// while((long)((TimeSpan)(DateTime.Now - StartTime)).TotalSeconds < _wait)
// {
// if(compiler.HasExited)
// break;
// }
if(!compiler.HasExited)
compiler.Kill();
msg = " " + compiler.StandardOutput.ReadToEnd();
compiler.Dispose();
if(msg.ToLower().IndexOf("error",0) > 0 ||
msg.ToLower().IndexOf("warning",0) > 0)
{
throw new Exception("Pgp error: Arguments(" + Arguments + ")" );
}
return msg;
}
catch( Exception err)
{
throw new Exception( err.Message + " :: " + msg);
//Cannot find the public key matching userid
}
}
When I run this code from my aspx page I'm prompted for random data: "PGP
needs to generate some random data. This is done by measuring the time
intervals between your keystrokes. Please enter some random text on your
keyboard until the indicator reaches 100%. Press ^D to cancel 0% of required
data "
How can I do this? Can someone give me an example? Thanks in advance.
code looks like this:
private String ExecuteProcess(String Arguments)
{
String msg = String.Empty;
try
{
if(this._pgpPath == null || this._pgpPath == String.Empty)
throw new Exception("The path to the Pgp cmdline application must be given!
");
Arguments +=GetSettings();
compiler = new Process();
compiler.StartInfo.FileName = this._pgpPath + "\\pgp.exe";
compiler.StartInfo.Arguments = Arguments;
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.CreateNoWindow = true ;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();
DateTime StartTime = DateTime.Now;
compiler.WaitForExit(_wait);
// while((long)((TimeSpan)(DateTime.Now - StartTime)).TotalSeconds < _wait)
// {
// if(compiler.HasExited)
// break;
// }
if(!compiler.HasExited)
compiler.Kill();
msg = " " + compiler.StandardOutput.ReadToEnd();
compiler.Dispose();
if(msg.ToLower().IndexOf("error",0) > 0 ||
msg.ToLower().IndexOf("warning",0) > 0)
{
throw new Exception("Pgp error: Arguments(" + Arguments + ")" );
}
return msg;
}
catch( Exception err)
{
throw new Exception( err.Message + " :: " + msg);
//Cannot find the public key matching userid
}
}
When I run this code from my aspx page I'm prompted for random data: "PGP
needs to generate some random data. This is done by measuring the time
intervals between your keystrokes. Please enter some random text on your
keyboard until the indicator reaches 100%. Press ^D to cancel 0% of required
data "
How can I do this? Can someone give me an example? Thanks in advance.