]>
git.ipfire.org Git - people/ms/strongswan.git/blob - programs/pluto/smartcard.h
1 /* Support of smartcards and cryptotokens
2 * Copyright (C) 2003 Christoph Gysin, Simon Zwahlen
3 * Copyright (C) 2004 David Buechi, Michael Meier
4 * Zuercher Hochschule Winterthur
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * RCSID $Id: smartcard.h,v 1.14 2005/11/06 22:55:41 as Exp $
24 #define SCX_TOKEN "%smartcard"
25 #define SCX_CERT_CACHE_INTERVAL 60 /* seconds */
26 #define SCX_MAX_PIN_TRIALS 3
28 /* smartcard operations */
37 /* smartcard record */
39 typedef struct smartcard smartcard_t
;
59 extern const smartcard_t empty_sc
;
61 /* keep a PKCS#11 login during the lifetime of pluto
62 * flag set in plutomain.c and used in ipsec_doi.c and ocsp.c
64 extern bool pkcs11_keep_state
;
66 /* allow other applications access to pluto's PKCS#11 interface
67 * via whack. Could be used e.g. for disk encryption
69 extern bool pkcs11_proxy
;
71 extern smartcard_t
* scx_parse_number_slot_id(const char *number_slot_id
);
72 extern void scx_init(const char *module
);
73 extern void scx_finalize(void);
74 extern bool scx_establish_context(smartcard_t
*sc
);
75 extern bool scx_login(smartcard_t
*sc
);
76 extern bool scx_on_smartcard(const char *filename
);
77 extern bool scx_load_cert(const char *filename
, smartcard_t
**scp
78 , cert_t
*cert
, bool *cached
);
79 extern bool scx_verify_pin(smartcard_t
*sc
);
80 extern void scx_share(smartcard_t
*sc
);
81 extern bool scx_sign_hash(smartcard_t
*sc
, const u_char
*in
, size_t inlen
82 , u_char
*out
, size_t outlen
);
83 extern bool scx_encrypt(smartcard_t
*sc
, const u_char
*in
, size_t inlen
84 , u_char
*out
, size_t *outlen
);
85 extern bool scx_decrypt(smartcard_t
*sc
, const u_char
*in
, size_t inlen
86 , u_char
*out
, size_t *outlen
);
87 extern bool scx_op_via_whack(const char* msg
, int inbase
, int outbase
88 , sc_op_t op
, const char *keyid
, int whackfd
);
89 extern bool scx_get_pin(smartcard_t
*sc
, int whackfd
);
90 extern size_t scx_get_keylength(smartcard_t
*sc
);
91 extern smartcard_t
* scx_add(smartcard_t
*sc
);
92 extern smartcard_t
* scx_get(x509cert_t
*cert
);
93 extern void scx_release(smartcard_t
*sc
);
94 extern void scx_release_context(smartcard_t
*sc
);
95 extern void scx_free_pin(chunk_t
*pin
);
96 extern void scx_free(smartcard_t
*sc
);
97 extern void scx_list(bool utc
);
98 extern char *scx_print_slot(smartcard_t
*sc
, const char *whitespace
);
100 #endif /* _SMARTCARD_H */