1 /* call-agent.h - Divert operations to the agent
2 * Copyright (C) 2003 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 #ifndef GNUPG_G10_CALL_AGENT_H
22 #define GNUPG_G10_CALL_AGENT_H
25 struct agent_card_info_s
27 int error
; /* private. */
28 char *serialno
; /* malloced hex string. */
29 char *disp_name
; /* malloced. */
30 char *disp_lang
; /* malloced. */
31 int disp_sex
; /* 0 = unspecified, 1 = male, 2 = female */
32 char *pubkey_url
; /* malloced. */
33 char *login_data
; /* malloced. */
34 char *private_do
[4]; /* malloced. */
50 unsigned long sig_counter
;
51 int chv1_cached
; /* True if a PIN is not required for each
52 signing. Note that the gpg-agent might cache
54 int chvmaxlen
[3]; /* Maximum allowed length of a CHV. */
55 int chvretry
[3]; /* Allowed retries for the CHV; 0 = blocked. */
58 struct agent_card_genkey_s
{
67 /* Release the card info structure. */
68 void agent_release_card_info (struct agent_card_info_s
*info
);
70 /* Return card info. */
71 int agent_learn (struct agent_card_info_s
*info
);
73 /* Update INFO with the attribute NAME. */
74 int agent_scd_getattr (const char *name
, struct agent_card_info_s
*info
);
76 /* Check whether the secret key for the key identified by HEXKEYGRIP
77 is available. Return 0 for yes or an error code. */
78 int agent_havekey (const char *hexkeygrip
);
80 /* Send a SETATTR command to the SCdaemon. */
81 int agent_scd_setattr (const char *name
,
82 const unsigned char *value
, size_t valuelen
,
83 const char *serialno
);
85 /* Send a WRITEKEY command to the SCdaemon. */
86 int agent_scd_writekey (int keyno
, const char *serialno
,
87 const unsigned char *keydata
, size_t keydatalen
);
89 /* Send a GENKEY command to the SCdaemon. */
90 int agent_scd_genkey (struct agent_card_genkey_s
*info
, int keyno
, int force
,
91 const char *serialno
);
93 /* Send a PKSIGN command to the SCdaemon. */
94 int agent_scd_pksign (const char *keyid
, int hashalgo
,
95 const unsigned char *indata
, size_t indatalen
,
96 unsigned char **r_buf
, size_t *r_buflen
);
98 /* Send a PKDECRYPT command to the SCdaemon. */
99 int agent_scd_pkdecrypt (const char *serialno
,
100 const unsigned char *indata
, size_t indatalen
,
101 unsigned char **r_buf
, size_t *r_buflen
);
103 /* Change the PIN of an OpenPGP card or reset the retry counter. */
104 int agent_scd_change_pin (int chvno
, const char *serialno
);
106 /* Send the CHECKPIN command to the SCdaemon. */
107 int agent_scd_checkpin (const char *serialno
);
109 /* Dummy function, only implemented by gpg 1.4. */
110 void agent_clear_pin_cache (const char *sn
);
113 #endif /*GNUPG_G10_CALL_AGENT_H*/