po/
[gnupg.git] / scd / card-common.h
blob78f2f60472efeed8d32334fdc304412bd1b27555
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 3 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, see <http://www.gnu.org/licenses/>.
20 #ifndef CARD_COMMON_H
21 #define CARD_COMMON_H
23 /* Declaration of private data structure used by card-p15.c */
24 struct p15private_s;
27 struct card_ctx_s {
28 int reader; /* used reader */
29 struct sc_context *ctx;
30 struct sc_card *scard;
31 struct sc_pkcs15_card *p15card; /* only if there is a pkcs15 application */
32 struct p15private_s *p15priv; /* private data used by card-p15.c */
34 struct {
35 int initialized; /* the card has been initialied and the function
36 pointers may be used. However for
37 unsupported operations the particular
38 function pointer is set to NULL */
40 int (*enum_keypairs) (CARD card, int idx,
41 unsigned char *keygrip, char **keyid);
42 int (*enum_certs) (CARD card, int idx, char **certid, int *certtype);
43 int (*read_cert) (CARD card, const char *certidstr,
44 unsigned char **cert, size_t *ncert);
45 int (*sign) (CARD card,
46 const char *keyidstr, int hashalgo,
47 int (pincb)(void*, const char *, char **),
48 void *pincb_arg,
49 const void *indata, size_t indatalen,
50 unsigned char **outdata, size_t *outdatalen );
51 int (*decipher) (CARD card, const char *keyidstr,
52 int (pincb)(void*, const char *, char **),
53 void *pincb_arg,
54 const void *indata, size_t indatalen,
55 unsigned char **outdata, size_t *outdatalen);
56 } fnc;
60 /*-- card.c --*/
61 gpg_error_t map_sc_err (int rc);
62 int card_help_get_keygrip (ksba_cert_t cert, unsigned char *array);
64 /*-- card-15.c --*/
65 void p15_release_private_data (CARD card);
67 /* constructors */
68 void card_p15_bind (CARD card);
69 void card_dinsig_bind (CARD card);
72 #endif /*CARD_COMMON_H*/