Re: Best way to get fingerprint programatically

2019-12-19 Thread Werner Koch via Gnupg-users
On Wed, 18 Dec 2019 11:51, john doe said: > By any chance, could something like the following be implemented?: > > $ gpg -K --print-fingerprint-only test I doubt that this helps because the only way to get a single result is to use the fingerprint for . Thus a second info item would be required

Re: Best way to get fingerprint programatically

2019-12-18 Thread Eric F via Gnupg-users
On 12/18/19 10:56 , Andrew Gallagher wrote: > On 18/12/2019 09:32, Werner Koch via Gnupg-users wrote: >> The -F:: is an interesting hack but Andrew's or my variant works >> with all AWK implementations: >> >>awk -F: '$1=="fpr" {print $10}' | head -1 > Aha, I forgot about handling

Re: Best way to get fingerprint programatically

2019-12-18 Thread john doe
On 12/18/2019 10:56 AM, Andrew Gallagher wrote: > On 18/12/2019 09:32, Werner Koch via Gnupg-users wrote: >> The -F:: is an interesting hack but Andrew's or my variant works >> with all AWK implementations: >> >>awk -F: '$1=="fpr" {print $10}' | head -1 > > Aha, I forgot about handling

Re: Best way to get fingerprint programatically

2019-12-18 Thread Andrew Gallagher
On 18/12/2019 09:32, Werner Koch via Gnupg-users wrote: > The -F:: is an interesting hack but Andrew's or my variant works > with all AWK implementations: > >awk -F: '$1=="fpr" {print $10}' | head -1 Aha, I forgot about handling multiple results. Note that you don't need head if you're

Re: Best way to get fingerprint programatically

2019-12-18 Thread Werner Koch via Gnupg-users
On Wed, 18 Dec 2019 08:19, john doe said: > In other words, why '--quick-set-expire' requires a fingerprint and does > not accept a . Only the fingerprint is a unique identifier for the keyblock (aka certificate, public key). Allowing a User-id would require extra code in gpg and by the caller

Re: Best way to get fingerprint programatically

2019-12-18 Thread Andrew Gallagher
On 18/12/2019 07:19, john doe wrote: > $ gpg --quick-set-expire $(gpg --with-colons -k test | awk -F: > 'NR==3{print substr($2,1,length($2)-1)}') 1d > > I'm just wondering if there isn't a better, programatically, way to go > about it? Your awk looks awkward to me. What about this

Best way to get fingerprint programatically

2019-12-18 Thread john doe
Hi, I'm using the following command to get the fingerprint to quickly change the expiration date on a key. $ gpg --quick-set-expire $(gpg --with-colons -k test | awk -F: 'NR==3{print substr($2,1,length($2)-1)}') 1d I'm just wondering if there isn't a better, programatically, way to go