Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Docs: include gpg's --armor option on export #2653

Merged
merged 1 commit into from
Dec 9, 2019

Conversation

alastairs
Copy link
Contributor

I found that a GPG exported with solely --export-secret-keys could not be imported via gpg --import, even on the same machine and with the same GPG version as those from which the key was exported. Including the --armor option, however, producing ASCII-armoured output, resolved the issue.

@2opremio 2opremio added the docs Issue or PR relates to documentation label Dec 3, 2019
@hiddeco
Copy link
Member

hiddeco commented Dec 9, 2019

Can you provide some details about e.g. the GnuPG version you are running? As on my machine I am perfectly able to perform the actions mentioned without the --armor option:

$ gpg --export-secret-keys 0x36BFC7F119A1C9F1 > secret.key
$ export GNUPGHOME=$(mktemp -d); echo $GNUPGHOME
/tmp/tmp.y8yrt27Qux
$ gpg --import secret.key
gpg: keybox '/tmp/tmp.y8yrt27Qux/pubring.kbx' created
gpg: /tmp/tmp.y8yrt27Qux/trustdb.gpg: trustdb created
gpg: key 36BFC7F119A1C9F1: public key "Flux <support@weave.works>" imported
gpg: key 36BFC7F119A1C9F1: secret key imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg:       secret keys read: 1
gpg:   secret keys imported: 1
$  gpg --version
gpg (GnuPG) 2.2.18
libgcrypt 1.8.5
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /tmp/tmp.y8yrt27Qux
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

@alastairs
Copy link
Contributor Author

Sure thing. I'm running on Windows, with GPG installed via scoop. I have the same version as you.

> gpg --export-secret-keys F8FB0DAE2EA9AD9156F0DB1912AC019F3F154890 > secret.key
> gpg --import .\secret.key
gpg: packet(3) with unknown version 7
gpg: read_block: read error: Invalid packet
gpg: import from '.\secret.key' failed: Invalid keyring
gpg: Total number processed: 0

The same thing happens if I set GNUPGHOME as you did.

> gpg --version
gpg (GnuPG) 2.2.18
libgcrypt 1.8.5
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: C:/Users/AlastairSmith/scoop/apps/gpg/current/home
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

@hiddeco
Copy link
Member

hiddeco commented Dec 9, 2019

Seems to be related to https://dev.gnupg.org/T3194. Given the dos2unix solution mentioned there is a pain to both document and use, adding the --armor option makes sense.

I found that a GPG exported with solely `--export-secret-keys` could not be imported via `gpg --import`, even on the same machine and with the same GPG version as those from which the key was exported. Including the `--armor` option, however, producing ASCII-armoured output, resolved the issue.
@hiddeco hiddeco merged commit 05cc850 into fluxcd:master Dec 9, 2019
@2opremio 2opremio added this to the 1.17.0 milestone Dec 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs Issue or PR relates to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants