Esempio n. 1
0
 public PGPDecrypt(string encryptedFilePath, string privKeyPath, string password, string outputPath, string pubKeyPath)
 {
     _encryptedFilePath = encryptedFilePath;
     _outputPath        = outputPath;
     _password          = password.ToCharArray();
     _privKeyPath       = privKeyPath;
     pgpKeys            = new PgpEncryptionKeys(pubKeyPath, privKeyPath, password);
 }
Esempio n. 2
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. 3
0
        public static void Encrypt(string fileOriginalPath, string encryptFileoutPut, string reciverPublicKey, string senderPrivateKey, string senderSignaturePassword)
        {
            FileInfo fi = new FileInfo(fileOriginalPath);

            using (FileStream str = new FileStream(encryptFileoutPut, FileMode.Create))
            {
                PgpEncryptionKeys objPgpEncryptionKeys = new PgpEncryptionKeys(reciverPublicKey, senderPrivateKey, senderSignaturePassword);
                PgpEncrypt        objPgpEncrypt        = new PgpEncrypt(objPgpEncryptionKeys);
                objPgpEncrypt.EncryptAndSign(str, fi);
                str.Flush();
                str.Close();
            }
        }