base64对文件进行加密

将原文件读取为字节数组,然后用base64加密,得到加密的字符串

https://stackoverflow.com/questions/475421/base64-encode-a-pdf-in-c

Use File.ReadAllBytes to load the PDF file, and then encode the byte array as normal using Convert.ToBase64String(bytes).

将加密后的字符串,直接写到文件中

https://stackoverflow.com/questions/24808014/convert-base64-encoding-to-pdf

  byte[] sPDFDecoded = Convert.FromBase64String(base64BinaryStr);
  File.WriteAllBytes(@"c:Usersu316383Documentspdf8.pdf", sPDFDecoded);
原文地址:https://www.cnblogs.com/chucklu/p/8458939.html