chiark / gitweb /
configure.ac: Replace with a new version.
[catacomb] / passphrase.h
1 /* -*-c-*-
2  *
3  * $Id$
4  *
5  * Reading passphrases
6  *
7  * (c) 1999 Straylight/Edgeware
8  */
9
10 /*----- Licensing notice --------------------------------------------------*
11  *
12  * This file is part of Catacomb.
13  *
14  * Catacomb is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU Library General Public License as
16  * published by the Free Software Foundation; either version 2 of the
17  * License, or (at your option) any later version.
18  *
19  * Catacomb is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU Library General Public
25  * License along with Catacomb; if not, write to the Free
26  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27  * MA 02111-1307, USA.
28  */
29
30 #ifndef CATACOMB_PASSPHRASE_H
31 #define CATACOMB_PASSPHRASE_H
32
33 #ifdef __cplusplus
34   extern "C" {
35 #endif
36
37 /*----- Header files ------------------------------------------------------*/
38
39 #include <stddef.h>
40
41 /*----- Data structures ---------------------------------------------------*/
42
43 /* --- Passphrase modes --- *
44  *
45  * @PMODE_VERIFY@ requests that the passphrase be repeated to make sure it's
46  * right.
47  */
48
49 enum {
50   PMODE_READ,
51   PMODE_VERIFY
52 };
53
54 /*----- Functions provided ------------------------------------------------*/
55
56 /* --- @passphrase_connect@ ---
57  *
58  * Arguments:   @const char *sock@ = socket name to connect to, or null for
59  *                      default
60  *
61  * Returns:     Zero if OK, nonzero if it failed
62  *
63  * Use:         Attempts to connect to the passphrase pixie.
64  */
65
66 extern int passphrase_connect(const char */*sock*/);
67
68 /* --- @passphrase_read@ --- *
69  *
70  * Arguments:   @const char *tag@ = pointer to passphrase tag string
71  *              @unsigned mode@ = reading mode
72  *              @char *buf@ = pointer to destination buffer
73  *              @size_t sz@ = size of destination buffer
74  *
75  * Returns:     Zero if successful, nonzero on failure.
76  *
77  * Use:         Reads a passphrase from the user, using some system-specific
78  *              secure mechanism.  The mechanism may keep a cache of
79  *              passphrases, so the user may not necessarily be prompted.
80  */
81
82 extern int passphrase_read(const char */*tag*/, unsigned /*mode*/,
83                            char */*buf*/, size_t /*sz*/);
84
85 /* --- @passphrase_cancel@ --- *
86  *
87  * Arguments:   @const char *tag@ = pointer to passphrase tag string
88  *
89  * Returns:     ---
90  *
91  * Use:         Attempts to make the passphrase cache forget about a
92  *              particular passphrase.  This may be useful if the passphrase
93  *              turns out to be wrong, or if the user is attempting to change
94  *              the passphrase.
95  */
96
97 extern void passphrase_cancel(const char */*tag*/);
98
99 /*----- That's all, folks -------------------------------------------------*/
100
101 #ifdef __cplusplus
102   }
103 #endif
104
105 #endif