title: How to use *.pub/*.sec files to encrypt/decrypt another file?
body: <p>I created a pair of <code>*.pub</code> and <code>*.sec</code> files using the instructions and code given here:</p>
  
  <p><a href="https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html" rel="noreferrer">https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html</a></p>
  
  <p>(I am using this documentation because the ultimate application I have in
  mind is an automated encryption/decryption pipeline.)</p>
  
  <p><strong>Q1:</strong> How can I use gpg2 and the <code>*.pub</code> file to encrypt another file?</p>
  
  <p><strong>Q2:</strong> How can I use gpg2 and the companion <code>*.sec</code> to decrypt a file encrypted using the companion <code>*.pub</code> file?</p>
  
  <hr>
  
  <p><strong><em>Important:</em></strong>  <em>I am interested only in answers that are suitable for programmatic implementation of an unsupervised operation. Please do not post answers that can only be carried out interactively.  I am particularly interested in solutions that can be implemented in Python.</em></p>
  
  <hr>
  
  <p>Please include precise pointers to the relevant documentation.</p>