I'm looking a way to generate a GPG key with a given expiration date. In GPG/GPG2, when you create a new key you can set a date only in signature, but the key expiration date is always set to zero.
:public key packet: version 4, algo 1, created 1417388459, expires 0 pkey: [2048 bits] pkey: [17 bits] :user ID packet: "my user id mymail" :signature packet: algo 1, keyid mykeyid version 4, created 1417688533, md5len 0, sigclass 0x13 digest algo 2, begin of digest f0 52 hashed subpkt 27 len 1 (key flags: 03) hashed subpkt 9 len 4 (key expires after 5y31d23h59m) hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
I found some discussion about why GPG handle the expiration (https://davesteele.github.io/gpg/2014/09/20/anatomy-of-a-gpg-key/ is a good starting point) but I don't know if there is a way to set an expiration for your primary key.
How to create a primary key with the expiration date set?