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);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM