/// <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); }
/// <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 }
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 }
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 }
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()); } }
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); }
public void Decryption() { PGPDecrypt.Decrypt(filePath + "\\" + encryptedFile, _keyRingHome + "\\" + secretKeyRingFilename, secretKeyRingPassphrase, filePath + "\\" + outputFile, _keyRingHome + "\\" + publicKeyRingFilename); Console.WriteLine("Decryption Done"); }