public PGPDecrypt(byte[] encrypted, string privKeyPath, string password, string pubKeyPath) { _encrypted = encrypted; _password = password.ToCharArray(); _privKeyPath = privKeyPath; pgpKeys = new PgpEncryptionKeys(pubKeyPath, privKeyPath, password); }
private const int BufferSize = 0x10000; // should always be power of 2 public PgpEncrypt(PgpEncryptionKeys encryptionKeys) { if (encryptionKeys == null) { throw new ArgumentNullException("encryptionKeys", "encryptionKeys is null."); } m_encryptionKeys = encryptionKeys; }
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); }
public static void EncryptAndWriteFile(string originalText, string encryptFileoutPut, string reciverPublicKey, string senderPrivateKey, string senderSignaturePassword) { using (MemoryStream str = new MemoryStream()) { PgpEncryptionKeys objPgpEncryptionKeys = new PgpEncryptionKeys(reciverPublicKey, senderPrivateKey, senderSignaturePassword); PgpEncrypt objPgpEncrypt = new PgpEncrypt(objPgpEncryptionKeys); objPgpEncrypt.EncryptAndSign(str, originalText); SaveFileStream(encryptFileoutPut, str); str.Flush(); str.Close(); } }
public static byte[] Encrypt(string originalText, string reciverPublicKey, string senderPrivateKey, string senderSignaturePassword) { byte[] data; using (MemoryStream str = new MemoryStream()) { PgpEncryptionKeys objPgpEncryptionKeys = new PgpEncryptionKeys(reciverPublicKey, senderPrivateKey, senderSignaturePassword); PgpEncrypt objPgpEncrypt = new PgpEncrypt(objPgpEncryptionKeys); objPgpEncrypt.EncryptAndSign(str, originalText); data = str.ToArray(); str.Flush(); str.Close(); } return(data); }