gpg decryption fails with no secret key error

后端 未结 9 660
一生所求
一生所求 2020-12-13 17:48

I have a gpg .key file that is used as passphrase for decrypting a .dat.pgp file. The encrypted .data.pgp file gets successfully decrypted on one server with same .key file

相关标签:
9条回答
  • 2020-12-13 18:35

    Looks like the secret key isn't on the other machine, so even with the right passphrase (read from a file) it wouldn't work.

    These options should work, to

    • Either copy the keyrings (maybe only secret keyring required, but public ring is public anyway) over to the other machine
    • Or export the secret key & then import it on the other machine

    A few useful looking options from man gpg:

    --export
    Either export all keys from all keyrings (default keyrings and those registered via option --keyring), or if at least one name is given, those of the given name. The new keyring is written to STDOUT or to the file given with option --output. Use together with --armor to mail those keys.

    --export-secret-keys
    Same as --export, but exports the secret keys instead.

    --import
    --fast-import
    Import/merge keys. This adds the given keys to the keyring. The fast version is currently just a synonym.

    And maybe

    --keyring file
    Add file to the current list of keyrings. If file begins with a tilde and a slash, these are replaced by the $HOME directory. If the file‐ name does not contain a slash, it is assumed to be in the GnuPG home directory ("~/.gnupg" if --homedir or $GNUPGHOME is not used).

    Note that this adds a keyring to the current list. If the intent is to use the specified keyring alone, use --keyring along with --no-default-keyring.

    --secret-keyring file
    Same as --keyring but for the secret keyrings.

    0 讨论(0)
  • 2020-12-13 18:36

    I have solved this problem, try to use root privileges, such as sudo gpg ... I think that gpg elevated without permissions does not refer to file permissions, but system

    0 讨论(0)
  • 2020-12-13 18:43

    You can also be interested at the top answer in here: https://askubuntu.com/questions/1080204/gpg-problem-with-the-agent-permission-denied

    basically the solution that worked for me too is:

    gpg --decrypt --pinentry-mode=loopback <file>
    
    0 讨论(0)
提交回复
热议问题