title: How to encrypt a string with GnuPG?
body: <p>How can I encrypt a given string using gpg from command line?
  I have the public key stored in a file called pubkey.pub
  I thought I could simply do it with something like that.</p>
  
  <pre><code>gpg --import "path/to/pubkey.pub" --encrypt "my string to encrypt"
  </code></pre>
  
  <p>But this won't work.</p>
  
  <p>Background: I have to use the PHP exec command to encrypt given text, because I don't have the PHP module itself installed on the server. </p>