Пример #1
0
 public PGPDecrypt(byte[] encrypted, string privKeyPath, string password, string pubKeyPath)
 {
     _encrypted   = encrypted;
     _password    = password.ToCharArray();
     _privKeyPath = privKeyPath;
     pgpKeys      = new PgpEncryptionKeys(pubKeyPath, privKeyPath, password);
 }
Пример #2
0
        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;
        }
Пример #3
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);
 }
Пример #4
0
 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();
     }
 }
Пример #5
0
 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);
 }