コード例 #1
0
 string PGPEncryptToASCIIArmored(byte[] data, string filename = "encrypted-data.gpg")
 {
     using (var encOut = new MemoryStream()) {
         var byteData = GPGTools.EncryptForKeys(data, keys, filename);
         var s        = new ArmoredOutputStream(encOut);
         s.Write(byteData, 0, byteData.Length);
         s.Close();
         encOut.Seek(0, SeekOrigin.Begin);
         var reader = new StreamReader(encOut);
         return(reader.ReadToEnd());
     }
 }
コード例 #2
0
 public string PGPEncryptToBase64(byte[] data, string filename = "encrypted-data.gpg")
 {
     return(Convert.ToBase64String(GPGTools.EncryptForKeys(data, keys, filename)));
 }