title: How to encrypt files with AES256-GCM in golang?
body: <p>AES256-GCM could be implemented in go as <a href="https://gist.github.com/cannium/c167a19030f2a3c6adbb5a5174bea3ff" rel="noreferrer">https://gist.github.com/cannium/c167a19030f2a3c6adbb5a5174bea3ff</a></p>
  
  <p>However, <code>Seal</code> method of interface <code>cipher.AEAD</code> has signature:</p>
  
  <pre><code>Seal(dst, nonce, plaintext, additionalData []byte) []byte
  </code></pre>
  
  <p>So for very large files, one must read all file contents into memory, which is unacceptable.</p>
  
  <p>A possible way is to implement <code>Reader</code>/<code>Writer</code> interfaces on <code>Seal</code> and <code>Open</code>, but shouldn't that be solved by those block cipher "modes" of AEAD? So I wonder if this is a design mistake of golang cipher lib, or I missed something important with GCM?</p>