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); }
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; }
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(); } }