Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: GnuPG: users

way to see what cipher/algo was used to create your key?

 

 

GnuPG users RSS feed   Index | Next | Previous | View Threaded


smickson at hotmail

Jun 17, 2012, 6:16 AM

Post #1 of 15 (529 views)
Permalink
way to see what cipher/algo was used to create your key?

I see that --edit-key > pref lists out preferences. I'm assuming the first S is default cipher, first H is default algo, etc? so if a key is generated it will use the first S, first H, etc. But why are all those other S and H options listed? when would they ever be used to create keys?

Lastly, if you created your key some time ago (on a different machine) and don't know what the default cipher/hash was at the time, is there a way to find out what cipher and hash was used in the creation of your key?


dshaw at jabberwocky

Jun 17, 2012, 8:47 AM

Post #2 of 15 (521 views)
Permalink
Re: way to see what cipher/algo was used to create your key? [In reply to]

On Jun 17, 2012, at 9:16 AM, Sam Smith wrote:

> I see that --edit-key > pref lists out preferences. I'm assuming the first S is default cipher, first H is default algo, etc? so if a key is generated it will use the first S, first H, etc. But why are all those other S and H options listed? when would they ever be used to create keys?
>
> Lastly, if you created your key some time ago (on a different machine) and don't know what the default cipher/hash was at the time, is there a way to find out what cipher and hash was used in the creation of your key?

--edit-key -> pref shows you the preferences on that specific key (try using "showpref" instead for a more user friendly display). It does not show what what ciphers are chosen for generating a new key. You can change the preferences whenever you like via --edit-key -> setpref

OpenPGP doesn't really have the notion of a default cipher (or other preference). Rather, it has lists, ranked in order of preference, for ciphers, hashes, and compression algorithms. These do double duty, in that they tell someone encrypting to your key both what algorithms you can handle (i.e. if your implementation couldn't handle CAST5, it wouldn't be on your list at all), and also which algorithms you prefer to use (i.e. if you like AES more than CAST5, you'd list AES before CAST5 in the list).

Here's how it works - when encrypting to a bunch of keys, GPG needs to send a message that is usable by all recipients (as what's the point of sending a message to someone that they can't read?). To do this, it has to find a set of algorithms (cipher, compression, etc) that every recipient can handle. The method is simple: read everyone's preference lists, and find the intersection of the preferences. This intersection is a list of algorithms that every recipient can handle. Pick an algorithm from this list, and you are safe that no recipient won't be able to read the message.

To deal with the case where there is no intersection (say, Alice put CAST5 and AES in her list, and Baker put TWOFISH and BLOWFISH in his list), the standard requires that all cipher lists have 3DES in them somewhere, all hash lists have SHA-1 in there somewhere, and all compression lists have "uncompressed" in there somewhere. If the user doesn't explicitly put it in, it is assumed to be there at the end of the list. This guarantees that there will aways be at least one algorithm in the intersection (and also requires all OpenPGP programs to implement these algorithms).

Methods vary in how to pick an algorithm from the list - all the standard requires is that it comes from the list at all. GPG actually ranks each algorithm so that more "votes" for that algorithm can increase the chance of it being chosen, but it is equally correct (though perhaps not particularly friendly) for an implementation to always pick 3DES, for example.

David


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


smickson at hotmail

Jun 18, 2012, 4:30 PM

Post #3 of 15 (531 views)
Permalink
RE: way to see what cipher/algo was used to create your key? [In reply to]

Does anybody know a way to learn what cipher & hash was used to create the secret key?

Also, does anyone know a way to make AES256 & SHA256 the default cipher/hash combo for --symmetric encryption? I can create these using --cipher-algo etc but is there a way to make them default for if I use this command: gpg -a -o file-encrypted -c file


From: smickson [at] hotmail
To: gnupg-users [at] gnupg
Subject: way to see what cipher/algo was used to create your key?
Date: Sun, 17 Jun 2012 09:16:46 -0400





I see that --edit-key > pref lists out preferences. I'm assuming the first S is default cipher, first H is default algo, etc? so if a key is generated it will use the first S, first H, etc. But why are all those other S and H options listed? when would they ever be used to create keys?

Lastly, if you created your key some time ago (on a different machine) and don't know what the default cipher/hash was at the time, is there a way to find out what cipher and hash was used in the creation of your key?


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


mailinglisten at hauke-laging

Jun 18, 2012, 8:21 PM

Post #4 of 15 (522 views)
Permalink
Re: way to see what cipher/algo was used to create your key? [In reply to]

Am Mo 18.06.2012, 19:30:44 schrieb Sam Smith:
> Does anybody know a way to learn what cipher & hash was used to create the
> secret key?

May it be you mix up things? The key is just a random number. It can be used
with ciphers but you don't use ciphers to generate a key. Neither a symmetric
nor an asymmetric one. There are algorithms (no ciphers) which determine
whether a random number is suitable as asymmetric key but that's probably not
what you mean.


> Also, does anyone know a way to make AES256 & SHA256 the default cipher/hash
> combo for --symmetric encryption? I can create these using --cipher-algo
> etc but is there a way to make them default for if I use this command: gpg
> -a -o file-encrypted -c file

You mean except for putting cipher-algo in your config file...?


Hauke
--
PGP: D44C 6A5B 71B0 427C CED3 025C BD7D 6D27 ECCB 5814
Attachments: signature.asc (0.54 KB)


rjh at sixdemonbag

Jun 18, 2012, 8:31 PM

Post #5 of 15 (522 views)
Permalink
Re: way to see what cipher/algo was used to create your key? [In reply to]

On 06/18/2012 11:21 PM, Hauke Laging wrote:
> You mean except for putting cipher-algo in your config file...?

Please don't advocate this. cipher-algo and digest-algo can potentially
wreck interoperability with other OpenPGP clients. For this reason most
users will be best-served by leaving those options out of their gpg.conf
file. Specify it on the command line each time if you must.


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


MichaelQuigley at TheWay

Jun 19, 2012, 6:05 AM

Post #6 of 15 (523 views)
Permalink
Re: way to see what cipher/algo was used to create your key? [In reply to]

gnupg-users-bounces [at] gnupg wrote on 06/19/2012 01:50:04 AM:
> ----- Message from Sam Smith <smickson [at] hotmail> on Mon, 18 Jun
> 2012 19:30:44 -0400 -----
>
> To:
>
> Gnupg <gnupg-users [at] gnupg>
>
> Subject:
>
> RE: way to see what cipher/algo was used to create your key?
>
> Does anybody know a way to learn what cipher & hash was used to
> create the secret key?

The details file documents using the --list-keys command with the and
specifying the --with-fingerprint option twice. This produces a list
which shows the algorithm used for the key. This can also be used with
the --list-secret-keys command.

e.g., enter the following command:

gpg --with-fingerprint --with-fingerprint --with-colons --list-secret-keys

Description from DETAILS:

4. Field: Algorithm: 1 = RSA
16 = Elgamal (encrypt only)
17 = DSA (sometimes called DH, sign only)
20 = Elgamal (sign and encrypt - don't use them!)
(for other id's see include/cipher.h)


mailinglisten at hauke-laging

Jun 19, 2012, 6:59 AM

Post #7 of 15 (523 views)
Permalink
Re: way to see what cipher/algo was used to create your key? [In reply to]

Am Di 19.06.2012, 09:05:41 schrieb MichaelQuigley [at] TheWay:

> The details file documents using the --list-keys command with the and
> specifying the --with-fingerprint option twice. This produces a list
> which shows the algorithm used for the key. This can also be used with
> the --list-secret-keys command.

The key type is shown even by the most simple form of --list-keys:

start cmd:> gpg --list-keys

pub 1024D
sub 2048g
sub 2048R
sub 2048R
sub 2048R


Hauke
--
PGP: D44C 6A5B 71B0 427C CED3 025C BD7D 6D27 ECCB 5814
Attachments: signature.asc (0.54 KB)


vedaal at nym

Jun 19, 2012, 10:50 AM

Post #8 of 15 (525 views)
Permalink
way to see what cipher/algo was used to create your key? [In reply to]

Sam Smith smickson at hotmail.com wrote on:
Tue Jun 19 01:30:44 CEST 2012

>a way to learn what cipher & hash was used to create the secret
key?


export your secret key as seckey.asc
then do gpg --list-packets seckey.asc


here is an example of one of mine:

V:\z\>gpg --list-packets v:\seckey.asc
gpg: armor: BEGIN PGP PRIVATE KEY BLOCK
gpg: armor header: Version: GnuPG v1.4.12 (MingW32)
gpg: armor header: Comment: Acts of Kindness better the World, and
protect the Soul
:secret key packet:
version 4, algo 1, created 1201031494, expires 0
skey[0]: [4096 bits]
skey[1]: [17 bits]
iter+salt S2K, algo: 10, SHA1 protection, hash: 8, salt:

'version 4' describes the key-version
(all current gnupg keys are v4, older keys from pgp were v3, maybe
when elliptic curve crypto gets done, there might be a v5 ;-) )

'algo 1' describes the 'type' of key (RSA, ELG, DSA, etc.) and the
1
refers to RSA

the line beginning 'iter+salt' describes the algorithm used to
encrypt the secret key, and the hash used.

'algo: 10' is Twofish
'hash 8' is SHA256

(not the 'defaults')
your key will probably show 'algo: 9' (AES256) and 'hash: 2' (SHA1)


(btw, Should a listing explaining these things be in the FAQ ? )


vedaal


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


rjh at sixdemonbag

Jun 19, 2012, 11:09 AM

Post #9 of 15 (517 views)
Permalink
Re: way to see what cipher/algo was used to create your key? [In reply to]

On 06/19/2012 01:50 PM, vedaal [at] nym wrote:
> (btw, Should a listing explaining these things be in the FAQ ? )

I won't put it in there. Once you open the door to that, then you have
to answer questions about "so how do I change these settings?" and then
you're explaining half of the edit-key interface. You have to draw the
line somewhere.

I draw it at explaining politely and reasonably that the defaults are
safe for the overwhelming majority of users and there's no need to
change them.

_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


wk at gnupg

Jun 19, 2012, 1:27 PM

Post #10 of 15 (520 views)
Permalink
Re: way to see what cipher/algo was used to create your key? [In reply to]

On Tue, 19 Jun 2012 19:50, vedaal [at] nym said:

> (all current gnupg keys are v4, older keys from pgp were v3, maybe
> when elliptic curve crypto gets done, there might be a v5 ;-) )

2.1beta has ECC support as described by RFC6637. Still using v4.


Shalom-Salam,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


smickson at hotmail

Jun 21, 2012, 6:00 AM

Post #11 of 15 (517 views)
Permalink
RE: "SHA1 Protection" from way to see what cipher/algo was used to create your key? [In reply to]

when running the command: gpg --list-packets <keyname.asc>

there is an outputted line that reads: "SHA1 protection"

I did some looking online and saw that this line stays even when people change their hash algorithm to something else (like SHA2).

If the "SHA1 protection" is not indicating the use of SHA1 hash, what is it communicating? If a SHA2 hash is being used to mangle the passphrase of the secret key being stored on the disk, why is the line "SHA1 protection" being shown?



> Date: Tue, 19 Jun 2012 13:50:47 -0400
> To: gnupg-users [at] gnupg
> Subject: way to see what cipher/algo was used to create your key?
> From: vedaal [at] nym
>
> Sam Smith smickson at hotmail.com wrote on:
> Tue Jun 19 01:30:44 CEST 2012
>
> >a way to learn what cipher & hash was used to create the secret
> key?
>
>
> export your secret key as seckey.asc
> then do gpg --list-packets seckey.asc
>
>
> here is an example of one of mine:
>
> V:\z\>gpg --list-packets v:\seckey.asc
> gpg: armor: BEGIN PGP PRIVATE KEY BLOCK
> gpg: armor header: Version: GnuPG v1.4.12 (MingW32)
> gpg: armor header: Comment: Acts of Kindness better the World, and
> protect the Soul
> :secret key packet:
> version 4, algo 1, created 1201031494, expires 0
> skey[0]: [4096 bits]
> skey[1]: [17 bits]
> iter+salt S2K, algo: 10, SHA1 protection, hash: 8, salt:
>
> 'version 4' describes the key-version
> (all current gnupg keys are v4, older keys from pgp were v3, maybe
> when elliptic curve crypto gets done, there might be a v5 ;-) )
>
> 'algo 1' describes the 'type' of key (RSA, ELG, DSA, etc.) and the
> 1
> refers to RSA
>
> the line beginning 'iter+salt' describes the algorithm used to
> encrypt the secret key, and the hash used.
>
> 'algo: 10' is Twofish
> 'hash 8' is SHA256
>
> (not the 'defaults')
> your key will probably show 'algo: 9' (AES256) and 'hash: 2' (SHA1)
>
>
> (btw, Should a listing explaining these things be in the FAQ ? )
>
>
> vedaal
>
>
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users [at] gnupg
> http://lists.gnupg.org/mailman/listinfo/gnupg-users


dshaw at jabberwocky

Jun 21, 2012, 6:15 AM

Post #12 of 15 (512 views)
Permalink
Re: "SHA1 Protection" from way to see what cipher/algo was used to create your key? [In reply to]

On Jun 21, 2012, at 9:00 AM, Sam Smith wrote:

> when running the command: gpg --list-packets <keyname.asc>
>
> there is an outputted line that reads: "SHA1 protection"
>
> I did some looking online and saw that this line stays even when people change their hash algorithm to something else (like SHA2).
>
> If the "SHA1 protection" is not indicating the use of SHA1 hash, what is it communicating? If a SHA2 hash is being used to mangle the passphrase of the secret key being stored on the disk, why is the line "SHA1 protection" being shown?

It means that the secret key is has (in addition to the passphrase) an internal SHA-1 hash to detect tampering. It's basically a large checksum, used to foil attacks that involve modifying the secret key. It's not related to the hash algorithm you use when signing things.

David


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


peter at digitalbrains

Jun 21, 2012, 6:57 AM

Post #13 of 15 (526 views)
Permalink
Re: "SHA1 Protection" from way to see what cipher/algo was used to create your key? [In reply to]

On 21/06/12 15:00, Sam Smith wrote:
> when running the command: gpg --list-packets <keyname.asc>
>
> there is an outputted line that reads: "SHA1 protection"

First of all, it seems you understand it, but let me emphasize this: the
algorithms you get when using the inspection method vedaal showed you, are /not/
the algorithms used to create your secret key, as you asked. There is no cipher
or hashing involved in creating a key; it's just a random number which must
satisfy some mathematical properties. Key creation is determining random numbers
that satisfy the needed properties.

The symmetric cipher and hash algorithm are used to encrypt and protect the
secret key; protection is via a password.

All the details are in RFC 4880; you could read it at, e.g., [1]. It's a very
technical document.

I'll take the output vedaal gave as an example:

> :secret key packet:
> version 4, algo 1, created 1201031494, expires 0
> skey[0]: [4096 bits]
> skey[1]: [17 bits]
> iter+salt S2K, algo: 10, SHA1 protection, hash: 8, salt:

A password is used to protect this key. This password, along with a known, but
random "salting" value, is repeatedly fed through SHA256 hashing (hash: 8). This
is what "iter+salt S2K" means: A String-To-Key method that iteratively hashes,
with a salt. The result of this S2K is a symmetric encryption key.

The actual secret part of the secret key is protected by a symmetric cipher,
TWOFISH (algo: 10). The secret material is encrypted with TWOFISH using the key
the S2K gave.

However, there is the possibility for an attacker to modify this secret
material. If you don't notice, he has an attack vector on you as he can modify
the key you are using to sign and decrypt. To prevent modification, the secret
key material is hashed using the SHA1 algorithm, and this hash is stored in the
encrypted part. If the attacker modifies the encrypted part, the hash won't
check out anymore, and an OpenPGP implementation will reject the key as corrupted.

So that's the purpose of the "SHA1 protection".

The hashing algorithm you can choose is the one used to create a key with the
S2K specifier. The hashing algorithm to protect against modification of the
encrypted material is fixed. Note that since it is all inside the encrypted
part, a lot of attacks that are possible on hashing algorithms won't work
anymore. SHA1 would have to be extremely broken to be problematic for this
application.

Peter.

PS: BTW, the absolute worst possible checksum to use to protect integrity, when
put inside a streaming-mode cipher, is a cyclic redundancy check. Which they
used in WEP wireless LAN protection. My mouth fell open when I learned about
this :).

[1] <https://tools.ietf.org/html/rfc4880>

--
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://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt

_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


rjh at sixdemonbag

Jun 21, 2012, 7:27 AM

Post #14 of 15 (510 views)
Permalink
Re: "SHA1 Protection" from way to see what cipher/algo was used to create your key? [In reply to]

On 06/21/2012 09:57 AM, Peter Lebbing wrote:
> There is no cipher
> or hashing involved in creating a key...

This may or may not be true, depending on what method of random number
generation is being used. ANSI X9.17, Yarrow and Fortuna are three
examples of pseudorandom number generators that are built out of
cryptographic algorithms. libgcrypt supports at least the former:
Linux's /dev/urandom is (I think) Yarrow-based.

Nine in ten says the OP doesn't care about this and was operating under
a misconception, which you and others have ably corrected. One in ten
says we've been misunderstanding what the OP has been asking, and the
OP's really asking a technical question about PRNG operation. :)

_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


smickson at hotmail

Jun 21, 2012, 7:39 AM

Post #15 of 15 (509 views)
Permalink
RE: "SHA1 Protection" from way to see what cipher/algo was used to create your key? [In reply to]

Thanks for this detailed explanation. I really appreciate it.

I've read of theoretical attacks against SHA1. whenever I hear of such things I start to be leery when using such Hash. Seeing the advanced attack capabilities demonstrated by Flame/Stuxnet leads me to believe theoretical is only temporary. I agree though that "SHA1 protection" implementation sounds good. But seems to me it would be safer to use SHA2 for the hash used in producing the symmetric key.

> Date: Thu, 21 Jun 2012 15:57:28 +0200
> From: peter [at] digitalbrains
> To: smickson [at] hotmail
> CC: vedaal [at] nym; gnupg-users [at] gnupg
> Subject: Re: "SHA1 Protection" from way to see what cipher/algo was used to create your key?
>
> On 21/06/12 15:00, Sam Smith wrote:
> > when running the command: gpg --list-packets <keyname.asc>
> >
> > there is an outputted line that reads: "SHA1 protection"
>
> First of all, it seems you understand it, but let me emphasize this: the
> algorithms you get when using the inspection method vedaal showed you, are /not/
> the algorithms used to create your secret key, as you asked. There is no cipher
> or hashing involved in creating a key; it's just a random number which must
> satisfy some mathematical properties. Key creation is determining random numbers
> that satisfy the needed properties.
>
> The symmetric cipher and hash algorithm are used to encrypt and protect the
> secret key; protection is via a password.
>
> All the details are in RFC 4880; you could read it at, e.g., [1]. It's a very
> technical document.
>
> I'll take the output vedaal gave as an example:
>
> > :secret key packet:
> > version 4, algo 1, created 1201031494, expires 0
> > skey[0]: [4096 bits]
> > skey[1]: [17 bits]
> > iter+salt S2K, algo: 10, SHA1 protection, hash: 8, salt:
>
> A password is used to protect this key. This password, along with a known, but
> random "salting" value, is repeatedly fed through SHA256 hashing (hash: 8). This
> is what "iter+salt S2K" means: A String-To-Key method that iteratively hashes,
> with a salt. The result of this S2K is a symmetric encryption key.
>
> The actual secret part of the secret key is protected by a symmetric cipher,
> TWOFISH (algo: 10). The secret material is encrypted with TWOFISH using the key
> the S2K gave.
>
> However, there is the possibility for an attacker to modify this secret
> material. If you don't notice, he has an attack vector on you as he can modify
> the key you are using to sign and decrypt. To prevent modification, the secret
> key material is hashed using the SHA1 algorithm, and this hash is stored in the
> encrypted part. If the attacker modifies the encrypted part, the hash won't
> check out anymore, and an OpenPGP implementation will reject the key as corrupted.
>
> So that's the purpose of the "SHA1 protection".
>
> The hashing algorithm you can choose is the one used to create a key with the
> S2K specifier. The hashing algorithm to protect against modification of the
> encrypted material is fixed. Note that since it is all inside the encrypted
> part, a lot of attacks that are possible on hashing algorithms won't work
> anymore. SHA1 would have to be extremely broken to be problematic for this
> application.
>
> Peter.
>
> PS: BTW, the absolute worst possible checksum to use to protect integrity, when
> put inside a streaming-mode cipher, is a cyclic redundancy check. Which they
> used in WEP wireless LAN protection. My mouth fell open when I learned about
> this :).
>
> [1] <https://tools.ietf.org/html/rfc4880>
>
> --
> 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://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt

GnuPG users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.