Esempio n. 1
0
 private const int BufferSize = 0x10000; // should always be power of 2
 /// <summary>
 /// Instantiate a new PgpEncrypt class with initialized PgpEncryptionKeys.
 /// </summary>
 /// <param name="encryptionKeys"></param>
 /// <exception cref="ArgumentNullException">encryptionKeys is null</exception>
 public PgpEncrypt(PgpEncryptionKeys encryptionKeys)
 {
     if (encryptionKeys == null)
     {
         throw new ArgumentNullException("encryptionKeys", "encryptionKeys is null.");
     }
     m_encryptionKeys = encryptionKeys;
 }
Esempio n. 2
0
        public static void EncryptAndSign(string sourcePath, string targetPath, string passPhrase, string publicKeyFileName, string privateKeyFileName)
        {
            PgpEncryptionKeys encryptionKeys = new PgpEncryptionKeys(publicKeyFileName, privateKeyFileName, passPhrase);
            PgpEncrypt        encrypter      = new PgpEncrypt(encryptionKeys);

            using (Stream outputStream = File.Create(targetPath))
            {
                encrypter.EncryptAndSign(outputStream, new FileInfo(sourcePath));
            }
        }