2005-10-07 Marcus Brinkmann <marcus@g10code.de>
[gnupg.git] / scd / card-common.h
blobcefaf120f4985ce931dc8e09877c4cb96af4b20c
1 /* card-common.h - Common declarations for all card types
2 * Copyright (C) 2001, 2002 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21 #ifndef CARD_COMMON_H
22 #define CARD_COMMON_H
24 /* Declaration of private data structure used by card-p15.c */
25 struct p15private_s;
28 struct card_ctx_s {
29 int reader; /* used reader */
30 struct sc_context *ctx;
31 struct sc_card *scard;
32 struct sc_pkcs15_card *p15card; /* only if there is a pkcs15 application */
33 struct p15private_s *p15priv; /* private data used by card-p15.c */
35 struct {
36 int initialized; /* the card has been initialied and the function
37 pointers may be used. However for
38 unsupported operations the particular
39 function pointer is set to NULL */
41 int (*enum_keypairs) (CARD card, int idx,
42 unsigned char *keygrip, char **keyid);
43 int (*enum_certs) (CARD card, int idx, char **certid, int *certtype);
44 int (*read_cert) (CARD card, const char *certidstr,
45 unsigned char **cert, size_t *ncert);
46 int (*sign) (CARD card,
47 const char *keyidstr, int hashalgo,
48 int (pincb)(void*, const char *, char **),
49 void *pincb_arg,
50 const void *indata, size_t indatalen,
51 unsigned char **outdata, size_t *outdatalen );
52 int (*decipher) (CARD card, const char *keyidstr,
53 int (pincb)(void*, const char *, char **),
54 void *pincb_arg,
55 const void *indata, size_t indatalen,
56 unsigned char **outdata, size_t *outdatalen);
57 } fnc;
61 /*-- card.c --*/
62 gpg_error_t map_sc_err (int rc);
63 int card_help_get_keygrip (ksba_cert_t cert, unsigned char *array);
65 /*-- card-15.c --*/
66 void p15_release_private_data (CARD card);
68 /* constructors */
69 void card_p15_bind (CARD card);
70 void card_dinsig_bind (CARD card);
73 #endif /*CARD_COMMON_H*/