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:\Users\u316383\Documents\pdf8.pdf", sPDFDecoded);

 

posted @ 2018-02-22 14:57  ChuckLu  阅读(4582)  评论(0编辑  收藏  举报