Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use my implementation i wrote one year ago. I know that it's a bit ugly.</p> <p>You need pgp.exe and some background about it. see <a href="http://www.ercueser.com/post/2009/02/17/PGP-File-Encrypt-Decrypting-in-C.aspx" rel="nofollow noreferrer">my blog post</a>.</p> <pre><code>/// &lt;summary&gt; /// Encryps given file using PGP Public Key /// &lt;/summary&gt; /// &lt;param name="filename"&gt;&lt;/param&gt; public string Encrypt(string filename, bool isBinary, ref string outstr){ string outputfilename = filename; //We use stringbuilder for performance considerations StringBuilder sb = new StringBuilder(); sb.Append("/c "); sb.Append(""); sb.Append(PGPLocation); sb.Append(" +force -es "); sb.Append("\""); sb.Append(filename); sb.Append("\" "); sb.Append(ToUserName); sb.Append(" -u "); sb.Append(MyUserName); sb.Append(" -z "); sb.Append(PassPhrase); sb.Append(" "); // Use binary indicator because PGP produces different outputs for binary and plain text files if (isBinary) sb.Append("-a"); proc.StartInfo.Arguments = sb.ToString(); //proc.StartInfo.Arguments = "/c pgp +force -es "+filename+" cumacam -u bugra"; proc.Start(); if (WaitForInfinity) proc.WaitForExit(); else proc.WaitForExit(WaitTime); //string res = proc.StandardOutput.ReadToEnd(); outstr = proc.StartInfo.Arguments; if (proc.HasExited) { int ab = proc.ExitCode; if (ab != 0) { FireError(Convert.ToInt32(ErrorTypes.PGPEncryptError), "Erro No: " + ab.ToString() + "in PGP. Details: "+" "+proc.StandardOutput.ReadToEnd()); return null; } else if (!isBinary) return outputfilename+".pgp"; return outputfilename + ".asc"; } return null; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload