Пример #1
0
        /// <summary>
        /// Convert an byte[] parameter to string after decode (decrypt)
        /// </summary>
        /// <param name="kObj">have byte[] parameter </param>
        /// <returns></returns>

        #region Convert
        private string Convert(KeyObj kObj)
        {
            Stream output = PGPDecrypt.Decrypt(kObj.kByte, privateKeyPath, pwd);
            string later  = GenerateStringFromStream(output);

            return(later);
        }
Пример #2
0
        /// <summary>
        /// The decryption.
        /// </summary>
        private void Decryption()
        {
            #region PGP Decryption

            PGPDecrypt.Decrypt(@"D:\Keys\EncryptData.txt", @"D:\Keys\PGPPrivateKey.asc", @"P@ll@m@lli", @"D:\Keys\OriginalText.txt");
            this.InfoListBox.Items.Add("Decryption Done");

            #endregion
        }
Пример #3
0
        public async void Decryption()
        {
            #region PGP Decryption

            PGPDecrypt.Decrypt("D:\\Keys\\2018-06-08-15-13-23-INPUT-12469390.txt", @"D:\Keys\PGPPrivateKey.asc", "P@ll@m@lli", "D:\\Keys\\OriginalText.txt");

            Console.WriteLine("Decryption Done");

            #endregion
        }
Пример #4
0
        public async void Decryption()
        {
            #region PGP Decryption

            PGPDecrypt.Decrypt("D:\\Keys\\EncryptData.txt", @"D:\Keys\PGPPrivateKey.asc", "P@ll@m@lli", "D:\\Keys\\OriginalText.txt");

            Console.WriteLine("Decryption Done");

            #endregion
        }
Пример #5
0
        public byte[] Decrypt(byte[] encData)
        {
            using (MemoryStream outputStream = new MemoryStream())
            {
                using (MemoryStream inputStream = new MemoryStream(encData))
                {
                    inputStream.Position = 0;
                    using (Stream keyStream = GetDecryptionKey())
                    {
                        PGPDecrypt.Decrypt(inputStream, keyStream, _passPhrase, outputStream);
                    }
                }

                return(outputStream.ToArray());
            }
        }
Пример #6
0
        static void Main(string[] args)
        {
            Random rnd    = new Random();
            int    rndInt = rnd.Next(0, 20000000);

            Byte[] ss = System.IO.File.ReadAllBytes(@"D:\Keys\2018-06-08-13-49-18-OUTPUT-3284217.txt");
            //Console.WriteLine(ss);
            string fileName = directory + "2018-06-08-13-49-18-OUTPUT-3284217.txt";

            //string fileName = directory + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-OUTPUT-" + rndInt.ToString(), CultureInfo.InvariantCulture) + ".txt";
            System.IO.File.WriteAllBytes(fileName, ss);
            Console.WriteLine(fileName);
            //var item = JsonConvert.DeserializeObject<Product>(requestParam.ToString());
            //string item = JsonConvert.DeserializeObject<String>(requestParam.ToString());
            //PGPDecrypt.Decrypt("D:\\Keys\\EncryptData.txt", @"D:\Keys\PGPPrivateKey.asc", "P@ll@m@lli", "D:\\Keys\\OriginalText.txt");
            Stream output = PGPDecrypt.Decrypt(fileName, privateKeyPath, pwd);
            string later  = GenerateStringFromStream(output);

            Console.WriteLine(later);
            var item = JsonConvert.DeserializeObject <Product>(later);
        }
Пример #7
0
        public void Decryption()
        {
            PGPDecrypt.Decrypt(filePath + "\\" + encryptedFile, _keyRingHome + "\\" + secretKeyRingFilename, secretKeyRingPassphrase, filePath + "\\" + outputFile, _keyRingHome + "\\" + publicKeyRingFilename);

            Console.WriteLine("Decryption Done");
        }