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

Mailing List Archive: GnuPG: users

Algorithm used to encrypt

 

 

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


htd at fritha

Nov 8, 2009, 8:52 AM

Post #1 of 3 (541 views)
Permalink
Algorithm used to encrypt

Hi,

seems I'm just too stupid today to find what's maybe obvious:
given an ascii armored gpg encrypted file, how can I find out what
algorithm has been used to encrypt the file?

Thanks,
Heinz.

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


mephisto at fastmail

Nov 8, 2009, 7:57 PM

Post #2 of 3 (468 views)
Permalink
Re: Algorithm used to encrypt [In reply to]

On Sun, Nov 08, 2009 at 05:52:37PM +0100 Heinz Diehl wrote:
> Hi,
>
> seems I'm just too stupid today to find what's maybe obvious:
> given an ascii armored gpg encrypted file, how can I find out what
> algorithm has been used to encrypt the file?
>
> Thanks,
> Heinz.

I should preface what I say by indicating that I always use "verbose"
mode (set in gpg.conf):

When I invoke gpg on a file encrypted with my public key, it displays
the public key algorithm used to encrypt the session key before it asks
for a passphrase. After I enter the passphrase, the symmetric algorithm
is displayed as well. I would infer (perhaps mistakenly) that data
identifying the symmetric algo is stored, encrypted, with the session
key, and is therefore only accessible after the first phase of the
decryption process (i.e. decrypting the session key material using the
appropriate private key) is successful.

If my inference is correct, then it is possible (in fact, necessary) to
be able to ascertain the public key algo on any OpenPGP encrypted
document, but it is only possible to determine the symmetric algo if you
have access to the appropriate private key.

-Kevin

--
"Le hasard favorise l'esprit préparé."
--Louis Pasteur

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


mephisto at fastmail

Nov 8, 2009, 8:19 PM

Post #3 of 3 (467 views)
Permalink
Re: Algorithm used to encrypt [In reply to]

On Sun, Nov 08, 2009 at 10:57:46PM -0500 I wrote:
> On Sun, Nov 08, 2009 at 05:52:37PM +0100 Heinz Diehl wrote:
> > Hi,
> >
> > seems I'm just too stupid today to find what's maybe obvious:
> > given an ascii armored gpg encrypted file, how can I find out what
> > algorithm has been used to encrypt the file?
> >
> > Thanks,
> > Heinz.
>

> ... I would infer (perhaps mistakenly) that data identifying the
> symmetric algo is stored, encrypted, with the session key, and is
> therefore only accessible after the first phase of the decryption
> process (i.e. decrypting the session key material using the
> appropriate private key) is successful. If my inference is correct...
>

I figured that I owed you a better respons than "I guess..." so I looked
the following up. I would seem that my guess was on the money.

The following is quoted from RFC4880 (OpenPGP Message Format):


5.1. Public-Key Encrypted Session Key Packets (Tag 1)

A Public-Key Encrypted Session Key packet holds the session key used
to encrypt a message.

...

The body of this packet consists of:

- A one-octet number giving the version number of the packet type.
The currently defined value for packet version is 3.

- An eight-octet number that gives the Key ID of the public key to
which the session key is encrypted. If the session key is
encrypted to a subkey, then the Key ID of this subkey is used
here instead of the Key ID of the primary key.

- A one-octet number giving the public-key algorithm used.

- A string of octets that is the encrypted session key. This
string takes up the remainder of the packet, and its contents are
dependent on the public-key algorithm used.

Algorithm Specific Fields for RSA encryption

- multiprecision integer (MPI) of RSA encrypted value m**e mod n.

Algorithm Specific Fields for Elgamal encryption:

- MPI of Elgamal (Diffie-Hellman) value g**k mod p.

- MPI of Elgamal (Diffie-Hellman) value m * y**k mod p.

The value "m" in the above formulas is derived from the session key
as follows. First, the session key is prefixed with a one-octet
algorithm identifier that specifies the symmetric encryption
algorithm used to encrypt the following Symmetrically Encrypted Data
Packet...


So, it would appear that the symmetric algo is specified as part of the
"string of octets that is the encrypted session key," and therefore,
being encrypted, is only accessible if you have the means (the correct
private key) to decrypt the packet.

-Kevin

--
"Le hasard favorise l'esprit préparé."
--Louis Pasteur

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

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.