2003-06-05 07:14:21 +00:00
|
|
|
/* call-agent.h - Divert operations to the agent
|
|
|
|
* Copyright (C) 2003 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of GnuPG.
|
|
|
|
*
|
|
|
|
* GnuPG is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-04 19:49:40 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-06-05 07:14:21 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GnuPG is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-04 19:49:40 +00:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2003-06-05 07:14:21 +00:00
|
|
|
*/
|
|
|
|
#ifndef GNUPG_G10_CALL_AGENT_H
|
|
|
|
#define GNUPG_G10_CALL_AGENT_H
|
|
|
|
|
2003-06-27 20:53:09 +00:00
|
|
|
|
2006-05-23 16:19:43 +00:00
|
|
|
struct agent_card_info_s
|
|
|
|
{
|
2003-06-27 20:53:09 +00:00
|
|
|
int error; /* private. */
|
2009-01-13 14:01:56 +00:00
|
|
|
char *apptype; /* Malloced application type string. */
|
2003-07-01 08:34:45 +00:00
|
|
|
char *serialno; /* malloced hex string. */
|
2003-06-27 20:53:09 +00:00
|
|
|
char *disp_name; /* malloced. */
|
2003-07-24 09:06:43 +00:00
|
|
|
char *disp_lang; /* malloced. */
|
|
|
|
int disp_sex; /* 0 = unspecified, 1 = male, 2 = female */
|
2003-06-27 20:53:09 +00:00
|
|
|
char *pubkey_url; /* malloced. */
|
2003-07-24 09:06:43 +00:00
|
|
|
char *login_data; /* malloced. */
|
2006-05-23 16:19:43 +00:00
|
|
|
char *private_do[4]; /* malloced. */
|
2004-07-01 17:42:09 +00:00
|
|
|
char cafpr1valid;
|
|
|
|
char cafpr2valid;
|
|
|
|
char cafpr3valid;
|
|
|
|
char cafpr1[20];
|
|
|
|
char cafpr2[20];
|
|
|
|
char cafpr3[20];
|
2003-06-27 20:53:09 +00:00
|
|
|
char fpr1valid;
|
|
|
|
char fpr2valid;
|
|
|
|
char fpr3valid;
|
|
|
|
char fpr1[20];
|
|
|
|
char fpr2[20];
|
|
|
|
char fpr3[20];
|
2006-05-23 16:19:43 +00:00
|
|
|
u32 fpr1time;
|
|
|
|
u32 fpr2time;
|
|
|
|
u32 fpr3time;
|
2003-07-24 09:06:43 +00:00
|
|
|
unsigned long sig_counter;
|
|
|
|
int chv1_cached; /* True if a PIN is not required for each
|
|
|
|
signing. Note that the gpg-agent might cache
|
|
|
|
it anyway. */
|
2008-09-25 10:06:02 +00:00
|
|
|
int is_v2; /* True if this is a v2 card. */
|
2003-07-24 09:06:43 +00:00
|
|
|
int chvmaxlen[3]; /* Maximum allowed length of a CHV. */
|
|
|
|
int chvretry[3]; /* Allowed retries for the CHV; 0 = blocked. */
|
2009-05-15 19:26:46 +00:00
|
|
|
struct { /* Array with key attributes. */
|
|
|
|
int algo; /* Algorithm identifier. */
|
|
|
|
unsigned int nbits; /* Supported keysize. */
|
|
|
|
} key_attr[3];
|
2003-06-27 20:53:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct agent_card_genkey_s {
|
|
|
|
char fprvalid;
|
|
|
|
char fpr[20];
|
|
|
|
u32 created_at;
|
|
|
|
gcry_mpi_t n;
|
|
|
|
gcry_mpi_t e;
|
|
|
|
};
|
|
|
|
|
2003-07-23 07:11:06 +00:00
|
|
|
|
|
|
|
/* Release the card info structure. */
|
|
|
|
void agent_release_card_info (struct agent_card_info_s *info);
|
|
|
|
|
2003-06-27 20:53:09 +00:00
|
|
|
/* Return card info. */
|
|
|
|
int agent_learn (struct agent_card_info_s *info);
|
|
|
|
|
2003-09-30 17:34:38 +00:00
|
|
|
/* Update INFO with the attribute NAME. */
|
|
|
|
int agent_scd_getattr (const char *name, struct agent_card_info_s *info);
|
|
|
|
|
2003-06-27 20:53:09 +00:00
|
|
|
/* Send a SETATTR command to the SCdaemon. */
|
|
|
|
int agent_scd_setattr (const char *name,
|
2006-05-23 16:19:43 +00:00
|
|
|
const unsigned char *value, size_t valuelen,
|
|
|
|
const char *serialno);
|
2003-06-27 20:53:09 +00:00
|
|
|
|
2008-09-23 09:57:45 +00:00
|
|
|
/* Send a WRITECERT command to the SCdaemon. */
|
|
|
|
int agent_scd_writecert (const char *certidstr,
|
|
|
|
const unsigned char *certdata, size_t certdatalen);
|
|
|
|
|
2006-08-16 10:47:53 +00:00
|
|
|
/* Send a WRITEKEY command to the SCdaemon. */
|
|
|
|
int agent_scd_writekey (int keyno, const char *serialno,
|
|
|
|
const unsigned char *keydata, size_t keydatalen);
|
|
|
|
|
2003-06-27 20:53:09 +00:00
|
|
|
/* Send a GENKEY command to the SCdaemon. */
|
2006-05-23 16:19:43 +00:00
|
|
|
int agent_scd_genkey (struct agent_card_genkey_s *info, int keyno, int force,
|
2007-07-05 16:58:19 +00:00
|
|
|
const char *serialno, u32 createtime);
|
2003-06-27 20:53:09 +00:00
|
|
|
|
|
|
|
/* Send a PKSIGN command to the SCdaemon. */
|
|
|
|
int agent_scd_pksign (const char *keyid, int hashalgo,
|
|
|
|
const unsigned char *indata, size_t indatalen,
|
2006-08-16 10:47:53 +00:00
|
|
|
unsigned char **r_buf, size_t *r_buflen);
|
2003-06-27 20:53:09 +00:00
|
|
|
|
2003-07-03 18:08:16 +00:00
|
|
|
/* Send a PKDECRYPT command to the SCdaemon. */
|
|
|
|
int agent_scd_pkdecrypt (const char *serialno,
|
|
|
|
const unsigned char *indata, size_t indatalen,
|
2006-08-16 10:47:53 +00:00
|
|
|
unsigned char **r_buf, size_t *r_buflen);
|
2003-06-05 07:14:21 +00:00
|
|
|
|
2009-06-17 09:45:50 +00:00
|
|
|
/* Send a READKEY command to the SCdaemon. */
|
|
|
|
int agent_scd_readcert (const char *certidstr,
|
|
|
|
void **r_buf, size_t *r_buflen);
|
|
|
|
|
2003-07-23 07:11:06 +00:00
|
|
|
/* Change the PIN of an OpenPGP card or reset the retry counter. */
|
2006-05-23 16:19:43 +00:00
|
|
|
int agent_scd_change_pin (int chvno, const char *serialno);
|
2003-06-27 20:53:09 +00:00
|
|
|
|
2003-10-21 17:12:21 +00:00
|
|
|
/* Send the CHECKPIN command to the SCdaemon. */
|
|
|
|
int agent_scd_checkpin (const char *serialno);
|
|
|
|
|
2006-05-23 16:19:43 +00:00
|
|
|
/* Dummy function, only implemented by gpg 1.4. */
|
|
|
|
void agent_clear_pin_cache (const char *sn);
|
2003-10-21 17:12:21 +00:00
|
|
|
|
2003-06-27 20:53:09 +00:00
|
|
|
|
2006-10-04 16:45:04 +00:00
|
|
|
/* Send the GET_PASSPHRASE command to the agent. */
|
|
|
|
gpg_error_t agent_get_passphrase (const char *cache_id,
|
|
|
|
const char *err_msg,
|
|
|
|
const char *prompt,
|
|
|
|
const char *desc_msg,
|
2009-03-17 12:13:32 +00:00
|
|
|
int repeat,
|
2009-05-15 19:26:46 +00:00
|
|
|
int check,
|
2006-10-04 16:45:04 +00:00
|
|
|
char **r_passphrase);
|
|
|
|
|
|
|
|
/* Send the CLEAR_PASSPHRASE command to the agent. */
|
|
|
|
gpg_error_t agent_clear_passphrase (const char *cache_id);
|
|
|
|
|
|
|
|
|
2003-06-05 07:14:21 +00:00
|
|
|
#endif /*GNUPG_G10_CALL_AGENT_H*/
|
2003-06-27 20:53:09 +00:00
|
|
|
|