mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
card: Allow PEM encoded certificates in "writecert".
* tools/gpg-card.c (cmd_writecert): Convert from base64. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
772bba34ea
commit
4e1f04a4cd
@ -1647,6 +1647,20 @@ cmd_writecert (card_info_t info, char *argstr)
|
||||
err = get_data_from_file (argstr, &data, &datalen);
|
||||
if (err)
|
||||
goto leave;
|
||||
if (ascii_memistr (data, datalen, "-----BEGIN CERTIFICATE-----")
|
||||
&& ascii_memistr (data, datalen, "-----END CERTIFICATE-----")
|
||||
&& !memchr (data, 0, datalen) && !memchr (data, 1, datalen))
|
||||
{
|
||||
struct b64state b64;
|
||||
|
||||
err = b64dec_start (&b64, "");
|
||||
if (!err)
|
||||
err = b64dec_proc (&b64, data, datalen, &datalen);
|
||||
if (!err)
|
||||
err = b64dec_finish (&b64);
|
||||
if (err)
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user