title: gpg : encryption/decryption failed
body: <p>I try to make a gpg encryption/decryption on my server, for encryption i make this command line :</p>
  
  <pre><code>gpg --output test.txt.gpg --encrypt test.txt
  </code></pre>
  
  <p>and then i enter a user ID and my file is created.</p>
  
  <p>But after, when i want to decrypt this file with same commande :</p>
  
  <pre><code>gpg --output result.txt --decrypt test.txt.gpg
  </code></pre>
  
  <p>result is :</p>
  
  <pre><code>gpg: encrypted with 2048-bit RSA key, ID FF070B4D, created 2017-07-19
  "droli mail_adress"
  gpg: decryption failed: No secret key
  </code></pre>
  
  <p>i don't understand why i can encrypt but can't decrypt after ?</p>
  
  <pre><code>$gpg --list-keys  
  /home/ssie/.gnupg/pubring.gpg
  ----------------------------- 
  pub   2048R/09C41BAC 2017-07-19 
  uid                  droli  mail_adress 
  sub   2048R/6D2F1BE9 2017-07-19
  
  $gpg --list-secret-keys
  /home/ssie/.gnupg/secring.gpg
  -----------------------------
  sec   2048R/09C41BAC 2017-07-19
  uid                  droli  mail_adress sub
  ssb   2048R/6D2F1BE9 2017-07-19
  </code></pre>
  
  <p>Edit after 2 hours :</p>
  
  <p>I think to have find why : there were 2 different keys and 1 secret key for the same user. But now there is another issue : i deleted the wrong key and make the same test again.</p>
  
  <p>the answer after decrypt is :</p>
  
  <blockquote>
    <p>You need a passphrase to unlock the secret key for user:  "droli
    mail_adress" 2048-bit RSA key, ID 6D2F1BE9,  created 2017-07-19 (main
    key ID 09C41BAC)</p>
    
    <p>can't connect to `/home/ssie/.gnupg/S.gpg-agent': Connection refused 
    gpg-agent[32298]: command get_passphrase failed: Operation cancelled 
    gpg: cancelled by user gpg: encrypted with 2048-bit RSA key,  ID
    6D2F1BE9, created 2017-07-19 "telefact " gpg: public key decryption 
    failed: General error gpg: decryption failed: No secret key</p>
  </blockquote>
  
  <p>what is this "S.gpg-agent" ? (the file /home/ssie/.gnupg/S.gpg-agent is empty in my case)</p>
  
  <pre><code>$ gpg-agent 
  --daemon GPG_AGENT_INFO=/tmp/gpg-1K7fOi/S.gpg-agent:18607:1; export GPG_AGENT_INFO;
  </code></pre>
  
  <p>After launching <code>GPG_AGENT_INFO=/tmp/gpg-1K7fOi/S.gpg-agent:18607:1</code>
  and <code>export GPG_AGENT_INFO</code></p>
  
  <p>there is no ask about the gpg agent.</p>
  
  <blockquote>
    <p>You need a passphrase to unlock the secret key for user:  "droli
    mail_adress" 2048-bit RSA key, ID 6D2F1BE9,  created 2017-07-19 (main
    key ID 09C41BAC)</p>
    
    <p>gpg: cancelled by user 
    gpg: encrypted with 2048-bit RSA key,  ID 6D2F1BE9, created 2017-07-19
    "droli mail_adress" 
    gpg: public key decryption failed: General error 
    gpg: decryption failed: No secret key</p>
  </blockquote>
  
  <p>When creating a new key i have the same issue at the end :</p>
  
  <p>Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
  You need a Passphrase to protect your secret key.</p>
  
  <p>gpg: cancelled by user
  gpg: Key generation canceled.</p>
  
  <p>it's like there is a dyfonctionnement with the passphrase ?</p>
  
  <p>Thanks for help.</p>