title: Ghostscript with AES-256 password protection for PDF 2.0 documents
body: <p>A password protected pdf file can be generated with ghostscript:</p>
  
  <pre><code>gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=protect.pdf -sOwnerPassword=pwd1 -sUserPassword=pwd2 -dCompatibilityLevel=2.0 test.pdf
  </code></pre>
  
  <p>The output file has the newest pdf version 2.0 which has unicode support for password protection. But according to pdfinfo the obsolete RC4 algorithm was used:</p>
  
  <pre><code>pdfinfo protect.pdf -upw pwd2
  CreationDate: Sat Apr 21 09:10:14 2018 CEST
  ModDate: Sat Apr 21 09:10:14 2018 CEST
  Tagged: no
  UserProperties: no
  Suspects: no
  Form: none
  JavaScript: no
  Pages: 26
  Encrypted: yes (print:yes copy:yes change:yes addNotes:yes algorithm:RC4)
  Page size: 612 x 792 pts (letter)
  Page rot: 0
  File size: 288060 bytes
  Optimized: no
  PDF version: 2.0
  </code></pre>
  
  <p>According to <a href="https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/" rel="nofollow noreferrer">https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/</a> the PDF 2.0 version is able to encrypt PDF files with the AES-256 standard. How can I do this with ghostscript?</p>