Why gpg 2.1.9 cannot export secret key without passphrase?

Peter Lebbing peter at digitalbrains.com
Tue Dec 1 11:24:05 CET 2015


On 30/11/15 23:54, Andrey Utkin wrote:
> Could you please direct me to exact S2K-stuff modes for exporting it 
> which would be compliant with earlier GnuPG branches 1.4 and 2.0?
> [...]
> But for unattended processing cases, I'd like a mode that makes utils
> skip all passphrase entry prompts. I guess the no-encryption case
> ("trivially cracked by anyone") is needed here. Which of the
> mentioned modes was used in 1.4 and 2.0 for exporting without
> passphrase?

"Trivially cracked" implies that there is something to crack. That would
be the silly case with the empty string as the password. Instead, the
first octet in the secret part of the secret key packet indicates
whether to use an S2K or not:

>From [1]:
>      - One octet indicating string-to-key usage conventions.  Zero
>        indicates that the secret-key data is not encrypted.  255 or 254
>        indicates that a string-to-key specifier is being given.  Any
>        other value is a symmetric-key encryption algorithm identifier.

The "any other" stuff is ancient legacy stuff, and MUST NOT be produced
by a conforming implementation. This byte is zero when there is no
encryption, and the following bytes are just the plaintext version of
the secret parts:

>      - Plain or encrypted multiprecision integers comprising the secret
>        key data.  These algorithm-specific fields are as described
>        below.

In this case, read it as "plain multiprecision integers ...".

HTH,

Peter.

[1] http://tools.ietf.org/html/rfc4880#section-5.5.3

-- 
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <http://digitalbrains.com/2012/openpgp-key-peter>



More information about the Gnupg-users mailing list