mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
g10: Unattended key generation "Key-Grip" and "Subkey-Grip".
* g10/keygen.c (pSUBKEYGRIP): New. (read_parameter_file): Add "Key-Grip" and "Subkey-Grip". (do_generate_keypair): Support pSUBKEYGRIP. -- In the manual, it says "Key-Grip". gpgsm also supports "Key-Grip". Adding "Subkey-Grip" now, adding "Key-Grip" makes sense. GnuPG-bug-id: 3478 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
d63b7966cd
commit
6c63a04569
25
g10/keygen.c
25
g10/keygen.c
@ -89,7 +89,8 @@ enum para_name {
|
||||
pCARDBACKUPKEY,
|
||||
pHANDLE,
|
||||
pKEYSERVER,
|
||||
pKEYGRIP
|
||||
pKEYGRIP,
|
||||
pSUBKEYGRIP,
|
||||
};
|
||||
|
||||
struct para_data_s {
|
||||
@ -3648,6 +3649,8 @@ read_parameter_file (ctrl_t ctrl, const char *fname )
|
||||
{ "Handle", pHANDLE },
|
||||
{ "Keyserver", pKEYSERVER },
|
||||
{ "Keygrip", pKEYGRIP },
|
||||
{ "Key-Grip", pKEYGRIP },
|
||||
{ "Subkey-grip", pSUBKEYGRIP },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
IOBUF fp;
|
||||
@ -4696,8 +4699,7 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
|
||||
if (!err && card && get_parameter (para, pAUTHKEYTYPE))
|
||||
{
|
||||
err = gen_card_key (3, get_parameter_algo( para, pAUTHKEYTYPE, NULL ),
|
||||
0, pub_root, ×tamp,
|
||||
get_parameter_u32 (para, pKEYEXPIRE));
|
||||
0, pub_root, ×tamp, expire);
|
||||
if (!err)
|
||||
err = write_keybinding (ctrl, pub_root, pri_psk, NULL,
|
||||
PUBKEY_USAGE_AUTH, timestamp, cache_nonce);
|
||||
@ -4705,11 +4707,18 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
|
||||
|
||||
if (!err && get_parameter (para, pSUBKEYTYPE))
|
||||
{
|
||||
sub_psk = NULL;
|
||||
int subkey_algo = get_parameter_algo (para, pSUBKEYTYPE, NULL);
|
||||
|
||||
s = NULL;
|
||||
if (!card || (s = get_parameter_value (para, pCARDBACKUPKEY)))
|
||||
key_from_hexgrip = get_parameter_value (para, pSUBKEYGRIP);
|
||||
if (key_from_hexgrip)
|
||||
err = do_create_from_keygrip (ctrl, subkey_algo, key_from_hexgrip,
|
||||
pub_root, timestamp,
|
||||
get_parameter_u32 (para, pSUBKEYEXPIRE),
|
||||
1);
|
||||
else if (!card || (s = get_parameter_value (para, pCARDBACKUPKEY)))
|
||||
{
|
||||
err = do_create (get_parameter_algo (para, pSUBKEYTYPE, NULL),
|
||||
err = do_create (subkey_algo,
|
||||
get_parameter_uint (para, pSUBKEYLENGTH),
|
||||
get_parameter_value (para, pSUBKEYCURVE),
|
||||
pub_root,
|
||||
@ -4735,9 +4744,7 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
|
||||
}
|
||||
else
|
||||
{
|
||||
err = gen_card_key (2, get_parameter_algo (para, pSUBKEYTYPE, NULL),
|
||||
0, pub_root, ×tamp,
|
||||
get_parameter_u32 (para, pKEYEXPIRE));
|
||||
err = gen_card_key (2, subkey_algo, 0, pub_root, ×tamp, expire);
|
||||
}
|
||||
|
||||
if (!err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user